Пример #1
0
 def CleanUp(self):
     #self._remove_mask()
     Publisher.unsubscribe(self.expand_watershed, 'Expand watershed to 3D ' + self.orientation)
     Publisher.unsubscribe(self.set_operation, 'Set watershed operation')
     self.RemoveAllObservers()
     self.viewer.slice_.to_show_aux = ''
     self.viewer.OnScrollBar()
Пример #2
0
 def UdpListenerStopped(self):
     global playerCount
     self.udpListening = False
     Publisher.unsubscribe(self.UdpListenerStopped, 'listener_stop')
     Publisher.unsubscribe(self.HostFound, 'host_found')
     print "Number of players found: ", playerCount
     if self.hostSearch:
         self.hostSearch = False
         if playerCount == 0:
             self.prgDialog.Update(100)
             if HOST_SYS == HOST_WIN:
                 self.prgDialog.Destroy()
             #dlg = wx.SingleChoiceDialog(self,wordwrap(tr("no_players_found"), 300, wx.ClientDC(self)), tr("no_player"), [tr("rescan"), tr("exit")])
             dlg = wx.MessageDialog(self,
                                    wordwrap(tr("no_players_found"), 300,
                                             wx.ClientDC(self)),
                                    tr("no_player"),
                                    style=wx.YES_NO)
             result = dlg.ShowModal()
             #selection = dlg.GetSelection()
             # print "RESULT: ", result
             if result == wx.ID_YES:
                 #if selection == 0: # RESCAN
                 self.SearchHosts()
                 #elif selection == 1:
                 #   pass
                 #elif selection == 1: # EXIT
                 #    self.Close()
             elif result == wx.ID_NO:
                 # print "Cancel clicked, terminating program, bye bye..."
                 self.Close()
         else:
             # sort hosts by hostname
             self.SortHostList()
             self.WaitForUSB()
Пример #3
0
    def _upload_complete(self, sample=None):
        """Update the display when the upload has been completed.

        This method will set the progress bar to it's maximum value and show
        text of 100% when the run.upload_completed_topic is received.
        """
        if sample:
            logging.info("Upload completed for sample {}".format(
                sample.get_id()))
            sample_panel = self._sample_panels[sample.get_id()]

            # Move the completed sample to the bottom of the list.
            sample_panel.HideWithEffect(wx.SHOW_EFFECT_BLEND)
            self._sizer.Detach(sample_panel)
            self._sizer.Add(sample_panel,
                            flag=wx.EXPAND | wx.LEFT | wx.RIGHT,
                            border=5)
            sample_panel.ShowWithEffect(wx.SHOW_EFFECT_BLEND)
            self.Layout()
        else:
            logging.info("Upload completed for run {}".format(
                self._run.upload_started_topic))
            pub.unsubscribe(self._handle_progress,
                            self._run.upload_progress_topic)
            pub.unsubscribe(self._upload_complete,
                            self._run.upload_completed_topic)

            self.Freeze()
            self._progress.SetValue(self._progress.GetRange())
            self._progress_text.SetLabel("100%")
            self._timer.Stop()
            self.Layout()
            self.Thaw()
Пример #4
0
 def __del__(self):
     """
     
         Actions necessary on scan event deletion.
     
     """
     pub.unsubscribe(self.stop, "scan.stop")
Пример #5
0
 def UdpListenerStopped(self):
     global playerCount
     self.udpListening = False
     Publisher.unsubscribe(self.UdpListenerStopped, "listener_stop")
     Publisher.unsubscribe(self.HostFound, "host_found")
     print "Number of players found: ", playerCount
     if self.hostSearch:
         self.hostSearch = False
         if playerCount == 0:
             self.prgDialog.Update(100)
             if HOST_SYS == HOST_WIN:
                 self.prgDialog.Destroy()
             # dlg = wx.SingleChoiceDialog(self,wordwrap(tr("no_players_found"), 300, wx.ClientDC(self)), tr("no_player"), [tr("rescan"), tr("exit")])
             dlg = wx.MessageDialog(
                 self, wordwrap(tr("no_players_found"), 300, wx.ClientDC(self)), tr("no_player"), style=wx.YES_NO
             )
             result = dlg.ShowModal()
             # selection = dlg.GetSelection()
             # print "RESULT: ", result
             if result == wx.ID_YES:
                 # if selection == 0: # RESCAN
                 self.SearchHosts()
                 # elif selection == 1:
                 #   pass
                 # elif selection == 1: # EXIT
                 #    self.Close()
             elif result == wx.ID_NO:
                 # print "Cancel clicked, terminating program, bye bye..."
                 self.Close()
         else:
             # sort hosts by hostname
             self.SortHostList()
             self.WaitForUSB()
