Exemplo n.º 1
0
    def on_close_window(self, evt=None):
        """ This method cleans up and closes the Odemis GUI. """
        logging.info("Exiting Odemis")

        if self.main_data.is_acquiring.value:
            msg = (
                "Acquisition in progress!\n\n"
                "Please cancel the current acquisition operation before exiting Odemis."
            )
            dlg = wx.MessageDialog(self.main_frame, msg, "Exit",
                                   wx.OK | wx.ICON_STOP)
            # if dlg.ShowModal() == wx.ID_NO:
            dlg.ShowModal()
            dlg.Destroy()  # frame
            return

        # Check if there's any action to do before tab termination
        # Do not terminate if returned False
        if not self.tab_controller.query_terminate():
            return

        for p in self.plugins:
            try:
                p.terminate()
            except Exception:
                logging.exception("Failed to end the plugin properly")
        self.plugins = []

        if self.dev_powermate:
            self.dev_powermate.terminate()

        try:
            pub.unsubAll()
            # let all the tabs know we are stopping
            self.tab_controller.terminate()
        except Exception:
            logging.exception("Error during GUI shutdown")

        try:
            log.stop_gui_logger()
        except Exception:
            logging.exception("Error stopping GUI logging")

        self.main_frame.Destroy()
Exemplo n.º 2
0
    def on_close_window(self, evt=None): #pylint: disable=W0613
        """ This method cleans up and closes the Odemis GUI. """
        logging.info("Exiting Odemis")

        if self.main_data.is_acquiring.value:
            msg = ("Acquisition in progress!\n\n"
                   "Please cancel the current acquistion operation before exiting Odemis." )
            dlg = wx.MessageDialog(self.main_frame, msg, "Exit", wx.OK | wx.ICON_STOP)
            # if dlg.ShowModal() == wx.ID_NO:
            dlg.ShowModal()
            dlg.Destroy() # frame
            return

        try:
            # Put cleanup actions here (like disconnect from odemisd)

            pub.unsubAll()

            # Stop live view
            try:
                self.main_data.opticalState.value = guimodel.STATE_OFF
            except AttributeError:
                pass # just no such microscope present
            try:
                self.main_data.emState.value = guimodel.STATE_OFF
            except AttributeError:
                pass

            # let all the tabs know we are stopping
            self._tab_controller.terminate()

            if self.http_proc:
                self.http_proc.terminate()  #pylint: disable=E1101
        except Exception:
            logging.exception("Error during GUI shutdown")

        try:
            log.stop_gui_logger()
        except Exception:
            logging.exception("Error stopping GUI logging")

        self.main_frame.Destroy()
Exemplo n.º 3
0
    def on_close_window(self, evt=None):
        """ This method cleans up and closes the Odemis GUI. """
        logging.info("Exiting Odemis")

        if self.main_data.is_acquiring.value:
            msg = ("Acquisition in progress!\n\n"
                   "Please cancel the current acquisition operation before exiting Odemis.")
            dlg = wx.MessageDialog(self.main_frame, msg, "Exit", wx.OK | wx.ICON_STOP)
            # if dlg.ShowModal() == wx.ID_NO:
            dlg.ShowModal()
            dlg.Destroy()  # frame
            return

        for p in self.plugins:
            try:
                p.terminate()
            except Exception:
                logging.exception("Failed to end the plugin properly")
        self.plugins = []

        if self.dev_powermate:
            self.dev_powermate.terminate()

        try:
            pub.unsubAll()
            # let all the tabs know we are stopping
            self.tab_controller.terminate()
        except Exception:
            logging.exception("Error during GUI shutdown")

        try:
            log.stop_gui_logger()
        except Exception:
            logging.exception("Error stopping GUI logging")

        self.main_frame.Destroy()