Skip to content

Commit a6d5316

Browse files
LiametcJoseph Yu
authored and
Joseph Yu
committed
Feature/summary display (#6)
* Adding better formatting to publish dialog for summaries. * Doc string added
1 parent f4f8a9d commit a6d5316

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

python/tk_multi_publish2/dialog.py

+1
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ def _create_item_details(self, tree_item):
696696

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

701702
self.ui.item_summary.setText(summary_text)

python/tk_multi_publish2/publish_tree_widget/tree_node_item.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@ def __repr__(self):
7373
def __str__(self):
7474
return "%s %s" % (self._item.type_display, self._item.name)
7575

76-
def create_summary(self):
76+
def create_summary(self, level=0):
7777
"""
7878
Creates summary of actions
7979
80+
:param level: Indentation level of this item lives within the tree.
81+
:type level: int
82+
8083
:returns: List of strings
8184
"""
8285
if self.checked:
@@ -91,16 +94,23 @@ def create_summary(self):
9194
task_summaries.extend(child_item.create_summary())
9295
else:
9396
# sub-items
94-
items_summaries.extend(child_item.create_summary())
97+
items_summaries.extend(child_item.create_summary(level + 1))
9598

9699
summary = []
97100

98101
if len(task_summaries) > 0:
99102

100-
summary_str = "<b>%s</b><br>" % self.item.name
101-
summary_str += "<br>".join(
102-
["&ndash; %s" % task_summary for task_summary in task_summaries]
103+
summary_str = "<ul><li>" * level
104+
summary_str += "<b>%s</b>" % self.item.name
105+
summary_str += '<ul style="list-style-type:circle;">'
106+
summary_str += "".join(
107+
[
108+
"<li><i>%s</i></li>" % task_summary
109+
for task_summary in task_summaries
110+
]
103111
)
112+
summary_str += "</ul>"
113+
summary_str += "</li></ul>" * level
104114
summary.append(summary_str)
105115

106116
summary.extend(items_summaries)

0 commit comments

Comments
 (0)