def genRightClickMenu(self, path): gid = self.trees[path][0] eid = self.trees[path][1] group = ui.eventGroups[gid] event = group[eid] ## menu = gtk.Menu() ## menu.add(labelStockMenuItem( "Edit", gtk.STOCK_EDIT, self.editEventFromMenu, path, )) ## menu.add(self.getMoveToGroupSubMenu(path, group, event)) menu.add(gtk.SeparatorMenuItem()) menu.add(self.getCopyToGroupSubMenu(path, event)) ## menu.add(gtk.SeparatorMenuItem()) menu.add(labelImageMenuItem( _("Move to %s") % ui.eventTrash.title, ui.eventTrash.icon, self.moveEventToTrashFromMenu, path, )) ## menu.show_all() return menu
def genRightClickMenu(self, path): gid = self.trees[path][0] eid = self.trees[path][1] group = ui.eventGroups[gid] event = group[eid] ## menu = gtk.Menu() ## menu.add( labelStockMenuItem( "Edit", gtk.STOCK_EDIT, self.editEventFromMenu, path, )) ## menu.add(self.getMoveToGroupSubMenu(path, group, event)) menu.add(gtk.SeparatorMenuItem()) menu.add(self.getCopyToGroupSubMenu(path, event)) ## menu.add(gtk.SeparatorMenuItem()) menu.add( labelImageMenuItem( _("Move to %s") % ui.eventTrash.title, ui.eventTrash.icon, self.moveEventToTrashFromMenu, path, )) ## menu.show_all() return menu
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()
def buttonPress(self, obj, gevent): x = gevent.x y = gevent.y w = self.get_allocation().width h = self.get_allocation().height if gevent.button==1: for button in self.buttons: if button.contains(x, y, w, h): button.func(gevent) return True #### for box in self.data['boxes']: if not box.hasBorder: continue if not box.ids: continue if not box.contains(x, y): continue gid, eid = box.ids group = ui.eventGroups[gid] event = group[eid] #### top = y - box.y left = x - box.x right = box.x + box.w - x minA = min(boxMoveBorder, top, left, right) editType = None if top == minA: editType = 0 t0 = event.getStartEpoch() self.get_window().set_cursor(gdk.Cursor.new(gdk.CursorType.FLEUR)) elif right == minA: editType = 1 t0 = event.getEndEpoch() self.get_window().set_cursor(gdk.Cursor.new(gdk.CursorType.RIGHT_SIDE)) elif left == minA: editType = -1 t0 = event.getStartEpoch() self.get_window().set_cursor(gdk.Cursor.new(gdk.CursorType.LEFT_SIDE)) if editType is not None: self.boxEditing = (editType, event, box, x, t0) return True elif gevent.button==3: for box in self.data['boxes']: if not box.ids: continue if not box.contains(x, y): continue gid, eid = box.ids group = ui.eventGroups[gid] event = group[eid] #### menu = gtk.Menu() ## if not event.readOnly: winTitle = _('Edit') + ' ' + event.desc menu.add(labelStockMenuItem( winTitle, gtk.STOCK_EDIT, self.editEventClicked, winTitle, event, gid, )) ## winTitle = _('Edit') + ' ' + group.desc menu.add(labelStockMenuItem( winTitle, gtk.STOCK_EDIT, self.editGroupClicked, winTitle, group, )) ## menu.add(gtk.SeparatorMenuItem()) ## menu.add(labelImageMenuItem( _('Move to %s')%ui.eventTrash.title, ui.eventTrash.icon, self.moveEventToTrash, group, event, )) ## menu.show_all() self.tmpMenu = menu menu.popup(None, None, None, None, 3, gevent.time) return False
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()
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()
def genRightClickMenu(self, path): ## how about multi-selection? FIXME ## and Select _All menu item obj_list = self.getObjsByPath(path) #print(len(obj_list)) menu = gtk.Menu() if len(obj_list) == 1: group = obj_list[0] if group.name == "trash": #print("right click on trash", group.title) menu.add(eventWriteMenuItem( "Edit", gtk.STOCK_EDIT, self.editTrash, )) menu.add(eventWriteMenuItem( "Empty Trash",## or use group.title FIXME gtk.STOCK_CLEAR, self.emptyTrash, )) #menu.add(gtk.SeparatorMenuItem()) #menu.add(eventWriteMenuItem( # "Add New Group", # gtk.STOCK_NEW, # self.addGroupBeforeSelection, #))## FIXME else: #print("right click on group", group.title) menu.add(eventWriteMenuItem( "Edit", gtk.STOCK_EDIT, self.editGroupFromMenu, path, )) eventTypes = group.acceptsEventTypes if eventTypes is None: eventTypes = event_lib.classes.event.names if len(eventTypes) > 3: menu.add(eventWriteMenuItem( _("Add Event"), gtk.STOCK_ADD, self.addGenericEventToGroupFromMenu, path, group, )) else: for eventType in eventTypes: #if eventType == "custom":## FIXME # desc = _("Add ") + _("Event") #else: label = _("Add ") + event_lib.classes.event.byName[eventType].desc menu.add(eventWriteMenuItem( label, gtk.STOCK_ADD, self.addEventToGroupFromMenu, path, group, eventType, label, )) pasteItem = eventWriteMenuItem( "Paste Event", gtk.STOCK_PASTE, self.pasteEventFromMenu, path, ) menu.add(pasteItem) pasteItem.set_sensitive(self.canPasteToGroup(group)) ## if group.remoteIds: aid, remoteGid = group.remoteIds try: account = ui.eventAccounts[aid] except KeyError: myRaise() else: if account.enable: menu.add(gtk.SeparatorMenuItem()) menu.add(eventWriteMenuItem( "Synchronize", gtk.STOCK_CONNECT,## or gtk.STOCK_REFRESH FIXME self.syncGroupFromMenu, path, account, )) #else:## FIXME ## menu.add(gtk.SeparatorMenuItem()) #menu.add(eventWriteMenuItem( # "Add New Group", # gtk.STOCK_NEW, # self.addGroupBeforeGroup, # path, #))## FIXME menu.add(eventWriteMenuItem( "Duplicate", gtk.STOCK_COPY, self.duplicateGroupFromMenu, path, )) ### dupAllItem = labelStockMenuItem( "Duplicate with All Events", gtk.STOCK_COPY, self.duplicateGroupWithEventsFromMenu, path, ) menu.add(dupAllItem) dupAllItem.set_sensitive( not group.isReadOnly() and bool(group.idList) ) ### menu.add(gtk.SeparatorMenuItem()) menu.add(eventWriteMenuItem( "Delete Group", gtk.STOCK_DELETE, self.deleteGroupFromMenu, path, )) menu.add(gtk.SeparatorMenuItem()) ## #menu.add(eventWriteMenuItem( # "Move Up", # gtk.STOCK_GO_UP, # self.moveUpFromMenu, # path, #)) #menu.add(eventWriteMenuItem( # "Move Down", # gtk.STOCK_GO_DOWN, # self.moveDownFromMenu, # path, #)) ## menu.add(labelStockMenuItem( _("Export"), gtk.STOCK_CONVERT, self.groupExportFromMenu, group, )) ### sortItem = labelStockMenuItem( _("Sort Events"), gtk.STOCK_SORT_ASCENDING, self.groupSortFromMenu, path, ) menu.add(sortItem) sortItem.set_sensitive( not group.isReadOnly() and bool(group.idList) ) ### convertItem = labelStockMenuItem( _("Convert Calendar Type"), gtk.STOCK_CONVERT, self.groupConvertModeFromMenu, group, ) menu.add(convertItem) convertItem.set_sensitive( not group.isReadOnly() and bool(group.idList) ) ### for newGroupType in group.canConvertTo: menu.add(eventWriteMenuItem( _( "Convert to %s" ) % event_lib.classes.group.byName[newGroupType].desc, None, self.groupConvertTo, group, newGroupType, )) ### bulkItem = labelStockMenuItem( _("Bulk Edit Events"), gtk.STOCK_EDIT, self.groupBulkEditFromMenu, group, path, ) menu.add(bulkItem) bulkItem.set_sensitive( not group.isReadOnly() and bool(group.idList) ) ### for actionName, actionFuncName in group.actions: menu.add(eventWriteMenuItem( _(actionName), None, self.groupActionClicked, group, actionFuncName, )) elif len(obj_list) == 2: group, event = obj_list #print("right click on event", event.summary) if group.name != "trash": menu.add(eventWriteMenuItem( "Edit", gtk.STOCK_EDIT, self.editEventFromMenu, path, )) #### menu.add(eventWriteImageMenuItem( "History", "history-24.png", self.historyOfEventFromMenu, path, )) #### moveToItem = eventWriteMenuItem( _("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:## FIXME # continue new_groupPath = self.trees.get_path(self.groupIterById[new_group.id]) if event.name in new_group.acceptsEventTypes: new_groupItem = ImageMenuItem() new_groupItem.set_label(new_group.title) ## image = gtk.Image() image.set_from_pixbuf(newColorCheckPixbuf(new_group.color, 20, True)) new_groupItem.set_image(image) ## new_groupItem.connect( "activate", self.moveEventToPathFromMenu, path, new_groupPath, ) ## moveToMenu.add(new_groupItem) moveToItem.set_submenu(moveToMenu) menu.add(moveToItem) #### menu.add(gtk.SeparatorMenuItem()) #### menu.add(eventWriteMenuItem( "Cut", gtk.STOCK_CUT, self.cutEvent, path, )) menu.add(eventWriteMenuItem( "Copy", gtk.STOCK_COPY, self.copyEvent, path, )) ## if group.name == "trash": menu.add(gtk.SeparatorMenuItem()) menu.add(eventWriteMenuItem( "Delete", gtk.STOCK_DELETE, self.deleteEventFromTrash, path, )) else: pasteItem = eventWriteMenuItem( "Paste", gtk.STOCK_PASTE, self.pasteEventFromMenu, path, ) menu.add(pasteItem) pasteItem.set_sensitive(self.canPasteToGroup(group)) ## menu.add(gtk.SeparatorMenuItem()) menu.add(labelImageMenuItem( _("Move to %s") % ui.eventTrash.title, ui.eventTrash.icon, self.moveEventToTrashFromMenu, path, )) else: return menu.show_all() return menu
def buttonPress(self, obj, gevent): x = gevent.x y = gevent.y w = self.get_allocation().width h = self.get_allocation().height if gevent.button == 1: for button in self.buttons: if button.contains(x, y, w, h): button.func(gevent) return True #### for box in self.data['boxes']: if not box.hasBorder: continue if not box.ids: continue if not box.contains(x, y): continue gid, eid = box.ids group = ui.eventGroups[gid] event = group[eid] #### top = y - box.y left = x - box.x right = box.x + box.w - x minA = min(boxMoveBorder, top, left, right) editType = None if top == minA: editType = 0 t0 = event.getStartEpoch() self.get_window().set_cursor( gdk.Cursor.new(gdk.CursorType.FLEUR)) elif right == minA: editType = 1 t0 = event.getEndEpoch() self.get_window().set_cursor( gdk.Cursor.new(gdk.CursorType.RIGHT_SIDE)) elif left == minA: editType = -1 t0 = event.getStartEpoch() self.get_window().set_cursor( gdk.Cursor.new(gdk.CursorType.LEFT_SIDE)) if editType is not None: self.boxEditing = (editType, event, box, x, t0) return True elif gevent.button == 3: for box in self.data['boxes']: if not box.ids: continue if not box.contains(x, y): continue gid, eid = box.ids group = ui.eventGroups[gid] event = group[eid] #### menu = gtk.Menu() ## if not event.readOnly: winTitle = _('Edit') + ' ' + event.desc menu.add( labelStockMenuItem( winTitle, gtk.STOCK_EDIT, self.editEventClicked, winTitle, event, gid, )) ## winTitle = _('Edit') + ' ' + group.desc menu.add( labelStockMenuItem( winTitle, gtk.STOCK_EDIT, self.editGroupClicked, winTitle, group, )) ## menu.add(gtk.SeparatorMenuItem()) ## menu.add( labelImageMenuItem( _('Move to %s') % ui.eventTrash.title, ui.eventTrash.icon, self.moveEventToTrash, group, event, )) ## menu.show_all() self.tmpMenu = menu menu.popup(None, None, None, None, 3, gevent.time) return False
def genRightClickMenu(self, path): ## how about multi-selection? FIXME ## and Select _All menu item obj_list = self.getObjsByPath(path) #print(len(obj_list)) menu = gtk.Menu() if len(obj_list)==1: group = obj_list[0] if group.name == 'trash': #print('right click on trash', group.title) menu.add(eventWriteMenuItem( 'Edit', gtk.STOCK_EDIT, self.editTrash, )) menu.add(eventWriteMenuItem( 'Empty Trash', gtk.STOCK_CLEAR, self.emptyTrash, )) #menu.add(gtk.SeparatorMenuItem()) #menu.add(eventWriteMenuItem( # 'Add New Group', # gtk.STOCK_NEW, # self.addGroupBeforeSelection, #))## FIXME else: #print('right click on group', group.title) menu.add(eventWriteMenuItem( 'Edit', gtk.STOCK_EDIT, self.editGroupFromMenu, path, )) eventTypes = group.acceptsEventTypes if eventTypes is None: eventTypes = event_lib.classes.event.names if len(eventTypes) > 3: menu.add(eventWriteMenuItem( _('Add Event'), gtk.STOCK_ADD, self.addGenericEventToGroupFromMenu, path, group, )) else: for eventType in eventTypes: #if eventType == 'custom':## FIXME # desc = _('Add ') + _('Event') #else: label = _('Add ') + event_lib.classes.event.byName[eventType].desc menu.add(eventWriteMenuItem( label, gtk.STOCK_ADD, self.addEventToGroupFromMenu, path, group, eventType, label, )) pasteItem = eventWriteMenuItem( 'Paste Event', gtk.STOCK_PASTE, self.pasteEventFromMenu, path, ) menu.add(pasteItem) pasteItem.set_sensitive(self.canPasteToGroup(group)) ## if group.remoteIds: aid, remoteGid = group.remoteIds try: account = ui.eventAccounts[aid] except KeyError: myRaise() else: if account.enable: menu.add(gtk.SeparatorMenuItem()) menu.add(eventWriteMenuItem( 'Synchronize', gtk.STOCK_CONNECT,## or gtk.STOCK_REFRESH FIXME self.syncGroupFromMenu, path, account, )) #else:## FIXME ## menu.add(gtk.SeparatorMenuItem()) #menu.add(eventWriteMenuItem( # 'Add New Group', # gtk.STOCK_NEW, # self.addGroupBeforeGroup, # path, #))## FIXME menu.add(eventWriteMenuItem( 'Duplicate', gtk.STOCK_COPY, self.duplicateGroupFromMenu, path, )) ### dupAllItem = labelStockMenuItem( 'Duplicate with All Events', gtk.STOCK_COPY, self.duplicateGroupWithEventsFromMenu, path, ) menu.add(dupAllItem) dupAllItem.set_sensitive(not event_lib.readOnly and bool(group.idList)) ### menu.add(gtk.SeparatorMenuItem()) menu.add(eventWriteMenuItem( 'Delete Group', gtk.STOCK_DELETE, self.deleteGroupFromMenu, path, )) menu.add(gtk.SeparatorMenuItem()) ## #menu.add(eventWriteMenuItem( # 'Move Up', # gtk.STOCK_GO_UP, # self.moveUpFromMenu, # path, #)) #menu.add(eventWriteMenuItem( # 'Move Down', # gtk.STOCK_GO_DOWN, # self.moveDownFromMenu, # path, #)) ## menu.add(labelStockMenuItem( _('Export'), gtk.STOCK_CONVERT, self.groupExportFromMenu, group, )) ### sortItem = labelStockMenuItem( _('Sort Events'), gtk.STOCK_SORT_ASCENDING, self.groupSortFromMenu, path, ) menu.add(sortItem) sortItem.set_sensitive(not event_lib.readOnly and bool(group.idList)) ### convertItem = labelStockMenuItem( _('Convert Calendar Type'), gtk.STOCK_CONVERT, self.groupConvertModeFromMenu, group, ) menu.add(convertItem) convertItem.set_sensitive(not event_lib.readOnly and bool(group.idList)) ### for newGroupType in group.canConvertTo: menu.add(eventWriteMenuItem( _('Convert to %s')%event_lib.classes.group.byName[newGroupType].desc, None, self.groupConvertTo, group, newGroupType, )) ### bulkItem = labelStockMenuItem( _('Bulk Edit Events'), gtk.STOCK_EDIT, self.groupBulkEditFromMenu, group, path, ) menu.add(bulkItem) bulkItem.set_sensitive(not event_lib.readOnly and bool(group.idList)) ### for actionName, actionFuncName in group.actions: menu.add(eventWriteMenuItem( _(actionName), None, self.groupActionClicked, group, actionFuncName, )) elif len(obj_list) == 2: group, event = obj_list #print('right click on event', event.summary) if group.name != 'trash': menu.add(eventWriteMenuItem( 'Edit', gtk.STOCK_EDIT, self.editEventFromMenu, path, )) #### moveToItem = eventWriteMenuItem( _('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:## FIXME # continue new_groupPath = self.trees.get_path(self.groupIterById[new_group.id]) if event.name in new_group.acceptsEventTypes: new_groupItem = ImageMenuItem() new_groupItem.set_label(new_group.title) ## image = gtk.Image() image.set_from_pixbuf(newColorCheckPixbuf(new_group.color, 20, True)) new_groupItem.set_image(image) ## new_groupItem.connect( 'activate', self.moveEventToPathFromMenu, path, new_groupPath, ) ## moveToMenu.add(new_groupItem) moveToItem.set_submenu(moveToMenu) menu.add(moveToItem) #### menu.add(gtk.SeparatorMenuItem()) #### menu.add(eventWriteMenuItem( 'Cut', gtk.STOCK_CUT, self.cutEvent, path, )) menu.add(eventWriteMenuItem( 'Copy', gtk.STOCK_COPY, self.copyEvent, path, )) ## if group.name == 'trash': menu.add(gtk.SeparatorMenuItem()) menu.add(eventWriteMenuItem( 'Delete', gtk.STOCK_DELETE, self.deleteEventFromTrash, path, )) else: pasteItem = eventWriteMenuItem( 'Paste', gtk.STOCK_PASTE, self.pasteEventFromMenu, path, ) menu.add(pasteItem) pasteItem.set_sensitive(self.canPasteToGroup(group)) ## menu.add(gtk.SeparatorMenuItem()) menu.add(labelImageMenuItem( _('Move to %s')%ui.eventTrash.title, ui.eventTrash.icon, self.moveEventToTrashFromMenu, path, )) else: return menu.show_all() return menu
def eventWriteImageMenuItem(*args, **kwargs): item = labelImageMenuItem(*args, **kwargs) item.set_sensitive(not event_lib.allReadOnly) return item