Exemple #1
0
    def _init_ctrls(self, series_service):
        # generated method, don't edit
        logger.debug("Loading frame...")

        self.SetIcon(gtk_execute.getIcon())

        self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL,
                             False, u'Tahoma'))

        ############### Ribbon ###################
        logger.debug("Loading Ribbon Menu...")
        self._ribbon = mnuRibbon.mnuRibbon(parent=self, id=wx.ID_ANY, name='ribbon')

        if sys.platform == 'darwin':
            self.menu_bar = wx.MenuBar()
            self.help_menu = wx.Menu()

            self.help_menu.Append(wx.ID_ABOUT, "&About ODMTools")
            self.menu_bar.Append(self.help_menu, "&Help")

            self.SetMenuBar(self.menu_bar)
            self.Bind(wx.EVT_MENU, self.on_about_request, id=wx.ID_ABOUT)

            # self.menu_bar.SetAutoWindowMenu()

        ################ Docking Tools##############
        self.pnlDocking = wx.Panel(name='pnlDocking',
                                   parent=self, size=wx.Size(605, 458),
                                   style=wx.TAB_TRAVERSAL)

        ############# Graph ###############
        logger.debug("Loading Plot ...")
        self.pnlPlot = pnlPlot.pnlPlot(self.pnlDocking, self.taskserver)

        ################ Series Selection Panel ##################
        logger.debug("Loading Series Selector ...")


        self.pnlSelector = FrmSeriesSelector(self.pnlDocking, series_service, plot=self.pnlPlot, taskserver=self.taskserver, memdb = self.memDB)


        ####################grid Table View##################
        logger.debug("Loading DataTable ...")
        self.dataTable = FrmDataTable(self.pnlDocking)

        # self.dataTable.toggleBindings()
        ############# Script & Console ###############
        logger.debug("Loading Python Console ...")
        self.txtPythonConsole = ODMToolsConsole(parent=self.pnlDocking, size=wx.Size(200, 200))
        wx.CallAfter(self._postStartup)



        logger.debug("Loading Python Script ...")
        self.txtPythonScript = pnlScript(name=u'txtPython', parent=self,
                                     size=wx.Size(200, 200))

        self.Bind(wx.EVT_CLOSE, self.onClose)


        Publisher.subscribe(self.onDocking, ("adjust.Docking"))
        Publisher.subscribe(self.onPlotSelection, ("select.Plot"))
        Publisher.subscribe(self.onExecuteScript, ("execute.script"))
        Publisher.subscribe(self.onChangeDBConn, ("change.dbConfig"))
        Publisher.subscribe(self.onSetScriptTitle, ("script.title"))
        Publisher.subscribe(self.onClose, ("onClose"))
        Publisher.subscribe(self.addEdit, ("selectEdit"))
        Publisher.subscribe(self.stopEdit, ("stopEdit"))
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self,
                          id=wxID_ODMTOOLS,
                          name=u'ODMTools',
                          parent=prnt,
                          pos=wx.Point(150, 150),
                          size=wx.Size(1190, 812),
                          style=wx.DEFAULT_FRAME_STYLE,
                          title=u'ODM Tools')
        self.SetFont(
            wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma'))
        # Publisher.subscribe(self.addPlot, ("add.NewPlot"))
        # Publisher.subscribe(self.addEdit, ("edit.NewPlot"))
        Publisher.subscribe(self.onDocking, ("adjust.Docking"))

        Publisher.subscribe(self.onDocking, ("adjust.Docking"))
        Publisher.subscribe(self.onPlotSelection, ("select.Plot"))
        Publisher.subscribe(self.onExecuteScript, ("execute.script"))

        Publisher.subscribe(self.onExecuteScript, ("execute.script"))
        Publisher.subscribe(self.onChangeDBConn, ("change.dbConfig"))
        Publisher.subscribe(self.onSetScriptTitle, ("script.title"))
        Publisher.subscribe(self.OnClose, ("onClose"))

        ############### Ribbon ###################
        self._ribbon = mnuRibbon.mnuRibbon(parent=self,
                                           id=wx.ID_ANY,
                                           name='ribbon')

        ################ Docking Tools##############
        self.pnlDocking = wx.Panel(id=wxID_ODMTOOLSPANEL1,
                                   name='pnlDocking',
                                   parent=self,
                                   pos=wx.Point(0, 0),
                                   size=wx.Size(605, 458),
                                   style=wx.TAB_TRAVERSAL)

        ################ Series Selection Panel ##################
        self.pnlSelector = pnlSeriesSelector.pnlSeriesSelector(
            id=wxID_PNLSELECTOR,
            name=u'pnlSelector',
            parent=self.pnlDocking,
            pos=wx.Point(0, 0),
            size=wx.Size(770, 388),
            style=wx.TAB_TRAVERSAL,
            dbservice=self.sc)

        ####################grid##################
        self.dataTable = pnlDataTable.pnlDataTable(id=wxID_ODMTOOLSGRID1,
                                                   name='dataTable',
                                                   parent=self.pnlDocking,
                                                   pos=wx.Point(64, 160),
                                                   size=wx.Size(376, 280),
                                                   style=0)

        ############# Graph ###############
        self.pnlPlot = pnlPlot.pnlPlot(id=wxID_ODMTOOLSPANEL1,
                                       name='pnlPlot',
                                       parent=self.pnlDocking,
                                       pos=wx.Point(0, 0),
                                       size=wx.Size(605, 458),
                                       style=wx.TAB_TRAVERSAL)

        ############# Script & Console ###############

        self.txtPythonConsole = wx.py.crust.CrustFrame(
            id=wxID_TXTPYTHONCONSOLE,
            name=u'txtPython',
            parent=self,
            rootObject=self,
            rootLabel="Main Window",
            pos=wx.Point(72, 24),
            size=wx.Size(500, 800),
            style=0)

        # Console tools object for usability
        self.console_tools = ConsoleTools(self._ribbon)
        self.txtPythonConsole.shell.run("Tools = app.TopWindow.console_tools",
                                        prompt=False,
                                        verbose=False)

        self.txtPythonScript = pnlScript(id=wxID_TXTPYTHONSCRIPT,
                                         name=u'txtPython',
                                         parent=self,
                                         pos=wx.Point(72, 24),
                                         size=wx.Size(200, 200))

        # print self.txtPythonConsole.fileMenu.MenuItems
        # for menu in self.txtPythonConsole.fileMenu.MenuItems:
        #     print menu.Label, menu.Kind
        # print self.txtPythonConsole.fileMenu.MenuItems[11].IsEnabled()
        # self.txtPythonConsole.fileMenu.MenuItems[11].Enable=False
        # print self.txtPythonConsole.fileMenu.MenuItems[11].IsEnabled()

        ############ Docking ###################

        self._mgr = aui.AuiManager()
        self._mgr.SetManagedWindow(self.pnlDocking)
        self._mgr.AddPane(
            self.dataTable,
            aui.AuiPaneInfo().Right().Name("Table").Show(
                show=False).Caption('Table View').MinSize(wx.Size(200, 200)))
        # DestroyOnClose(b=False)
        self._mgr.AddPane(
            self.pnlSelector,
            aui.AuiPaneInfo().Bottom().Name("Selector").Layer(0).Caption(
                'Series Selector').MinSize(wx.Size(100, 200)))
        self._mgr.AddPane(
            self.txtPythonScript,
            aui.AuiPaneInfo().Caption('Script').Name("Script").Show(
                show=False).Layer(0).Float().MinSize(wx.Size(200, 200)))
        # self._mgr.CreateFloatingFrame(self.txtPythonScript,  aui.AuiPaneInfo().Caption('Script').
        #         Name("Script").MinSize(wx.Size(500,800)))
        self._mgr.AddPane(
            self.txtPythonConsole,
            aui.AuiPaneInfo().Caption('Python Console').Name("Console").Layer(
                1).Show(show=False).Float())
        # self.txtPythonConsole.ToggleTools()

        self._mgr.AddPane(
            self.pnlPlot,
            aui.AuiPaneInfo().CenterPane().Name("Plot").Caption("Plot"))

        self.loadDockingSettings()

        self._mgr.Update()

        self.Bind(wx.EVT_CLOSE, self.OnClose)

        self._init_sizers()
        self._ribbon.Realize()
    def _init_ctrls(self, series_service):
        # generated method, don't edit
        logger.debug("Loading frame...")

        self.SetIcon(gtk_execute.getIcon())

        self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL,
                             False, u'Tahoma'))

        ############### Ribbon ###################
        logger.debug("Loading Ribbon Menu...")
        self._ribbon = mnuRibbon.mnuRibbon(parent=self, id=wx.ID_ANY, name='ribbon')

        if sys.platform == 'darwin':
            self.menu_bar = wx.MenuBar()
            self.help_menu = wx.Menu()

            self.help_menu.Append(wx.ID_ABOUT, "&About ODMTools")
            self.menu_bar.Append(self.help_menu, "&Help")

            self.SetMenuBar(self.menu_bar)
            self.Bind(wx.EVT_MENU, self.on_about_request, id=wx.ID_ABOUT)

            # self.menu_bar.SetAutoWindowMenu()

        ################ Docking Tools##############
        self.pnlDocking = wx.Panel(name='pnlDocking',
                                   parent=self, size=wx.Size(605, 458),
                                   style=wx.TAB_TRAVERSAL)

        ############# Graph ###############
        logger.debug("Loading Plot ...")
        self.pnlPlot = pnlPlot.pnlPlot(self.pnlDocking, self.taskserver)

        ################ Series Selection Panel ##################
        logger.debug("Loading Series Selector ...")


        self.pnlSelector = FrmSeriesSelector(self.pnlDocking, series_service, plot=self.pnlPlot, taskserver=self.taskserver, memdb = self.memDB)


        ####################grid Table View##################
        logger.debug("Loading DataTable ...")
        self.dataTable = FrmDataTable(self.pnlDocking)
        # self.dataTable = pnlDataTable.pnlDataTable(self.pnlDocking)
        # self.dataTable.toggleBindings()
        ############# Script & Console ###############
        logger.debug("Loading Python Console ...")
        self.txtPythonConsole = ODMToolsConsole(parent=self.pnlDocking, size=wx.Size(200, 200))
        wx.CallAfter(self._postStartup)



        logger.debug("Loading Python Script ...")
        self.txtPythonScript = pnlScript(name=u'txtPython', parent=self,
                                     size=wx.Size(200, 200))

        self.Bind(wx.EVT_CLOSE, self.onClose)


        Publisher.subscribe(self.onDocking, ("adjust.Docking"))
        Publisher.subscribe(self.onPlotSelection, ("select.Plot"))
        Publisher.subscribe(self.onExecuteScript, ("execute.script"))
        Publisher.subscribe(self.onChangeDBConn, ("change.dbConfig"))
        Publisher.subscribe(self.onSetScriptTitle, ("script.title"))
        #.subscribe(self.onSetScriptTitle, ("script.title"))
        Publisher.subscribe(self.onClose, ("onClose"))
        Publisher.subscribe(self.addEdit, ("selectEdit"))
        Publisher.subscribe(self.stopEdit, ("stopEdit"))
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_ODMTOOLS, name=u'ODMTools', parent=prnt,
               size=wx.Size(900, 700),
              style=wx.DEFAULT_FRAME_STYLE, title=u'ODM Tools')
        self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, u'Tahoma'))
        # Publisher.subscribe(self.addPlot, ("add.NewPlot"))
        # Publisher.subscribe(self.addEdit, ("edit.NewPlot"))
        Publisher.subscribe(self.onDocking, ("adjust.Docking"))

        Publisher.subscribe(self.onDocking, ("adjust.Docking"))
        Publisher.subscribe(self.onPlotSelection, ("select.Plot"))
        Publisher.subscribe(self.onExecuteScript, ("execute.script"))


        Publisher.subscribe(self.onExecuteScript, ("execute.script"))
        Publisher.subscribe(self.onChangeDBConn, ("change.dbConfig"))
        Publisher.subscribe(self.onSetScriptTitle, ("script.title"))
        Publisher.subscribe(self.OnClose, ("onClose"))


