Example #1
0
 def onLabelPopup(self, label, menu):
     menu = gtk.Menu()
     self.labelMenuAddCopyItems(label, menu)
     ####
     menu.show_all()
     menu.popup(None, None, None, 3, 0)
     ui.updateFocusTime()
Example #2
0
 def onLabelPopup(self, label, menu):
     menu = gtk.Menu()
     self.labelMenuAddCopyItems(label, menu)
     ####
     menu.show_all()
     menu.popup(None, None, None, 3, 0)
     ui.updateFocusTime()
Example #3
0
 def onEventLabelPopup(self, label, menu, ids):
     menu = gtk.Menu()
     self.labelMenuAddCopyItems(label, menu)
     ####
     groupId, eventId = ids
     event = ui.getEvent(groupId, eventId)
     if not event.readOnly:
         menu.add(gtk.SeparatorMenuItem())
         ###
         winTitle = _('Edit ') + event.desc
         menu.add(labelStockMenuItem(
             winTitle,
             gtk.STOCK_EDIT,
             self.editEventClicked,
             winTitle,
             event,
             groupId,
         ))
         ###
         menu.add(gtk.SeparatorMenuItem())
         ###
         menu.add(labelImageMenuItem(
             _('Move to %s') % ui.eventTrash.title,
             ui.eventTrash.icon,
             self.moveEventToTrash,
             event,
             groupId,
         ))
     ####
     menu.show_all()
     menu.popup(None, None, None, 3, 0)
     ui.updateFocusTime()
Example #4
0
 def onEventLabelPopup(self, label, menu, ids):
     menu = gtk.Menu()
     self.labelMenuAddCopyItems(label, menu)
     ####
     groupId, eventId = 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 new_group in ui.eventGroups:
             if new_group.id == group.id:
                 continue
             if not new_group.enable:
                 continue
             if event.name in new_group.acceptsEventTypes:
                 new_groupItem = gtk.ImageMenuItem()
                 new_groupItem.set_label(new_group.title)
                 ##
                 image = gtk.Image()
                 image.set_from_pixbuf(newOutlineSquarePixbuf(new_group.color, 20))
                 new_groupItem.set_image(image)
                 ##
                 new_groupItem.connect('activate', self.moveEventToGroupFromMenu, event, group, new_group)
                 ##
                 moveToMenu.add(new_groupItem)
         moveToItem.set_submenu(moveToMenu)
         menu.add(moveToItem)
         ###
         menu.add(gtk.SeparatorMenuItem())
         ###
         menu.add(labelImageMenuItem(
             _('Move to %s') % ui.eventTrash.title,
             ui.eventTrash.icon,
             self.moveEventToTrash,
             event,
             groupId,
         ))
     ####
     menu.show_all()
     menu.popup(None, None, None, 3, 0)
     ui.updateFocusTime()
Example #5
0
 def buttonPress(self, obj, gevent):
     b = gevent.button
     #print('buttonPress', b)
     if b==3:
         self.menuMainCreate()
         self.menuMain.popup(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 #6
0
 def buttonPress(self, obj, event):
     b = event.button
     #print 'buttonPress', b
     if b==3:
         self.menuMain.popup(None, None, None, 3, event.time)
         ui.updateFocusTime()
     elif b==1:
         x, y, mask = ud.rootWindow.get_pointer()
         self.begin_move_drag(event.button, x, y, event.time)
     return False
 def buttonPress(self, widget, event):
     if event.button==3:
         self.updateMenu()
         x, y = self.window.get_origin()
         y += self.allocation.height
         x -= 7 ## ????????? because of menu padding
         self.menu.popup(None, None, lambda widget: (x, y, True), event.button, event.time)
         ui.updateFocusTime()
         return True
     else:
         return False
Example #8
0
 def buttonPress(self, obj, gevent):
     b = gevent.button
     #print('buttonPress', b)
     if b == 3:
         self.menuMainCreate()
         self.menuMain.popup(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 #9
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)
     wx, wy = self.get_window().get_origin()
     x = wx+dx
     y = wy+dy
     if rtl:
         x -= get_menu_width(menu)
     menu.popup(None, None, lambda m: (x, y, True), 3, etime)
     ui.updateFocusTime()
Example #10
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)
     wx, wy = self.get_window().get_origin()
     x = wx + dx
     y = wy + dy
     if rtl:
         x -= get_menu_width(menu)
     menu.popup(None, None, lambda m: (x, y, True), 3, etime)
     ui.updateFocusTime()
Example #11
0
	def buttonPress(self, widget, gevent):
		if gevent.button==3:
			self.updateMenu()
			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 widget: (x, y, True), gevent.button, gevent.time)
			ui.updateFocusTime()
			return True
		else:
			return False
