Example #1
0
	def statusIconPopup(self, sicon, button, etime):
		menu = gtk.Menu()
		if os.sep == "\\":
			from scal3.ui_gtk.windows import setupMenuHideOnLeave
			setupMenuHideOnLeave(menu)
		items = self.getStatusIconPopupItems()
		# items.insert(0, self.getMainWinMenuItem())## FIXME
		get_pos_func = None
		y1 = 0
		geo = self.sicon.get_geometry()
		## Previously geo was None on windows, and on Linux it had `geo.index(1)` (not sure about the type)
		## Now it's tuple on both Linux and windows
		if geo is None:
			items.reverse()
		elif isinstance(geo, tuple):
			# geo == (True, screen, area, orientation)
			y1 = geo[2].y
		else:
			y1 = geo.index(1)
		try:
			y = gtk.StatusIcon.position_menu(menu, self.sicon)[1]
		except TypeError: ## new gi versions
			y = gtk.StatusIcon.position_menu(menu, 0, 0, self.sicon)[1]
		if y1 > 0 and y < y1:  # taskbar is on bottom
			items.reverse()
		get_pos_func = gtk.StatusIcon.position_menu
		for item in items:
			menu.add(item)
		menu.show_all()
		#print("statusIconPopup", button, etime)
		menu.popup(None, None, get_pos_func, self.sicon, button, etime)
		#self.sicon.do_popup_menu(self.sicon, button, etime)
		ui.updateFocusTime()
		self.sicon.menu = menu ## to prevent gurbage collected
Example #2
0
	def popupPopulate(self, label, menu):
		itemCopyAll = ImageMenuItem(_("Copy _All"))
		itemCopyAll.set_image(gtk.Image.new_from_stock(
			gtk.STOCK_COPY,
			gtk.IconSize.MENU),
		)
		itemCopyAll.connect("activate", self.copyAll)
		##
		itemCopy = ImageMenuItem(_("_Copy"))
		itemCopy.set_image(gtk.Image.new_from_stock(
			gtk.STOCK_COPY,
			gtk.IconSize.MENU,
		))
		itemCopy.connect("activate", self.copy)
		itemCopy.set_sensitive(
			self.get_property("cursor-position") >
			self.get_property("selection-bound")
		)  # FIXME
		##
		for item in menu.get_children():
			menu.remove(item)
		##
		menu.add(itemCopyAll)
		menu.add(itemCopy)
		menu.show_all()
		##
		ui.updateFocusTime()
Example #3
0
 def popupPopulate(self, label, menu):
     itemCopyAll = ImageMenuItem(_("Copy _All"))
     itemCopyAll.set_image(
         gtk.Image.new_from_stock(gtk.STOCK_COPY, gtk.IconSize.MENU), )
     itemCopyAll.connect("activate", self.copyAll)
     ##
     itemCopy = ImageMenuItem(_("_Copy"))
     itemCopy.set_image(
         gtk.Image.new_from_stock(
             gtk.STOCK_COPY,
             gtk.IconSize.MENU,
         ))
     itemCopy.connect("activate", self.copy)
     itemCopy.set_sensitive(
         self.get_property("cursor-position") >
         self.get_property("selection-bound"))  # FIXME
     ##
     for item in menu.get_children():
         menu.remove(item)
     ##
     menu.add(itemCopyAll)
     menu.add(itemCopy)
     menu.show_all()
     ##
     ui.updateFocusTime()
Example #4
0
	def statusIconPopup(self, sicon, button, etime):
		menu = gtk.Menu()
		if os.sep == '\\':
			from scal3.ui_gtk.windows import setupMenuHideOnLeave
			setupMenuHideOnLeave(menu)
		items = self.getStatusIconPopupItems()
		# items.insert(0, self.getMainWinMenuItem())## FIXME
		geo = self.sicon.get_geometry() ## Returns None on windows, why???
		if geo is None:## windows, taskbar is on buttom(below)
			items.reverse()
			get_pos_func = None
		else:
			#print(dir(geo))
			y1 = geo.index(1)
			try:
				y = gtk.StatusIcon.position_menu(menu, self.sicon)[1]
			except TypeError: ## new gi versions
				y = gtk.StatusIcon.position_menu(menu, 0, 0, self.sicon)[1]
			if y<y1:## taskbar is on bottom
				items.reverse()
			get_pos_func = gtk.StatusIcon.position_menu
		for item in items:
			menu.add(item)
		menu.show_all()
		#print('statusIconPopup', button, etime)
		menu.popup(None, None, get_pos_func, self.sicon, button, etime)
		#self.sicon.do_popup_menu(self.sicon, button, etime)
		ui.updateFocusTime()
		self.sicon.menu = menu ## to prevent gurbage collected
