Exemplo n.º 1
0
    def __init__(self):
        """
        """
        logger = logging.getLogger(__name__)

        from sas.sasgui.guiframe.gui_manager import SasViewApp
        self.gui = SasViewApp(0)
        if sys.platform == "darwin":
            self.check_sasmodels_compiler()
        # Set the application manager for the GUI
        self.gui.set_manager(self)
        # Add perspectives to the basic application
        # Additional perspectives can still be loaded
        # dynamically
        # Note: py2exe can't find dynamically loaded
        # modules. We load the fitting module here
        # to ensure a complete Windows executable build.

        # Rebuild .sasview/categories.json.  This triggers a load of sasmodels
        # and all the plugins.
        try:
            from sas.sascalc.fit.models import ModelManager
            from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller
            model_list = ModelManager().cat_model_list()
            CategoryInstaller.check_install(model_list=model_list)
        except Exception:
            logger.error("%s: could not load SasView models")
            logger.error(traceback.format_exc())

        # Fitting perspective
        try:
            import sas.sasgui.perspectives.fitting as module
            fitting_plug = module.Plugin()
            self.gui.add_perspective(fitting_plug)
        except Exception:
            logger.error("%s: could not find Fitting plug-in module", APP_NAME)
            logger.error(traceback.format_exc())

        # P(r) perspective
        try:
            import sas.sasgui.perspectives.pr as module
            pr_plug = module.Plugin()
            self.gui.add_perspective(pr_plug)
        except Exception:
            logger.error("%s: could not find P(r) plug-in module", APP_NAME)
            logger.error(traceback.format_exc())

        # Invariant perspective
        try:
            import sas.sasgui.perspectives.invariant as module
            invariant_plug = module.Plugin()
            self.gui.add_perspective(invariant_plug)
        except Exception:
            logger.error("%s: could not find Invariant plug-in module",
                         APP_NAME)
            logger.error(traceback.format_exc())

        # Corfunc perspective
        try:
            import sas.sasgui.perspectives.corfunc as module
            corfunc_plug = module.Plugin()
            self.gui.add_perspective(corfunc_plug)
        except Exception:
            logger.error("Unable to load corfunc module")

        # Calculator perspective
        try:
            import sas.sasgui.perspectives.calculator as module
            calculator_plug = module.Plugin()
            self.gui.add_perspective(calculator_plug)
        except Exception:
            logger.error("%s: could not find Calculator plug-in module",
                         APP_NAME)
            logger.error(traceback.format_exc())

        # File converter tool
        try:
            import sas.sasgui.perspectives.file_converter as module
            converter_plug = module.Plugin()
            self.gui.add_perspective(converter_plug)
        except Exception:
            logger.error("%s: could not find File Converter plug-in module",
                         APP_NAME)
            logger.error(traceback.format_exc())

        # Add welcome page
        from .welcome_panel import WelcomePanel
        self.gui.set_welcome_panel(WelcomePanel)

        # Build the GUI
        self.gui.build_gui()
        # delete unused model folder
        self.gui.clean_plugin_models(PLUGIN_MODEL_DIR)
        # Start the main loop
        self.gui.MainLoop()
Exemplo n.º 2
0
    def __init__(self):
        """
        """
        # from gui_manager import ViewApp
        self.gui = gui_manager.SasViewApp(0)
        # Set the application manager for the GUI
        self.gui.set_manager(self)
        # Add perspectives to the basic application
        # Additional perspectives can still be loaded
        # dynamically
        # Note: py2exe can't find dynamically loaded
        # modules. We load the fitting module here
        # to ensure a complete Windows executable build.

        # Fitting perspective
        try:
            import sas.sasgui.perspectives.fitting as module
            fitting_plug = module.Plugin()
            self.gui.add_perspective(fitting_plug)
        except Exception:
            logger.error("%s: could not find Fitting plug-in module" %
                         APP_NAME)
            logger.error(traceback.format_exc())

        # P(r) perspective
        try:
            import sas.sasgui.perspectives.pr as module
            pr_plug = module.Plugin()
            self.gui.add_perspective(pr_plug)
        except:
            logger.error("%s: could not find P(r) plug-in module" % APP_NAME)
            logger.error(traceback.format_exc())

        # Invariant perspective
        try:
            import sas.sasgui.perspectives.invariant as module
            invariant_plug = module.Plugin()
            self.gui.add_perspective(invariant_plug)
        except Exception as e:
            logger.error("%s: could not find Invariant plug-in module"% \
                          APP_NAME)
            logger.error(traceback.format_exc())

        # Corfunc perspective
        try:
            import sas.sasgui.perspectives.corfunc as module
            corfunc_plug = module.Plugin()
            self.gui.add_perspective(corfunc_plug)
        except:
            logger.error("Unable to load corfunc module")

        # Calculator perspective
        try:
            import sas.sasgui.perspectives.calculator as module
            calculator_plug = module.Plugin()
            self.gui.add_perspective(calculator_plug)
        except:
            logger.error("%s: could not find Calculator plug-in module"% \
                                                        APP_NAME)
            logger.error(traceback.format_exc())

        # File converter tool
        try:
            import sas.sasgui.perspectives.file_converter as module
            converter_plug = module.Plugin()
            self.gui.add_perspective(converter_plug)
        except:
            logger.error("%s: could not find File Converter plug-in module"% \
                                                        APP_NAME)
            logger.error(traceback.format_exc())

        # Add welcome page
        self.gui.set_welcome_panel(WelcomePanel)

        # Build the GUI
        self.gui.build_gui()
        # delete unused model folder
        self.gui.clean_plugin_models(PLUGIN_MODEL_DIR)
        # Start the main loop
        self.gui.MainLoop()