Пример #6
0
    def _upload_started(self):
        """Update the display when the upload is started.

        This method will add the progress bar and progress text to the display
        when the run.upload_started_topic is received.
        """
        logging.info("Upload started for {} with max size {}".format(
            self._run.upload_started_topic, self._progress_max))
        pub.unsubscribe(self._upload_started, self._run.upload_started_topic)
        self.Freeze()
        self._progress = wx.Gauge(self,
                                  id=wx.ID_ANY,
                                  range=100,
                                  size=(250, 20))
        self._progress_text = wx.StaticText(self, label="  0%")
        progress_sizer = wx.BoxSizer(wx.HORIZONTAL)

        progress_sizer.Add(self._progress, proportion=1)
        progress_sizer.Add(self._progress_text, proportion=0)

        self._sizer.Insert(0,
                           progress_sizer,
                           flag=wx.EXPAND | wx.LEFT | wx.RIGHT,
                           border=5)
        self.Layout()
        # Update our parent sizer so that samples don't get hidden
        self.GetParent().Layout()
        self.Thaw()
        self._timer.Start(1000)
Пример #7
0
    def _handle_connection_error(self, error_message=None):
        """Handle connection errors that might be thrown when initially connecting to IRIDA.

        Args:
            error_message: A more detailed error message than "Can't connect"
        """

        logging.error("Handling connection error.")

        self.Freeze()

        connection_error_sizer = wx.BoxSizer(wx.HORIZONTAL)
        connection_error_header = wx.StaticText(self, label=u"✘ Uh-oh. I couldn't to connect to IRIDA.")
        connection_error_header.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        connection_error_header.SetForegroundColour(wx.Colour(255, 0, 0))
        connection_error_header.Wrap(350)
        connection_error_sizer.Add(connection_error_header, flag=wx.LEFT | wx.RIGHT, border=5)

        self._sizer.Add(connection_error_sizer, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)
        if error_message:
            self._sizer.Add(wx.StaticText(self, label=wordwrap(error_message, 350, wx.ClientDC(self))), flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)

        open_settings_button = wx.Button(self, label="Open Settings")
        self.Bind(wx.EVT_BUTTON, self._parent._open_settings, id=open_settings_button.GetId())
        self._sizer.Add(open_settings_button, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)

        self.Layout()
        self.Thaw()
        pub.unsubscribe(self._handle_connection_error, APIConnectorTopics.connection_error_topic)
Пример #8
0
 def UdpListenerStopped(self):
     global playerCount
     Publisher.unsubscribe(self.UdpListenerStopped, 'listener_stop')
     Publisher.unsubscribe(self.HostFound, 'host_found')
     if self.hostSearch:
         self.hostSearch = False
         if playerCount == 0:
             self.prgDialog.Update(100)
             if HOST_SYS == HOST_WIN:
                 self.prgDialog.Destroy()
                 if platform.release() == "XP":
                     dlgWin = wx.MessageDialog(self,wordwrap(tr("no_players_found"), 300, wx.ClientDC(self)), tr("no_player"), style=wx.OK)
                     result = dlgWin.ShowModal()
                     self.parent.Close()
             dlg = wx.SingleChoiceDialog(self,wordwrap(tr("no_players_found"), 300, wx.ClientDC(self)), tr("no_player"), ["Enter IP Address", tr("rescan"), tr("exit")])
             result = dlg.ShowModal()
             selection = dlg.GetSelection()
             if result == wx.ID_OK:
                 if selection == 0: # ENTER IP
                     ipDlg = wx.TextEntryDialog(self, "Enter the IP of your RaspMedia Player or Exit application with cancel.", "Enter IP Address");
                     if ipDlg.ShowModal() == wx.ID_OK:
                         ipAddress = ipDlg.GetValue()
                         self.HostFound([ipAddress, "RaspMedia"], "RaspMedia")
                         self.LoadControlWindowForCurrentHostList()
                     else:
                         self.parent.Close()
                 elif selection == 1: # RESCAN
                     self.SearchHosts()
                 elif selection == 2: # EXIT
                     self.parent.Close()
             elif result == wx.ID_CANCEL:
                 self.parent.Close()
         else:
             self.LoadControlWindowForCurrentHostList()
