def mylocaltime(sec=None, mode=None): from scal2.cal_types import convert if mode == None: ##DATE_GREG return list(localtime(sec)) t = list(localtime(sec)) t[:3] = convert(t[0], t[1], t[2], DATE_GREG, mode) return t
def mylocaltime(sec=None, mode=None): from scal2.cal_types import convert if mode==None:##DATE_GREG return list(localtime(sec)) t = list(localtime(sec)) t[:3] = convert(t[0], t[1], t[2], DATE_GREG, mode) return t
def getSysDate(mode=None): if mode is None: mode = primaryMode if mode==DATE_GREG: return localtime()[:3] else: gy, gm, gd = localtime()[:3] return convert(gy, gm, gd, DATE_GREG, mode)
def comboModeChanged(self, widget=None): pMode = self.mode pDate = self.get() mode = self.comboMode.get_active() module = calTypes[mode] if pDate==None: y, m, d = ui.cell.dates[mode] else: y0, m0, d0 = pDate y, m, d = convert(y0, m0, d0, pMode, mode) self.ymdBox.set_mode(mode) self.dateInput.setMaxDay(module.maxMonthLen) self.set(y, m, d) self.mode = mode
def dragRec(self, obj, context, x, y, selection, target_id, etime): text = selection.get_text() if text==None: return date = ui.parseDroppedDate(text) if date==None: print('selectDateDialog: dropped text "%s"'%text) return print('selectDateDialog: dropped date: %d/%d/%d'%date) mode = self.comboMode.get_active() if mode!=ui.dragGetMode: date = convert(date[0], date[1], date[2], ui.dragGetMode, mode) self.dateInput.set_value(date) self.dateInput.add_history() return True
def modeComboChanged(self, obj=None):## overwrite method from common.WidgetClass newMode = self.modeCombo.get_active() module = calTypes[newMode] monthCombo = self.monthCombo month = monthCombo.getValue() monthCombo.build(newMode) y2, m2, d2 = convert( int(self.startYearSpin.get_value()), month, int(self.daySpin.get_value()), self.event.mode, newMode, ) self.startYearSpin.set_value(y2) monthCombo.setValue(m2) self.daySpin.set_value(d2) self.event.mode = newMode
def ok(self, widget): mode = self.comboMode.get_active() if mode==None: return get = self.get() if get==None: return y0, m0, d0 = get if mode==calTypes.primary: y, m, d = (y0, m0, d0) else: y, m, d = convert(y0, m0, d0, mode, calTypes.primary) #if not core.validDate(mode, y, m, d): # print('bad date', mode, y, m, d) # return self.emit('response-date', y, m, d) self.hide() self.dateInput.set_value((y0, m0, d0)) self.dateInput.add_history()
def modeComboChanged(self, obj=None ): ## overwrite method from common.WidgetClass newMode = self.modeCombo.get_active() module = calTypes[newMode] monthCombo = self.monthCombo month = monthCombo.getValue() monthCombo.build(newMode) y2, m2, d2 = convert( int(self.startYearSpin.get_value()), month, int(self.daySpin.get_value()), self.event.mode, newMode, ) self.startYearSpin.set_value(y2) monthCombo.setValue(m2) self.daySpin.set_value(d2) self.event.mode = newMode
def mylocaltime(sec=None, mode=None): if mode==None:##DATE_GREG return list(localtime(sec)) t = list(localtime(sec)) t[:3] = convert(t[0], t[1], t[2], DATE_GREG, mode) return t