Skip to content

Commit

Permalink
Fixed description control
Browse files Browse the repository at this point in the history
  • Loading branch information
nishimura5 committed Nov 19, 2024
1 parent 3eb349e commit 0bc3b88
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/gui_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,12 @@ def rename_item(self):
self.tree.item(item, values=values)

def scene_table_add(self, min_time_str, max_time_str):
dialog = SceneTableTreeDialog(self, self.member_list, [min_time_str, max_time_str], "new_scene")
dialog = SceneTableTreeDialog(self, self.member_list, [min_time_str, max_time_str])
self.wait_window(dialog)
new_member = dialog.selected_member
new_timespan = dialog.new_timespan
new_description = dialog.new_description

# search description in tree
descriptions = [self.tree.item(item)["values"][4] for item in self.tree.get_children("")]
for i in range(1, 100):
if new_description not in descriptions:
break
if new_description + str(i) not in descriptions:
new_description = new_description + str(i)
break
new_description = self.fix_description(new_description)

if new_member is None:
return
Expand All @@ -162,6 +154,7 @@ def scene_table_edit(self):
new_member = dialog.selected_member
new_timespan = dialog.new_timespan
new_description = dialog.new_description
new_description = self.fix_description(new_description)

if new_member is None:
return
Expand All @@ -179,6 +172,11 @@ def scene_table_edit(self):
values[4] = new_description
self.tree.item(item, values=values)

def fix_description(self, description):
if description == "":
return "untitled"
return description

def scene_table_copy(self):
selected = self.tree.selection()
if len(selected) == 0:
Expand Down

0 comments on commit 0bc3b88

Please sign in to comment.