Пример #9
0
 def __del__(self):
     """
     
         Actions necessary on filter bank deletion.
     
     """
     pub.unsubscribe(self.ComputeReference, "history.change_reference")
     pub.unsubscribe(self.RemoveReference, "history.clear_reference")
Пример #10
0
 def CleanUp(self):
     #self._remove_mask()
     Publisher.unsubscribe(self.expand_watershed,
                           'Expand watershed to 3D ' + self.orientation)
     Publisher.unsubscribe(self.set_operation, 'Set watershed operation')
     self.RemoveAllObservers()
     self.viewer.slice_.to_show_aux = ''
     self.viewer.OnScrollBar()
Пример #11
0
    def checkstatus(self, e):
        sender = e.GetEventObject()
        isChecked = sender.GetValue()

        if isChecked:
            pub.subscribe(self.writeStatus, "status.update")
        else:
            pub.unsubscribe(self.writeStatus, "status.update")
Пример #12
0
    def OnDestroy(self, evt):
        """Unbind to all events before the plugin is destroyed."""

        pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.parsed_data')
        pub.unsubscribe(self.OnStructureCheck, 'structures.checked')
        pub.unsubscribe(self.OnIsodoseCheck, 'isodoses.checked')
        pub.unsubscribe(self.OnDrawingPrefsChange, '2dview.drawingprefs')
        pub.unsubscribe(self.OnPluginLoaded, 'plugin.loaded.2dview')
Пример #13
0
    def _upload_completed(self, sample=None):
        """Stop the timer and hide self when the upload is complete."""

        logging.info("Upload complete for sample {}".format(self._sample.get_id()))

        pub.unsubscribe(self._upload_completed, self._sample.upload_completed_topic)
        pub.unsubscribe(self._upload_progress, self._sample.upload_progress_topic)
        self._upload_terminated(label=u"✓", colour=wx.Colour(51, 204, 51),
                                tooltip="{} is completed uploading.".format(self._sample.get_id()))
Пример #14
0
    def _retry_upload(self, evt=None):
        """Retry the upload after a failure is encountered.

        Args:
            evt: the event that fired this upload.
        """
        self._prepare_for_automatic_upload()
        pub.unsubscribe(self._finished_loading, DirectoryScannerTopics.finished_run_scan)
        pub.subscribe(self._start_upload, DirectoryScannerTopics.finished_run_scan)
        find_runs_in_directory(self._get_default_directory())
Пример #15
0
    def _upload_failed(self, exception=None):
        """Update the display when the upload has failed.

        Args:
            exception: the exception that caused the failure.
        """
        logging.info("Upload failed for sample {}".format(self._sample.get_id()))
        pub.unsubscribe(self._upload_failed, self._sample.upload_failed_topic)
        self._upload_terminated(label=u"✘", colour=wx.Colour(255, 0, 0),
                                tooltip="{} failed to upload.".format(self._sample.get_id()))
Пример #16
0
 def _on_close(self, evt=None):
     pub.unsubscribe(self._field_changed,
                     SettingsDialog.field_changed_topic)
     # only inform the UI that settings have changed if we're not being invoked
     # to set up the initial configuration settings (i.e., the first run)
     if type(evt) is wx.CommandEvent and not self._first_run:
         logging.info(
             "Closing settings dialog and informing UI to scan for sample sheets."
         )
         send_message(SettingsDialog.settings_closed_topic)
     evt.Skip()
Пример #17
0
 def OnDelete(self, event=None):
     """
     
         Clean up before destroying object.
         
         Parameters:
             event    -    wx.Event
     
     """
     pub.unsubscribe(self.ChangeDefaultUnits, "default_units.changed")
     event.Skip()
Пример #18
0
 def _post_processing_task_failed(self):
     """Show a 'failed' message on the UI when the post processing task fails."""
     pub.unsubscribe(self._post_processing_task_failed, RunUploaderTopics.failed_post_processing)
     pub.unsubscribe(self._post_processing_task_completed, RunUploaderTopics.finished_post_processing)
     logging.info("Post-processing failed, updating UI.")
     self.Freeze()
     self._post_processing_text.SetLabel("Post-processing task failed.")
     self._post_processing_text.SetToolTipString("Failed to execute command `{}`.".format(read_config_option("completion_cmd")))
     self._post_processing_text.Wrap(350)
     self._post_processing_placeholder.SetError("Failed to execute command `{}`.".format(read_config_option("completion_cmd")))
     self.Layout()
     self.Thaw()
