diff --git a/invesalius/control.py b/invesalius/control.py index ebcf206..674c08d 100755 --- a/invesalius/control.py +++ b/invesalius/control.py @@ -261,7 +261,7 @@ class Controller(): if (data): if not(self.progress_dialog): self.progress_dialog = dialog.ProgressDialog( - maximum = data[1]) + maximum = data[1], abort=1) else: if not(self.progress_dialog.Update(data[0],message)): self.progress_dialog.Close() diff --git a/invesalius/gui/dialogs.py b/invesalius/gui/dialogs.py index a61a77e..0aa949d 100644 --- a/invesalius/gui/dialogs.py +++ b/invesalius/gui/dialogs.py @@ -90,19 +90,20 @@ def ShowNumberDialog(message, value=0): class ProgressDialog(object): - def __init__(self, maximum): + def __init__(self, maximum, abort=False): self.title = "InVesalius 3" self.msg = _("Loading DICOM files") self.maximum = maximum self.current = 0 - self.style = wx.PD_CAN_ABORT | wx.PD_APP_MODAL + self.style = wx.PD_APP_MODAL + if abort: + self.style = wx.PD_APP_MODAL | wx.PD_CAN_ABORT + self.dlg = wx.ProgressDialog(self.title, self.msg, maximum = self.maximum, parent = None, - style = wx.PD_CAN_ABORT - | wx.PD_APP_MODAL, - ) + style = self.style) self.dlg.Bind(wx.EVT_BUTTON, self.Cancel) self.dlg.SetSize(wx.Size(250,150)) diff --git a/invesalius/gui/frame.py b/invesalius/gui/frame.py index 4368799..ec8d0a7 100755 --- a/invesalius/gui/frame.py +++ b/invesalius/gui/frame.py @@ -93,7 +93,11 @@ class Frame(wx.Frame): ps.Publisher().subscribe(self.HideContentPanel, 'Hide content panel') def EndBusyCursor(self, pubsub_evt=None): - wx.EndBusyCursor() + try: + wx.EndBusyCursor() + except wx._core.PyAssertionError: + #xEndBusyCursor(): no matching wxBeginBusyCursor() for wxEndBusyCursor() + pass def BeginBusyCursor(self, pubsub_evt=None): wx.BeginBusyCursor() -- libgit2 0.21.2