Skip to content

Commit

Permalink
select on right click;
Browse files Browse the repository at this point in the history
  • Loading branch information
hakaishi committed Nov 13, 2020
1 parent 1126be2 commit ada9396
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,17 @@ def __init__(self):
try:
func, args = self._q.get(block=False)
except Empty:
if not self.quitting and self.winfo_exists():
self.update()
sleep(0.1)
self.update()
else:
if func:
if args is None:
func(self)
else:
func(self, *args)
self.update()
if not self.quitting and self.winfo_exists():
self.update()
self._q.task_done()

def update_main_thread_from_thread(self, func, args=None):
Expand Down Expand Up @@ -482,11 +484,15 @@ def fill(self, event=None):
def context(self, e):
"""create a context menu"""
self.ctx = Menu(self, tearoff=False)
# iid = self.tree.identify_row(e.y)
under_cursor = self.tree.identify_row(e.y)
sel = list(self.tree.selection())
if len(sel) > 0 and self.tree.item(sel[0], "text") == "..":
sel.pop(0)

if under_cursor not in sel and self.tree.item(under_cursor, "text") != "..":
self.tree.selection_clear()
self.tree.selection_set(under_cursor)

if len(sel) > 0:
selection = []
for s in sel:
Expand Down

0 comments on commit ada9396

Please sign in to comment.