def SetFocusedControl(control): parent = control defbut = None while not isinstance(parent, (wx.Frame, wx.Dialog)): parent = parent.GetParent() if hasattr(parent, '_default_item'): d = parent._default_item if d: defbut = d break SetDefaultButton(awu.GetParentFrame(control), defbut)
def RestoreColors(): try: if awu.GetParentFrame(b).IsShown(): try: b.SetForegroundColour(None) b.SetBackgroundColour(None) wx.YieldIfNeeded() except: pass except: pass
def SetDefaultItem(self, c): parent = self while not isinstance(self, wx.Panel): parent = parent.GetParent() parent._default_item = c f = awu.GetParentFrame(self) SetDefaultButton(f, c) #workaround su WXP non ridisegna il bottone con il bordo del bottone #di default, fino a che esso non riceve il focus f = self.FindFocus() s = None if isinstance(f, wx.TextCtrl): s = f.GetSelection() if s: f.SetSelection(*s)
def SetFirstFocus(parent): if parent.IsShown(): if awu.GetParentFrame(parent).IsShown(): for ctrl in awu.GetAllChildrens(parent): if isinstance(ctrl, (TextCtrl, NumCtrl, DateCtrl, CheckBox, RadioBox, Choice, LinkTable, DbGrid)): if hasattr(ctrl, 'this'): def SetFocus(): try: ctrl.SetFocus() except: pass wx.CallAfter(SetFocus) break
def OnKeyDown_TestHelp(self, event): if event.GetKeyCode() == wx.WXK_F1: f = awu.GetParentFrame(self) if event.ControlDown(): #CtrlF1 Attiva/Disattiva identificazione Window if hasattr(f, 'HelpBuilder_Switch'): try: f.HelpBuilder_Switch() except: pass else: #if event.AltDown(): a = wx.GetApp() if hasattr(f, 'HelpBuilder_ShowObjectHelp'): f.HelpBuilder_ShowObjectHelp(self) elif not hasattr(a, 'HelpBuilder_ShowObjectHelp'): awu.MsgDialog( self, "L'Applicazione non supporta il sistema di Help.") else: a.HelpBuilder_ShowObjectHelp(self) event.Skip()
def GridScadCheckImporti(self): out = True pf = awu.GetParentFrame(self.gridscad) st = pf.FindWindowByName('scadtot') for s in self.dbreg.scad: if s.f_riba is None: s.f_riba = 0 if st: tot = self.dbreg.scad.GetTotalOf('importo') st.SetValue(tot) try: out = self.CheckScad() sw = pf.FindWindowByName('scadwarning') if out: l = '' else: l = 'Controllare scadenze ed importi' sw.SetLabel(l) except AttributeError: pass return out
def RefreshDefaultItem(self): f = awu.GetParentFrame(self) f.SetDefaultItem(f.GetDefaultItem())
def HelpBuilder_ShowObjectHelp(self, obj): fn = self.HelpBuilder_FindObjectHelp(obj) if fn is not None: HelpBuilder_ShowHelp(fn, parent=awu.GetParentFrame(obj))
self.oTitle.mnemonicName = 'Title' statit = False if filtersPanel: if messages: statit = awu.MsgDialog(parentWindow, "Vuoi stampare le selezioni?", style=wx.ICON_QUESTION | wx.YES_NO | wx.YES_DEFAULT) == wx.ID_YES if statit: self.AddFiltersPanelTitleElements(filtersPanel) else: statit = False if doprogress: re_enable = awu.GetParentFrame(parentWindow).Disable() wait = awu.WaitDialog(parentWindow, message=waitMessage, maximum=dbTable.RowsCount()) self.progressBar = progressBar = wait.progress if messages: focused_object = parentWindow.FindFocus() else: wait = None try: r = 0 if progressBar <> None: progressBar.SetRange(dbTable.RowsCount()) if pageCount <> None: pageCount.SetLabel("0")