Пример #19
0
 def OnDelete(self, event=None):
     """
     
         Actions triggered when canvas is deleted.
         
         Parameters:
             event    -    wx.Event
     
     """
     PlotCanvas1D.OnDelete(self,event)
     pub.unsubscribe(self.PostProcess, "filter.change")
     event.Skip()
Пример #20
0
    def _view_file(self):
        """
        Called to open the file which was just acquired
        """

        self.remove_all_streams()
        # stop listening to events
        pub.unsubscribe(self.on_setting_change, 'setting.changed')
        self._view.lastUpdate.unsubscribe(self.on_streams_changed)

        self.EndModal(wx.ID_OPEN)
        logging.debug("My return code is %d", self.GetReturnCode())
Пример #21
0
    def _view_file(self):
        """
        Called to open the file which was just acquired
        """

        self.remove_all_streams()
        # stop listening to events
        pub.unsubscribe(self.on_setting_change, 'setting.changed')
        self._view.lastUpdate.unsubscribe(self.on_streams_changed)

        self.EndModal(wx.ID_OPEN)
        logging.debug("My return code is %d", self.GetReturnCode())
Пример #22
0
 def UdpListenerStopped(self):
     global playerCount
     Publisher.unsubscribe(self.UdpListenerStopped, 'listener_stop')
     Publisher.unsubscribe(self.HostFound, 'host_found')
     # print "Number of players found: ", playerCount
     if self.hostSearch:
         self.hostSearch = False
         if playerCount == 0:
             self.prgDialog.Update(100)
             if HOST_SYS == HOST_WIN:
                 self.prgDialog.Destroy()
                 if platform.release() == "XP":
                     dlgWin = wx.MessageDialog(self,wordwrap(tr("no_players_found"), 300, wx.ClientDC(self)), tr("no_player"), style=wx.OK)
                     result = dlgWin.ShowModal()
                     self.parent.Close()
             dlg = wx.SingleChoiceDialog(self,wordwrap(tr("no_players_found"), 300, wx.ClientDC(self)), tr("no_player"), [tr("rescan"), tr("exit")])
             result = dlg.ShowModal()
             selection = dlg.GetSelection()
             # print "RESULT: ", result
             if result == wx.ID_OK:
                 # print "OK clicked, checking selected index... ", selection
                 if selection == 0: # RESCAN
                     self.SearchHosts()
                 #elif selection == 1:
                 #	pass
                 elif selection == 1: # EXIT
                     self.parent.Close()
             elif result == wx.ID_CANCEL:
                 # print "Cancel clicked, terminating program, bye bye..."
                 self.parent.Close()
         else:
             #self.prgDialog.Destroy()
             ind = 0
             # sort hosts by hostname
             self.SortHostList()
             for host in self.hosts:
                 # print "Preparing page for " + host['name']
                 # print "Player address: " + host['addr']
                 curPage = rmc.RaspMediaCtrlPanel(self,-1,host['name'],ind,host['addr'],HOST_SYS)
                 self.pages.append(curPage)
                 self.AddPage(curPage, host['name'])
                 ind += 1
             self.LoadPageData(0)
             self.Fit()
             self.parent.Fit()
             if HOST_SYS == HOST_WIN:
                 self.parent.SetSize((self.GetSize()[0]-85, self.GetSize()[1]+35))
             else:
                 self.parent.SetSize((self.GetSize()[0]-115, self.GetSize()[1]))
             self.parent.Center()
Пример #23
0
    def _upload_started(self):
        """Update the display when the upload is started.

        This method will add the progress bar to the display when the upload
        started topic is recieved.
        """
        logging.info("Upload started for sample {}".format(self._sample.get_id()))
        pub.unsubscribe(self._upload_started, self._sample.upload_started_topic)
        self.Freeze()
        self._status_label.Destroy()
        self._progress = wx.Gauge(self, range=100, size=(100, 20))
        self._sizer.Add(self._progress)
        self.Layout()
        self.Thaw()
        self._timer.Start(1000)
