Skip to content
This repository was archived by the owner on Oct 10, 2024. It is now read-only.

Commit 555a291

Browse files
authored
Merge pull request #65 from pypeclub/feature/PYPE-484_refactor_tools_gui
Feature/PYPE-484_refator_tools_gui
2 parents 2e04dc3 + c8e244f commit 555a291

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+344
-1434
lines changed

avalon/tools/_views/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

avalon/tools/_widgets/__init__.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

avalon/tools/cbloader/app.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
from ... import api, io, style
66
from .. import lib
77

8-
from .._models import AssetModel
9-
from .._models.lib import (
10-
refresh_family_config,
11-
refresh_group_config,
12-
get_active_group_config,
8+
from ..gui.models import AssetModel
9+
from ..gui.widgets import (
10+
SubsetsWidget, VersionWidget, FamiliesListWidget, AssetsWidget
1311
)
14-
from .._widgets import (
15-
SubsetWidget, VersionWidget, FamilyListWidget, AssetWidget
12+
from ..gui.lib import refresh_family_config
13+
from ..gui.models.lib import (
14+
refresh_group_config,
15+
get_active_group_config
1616
)
17-
from .._widgets.lib import preserve_selection
17+
from ..gui.widgets.lib import preserve_selection
1818

1919
module = sys.modules[__name__]
2020
module.window = None
@@ -43,9 +43,9 @@ def __init__(self, parent=None):
4343

4444
container = QtWidgets.QWidget()
4545

46-
assets = AssetWidget(silo_creatable=False)
47-
families = FamilyListWidget()
48-
subsets = SubsetWidget(parent=self)
46+
assets = AssetsWidget(silo_creatable=False)
47+
families = FamiliesListWidget()
48+
subsets = SubsetsWidget(parent=self)
4949
version = VersionWidget()
5050

5151
# Create splitter to show / hide family filters
@@ -255,7 +255,7 @@ def _set_context(self, context, refresh=True):
255255
self._refresh()
256256

257257
asset_widget = self.data['model']['assets']
258-
asset_widget.select_assets([asset], expand=True)
258+
asset_widget.select_assets(asset)
259259

260260
def echo(self, message):
261261
widget = self.data["label"]["message"]

avalon/tools/cbloader/lib.py

Lines changed: 0 additions & 181 deletions
This file was deleted.

avalon/tools/cbsceneinventory/app.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
import logging
4+
import collections
45
from functools import partial
56
import re
67

@@ -9,19 +10,16 @@
910
from ... import io, api, style
1011
from .. import lib as tools_lib
1112

12-
# todo(roy): refactor loading from other tools
13-
from ..projectmanager.widget import (
13+
from ..gui.delegates import VersionDelegate
14+
from ..gui.models import FilterProxyModel, InventoryModel
15+
16+
from ..gui.lib import refresh_family_config
17+
from ..gui.widgets.lib import (
1418
preserve_expanded_rows,
1519
preserve_selection,
16-
_iter_model_rows,
20+
_iter_model_rows
1721
)
18-
from .._delegates import VersionDelegate
19-
from ..cbloader.lib import refresh_family_config
20-
21-
from .proxy import FilterProxyModel
22-
from .model import InventoryModel
2322
from .lib import switch_item
24-
import collections
2523

2624
DEFAULT_COLOR = "#fb9c15"
2725

avalon/tools/cbsceneinventory/lib.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from avalon import io, api
1+
from ... import io, api
22

33

44
def switch_item(container,
@@ -71,14 +71,3 @@ def switch_item(container,
7171
api.switch(container, representation)
7272

7373
return representation
74-
75-
76-
def walk_hierarchy(node):
77-
"""Recursively yield group node
78-
"""
79-
for child in node.children():
80-
if child.get("isGroupNode"):
81-
yield child
82-
83-
for _child in walk_hierarchy(child):
84-
yield _child

avalon/tools/contextmanager/app.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import sys
22
import logging
33

4-
import avalon.api as api
5-
6-
from avalon.vendor.Qt import QtWidgets, QtCore
7-
from .._widgets import AssetWidget
8-
from .._models import TasksModel
4+
from ... import api
95

6+
from ...vendor.Qt import QtWidgets, QtCore
7+
from ..gui.widgets import AssetsWidget
8+
from ..gui.models import TaskModel
109

1110
module = sys.modules[__name__]
1211
module.window = None
1312

14-
1513
log = logging.getLogger(__name__)
1614

1715

@@ -33,15 +31,15 @@ def __init__(self, parent=None):
3331
accept_btn = QtWidgets.QPushButton("Accept")
3432

3533
# Asset picker
36-
assets = AssetWidget(silo_creatable=False)
34+
assets = AssetsWidget(silo_creatable=False)
3735

3836
# Task picker
3937
tasks_widgets = QtWidgets.QWidget()
4038
tasks_widgets.setContentsMargins(0, 0, 0, 0)
4139
tasks_layout = QtWidgets.QVBoxLayout(tasks_widgets)
4240
task_view = QtWidgets.QTreeView()
4341
task_view.setIndentation(0)
44-
task_model = TasksModel()
42+
task_model = TaskModel()
4543
task_view.setModel(task_model)
4644
tasks_layout.addWidget(task_view)
4745
tasks_layout.addWidget(accept_btn)
@@ -188,7 +186,7 @@ def select_asset(self, assetname):
188186
Returns:
189187
None
190188
"""
191-
self._assets.select_assets([assetname], expand=True)
189+
self._assets.select_assets(assetname)
192190

193191

194192
def show(parent=None):

avalon/tools/gui/__init__.py

Whitespace-only changes.
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
from ...vendor.Qt import QtWidgets, QtCore
2-
from ... import io
1+
from . import lib
32

43
from .delegate_pretty_time import PrettyTimeDelegate
54
from .delegate_version import VersionDelegate
5+
6+
__all__ = [
7+
"lib",
8+
9+
"PrettyTimeDelegate",
10+
"VersionDelegate"
11+
]

avalon/tools/_delegates/delegate_pretty_time.py renamed to avalon/tools/gui/delegates/delegate_pretty_time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from . import QtWidgets
1+
from ....vendor.Qt import QtWidgets
22
from .lib import pretty_timestamp
33

44

0 commit comments

Comments
 (0)