Beispiel #1
0
    def v_content(self):

        # configuración de lenguajes
        self.i18n = I18nLocale(self.properties.get_language())

        # aui que manejará los paneles principales
        self._mgr = aui.AuiManager(self, aui.AUI_MGR_ANIMATE_FRAMES)

        # add Menu Bar
        self.menu_bar = TMenuBar(self)
        self.SetMenuBar(self.menu_bar)

        self.set_status_bar()

        self.build_panels()

        self.Bind(wx.EVT_SIZE, self.on_resize_window)
Beispiel #2
0
    def scikit(self):

        # Create an AUI Manager and tell it to manage this Frame
        NMFAuiWindow._manager = aui.AuiManager()
        NMFAuiWindow._manager.SetManagedWindow(self)
        #sizer = wx.BoxSizer(wx.HORIZONTAL)
        
        nmf=scikitpanel(parent=self)
        
        #sizer.Add(nmf, 1, wx.EXPAND)
        #self.SetSizer(sizer,deleteOld=True)

        control_info = aui.AuiPaneInfo().Top().Name('Scikit Parameters').Caption('Scikit Parameters').\
            CloseButton(True).MaximizeButton(False).MinimizeButton(False).Show().Floatable(False).DestroyOnClose(b=True).MinSize((600,42))
        
        NMFAuiWindow._manager.AddPane(nmf, control_info)
        NMFAuiWindow._manager.Update()    
Beispiel #3
0
    def __init__(self, parent, name, statusbar):
        """"""
        #region -----------------------------------------------> Initial setup
        self.parent = parent
        self.name = name

        super().__init__(parent, name=name)
        #endregion --------------------------------------------> Initial setup

        #region -----------------------------------------------------> Widgets
        self.lc = dtsWidget.ListZebra(
            self,
            colLabel=config.label[name]['Column'],
            colSize=config.size['ListCtrl']['Peptide'],
        )
        self.userInput = pstPane.PeptidePane(self, name, statusbar, lc=self.lc)
        #endregion --------------------------------------------------> Widgets

        #region -------------------------------------------------> AUI Control
        self._mgr = aui.AuiManager()
        self._mgr.SetManagedWindow(self)
        #--> Add standard panels
        self._mgr.AddPane(
            self.userInput,
            aui.AuiPaneInfo().CenterPane().Caption(
                config.title['UserInput']).CaptionVisible().Floatable(
                    b=False).CloseButton(visible=False).Movable(
                        b=False).PaneBorder(visible=False, ),
        )
        self._mgr.AddPane(
            self.lc,
            aui.AuiPaneInfo().Right().Caption(
                config.title['ListCtrl']).Floatable(b=False).CloseButton(
                    visible=False).Movable(b=False).PaneBorder(
                        visible=False, ),
        )
        #---
        self._mgr.Update()
        #endregion ----------------------------------------------> AUI Control

    #---
    #endregion -----------------------------------------------> Instance setup


#---
#endregion ----------------------------------------------------------> Classes
Beispiel #4
0
    def __init__(self, application, controller):
        size = application.settings.get('mainframe size', (1100, 700))
        wx.Frame.__init__(self,
                          parent=None,
                          id=wx.ID_ANY,
                          title='RIDE',
                          pos=application.settings.get('mainframe position',
                                                       (50, 30)),
                          size=size,
                          style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER)

        self._mgr = aui.AuiManager()

        # tell AuiManager to manage this frame
        self._mgr.SetManagedWindow(self)

        # set frame icon
        # self.SetIcon(Icon('widgets/robot.ico')) # Maybe is not needed
        # self.SetMinSize(size)
        self.SetMinSize(wx.Size(400, 300))

        self.ensure_on_screen()
        if application.settings.get('mainframe maximized', False):
            self.Maximize()
        self._application = application
        self._controller = controller
        self.favicon = Icon(
            os.path.join(os.path.dirname(__file__), "..", "widgets",
                         "robot.ico"), wx.BITMAP_TYPE_ICO, 256, 256)
        self.SetIcon(self.favicon)
        self._init_ui()
        self._plugin_manager = PluginManager(self.notebook)
        self._review_dialog = None
        self._view_all_tags_dialog = None
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_MOVE, self.OnMove)
        self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize)
        self.Bind(wx.EVT_DIRCTRL_FILEACTIVATED, self.OnOpenFile)
        self._subscribe_messages()
        #print("DEBUG: Call register_tools, actions: %s" % self.actions.__repr__())
        if PY2:
            wx.CallLater(100, self.actions.register_tools)  # DEBUG
        else:
            wx.CallAfter(self.actions.register_tools)  # DEBUG
    def __init__(self, messageProcessingGraphWindow):
        wx.Frame.__init__(self,
                          None,
                          id=wx.ID_ANY,
                          title="RemoteConsole+ output windows",
                          size=Config["UI behavior"]
                          ["Output windows container"]["Window size"],
                          pos=Config["UI behavior"]["Output windows container"]
                          ["Window position"])
        self.InitializeMenuBar()
        self.messageProcessingGraphWindow = messageProcessingGraphWindow
        self._auiMgr = aui.AuiManager()
        self._auiMgr.SetManagedWindow(self)

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

        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_MOVE, self.OnMove)
Beispiel #6
0
    def __init__(self,
                 parent,
                 controller,
                 title='',
                 width=800,
                 height=600,
                 style=wx.DEFAULT_FRAME_STYLE,
                 **kwargs):
        """
        Main Window.

        :param parent: parent wx.Frame
        :param controller: local controller
        :param title:
        :param width:
        :param height:
        :param style:
        :param kwargs:
        :return:
        """
        wx.Frame.__init__(self,
                          parent,
                          title=title,
                          size=(width, height),
                          style=style)

        self.parent = parent

        self.controller = controller
        self.controller.frame = self

        self.mgr = aui.AuiManager(self)

        # notify AUI which frame to use
        self.mgr.SetManagedWindow(self)
        self.mgr.Update()

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

        self.menu_bar = None

        # Status Bar
        self.status_bar = CustomStatusBar(self)
        self.SetStatusBar(self.status_bar)
    def test_lib_agw_auiCtor(self):
        self._mgr = aui.AuiManager()

        # tell AuiManager to manage this frame
        self._mgr.SetManagedWindow(self.frame)

        pane = wx.Panel()
        self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane1").Caption("A pane")
                          .CenterPane())
        pane = wx.Panel()
        self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane2").Caption("A pane")
                          .Top())
        pane = wx.Panel()
        self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane3").Caption("A pane")
                          .Left())
        pane = wx.Panel()
        self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane4").Caption("A pane")
                          .Bottom())
        self._mgr.Update()
