コード例 #1
0
ファイル: weekCal.py プロジェクト: amirkarimi/starcal
 def __init__(self):
     gtk.HBox.__init__(self)
     CalBase.__init__(self)
     self.set_property('height-request', ui.wcalHeight)
     ######################
     self.connect('scroll-event', self.scroll)
     ###
     self.connect('button-press-event', self.buttonPress)
     #####
     defaultItems = [
         ToolbarColumn(self),
         WeekDaysColumn(self),
         PluginsTextColumn(self),
         EventsIconColumn(self),
         EventsCountColumn(self),
         EventsTextColumn(self),
         EventsBoxColumn(self),
         DaysOfMonthColumnGroup(self),
     ]
     defaultItemsDict = dict([(item._name, item) for item in defaultItems])
     itemNames = defaultItemsDict.keys()
     for name, enable in ui.wcalItems:
         try:
             item = defaultItemsDict[name]
         except KeyError:
             print('weekCal item %s does not exist'%name)
         else:
             item.enable = enable
             self.appendItem(item)
             itemNames.remove(name)
     for name in itemNames:
         item = defaultItemsDict[name]
         item.enable = False
         self.appendItem(item)
コード例 #2
0
	def __init__(self):
		gtk.HBox.__init__(self)
		CalBase.__init__(self)
		self.set_property('height-request', ui.wcalHeight)
		######################
		self.connect('scroll-event', self.scroll)
		###
		self.connect('button-press-event', self.buttonPress)
		#####
		defaultItems = [
			ToolbarColumn(self),
			WeekDaysColumn(self),
			PluginsTextColumn(self),
			EventsIconColumn(self),
			EventsCountColumn(self),
			EventsTextColumn(self),
			EventsBoxColumn(self),
			DaysOfMonthColumnGroup(self),
		]
		defaultItemsDict = dict([(item._name, item) for item in defaultItems])
		itemNames = defaultItemsDict.keys()
		for name, enable in ui.wcalItems:
			try:
				item = defaultItemsDict[name]
			except KeyError:
				print('weekCal item %s does not exist'%name)
			else:
				item.enable = enable
				self.appendItem(item)
				itemNames.remove(name)
		for name in itemNames:
			item = defaultItemsDict[name]
			item.enable = False
			self.appendItem(item)
コード例 #3
0
	def __init__(self):
		gtk.Widget.__init__(self)
		CalBase.__init__(self)
		self.set_property('height-request', ui.mcalHeight)
		######################
		#self.kTime = 0
		######################
		self.connect('expose-event', self.drawAll)
		self.connect('button-press-event', self.buttonPress)
		#self.connect('screen-changed', self.screenChanged)
		self.connect('scroll-event', self.scroll)
