def OnToggle(self, event=None): enabled = GetField(self, chkid.ENABLE).IsChecked() # Fields that should not be disabled skip_ids = ( chkid.ENABLE, btnid.BROWSE, txtid.FNAME, ) for LIST in inputid, chkid, listid, btnid: for ID in LIST.IdList: if ID not in skip_ids: field = GetField(self, ID) if isinstance(field, wx.Window): field.Enable(enabled) # Disable/Enable static text labels st_labels = GetAllTypeFields(self, wx.StaticText) for ST in st_labels: if ST.Id not in skip_ids: ST.Enable(enabled) self.OnSetCustomFilename()
def ToggleButtons(self): parent = self.GetParent() for ID in self.TabButtonIds: button = GetField(parent, ID) if button: button.Enable(self.HasTabs())
def OnCatSelect(self, event=None): btn_cat_clr = GetField(self, wx.ID_CLEAR) lst_cat = GetField(self, listid.CAT) if btn_cat_clr and lst_cat: if FieldEnabled(btn_cat_clr): if not lst_cat.HasSelected(): btn_cat_clr.Disable() else: if lst_cat.HasSelected(): btn_cat_clr.Enable()
def OnOtherRemove(self, event=None): pnl_other = GetField(self, inputid.OTHER) # FIXME: Show confirmation dialog if pnl_other: if pnl_other.HasSelected(): remove = ConfirmationDialog( GetMainWindow(), GT(u'Custom Fields'), GT(u'Remove all selected custom fields?')) if remove.Confirmed(): pnl_other.RemoveSelected() btn_remove = GetField(self, wx.ID_REMOVE) if btn_remove and FieldEnabled(btn_remove): btn_remove.Enable(pnl_other.HasSelected())
def OnSetCustomFilename(self, event=None): chk_filename = GetField(self, chkid.FNAME) txt_filename = GetField(self, txtid.FNAME) ti_filename = GetField(self, inputid.FNAME) if not chk_filename.IsEnabled(): txt_filename.Enable(False) ti_filename.Enable(False) return if chk_filename.GetValue(): txt_filename.Enable(False) ti_filename.Enable(False) return txt_filename.Enable(True) ti_filename.Enable(True)
def OnOtherSelect(self, event=None): btn_remove = GetField(self, wx.ID_REMOVE) pnl_other = GetField(self, inputid.OTHER) if btn_remove and pnl_other: btn_remove.Enable(pnl_other.HasSelected())