Commit 34b0e1c1573ac3e3807a129feed851c0e9bde696
1 parent
4688fe1b
Exists in
master
and in
6 other branches
ENH: Progress dialog while generating multiplanar (removed cancel)
Showing
3 changed files
with
12 additions
and
7 deletions
Show diff stats
invesalius/control.py
... | ... | @@ -261,7 +261,7 @@ class Controller(): |
261 | 261 | if (data): |
262 | 262 | if not(self.progress_dialog): |
263 | 263 | self.progress_dialog = dialog.ProgressDialog( |
264 | - maximum = data[1]) | |
264 | + maximum = data[1], abort=1) | |
265 | 265 | else: |
266 | 266 | if not(self.progress_dialog.Update(data[0],message)): |
267 | 267 | self.progress_dialog.Close() | ... | ... |
invesalius/gui/dialogs.py
... | ... | @@ -90,19 +90,20 @@ def ShowNumberDialog(message, value=0): |
90 | 90 | |
91 | 91 | |
92 | 92 | class ProgressDialog(object): |
93 | - def __init__(self, maximum): | |
93 | + def __init__(self, maximum, abort=False): | |
94 | 94 | self.title = "InVesalius 3" |
95 | 95 | self.msg = _("Loading DICOM files") |
96 | 96 | self.maximum = maximum |
97 | 97 | self.current = 0 |
98 | - self.style = wx.PD_CAN_ABORT | wx.PD_APP_MODAL | |
98 | + self.style = wx.PD_APP_MODAL | |
99 | + if abort: | |
100 | + self.style = wx.PD_APP_MODAL | wx.PD_CAN_ABORT | |
101 | + | |
99 | 102 | self.dlg = wx.ProgressDialog(self.title, |
100 | 103 | self.msg, |
101 | 104 | maximum = self.maximum, |
102 | 105 | parent = None, |
103 | - style = wx.PD_CAN_ABORT | |
104 | - | wx.PD_APP_MODAL, | |
105 | - ) | |
106 | + style = self.style) | |
106 | 107 | |
107 | 108 | self.dlg.Bind(wx.EVT_BUTTON, self.Cancel) |
108 | 109 | self.dlg.SetSize(wx.Size(250,150)) | ... | ... |
invesalius/gui/frame.py
... | ... | @@ -93,7 +93,11 @@ class Frame(wx.Frame): |
93 | 93 | ps.Publisher().subscribe(self.HideContentPanel, 'Hide content panel') |
94 | 94 | |
95 | 95 | def EndBusyCursor(self, pubsub_evt=None): |
96 | - wx.EndBusyCursor() | |
96 | + try: | |
97 | + wx.EndBusyCursor() | |
98 | + except wx._core.PyAssertionError: | |
99 | + #xEndBusyCursor(): no matching wxBeginBusyCursor() for wxEndBusyCursor() | |
100 | + pass | |
97 | 101 | |
98 | 102 | def BeginBusyCursor(self, pubsub_evt=None): |
99 | 103 | wx.BeginBusyCursor() | ... | ... |