Beispiel #8
0
    def aui_panes_design(self):
        self.mgr = aui.AuiManager(self)
        self.mgr.SetManagedWindow(self)

        self.mgr.AddPane(self.toolbar_buttons(),
                         aui.AuiPaneInfo().Top().CloseButton(False))
        self.mgr.AddPane(
            self.recent_activities(),
            aui.AuiPaneInfo().Left().Caption("Recent activities").CloseButton(
                False).MinimizeButton(True))

        self._center_panel = aui.AuiPaneInfo().CenterPane().CloseButton(
            False).MinimizeButton(True)
        #self.mgr.AddPane(self.working_area(), aui.AuiPaneInfo().CenterPane().CloseButton(False).MinimizeButton(True))
        self.mgr.AddPane(
            self.information_area(),
            aui.AuiPaneInfo().Bottom().Caption("Information area").CloseButton(
                False).MinimizeButton(True))
        self.mgr.Update()
Beispiel #9
0
    def __init__(self, parent, IDmodele=None):
        wx.Panel.__init__(self, parent, -1)
        self.parent = parent
        self.IDmodele = IDmodele

        self._mgr = aui.AuiManager()
        self._mgr.SetManagedWindow(self)

        # Propriétés
        self.SetMinSize((920, 740))

        # Importation des données
        # interactive_data = Data(IDmodele=IDmodele)
        # categorie = interactive_data.categorie

        # Création des widgets
        couleur_zone_travail = wx.Colour(255, 255, 255)
        self.ctrl_canvas = Panel_canvas(self, IDmodele=self.IDmodele, categorie="", couleur_zone_travail=couleur_zone_travail,
                                        mode="visualisation")#, interactive_data=interactive_data)

        # Barres d'outils
        self.toolbar1 = self.MakeToolBar1()
        self.toolbar2 = self.MakeToolBar2()

        # Création du panel central
        self._mgr.AddPane(self.ctrl_canvas, aui.AuiPaneInfo().Name("canvas").CenterPane())

        # Création des barres d'outils
        self._mgr.AddPane(self.toolbar1, aui.AuiPaneInfo().
                          Name("barreOutil_modes").Caption("Modes").
                          ToolbarPane().Top().
                          LeftDockable(True).RightDockable(True))

        self._mgr.AddPane(self.toolbar2, aui.AuiPaneInfo().
                          Name("barreOutil_outils").Caption("Modes").
                          ToolbarPane().Top().
                          LeftDockable(True).RightDockable(True))

        self._mgr.Update()

        # Init Canvas
        self.ctrl_canvas.Init_canvas()
        self.SendSizeEvent()
Beispiel #10
0
    def __init__(self, application, controller):
        size = application.settings.get('mainframe size', (1100, 700))
        wx.Frame.__init__(self, parent=None, id = wx.ID_ANY, title='RIDE',
                          pos=application.settings.get('mainframe position', (50, 30)),
                          size=size, style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER)

        # set Left to Right direction (while we don't have localization)
        self.SetLayoutDirection(wx.Layout_LeftToRight)
        # self.SetLayoutDirection(wx.Layout_RightToLeft)

        self._mgr = aui.AuiManager()

        # tell AuiManager to manage this frame
        self._mgr.SetManagedWindow(self)

        # set frame icon
        # self.SetIcon(Icon('widgets/robot.ico')) # Maybe is not needed
        # self.SetMinSize(size)
        self.SetMinSize(wx.Size(400, 300))

        self.ensure_on_screen()
        if application.settings.get('mainframe maximized', False):
            self.Maximize()
        self._application = application
        self._controller = controller
        self.favicon = Icon(os.path.join(os.path.dirname(__file__), "..",
                                         "widgets","robot.ico"),
                            wx.BITMAP_TYPE_ICO, 256, 256)
        self.SetIcon(self.favicon)  #TODO use SetIcons for all sizes
        self._init_ui()
        self._plugin_manager = PluginManager(self.notebook)
        self._review_dialog = None
        self._view_all_tags_dialog = None
         #, self, self.actions,
        # self._application.settings)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_MOVE, self.OnMove)
        self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize)
        self.Bind(wx.EVT_DIRCTRL_FILEACTIVATED, self.OnOpenFile)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnMenuOpenFile)
        self._subscribe_messages()
        wx.CallAfter(self.actions.register_tools)  # DEBUG
Beispiel #11
0
    def __init__(self, application, controller):
        size = application.settings.get('mainframe size', (1100, 700))
        wx.Frame.__init__(self,
                          parent=None,
                          id=wx.ID_ANY,
                          title='RIDE',
                          pos=application.settings.get('mainframe position',
                                                       (50, 30)),
                          size=size,
                          style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER)

        # set Left to Right direction (while we don't have localization)
        self.SetLayoutDirection(wx.Layout_LeftToRight)
        # self.SetLayoutDirection(wx.Layout_RightToLeft)

        self._mgr = aui.AuiManager()

        # tell AuiManager to manage this frame
        self._mgr.SetManagedWindow(self)

        self.SetMinSize(wx.Size(400, 300))

        self.ensure_on_screen()
        if application.settings.get('mainframe maximized', False):
            self.Maximize()
        self._application = application
        self._controller = controller
        self._image_provider = ImageProvider()
        self._init_ui()
        self._task_bar_icon = RIDETaskBarIcon(self._image_provider)
        self._plugin_manager = PluginManager(self.notebook)
        self._review_dialog = None
        self._view_all_tags_dialog = None
        self._current_external_dir = None
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_MOVE, self.OnMove)
        self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize)
        self.Bind(wx.EVT_DIRCTRL_FILEACTIVATED, self.OnOpenFile)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnMenuOpenFile)
        self._subscribe_messages()
        wx.CallAfter(self.actions.register_tools)  # DEBUG
Beispiel #12
0
    def _init_aui_manager(self):

        ############ 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()
Beispiel #13
0
    def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = 'MeltPoolApp', 
                            size = wx.Size(-1,-1), pos = wx.DefaultPosition, 
                            style = wx.RESIZE_BORDER|wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        App.__init__(self)
        self.auimgr = aui.AuiManager()
        self.auimgr.SetManagedWindow(self)
        self.SetSizeHints(wx.Size(1024,768))
        
        self.init_menu()
        self.init_tool()
        self.init_canvas()

        self.Layout()
        self.auimgr.Update()
        self.Fit()
        self.Centre(wx.BOTH)

        self.Bind(wx.EVT_CLOSE, self.on_close)
        self.Bind(aui.EVT_AUI_PANE_CLOSE, self.on_pan_close)
    def __init__(self, parent, title, size):

        wx.Frame.__init__(self, parent, -1, title, size=size, name="Example1")

        self._auiMgr = AUI.AuiManager()
        self._auiMgr.SetManagedWindow(self)

        self._persistMgr = PM.PersistenceManager.Get()
        self._persistMgr.SetPersistenceFile(_configFile1)

        self.CreateMenuBar()
        self.CreateAuiToolBar()

        self.BuildPanes()

        self.SetIcon(images.Mondrian.Icon)
        self.CenterOnParent()
        self.Show()

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        wx.CallAfter(self.RegisterControls)
	def __init__(self):
		wx.Frame.__init__(self, None, wx.ID_ANY, 
						  "AGW AUI Notebook Tutorial",
						  size=(600,400))
 
		self._mgr = aui.AuiManager()
 
		# tell AuiManager to manage this frame
		self._mgr.SetManagedWindow(self)
 
		notebook = aui.AuiNotebook(self)
		panelOne = TabPanelOne(notebook)
		panelTwo = TabPanelOne(notebook)
 
		notebook.AddPage(panelOne, "PanelOne", False)
		notebook.AddPage(panelTwo, "PanelTwo", False)
 
		self._mgr.AddPane(notebook, 
						  aui.AuiPaneInfo().Name("notebook_content").
						  CenterPane().PaneBorder(False)) 
		self._mgr.Update()