Пример #24
0
    def _validation_results(self, project=None):
        """Show the results of the online validation (checking if the project exists).

        Args:
            project: the project (if it exists) or None.
        """

        pub.unsubscribe(self._validation_results, self._sample.online_validation_topic)
        self.Freeze()
        if project:
            self._status_label.SetLabel("{} ({})".format(self._sample.get_project_id(), project.get_name()))
        else:
            self._status_label.SetLabel(u"✘ Project with ID {} does not exist.".format(self._sample.get_project_id()))
        self.Layout()
        self.Thaw()
Пример #25
0
    def on_close(self, evt):
        """ Close event handler that executes various cleanup actions
        """
        if self.acq_future:
            # TODO: ask for confirmation before cancelling?
            # What to do if the acquisition is done while asking for
            # confirmation?
            msg = "Cancelling acquisition due to closing the acquisition window"
            logging.info(msg)
            self.acq_future.cancel()

        self.remove_all_streams()
        # stop listening to events
        pub.unsubscribe(self.on_setting_change, 'setting.changed')

        self.Destroy()
Пример #26
0
    def ConfigLoaded(self, config, isDict=False):
        Publisher.unsubscribe(self.ConfigLoaded, "config")
        global HOST_SYS
        if isDict:
            configDict = config
        else:
            configDict = ast.literal_eval(config)
        # print configDict
        self.config = configDict

        # config loaded --> settings can be opened now
        settings = prefs.SettingsFrame(self, -1, tr("player_settings"), self.configHost, self.config)
        settings.Center()
        settings.SetBackgroundColour("WHITE")
        settings.Refresh()
        settings.Show()
Пример #27
0
    def ConfigLoaded(self, config, isDict=False):
        Publisher.unsubscribe(self.ConfigLoaded, 'config')
        global HOST_SYS
        if isDict:
            configDict = config
        else:
            configDict = ast.literal_eval(config)
        # print configDict
        self.config = configDict

        # config loaded --> settings can be opened now
        settings = prefs.SettingsFrame(self, -1, tr("player_settings"),
                                       self.configHost, self.config)
        settings.Center()
        settings.SetBackgroundColour('WHITE')
        settings.Refresh()
        settings.Show()
Пример #28
0
    def _handle_upload_sample_complete(sample=None):
        """Handle the event that happens when a sample has finished uploading.

        """
        if sample is None:
            raise Exception("sample is required!")
        with open(filename, "rb") as reader:
            uploader_info = json.load(reader)
            logging.info(uploader_info)
            if not 'uploaded_samples' in uploader_info:
                uploader_info['uploaded_samples'] = list()

            uploader_info['uploaded_samples'].append(sample.get_id())
        with open(filename, 'wb') as writer:
            json.dump(uploader_info, writer)
        logging.info("Finished updating info file.")
        pub.unsubscribe(_handle_upload_sample_complete,
                        sample.upload_completed_topic)
Пример #29
0
    def _post_processing_task_started(self):
        """Show a 'processing' message on the UI while the post processing task is executing."""
        pub.unsubscribe(self._post_processing_task_started, RunUploaderTopics.started_post_processing)
        pub.subscribe(self._post_processing_task_completed, RunUploaderTopics.finished_post_processing)
        pub.subscribe(self._post_processing_task_failed, RunUploaderTopics.failed_post_processing)
        logging.info("Post-processing started, updating UI.")

        self.Freeze()
        self._post_processing_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._post_processing_placeholder = ProcessingPlaceholderText(self)
        self._post_processing_placeholder.SetFont(wx.Font(pointSize=18, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_BOLD, face="Segoe UI Symbol"))
        self._post_processing_text = wx.StaticText(self, label="Executing post-processing task.")
        self._post_processing_text.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        self._post_processing_text.Wrap(350)
        self._post_processing_text.SetToolTipString("Executing command `{}`.".format(read_config_option("completion_cmd")))
        self._post_processing_sizer.Add(self._post_processing_text, flag=wx.RIGHT, border=5, proportion=1)
        self._post_processing_sizer.Add(self._post_processing_placeholder, flag=wx.LEFT, border=5, proportion=0)

        self._sizer.Insert(0, self._post_processing_sizer, flag=wx.EXPAND | wx.ALL, border=5)
        self.Layout()
        self.Thaw()
