Skip to content

Commit

Permalink
Updated code to fit new artellapipe framework
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoveda committed Nov 10, 2019
1 parent 019c27f commit 975c9a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 2 additions & 3 deletions artellapipe/tools/assetsmanager/core/assetsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from tpQtLib.widgets import stack

from artellapipe.utils import resource, worker
from artellapipe.core import tool, userinfo
from artellapipe.gui import waiter
from artellapipe.core import tool
from artellapipe.widgets import waiter, userinfo
from artellapipe.tools.assetsmanager.widgets import assetswidget

LOGGER = logging.getLogger()
Expand Down Expand Up @@ -136,7 +136,6 @@ def closeEvent(self, event):
"""

self.save_settings()
self.windowClosed.emit()
event.accept()

def show_asset_info(self, asset_widget):
Expand Down
16 changes: 11 additions & 5 deletions artellapipe/tools/assetsmanager/widgets/assetswidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@

from Qt.QtCore import *
from Qt.QtWidgets import *
from Qt.QtGui import *

from tpQtLib.core import base, qtutils

from artellapipe.core import defines
import artellapipe
from artellapipe.core import asset
from artellapipe.utils import resource

LOGGER = logging.getLogger()

Expand Down Expand Up @@ -63,13 +66,13 @@ def ui(self):
asset_splitter = QSplitter(Qt.Horizontal)
main_categories_menu_layout.addWidget(asset_splitter)

self._assets_viewer = self._project.ASSETS_VIEWER_CLASS(project=self._project, parent=self)
self._assets_viewer = artellapipe.AssetsViewer(project=self._project, parent=self)
asset_splitter.addWidget(self._assets_viewer)
self._assets_viewer.first_empty_cell()

self._categories_btn_grp = QButtonGroup(self)
self._categories_btn_grp.setExclusive(True)
asset_categories = self._project.asset_types if self._project else list()
asset_categories = artellapipe.AssetsMgr().config.get('types') or list()
self.update_asset_categories(asset_categories)

def setup_signals(self):
Expand Down Expand Up @@ -100,14 +103,17 @@ def update_asset_categories(self, asset_categories):

qtutils.clear_layout(self._categories_menu_layout)

all_asset_categories = [defines.ARTELLA_ALL_CATEGORIES_NAME]
all_asset_categories = [asset.ArtellaAssetFileStatus.ALL]
all_asset_categories.extend(asset_categories)
for category in all_asset_categories:
new_btn = QPushButton(category)
new_btn.setMinimumWidth(QFontMetrics(new_btn.font()).width(category) + 10)
new_btn.setIcon(resource.ResourceManager().icon(category.lower()))
new_btn.setCheckable(True)
self._categories_menu_layout.addWidget(new_btn)
self._categories_btn_grp.addButton(new_btn)
if category == defines.ARTELLA_ALL_CATEGORIES_NAME:
if category == asset.ArtellaAssetFileStatus.ALL:
new_btn.setIcon(resource.ResourceManager().icon('home'))
new_btn.setChecked(True)
new_btn.toggled.connect(partial(self._change_category, category))

Expand Down

0 comments on commit 975c9a9

Please sign in to comment.