def __init__(self, resources=None, view=None, state=IMPORT, modal=True, parent=None): global dialogShowing dialogShowing = True self.resources = resources self.view = view self.state = state self.changedTimeZone = None pre = wx.PreDialog() self.resources.LoadOnDialog(pre, parent, "TurnOnTimezonesDialog") self.PostCreate(pre) self.text = wx.xrc.XRCCTRL(self, "Text") self.checkbox = wx.xrc.XRCCTRL(self, "Checkbox") self.chooser = wx.xrc.XRCCTRL(self, "Chooser") TimeZoneList.buildTZChoiceList(view, self.chooser) self.FillButtonPanel() self.SetText() self.Bind(wx.EVT_BUTTON, self.OnYes, id=wx.ID_YES) self.Bind(wx.EVT_BUTTON, self.OnNo, id=wx.ID_NO) self.Bind(wx.EVT_BUTTON, self.End, id=wx.ID_CANCEL) self.chooser.Bind(wx.EVT_CHOICE, self.OnTZChoice) self.Fit()
def OnTZChoice(self, event): choiceIndex = self.chooser.GetSelection() if choiceIndex != -1: oldTZ = TimeZoneInfo.get(self.view).default newTZ = self.chooser.GetClientData(choiceIndex) if newTZ == TimeZoneList.TIMEZONE_OTHER_FLAG: newTZ = TimeZoneList.pickTimeZone(self.view) if newTZ is None: newTZ = oldTZ TimeZoneList.buildTZChoiceList(self.view, self.chooser, newTZ) if newTZ != oldTZ: self.changedTimeZone = newTZ