Пример #30
0
 def OnUpdatePatient(self, msg):
     """Update and load the patient data."""
     
     self.choiceDICOM.Enable()
     self.choiceDICOM.Clear()
     self.choiceDICOM.Append("Select a DICOM dataset...")
     self.choiceDICOM.Select(0)
     self.tlcTreeView.DeleteAllItems()
     # Iterate through the message and enumerate the DICOM datasets
     for k, v in msg.items():
         if isinstance(v, pydicom.dataset.FileDataset):
             i = self.choiceDICOM.Append(v.SOPClassUID.name.split(' Storage')[0])
             self.choiceDICOM.SetClientData(i, v)
         # Add the images to the choicebox
         if (k == 'images'):
             for imgnum, image in enumerate(v):
                 i = self.choiceDICOM.Append(
                     image.SOPClassUID.name.split(' Storage')[0] + \
                     ' Slice ' + str(imgnum + 1))
                 self.choiceDICOM.SetClientData(i, image)
     pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.raw_data')
Пример #31
0
    def _upload_failed(self, exception=None):
        """Update the display when the upload has failed.

        Args:
            exception: the exception that caused the failure.
        """

        pub.unsubscribe(self._upload_failed, self._run.upload_failed_topic)
        pub.unsubscribe(self._handle_progress, self._run.upload_progress_topic)
        pub.unsubscribe(self._upload_complete,
                        self._run.upload_completed_topic)

        self.Freeze()
        self._timer.Stop()
        self._progress_text.Destroy()
        self._progress.Destroy()
        error_label = wx.StaticText(self, label=u"✘ Yikes!")
        error_label.SetForegroundColour(wx.Colour(255, 0, 0))
        error_label.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        detailed_error_label = wx.StaticText(
            self,
            label=
            "The IRIDA server failed to accept the upload. You can try again by clicking the 'Try again' button below. If the problem persists, please contact an IRIDA administrator."
            .format(str(exception)))
        detailed_error_label.Wrap(350)

        self._sizer.Insert(0,
                           detailed_error_label,
                           flag=wx.EXPAND | wx.ALL,
                           border=5)
        self._sizer.Insert(0, error_label, flag=wx.EXPAND | wx.ALL, border=5)

        self.Layout()
        self.Thaw()
Пример #32
0
 def _on_close(self, evt=None):
     pub.unsubscribe(self._status_label.SetError,
                     APIConnectorTopics.connection_error_url_topic)
     pub.unsubscribe(self._status_label.SetSuccess,
                     APIConnectorTopics.connection_success_topic)
     pub.unsubscribe(self._status_label.SetSuccess,
                     APIConnectorTopics.connection_success_valid_url)
Пример #33
0
 def UdpListenerStopped(self):
     global HOST_SYS
     if self.pageDataLoading:
         if self.remoteListLoading:
             self.pageDataLoading = False
             if self.parent.prgDialog:
                 self.parent.prgDialog.Update(100)
                 if HOST_SYS == HOST_WIN:
                     self.parent.prgDialog.Destroy()
             if self.prgDialog:
                 self.prgDialog.Update(100)
                 if HOST_SYS == HOST_WIN:
                     self.prgDialog.Destroy()
         else:
             Publisher.unsubscribe(self.UpdateConfigUI, 'config')
             self.LoadRemoteFileList()
     else:
         if self.prgDialog:
             self.prgDialog.Update(100)
             if HOST_SYS == HOST_WIN:
                 self.prgDialog.Destroy()
     self.LayoutAndFit()
Пример #34
0
 def _on_close(self, evt=None):
     pub.unsubscribe(
         self._handle_connection_error,
         APIConnectorTopics.connection_error_user_credentials_topic)
     pub.unsubscribe(self._status_label_user.SetSuccess,
                     APIConnectorTopics.connection_success_topic)
     pub.unsubscribe(self._status_label_pass.SetSuccess,
                     APIConnectorTopics.connection_success_topic)
Пример #35
0
  def OnCancelSubmission(self, event):

    # Unsubscribe from all events

    map(lambda evt: pub.unsubscribe(*evt), [(self.OnSubmitEvent, 'rce_submit.job_submitted'), 
      (self.OnPollEvent, 'rce_submit.job_started'),
      (self.OnAttachEvent, 'rce_submit.xpra_attached')])

    htcondor.Schedd().act(htcondor.JobAction.Remove, [ str(float(self.jobid)) ])

    # This is lazy because I'm not stopping the polling thread, but it will stop on its own.

    self.progress_bar_window.complete_task()
    self.progress_bar_window.Destroy()

    return self.Destroy()
