Skip to content

Commit

Permalink
Merge remote-tracking branches 'origin/word-wrap-message-label', 'ori…
Browse files Browse the repository at this point in the history
…gin/PIPE-286-fix-no-tasks-text', 'origin/pyqt-remove-checkstate-prefix', 'origin/feature/summary_display', 'origin/fix-qicon-for-pyqt' and 'origin/texture-extensions'
  • Loading branch information
Joseph Yu committed Jun 15, 2021
6 parents 5d05f4a + 65fe51a + 2a9cd2c + e5bd07e + 2bd3ba1 + 95fec44 commit 38aa505
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion hooks/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def common_file_info(self):
"item_type": "file.image",
},
"Texture Image": {
"extensions": ["tif", "tiff", "tx", "tga", "dds", "rat"],
"extensions": ["tif", "tiff", "tex", "tx", "tga", "dds", "rat"],
"icon": self._get_icon_path("texture.png"),
"item_type": "file.texture",
},
Expand Down
2 changes: 1 addition & 1 deletion hooks/publish_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def settings(self):
["Photoshop Image", "psd", "psb"],
["VRED Scene", "vpb", "vpe", "osb"],
["Rendered Image", "dpx", "exr"],
["Texture", "tiff", "tx", "tga", "dds"],
["Texture", "tif", "tiff", "tex", "tx", "tga", "dds"],
["Image", "jpeg", "jpg", "png"],
["Movie", "mov", "mp4"],
["PDF", "pdf"],
Expand Down
3 changes: 2 additions & 1 deletion python/tk_multi_publish2/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ def _create_item_details(self, tree_item):

else:
summary_text = "<p>The following items will be processed:</p>"
summary_text += "<style>ul { margin-left:-20px; }</style>"
summary_text += "".join(["<p>%s</p>" % line for line in summary])

self.ui.item_summary.setText(summary_text)
Expand Down Expand Up @@ -880,7 +881,7 @@ def _on_drop(self, files):
self._overlay.show_loading()
self.ui.button_container.hide()
new_items = self._publish_manager.collect_files(str_files)
num_items_created = len(new_items)
num_items_created = len([item for item in new_items if item.tasks])
num_errors = self._progress_handler.pop()

if num_errors == 0 and num_items_created == 0:
Expand Down
13 changes: 13 additions & 0 deletions python/tk_multi_publish2/progress/progress_details_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ def show(self):
self.__recompute_position()
self.ui.log_tree.expandAll()

# Scroll to last item by default
def last_by_breadth_depth(item):
if item.childCount():
last_child = item.child(item.childCount())
if last_child:
return last_by_breadth_depth(last_child)
return item

self.ui.log_tree.scrollToItem(
last_by_breadth_depth(self.ui.log_tree.invisibleRootItem()),
QtGui.QAbstractItemView.PositionAtCenter,
)

@property
def log_tree(self):
"""
Expand Down
6 changes: 3 additions & 3 deletions python/tk_multi_publish2/progress/progress_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def process_log_message(self, message, status, action):
item.setText(0, message)

if icon:
item.setIcon(0, icon)
item.setIcon(0, QtGui.QIcon(icon))

if self._logging_parent_item:
self._logging_parent_item.addChild(item)
Expand Down Expand Up @@ -278,11 +278,11 @@ def push(self, text, icon=None, publish_instance=None):
self._logging_parent_item.addChild(item)

if icon:
item.setIcon(0, icon)
item.setIcon(0, QtGui.QIcon(icon))
self._icon_label.setPixmap(icon)
elif self._current_phase:
std_icon = self._icon_lookup[self._current_phase]
item.setIcon(0, std_icon)
item.setIcon(0, QtGui.QIcon(std_icon))
self._icon_label.setPixmap(std_icon)

self._progress_details.log_tree.setCurrentItem(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def nextCheckState(self):
"""
# Qt tri-state logic is a little odd. The default behaviour is to go from unchecked
# to partially checked. We want it to go from unchecked to checked
if self.ui.checkbox.checkState() == QtCore.Qt.CheckState.Checked:
next_state = QtCore.Qt.CheckState.Unchecked
if self.ui.checkbox.checkState() == QtCore.Qt.Checked:
next_state = QtCore.Qt.Unchecked
else:
next_state = QtCore.Qt.CheckState.Checked
next_state = QtCore.Qt.Checked
self.ui.checkbox.setCheckState(next_state)
self._tree_node.set_check_state(next_state)

Expand Down
24 changes: 17 additions & 7 deletions python/tk_multi_publish2/publish_tree_widget/tree_node_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ def __repr__(self):
def __str__(self):
return "%s %s" % (self._item.type_display, self._item.name)

def create_summary(self):
def create_summary(self, level=0):
"""
Creates summary of actions
:param level: Indentation level of this item lives within the tree.
:type level: int
:returns: List of strings
"""
if self.checked:
Expand All @@ -91,16 +94,23 @@ def create_summary(self):
task_summaries.extend(child_item.create_summary())
else:
# sub-items
items_summaries.extend(child_item.create_summary())
items_summaries.extend(child_item.create_summary(level + 1))

summary = []

if len(task_summaries) > 0:

summary_str = "<b>%s</b><br>" % self.item.name
summary_str += "<br>".join(
["&ndash; %s" % task_summary for task_summary in task_summaries]
summary_str = "<ul><li>" * level
summary_str += "<b>%s</b>" % self.item.name
summary_str += '<ul style="list-style-type:circle;">'
summary_str += "".join(
[
"<li><i>%s</i></li>" % task_summary
for task_summary in task_summaries
]
)
summary_str += "</ul>"
summary_str += "</li></ul>" * level
summary.append(summary_str)

summary.extend(items_summaries)
Expand Down Expand Up @@ -227,7 +237,7 @@ def double_clicked(self, column):
else:
icon = self._expanded_icon

self._embedded_widget.expand_indicator.setIcon(icon)
self._embedded_widget.expand_indicator.setIcon(QtGui.QIcon(icon))

def _check_expand_state(self):
"""
Expand All @@ -240,7 +250,7 @@ def _check_expand_state(self):
else:
icon = self._collapsed_icon

self._embedded_widget.expand_indicator.setIcon(icon)
self._embedded_widget.expand_indicator.setIcon(QtGui.QIcon(icon))


class TopLevelTreeNodeItem(TreeNodeItem):
Expand Down

0 comments on commit 38aa505

Please sign in to comment.