Skip to content

Commit

Permalink
decorators partially unified, processing with progress dialog, lazy d…
Browse files Browse the repository at this point in the history
…ialog showing
  • Loading branch information
PJDude committed Mar 5, 2024
1 parent e76c582 commit b81bc8e
Show file tree
Hide file tree
Showing 2 changed files with 214 additions and 75 deletions.
37 changes: 20 additions & 17 deletions src/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def __init__(self,parent,icon,bg_color,title,pre_show=None,post_close=None,min_w
self.do_command_after_show=None
self.command_on_close=None

self.focus_restore=False
self.shown_really = False

def clip_copy(self,what):
self.widget.clipboard_clear()
self.widget.clipboard_append(what)
Expand All @@ -120,6 +123,7 @@ def focusin(self):
def show(self,wait=True):
self.parent.config(cursor="watch")
self.parent.update()
self.shown_really=True

widget = self.widget

Expand Down Expand Up @@ -179,28 +183,27 @@ def hide(self,force_hide=False):
if not force_hide and self.command_on_close:
self.command_on_close()
else:
#widget.grab_release()

widget.withdraw()
if self.shown_really:
widget.withdraw()

try:
widget.update()
except Exception as e:
pass
try:
widget.update()
except Exception as e:
pass

locked_by_child[self.parent]=None
locked_by_child[self.parent]=None

if self.post_close:
self.post_close()
if self.post_close:
self.post_close()

if self.focus_restore:
if self.pre_focus:
self.pre_focus.focus_set()
else:
self.parent.focus_set()
if self.focus_restore:
if self.pre_focus:
self.pre_focus.focus_set()
else:
self.parent.focus_set()

self.wait_var.set(True)
self.parent.config(cursor="")
self.wait_var.set(True)
self.parent.config(cursor="")

class LabelDialog(GenericDialog):
def __init__(self,parent,icon,bg_color,pre_show=None,post_close=None,min_width=300,min_height=120):
Expand Down
Loading

0 comments on commit b81bc8e

Please sign in to comment.