Beispiel #1
0
def mylocaltime(sec=None, mode=None):
	from scal3.cal_types import convert
	if mode is 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
Beispiel #2
0
def mylocaltime(sec=None, mode=None):
    from scal3.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
Beispiel #3
0
	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
Beispiel #4
0
 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
Beispiel #5
0
	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
Beispiel #6
0
 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
Beispiel #7
0
 def comboModeChanged(self, widget=None):
     pMode = self.mode
     pDate = self.get()
     mode = self.comboMode.get_active()
     module, ok = calTypes[mode]
     if not ok:
         raise RuntimeError("cal type %r not found" % mode)
     if pDate is 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
Beispiel #8
0
	def comboModeChanged(self, widget=None):
		pMode = self.mode
		pDate = self.get()
		mode = self.comboMode.get_active()
		module, ok = calTypes[mode]
		if not ok:
			raise RuntimeError("cal type %r not found" % mode)
		if pDate is 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
Beispiel #9
0
	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
Beispiel #10
0
	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()
Beispiel #11
0
 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()
Beispiel #12
0
 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
Beispiel #13
0
 def modeComboChanged(self, obj=None):
     # overwrite method from common.WidgetClass
     newMode = self.modeCombo.get_active()
     module, ok = calTypes[newMode]
     if not ok:
         raise RuntimeError("cal type %r not found" % mode)
     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