Example #12
0
 def buttonPress(self, widget, gevent):
     if gevent.button==3:
         self.updateMenu()
         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 widget: (x, y, True), gevent.button, gevent.time)
         ui.updateFocusTime()
         return True
     else:
         return False
Example #13
0
 def popupMenuMain(self, widget, etime, x, y):
     menu = self.menuMain
     dx, dy = widget.translate_coordinates(self, x, y)
     wx, wy = self.window.get_origin()
     x = wx+dx
     y = wy+dy
     if rtl:
         mw = menu.allocation.width
         if mw < 2:# menu width
             mw = 145
         x -= mw
     menu.popup(None, None, lambda m: (x, y, True), 3, etime)
     #self.menuMainWidth = menu.allocation.width
     ui.updateFocusTime()
Example #14
0
 def popupMenuCell(self, widget, etime, x, y):
     #print('popupMenuCell', widget._name)
     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 isfile('/usr/bin/evolution'):##??????????????????
         menu.add(labelImageMenuItem('In E_volution', 'evolution-18.png', ui.dayOpenEvolution))
     #if 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.trayMode!=1:
         moreMenu.add(labelStockMenuItem('_Quit', gtk.STOCK_QUIT, self.quit))
     ##
     moreMenu.show_all()
     moreItem = gtk.MenuItem(_('More'))
     moreItem.set_submenu(moreMenu)
     menu.add(moreItem)
     ####
     menu.show_all()
     dx, dy = widget.translate_coordinates(self, x, y)
     wx, wy = self.get_window().get_origin()
     x = wx+dx
     y = wy+dy
     if rtl:
         #mw = menu.get_allocation().width
         #if mw < 2:# menu width
         mw = 145 ## FIXME
         x -= mw
     ####
     menu.popup(None, None, lambda m: (x, y, True), 3, etime)
     ui.updateFocusTime()
Example #15
0
 def buttonPress(self, widget, event):
     if event.button==3:
         x, y = self.window.get_origin()
         y += self.allocation.height
         if rtl:
             mw = self.menu.allocation.width
             #print 'menu.allocation.width', mw
             if mw>1:
                 x -= (mw - self.allocation.width)
         #x -= 7 ## ????????? because of menu padding
         self.menu.popup(None, None, lambda widget: (x, y, True), event.button, event.time)
         ui.updateFocusTime()
         return True
     else:
         return False
Example #16
0
 def trayPopup(self, sicon, button, etime):
     menu = gtk.Menu()
     if os.sep == '\\':
         setupMenuHideOnLeave(menu)
     items = self.getTrayPopupItems()
     # 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:
         y1 = geo[1][1]
         y = gtk.status_icon_position_menu(menu, self.sicon)[1]
         if y<y1:## taskbar is on bottom
             items.reverse()
         get_pos_func = gtk.status_icon_position_menu
     for item in items:
         menu.add(item)
     menu.show_all()
     menu.popup(None, None, get_pos_func, button, etime, self.sicon)
     ui.updateFocusTime()
Example #17
0
 def statusIconPopup(self, sicon, button, etime):
     menu = gtk.Menu()
     if os.sep == '\\':
         from scal2.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:
         y1 = geo[1][1]
         y = gtk.status_icon_position_menu(menu, self.sicon)[1]
         if y < y1:  ## taskbar is on bottom
             items.reverse()
         get_pos_func = gtk.status_icon_position_menu
     for item in items:
         menu.add(item)
     menu.show_all()
     menu.popup(None, None, get_pos_func, button, etime, self.sicon)
     ui.updateFocusTime()
Example #18
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, 3, 0)
     ui.updateFocusTime()
Example #19
0
 def onEventLabelPopup(self, label, menu, occurData):
     from scal2.ui_gtk.event.utils import menuItemFromEventGroup
     menu = gtk.Menu()
     self.labelMenuAddCopyItems(label, 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()
     menu.popup(None, None, None, 3, 0)
     ui.updateFocusTime()
Example #20
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, 3, 0)
     ui.updateFocusTime()
Example #21
0
 def onEventLabelPopup(self, label, menu, occurData):
     from scal2.ui_gtk.event.utils import menuItemFromEventGroup
     menu = gtk.Menu()
     self.labelMenuAddCopyItems(label, 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()
     menu.popup(None, None, None, 3, 0)
     ui.updateFocusTime()
Example #22
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 = gtk.MenuItem(_('More'))
     moreItem.set_submenu(moreMenu)
     menu.add(moreItem)
     ####
     menu.show_all()
     dx, dy = widget.translate_coordinates(self, x, y)
     wx, wy = self.get_window().get_origin()
     x = wx + dx
     y = wy + dy
     if rtl:
         x -= get_menu_width(menu)
     ####
     menu.popup(None, None, lambda m: (x, y, True), 3, etime)
     ui.updateFocusTime()