def make_date_grid(self, panel): self.currDateLabel = wx.StaticText(panel, label="Curr Date") dates = Date(self, self.dateFormat, self.payType, self.ref_date) self.curr_date = dates.get_curr_date() self.currDate = wx.StaticText(panel, label=self.curr_date["str"]) self.projDateLabel = wx.StaticText(panel, label="Proj Date") displayDateFormat = self.dateFormat.replace("%m", "mm").replace( "%d", "dd").replace("%y", "yy").replace("%Y", "yyyy") self.projDateInput = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER, value=displayDateFormat) self.currPayDateLabel = wx.StaticText(panel, label="Current Pay Date") self.currPayDate = dates.get_curr_paydate() self.currPayDateOutput = wx.StaticText(panel, label=str(self.currPayDate)) self.nextPayDateLabel = wx.StaticText(panel, label="Next Pay Date") self.nextPayDate = dates.get_next_paydate() self.nextPayDateOutput = wx.StaticText(panel, label=str(self.nextPayDate)) self.projDateInput.Bind(wx.EVT_TEXT_ENTER, self.onProjDateEntered)
def update_date_grid_dates(self, oldDateFormat, newDateFormat): if oldDateFormat != newDateFormat: self.curr_date = Date.convertDateFormat(self, self.curr_date, oldDateFormat, newDateFormat) self.currDate.LabelText = self.curr_date["str"] self.currDate.Refresh() try: if oldDateFormat != newDateFormat: self.proj_date = Date.convertDateFormat( self, self.proj_date, oldDateFormat, newDateFormat) if self.proj_date == None: self.projDateInput.LabelText = newDateFormat.replace( "%m", "mm").replace("%d", "dd").replace("%y", "yy").replace("%Y", "yyyy") else: self.projDateInput.LabelText = self.proj_date except: self.projDateInput.LabelText = newDateFormat.replace( "%m", "mm").replace("%d", "dd").replace("%y", "yy").replace("%Y", "yyyy") self.projDateInput.Refresh() if oldDateFormat != newDateFormat: self.currPayDate = Date.convertDateFormat(self, self.currPayDate, oldDateFormat, newDateFormat) self.currPayDateOutput.LabelText = Date.get_curr_paydate(self) self.currPayDateOutput.Refresh() if oldDateFormat != newDateFormat: self.nextPayDate = Date.convertDateFormat(self, self.nextPayDate, oldDateFormat, newDateFormat) self.nextPayDateOutput.LabelText = Date.get_next_paydate(self) self.nextPayDateOutput.Refresh()