def getControl(self, xmlid): '''Retrieves the given control (within a dialog) by its xmlid''' control = self.FindWindowById(xrc.XRCID(xmlid)) if control == None and self.GetMenuBar() != None: # see if on the menubar control = self.GetMenuBar().FindItemById(xrc.XRCID(xmlid)) assert control != None, 'Programming error: a control with xml id ' + xmlid + ' was not found.' return control
def __init__(self, parent, value): pre = wx.PreDialog() g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECKLIST') self.PostCreate(pre) self.list = xrc.XRCCTRL(self, 'CHECK_LIST') # Set list items i = 0 for v, ch in value: self.list.Append(v) self.list.Check(i, ch) i += 1 self.SetAutoLayout(True) self.GetSizer().Fit(self) # Callbacks self.ID_BUTTON_APPEND = xrc.XRCID('BUTTON_APPEND') self.ID_BUTTON_REMOVE = xrc.XRCID('BUTTON_REMOVE') self.ID_BUTTON_UP = xrc.XRCID('BUTTON_UP') self.ID_BUTTON_DOWN = xrc.XRCID('BUTTON_DOWN') wx.EVT_CHECKLISTBOX(self, self.list.GetId(), self.OnCheck) wx.EVT_BUTTON(self, self.ID_BUTTON_UP, self.OnButtonUp) wx.EVT_BUTTON(self, self.ID_BUTTON_DOWN, self.OnButtonDown) wx.EVT_BUTTON(self, self.ID_BUTTON_APPEND, self.OnButtonAppend) wx.EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove) wx.EVT_UPDATE_UI(self, self.ID_BUTTON_UP, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.ID_BUTTON_DOWN, self.OnUpdateUI) wx.EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
def __init__(self, app, parent): self.app = app self.OrganizationView = parent self.ale_view = ALEView(self.OrganizationView.frame, self.app) #Load the buttons of the view self.btnOK = xrc.XRCCTRL(self.ale_view.Dialog, 'ale_btnok') btnCancel = xrc.XRCCTRL(self.ale_view.Dialog, 'ale_btncancel') # Call the onCancel method when window close self.ale_view.Dialog.Bind(wx.EVT_CLOSE, self.onCancel) #Bind events to the buttons self.ale_view.Dialog.Bind(wx.EVT_BUTTON, self.onAssignIncidentALE, self.btnOK) self.ale_view.Dialog.Bind(wx.EVT_BUTTON, self.onCancel, btnCancel) #Bind Events to the items in the ToolBar self.ale_view.Dialog.Bind(wx.EVT_TOOL, self.onEdit, id=xrc.XRCID('ale_tooledit')) self.ale_view.Dialog.Bind(wx.EVT_TOOL, self.onDelete, id=xrc.XRCID('ale_tooldelete')) #Load the widget of check box to know if the total value will be given directly self.ale_totalok = xrc.XRCCTRL(self.ale_view.Dialog, 'ale_checktotal') #Bind events to the checkbox self.ale_view.Dialog.Bind(wx.EVT_CHECKBOX, self.onCheckBox, self.ale_totalok) #Bind event when an item of the list of incidents is selected self.ale_view.Dialog.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onIncidentSelected, self.ale_view.incidentList) self.ale_view.Dialog.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onEdit, self.ale_view.incidentOrganizationList) #Subscribe to the messages given by the model. In case of any change, the list of elements will be updated Publisher.subscribe(self.aleModified, 'ale_created') Publisher.subscribe(self.aleModified, 'ale_updated') Publisher.subscribe(self.aleModified, 'ale_deleted') #ID of the Organization selected self.idOrganization = self.OrganizationView.getIDItemSelected() #Instance of the ALE, Incident model self.ale = ALE() self.incident = Incident() #Filters self.GUIincidents = [] self.GUIorg_incidents = [] self.txtFilter1 = xrc.XRCCTRL(self.ale_view.Dialog, 'ALE_txtfilter1') self.btnFilter1 = xrc.XRCCTRL(self.ale_view.Dialog, 'ALE_btnfilter1') self.txtFilter2 = xrc.XRCCTRL(self.ale_view.Dialog, 'ALE_txtfilter2') self.btnFilter2 = xrc.XRCCTRL(self.ale_view.Dialog, 'ALE_btnfilter2') self.ale_view.Dialog.Bind(wx.EVT_BUTTON, self.onFilter1, self.btnFilter1) self.ale_view.Dialog.Bind(wx.EVT_TEXT_ENTER, self.onFilter1, self.txtFilter1) self.ale_view.Dialog.Bind(wx.EVT_BUTTON, self.onFilter2, self.btnFilter2) self.ale_view.Dialog.Bind(wx.EVT_TEXT_ENTER, self.onFilter2, self.txtFilter2) #Load the list of incidents in the view self.loadListOfIncidents() self.loadListOfIncidentsOrganization() #Display the view self.ale_view.Show()
def OnInit(self): self.res = xrc.XmlResource('./xrc/RORI.xrc') self.main_frame = self.res.LoadFrame(None, 'RORI') #Events of Menu #Bind Events to the items in the Menu self.main_frame.Bind(wx.EVT_MENU, self.onLoadFile, id=xrc.XRCID('rori_load')) self.main_frame.Bind(wx.EVT_MENU, self.onGenerateOutputFile, id=xrc.XRCID('rori_generateoutput')) self.main_frame.Bind(wx.EVT_BUTTON, self.onPerformEvaluation, id=xrc.XRCID('rori_btncalcul')) self.main_frame.Bind(wx.EVT_MENU, self.onExit, id=xrc.XRCID('rori_exit')) self.main_frame.Bind(wx.EVT_BUTTON, self.onExit, id=xrc.XRCID('rori_exit1')) #Title self.title = xrc.XRCCTRL(self.main_frame, 'rori_title') #Lists self.individualList = xrc.XRCCTRL(self.main_frame, 'rori_listindividual') self.combinedList = xrc.XRCCTRL(self.main_frame, 'rori_listcombined') self.main_frame.SetSize((600, 550)) self.main_frame.Show() self.evaluationOK = False self.rori_calculator = None return True
def find_sphere_panel_init(self): """ Initializes find sphere notebook page of the GUI """ self.find_sphere_panel = xrc.XRCCTRL(self.notebook, Find_Sphere_PANEL) # Set up controls for find sphere panel self.find_sphere_image_panel = xrc.XRCCTRL(self.find_sphere_panel, Find_Sphere_Image_PANEL) self.grab_image_button = xrc.XRCCTRL(self.find_sphere_panel, Grab_Image_BUTTON) self.delete_points_button = xrc.XRCCTRL(self.find_sphere_panel, Delete_Points_BUTTON) self.find_sphere_button = xrc.XRCCTRL(self.find_sphere_panel, Find_Sphere_BUTTON) # Set up events wx.EVT_BUTTON(self.grab_image_button, xrc.XRCID(Grab_Image_BUTTON), self.on_grab_image_button) wx.EVT_BUTTON(self.delete_points_button, xrc.XRCID(Delete_Points_BUTTON), self.on_delete_points_button) wx.EVT_BUTTON(self.find_sphere_button, xrc.XRCID(Find_Sphere_BUTTON), self.on_find_sphere_button) # Setup image plot panel -- copying Andrew sizer = wx.BoxSizer(wx.VERTICAL) self.plot_panel = PlotPanel(self.find_sphere_image_panel) # wx boilerplate sizer.Add(self.plot_panel, 1, wx.EXPAND) # |wx.TOP| wx.LEFT |wx.ALIGN_CENTER) self.find_sphere_image_panel.SetSizer(sizer) self.find_sphere_image_panel.Fit()
def __init__(self, parent): self._mutex = threading.Lock() xrc_path = roslib.packages.get_pkg_dir(PKG) + '/ui/fingertip_panel.xrc' panelxrc = xrc.XmlResource(xrc_path) self.panel = panelxrc.LoadPanel(parent, 'FingertipPressurePanel') bag =self.panel.GetSizer() bag.SetEmptyCellSize(wx.Size(0,0)) self.scalings = None self.zeros = [0 for i in range(0,22)] self.recentmean = [0 for i in range(0,22)] self.pad = [] for i in range(0, NUMSENSORS): self.pad.append(xrc.XRCCTRL(self.panel, 'pad%i'%i)) self.pad[i].SetEditable(False) font = self.pad[i].GetFont() font.SetPointSize(6) self.pad[i].SetFont(font) self.pad[i].SetMinSize(wx.Size(40,35)) self.frame_id_box = xrc.XRCCTRL(self.panel, 'frame_id') self.panel.Bind(wx.EVT_RADIOBUTTON, self.set_Newton, id=xrc.XRCID('button_N')) self.panel.Bind(wx.EVT_RADIOBUTTON, self.set_kPascal, id=xrc.XRCID('button_kPa')) self.unit = self.Newton self.panel.Bind(wx.EVT_CHECKBOX, self.set_Zero, id=xrc.XRCID('button_Zero'))
def bindXrcObjects(self): self.Bind(wx.EVT_BUTTON, self.onCont, id=xrc.XRCID('contBtn')) self.Bind(wx.EVT_BUTTON, self.onRepeat, id=xrc.XRCID('repeatBtn')) self.Bind(wx.EVT_BUTTON, self.onHelp, id=xrc.XRCID('helpBtn')) self.Bind(wx.EVT_CHECKBOX, self.onSetDisable, self.setDisableCheck) if (self.inter_app.is_init_sop_enable()): self.Bind(wx.EVT_CHECKBOX, self.onSetInitSop, self.setInitSopCheck)
def on_tree_tree_sel_changed(self, evt): item = evt.Item txt = self.FindWindowByName("text") if self.prev_node and txt.IsModified(): orgutils.set_org_text(self.prev_node, txt.Value) self.file.modified = True node = self.FindWindowByName("tree").GetItemPyData(item) lines = [i.decode("UTF-8") for i in node.content if isinstance(i, str)] text = "".join(lines).strip() # The newlines are in the input already txt.Value = text self.prev_node = node rid = xrc.XRCID("remove") # Removing the only node of the 1st level would break everything else if node.level == 1 and len(node.parent.content) == 1: self.MenuBar.Enable(rid, False) else: self.MenuBar.Enable(rid, True) # And some movement operations would not be possible as well in some cases self.MenuBar.Enable(xrc.XRCID("left"), node.level != 1) self.MenuBar.Enable(xrc.XRCID("right"), len(node.parent.content) != 1) self.MenuBar.Enable(xrc.XRCID("up"), node.parent.content.index(node) != 0) self.MenuBar.Enable(xrc.XRCID("down"), node.parent.content[-1] != node) # Time recording if requested if self.file.track_times: orgutils.set_node_property(node, "accessed", orgutils.current_time())
def on_properties_selected(self, evt): dlg = uimanager.get().prepare_xrc_dialog( node_properties.NodeProperties, node=self.tree.GetItemPyData(self.tree.Selection)) dlg.AffirmativeId = xrc.XRCID("ok") dlg.EscapeId = xrc.XRCID("cancel") dlg.ShowModal()
def __init__(self, parent): rsrc = xrc.XmlResource(ZOOM_RSRC_FILE) self.frame = rsrc.LoadFrame(parent, "frame_ellipses") self.n_ell_spinner = xrc.XRCCTRL(self.frame, "spin_n_ellipses") self.frame.Bind(wx.EVT_SPINCTRL, self.OnNEllSpinner, id=xrc.XRCID("spin_n_ellipses")) self.show_tail_checkbox = xrc.XRCCTRL(self.frame, "check_show_orientation") self.frame.Bind(wx.EVT_CHECKBOX, self.OnShowTailCheckbox, id=xrc.XRCID("check_show_orientation")) # set up image panel self.img = DEFAULT_IMG self.img_panel = xrc.XRCCTRL(self.frame, "panel_show") self.img_box = wx.BoxSizer(wx.VERTICAL) self.img_panel.SetSizer(self.img_box) # make ellipse window self.ellipses = TargetList() self.ellipse_windows = [EllipseWindow(self.img_panel, 0)] self.n_ell = 1 #self.n_ell_spinner.SetValue( self.n_ell ) # add ellipse window to img_panel self.img_box.Add(self.ellipse_windows[0].box, 1, wx.EXPAND) self.img_panel.SetAutoLayout(True) self.img_panel.Layout() self.frame.Show()
def __init__(self, parent): # Two stage creation (see http://wiki.wxpython.org/index.cgi/TwoStageCreation) pre = wx.PrePanel() self.PreCreate(pre) get_resources().LoadOnPanel(pre, parent, "mypanel") self.PostCreate(pre) # Define variables for the controls, bind event handlers self.Bind(wx.EVT_TEXT_ENTER, self.OnText_enter_text1, id=xrc.XRCID('text1')) self.Bind(wx.EVT_TEXT_ENTER, self.OnText_enter_text2, id=xrc.XRCID('text2')) self.Bind(wx.EVT_CHECKBOX, self.OnCheckbox_ch1, id=xrc.XRCID('ch1')) self.Bind(wx.EVT_SCROLL, self.OnScroll_slider1, id=xrc.XRCID('slider1')) self.Bind(wx.EVT_LISTBOX, self.OnListbox_listbox1, id=xrc.XRCID('listbox1')) self.Bind(wx.EVT_COMBOBOX, self.OnCombobox_combo1, id=xrc.XRCID('combo1')) self.Bind(wx.EVT_TEXT, self.OnText_combo1, id=xrc.XRCID('combo1')) self.Bind(wx.EVT_TEXT_ENTER, self.OnText_enter_combo1, id=xrc.XRCID('combo1')) self.Bind(wx.EVT_SPINCTRL, self.OnSpinctrl_sp1, id=xrc.XRCID('sp1')) self.Bind(wx.EVT_BUTTON, self.OnButton_button, id=xrc.XRCID('button'))
def OnInit(self, *args, **kwargs): # XRC Loading # For some reason resource_filename('jolt.fwupd', 'fw_updater.xrc') does not # work. It works fine in the JoltApp, but not here. self.res = xrc.XmlResource(resource_filename('jolt', 'fwupd/fw_updater.xrc')) self.dialog = self.res.LoadDialog(None, 'MyDialog1') self.upload_btn = xrc.XRCCTRL(self.dialog, 'upload_button') self.filePicker_cb = xrc.XRCCTRL(self.dialog, 'filePicker_cb') self.filePicker_fb = xrc.XRCCTRL(self.dialog, 'filePicker_fb') self.output_box = xrc.XRCCTRL(self.dialog, 'm_textCtrl5') self.finish_label = xrc.XRCCTRL(self.dialog, 'm_staticText27') self.slider = xrc.XRCCTRL(self.dialog, 'm_scrollBar4') self.dialog.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileCb, id=xrc.XRCID('filePicker_cb')) self.dialog.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileFb, id=xrc.XRCID('filePicker_fb')) self.dialog.Bind(wx.EVT_BUTTON, self.OnUploadBtn, id=xrc.XRCID('upload_button')) self.dialog.Bind(wx.EVT_BUTTON, self.OnEraseBtn, id=xrc.XRCID('erase_button')) self.dialog.Bind(wx.EVT_BUTTON, self.OnEraseBtn, id=xrc.XRCID('erase_button')) self.dialog.Bind(wx.EVT_CLOSE, self.OnClose) redir = RedirectText(self.output_box) sys.stdout = redir sys.stderr = redir self.upload_btn.Enable(False) self.finish_label.Hide() return True
def onInstall(self, evt): # FIXME bad hack self.status['initialized'] = True self.menu.FindItemById(xrc.XRCID('reference_mi')).Enable(True) self.menu.FindItemById(xrc.XRCID('documentation_mi')).Enable(True) self._tasks = 4 self.runPython('bootstrap.py', wd=self.path)
def __init__(self, parent, panel, columnNumToName, runStartString, listDataItems=[]): self.columnNumToName = OrderedDict([(0, '#')] + columnNumToName.items()) self.columnNameToNum = {v: k for k, v in self.columnNumToName.items()} self.runStartString = runStartString self.panel = panel self.runButton = (xrc.XRCCTRL(parent, 'runButton')) self.addButton = (xrc.XRCCTRL(parent, 'addButton')) self.removeButton = (xrc.XRCCTRL(parent, 'removeButton')) self.list = ULC.UltimateListCtrl(self.panel, agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT | ULC.ULC_SINGLE_SEL) self.panel.GetSizer().Add(self.list, 1, wx.EXPAND|wx.ALL|wx.GROW) for idx, name in self.columnNumToName.items(): columnInfo = ULC.UltimateListItem() columnInfo._mask = wx.LIST_MASK_TEXT columnInfo._text = name self.list.InsertColumnInfo(idx, columnInfo) if len(listDataItems) == 0: listDataItems = [self.getDefaultDataItem(),] self.populateList(listDataItems) self.listUpdate() parent.Bind(wx.EVT_BUTTON, self.onAddButton, id=xrc.XRCID('addButton')) parent.Bind(wx.EVT_BUTTON, self.onRemoveButton, id=xrc.XRCID('removeButton')) parent.Bind(wx.EVT_BUTTON, self.onRunButton, id=xrc.XRCID('runButton')) self.list.Bind(ULC.EVT_LIST_KEY_DOWN, self.onKeyPress)
def __init__(self, parent): self.parent = parent self.path = None self._resources = xrc.EmptyXmlResource() self._resources.Load(_getpath('xrc', 'fbfdframe.xrc')) pre = wx.PreFrame() self._resources.LoadOnFrame(pre, parent, "fbfrontdesk_frame") self.PostCreate(pre) self.SetIcon(wx.Icon(_getpath('xrc', 'foxbms100px.png'))) self.tbicon = DemoTaskBarIcon(self) print self.tbicon.IsOk() self.Bind(wx.EVT_MENU, self.onProjectSelect, id=xrc.XRCID("folder_tb")) self.Bind(wx.EVT_MENU, self.onOpenDocumentation, id=xrc.XRCID("help_tb")) self.panel = FBFrontDeskPanel(self) self.SetMinSize((800, 700)) self.Fit() self.detect(self.path) self.selectProject(self.path)
def DoInstruct(self): # Load panels self.res = xrc.XmlResource(execution_path('base_test.xrc')) self.instruct_wrapper = self.res.LoadPanel(self.parent, 'instruct_wrapper') self.instruct_wrapper_panel = xrc.XRCCTRL(self.instruct_wrapper, 'instruct_wrapper_panel') # Bind the continue/cancel buttons self.instruct_wrapper.Bind(wx.EVT_BUTTON, self.OnContinue, id=xrc.XRCID('ins_continue_button')) self.instruct_wrapper.Bind(wx.EVT_BUTTON, self.OnCancel, id=xrc.XRCID('ins_cancel_button')) # Create the instruction panel using the child classes generator self.instruct_panel = self.instruct_panel_gen( self.instruct_wrapper_panel) # Place the instruction panel inside the wrapper NestPanel(self.instruct_wrapper_panel, self.instruct_panel) # Place the wrapper inside the parent NestPanel(self.parent, self.instruct_wrapper)
def __init__(self, *args, **kw): wx.Dialog.__init__(self, *args, **kw) self.Bind(wx.EVT_BUTTON, self.close, id=xrc.XRCID('m_cancel')) self.Bind(wx.EVT_BUTTON, self.save, id=xrc.XRCID('m_save')) self.Bind(wx.EVT_BUTTON, self.test, id=xrc.XRCID('m_test')) return
def OnInit(self): """Initialize the :py:class:`MyApp` instance; start by loading the xrc resource file and then add other stuff and bind the events""" xrcfile = '/Users/kraussry/git/wxpython_guis/ind_spreadsheet_mapper_xrc.xrc' self.res = xrc.XmlResource(xrcfile) # main frame and panel --------- self.frame = self.res.LoadFrame(None, "main_frame") self.panel = xrc.XRCCTRL(self.frame, "main_panel") self.source_folder_box = xrc.XRCCTRL(self.frame, "source_folder_box") self.source_browse = xrc.XRCCTRL(self.frame, "source_browse") self.main_browse = xrc.XRCCTRL(self.frame, "main_browse") self.main_folder_box = xrc.XRCCTRL(self.frame, "main_folder_box") self.source_listbox = xrc.XRCCTRL(self.frame, "list_box_1") self.go_button = xrc.XRCCTRL(self.frame, "go_button") self.go_catme_button = xrc.XRCCTRL(self.frame, \ "go_catme_button") #self.lab_title_box.SetFocus() wx.EVT_BUTTON(self.source_browse, self.source_browse.GetId(), \ self.on_source_browse) wx.EVT_BUTTON(self.main_browse, self.main_browse.GetId(), \ self.on_main_browse) wx.EVT_BUTTON(self.go_button, self.go_button.GetId(), \ self.go) wx.EVT_BUTTON(self.go_catme_button, self.go_catme_button.GetId(), \ self.catme_go) self.menubar = self.frame.GetMenuBar() ## self.frame.Bind(wx.EVT_MENU, self.on_exit, \ ## id=xrc.XRCID('quit_menu_item')) self.frame.Bind(wx.EVT_MENU, self.go, \ id=xrc.XRCID('menu_go')) self.frame.Bind(wx.EVT_MENU, self.catme_go, \ id=xrc.XRCID('menu_catme_go')) self.frame.Bind(wx.EVT_ACTIVATE, self.OnActivate) self.frame.Bind(wx.EVT_MENU, self.show_help, \ id=xrc.XRCID('menu_show_help')) # set up accelerators accelEntries = [] accelEntries.append((wx.ACCEL_CTRL, ord('G'), xrc.XRCID("menu_go"))) accelTable = wx.AcceleratorTable(accelEntries) self.frame.SetAcceleratorTable(accelTable) ## self.frame.Bind(wx.EVT_MENU, self.load, \ ## id=xrc.XRCID('load_menu_item')) self.my_init() # Intial debugging #L4title = "Open-Loop DC Motor Control" #self.lab_title_box.SetValue(L4title) self.frame.SetClientSize((625, 350)) self.frame.Show(1) self.SetTopWindow(self.frame) return True
def __init__(self, *args, **kw): Wizard.__init__(self, *args, **kw) self.m_wiz_gnerate_keys = xrc.XRCCTRL(self, 'm_wiz_gnerate_keys') self.Bind(wx.EVT_BUTTON, self.generate_keys, id=xrc.XRCID('m_generate_keys')) self.Bind(wx.EVT_BUTTON, self.select_all, id=xrc.XRCID('m_select_all')) self.m_public_key = xrc.XRCCTRL(self, 'm_public_key')
def OnPause(self, event): """ When PAUSE button is clicked """ self.canvas.dynamic_control.pause() self.toolbar.EnableTool(xrc.XRCID('ID_PLAY'), True) self.toolbar.EnableTool(xrc.XRCID('ID_PAUSE'), False) self.toolbar.EnableTool(xrc.XRCID('ID_STOP'), True)
def __init__(self, app, parent): self.app = app self.OrganizationView = parent self.aiv_view = AIVView(self.OrganizationView.frame, self.app) #Load the buttons of the view self.btnOK = xrc.XRCCTRL(self.aiv_view.Dialog, 'aiv_btnok') btnCancel = xrc.XRCCTRL(self.aiv_view.Dialog, 'aiv_btncancel') # Call the onCancel method when window close self.aiv_view.Dialog.Bind(wx.EVT_CLOSE, self.onCancel) #Bind events to the buttons self.aiv_view.Dialog.Bind(wx.EVT_BUTTON, self.onAssignEquipmentAIV, self.btnOK) self.aiv_view.Dialog.Bind(wx.EVT_BUTTON, self.onCancel, btnCancel) #Bind Events to the items in the ToolBar self.aiv_view.Dialog.Bind(wx.EVT_TOOL, self.onEdit, id=xrc.XRCID('aiv_tooledit')) self.aiv_view.Dialog.Bind(wx.EVT_TOOL, self.onDelete, id=xrc.XRCID('aiv_tooldelete')) #Load the widget of check box to know if the total value will be given directly self.aiv_totalok = xrc.XRCCTRL(self.aiv_view.Dialog, 'aiv_checktotal') #Bind events to the checkbox self.aiv_view.Dialog.Bind(wx.EVT_CHECKBOX, self.onCheckBox, self.aiv_totalok) #Bind event when an item of the list of equipments is selected self.aiv_view.Dialog.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onEquipmentSelected, self.aiv_view.equipmentList) self.aiv_view.Dialog.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onEdit, self.aiv_view.equipmentOrganizationList) #Subscribe to the messages given by the model. In case of any change, the list of elements will be updated Publisher.subscribe(self.aivModified, 'aiv_created') Publisher.subscribe(self.aivModified, 'aiv_updated') Publisher.subscribe(self.aivModified, 'aiv_deleted') #ID of the Organization selected self.idOrganization = self.OrganizationView.getIDItemSelected() #Instance of the AIV, Equipment model self.aiv = AIV() self.equipment = Equipment() #Load the list of equipments in the view self.loadListOfEquipments() self.loadListOfEquipmentsOrganization() #Display the view self.aiv_view.Show()
def OnInit(self): """Initialize the :py:class:`MyApp` instance; start by loading the xrc resource file and then add other stuff and bind the events""" xrcfile = '/Users/kraussry/git/wxpython_guis/lab_prep_xrc_GVSU.xrc' self.res = xrc.XmlResource(xrcfile) # main frame and panel --------- self.frame = self.res.LoadFrame(None,"main_frame") self.panel = xrc.XRCCTRL(self.frame,"main_panel") self.coursechoice = xrc.XRCCTRL(self.frame,"course_choice") self.coursechoice.SetStringSelection('345') self.lab_number_box = xrc.XRCCTRL(self.frame,"lab_number_box") self.root_folder_box = xrc.XRCCTRL(self.frame,"root_folder_box") self.root_browse = xrc.XRCCTRL(self.frame, "root_browse") self.go_button = xrc.XRCCTRL(self.frame, "go_button") self.next_button = xrc.XRCCTRL(self.frame, "next_button") self.lab_title_box = xrc.XRCCTRL(self.frame, "lab_title_box") self.lab_title_box.SetFocus() wx.EVT_CHOICE(self.coursechoice, self.coursechoice.GetId(), \ self.on_course_choice) wx.EVT_BUTTON(self.root_browse, self.root_browse.GetId(), \ self.on_browse) wx.EVT_BUTTON(self.go_button, self.go_button.GetId(), \ self.go) wx.EVT_BUTTON(self.next_button, self.next_button.GetId(), \ self.next_lab) self.menubar = self.frame.GetMenuBar() ## self.frame.Bind(wx.EVT_MENU, self.on_exit, \ ## id=xrc.XRCID('quit_menu_item')) self.frame.Bind(wx.EVT_MENU, self.go, \ id=xrc.XRCID('menu_go')) self.frame.Bind(wx.EVT_ACTIVATE, self.OnActivate) # set up accelerators accelEntries = [] accelEntries.append((wx.ACCEL_CTRL, ord('G'), xrc.XRCID("menu_go"))) accelTable = wx.AcceleratorTable(accelEntries) self.frame.SetAcceleratorTable(accelTable) ## self.frame.Bind(wx.EVT_MENU, self.load, \ ## id=xrc.XRCID('load_menu_item')) self.my_init() # Intial debugging #L4title = "Open-Loop DC Motor Control" #self.lab_title_box.SetValue(L4title) self.frame.SetClientSize((625,300)) self.frame.Show(1) self.SetTopWindow(self.frame) return True
def __init__(self): p = wx.PreDialog() self.PostCreate(p) wx.EVT_BUTTON(self, xrc.XRCID("FEEDWINCANCEL"), self.OnCancel) wx.EVT_BUTTON(self, xrc.XRCID("FEEDWINOK"), self.OnSaveSettings) wx.EVT_CHECKBOX(self, xrc.XRCID("FEEDWINCLEANUP"), self.OnCleanupChk) self.initialized = False self.feedinfo = None self.parent = None
def onClosePane(self, event): """""" window = event.GetPane().window if window == self.auiMgr.GetPane(self.logAndMore).window: self.GetMenuBar().Check(xrc.XRCID('mbViewLogAndMore'), False) elif window == self.auiMgr.GetPane(self.resourceTree).window: self.GetMenuBar().Check(xrc.XRCID('mbViewResources'), False) elif window == self.auiMgr.GetPane(self.propertyInspectorSlot).window: self.GetMenuBar().Check(xrc.XRCID('mbViewProperties'), False)
def BindCallbacks(self): if self.interactive: wxvt.setup_validated_float_callback(self.weight_input, xrc.XRCID('weight'), self.ValidateWeight, pending_color=params.wxvt_bg) wxvt.setup_validated_float_callback(self.max_weight_input, xrc.XRCID('weight'), self.ValidateWeight, pending_color=params.wxvt_bg)
def __init__(self, parent): # Two stage creation (see http://wiki.wxpython.org/index.cgi/TwoStageCreation) pre = wx.PreDialog() self.PreCreate(pre) get_resources().LoadOnDialog(pre, parent, "FilterEditorDialog") self.PostCreate(pre) # Define variables for the controls, bind event handlers self.Bind(wx.EVT_BUTTON, self.OnButton_button_okay, id=xrc.XRCID('button_okay')) self.Bind(wx.EVT_BUTTON, self.OnButton_button_cancel, id=xrc.XRCID('button_cancel'))
def OnStop(self, event): """ When STOP button is clicked """ self.canvas.dynamic_control.stop() self.animate_slider.SetValue(0) # draw the first map self.canvas.updateDraw(0) self.toolbar.EnableTool(xrc.XRCID('ID_PLAY'), True) self.toolbar.EnableTool(xrc.XRCID('ID_PAUSE'), False) self.toolbar.EnableTool(xrc.XRCID('ID_STOP'), False)
def __init__(self, app): self.app = app self.org_view = OrganizationView(app) #Close the Frame #self.org_view.frame.Bind(wx.EVT_CLOSE,self.onClose) #Bind Events to the items in the Menu self.org_view.frame.Bind(wx.EVT_MENU, self.onCreateOrganization, id=xrc.XRCID('org_mitcreate')) self.org_view.frame.Bind(wx.EVT_MENU, self.onEditOrganization, id=xrc.XRCID('org_mitedit')) self.org_view.frame.Bind(wx.EVT_MENU, self.onDeleteOrganization, id=xrc.XRCID('org_mitdelete')) self.org_view.frame.Bind(wx.EVT_MENU, self.onExit, id=xrc.XRCID('org_exit')) #Bind Events to the items in the ToolBar self.org_view.frame.Bind(wx.EVT_TOOL, self.onCreateOrganization, id=xrc.XRCID('org_toolcreate')) self.org_view.frame.Bind(wx.EVT_TOOL, self.onEditOrganization, id=xrc.XRCID('org_tooledit')) self.org_view.frame.Bind(wx.EVT_TOOL, self.onDeleteOrganization, id=xrc.XRCID('org_tooldelete')) self.org_view.frame.Bind(wx.EVT_TOOL, self.onRelationOrgEqu, id=xrc.XRCID('org_toolorg-equ')) self.org_view.frame.Bind(wx.EVT_TOOL, self.onRelationOrgInc, id=xrc.XRCID('org_toolorg-inc')) #Subscribe to the messages given by the model. In case of any change the list of elements will be updated Publisher.subscribe(self.organizationModified, 'organization_deleted') Publisher.subscribe(self.organizationModified, 'aev_created') Publisher.subscribe(self.organizationModified, 'aev_deleted') Publisher.subscribe(self.organizationModified, 'aev_updated') Publisher.subscribe(self.organizationModified, 'organization_created') Publisher.subscribe(self.organizationModified, 'organization_updated') #Filter self.txtFilter = xrc.XRCCTRL(self.org_view.frame, 'org_txtfilter') self.btnFilter = xrc.XRCCTRL(self.org_view.frame, 'org_btnfilter') self.org_view.frame.Bind(wx.EVT_TEXT_ENTER, self.onFilterOrganization, self.txtFilter) self.org_view.frame.Bind(wx.EVT_BUTTON, self.onFilterOrganization, self.btnFilter) self.GUIorganizations = [] #Load the list of organizations in the View self.loadListOfOrganizations_controller() self.org_view.show()
def init_frame(self): self.frame = self.res.LoadFrame(None, 'MyFrame2') self.panel = xrc.XRCCTRL(self.frame, 'm_Panel1') self.text1 = xrc.XRCCTRL(self.panel, 'm_textCtrl4') self.text2 = xrc.XRCCTRL(self.panel, 'm_textCtrl5') self.frame.Bind(wx.EVT_BUTTON, self.OnCopy, id=xrc.XRCID('m_button6')) #绑定事件 self.frame.Bind(wx.EVT_BUTTON, self.OnPaste, id=xrc.XRCID('m_button7')) #绑定事件 self.frame.Bind(wx.EVT_BUTTON, self.OnQuit, id=xrc.XRCID('m_button8')) #绑定事件 self.frame.Show()
def BindCallbacks(self): # threshold button self.frame.Bind(wx.EVT_SPIN,self.ChangeThreshold,self.edge_threshold_button) # mode button self.frame.Bind(wx.EVT_BUTTON,self.Detect,self.detect_button) # enter button self.frame.Bind(wx.EVT_BUTTON,self.Refine,self.refine_button) # parameter spinners self.frame.Bind(wx.EVT_SPIN,self.ChangeRadius,self.radius_spin) self.frame.Bind(wx.EVT_SPIN,self.ChangeCenterX,self.x_spin) self.frame.Bind(wx.EVT_SPIN,self.ChangeCenterY,self.y_spin) # text input wxvt.setup_validated_float_callback( self.radius_text, xrc.XRCID("radius_text"), self.OnRadiusValidated, pending_color=params.wxvt_bg ) wxvt.setup_validated_float_callback( self.x_text, xrc.XRCID("x_text"), self.OnXValidated, pending_color=params.wxvt_bg ) wxvt.setup_validated_float_callback( self.y_text, xrc.XRCID("y_text"), self.OnYValidated, pending_color=params.wxvt_bg ) # min, max text input wxvt.setup_validated_float_callback( self.minradius_text, xrc.XRCID("minradius_text"), self.OnRadiusBoundsValidated, pending_color=params.wxvt_bg ) wxvt.setup_validated_float_callback( self.maxradius_text, xrc.XRCID("maxradius_text"), self.OnRadiusBoundsValidated, pending_color=params.wxvt_bg ) wxvt.setup_validated_float_callback( self.minx_text, xrc.XRCID("minx_text"), self.OnXBoundsValidated, pending_color=params.wxvt_bg ) wxvt.setup_validated_float_callback( self.maxx_text, xrc.XRCID("maxx_text"), self.OnXBoundsValidated, pending_color=params.wxvt_bg ) wxvt.setup_validated_float_callback( self.miny_text, xrc.XRCID("miny_text"), self.OnYBoundsValidated, pending_color=params.wxvt_bg ) wxvt.setup_validated_float_callback( self.maxy_text, xrc.XRCID("maxy_text"), self.OnYBoundsValidated, pending_color=params.wxvt_bg ) # mouse click self.img_wind_child.Bind(wx.EVT_LEFT_DOWN,self.MouseDown) self.img_wind_child.Bind(wx.EVT_LEFT_UP,self.MouseUp)