Merge pull request #798 from pypeclub/bugfix/launcher_actions_update

Launcher actions update
This commit is contained in:
Milan Kolar 2020-12-11 12:45:13 +01:00 committed by GitHub
commit 8aa5b1362d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View file

@ -129,10 +129,6 @@ class ActionModel(QtGui.QStandardItemModel):
def discover(self):
"""Set up Actions cache. Run this for each new project."""
if not self.dbcon.Session.get("AVALON_PROJECT"):
self._registered_actions = list()
return
# Discover all registered actions
actions = api.discover(api.Action)
@ -144,6 +140,9 @@ class ActionModel(QtGui.QStandardItemModel):
def get_application_actions(self):
actions = []
if not self.dbcon.Session.get("AVALON_PROJECT"):
return actions
project_doc = self.dbcon.find_one({"type": "project"})
if not project_doc:
return actions
@ -185,6 +184,8 @@ class ActionModel(QtGui.QStandardItemModel):
self._groups.clear()
self.discover()
actions = self.filter_compatible_actions(self._registered_actions)
self.beginResetModel()

View file

@ -186,6 +186,7 @@ class AssetsPanel(QtWidgets.QWidget):
# signals
project_bar.project_changed.connect(self.on_project_changed)
assets_widget.selection_changed.connect(self.on_asset_changed)
assets_widget.refreshed.connect(self.on_asset_changed)
btn_back.clicked.connect(self.back_clicked)
# Force initial refresh for the assets since we might not be
@ -206,9 +207,6 @@ class AssetsPanel(QtWidgets.QWidget):
self.dbcon.Session["AVALON_PROJECT"] = project_name
self.assets_widget.refresh()
# Force asset change callback to ensure tasks are correctly reset
self.assets_widget.refreshed.connect(self.on_asset_changed)
def on_asset_changed(self):
"""Callback on asset selection changed