Skip to content

Commit dbeb3a4

Browse files
LiametcJoseph Yu
authored andcommitted
Feature/summary display (#6)
* Adding better formatting to publish dialog for summaries. * Doc string added
1 parent a2f0e40 commit dbeb3a4

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

python/tk_multi_publish2/dialog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ def _create_item_details(self, tree_item):
649649

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

654655
self.ui.item_summary.setText(summary_text)

python/tk_multi_publish2/publish_tree_widget/tree_node_item.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,13 @@ def __repr__(self):
6363
def __str__(self):
6464
return "%s %s" % (self._item.type_display, self._item.name)
6565

66-
def create_summary(self):
66+
def create_summary(self, level=0):
6767
"""
6868
Creates summary of actions
6969
70+
:param level: Indentation level of this item lives within the tree.
71+
:type level: int
72+
7073
:returns: List of strings
7174
"""
7275
if self.checked:
@@ -81,16 +84,23 @@ def create_summary(self):
8184
task_summaries.extend(child_item.create_summary())
8285
else:
8386
# sub-items
84-
items_summaries.extend(child_item.create_summary())
87+
items_summaries.extend(child_item.create_summary(level + 1))
8588

8689
summary = []
8790

8891
if len(task_summaries) > 0:
8992

90-
summary_str = "<b>%s</b><br>" % self.item.name
91-
summary_str += "<br>".join(
92-
["&ndash; %s" % task_summary for task_summary in task_summaries]
93+
summary_str = "<ul><li>" * level
94+
summary_str += "<b>%s</b>" % self.item.name
95+
summary_str += '<ul style="list-style-type:circle;">'
96+
summary_str += "".join(
97+
[
98+
"<li><i>%s</i></li>" % task_summary
99+
for task_summary in task_summaries
100+
]
93101
)
102+
summary_str += "</ul>"
103+
summary_str += "</li></ul>" * level
94104
summary.append(summary_str)
95105

96106
summary.extend(items_summaries)

0 commit comments

Comments
 (0)