Example #5
0
	def statusIconPopup(self, sicon, button, etime):
		menu = gtk.Menu()
		if os.sep == "\\":
			from scal3.ui_gtk.windows import setupMenuHideOnLeave
			setupMenuHideOnLeave(menu)
		items = self.getStatusIconPopupItems()
		# items.insert(0, self.getMainWinMenuItem())## FIXME
		get_pos_func = None
		y1 = 0
		geo = self.sicon.get_geometry()
		## Previously geo was None on windows, and on Linux it had `geo.index(1)` (not sure about the type)
		## Now it's tuple on both Linux and windows
		if geo is None:
			items.reverse()
		elif isinstance(geo, tuple):
			# geo == (True, screen, area, orientation)
			y1 = geo[2].y
		else:
			y1 = geo.index(1)
		try:
			y = gtk.StatusIcon.position_menu(menu, self.sicon)[1]
		except TypeError: ## new gi versions
			y = gtk.StatusIcon.position_menu(menu, 0, 0, self.sicon)[1]
		if y1 > 0 and y < y1:  # taskbar is on bottom
			items.reverse()
		get_pos_func = gtk.StatusIcon.position_menu
		for item in items:
			menu.add(item)
		menu.show_all()
		#print("statusIconPopup", button, etime)
		menu.popup(None, None, get_pos_func, self.sicon, button, etime)
		#self.sicon.do_popup_menu(self.sicon, button, etime)
		ui.updateFocusTime()
		self.sicon.menu = menu ## to prevent gurbage collected
Example #6
0
 def statusIconPopup(self, sicon, button, etime):
     menu = gtk.Menu()
     if os.sep == '\\':
         from scal3.ui_gtk.windows import setupMenuHideOnLeave
         setupMenuHideOnLeave(menu)
     items = self.getStatusIconPopupItems()
     # items.insert(0, self.getMainWinMenuItem())## FIXME
     geo = self.sicon.get_geometry() ## Returns None on windows, why???
     if geo is None:## windows, taskbar is on buttom(below)
         items.reverse()
         get_pos_func = None
     else:
         #print(dir(geo))
         y1 = geo.index(1)
         try:
             y = gtk.StatusIcon.position_menu(menu, self.sicon)[1]
         except TypeError: ## new gi versions
             y = gtk.StatusIcon.position_menu(menu, 0, 0, self.sicon)[1]
         if y<y1:## taskbar is on bottom
             items.reverse()
         get_pos_func = gtk.StatusIcon.position_menu
     for item in items:
         menu.add(item)
     menu.show_all()
     #print('statusIconPopup', button, etime)
     menu.popup(None, None, get_pos_func, self.sicon, button, etime)
     #self.sicon.do_popup_menu(self.sicon, button, etime)
     ui.updateFocusTime()
     self.sicon.menu = menu ## to prevent gurbage collected
Example #7
0
	def buttonPress(self, widget, gevent):
		if gevent.button == 3:
			self.updateMenu()
			foo, x, y = self.get_window().get_origin()
			y += self.get_allocation().height
			x -= 7 ## ????????? because of menu padding
			## align menu to center:
			x -= int(
				(
					get_menu_width(self.menu) -
					self.get_allocation().width
				) // 2
			)
			self.menu.popup(
				None,
				None,
				lambda *args: (x, y, True),
				None,
				gevent.button,
				gevent.time,
			)
			ui.updateFocusTime()
			return True
		else:
			return False
Example #8
0
	def buttonPress(self, widget, gevent):
		if gevent.button == 3:
			self.updateMenu()
			foo, x, y = self.get_window().get_origin()
			y += self.get_allocation().height
			x -= 7 ## ????????? because of menu padding
			## align menu to center:
			x -= int(
				(
					get_menu_width(self.menu) -
					self.get_allocation().width
				) // 2
			)
			self.menu.popup(
				None,
				None,
				lambda *args: (x, y, True),
				None,
				gevent.button,
				gevent.time,
			)
			ui.updateFocusTime()
			return True
		else:
			return False
Example #9
0
 def onPopup(self, widget, menu):
     menu = gtk.Menu()
     self.labelMenuAddCopyItems(menu)
     ####
     menu.show_all()
     self.tmpMenu = menu
     menu.popup(None, None, None, None, 3, 0)
     ui.updateFocusTime()
Example #10
0
 def onPopup(self, widget, menu):
     menu = gtk.Menu()
     self.labelMenuAddCopyItems(menu)
     ####
     menu.show_all()
     self.tmpMenu = menu
     menu.popup(None, None, None, None, 3, 0)
     ui.updateFocusTime()