Beispiel #16
0
    def _InitAUIManagerStyles(self):
        # Setup the AUI window manager and configure settings so
        # that we get the style that we want instead
        # of the yucky default colors. :)
        self._mgr = aui.AuiManager()
        art = self._mgr.GetArtProvider()
        self._mgr.SetManagedWindow(self)
        self._mgr.SetAGWFlags(self._mgr.GetAGWFlags()
                              ^ aui.AUI_MGR_LIVE_RESIZE)

        art.SetMetric(aui.AUI_DOCKART_SASH_SIZE, 3)
        art.SetMetric(aui.AUI_DOCKART_PANE_BORDER_SIZE, 5)
        art.SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_NONE)
        art.SetColour(aui.AUI_DOCKART_BACKGROUND_COLOUR, wx.Colour("#404040"))
        art.SetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR,
                      wx.Colour("#404040"))
        art.SetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
                      wx.Colour("#fff"))
        art.SetColour(aui.AUI_DOCKART_BORDER_COLOUR, wx.Colour("#404040"))
        art.SetColour(aui.AUI_DOCKART_SASH_COLOUR, wx.Colour("#333"))
        art.SetColour(aui.AUI_DOCKART_GRIPPER_COLOUR, wx.Colour("#404040"))
    def __init__(self,
                 parent,
                 id=-1,
                 title="AUI Test",
                 pos=wx.DefaultPosition,
                 size=(800, 600),
                 style=wx.DEFAULT_FRAME_STYLE):

        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        self._mgr = aui.AuiManager()

        # notify AUI which frame to use
        self._mgr.SetManagedWindow(self)

        # create several text controls
        text1 = wx.TextCtrl(self, -1,
                            "Pane 1 - sample text", wx.DefaultPosition,
                            wx.Size(200, 150), wx.NO_BORDER | wx.TE_MULTILINE)

        text2 = wx.TextCtrl(self, -1,
                            "Pane 2 - sample text", wx.DefaultPosition,
                            wx.Size(200, 150), wx.NO_BORDER | wx.TE_MULTILINE)

        text3 = wx.TextCtrl(self, -1,
                            "Main content window", wx.DefaultPosition,
                            wx.Size(200, 150), wx.NO_BORDER | wx.TE_MULTILINE)

        # add the panes to the manager
        self._mgr.AddPane(text1,
                          aui.AuiPaneInfo().Left().Caption("Pane Number One"))
        self._mgr.AddPane(
            text2,
            aui.AuiPaneInfo().Bottom().Caption("Pane Number Two"))
        self._mgr.AddPane(text3, aui.AuiPaneInfo().CenterPane())

        # tell the manager to "commit" all the changes just made
        self._mgr.Update()

        self.Bind(wx.EVT_CLOSE, self.OnClose)
Beispiel #18
0
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
        
        self.SetAutoLayout(True)
        
        self._mgr = aui.AuiManager(agwFlags = aui.AUI_MGR_DEFAULT | aui.AUI_MGR_AUTONB_NO_CAPTION)
        atabstyle = self._mgr.GetAutoNotebookStyle()
        self._mgr.SetAutoNotebookStyle((atabstyle ^ aui.AUI_NB_BOTTOM) | aui.AUI_NB_TOP)
        # tell AuiManager to manage this frame
        self._mgr.SetManagedWindow(self)
        
        #wx.EVT_SIZE(self, self.OnSize)
        
        self.paneHooks = []
        self.pane0 = None
        
        self.adding_panes=False

        self._menus = {}
        # Menu Bar
        self.menubar = wx.MenuBar()
        self.SetMenuBar(self.menubar)
Beispiel #19
0
    def _loadui(self):
        self._top_panel = self._build_top()
        bottom_panel = self._build_bottom()

        self._layout = aui.AuiManager()
        self._layout.SetManagedWindow(self)
        self._layout.AddPane(
            self._top_panel,
            aui.AuiPaneInfo().Name("TopView").CenterPane().Show()
        )
        self._layout.AddPane(
            bottom_panel,
            aui.AuiPaneInfo().Name("BottomView").Bottom().MinSize((-1, 110)).CaptionVisible(False)
        )

        self._anchorx_text.SetLabelText('0.5')
        self._anchory_text.SetLabelText('0.3')
        self._offsetx_text.SetLabelText('0')
        self._offsety_text.SetLabelText('0')
        self._scalex_text.SetLabelText('0')
        self._scaley_text.SetLabelText('0')
        self._layout.Update()
Beispiel #20
0
    def aui_panes_design(self):
        self.mgr = aui.AuiManager(self)
        self.mgr.SetManagedWindow(self)

        # desing of each panes

        self.mgr.AddPane(
            self.toolbar_buttons(),
            aui.AuiPaneInfo().CaptionVisible(False).Name(
                "toolbar_pane").MinSize(0,
                                        30).Fixed().Top().CloseButton(False))
        self.mgr.AddPane(
            self.recent_activities(),
            aui.AuiPaneInfo().Name("recent_pane").BestSize(180, 0).MinSize(
                180, 0).Left().Caption("Recent activities").CloseButton(
                    False).MinimizeButton(True))
        #self._center_panel = aui.AuiPaneInfo().CenterPane().CloseButton(False).MinimizeButton(True)
        self.mgr.AddPane(
            self.working_area_process(),
            aui.AuiPaneInfo().Name("process_pane").CenterPane().CloseButton(
                False).MinimizeButton(True))
        self.mgr.AddPane(
            self.working_area_result(),
            aui.AuiPaneInfo().Name("insight_pane").CenterPane().CloseButton(
                False).MinimizeButton(True).Hide())
        self.mgr.AddPane(
            self.working_area_preprocess(),
            aui.AuiPaneInfo().Name("preprocess_pane").CenterPane().CloseButton(
                False).MinimizeButton(True).Hide())
        self.mgr.AddPane(
            self.working_area_training(),
            aui.AuiPaneInfo().Name("training_pane").CenterPane().CloseButton(
                False).MinimizeButton(True).Hide())
        self.mgr.AddPane(
            self.information_area(),
            aui.AuiPaneInfo().Name("information_pane").Bottom().Caption(
                "Information area").CloseButton(False).MinimizeButton(True))
        self.mgr.Update()