コード例 #4
0
ファイル: monthcal.py プロジェクト: Noori/starcal
 def keyPress(self, arg, event):
     if CalBase.keyPress(self, arg, event):
         return True
     kname = gdk.keyval_name(event.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,
             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 event.state & gdk.SHIFT_MASK:
             # Simulate right click (key beside Right-Ctrl)
             self.emit('popup-menu-cell', event.time, *self.getCellPos())
         else:
             self.emit('popup-menu-main', event.time, *self.getMainMenuPos())
     else:
         return False
     return True
コード例 #5
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.state & gdk.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
コード例 #6
0
ファイル: weekCal.py プロジェクト: amirkarimi/starcal
 def keyPress(self, arg, gevent):
     if CalBase.keyPress(self, arg, gevent):
         return True
     kname = gdk.keyval_name(gevent.keyval).lower()
     if kname=='up':
         self.jdPlus(-1)
     elif kname=='down':
         self.jdPlus(1)
     elif kname=='end':
         self.gotoJd(self.status[-1].jd)
     elif kname in ('page_up', 'k', 'p'):
         self.jdPlus(-7)
     elif kname in ('page_down', 'j', 'n'):
         self.jdPlus(7)
     elif kname in ('f10', 'm'):
         if gevent.state & gdk.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
コード例 #7
0
	def keyPress(self, arg, gevent):
		if CalBase.keyPress(self, arg, gevent):
			return True
		kname = gdk.keyval_name(gevent.keyval).lower()
		if kname=='up':
			self.jdPlus(-1)
		elif kname=='down':
			self.jdPlus(1)
		elif kname=='end':
			self.gotoJd(self.status[-1].jd)
		elif kname in ('page_up', 'k', 'p'):
			self.jdPlus(-7)
		elif kname in ('page_down', 'j', 'n'):
			self.jdPlus(7)
		elif kname in ('f10', 'm'):
			if gevent.state & gdk.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
コード例 #8
0
ファイル: weekcal.py プロジェクト: Noori/starcal
 def __init__(self):
     gtk.HBox.__init__(self)
     CalBase.__init__(self)
     self.set_property('height-request', ui.wcalHeight)
     ######################
     self.connect('scroll-event', self.scroll)
     ###
     self.connect('button-press-event', self.buttonPress)
     #####
     defaultItems = [
         ToolbarColumn(self),
         WeekDaysColumn(self),
         PluginsTextColumn(self),
         EventsIconColumn(self),
         EventsCountColumn(self),
         EventsTextColumn(self),
         EventsBoxColumn(self),
         DaysOfMonthColumnGroup(self),
     ]
     defaultItemsDict = dict([(item._name, item) for item in defaultItems])
     itemNames = defaultItemsDict.keys()
     for name, enable in ui.wcalItems:
         try:
             item = defaultItemsDict[name]
         except KeyError:
             print('weekCal item %s does not exist'%name)
         else:
             item.enable = enable
             self.appendItem(item)
             itemNames.remove(name)
     for name in itemNames:
         item = defaultItemsDict[name]
         item.enable = False
         self.appendItem(item)
     #####
     hbox = gtk.HBox()
     spin = IntSpinButton(1, 9999)
     spin.set_value(ui.wcalHeight)
     spin.connect('changed', self.heightSpinChanged)
     pack(hbox, gtk.Label(_('Height')))
     pack(hbox, spin)
     pack(self.optionsWidget, hbox)
     ###
     hbox = gtk.HBox()
     spin = FloatSpinButton(0.01, 1, 2)
     spin.set_value(ui.wcalTextSizeScale)
     spin.connect('changed', self.textSizeScaleSpinChanged)
     pack(hbox, gtk.Label(_('Text Size Scale')))
     pack(hbox, spin)
     pack(self.optionsWidget, hbox)
     ########
     hbox = gtk.HBox(spacing=3)
     ####
     item = CheckPrefItem(ui, 'wcalGrid', _('Grid'))
     item.updateWidget()
     gridCheck = item._widget
     pack(hbox, gridCheck)
     gridCheck.item = item
     ####
     colorItem = ColorPrefItem(ui, 'wcalGridColor', True)
     colorItem.updateWidget()
     pack(hbox, colorItem._widget)
     gridCheck.colorb = colorItem._widget
     gridCheck.connect('clicked', self.gridCheckClicked)
     colorItem._widget.item = colorItem
     colorItem._widget.connect('color-set', self.gridColorChanged)
     colorItem._widget.set_sensitive(ui.wcalGrid)
     ####
     pack(self.optionsWidget, hbox)
     ###
     self.optionsWidget.show_all()
コード例 #9
0
ファイル: monthcal.py プロジェクト: Noori/starcal
 def __init__(self):
     gtk.Widget.__init__(self)
     CalBase.__init__(self)
     self.set_property('height-request', ui.mcalHeight)
     ######
     hbox = gtk.HBox()
     spin = IntSpinButton(1, 9999)
     spin.set_value(ui.mcalHeight)
     spin.connect('changed', self.heightSpinChanged)
     pack(hbox, gtk.Label(_('Height')))
     pack(hbox, spin)
     pack(self.optionsWidget, hbox)
     ####
     hbox = gtk.HBox(spacing=3)
     ##
     pack(hbox, gtk.Label(_('Left Margin')))
     spin = IntSpinButton(0, 99)
     spin.set_value(ui.mcalLeftMargin)
     spin.connect('changed', self.leftMarginSpinChanged)
     pack(hbox, spin)
     ##
     pack(hbox, gtk.Label(_('Top')))
     spin = IntSpinButton(0, 99)
     spin.set_value(ui.mcalTopMargin)
     spin.connect('changed', self.topMarginSpinChanged)
     pack(hbox, spin)
     ##
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.optionsWidget, hbox)
     ########
     hbox = gtk.HBox(spacing=3)
     ####
     item = CheckPrefItem(ui, 'mcalGrid', _('Grid'))
     item.updateWidget()
     gridCheck = item._widget
     pack(hbox, gridCheck)
     gridCheck.item = item
     ####
     colorItem = ColorPrefItem(ui, 'mcalGridColor', True)
     colorItem.updateWidget()
     pack(hbox, colorItem._widget)
     gridCheck.colorb = colorItem._widget
     gridCheck.connect('clicked', self.gridCheckClicked)
     colorItem._widget.item = colorItem
     colorItem._widget.connect('color-set', self.gridColorChanged)
     colorItem._widget.set_sensitive(ui.mcalGrid)
     ####
     pack(self.optionsWidget, hbox)
     ########
     frame = gtk.Frame(_('Calendars'))
     self.typeParamsVbox = gtk.VBox()
     frame.add(self.typeParamsVbox)
     frame.show_all()
     pack(self.optionsWidget, frame)
     self.optionsWidget.show_all()
     self.updateTypeParamsWidget()## FIXME
     ######################
     #self.kTime = 0
     ######################
     self.connect('expose-event', self.drawAll)
     self.connect('button-press-event', self.buttonPress)
     #self.connect('screen-changed', self.screenChanged)
     self.connect('scroll-event', self.scroll)
     ######################
     self.updateTextWidth()