Example #1
0
	def comboMonthChanged(self, widget=None):
		monthIndex = self.comboMonth.get_active()
		if monthIndex == -1:
			return
		self.spinD.set_range(1, getMonthLen(
			self.spinY.get_value(),
			monthIndex + 1,
			self.mode,
		))
Example #2
0
File: ymd.py Project: ilius/starcal
	def comboMonthChanged(self, widget=None):
		monthIndex = self.comboMonth.get_active()
		if monthIndex == -1:
			return
		self.spinD.set_range(1, getMonthLen(
			self.spinY.get_value(),
			monthIndex + 1,
			self.mode,
		))
Example #3
0
 def __init__(self, cellCache, year, month):
     self.year = year
     self.month = month
     self.monthLen = getMonthLen(year, month, calTypes.primary)
     self.offset = getWeekDay(year, month, 1)  ## month start offset
     initJd = core.primary_to_jd(year, month, 1)
     self.weekNum = [getWeekNumberByJd(initJd + i * 7) for i in range(6)]
     #########
     startJd, endJd = core.getJdRangeForMonth(year, month, calTypes.primary)
     tableStartJd = startJd - self.offset
     #####
     list.__init__(self, [[
         cellCache.getCell(tableStartJd + yPos * 7 + xPos)
         for xPos in range(7)
     ] for yPos in range(6)])
Example #4
0
 def __init__(self, cellCache, year, month):
     self.year = year
     self.month = month
     self.monthLen = getMonthLen(year, month, calTypes.primary)
     self.offset = getWeekDay(year, month, 1)## month start offset
     self.weekNum = [getWeekNumber(year, month, 1+7*i) for i in range(6)]
     #########
     startJd, endJd = core.getJdRangeForMonth(year, month, calTypes.primary)
     tableStartJd = startJd - self.offset
     #####
     list.__init__(self, [
         [
             cellCache.getCell(
                 tableStartJd + yPos*7 + xPos
             ) for xPos in range(7)
         ] for yPos in range(6)
     ])
Example #5
0
 def keyPress(self, arg, gevent):
     print('keyPress')
     if CalBase.keyPress(self, arg, gevent):
         return True
     kname = gdk.keyval_name(gevent.keyval).lower()
     print('keyPress', kname)
     #if kname.startswith('alt'):
     #    return True
     ## How to disable Alt+Space of metacity ?????????????????????
     if kname == 'up':
         self.jdPlus(-7)
     elif kname == 'down':
         self.jdPlus(7)
     elif kname == 'right':
         if rtl:
             self.jdPlus(-1)
         else:
             self.jdPlus(1)
     elif kname == 'left':
         if rtl:
             self.jdPlus(1)
         else:
             self.jdPlus(-1)
     elif kname == 'end':
         self.changeDate(
             ui.cell.year,
             ui.cell.month,
             core.getMonthLen(ui.cell.year, ui.cell.month,
                              calTypes.primary),
         )
     elif kname in ('page_up', 'k', 'p'):
         self.monthPlus(-1)
     elif kname in ('page_down', 'j', 'n'):
         self.monthPlus(1)
     elif kname in ('f10', 'm'):
         if gevent.get_state() & gdk.ModifierType.SHIFT_MASK:
             # Simulate right click (key beside Right-Ctrl)
             self.emit('popup-cell-menu', gevent.time, *self.getCellPos())
         else:
             self.emit('popup-main-menu', gevent.time,
                       *self.getMainMenuPos())
     else:
         return False
     return True
Example #6
0
 def keyPress(self, arg, gevent):
     if CalBase.keyPress(self, arg, gevent):
         return True
     kname = gdk.keyval_name(gevent.keyval).lower()
     #if kname.startswith("alt"):
     #	return True
     ## How to disable Alt+Space of metacity ?????????????????????
     if kname == "up":
         self.jdPlus(-7)
     elif kname == "down":
         self.jdPlus(7)
     elif kname == "right":
         if rtl:
             self.jdPlus(-1)
         else:
             self.jdPlus(1)
     elif kname == "left":
         if rtl:
             self.jdPlus(1)
         else:
             self.jdPlus(-1)
     elif kname == "end":
         self.changeDate(
             ui.cell.year,
             ui.cell.month,
             core.getMonthLen(ui.cell.year, ui.cell.month,
                              calTypes.primary),
         )
     elif kname in ("page_up", "k", "p"):
         self.monthPlus(-1)
     elif kname in ("page_down", "j", "n"):
         self.monthPlus(1)
     elif kname in ("f10", "m"):
         if gevent.get_state() & gdk.ModifierType.SHIFT_MASK:
             # Simulate right click (key beside Right-Ctrl)
             self.emit("popup-cell-menu", gevent.time, *self.getCellPos())
         else:
             self.emit("popup-main-menu", gevent.time,
                       *self.getMainMenuPos())
     else:
         return False
     return True
Example #7
0
 def keyPress(self, arg, gevent):
     print('keyPress')
     if CalBase.keyPress(self, arg, gevent):
         return True
     kname = gdk.keyval_name(gevent.keyval).lower()
     print('keyPress', kname)
     #if kname.startswith('alt'):
     #    return True
     ## How to disable Alt+Space of metacity ?????????????????????
     if kname=='up':
         self.jdPlus(-7)
     elif kname=='down':
         self.jdPlus(7)
     elif kname=='right':
         if rtl:
             self.jdPlus(-1)
         else:
             self.jdPlus(1)
     elif kname=='left':
         if rtl:
             self.jdPlus(1)
         else:
             self.jdPlus(-1)
     elif kname=='end':
         self.changeDate(
             ui.cell.year,
             ui.cell.month,
             core.getMonthLen(ui.cell.year, ui.cell.month, calTypes.primary),
         )
     elif kname in ('page_up', 'k', 'p'):
         self.monthPlus(-1)
     elif kname in ('page_down', 'j', 'n'):
         self.monthPlus(1)
     elif kname in ('f10', 'm'):
         if gevent.get_state() & gdk.ModifierType.SHIFT_MASK:
             # Simulate right click (key beside Right-Ctrl)
             self.emit('popup-cell-menu', gevent.time, *self.getCellPos())
         else:
             self.emit('popup-main-menu', gevent.time, *self.getMainMenuPos())
     else:
         return False
     return True
Example #8
0
File: ui.py Project: ilius/starcal
def yearPlus(plus=1):
	global cell
	year = cell.year + plus
	month = cell.month
	day = min(cell.day, core.getMonthLen(year, month, calTypes.primary))
	cell = cellCache.getCellByDate(year, month, day)
Example #9
0
File: ui.py Project: ilius/starcal
def getMonthPlus(tmpCell, plus):
	year, month = core.monthPlus(tmpCell.year, tmpCell.month, plus)
	day = min(tmpCell.day, core.getMonthLen(year, month, calTypes.primary))
	return cellCache.getCellByDate(year, month, day)
Example #10
0
def yearPlus(plus=1):
	global cell
	year = cell.year + plus
	month = cell.month
	day = min(cell.day, core.getMonthLen(year, month, calTypes.primary))
	cell = cellCache.getCellByDate(year, month, day)
Example #11
0
def getMonthPlus(tmpCell, plus):
	year, month = core.monthPlus(tmpCell.year, tmpCell.month, plus)
	day = min(tmpCell.day, core.getMonthLen(year, month, calTypes.primary))
	return cellCache.getCellByDate(year, month, day)
Example #12
0
 def comboMonthChanged(self, widget=None):
     self.spinD.set_range(1, getMonthLen(
         self.spinY.get_value(),
         self.comboMonth.get_active() + 1,
         self.mode,
     ))