Beispiel #21
0
    def __init__(self, parent=None):
        """构造函数"""

        wx.Frame.__init__(self, parent, -1, APP_TITLE)
        self.Maximize()

        # 设置图标
        icon = wx.Icon(os.path.join("res", "PyEditor.ico"))
        self.SetIcon(icon)

        # 主框架布局
        self._mgr = aui.AuiManager()

        # 生成菜单栏
        self.__CreateMenuBar()

        # 生成工具栏
        self.__CreateToolbar()

        # 生成状态栏
        self.__CreateStatusbar()

        # 生成代码编辑区
        self.__CreateEditorView()

        # 生成目录树
        self.__CreateTreeView()

        # 生成信息区
        self.__CreateDebugView()

        # 总成
        self._mgr.SetManagedWindow(self)
        self._mgr.Update()

        # 绑定事件
        self.__BindEvt()
Beispiel #22
0
    def __init__(self, *args, **kwds):
        kwds[
            "style"] = wx.ICONIZE | wx.CAPTION | wx.MINIMIZE | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.SYSTEM_MENU | wx.CLIP_CHILDREN | wx.RESIZE_BORDER
        wx.Frame.__init__(self, *args, **kwds)
        self.auiManager = aui.AuiManager()
        self.auiManager.SetManagedWindow(self)

        preferences = Preferences()
        preferences.loadPreferences()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(EVT_REQUEST_FROM_PVS, PVSCommunicator().processEvent)
        self.Bind(EVT_RESPONSE_FROM_PVS, PVSCommandManager().processResponse)
        #self.Bind(wx.EVT_IDLE, self.OnIdle)
        self.auiManager.Bind(aui.EVT_AUI_PANE_CLOSE, self.OnPanelClose)

        self.statusbar = self.CreateStatusBar(2)
        self.statusbar.SetStatusWidths([-1, -1])

        # Menu Bar
        self.menubar = MainFrameMenu()
        self.SetMenuBar(self.menubar)
        # Menu Bar end

        self.mainPanel = wx.Panel(self, wx.ID_ANY)

        notebook = aui.AuiNotebook(self)
        notebook.SetArtProvider(aui.ChromeTabArt())
        RichEditorManager().setNotebook(notebook)

        self.__do_layout()
        self.SetTitle(MAINFRAME)
        pub.sendMessage(PUB_CONSOLEINITIALIZE)
        pub.subscribe(self.handlePVSModeUpdated, PUB_UPDATEPVSMODE)
        pub.subscribe(self.handlePVSContextUpdated, PUB_UPDATEPVSCONTEXT)
        pub.subscribe(self.handleNumberOfOpenFilesChanged,
                      PUB_NUMBEROFOPENFILESCHANGED)
        pub.subscribe(self.setStatusbarText, PUB_UPDATESTATUSBAR)
Beispiel #23
0
    def __init__(self, title):
        wx.Frame.__init__(self, None, -1, title, size=(600, 400))

        splitWindow = splitter.MultiSplitterWindow(self, wx.ID_ANY)

        #left treelist
        self.treeList = CTL.CustomTreeCtrl(splitWindow)
        root = self.treeList.AddRoot(u'上证交易所')
        for instrument in self.LoadInstruments():
            self.treeList.AppendItem(root,
                                     instrument[0]).SetData(instrument[1])
        self.treeList.Expand(root)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeDoubleClick)

        splitWindow.AppendWindow(self.treeList)

        #import AUI
        self._mgr = aui.AuiManager()
        self._mgr.SetManagedWindow(splitWindow)

        notebook = aui.AuiNotebook(splitWindow)
        panelOne = TabPanelOne(notebook)
        panelTwo = TabPanelOne(notebook)

        notebook.AddPage(panelOne, u"历史数据", False)
        notebook.AddPage(panelTwo, u"图表", False)

        self._mgr.AddPane(
            notebook,
            aui.AuiPaneInfo().Name('content').CenterPane().PaneBorder(False))
        self._mgr.Update()

        splitWindow.AppendWindow(notebook)

        self.statusBar = self.CreateStatusBar()
        self.menuBar = self.CreateMenu()
Beispiel #24
0
    def __init__(self, parent, title):
        '''构造函数'''
        # self=Frame父类框,parent=None
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          title,
                          style=wx.MAXIMIZE | wx.DEFAULT_FRAME_STYLE)
        # 设置背景为白色
        self.SetBackgroundColour("#FFFFFF")
        self.count_page = 0
        # 设置页面开启关闭状态
        self.login_state = 0  # 登录界面
        self.register_state = 0  # 注册界面
        self.set_state = 0  # 设置界面
        self.about_state = 0  # 关于界面
        self.fun_state = 0  # 功能界面
        #  数据库连接状态
        self.dbhelper = None
        self.connect_state = 0
        # 设置面板
        p_top = wx.Panel(self, -1)  # 标题
        p_left = wx.Panel(self, -1)  # 操作界面
        #  设置字体
        self.font1 = wx.Font(pointSize=14,
                             family=wx.DEFAULT,
                             style=wx.NORMAL,
                             weight=wx.NORMAL,
                             underline=False)
        self.font2 = wx.Font(pointSize=13,
                             family=wx.DEFAULT,
                             style=wx.NORMAL,
                             weight=wx.NORMAL,
                             underline=False)
        # 设置多标签页面
        self.p_center0 = wx.Panel(self, -1)
        self.notebook = wx.Notebook(self.p_center0, -1)
        # 设置多标签页面
        self.p_center1 = wx.Panel(self, -1)
        self.nb = wx.Notebook(self.p_center1, -1)
        #
        self.notebook.SetFont(self.font2)
        self.nb.SetFont(self.font2)
        # 创建操作按钮
        login_button = wx.Button(p_left,
                                 label="登  录",
                                 pos=(50, 100),
                                 size=(100, 40))
        register_button = wx.Button(p_left,
                                    label="注  册",
                                    pos=(50, 200),
                                    size=(100, 40))
        set_button = wx.Button(p_left,
                               label="设  置",
                               pos=(50, 300),
                               size=(100, 40))
        about_button = wx.Button(p_left,
                                 label="关  于",
                                 pos=(50, 400),
                                 size=(100, 40))
        quit_button = wx.Button(p_left,
                                label="退  出",
                                pos=(50, 500),
                                size=(100, 40))
        #
        login_button.SetFont(self.font1)
        register_button.SetFont(self.font1)
        set_button.SetFont(self.font1)
        about_button.SetFont(self.font1)
        quit_button.SetFont(self.font1)
        # 绑定事件处理
        register_button.Bind(wx.EVT_BUTTON, self.register)  # 注册
        login_button.Bind(wx.EVT_BUTTON, self.login)  # 登录
        set_button.Bind(wx.EVT_BUTTON, self.set_page)  # 设置
        about_button.Bind(wx.EVT_BUTTON, self.about)  # 关于
        quit_button.Bind(wx.EVT_BUTTON, self.OnExit)  # 退出
        # 创建logo静态文本,设置字体属性和图片
        bmp = wx.Image("image/logo.jpg", wx.BITMAP_TYPE_JPEG)
        wx.StaticBitmap(p_top, -1, bitmap=bmp.ConvertToBitmap())
        logo = wx.StaticText(p_top, label="专 利 管 理 系 统", pos=(500, 20))
        # 设置字体
        font = wx.Font(pointSize=35,
                       family=wx.DEFAULT,
                       style=wx.NORMAL,
                       weight=wx.BOLD,
                       underline=False)
        logo.SetFont(font)
        #
        self._mgr = aui.AuiManager()  # 创建一个布局管理器
        self._mgr.SetManagedWindow(self)  # 告诉主窗口由mgr来管理界面
        # 添加界面上的各个区域
        self._mgr.AddPane(
            p_top,
            aui.AuiPaneInfo().Name("topPanel").Top().MinSize(
                (0,
                 80)).Caption(u"标题栏").CaptionVisible(False).Resizable(False))
        self._mgr.AddPane(
            p_left,
            aui.AuiPaneInfo().Name("LeftPanel").Left().MinSize(
                (200, -1)).Caption(u"操作区").CaptionVisible(
                    False).MinimizeButton(False).MaximizeButton(
                        False).CloseButton(False).Resizable(False))
        self._mgr.AddPane(
            self.p_center0,
            aui.AuiPaneInfo().Name("CenterPanel0").CenterPane().Hide())
        self._mgr.AddPane(
            self.p_center1,
            aui.AuiPaneInfo().Name("CenterPanel1").CenterPane().Hide())

        # 更新界面显示
        self._mgr.Update()