Example #11
0
	def menuCellPopup(self, widget, etime, x, y):
		menu = gtk.Menu()
		####
		menu.add(labelStockMenuItem('_Copy Date', gtk.STOCK_COPY, self.copyDate))
		menu.add(labelStockMenuItem('Day Info', gtk.STOCK_INFO, self.dayInfoShow))
		menu.add(self.getEventAddToMenuItem())
		menu.add(gtk.SeparatorMenuItem())
		menu.add(labelStockMenuItem('Select _Today', gtk.STOCK_HOME, self.goToday))
		menu.add(labelStockMenuItem('Select _Date...', gtk.STOCK_INDEX, self.selectDateShow))
		if widget._name in ('weekCal', 'monthCal'):
			menu.add(labelStockMenuItem(
				'Switch to ' + ('Month Calendar' if widget._name=='weekCal' else 'Week Calendar'),
				gtk.STOCK_REDO,
				self.switchWcalMcal,
			))
		if os.path.isfile('/usr/bin/evolution'):##??????????????????
			menu.add(labelImageMenuItem('In E_volution', 'evolution-18.png', ui.dayOpenEvolution))
		#if os.path.isfile('/usr/bin/sunbird'):##??????????????????
		#	menu.add(labelImageMenuItem('In _Sunbird', 'sunbird-18.png', ui.dayOpenSunbird))
		####
		moreMenu = gtk.Menu()
		moreMenu.add(labelStockMenuItem('_Customize', gtk.STOCK_EDIT, self.customizeShow))
		moreMenu.add(labelStockMenuItem('_Preferences', gtk.STOCK_PREFERENCES, self.prefShow))
		moreMenu.add(labelStockMenuItem('_Event Manager', gtk.STOCK_ADD, self.eventManShow))
		moreMenu.add(labelImageMenuItem('Time Line', 'timeline-18.png', self.timeLineShow))
		#moreMenu.add(labelImageMenuItem('Week Calendar', 'weekcal-18.png', self.weekCalShow))
		moreMenu.add(labelStockMenuItem(_('Export to %s')%'HTML', gtk.STOCK_CONVERT, self.exportClicked))
		moreMenu.add(labelStockMenuItem('_About', gtk.STOCK_ABOUT, self.aboutShow))
		if self.statusIconMode!=1:
			moreMenu.add(labelStockMenuItem('_Quit', gtk.STOCK_QUIT, self.quit))
		##
		moreMenu.show_all()
		moreItem = MenuItem(_('More'))
		moreItem.set_submenu(moreMenu)
		#moreItem.show_all()
		menu.add(moreItem)
		####
		menu.show_all()
		dx, dy = widget.translate_coordinates(self, x, y)
		foo, wx, wy = self.get_window().get_origin()
		x = wx+dx
		y = wy+dy
		if rtl:
			x -= get_menu_width(menu)
		####
		etime = gtk.get_current_event_time()
		#print('menuCellPopup', x, y, etime)
		self.menuCell = menu ## without this line, the menu was not showing up, WTF?!!
		menu.popup(
			None,
			None,
			lambda *args: (x, y, True),
			None,
			3,
			etime,
		)
		ui.updateFocusTime()
Example #12
0
 def menuCellPopup(self, widget, etime, x, y):
     menu = gtk.Menu()
     ####
     menu.add(labelStockMenuItem('_Copy Date', gtk.STOCK_COPY, self.copyDate))
     menu.add(labelStockMenuItem('Day Info', gtk.STOCK_INFO, self.dayInfoShow))
     menu.add(self.getEventAddToMenuItem())
     menu.add(gtk.SeparatorMenuItem())
     menu.add(labelStockMenuItem('Select _Today', gtk.STOCK_HOME, self.goToday))
     menu.add(labelStockMenuItem('Select _Date...', gtk.STOCK_INDEX, self.selectDateShow))
     if widget._name in ('weekCal', 'monthCal'):
         menu.add(labelStockMenuItem(
             'Switch to ' + ('Month Calendar' if widget._name=='weekCal' else 'Week Calendar'),
             gtk.STOCK_REDO,
             self.switchWcalMcal,
         ))
     if os.path.isfile('/usr/bin/evolution'):##??????????????????
         menu.add(labelImageMenuItem('In E_volution', 'evolution-18.png', ui.dayOpenEvolution))
     #if os.path.isfile('/usr/bin/sunbird'):##??????????????????
     #    menu.add(labelImageMenuItem('In _Sunbird', 'sunbird-18.png', ui.dayOpenSunbird))
     ####
     moreMenu = gtk.Menu()
     moreMenu.add(labelStockMenuItem('_Customize', gtk.STOCK_EDIT, self.customizeShow))
     moreMenu.add(labelStockMenuItem('_Preferences', gtk.STOCK_PREFERENCES, self.prefShow))
     moreMenu.add(labelStockMenuItem('_Event Manager', gtk.STOCK_ADD, self.eventManShow))
     moreMenu.add(labelImageMenuItem('Time Line', 'timeline-18.png', self.timeLineShow))
     #moreMenu.add(labelImageMenuItem('Week Calendar', 'weekcal-18.png', self.weekCalShow))
     moreMenu.add(labelStockMenuItem(_('Export to %s')%'HTML', gtk.STOCK_CONVERT, self.exportClicked))
     moreMenu.add(labelStockMenuItem('_About', gtk.STOCK_ABOUT, self.aboutShow))
     if self.statusIconMode!=1:
         moreMenu.add(labelStockMenuItem('_Quit', gtk.STOCK_QUIT, self.quit))
     ##
     moreMenu.show_all()
     moreItem = MenuItem(_('More'))
     moreItem.set_submenu(moreMenu)
     #moreItem.show_all()
     menu.add(moreItem)
     ####
     menu.show_all()
     dx, dy = widget.translate_coordinates(self, x, y)
     foo, wx, wy = self.get_window().get_origin()
     x = wx+dx
     y = wy+dy
     if rtl:
         x -= get_menu_width(menu)
     ####
     etime = gtk.get_current_event_time()
     #print('menuCellPopup', x, y, etime)
     self.menuCell = menu ## without this line, the menu was not showing up, WTF?!!
     menu.popup(
         None,
         None,
         lambda *args: (x, y, True),
         None,
         3,
         etime,
     )
     ui.updateFocusTime()
