コード例 #1
0
    def __init__(self, parent = None, id = wx.NewId(), title = 'UI Evolver'):
        '''
        GUI window for the GA.
        '''
        wSize = (850, 900)
        wx.Frame.__init__(self, parent, wx.ID_ANY, title, size = wSize, pos = (200,0), 
                        style = wx.DEFAULT_FRAME_STYLE)
        self.CreateStatusBar()

        # tools menu specification
        toolsMenu = wx.Menu()
        toolsMenu.Append(ID_RUN, "&Run GA\tCtrl+R", "Start/restart the GA.")
        toolsMenu.Append(ID_STOP, "&Stop GA\tCtrl+K", "Stop the GA.")
        toolsMenu.AppendSeparator()


        # id, label text, status bar message
        # file menu specification
        fileMenu = wx.Menu()
        fileMenu.Append(ID_OPEN_APP, "Open Application...\tCtrl+O", "Open application file.")
        fileMenu.AppendSeparator()
        fileMenu.Append(ID_EXIT, "E&xit\tCtrl+Q", "Terminate the program.")

        # menubar specification
        menuBar = wx.MenuBar()
        menuBar.Append(fileMenu, "&File")
        menuBar.Append(toolsMenu, "&GA")
        self.SetMenuBar(menuBar)

        # event handlers for menu items

        wx.EVT_MENU(self, ID_RUN,  self.onRun )
        wx.EVT_MENU(self, ID_STOP,  self.onStop )
        wx.EVT_MENU(self, ID_EXIT, self.onExit)
        wx.EVT_MENU(self, ID_SAVE_GA_STATE, self.onSaveGAState)
        wx.EVT_MENU(self, ID_OPEN_GA_STATE, self.onOpenGAState)

        wx.EVT_MENU(self, ID_OPEN_APP, self.onOpenApp) 
        wx.EVT_MENU(self, ID_EXIT, self.onExit)
        self.Bind(wx.EVT_CLOSE, self.onExit, self)


        # IGA panel, where user interacts with IGA
        import iGAPanel
        self.iGAPanel = iGAPanel.iGAPanel(self, size = wSize)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.iGAPanel, 1, wx.EXPAND)
        sizer.Fit(self)
        sizer.SetSizeHints(self)

        self.SetSizer(sizer)

        self.Layout()

        self.env = None
        self.SetTitle('IGA Client - %s' % gaParams.getAppName())
        self.Show(True)
コード例 #2
0
    def onOpenApp(self, event):
        '''
            Load application specific config file.
        '''
        dirname = getcwd() + '/config'
        dlg = wx.FileDialog(self, "Load Application File", dirname, "", 'YAML files (.yml)|*.yml|All files (*)|*', wx.OPEN)

        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetFilename()
            gaParams.reset()
            gaParams.fileArgs('config/' + filename)
            self.SetTitle('IGA Client - %s' % gaParams.getAppName())

        dlg.Destroy()
コード例 #3
0
ファイル: leftPanel.py プロジェクト: juancq/character-evolver
    def reset(self):
        name = gaParams.getAppName()
        self.appSizer.Clear()

        if name == 'doctemplate':
            # app specific panel
            from app.doctemplate.docdesignpanel import DocDesign
            new_panel = DocDesign(self)
            self.app_panels.append(new_panel)

            self.appSizer.Add(new_panel)
            self.appSizer.AddSpacer((10, 10))
            self.appSizer.Add(wx.StaticLine(self), 0, wx.EXPAND)
            self.appSizer.AddSpacer((10, 10))
        self.Layout()