Beispiel #25
0
    def __init__(self, parent, *args, **kwargs):
        try:
            S = kwargs.pop("S")

        except KeyError:
            S = None

        try:
            dimensions = kwargs.pop("dimensions")

        except KeyError:
            dimensions = (config["grid_rows"], config["grid_columns"],
                          config["grid_tables"])

        wx.Frame.__init__(self, parent, *args, **kwargs)

        self.interfaces = GuiInterfaces(self)

        try:
            self._mgr = aui.AuiManager(self)

        except Exception:
            # This may fail if py.test runs under Windows
            # Therefore, we set up a basic framework for the unit tests
            self.grid = Grid(self, -1, S=S, dimensions=dimensions)
            self.clipboard = Clipboard()
            self.actions = AllMainWindowActions(self.grid)

        self.parent = parent

        self.handlers = MainWindowEventHandlers(self)

        # Program states
        # --------------

        self._states()

        # GUI elements
        # ------------

        # Menu Bar
        self.menubar = wx.MenuBar()
        self.main_menu = MainMenu(parent=self, menubar=self.menubar)
        self.SetMenuBar(self.menubar)

        # Disable menu item for leaving safe mode
        post_command_event(self, self.SafeModeExitMsg)

        # Status bar
        statusbar = StatusBar(self)
        self.SetStatusBar(statusbar)

        welcome_text = _("Welcome to pyspread.")
        post_command_event(self, self.StatusBarMsg, text=welcome_text)

        # Toolbars
        self.main_toolbar = MainToolbar(self, -1)
        self.macro_toolbar = MacroToolbar(self, -1)
        self.find_toolbar = FindToolbar(self, -1)
        self.attributes_toolbar = AttributesToolbar(self, -1)
        self.widget_toolbar = WidgetToolbar(self, -1)

        # Entry line
        self.entry_line_panel = EntryLineToolbarPanel(self, -1)

        # Main grid
        self.grid = Grid(self, -1, S=S, dimensions=dimensions)

        # TableChoiceListCtrl
        self.table_list_panel = TableChoiceListCtrl(self, self.grid)

        # Clipboard
        self.clipboard = Clipboard()

        # Main window actions

        self.actions = AllMainWindowActions(self.grid)

        # Layout and bindings

        self._set_properties()
        self._do_layout()
        self._bind()
Beispiel #26
0
    def __init__(self,
                 wnd=None,
                 locals=None,
                 config=None,
                 app=None,
                 title="wxPython Widget Inspection Tool",
                 *args,
                 **kw):
        kw['title'] = title
        wx.Frame.__init__(self, *args, **kw)

        self.SetExtraStyle(wx.WS_EX_BLOCK_EVENTS)
        self.includeSizers = False
        self.started = False

        self.SetIcon(Icon.GetIcon())
        self.MakeToolBar()
        panel = wx.Panel(self, size=self.GetClientSize())

        # tell FrameManager to manage this frame
        self.mgr = aui.AuiManager(
            panel, aui.AUI_MGR_DEFAULT
            | aui.AUI_MGR_TRANSPARENT_DRAG
            | aui.AUI_MGR_ALLOW_ACTIVE_PANE)

        # make the child tools
        self.tree = InspectionTree(panel, size=(100, 300))
        self.info = InspectionInfoPanel(
            panel,
            style=wx.NO_BORDER,
        )

        if not locals:
            locals = {}
        myIntroText = (
            "Python %s on %s, wxPython %s\n"
            "NOTE: The 'obj' variable refers to the object selected in the tree."
            % (sys.version.split()[0], sys.platform, wx.version()))
        self.crust = wx.py.crust.Crust(
            panel,
            locals=locals,
            intro=myIntroText,
            showInterpIntro=False,
            style=wx.NO_BORDER,
        )
        self.locals = self.crust.shell.interp.locals
        self.crust.shell.interp.introText = ''
        self.locals['obj'] = self.obj = wnd
        self.locals['app'] = app
        self.locals['wx'] = wx
        wx.CallAfter(self._postStartup)

        # put the chlid tools in AUI panes
        self.mgr.AddPane(
            self.info,
            aui.AuiPaneInfo().Name("info").Caption("Object Info").CenterPane().
            CaptionVisible(True).CloseButton(False).MaximizeButton(True))
        self.mgr.AddPane(
            self.tree,
            aui.AuiPaneInfo().Name("tree").Caption(
                "Widget Tree").CaptionVisible(True).Left().Dockable(
                    True).Floatable(True).BestSize(
                        (280, 200)).CloseButton(False).MaximizeButton(True))
        self.mgr.AddPane(
            self.crust,
            aui.AuiPaneInfo().Name("crust").Caption("PyCrust").CaptionVisible(
                True).Bottom().Dockable(True).Floatable(True).BestSize(
                    (400, 200)).CloseButton(False).MaximizeButton(True))

        self.mgr.Update()

        if config is None:
            config = wx.Config('wxpyinspector')
        self.config = config
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        if self.Parent:
            tlw = self.Parent.GetTopLevelParent()
            tlw.Bind(wx.EVT_CLOSE, self.OnClose)
        self.LoadSettings(self.config)
        self.crust.shell.lineNumbers = False
        self.crust.shell.setDisplayLineNumbers(False)
        self.crust.shell.SetMarginWidth(1, 0)
