Example #1
0
 def OnDatasourceAddMenu(self, event):
     """Called on 'Datasource'->'Add...' menu.
     """
     debug('Available datasource page types: %s' %DATASOURCE_PAGE_REGISTRY.keys())
     dlg = AddDatasourceDialog(self.browser, choices=sorted(DATASOURCE_PAGE_REGISTRY.keys()))
     if dlg.ShowModal()==wx.ID_OK:
         label_name = dlg.label_name
         page_class = DATASOURCE_PAGE_REGISTRY.get(dlg.datasource_name, None)
         debug('Got %s as %s' %(page_class.__name__, label_name))
         if page_class is None:
             wx.MessageBox('Page Type not found: %s' %dlg.datasource_name, 'Error')
         # load new dialog page
         self.datasource_panel.notebook.create_page(page_class, label_name)
     dlg.Destroy()
Example #2
0
 def OnDatasourceAddMenu(self, event):
     """Called on 'Datasource'->'Add...' menu.
     """
     debug('Available datasource page types: %s' %
           DATASOURCE_PAGE_REGISTRY.keys())
     dlg = AddDatasourceDialog(self.browser,
                               choices=sorted(
                                   DATASOURCE_PAGE_REGISTRY.keys()))
     if dlg.ShowModal() == wx.ID_OK:
         label_name = dlg.label_name
         page_class = DATASOURCE_PAGE_REGISTRY.get(dlg.datasource_name,
                                                   None)
         debug('Got %s as %s' % (page_class.__name__, label_name))
         if page_class is None:
             wx.MessageBox('Page Type not found: %s' % dlg.datasource_name,
                           'Error')
         # load new dialog page
         self.datasource_panel.notebook.create_page(page_class, label_name)
     dlg.Destroy()
Example #3
0
 def post_init_setup(self):
     """The last phase of initialization.
     """
     # load datasources
     ds_registry = self.registry.load_section('datasources')
     for label_name, ds_name, ds_info in ds_registry.get('pages', []):
         page_class = DATASOURCE_PAGE_REGISTRY.get(ds_name, None)
         if page_class is None:
             wx.MessageBox('Page Type not found: %s' %ds_name, 'Error')
         idx, page = self.datasource_panel.notebook.create_page(page_class, label_name)
         page.restore(ds_info)
     # load pipeline
     pl_registry = self.registry.load_section('pipeline')
     tree_info = pl_registry.get('tree', None)
     if tree_info:
         self.pipeline.restore(tree_info)
         self.pipeline_tree_ctrl.rebuild_root()
         self.pipeline_tree_ctrl.ExpandAll()
Example #4
0
    def OnBrowserClosing(self, event):
        """Hook from browser on closing.
        """
        # save datasource panel.
        ds_registry = self.registry.load_section('datasources')
        ds_notebook = self.datasource_panel.notebook
        ds_pages_info = []
        for page_index in range(ds_notebook.GetPageCount()):
            page = ds_notebook.GetPage(page_index)
            label = ds_notebook.GetPageText(page_index)
            for name, cls in DATASOURCE_PAGE_REGISTRY.items():
                if cls == page.__class__:
                    ds_pages_info.append((label, name, page.save()))
            debug('saving page %s' % [label, name, page.save()])
        ds_registry['pages'] = ds_pages_info

        # save pipeline
        pl_registry = self.registry.load_section('pipeline')
        pl_registry['tree'] = self.pipeline.save()
Example #5
0
 def post_init_setup(self):
     """The last phase of initialization.
     """
     # load datasources
     ds_registry = self.registry.load_section('datasources')
     for label_name, ds_name, ds_info in ds_registry.get('pages', []):
         page_class = DATASOURCE_PAGE_REGISTRY.get(ds_name, None)
         if page_class is None:
             wx.MessageBox('Page Type not found: %s' % ds_name, 'Error')
         idx, page = self.datasource_panel.notebook.create_page(
             page_class, label_name)
         page.restore(ds_info)
     # load pipeline
     pl_registry = self.registry.load_section('pipeline')
     tree_info = pl_registry.get('tree', None)
     if tree_info:
         self.pipeline.restore(tree_info)
         self.pipeline_tree_ctrl.rebuild_root()
         self.pipeline_tree_ctrl.ExpandAll()
Example #6
0
    def OnBrowserClosing(self, event):
        """Hook from browser on closing.
        """
        # save datasource panel.
        ds_registry = self.registry.load_section('datasources')
        ds_notebook = self.datasource_panel.notebook
        ds_pages_info = []
        for page_index in range(ds_notebook.GetPageCount()):
            page = ds_notebook.GetPage(page_index)
            label = ds_notebook.GetPageText(page_index)
            for name, cls in DATASOURCE_PAGE_REGISTRY.items():
                if cls==page.__class__:
                    ds_pages_info.append((label, name, page.save()))
            debug('saving page %s' % [label, name, page.save()])
        ds_registry['pages'] = ds_pages_info

        # save pipeline
        pl_registry = self.registry.load_section('pipeline')
        pl_registry['tree'] = self.pipeline.save()