def on_initialize(self,event): self.cq = AddOnBreak() self.components.disas.columnHeadings = ['i','r1','r2','r3','Op','Argument'] self.localsWindow = model.childWindow(self,locals.Locals) self.stackWindow = model.childWindow(self,stack.Stack) self.btWindow = model.childWindow(self,backtrace.Backtrace) self.bpWindow = model.childWindow(self,breakpoint.Breakpoint) self.thread = WorkerThread(self).start()
def on_initialize(self, event): self.cq = AddOnBreak() self.components.disas.columnHeadings = [ 'i', 'r1', 'r2', 'r3', 'Op', 'Argument' ] self.localsWindow = model.childWindow(self, locals.Locals) self.stackWindow = model.childWindow(self, stack.Stack) self.btWindow = model.childWindow(self, backtrace.Backtrace) self.bpWindow = model.childWindow(self, breakpoint.Breakpoint) self.thread = WorkerThread(self).start()
def on_initialize(self, event): super(RestEditor, self).on_initialize(event) self.renderOnReturn = self.menuBar.getChecked('menuFormatRenderOnReturn') self.previewWindow = model.childWindow(self, HtmlPreview) #self.previewWindow.position = (425, -1) self.previewWindow.visible = True self.html = ''
def on_menuAppsPlotSelection_select(self, event): from pds.pcgui.wxPlotSelection import wxPlotSelection filename = os.path.join(self.rsrc_path,'wxPlotSelection.rsrc.py') self.PlotSelectionWindow = model.childWindow(self, wxPlotSelection, filename=filename) self.PlotSelectionWindow.position = (200, 5) self.PlotSelectionWindow.visible = True
def on_menuHelpParams_select(self,event): from . import wxXrrIntModelHelp wxXrrIntModelHelp = mod_import(wxXrrIntModelHelp) wxXrrIntModelHelp = wxXrrIntModelHelp.wxXrrIntModelHelp self.wxXrrIntModelHelp = model.childWindow(self,wxXrrIntModelHelp, rsrc=r_wxXrrIntModelHelp) self.wxXrrIntModelHelp.position = (200, 5) self.wxXrrIntModelHelp.visible = True
def on_initialize(self,event): self.displayOnlyWindow = model.childWindow(self, meeting_helper_displayOnly.ParliamentDisplayOnlyWindow) self.setParliamentInstance(Parliament.Parliament()) self.p.initState() self.displayOnlyWindow.setParliamentInstance(self.p) ParliamentGUI.do_initialize(self,event)
def on_menuAppsCtrData_select(self, event): from pds.pcgui import wxCtrData wxCtrData = mod_import(wxCtrData) wxCtrData = wxCtrData.wxCtrData filename = os.path.join(self.rsrc_path, 'wxCtrData.rsrc.py') self.wxCtrData = model.childWindow(self, wxCtrData, filename=filename) self.wxCtrData.position = (200, 5) self.wxCtrData.visible = True
def on_menuAppsXRF_select(self, event): from pds.pcgui import wxXrf wxXrf = mod_import(wxXrf) wxXrf = wxXrf.wxXrf filename = os.path.join(self.rsrc_path, 'wxXrf.rsrc.py') self.XrfWindow = model.childWindow(self, wxXrf, filename=filename) self.XrfWindow.position = (200, 5) self.XrfWindow.visible = True
def on_menuAppsXRF_select(self, event): from pds.pcgui import wxXrf wxXrf = mod_import(wxXrf) wxXrf = wxXrf.wxXrf filename = os.path.join(self.rsrc_path,'wxXrf.rsrc.py') self.XrfWindow = model.childWindow(self, wxXrf,filename=filename) self.XrfWindow.position = (200, 5) self.XrfWindow.visible = True
def on_menuAppsScanSelect_select(self, event): import wxScanSelect wxScanSelect = mod_import(wxScanSelect) wxScanSelect = wxScanSelect.wxScanSelect filename = os.path.join(self.rsrc_path,'wxScanSelect.rsrc.py') self.wxScanSelect = model.childWindow(self, wxScanSelect, filename=filename) self.wxScanSelect.position = (200, 5) self.wxScanSelect.visible = True
def on_menuAppsScanSelect_select(self, event): from pds.pcgui import wxScanSelect wxScanSelect = mod_import(wxScanSelect) wxScanSelect = wxScanSelect.wxScanSelect filename = os.path.join(self.rsrc_path,'wxScanSelect.rsrc.py') self.wxScanSelect = model.childWindow(self, wxScanSelect, filename=filename) self.wxScanSelect.position = (200, 5) self.wxScanSelect.visible = True
def on_menuHelpParams_select(self, event): from . import wxXrrIntModelHelp wxXrrIntModelHelp = mod_import(wxXrrIntModelHelp) wxXrrIntModelHelp = wxXrrIntModelHelp.wxXrrIntModelHelp self.wxXrrIntModelHelp = model.childWindow(self, wxXrrIntModelHelp, rsrc=r_wxXrrIntModelHelp) self.wxXrrIntModelHelp.position = (200, 5) self.wxXrrIntModelHelp.visible = True
def on_menuHelpParams_select(self,event): from . import wxXrrBuilderHelp wxXrrBuilderHelp = mod_import(wxXrrBuilderHelp) dir = os.path.dirname(wxXrrBuilderHelp.__file__) wxXrrBuilderHelp = wxXrrBuilderHelp.wxXrrBuilderHelp self.wxXrrBuilderHelp = model.childWindow(self,wxXrrBuilderHelp, rsrc=r_wxXrrBuilderHelp) self.wxXrrBuilderHelp.position = (200, 5) self.wxXrrBuilderHelp.visible = True
def on_menuHelpParams_select(self,event): from . import wxXrfHelp wxXrfHelp = mod_import(wxXrfHelp) dir = os.path.dirname(wxXrfHelp.__file__) wxXrfHelp = wxXrfHelp.wxXrfHelp self.XrfHelpWindow = model.childWindow(self,wxXrfHelp, rsrc=r_wxXrfHelp) self.XrfHelpWindow.position = (200, 5) self.XrfHelpWindow.visible = True
def on_menuAppsCtrData_select(self, event): from pds.pcgui import wxCtrData wxCtrData = mod_import(wxCtrData) wxCtrData = wxCtrData.wxCtrData filename = os.path.join(self.rsrc_path,'wxCtrData.rsrc.py') self.wxCtrData = model.childWindow(self, wxCtrData, filename=filename) self.wxCtrData.position = (200, 5) self.wxCtrData.visible = True
def on_menuHelpUse_select(self, event): import wxShellHelp wxShellHelp = mod_import(wxShellHelp) dir = os.path.dirname(wxShellHelp.__file__) wxShellHelp = wxShellHelp.wxShellHelp self.wxShellHelp = model.childWindow(self, wxShellHelp, rsrc=r_wxShellHelp) self.wxShellHelp.position = (200, 5) self.wxShellHelp.visible = True
def on_menuHelpParams_select(self, event): import wxXrrBuilderHelp wxXrrBuilderHelp = mod_import(wxXrrBuilderHelp) dir = os.path.dirname(wxXrrBuilderHelp.__file__) filename = os.path.join(dir, "wxXrrBuilderHelp.rsrc.py") wxXrrBuilderHelp = wxXrrBuilderHelp.wxXrrBuilderHelp self.wxXrrBuilderHelp = model.childWindow(self, wxXrrBuilderHelp, filename=filename) self.wxXrrBuilderHelp.position = (200, 5) self.wxXrrBuilderHelp.visible = True
def on_menuHelpParams_select(self,event): import wxXrfHelp wxXrfHelp = mod_import(wxXrfHelp) dir = os.path.dirname(wxXrfHelp.__file__) filename = os.path.join(dir,'wxXrfHelp.rsrc.py') #print filename wxXrfHelp = wxXrfHelp.wxXrfHelp self.XrfHelpWindow = model.childWindow(self,wxXrfHelp,filename=filename) self.XrfHelpWindow.position = (200, 5) self.XrfHelpWindow.visible = True
def on_menuHelpUse_select(self, event): import wxShellHelp wxShellHelp = mod_import(wxShellHelp) dir = os.path.dirname(wxShellHelp.__file__) filename = os.path.join(dir,'wxShellHelp.rsrc.py') wxShellHelp = wxShellHelp.wxShellHelp self.wxShellHelp = model.childWindow(self,wxShellHelp, filename=filename) self.wxShellHelp.position = (200, 5) self.wxShellHelp.visible = True
def on_menuAppsXRRBuild_select(self, event): #__import__('wxXrr') #from pds.pcgui.wxXrr import wxXrr from pds.pcgui import wxXrrBuilder wxXrrBuilder = mod_import(wxXrrBuilder) wxXrrBuilder = wxXrrBuilder.wxXrrBuilder filename = os.path.join(self.rsrc_path,'wxXrrBuilder.rsrc.py') self.XrrBuildWindow = model.childWindow(self, wxXrrBuilder, filename=filename) self.XrrBuildWindow.position = (200, 5) self.XrrBuildWindow.visible = True
def on_menuAppsXRRModel_select(self, event): #__import__('wxXrr') #from wxXrr import wxXrr from pds.pcgui import wxXrrIntModel wxXrrIntModel = mod_import(wxXrrIntModel) wxXrrIntModel = wxXrrIntModel.wxXrrIntModel filename = os.path.join(self.rsrc_path,'wxXrrIntModel.rsrc.py') self.XrrIntModelWindow = model.childWindow(self, wxXrrIntModel, filename=filename) self.XrrIntModelWindow.position = (200, 5) self.XrrIntModelWindow.visible = True
def on_menuHelpParams_select(self, event): import wxXrrIntModelHelp wxXrrIntModelHelp = mod_import(wxXrrIntModelHelp) dir = os.path.dirname(wxXrrIntModelHelp.__file__) filename = os.path.join(dir, 'wxXrrIntModelHelp.rsrc.py') wxXrrIntModelHelp = wxXrrIntModelHelp.wxXrrIntModelHelp self.wxXrrIntModelHelp = model.childWindow(self, wxXrrIntModelHelp, filename=filename) self.wxXrrIntModelHelp.position = (200, 5) self.wxXrrIntModelHelp.visible = True
def on_initialize(self, event): # the splitter code is adapted from the wxPython demo Main.py # I was having to do RemoveChild with Background # but SplitterBackground seems okay ## self.RemoveChild(self.panel) ## self.panel = None splitter = wx.SplitterWindow(self, -1, style=wx.CLIP_CHILDREN | wx.SP_LIVE_UPDATE | wx.SP_3D) splitter2 = wx.SplitterWindow(splitter, -1, style=wx.CLIP_CHILDREN | wx.SP_LIVE_UPDATE | wx.SP_3D) self.splitter = splitter self.splitter2 = splitter2 win1 = MyPanel(splitter, (100, 50), 'win1') #win1 = model.childWindow(splitter, doodle.Doodle) win1 = model.childWindow(splitter, minimal.Minimal) #win2 = model.childWindow(splitter, minimal.Minimal) #win2 = MyPanel(splitter, (100, 50), 'win2') win2 = model.childWindow(splitter2, doodle.Doodle) #win2 = model.childWindow(splitter2, minimal.Minimal) win3 = model.childWindow(splitter2, doodle.Doodle) self.win1 = win1 self.win2 = win2 self.win3 = win3 # add the windows to the splitter and split it. splitter2.SplitHorizontally(win2, win3, 160) splitter.SplitVertically(win1, splitter2, 200) #splitter.SplitVertically(win1, win2, 150) splitter.SetMinimumPaneSize(20) splitter2.SetMinimumPaneSize(20) self.size = (600, 400) # Make the splitter on the right expand the top window when resized def SplitterOnSize(evt): splitter = evt.GetEventObject() sz = splitter.GetSize() splitter.SetSashPosition(sz.height - 160, False) evt.Skip()
def createChatWindow(self, jid): # the jid should be in the form of username@domain win = model.childWindow(self, ChatWindow) win.setFonts(self.config['font']) # override resource position #win.SetPosition((425, -1)) # just in case, convert to string, will this clear up Unicode issues? jid = str(jid) toName = self.displayNames.get(jid, jid) win.setToJID(jid, toName) win.visible = True self.chatWindows[jid] = win
def on_initialize(self, event): self.createConfigDir() self.filename = None self.grid = None self.toggleToLife = 1 self.resizing = False # used to protect against # mouseClick after file dialog self.openingFileDialog = False scale = self.getScaleFromMenu() if scale: self.setCanvasAttributes(self.getScaleFromMenu()) else: self.menuBar.setChecked('menuScale5') self.setCanvasAttributes(5) self.initSizers() self.lexiconWindow = model.childWindow(self, Lexicon) self.lexiconWindow.position = (650, 25) self.patternsWindow = model.childWindow(self, Patterns) self.patternsWindow.position = (650, 300)
def on_Filter_mouseClick(self,event): if self.components.SpecFile.stringSelection=="" or self.components.SpecPath.text.strip()==" ": event.skip() return if not os.path.isfile(os.path.join(str(self.components.SpecPath.text), str(self.components.SpecFile.stringSelection))): event.skip() return from pds.pcgui import wxScanFilter wxScanFilter = mod_import(wxScanFilter) wxScanFilter = wxScanFilter.wxScanFilter self.wxScanFilter = model.childWindow(self, wxScanFilter, rsrc=r_wxScanFilter) self.wxScanFilter.position = (320, 160) self.wxScanFilter.visible = True self.wxScanFilter.filename = os.path.join(str(self.components.SpecPath.text), str(self.components.SpecFile.stringSelection))
def on_Filter_mouseClick(self,event): if self.components.SpecFile.stringSelection=="" or self.components.SpecPath.text.strip()==" ": event.skip() return if not os.path.isfile(os.path.join(str(self.components.SpecPath.text), str(self.components.SpecFile.stringSelection))): event.skip() return from pds.pcgui import wxScanFilter wxScanFilter = mod_import(wxScanFilter) wxScanFilter = wxScanFilter.wxScanFilter filename = os.path.join(self.rsrc_path,'wxScanFilter.rsrc.py') self.wxScanFilter = model.childWindow(self, wxScanFilter, filename=filename) self.wxScanFilter.position = (320, 160) self.wxScanFilter.visible = True self.wxScanFilter.filename = os.path.join(str(self.components.SpecPath.text), str(self.components.SpecFile.stringSelection))
def on_edinitconfig_command(self, event): ''' Edit init code for selected processor ''' self.edtask = model.childWindow(self, edtask.MyBackground) self.edtask.ix = -1 self.edtask.callback = self._edit_TASK self.edtask.parent = self self.edtask.components.dialogTitle.text = "Edit init code" self.edtask.title = "Edit init code" self.edtask.components.taskName.visible = False self.edtask.components.schRate.visible = False self.edtask.components.StaticText3.visible = False self.edtask.components.StaticText1.visible = False self.edtask.components.blockCode.text = self.initJALCode self.edtask.components.blockCode.SetFocus() self.edtask.MakeModal(True)
def on_initialize(self, event): # center App on screen xScreen = wxSystemSettings_GetMetric(wxSYS_SCREEN_X) yScreen = wxSystemSettings_GetMetric(wxSYS_SCREEN_Y) xSize, ySize = self.size xPos = (xScreen-xSize)/2 yPos = (yScreen-ySize)/2 self.position = (xPos,yPos) self.paletteWindow = model.childWindow(self, WorldEditorPalette.Palette) self.images = [] self.components.worldMap.autoRefresh = False self.map = None self.WIDTH = 100 self.HEIGHT = 100 self.changedFile = False self.offx = 0 self.offy = 0 self.actualTile = 0 self.load_tileset() self.newMap() self.drawMap() self.Show()
def on_openChildWindow_command(self, event): # delayed events - check the order these 'print's appear # should be # openChildWindow command # leaving openCHildWindow # initializing child window # in child function via CallAfter # in child function 10 ms in future print "openChildWindow command", event.target.name # KEA 2005-12-25 # the path for sys.modules[MinimalChild.__module__].__file__ # will be relative to the starting directory # so childWindow will fail if a resource file isn't provided # I'm not sure if this is a bug due to PythonCard changing the # directory to the application directory on startup or # the __file__ attribute already being set prior to our sys.path[0] # fix in model.py a combination of the two or something else. # However, always providing a resource path seems to work for # childWindow. win = model.childWindow(self, MinimalChild, 'testevents.rsrc.py') wx.FutureCall(10, win.callableFunction, "10 ms in the Future") wx.CallAfter(win.callableFunction, "via CallAfter") print "leaving openChildWindow"
def on_edittask_command(self, event): ''' Edit selected task ''' if not self.components.tasklist.GetSelectedItems(): return self._error('No task selected.', 'Error edit task') try: ix = int(self.components.tasklist.GetSelectedItems()[0][0]) tl = self.components.tasklist.items[ix] self.edtask = model.childWindow(self, edtask.MyBackground) self.edtask.ix = ix self.edtask.callback = self._edit_TASK self.edtask.parent = self self.edtask.components.Button3.visible = False self.edtask.components.dialogTitle.text = "Edit task" self.edtask.title = "Edit task" self.edtask.components.taskName.text = tl[2] self.edtask.components.schRate.text = tl[1] self.edtask.components.blockCode.text = tl[3] self.edtask.components.blockCode.SetFocus() self.edtask.MakeModal(True) self._format_tasklist() except Exception as ex: self._error(ex, 'Error edit task')
def on_initialize(self, event): # KEA 2004-09-16 # if we don't set a min size then the window is # very small. this may not be the correct way to # solve the problem... self.components.notebook.SetMinSize(self.components.notebook.size) self.singleItemExpandingSizerLayout() panel = wx.Panel(self.components.notebook, -1) panel.text1 = wx.TextCtrl(panel, -1, 'Hello Notebook', (5, 5)) self.components.notebook.AddPage(panel, 'wx panel', True) # you can't add a wx.Frame to a notebook #can this be done in wcgalde? ## frame = wx.Frame(self.components.notebook, -1) ## frame.text1 = wx.TextCtrl(frame, -1, 'Notebook 2', (5, 5)) ## self.components.notebook.AddPage(frame, 'frame', True) # let's pretend we were just given a string with the class to # load to see how this would be handled in the Notebook component # automatically #win = model.childWindow(self.components.notebook, minimal.Minimal) pageName = 'minimal' classString = 'minimal.Minimal' # assume for now that there will be one and only one # dot rather than something like modules.minimal.Minimal or just Minimal # indicating that the class is actually in the main source file # which would cause all sorts of problems with finding the resource file print "adding minimal page..." import imp moduleName, className = classString.split('.') fp, pathname, description = imp.find_module(moduleName) try: m = imp.load_module(moduleName, fp, pathname, description) win = model.childWindow(self.components.notebook, getattr(m, className)) self.components.notebook.AddPage(win, pageName, True) # now test setting the attribute for reference below setattr(self.components.notebook, pageName, win) #print self.components.notebook.GetPage(1).components.field1.text page = self.components.notebook.minimal print page.components.field1.text print "menuFileExit enabled:", page.menuBar.getEnabled('menuFileExit') finally: # Since we may exit via an exception, close fp explicitly. if fp: fp.close() win2 = model.childWindow(self.components.notebook, widgets.WidgetsTest) self.components.notebook.AddPage(win2, 'widgets', True) win3 = model.childWindow(self.components.notebook, doodle.Doodle) self.components.notebook.AddPage(win3, 'doodle', True) page = self.components.notebook.getPage(3) # it appears that since on_initialize hasn't run yet # after adding the page, the sizer code in doodle # in on_initialize hasn't been run so the page size # below is what we want but after the sizer code runs it # will be (300, 260) # if the user resizes the window, the sizer works as expected # but if the window hasn't been resized, then when you click # on the doodle tab the page doesn't fill the whole window # I don't know what the correct solution is yet, but this seems # to work. i have to use a method with CallAfter # so that's why we aren't just using the attribute size = page.size wx.CallAfter(page.SetSize, size) print "number of pages:", self.components.notebook.getPageCount() print "last page text: %s\n" % \ self.components.notebook.getPageText(self.components.notebook.getPageCount() - 1) print "stringSelection:", self.components.notebook.stringSelection self.components.notebook.stringSelection = 'minimal'
def on_proptable_mouseDoubleClick(self, event): ''' Edit selected property ''' L = self.components.proptable.GetSelectedItems() if L: if self.saved_data is None: self.saved_data = self.cfg.get('data').copy() ix = int(L[0][0]) self.ed = model.childWindow(self, edprop.MyBackground) self.ed.position = (self.position[0] + 50, self.position[1] + 50) self.ed.title = 'Edit #{}'.format(ix) self.ed.components.title.text = self.ed.title self.ed.callback = self.callback_ed self.ed.confirmSaveProperty = self.confirmSaveProperty self.ed.confirmCancelProperty = self.confirmCancelProperty #Here start populate form sequence x, y = 20, 50 dx, ddx, dy = 80, 200, 20 name = 'lab0' self.ed.components[name] = { 'type': 'StaticText', 'name': name, 'text': 'ix', 'size': (dx, dy), 'position': (x, y) } name = 'fld0' self.ed.components[name] = { 'type': 'TextField', 'name': name, 'text': str(ix), 'enabled': False, 'size': (ddx, dy), 'position': (x + dx + 10, y - 5) } y += dy + 5 d = self.cfg.get('data').get(str(ix)) fields = self.cfg.get('fields') fields_l = [fields[k][0] for k in sorted(fields.keys())] fields_opts = [fields[k][1] for k in sorted(fields.keys())] for i, prop_name in enumerate(fields_l): name = 'lab{}'.format(i + 1) self.ed.components[name] = { 'type': 'StaticText', 'name': name, 'text': prop_name, 'size': (dx, dy), 'position': (x, y) } name = 'fld{}'.format(i + 1) value = unicode(d[prop_name]) if not fields_opts[i]: #TextField or TextArea if '\n' in value: self.ed.components[name] = { 'type': 'TextArea', 'name': name, 'text': value, 'size': (ddx, dy + 50), 'position': (x + dx + 10, y - 5) } y += 50 else: self.ed.components[name] = { 'type': 'TextField', 'name': name, 'text': value, 'size': (ddx, dy), 'position': (x + dx + 10, y - 5) } else: #ComboBox items = fields_opts[i] default = value or (items and items[0] or '') self.ed.components[name] = { 'type': 'ComboBox', 'name': name, 'text': unicode(d[prop_name]), 'size': (ddx, dy), 'position': (x + dx + 10, y - 5), 'items': items, 'stringSelection': default } i += 1 y += dy + 5 if fields: self.ed.components['fld1'].SetFocus() self.ed.MakeModal(True)
def show_win(self, cls, rsrc): win = model.childWindow(self, cls, rsrc=rsrc) win.Position = (150, 50) # win.CenterOnScreen() win.visible = True return win
def on_GoInteractive_mouseClick(self, event): """Hit the interactive button""" form = model.childWindow(self, interactive.Interactive) form.visible = True