Beispiel #27
0
    def __init__(self, parent, size):
        """构造函数"""

        wx.Frame.__init__(self,
                          None,
                          -1,
                          'wxPlot',
                          style=wx.DEFAULT_FRAME_STYLE)
        self.SetSize(parent.size)
        self.Center()
        self.SetIcon(wx.Icon(os.path.join(BASE_PATH, 'res', 'wxplot.ico')))

        self.scene = scene.WxGLScene(self, style=parent.style3d, **parent.kwds)
        self.parent = parent
        self.csize = self.scene.GetClientSize()

        bmp_style = wx.Bitmap(
            os.path.join(BASE_PATH, 'res', 'tb_style_32.png'),
            wx.BITMAP_TYPE_ANY)
        bmp_restore = wx.Bitmap(
            os.path.join(BASE_PATH, 'res', 'tb_restore_32.png'),
            wx.BITMAP_TYPE_ANY)
        bmp_save = wx.Bitmap(os.path.join(BASE_PATH, 'res', 'tb_save_32.png'),
                             wx.BITMAP_TYPE_ANY)
        self.bmp_play = wx.Bitmap(
            os.path.join(BASE_PATH, 'res', 'tb_play_32.png'),
            wx.BITMAP_TYPE_ANY)
        self.bmp_stop = wx.Bitmap(
            os.path.join(BASE_PATH, 'res', 'tb_stop_32.png'),
            wx.BITMAP_TYPE_ANY)
        self.bmp_show = wx.Bitmap(
            os.path.join(BASE_PATH, 'res', 'tb_show_32.png'),
            wx.BITMAP_TYPE_ANY)
        self.bmp_hide = wx.Bitmap(
            os.path.join(BASE_PATH, 'res', 'tb_hide_32.png'),
            wx.BITMAP_TYPE_ANY)

        self.tb = aui.AuiToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize)
        self.tb.SetToolBitmapSize(wx.Size(32, 32))

        self.tb.AddSimpleTool(self.ID_STYLE, '风格', bmp_style, '绘图风格')
        self.tb.AddSeparator()
        self.tb.AddSimpleTool(self.ID_RESTORE, '复位', bmp_restore, '位置还原')
        self.tb.AddSimpleTool(self.ID_SAVE, '保存', bmp_save, '保存为文件')
        self.tb.AddSeparator()
        self.tb.AddSimpleTool(self.ID_GRID, '网格', self.bmp_hide, '显示/隐藏网格')
        self.tb.AddSimpleTool(self.ID_PAUSE, '动态显示', self.bmp_play,
                              '停止/开启动态显示)')

        self.tb.SetToolDropDown(self.ID_STYLE, True)
        self.tb.Realize()

        self._mgr = aui.AuiManager()
        self._mgr.SetManagedWindow(self)
        self._mgr.AddPane(self.scene,
                          aui.AuiPaneInfo().Name('Scene').CenterPane().Show())
        self._mgr.AddPane(
            self.tb,
            aui.AuiPaneInfo().Name('ToolBar').ToolbarPane().Bottom().Floatable(
                False))
        self._mgr.Update()

        self.once_timer = wx.Timer()  # 单次定时器
        self.once_timer.Bind(wx.EVT_TIMER, self.on_once_timer)

        self.th = None  # 生成gif或mp4文件的线程
        self.q = queue.Queue()  # PIL对象数据队列
        self.out_file = None  # 输出文件名
        self.ext = None  # 文件格式
        self.fs = None  # 总帧数
        self.fps = None  # 帧率
        self.loop = None  # 是否循环(仅gif有效)
        self.mod = None  # 帧间隔
        self.offset = None  # 帧偏移
        self.f = None  # 已完成帧数
        self.last = None  # 上一次截图的计数周期

        self.scene.Bind(wx.EVT_SIZE, self.on_resize)
        self.Bind(aui.EVT_AUITOOLBAR_TOOL_DROPDOWN,
                  self.on_style,
                  id=self.ID_STYLE)

        self.Bind(wx.EVT_MENU, self.on_save, id=self.ID_SAVE)
        self.Bind(wx.EVT_MENU, self.on_style, id=self.ID_STYLE)
        self.Bind(wx.EVT_MENU, self.on_pause, id=self.ID_PAUSE)
        self.Bind(wx.EVT_MENU, self.on_restore, id=self.ID_RESTORE)
        self.Bind(wx.EVT_MENU, self.on_grid, id=self.ID_GRID)

        self.Bind(wx.EVT_MENU, self.on_color, id=self.id_white)
        self.Bind(wx.EVT_MENU, self.on_color, id=self.id_black)
        self.Bind(wx.EVT_MENU, self.on_color, id=self.id_gray)
        self.Bind(wx.EVT_MENU, self.on_color, id=self.id_blue)