Пример #36
0
    def OnUnfocus(self):
        """Unbind to certain events when the plugin is unfocused."""

        # Unbind keyboard and mouse events
        self.Unbind(wx.EVT_KEY_DOWN)
        self.Unbind(wx.EVT_MOUSEWHEEL)
        self.Unbind(wx.EVT_LEFT_DOWN)
        self.Unbind(wx.EVT_LEFT_UP)
        self.Unbind(wx.EVT_RIGHT_DOWN)
        self.Unbind(wx.EVT_RIGHT_UP)
        self.Unbind(wx.EVT_MOTION)
        pub.unsubscribe(self.OnKeyDown, 'main.key_down')
        pub.unsubscribe(self.OnMouseWheel, 'main.mousewheel')
        pub.unsubscribe(self.OnRefresh, '2dview.refresh')
Пример #37
0
    def OnUnfocus(self):
        """Unbind to certain events when the plugin is unfocused."""

        # Unbind keyboard and mouse events
        self.Unbind(wx.EVT_KEY_DOWN)
        self.Unbind(wx.EVT_MOUSEWHEEL)
        self.Unbind(wx.EVT_LEFT_DOWN)
        self.Unbind(wx.EVT_LEFT_UP)
        self.Unbind(wx.EVT_RIGHT_DOWN)
        self.Unbind(wx.EVT_RIGHT_UP)
        self.Unbind(wx.EVT_MOTION)
        if guiutil.IsMSWindows():
            pub.unsubscribe(self.OnKeyDown, 'main.key_down')
            pub.unsubscribe(self.OnMouseWheel, 'main.mousewheel')
        pub.unsubscribe(self.OnRefresh, '2dview.refresh')
Пример #38
0
 def _pubsub_done(self, msg):
     if msg[0] is not None and not self.is_event_relevant(msg):
         return
     pub.unsubscribe(self._pubsub_done, "signals.MyGauge.done")
     pub.unsubscribe(self._pubsub_tick, "signals.MyGauge.tick")
     pub.unsubscribe(self._pubsub_nextjob, "signals.MyGauge.nextjob")
     if self.ondone:
         self.ondone()
     if self.destroyondone:
         self.Destroy()
     else:
         self.dead = True
         self.txt1.SetLabel("Computation finished.")
         t = time.time() - self.inittime
         self.txt3.SetLabel("Time taken: " + str(self.totime(t)))
         self.txt4.SetLabel("")
Пример #39
0
    def _done_event(self):
        '''
        Internal callback: destroy the loading bar, closing the
        relevant events, stopping the timer, and detroying the
        pop-up.

        Must be called in the original process, ideally via
        the pub-sub system.
        '''
        self.alive = False
        pub.unsubscribe(self._tick_event, self.signal + '.start')
        pub.unsubscribe(self._tick_event, self.signal + '.tick')
        pub.unsubscribe(self._done_event, self.signal + '.done')
        if self.timer:
            self.timer.Stop()
        if self.finish_cb:
            self.finish_cb()
        self.Destroy()
Пример #40
0
 def Destroy(self):
     pub.unsubscribe(self.deliverEvent, self.topicPattern)
Пример #41
0
 def OnDestroy(self, evt):
     """Unbind to all events before the plugin is destroyed."""
     pub.unsubscribe(self.OnImportPrefsChange,
                     'general.dicom.import_location')
     pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.raw_data')
Пример #42
0
    def OnDestroy(self, evt):
        """Unbind to all events before the plugin is destroyed."""

        pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.parsed_data')
        pub.unsubscribe(self.OnStructureCheck, 'structures.checked')
        pub.unsubscribe(self.OnStructureSelect, 'structure.selected')
Пример #43
0
    def OnDestroy(self, evt):
        """Unbind to all events before the plugin is destroyed."""

        pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.raw_data')
Пример #44
0
 def Destroy(self):
     pub.unsubscribe(self.deliverEvent, self.topicPattern)
Пример #45
0
 def OnClose(self, evt):
     pub.unsubscribe(self.plot, 'data.plot')
     self.Destroy()