def OnInit(self): """ Initialize the GUI This method is automatically called from the :wx:`App` constructor """ gui.legend_logo = "legend_logo_delmic.png" if self._is_standalone: microscope = None gui.icon = img.getIcon("icon/ico_gui_viewer_256.png") gui.name = odemis.__shortname__ + " Viewer" if "delphi" == self._is_standalone: gui.logo = img.getBitmap("logo_delphi.png") gui.legend_logo = "legend_logo_delphi.png" else: gui.icon = img.getIcon("icon/ico_gui_full_256.png") gui.name = odemis.__shortname__ try: microscope = model.getMicroscope() except (IOError, Pyro4.errors.CommunicationError) as e: logging.exception("Failed to connect to back-end") msg = ("The Odemis GUI could not connect to the Odemis back-end:" "\n\n{0}\n\n" "Launch user interface anyway?").format(e) answer = wx.MessageBox(msg, "Connection error", style=wx.YES | wx.NO | wx.ICON_ERROR) if answer == wx.NO: sys.exit(1) microscope = None else: if microscope.role == "delphi": gui.logo = img.getBitmap("logo_delphi.png") gui.legend_logo = "legend_logo_delphi.png" # TODO: if microscope.ghost is not empty => wait and/or display a special # "hardware status" tab. if microscope and microscope.role == "mbsem": self.main_data = guimodel.FastEMMainGUIData(microscope) else: self.main_data = guimodel.MainGUIData(microscope) # Load the main frame self.main_frame = main_xrc.xrcfr_main(None) self.init_gui() try: from odemis.gui.dev.powermate import Powermate self.dev_powermate = Powermate(self.main_data) except (LookupError, NotImplementedError) as ex: logging.debug("Not using Powermate: %s", ex) except Exception: logging.exception("Failed to load Powermate support") # Application successfully launched return True
def OnInit(self): """ Initialize the GUI This method is automatically called from the :wx:`App` constructor """ gui.legend_logo = "legend_logo_delmic.png" if self._is_standalone: microscope = None gui.icon = img.getIcon("icon/ico_gui_viewer_256.png") gui.name = odemis.__shortname__ + " Viewer" if "delphi" == self._is_standalone: gui.logo = img.getBitmap("logo_delphi.png") gui.legend_logo = "legend_logo_delphi.png" else: gui.icon = img.getIcon("icon/ico_gui_full_256.png") gui.name = odemis.__shortname__ try: microscope = model.getMicroscope() except (IOError, Pyro4.errors.CommunicationError) as e: logging.exception("Failed to connect to back-end") msg = ("The Odemis GUI could not connect to the Odemis back-end:" "\n\n{0}\n\n" "Launch user interface anyway?").format(e) answer = wx.MessageBox(msg, "Connection error", style=wx.YES | wx.NO | wx.ICON_ERROR) if answer == wx.NO: sys.exit(1) microscope = None else: if microscope.role == "delphi": gui.logo = img.getBitmap("logo_delphi.png") gui.legend_logo = "legend_logo_delphi.png" logging.info("\n\n************ Starting Odemis GUI ************\n") logging.info("Odemis GUI v%s (from %s)", odemis.__version__, __file__) logging.info("wxPython v%s", wx.version()) # TODO: if microscope.ghost is not empty => wait and/or display a special # "hardware status" tab. self.main_data = guimodel.MainGUIData(microscope) # Load the main frame self.main_frame = main_xrc.xrcfr_main(None) self.init_gui() try: from odemis.gui.dev.powermate import Powermate self.dev_powermate = Powermate(self.main_data) except (LookupError, NotImplementedError) as ex: logging.debug("Not using Powermate: %s", ex) except Exception: logging.exception("Failed to load Powermate support") # Application successfully launched return True