Beispiel #28
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          'AuiToolBarPopup Demo',
                          size=(300, 432))
        self._mgr = aui.AuiManager()

        # tell AuiManager to manage this frame
        self._mgr.SetManagedWindow(self)
        self.toolbarart = AuiToolBarPopupArt(self)

        self._mgr.AddPane(
            MyPanel(self),
            aui.AuiPaneInfo().Name("test1").Caption(
                "Pane Caption").CenterPane())

        tb = aui.AuiToolBar(self,
                            -1,
                            wx.DefaultPosition,
                            wx.DefaultSize,
                            agwStyle=aui.AUI_TB_OVERFLOW | aui.AUI_TB_TEXT
                            | aui.AUI_TB_HORZ_TEXT
                            | aui.AUI_TB_PLAIN_BACKGROUND)
        tb.SetToolBitmapSize(wx.Size(16, 16))
        tb_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER,
                                           wx.Size(16, 16))
        tb.AddSimpleTool(ID_TOOL_START + 0, "Item 1", tb_bmp1)
        tb.AddCheckTool(ID_TOOL_START + 1, "Toggle", tb_bmp1, wx.NullBitmap)
        tb.AddSeparator()
        tb.AddRadioTool(ID_TOOL_START + 2, "Radio 0", tb_bmp1, wx.NullBitmap)
        tb.AddRadioTool(ID_TOOL_START + 3, "Radio 1", tb_bmp1, wx.NullBitmap)
        tb.AddSeparator()
        tb.AddSimpleTool(ID_TOOL_START + 4, "Item 5", tb_bmp1)
        tb.AddSimpleTool(ID_TOOL_START + 5, "Item 6", tb_bmp1)
        tb.AddSimpleTool(ID_TOOL_START + 6, "Item 7", tb_bmp1)
        tb.AddSimpleTool(ID_TOOL_START + 7, "Item 8", tb_bmp1)

        choice = wx.Choice(tb, -1, choices=["One choice", "Another choice"])
        tb.AddControl(choice)
        cmb = wx.ComboBox(tb, -1, choices=["Option 1", "Option 2", "Option 3"])
        tb.AddControl(cmb)
        spin = wx.SpinCtrl(tb, -1)
        tb.AddControl(spin)

        tb.SetToolDropDown(ID_TOOL_START + 6, True)
        tb.Realize()
        tb.SetArtProvider(self.toolbarart)
        self._mgr.AddPane(
            tb,
            aui.AuiPaneInfo().Name("tb").Caption("tb").ToolbarPane().Floatable(
                False).Top())

        tb2 = aui.AuiToolBar(self,
                             -1,
                             wx.DefaultPosition,
                             wx.DefaultSize,
                             agwStyle=aui.AUI_TB_OVERFLOW | aui.AUI_TB_TEXT
                             | aui.AUI_TB_HORZ_TEXT
                             | aui.AUI_TB_PLAIN_BACKGROUND)
        tb2.SetToolBitmapSize(wx.Size(16, 16))
        tb2.AddSimpleTool(ID_TOOL_START + 100, "Item 1", tb_bmp1)
        tb2.AddSimpleTool(ID_TOOL_START + 101, "Item 2", tb_bmp1)
        tb2.AddSimpleTool(ID_TOOL_START + 102, "Item 3", tb_bmp1)
        tb2.AddSimpleTool(ID_TOOL_START + 103, "Item 4", tb_bmp1)
        tb2.AddSeparator()
        statictext = wx.StaticText(tb2, -1, "StaticText")
        tb2.AddControl(statictext)
        slider = wx.Slider(tb2,
                           100,
                           25,
                           1,
                           100,
                           size=(250, -1),
                           style=wx.SL_HORIZONTAL)
        tb2.AddControl(slider)
        search = wx.SearchCtrl(tb2, size=(200, -1), style=wx.TE_PROCESS_ENTER)
        tb2.AddControl(search)
        tb2.Realize()
        tb2.SetArtProvider(self.toolbarart)
        self._mgr.AddPane(
            tb2,
            aui.AuiPaneInfo().Name("tb2").Caption(
                "tb2").ToolbarPane().Floatable(False).Top().Row(1))
        self._mgr.Update()
        self.Bind(wx.EVT_TOOL, self.OnTool)
        self.Bind(aui.EVT_AUITOOLBAR_TOOL_DROPDOWN,
                  self.OnDropDownToolbarItem,
                  id=ID_TOOL_START + 6)