Example #13
0
 def buttonPress(self, obj, gevent):
     print('buttonPress')
     b = gevent.button
     #print('buttonPress', b)
     if b==3:
         self.menuMainCreate()
         self.menuMain.popup(None, None, None, None, 3, gevent.time)
         ui.updateFocusTime()
     elif b==1:
         self.begin_move_drag(gevent.button, int(gevent.x_root), int(gevent.y_root), gevent.time)
     return False
Example #14
0
	def buttonPress(self, obj, gevent):
		print('MainWin.buttonPress')
		b = gevent.button
		#print('buttonPress', b)
		if b==3:
			self.menuMainCreate()
			self.menuMain.popup(None, None, None, None, 3, gevent.time)
			ui.updateFocusTime()
		elif b==1:
			# FIXME: used to cause problems with `ConButton` when using 'pressed' and 'released' signals
			self.begin_move_drag(gevent.button, int(gevent.x_root), int(gevent.y_root), gevent.time)
		return False
Example #15
0
 def menuMainPopup(self, widget, etime, x, y):
     self.menuMainCreate()
     if etime == 0:
         etime = gtk.get_current_event_time()
     menu = self.menuMain
     dx, dy = widget.translate_coordinates(self, x, y)
     foo, wx, wy = self.get_window().get_origin()
     x = wx+dx
     y = wy+dy
     if rtl:
         x -= get_menu_width(menu)
     #print('menuMainPopup', x, y, etime)
     menu.popup(None, None, lambda m, e: (x, y, True), None, 3, etime)
     ui.updateFocusTime()