############### Ribbon ###################
        self._ribbon = mnuRibbon.mnuRibbon(parent=self, id=wx.ID_ANY, name ='ribbon')


################ Docking Tools##############
        self.pnlDocking = wx.Panel(id=wxID_ODMTOOLSPANEL1, name='pnlDocking',
              parent=self, size=wx.Size(605, 458),
              style=wx.TAB_TRAVERSAL)




################ Series Selection Panel ##################
        self.pnlSelector = pnlSeriesSelector.pnlSeriesSelector(id=wxID_PNLSELECTOR, name=u'pnlSelector',
               parent=self.pnlDocking, size=wx.Size(770, 388),
               style=wx.TAB_TRAVERSAL, dbservice= self.sc)


####################grid##################
        self.dataTable = pnlDataTable.pnlDataTable(id=wxID_ODMTOOLSGRID1, name='dataTable',
              parent=self.pnlDocking, size=wx.Size(376, 280),
              style=0)


############# Graph ###############
        self.pnlPlot= pnlPlot.pnlPlot(id=wxID_ODMTOOLSPANEL1, name='pnlPlot',
              parent=self.pnlDocking, size=wx.Size(605, 458),
               style=wx.TAB_TRAVERSAL)


############# Script & Console ###############

        self.txtPythonConsole = wx.py.crust.CrustFrame(id=wxID_TXTPYTHONCONSOLE,
                size=wx.Size(500,800), style=0)

        # Console tools object for usability
        self.console_tools = ConsoleTools(self._ribbon)
        self.txtPythonConsole.shell.run("Tools = app.TopWindow.console_tools", prompt=False, verbose=False)

        self.txtPythonScript = pnlScript(id=wxID_TXTPYTHONSCRIPT,
              name=u'txtPython', parent=self,
              size=wx.Size(200,200))