Beispiel #29
0
    def __init__(self, parent, overlayList, displayCtx, frame):
        """Create a ``ViewPanel``. All arguments are passed through to the
        :class:`.FSLeyesPanel` constructor.
        """

        fslpanel.FSLeyesPanel.__init__(
            self, parent, overlayList, displayCtx, frame)

        self.__profileManager = profiles.ProfileManager(
            self, overlayList, displayCtx)

        # The __centrePanel attribute stores a reference
        # to the main (centre) panel on this ViewPanel.
        # It is set by sub-class implementations via
        # the centrePanel property.
        #
        # The panels dictionary stores a collection
        # of {type : instance} mappings of active
        # FSLeyes control panels that are contained
        # in this view panel.
        self.__centrePanel = None
        self.__panels      = {}

        # See note in FSLeyesFrame about
        # the user of aero docking guides.
        self.__auiMgr = aui.AuiManager(
            self,
            agwFlags=(aui.AUI_MGR_RECTANGLE_HINT          |
                      aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE |
                      aui.AUI_MGR_ALLOW_FLOATING          |
                      aui.AUI_MGR_AERO_DOCKING_GUIDES     |
                      aui.AUI_MGR_LIVE_RESIZE))

        self.__auiMgr.SetDockSizeConstraint(0.5, 0.5)
        self.__auiMgr.Bind(aui.EVT_AUI_PANE_CLOSE, self.__onPaneClose)

        # Use a different listener name so that subclasses
        # can register on the same properties with self.name
        lName = 'ViewPanel_{}'.format(self.name)

        self.addListener('profile', lName, self.__profileChanged)

        overlayList.addListener('overlays',
                                lName,
                                self.__selectedOverlayChanged)
        displayCtx .addListener('selectedOverlay',
                                lName,
                                self.__selectedOverlayChanged)

        self.__selectedOverlay = None
        self.__selectedOverlayChanged()

        # A very shitty necessity. When panes are floated,
        # the AuiManager sets the size of the floating frame
        # to the minimum size of the panel, without taking
        # into account the size of its borders/title bar,
        # meaning that the panel size is too small. Here,
        # we're just creating a dummy MiniFrame (from which
        # the AuiFloatingFrame derives), and saving the size
        # of its trimmings for later use in the togglePanel
        # method.
        ff         = wx.MiniFrame(self)
        size       = ff.GetSize().Get()
        clientSize = ff.GetClientSize().Get()

        self.__floatOffset = (size[0] - clientSize[0],
                              size[1] - clientSize[1])

        ff.Destroy()
    def __init__(self, parent, loadedPipeline, loadedPipelinePath=None):
        wx.Frame.__init__(self,
                          parent,
                          title="Scimitar Data Analysis (alpha)",
                          size=(800, 600))

        # Set log on the main Scimitar form.
        self.MainLog = parent.log
        self.parent = parent
        self.loadedPipelinePath = loadedPipelinePath

        # Set analysis pipeline associated with this form.
        if loadedPipeline == None:
            self.pipeline = AnalysisCore.AnalysisPipeline()
        else:
            self.pipeline = loadedPipeline

        # Set up AUI manager.
        self._mgr = aui.AuiManager()
        self._mgr.SetManagedWindow(self)

        # Set up toolbar.
        if getattr(sys, 'frozen', False):
            basedir = sys._MEIPASS
        else:
            basedir = path.dirname(__file__)

        self.SetIcon(wx.Icon(basedir + '/resources/scimitar.ico'))

        newAnalysis_bmp = wx.Bitmap(basedir + '/resources/new.png')
        openAnalysis_bmp = wx.Bitmap(basedir + '/resources/open.png')
        save_bmp = wx.Bitmap(basedir + '/resources/save.png')
        saveAs_bmp = wx.Bitmap(basedir + '/resources/saveAs.png')
        up_bmp = wx.Bitmap(basedir + '/resources/up.png')
        down_bmp = wx.Bitmap(basedir + '/resources/down.png')
        add_bmp = wx.Bitmap(basedir + '/resources/add.png')
        remove_bmp = wx.Bitmap(basedir + '/resources/remove.png')
        reportCard_bmp = wx.Bitmap(basedir + '/resources/reportCard.png')
        execute_bmp = wx.Bitmap(basedir + '/resources/createScript.png')
        change_bmp = wx.Bitmap(basedir + '/resources/change.png')

        self.toolbar = aui.AuiToolBar(
            self, -1, wx.DefaultPosition, wx.DefaultSize,
            wx.TB_FLAT | wx.TB_NODIVIDER | wx.TB_TEXT)
        self.toolbar.SetToolBitmapSize(wx.Size(32, 32))
        toolNew = self.toolbar.AddTool(wx.ID_ANY,
                                       "New",
                                       newAnalysis_bmp,
                                       wx.NullBitmap,
                                       aui.ITEM_NORMAL,
                                       short_help_string="New analysis file.")
        toolOpen = self.toolbar.AddTool(
            wx.ID_ANY,
            "Open",
            openAnalysis_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Open analysis file.")
        toolSave = self.toolbar.AddTool(
            wx.ID_ANY,
            "Save",
            save_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Save analysis file.")
        toolSaveAs = self.toolbar.AddTool(wx.ID_ANY,
                                          "Save As",
                                          saveAs_bmp,
                                          wx.NullBitmap,
                                          aui.ITEM_NORMAL,
                                          short_help_string="New analysis as.")
        self.toolbar.AddSeparator()
        toolAddModule = self.toolbar.AddTool(
            wx.ID_ANY,
            "Add",
            add_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Add new module.")
        toolRemoveModule = self.toolbar.AddTool(
            wx.ID_ANY,
            "Remove",
            remove_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Remove selected module.")
        toolMoveModuleUp = self.toolbar.AddTool(
            wx.ID_ANY,
            "Up",
            up_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Move selected module up.")
        toolMoveModuleDown = self.toolbar.AddTool(
            wx.ID_ANY,
            "Down",
            down_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Move selected module down.")
        toolChangeLocation = self.toolbar.AddTool(
            wx.ID_ANY,
            "Change",
            change_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Move module to a different pipeline section.")
        self.toolbar.AddSeparator()
        toolReportCard = self.toolbar.AddTool(
            wx.ID_ANY,
            "Report Card",
            reportCard_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Get pipeline report card.")
        toolExecute = self.toolbar.AddTool(
            wx.ID_ANY,
            "Execute",
            execute_bmp,
            wx.NullBitmap,
            aui.ITEM_NORMAL,
            short_help_string="Execute pipeline.")

        self.toolbar.Realize()

        self._mgr.AddPane(self.toolbar, aui.AuiPaneInfo().ToolbarPane().Top())

        # Set up module tree.
        self.moduleTreeCtrl = wx.TreeCtrl(self, size=(200, 200))
        self.nodeRoot = self.moduleTreeCtrl.AddRoot("Pipeline")
        self.nodeSettings = self.moduleTreeCtrl.AppendItem(
            self.nodeRoot, 'Settings')
        self.nodeLoadData = self.moduleTreeCtrl.AppendItem(
            self.nodeRoot, 'Inspect Data')
        self.nodeReductionModules = self.moduleTreeCtrl.AppendItem(
            self.nodeRoot, 'Initial Reduction')
        self.nodeActiveModules = self.moduleTreeCtrl.AppendItem(
            self.nodeRoot, 'Active')
        self.nodeInactiveModules = self.moduleTreeCtrl.AppendItem(
            self.nodeRoot, 'Inactive')

        if not loadedPipeline == None:
            for i in range(0, len(self.pipeline.reductionModules)):
                treeID = self.moduleTreeCtrl.AppendItem(
                    self.nodeReductionModules,
                    self.pipeline.reductionModules[i].moduleName)
                self.moduleTreeCtrl.SetPyData(
                    treeID, self.pipeline.reductionModules[i].moduleID)

            for i in range(0, len(self.pipeline.activeModules)):
                treeID = self.moduleTreeCtrl.AppendItem(
                    self.nodeActiveModules,
                    self.pipeline.activeModules[i].moduleName)
                self.moduleTreeCtrl.SetPyData(
                    treeID, self.pipeline.activeModules[i].moduleID)

            for i in range(0, len(self.pipeline.inactiveModules)):
                treeID = self.moduleTreeCtrl.AppendItem(
                    self.nodeInactiveModules,
                    self.pipeline.inactiveModules[i].moduleName)
                self.moduleTreeCtrl.SetPyData(
                    treeID, self.pipeline.inactiveModules[i].moduleID)

        self.moduleTreeCtrl.ExpandAll()
        self.moduleTreeCtrl.SelectItem(self.nodeSettings)

        # Setup the AUI notebook for the main pane.
        self.mainNotebook = aui.AuiNotebook(self)
        self.mainSettingsTab = TabMainSettings(self.mainNotebook,
                                               self.pipeline)
        self.loadDataTab = TabLoadData(self.mainNotebook, self.pipeline, self)
        self.mainNotebook.AddPage(self.mainSettingsTab, "Main Settings")
        self.mainNotebook.AddPage(self.loadDataTab, "Inspect Data")

        # Add bindings.
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onTreeItemDoubleClicked,
                  self.moduleTreeCtrl)
        self.Bind(wx.EVT_TOOL, self.onAddNewModule, toolAddModule)
        self.Bind(wx.EVT_TOOL, self.onRemoveModule, toolRemoveModule)
        self.Bind(wx.EVT_TOOL, self.onMoveModuleUp, toolMoveModuleUp)
        self.Bind(wx.EVT_TOOL, self.onMoveModuleDown, toolMoveModuleDown)
        self.Bind(wx.EVT_TOOL, self.onNew, toolNew)
        self.Bind(wx.EVT_TOOL, self.onOpen, toolOpen)
        self.Bind(wx.EVT_TOOL, self.onSaveAs, toolSaveAs)
        self.Bind(wx.EVT_TOOL, self.onSave, toolSave)
        self.Bind(wx.EVT_TOOL, self.onReportCard, toolReportCard)
        self.Bind(wx.EVT_TOOL, self.onExecutePipeline, toolExecute)
        self.Bind(wx.EVT_TOOL, self.onChangeModuleLocation, toolChangeLocation)

        self.Connect(-1, -1, self.pipeline.EXECUTION_COMPLETE_ID,
                     self.onExecutionCompletedSignal)

        self._mgr.AddPane(self.moduleTreeCtrl,
                          aui.AuiPaneInfo().Left().Caption("Analysis Modules"))
        self._mgr.AddPane(
            self.mainNotebook,
            aui.AuiPaneInfo().CenterPane().Caption("Module Configuration"))
        self._mgr.Update()

        self.mainSettingsTab.settingsGrid.FitColumns(
        )  # Expand columns in settings grid to properly fit.
        self.moduleTreeCtrl.ExpandAll()
        self.moduleTreeCtrl.SelectItem(self.nodeSettings)
        self.Show()