Example #16
0
 def buttonPress(self, widget, gevent):
     if gevent.button==3:
         self.createMenuLabels()
         foo, x, y = self.get_window().get_origin()
         ## foo == 1 FIXME
         y += self.get_allocation().height
         #if rtl:
         #    x = x - get_menu_width(self.menu) + self.get_allocation().width
         #x -= 7 ## ????????? because of menu padding
         ## align menu to center:
         x -= int((get_menu_width(self.menu) - self.get_allocation().width)//2)
         self.menu.popup(None, None, lambda widget, menu: (x, y, True), None, gevent.button, gevent.time)
         ui.updateFocusTime()
         return True
     else:
         return False
Example #17
0
 def childButtonPress(self, widget, gevent):
     b = gevent.button
     #print(dir(gevent))
     #foo, x, y, mask = gevent.get_window().get_pointer()
     #x, y = self.get_pointer()
     x, y = gevent.x_root, gevent.y_root
     if b == 1:
         self.begin_move_drag(gevent.button, x, y, gevent.time)
         return True
     elif b == 3:
         self.menuMainCreate()
         if rtl:
             x -= get_menu_width(self.menuMain)
         self.menuMain.popup(None, None, lambda m, e: (x, y, True), None, 3, gevent.time)
         ui.updateFocusTime()
         return True
     return False
Example #18
0
	def buttonPress(self, obj, gevent):
		print("MainWin.buttonPress")
		b = gevent.button
		#print("buttonPress", b)
		if b == 3:
			self.menuMainCreate()
			self.menuMain.popup(None, None, None, None, 3, gevent.time)
			ui.updateFocusTime()
		elif b == 1:
			# FIXME: used to cause problems with `ConButton` when using 'pressed' and 'released' signals
			self.begin_move_drag(
				gevent.button,
				int(gevent.x_root),
				int(gevent.y_root),
				gevent.time,
			)
		return False
Example #19
0
	def menuMainPopup(self, widget, etime, x, y):
		self.menuMainCreate()
		if etime == 0:
			etime = gtk.get_current_event_time()
		menu = self.menuMain
		dx, dy = widget.translate_coordinates(self, x, y)
		foo, wx, wy = self.get_window().get_origin()
		x = wx+dx
		y = wy+dy
		if rtl:
			x -= get_menu_width(menu)
		#print('menuMainPopup', x, y, etime)
		menu.popup(
			None,
			None,
			lambda *args: (x, y, True),
			None,
			3,
			etime,
		)
		ui.updateFocusTime()
Example #20
0
	def onPopup(self, widget, menu):
		# instead of creating a new menu, we should remove all the current items from current menu
		for item in menu.get_children():
			menu.remove(item)
		####
		menu.add(labelStockMenuItem(
			"Copy _All",
			gtk.STOCK_COPY,
			self.copyAll,
		))
		####
		itemCopy = labelStockMenuItem(
			"_Copy",
			gtk.STOCK_COPY,
			self.copy,
		)
		if not self.has_selection():
			itemCopy.set_sensitive(False)
		menu.add(itemCopy)
		####
		menu.show_all()
		self.tmpMenu = menu
		ui.updateFocusTime()
Example #21
0
 def onPopup(self, widget, menu):
     # instead of creating a new menu, we should remove all the current items from current menu
     for item in menu.get_children():
         menu.remove(item)
     ####
     menu.add(
         labelStockMenuItem(
             "Copy _All",
             gtk.STOCK_COPY,
             self.copyAll,
         ))
     ####
     itemCopy = labelStockMenuItem(
         "_Copy",
         gtk.STOCK_COPY,
         self.copy,
     )
     if not self.has_selection():
         itemCopy.set_sensitive(False)
     menu.add(itemCopy)
     ####
     menu.show_all()
     self.tmpMenu = menu
     ui.updateFocusTime()
Example #22
0
	def childButtonPress(self, widget, gevent):
		b = gevent.button
		#print(dir(gevent))
		#foo, x, y, mask = gevent.get_window().get_pointer()
		#x, y = self.get_pointer()
		x, y = gevent.x_root, gevent.y_root
		if b == 1:
			self.begin_move_drag(gevent.button, x, y, gevent.time)
			return True
		elif b == 3:
			self.menuMainCreate()
			if rtl:
				x -= get_menu_width(self.menuMain)
			self.menuMain.popup(
				None,
				None,
				lambda *args: (x, y, True),
				None,
				3,
				gevent.time,
			)
			ui.updateFocusTime()
			return True
		return False
Example #23
0
	def menuCellPopup(self, widget, etime, x, y):
		calObjName = widget._name  # why private? FIXME
		# calObjName is in ("weekCal", "monthCal", ...)
		menu = gtk.Menu()
		####
		for calType in calTypes.active:
			menu.add(labelStockMenuItem(
				_("Copy %s Date") % _(calTypes.getDesc(calType)),
				gtk.STOCK_COPY,
				self.copyDateGetCallback(calType),
				calType,
			))
		menu.add(labelStockMenuItem(
			"Day Info",
			gtk.STOCK_INFO,
			self.dayInfoShow,
		))
		menu.add(self.getEventAddToMenuItem())
		self.addEditEventCellMenuItems(menu)
		menu.add(gtk.SeparatorMenuItem())
		menu.add(labelStockMenuItem(
			"Select _Today",
			gtk.STOCK_HOME,
			self.goToday,
		))
		menu.add(labelStockMenuItem(
			"Select _Date...",
			gtk.STOCK_INDEX,
			self.selectDateShow,
		))
		if calObjName in ("weekCal", "monthCal"):
			menu.add(labelStockMenuItem(
				"Switch to " + (
					"Month Calendar" if calObjName == "weekCal"
					else "Week Calendar"
				),
				gtk.STOCK_REDO,
				self.switchWcalMcal,
			))
		if os.path.isfile("/usr/bin/evolution"):  # FIXME
			menu.add(labelImageMenuItem(
				"In E_volution",
				"evolution-18.png",
				ui.dayOpenEvolution,
			))
		#if os.path.isfile("/usr/bin/sunbird"):  # FIXME
		#	menu.add(labelImageMenuItem(
		#	"In _Sunbird",
		#	"sunbird-18.png",
		#	ui.dayOpenSunbird,
		#))
		####
		moreMenu = gtk.Menu()
		moreMenu.add(labelStockMenuItem(
			"_Customize",
			gtk.STOCK_EDIT,
			self.customizeShow,
		))
		moreMenu.add(labelStockMenuItem(
			"_Preferences",
			gtk.STOCK_PREFERENCES,
			self.prefShow,
		))
		moreMenu.add(labelStockMenuItem(
			"_Event Manager",
			gtk.STOCK_ADD,
			self.eventManShow,
		))
		moreMenu.add(labelImageMenuItem(
			"Time Line",
			"timeline-18.png",
			self.timeLineShow,
		))
		moreMenu.add(labelImageMenuItem(
			"Year Wheel",
			"year-wheel-18.png",
			self.yearWheelShow,
		))  # icon? FIXME
		#moreMenu.add(labelImageMenuItem(
		#	"Week Calendar",
		#	"weekcal-18.png",
		#	self.weekCalShow,
		#))
		moreMenu.add(labelStockMenuItem(
			_("Export to %s") % "HTML",
			gtk.STOCK_CONVERT,
			self.exportClicked,
		))
		moreMenu.add(labelStockMenuItem(
			"_About",
			gtk.STOCK_ABOUT,
			self.aboutShow,
		))
		if self.statusIconMode != 1:
			moreMenu.add(labelStockMenuItem(
				"_Quit",
				gtk.STOCK_QUIT,
				self.quit,
			))
		##
		moreMenu.show_all()
		moreItem = MenuItem(_("More"))
		moreItem.set_submenu(moreMenu)
		#moreItem.show_all()
		menu.add(moreItem)
		####
		menu.show_all()
		dx, dy = widget.translate_coordinates(self, x, y)
		foo, wx, wy = self.get_window().get_origin()
		x = wx + dx
		y = wy + dy
		if rtl:
			x -= get_menu_width(menu)
		####
		etime = gtk.get_current_event_time()
		#print("menuCellPopup", x, y, etime)
		self.menuCell = menu
		# without the above line, the menu is not showing up
		# some GC-related pygi bug probably
		menu.popup(
			None,
			None,
			lambda *args: (x, y, True),
			None,
			3,
			etime,
		)
		ui.updateFocusTime()
Example #24
0
 def onEventLabelPopup(self, label, menu, occurData):
     from scal3.ui_gtk.event.utils import menuItemFromEventGroup
     if event_lib.readOnly:
         return
     menu = gtk.Menu()
     label.labelMenuAddCopyItems(menu)
     ####
     groupId, eventId = occurData['ids']
     event = ui.getEvent(groupId, eventId)
     group = ui.eventGroups[groupId]
     if not event.readOnly:
         menu.add(gtk.SeparatorMenuItem())
         ###
         winTitle = _('Edit ') + event.desc
         menu.add(labelStockMenuItem(
             winTitle,
             gtk.STOCK_EDIT,
             self.editEventClicked,
             winTitle,
             event,
             groupId,
         ))
         ###
         moveToItem = labelStockMenuItem(
             _('Move to %s')%'...',
             None,## FIXME
         )
         moveToMenu = gtk.Menu()
         for newGroup in ui.eventGroups:
             if newGroup.id == group.id:
                 continue
             if not newGroup.enable:
                 continue
             if event.name in newGroup.acceptsEventTypes:
                 newGroupItem = menuItemFromEventGroup(newGroup)
                 newGroupItem.connect(
                     'activate',
                     self.moveEventToGroupFromMenu,
                     event,
                     group,
                     newGroup,
                 )
                 moveToMenu.add(newGroupItem)
         moveToItem.set_submenu(moveToMenu)
         menu.add(moveToItem)
         ###
         if not event.isSingleOccur:
             newEventType = 'allDayTask' if occurData['is_allday'] else 'task'
             copyOccurItem = labelStockMenuItem(
                 _('Copy as %s to...') % event_lib.classes.event.byName[newEventType].desc,## FIXME
                 None,
             )
             copyOccurMenu = gtk.Menu()
             for newGroup in ui.eventGroups:
                 if not newGroup.enable:
                     continue
                 if newEventType in newGroup.acceptsEventTypes:
                     newGroupItem = menuItemFromEventGroup(newGroup)
                     newGroupItem.connect(
                         'activate',
                         self.copyOccurToGroupFromMenu,
                         newGroup,
                         newEventType,
                         event,
                         occurData,
                     )
                     copyOccurMenu.add(newGroupItem)
             copyOccurItem.set_submenu(copyOccurMenu)
             menu.add(copyOccurItem)
             ###
             menu.add(gtk.SeparatorMenuItem())
         ###
         menu.add(labelImageMenuItem(
             _('Move to %s') % ui.eventTrash.title,
             ui.eventTrash.icon,
             self.moveEventToTrash,
             event,
             groupId,
         ))
     ####
     menu.show_all()
     label.tmpMenu = menu
     menu.popup(None, None, None, None, 3, 0)
     ui.updateFocusTime()
Example #25
0
	def begin_resize_drag(self, *args):
		if self.isMaximized:
			self.isMaximized = False

		ui.updateFocusTime()
		return gtk.Window.begin_resize_drag(self, *args)
Example #26
0
	def menuCellPopup(self, widget, etime, x, y):
		calObjName = widget._name  # why private? FIXME
		# calObjName is in ("weekCal", "monthCal", ...)
		menu = gtk.Menu()
		####
		for calType in calTypes.active:
			menu.add(labelStockMenuItem(
				_("Copy %s Date") % _(calTypes.getDesc(calType)),
				gtk.STOCK_COPY,
				self.copyDateGetCallback(calType),
				calType,
			))
		menu.add(labelStockMenuItem(
			"Day Info",
			gtk.STOCK_INFO,
			self.dayInfoShow,
		))
		menu.add(self.getEventAddToMenuItem())
		self.addEditEventCellMenuItems(menu)
		menu.add(gtk.SeparatorMenuItem())
		menu.add(labelStockMenuItem(
			"Select _Today",
			gtk.STOCK_HOME,
			self.goToday,
		))
		menu.add(labelStockMenuItem(
			"Select _Date...",
			gtk.STOCK_INDEX,
			self.selectDateShow,
		))
		if calObjName in ("weekCal", "monthCal"):
			menu.add(labelStockMenuItem(
				"Switch to " + (
					"Month Calendar" if calObjName == "weekCal"
					else "Week Calendar"
				),
				gtk.STOCK_REDO,
				self.switchWcalMcal,
			))
		if os.path.isfile("/usr/bin/evolution"):  # FIXME
			menu.add(labelImageMenuItem(
				"In E_volution",
				"evolution-18.png",
				ui.dayOpenEvolution,
			))
		#if os.path.isfile("/usr/bin/sunbird"):  # FIXME
		#	menu.add(labelImageMenuItem(
		#	"In _Sunbird",
		#	"sunbird-18.png",
		#	ui.dayOpenSunbird,
		#))
		####
		moreMenu = gtk.Menu()
		moreMenu.add(labelStockMenuItem(
			"_Customize",
			gtk.STOCK_EDIT,
			self.customizeShow,
		))
		moreMenu.add(labelStockMenuItem(
			"_Preferences",
			gtk.STOCK_PREFERENCES,
			self.prefShow,
		))
		moreMenu.add(labelStockMenuItem(
			"_Event Manager",
			gtk.STOCK_ADD,
			self.eventManShow,
		))
		moreMenu.add(labelImageMenuItem(
			"Time Line",
			"timeline-18.png",
			self.timeLineShow,
		))
		moreMenu.add(labelImageMenuItem(
			"Year Wheel",
			"year-wheel-18.png",
			self.yearWheelShow,
		))  # icon? FIXME
		#moreMenu.add(labelImageMenuItem(
		#	"Week Calendar",
		#	"weekcal-18.png",
		#	self.weekCalShow,
		#))
		moreMenu.add(labelStockMenuItem(
			_("Export to %s") % "HTML",
			gtk.STOCK_CONVERT,
			self.exportClicked,
		))
		moreMenu.add(labelStockMenuItem(
			"_About",
			gtk.STOCK_ABOUT,
			self.aboutShow,
		))
		if self.statusIconMode != 1:
			moreMenu.add(labelStockMenuItem(
				"_Quit",
				gtk.STOCK_QUIT,
				self.quit,
			))
		##
		moreMenu.show_all()
		moreItem = MenuItem(_("More"))
		moreItem.set_submenu(moreMenu)
		#moreItem.show_all()
		menu.add(moreItem)
		####
		menu.show_all()
		dx, dy = widget.translate_coordinates(self, x, y)
		foo, wx, wy = self.get_window().get_origin()
		x = wx + dx
		y = wy + dy
		if rtl:
			x -= get_menu_width(menu)
		####
		etime = gtk.get_current_event_time()
		#print("menuCellPopup", x, y, etime)
		self.menuCell = menu
		# without the above line, the menu is not showing up
		# some GC-related pygi bug probably
		menu.popup(
			None,
			None,
			lambda *args: (x, y, True),
			None,
			3,
			etime,
		)
		ui.updateFocusTime()
Example #27
0
	def onEventLabelPopup(self, label, menu, occurData):
		from scal3.ui_gtk.event.utils import menuItemFromEventGroup
		if event_lib.allReadOnly:
			return
		# instead of creating a new menu, we should remove the current items from current menu
		# but here we will keep the items from ReadOnlyLabel
		####
		groupId, eventId = occurData["ids"]
		event = ui.getEvent(groupId, eventId)
		group = ui.eventGroups[groupId]
		if not event.readOnly:
			menu.add(gtk.SeparatorMenuItem())
			###
			winTitle = _("Edit ") + event.desc
			menu.add(labelStockMenuItem(
				winTitle,
				gtk.STOCK_EDIT,
				self.editEventClicked,
				winTitle,
				event,
				groupId,
			))
			###
			moveToItem = labelStockMenuItem(
				_("Move to %s") % "...",
				None,  # FIXME
			)
			moveToMenu = gtk.Menu()
			disabledGroupsMenu = gtk.Menu()
			for newGroup in ui.eventGroups:
				if newGroup.id == group.id:
					continue
				if event.name not in newGroup.acceptsEventTypes:
					continue
				newGroupItem = menuItemFromEventGroup(newGroup)
				newGroupItem.connect(
					"activate",
					self.moveEventToGroupFromMenu,
					event,
					group,
					newGroup,
				)
				if newGroup.enable:
					moveToMenu.add(newGroupItem)
				else:
					disabledGroupsMenu.add(newGroupItem)

			###
			disabledGroupsItem = gtk.MenuItem()
			disabledGroupsItem.set_label(_("Disabled"))
			disabledGroupsItem.set_submenu(disabledGroupsMenu)
			moveToMenu.add(disabledGroupsItem)
			###
			moveToItem.set_submenu(moveToMenu)
			menu.add(moveToItem)
			###
			if not event.isSingleOccur:
				newEventType = "allDayTask" if occurData["is_allday"] else "task"
				copyOccurItem = labelStockMenuItem(
					_(  # FIXME
						"Copy as %s to..."
					) % event_lib.classes.event.byName[newEventType].desc,
					None,
				)
				copyOccurMenu = gtk.Menu()
				for newGroup in ui.eventGroups:
					if not newGroup.enable:
						continue
					if newEventType in newGroup.acceptsEventTypes:
						newGroupItem = menuItemFromEventGroup(newGroup)
						newGroupItem.connect(
							"activate",
							self.copyOccurToGroupFromMenu,
							newGroup,
							newEventType,
							event,
							occurData,
						)
						copyOccurMenu.add(newGroupItem)
				copyOccurItem.set_submenu(copyOccurMenu)
				menu.add(copyOccurItem)
				###
				menu.add(gtk.SeparatorMenuItem())
			###
			menu.add(labelImageMenuItem(
				_("Move to %s") % ui.eventTrash.title,
				ui.eventTrash.icon,
				self.moveEventToTrash,
				event,
				groupId,
			))
		####
		menu.show_all()
		label.tmpMenu = menu
		ui.updateFocusTime()
Example #28
0
 def onEventLabelPopup(self, label, menu, occurData):
     from scal3.ui_gtk.event.utils import menuItemFromEventGroup
     if event_lib.readOnly:
         return
     # instead of creating a new menu, we should remove the current items from current menu
     # but here we will keep the items from ReadOnlyLabel
     ####
     groupId, eventId = occurData['ids']
     event = ui.getEvent(groupId, eventId)
     group = ui.eventGroups[groupId]
     if not event.readOnly:
         menu.add(gtk.SeparatorMenuItem())
         ###
         winTitle = _('Edit ') + event.desc
         menu.add(
             labelStockMenuItem(
                 winTitle,
                 gtk.STOCK_EDIT,
                 self.editEventClicked,
                 winTitle,
                 event,
                 groupId,
             ))
         ###
         moveToItem = labelStockMenuItem(
             _('Move to %s') % '...',
             None,  ## FIXME
         )
         moveToMenu = gtk.Menu()
         for newGroup in ui.eventGroups:
             if newGroup.id == group.id:
                 continue
             if not newGroup.enable:
                 continue
             if event.name in newGroup.acceptsEventTypes:
                 newGroupItem = menuItemFromEventGroup(newGroup)
                 newGroupItem.connect(
                     'activate',
                     self.moveEventToGroupFromMenu,
                     event,
                     group,
                     newGroup,
                 )
                 moveToMenu.add(newGroupItem)
         moveToItem.set_submenu(moveToMenu)
         menu.add(moveToItem)
         ###
         if not event.isSingleOccur:
             newEventType = 'allDayTask' if occurData[
                 'is_allday'] else 'task'
             copyOccurItem = labelStockMenuItem(
                 _('Copy as %s to...') % event_lib.classes.event.
                 byName[newEventType].desc,  ## FIXME
                 None,
             )
             copyOccurMenu = gtk.Menu()
             for newGroup in ui.eventGroups:
                 if not newGroup.enable:
                     continue
                 if newEventType in newGroup.acceptsEventTypes:
                     newGroupItem = menuItemFromEventGroup(newGroup)
                     newGroupItem.connect(
                         'activate',
                         self.copyOccurToGroupFromMenu,
                         newGroup,
                         newEventType,
                         event,
                         occurData,
                     )
                     copyOccurMenu.add(newGroupItem)
             copyOccurItem.set_submenu(copyOccurMenu)
             menu.add(copyOccurItem)
             ###
             menu.add(gtk.SeparatorMenuItem())
         ###
         menu.add(
             labelImageMenuItem(
                 _('Move to %s') % ui.eventTrash.title,
                 ui.eventTrash.icon,
                 self.moveEventToTrash,
                 event,
                 groupId,
             ))
     ####
     menu.show_all()
     label.tmpMenu = menu
     ui.updateFocusTime()
Example #29
0
 def popupPopulate(self, label, menu):
     self.itemCopy.set_sensitive(self.get_property('cursor-position') > self.get_property('selection-bound'))## FIXME
     self.menu.popup(None, None, None, None, 3, 0)
     ui.updateFocusTime()