def main(self, argv=None): """The main application is created and launched here. Parameters ---------- argv : list of strings The list of command line arguments. The default is `None` where no command line arguments are parsed. To support command line arguments you can pass `sys.argv[1:]`. log_mode : The logging mode to use. """ # parse any cmd line args. if argv is None: argv = [] self.parse_command_line(argv) # setup logging self.setup_logger() # add all default plugins plugins = get_plugins() # add ConnectomeViewer plugins plugins = get_cviewer_plugins() + plugins # create the application prefs = preference_manager.preferences # create the application object self.application = CViewerWorkbenchApplication(plugins=plugins, preferences=prefs) # start the application. self.application.run() logger.info('We hope you enjoyed using the Connectome Viewer!')
def main(self, argv=None): """The main application is created and launched here. Parameters ---------- argv : list of strings The list of command line arguments. The default is `None` where no command line arguments are parsed. To support command line arguments you can pass `sys.argv[1:]`. log_mode : The logging mode to use. """ # parse any cmd line args. if argv is None: argv = [] self.parse_command_line(argv) # setup logging self.setup_logger() # add all default plugins plugins = get_plugins() # add ConnectomeViewer plugins plugins = get_cviewer_plugins() + plugins # create the application prefs = preference_manager.preferences # create the application object self.application = CViewerWorkbenchApplication(plugins=plugins, preferences=prefs) # start the application. self.application.run() logger.info('We hope you enjoyed using the Connectome Viewer!')
class CViewer(HasTraits): """The Connectome Viewer application class. """ # The main envisage application. application = Instance('enthought.envisage.ui.workbench.api.WorkbenchApplication') # The MayaVi Script instance. script = Instance('enthought.mayavi.plugins.script.Script') # The logging mode. log_mode = Int(logging.ERROR, desc='the logging mode to use') def main(self, argv=None): """The main application is created and launched here. Parameters ---------- argv : list of strings The list of command line arguments. The default is `None` where no command line arguments are parsed. To support command line arguments you can pass `sys.argv[1:]`. log_mode : The logging mode to use. """ # parse any cmd line args. if argv is None: argv = [] self.parse_command_line(argv) # setup logging self.setup_logger() # add all default plugins plugins = get_plugins() # add ConnectomeViewer plugins plugins = get_cviewer_plugins() + plugins # create the application prefs = preference_manager.preferences # create the application object self.application = CViewerWorkbenchApplication(plugins=plugins, preferences=prefs) # start the application. self.application.run() logger.info('We hope you enjoyed using the Connectome Viewer!') def setup_logger(self): """ Setting up the root logger """ from enthought.etsconfig.api import ETSConfig path = os.path.join(ETSConfig.application_data, 'ch.connectome.viewer', 'cviewer.log') path = os.path.abspath(path) setup_logger(logger, path, mode=self.log_mode) def parse_command_line(self, argv): """Parse command line options. Parameters ---------- - argv : `list` of `strings` The list of command line arguments. """ from optparse import OptionParser usage = "usage: %prog [options]" parser = OptionParser(usage) (options, args) = parser.parse_args(argv) def run(self): """This function is called after the GUI has started. """ pass
class CViewer(HasTraits): """The Connectome Viewer application class. """ # The main envisage application. application = Instance( 'enthought.envisage.ui.workbench.api.WorkbenchApplication') # The MayaVi Script instance. script = Instance('enthought.mayavi.plugins.script.Script') # The logging mode. log_mode = Int(logging.ERROR, desc='the logging mode to use') def main(self, argv=None): """The main application is created and launched here. Parameters ---------- argv : list of strings The list of command line arguments. The default is `None` where no command line arguments are parsed. To support command line arguments you can pass `sys.argv[1:]`. log_mode : The logging mode to use. """ # parse any cmd line args. if argv is None: argv = [] self.parse_command_line(argv) # setup logging self.setup_logger() # add all default plugins plugins = get_plugins() # add ConnectomeViewer plugins plugins = get_cviewer_plugins() + plugins # create the application prefs = preference_manager.preferences # create the application object self.application = CViewerWorkbenchApplication(plugins=plugins, preferences=prefs) # start the application. self.application.run() logger.info('We hope you enjoyed using the Connectome Viewer!') def setup_logger(self): """ Setting up the root logger """ from enthought.etsconfig.api import ETSConfig path = os.path.join(ETSConfig.application_data, 'ch.connectome.viewer', 'cviewer.log') path = os.path.abspath(path) setup_logger(logger, path, mode=self.log_mode) def parse_command_line(self, argv): """Parse command line options. Parameters ---------- - argv : `list` of `strings` The list of command line arguments. """ from optparse import OptionParser usage = "usage: %prog [options]" parser = OptionParser(usage) (options, args) = parser.parse_args(argv) def run(self): """This function is called after the GUI has started. """ pass