############ Docking ###################

        self._mgr = aui.AuiManager()
        self._mgr.SetManagedWindow(self.pnlDocking)
        self._mgr.AddPane(self.dataTable, aui.AuiPaneInfo().Right().Name("Table").
                Show(show=False).Caption('Table View').MinSize(wx.Size( 200, 200)))
        self._mgr.AddPane(self.pnlSelector, aui.AuiPaneInfo().Bottom().Name("Selector").
                Layer(0).Caption('Series Selector').MinSize(wx.Size(100, 200)) )
        self._mgr.AddPane(self.txtPythonScript,  aui.AuiPaneInfo().Caption('Script').
                Name("Script").Show(show=False).Layer(0).Float().MinSize(wx.Size(200,200)))
        self._mgr.AddPane(self.txtPythonConsole,  aui.AuiPaneInfo().Caption('Python Console').
                Name("Console").Layer(1).Show(show=False).Float())

        self._mgr.AddPane(self.pnlPlot,  aui.AuiPaneInfo().CenterPane().Name("Plot").Caption("Plot"))

        self.loadDockingSettings()

        self._mgr.Update()

        self.Bind(wx.EVT_CLOSE, self.OnClose)

        self._init_sizers()
        self._ribbon.Realize()
    def _init_ctrls(self):
        # generated method, don't edit
        logger.debug("Loading frame...")


        self.SetIcon(gtk_execute.getIcon())

        self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL,
                             False, u'Tahoma'))

        ############### Ribbon ###################
        logger.debug("Loading Ribbon Menu...")
        self._ribbon = mnuRibbon.mnuRibbon(parent=self, id=wx.ID_ANY, name='ribbon')


        if sys.platform == 'darwin':
            self.menu_bar  = wx.MenuBar()
            self.help_menu = wx.Menu()

            self.help_menu.Append(wx.ID_ABOUT,   "&About ODMTools")
            self.menu_bar.Append(self.help_menu, "&Help")

            self.SetMenuBar(self.menu_bar)
            self.Bind(wx.EVT_MENU, self.on_about_request, id=wx.ID_ABOUT)

    #        self.menu_bar.SetAutoWindowMenu()


        ################ Docking Tools##############
        self.pnlDocking = wx.Panel(id=wxID_ODMTOOLSPANEL1, name='pnlDocking',
                                   parent=self, size=wx.Size(605, 458),
                                   style=wx.TAB_TRAVERSAL)

        ############# Graph ###############
        logger.debug("Loading Plot ...")
        self.pnlPlot = pnlPlot.pnlPlot(id=wxID_ODMTOOLSPANEL1, name='pnlPlot',
                                       parent=self.pnlDocking, size=wx.Size(605, 458),
                                       style=wx.TAB_TRAVERSAL)

        ################ Series Selection Panel ##################
        logger.debug("Loading Series Selector ...")
        self.pnlSelector = FrmSeriesSelector(name=u'pnlSelector', parent=self.pnlDocking,
                                             size=wx.Size(770, 388), style=wx.TAB_TRAVERSAL, dbservice=self.sc,
                                             serviceManager=self.service_manager)

        ####################grid Table View##################
        logger.debug("Loading DataTable ...")
        self.dataTable = pnlDataTable.pnlDataTable(id=wxID_ODMTOOLSGRID1, name='dataTable',
                                                   parent=self.pnlDocking, size=wx.Size(376, 280),
                                                   style=0)

        ############# Script & Console ###############
        logger.debug("Loading Python Console ...")
        self.txtPythonConsole = ODMConsole(id=wxID_TXTPYTHONCONSOLE, parent=self.pnlDocking, size=wx.Size(200, 200) )
        wx.CallAfter(self._postStartup)

        self.txtPythonConsole.shell.run("import datetime", prompt=False, verbose=False)

        self.txtPythonConsole.shell.run("edit_service = app.TopWindow.record_service", prompt=False, verbose=False)
        #self.txtPythonConsole.shell.run("import datetime", prompt=False, verbose=False)

        logger.debug("Loading Python Script ...")
        self.txtPythonScript = pnlScript(id=wxID_TXTPYTHONSCRIPT, name=u'txtPython', parent=self,
                                         size=wx.Size(200, 200))

        ############ Docking ###################
        logger.debug("Loading AuiManager ...")
        self._mgr = aui.AuiManager()
        self._mgr.SetManagedWindow(self.pnlDocking)

        self._mgr.AddPane(self.pnlPlot, aui.AuiPaneInfo().CenterPane()
                          .Name("Plot").Caption("Plot").MaximizeButton(True).DestroyOnClose(False)

        )

        self._mgr.AddPane(self.dataTable, aui.AuiPaneInfo().Right().Name("Table").
                          Show(show=False).Caption('Table View').MinSize(wx.Size(200, 200)).Floatable().Movable().
                          Position(1).MinimizeButton(True).MaximizeButton(True).DestroyOnClose(False)

        )

        self._mgr.AddPane(self.pnlSelector, aui.AuiPaneInfo().Bottom().Name("Selector").MinSize(wx.Size(50, 200)).
                          Movable().Floatable().Position(0).MinimizeButton(True).MaximizeButton(True).CloseButton(True)
                          .DestroyOnClose(False)
        )

        self._mgr.AddPane(self.txtPythonScript, aui.AuiPaneInfo().Caption('Script').
                          Name("Script").Movable().Floatable().Right()
                          .MinimizeButton(True).MaximizeButton(True).FloatingSize(size=(400, 400))
                          .CloseButton(True).Float().FloatingPosition(pos=(self.Position))
                          .Hide().CloseButton(True).DestroyOnClose(False)
        )


        self._mgr.AddPane(self.txtPythonConsole, aui.AuiPaneInfo().Caption('Python Console').
                          Name("Console").FloatingSize(size=(300, 400)).MinimizeButton(
            True).Movable().Floatable().MaximizeButton(True).CloseButton(True).Float()
                          .FloatingPosition(pos=(self.Position)).Show(show=False).DestroyOnClose(False)
        )


        ## TODO Fix loadingDockingSettings as it doesn't load it correctly.
        #self.loadDockingSettings()

        self.refreshConnectionInfo()
        self._mgr.Update()
        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.dataTable.toggleBindings()

        Publisher.subscribe(self.onDocking, ("adjust.Docking"))
        Publisher.subscribe(self.onPlotSelection, ("select.Plot"))
        Publisher.subscribe(self.onExecuteScript, ("execute.script"))
        Publisher.subscribe(self.onChangeDBConn, ("change.dbConfig"))
        Publisher.subscribe(self.onSetScriptTitle, ("script.title"))
        #.subscribe(self.onSetScriptTitle, ("script.title"))
        Publisher.subscribe(self.onClose, ("onClose"))
        Publisher.subscribe(self.addEdit, ("selectEdit"))
        Publisher.subscribe(self.stopEdit, ("stopEdit"))

        self._init_sizers()
        self._ribbon.Realize()
        logger.debug("System starting ...")