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
Next Next commit
Make debug behaviour consistent
  • Loading branch information
jasperges committed Jan 16, 2020
commit 5c232e3f6aa61e7e100b035a94cbd4db61db703b
6 changes: 5 additions & 1 deletion avalon/tools/contextmanager/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def select_asset(self, assetname):
self._assets.select_assets([assetname], expand=True)


def show(parent=None):
def show(parent=None, debug=False):

from avalon import style
from ...tools import lib
Expand All @@ -221,6 +221,10 @@ def show(parent=None):
except (RuntimeError, AttributeError):
pass

if debug:
import traceback
sys.excepthook = lambda typ, val, tb: traceback.print_last()

with lib.application():
window = App(parent)
window.show()
Expand Down
14 changes: 0 additions & 14 deletions avalon/tools/creator/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,23 +569,9 @@ def show(debug=False, parent=None):
del(module.window)

if debug:
from avalon import mock
for creator in mock.creators:
api.register_plugin(api.Creator, creator)

import traceback
sys.excepthook = lambda typ, val, tb: traceback.print_last()

io.install()

any_project = next(
project for project in io.projects()
if project.get("active", True) is not False
)

api.Session["AVALON_PROJECT"] = any_project["name"]
module.project = any_project["name"]

with lib.application():
window = Window(parent)
window.refresh()
Expand Down
5 changes: 3 additions & 2 deletions avalon/tools/projectmanager/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ def show(root=None, debug=False, parent=None):
except (RuntimeError, AttributeError):
pass

if debug is True:
io.install()
if debug:
import traceback
sys.excepthook = lambda typ, val, tb: traceback.print_last()

with tools_lib.application():
window = Window(parent)
Expand Down
4 changes: 2 additions & 2 deletions avalon/tools/workfiles/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ def show(root=None, debug=False, parent=None):
raise OSError("Root set for Work Files app does not exist: %s" % root)

if debug:
api.Session["AVALON_ASSET"] = "Mock"
api.Session["AVALON_TASK"] = "Testing"
import traceback
sys.excepthook = lambda typ, val, tb: traceback.print_last()

with tools_lib.application():
window = Window(root, parent=parent)
Expand Down