Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy/deprecated App code from pywin.framework.app #2144

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/app/basictimerapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import win32api
import win32con
import win32ui
from pywin.framework import cmdline, dlgappcore
from pywin.framework import dlgappcore


class TimerAppDialog(dlgappcore.AppDialog):
Expand Down
1 change: 0 additions & 1 deletion Pythonwin/pywin/Demos/app/customprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# This sample was contributed by Roger Burnham.

import win32api
import win32con
import win32ui
from pywin.framework import app
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/Demos/app/dlgappdemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys

import win32ui
from pywin.framework import app, dlgappcore
from pywin.framework import dlgappcore


class TestDialogApp(dlgappcore.DialogApp):
Expand Down Expand Up @@ -43,7 +43,7 @@ def write(self, str):
win32ui.OutputDebug("dlgapp - no edit control! >>\n%s\n<<\n" % str)


app.AppBuilder = TestDialogApp
app = TestDialogApp()

if __name__ == "__main__":
import demoutils
Expand Down
5 changes: 2 additions & 3 deletions Pythonwin/pywin/Demos/app/dojobapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
# pythonwin /app demos\dojobapp.py


import win32api
import win32con
import win32ui
from pywin.framework import app, dlgappcore
from pywin.framework import dlgappcore


class DoJobAppDialog(dlgappcore.AppDialog):
Expand Down Expand Up @@ -57,7 +56,7 @@ def __init__(self):
DoJobDialogApp.__init__(self)


app.AppBuilder = DoJobDialogApp
app = DoJobDialogApp()


def t():
Expand Down
28 changes: 0 additions & 28 deletions Pythonwin/pywin/framework/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# App.py
# Application stuff.
# The application is responsible for managing the main frame window.
#
Expand All @@ -17,29 +16,6 @@

from . import scriptutils

## NOTE: App and AppBuild should NOT be used - instead, you should contruct your
## APP class manually whenever you like (just ensure you leave these 2 params None!)
## Whoever wants the generic "Application" should get it via win32iu.GetApp()

# These are "legacy"
AppBuilder = None
App = None # default - if used, must end up a CApp derived class.


# Helpers that should one day be removed!
def AddIdleHandler(handler):
print(
"app.AddIdleHandler is deprecated - please use win32ui.GetApp().AddIdleHandler() instead."
)
return win32ui.GetApp().AddIdleHandler(handler)


def DeleteIdleHandler(handler):
print(
"app.DeleteIdleHandler is deprecated - please use win32ui.GetApp().DeleteIdleHandler() instead."
)
return win32ui.GetApp().DeleteIdleHandler(handler)


# Helper for writing a Window position by name, and later loading it.
def SaveWindowSize(section, rect, state=""):
Expand Down Expand Up @@ -169,10 +145,6 @@ def ExitInstance(self):
if self._obj_:
self._obj_.AttachObject(None)
self._obj_ = None
global App
global AppBuilder
App = None
AppBuilder = None
return 0

def HaveIdleHandler(self, handler):
Expand Down
4 changes: 0 additions & 4 deletions Pythonwin/pywin/framework/intpyapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,4 @@ def OnHelpIndex(self, id, code):
help.SelectAndRunHelpFile()


# As per the comments in app.py, this use is depreciated.
# app.AppBuilder = InteractivePythonApp

# Now all we do is create the application
thisApp = InteractivePythonApp()
14 changes: 0 additions & 14 deletions Pythonwin/pywin/framework/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,3 @@

# Import the application module.
__import__(moduleName)

try:
win32ui.GetApp()._obj_
# This worked - an app already exists - do nothing more
except (AttributeError, win32ui.error):
# This means either no app object exists at all, or the one
# that does exist does not have a Python class (ie, was created
# by the host .EXE). In this case, we do the "old style" init...
from . import app

if app.AppBuilder is None:
raise TypeError("No application object has been registered")

app.App = app.AppBuilder()