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

Make debug and show behaviour consistent for all tools #513

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Make closing/deleting window consistent
  • Loading branch information
jasperges committed Feb 6, 2020
commit 64bdd0264f18b033937936b26dbcbcfec52d7d93
6 changes: 4 additions & 2 deletions avalon/tools/creator/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,11 @@ def show(debug=False, parent=None):

"""

if module.window:
try:
module.window.close()
del(module.window)
del module.window
except (RuntimeError, AttributeError):
pass

with lib.application():
window = Window(parent)
Expand Down
25 changes: 5 additions & 20 deletions avalon/tools/loader/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,26 +385,11 @@ def show(debug=False, parent=None, use_context=False):

"""

# Remember window
if module.window is not None:
try:
module.window.show()

# If the window is minimized then unminimize it.
if module.window.windowState() & QtCore.Qt.WindowMinimized:
module.window.setWindowState(QtCore.Qt.WindowActive)

# Raise and activate the window
module.window.raise_() # for MacOS
module.window.activateWindow() # for Windows
module.window.refresh()
return
except RuntimeError as e:
if not str(e).rstrip().endswith("already deleted."):
raise

# Garbage collected
module.window = None
try:
module.window.close()
del module.window
except (RuntimeError, AttributeError):
pass

with lib.application():

Expand Down
6 changes: 5 additions & 1 deletion avalon/tools/workfiles/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,12 @@ def show(root=None, debug=False, parent=None):
to this QObject.

"""

try:
module.window.close()
del(module.window)
del module.window
except (RuntimeError, AttributeError):
pass

host = api.registered_host()
if host is None:
Expand Down