def __init__(self, handler, parent=None): ''' constructor handler -- e3common.Handler.HelpHandler ''' QtGui.QMenu.__init__(self, trs('_Help'), parent) self.handler = handler self.website = QtGui.QAction(trs('_Website'), self) self.about = QtGui.QAction(ICON('help-about'), tr('About'), self) self.debug = QtGui.QAction(tr('Debug'), self) self.updatecheck = QtGui.QAction(tr('Check for updates'), self) self.addAction(self.website) self.addAction(self.about) self.addAction(self.debug) self.addSeparator() self.addAction(self.updatecheck) self.website.triggered.connect( lambda *args: self.handler.on_website_selected()) self.about.triggered.connect( lambda *args: self.handler.on_about_selected()) self.debug.triggered.connect( lambda *args: self.handler.on_debug_selected()) self.updatecheck.triggered.connect( lambda *args: self.handler.on_check_update_selected())
def __init__(self, handler, session, parent=None): ''' constructor handler -- e3common.Handler.ActionsHandler ''' QtGui.QMenu.__init__(self, trs('_Actions'), parent) self._handler = handler contacts_menu_cls = extension.get_default('menu contact') group_menu_cls = extension.get_default('menu group') profile_menu_cls = extension.get_default('menu profile') self.contact_menu = contacts_menu_cls(self._handler.contact_handler, session) self.group_menu = group_menu_cls(self._handler.group_handler) self.my_profile_menu = profile_menu_cls( self._handler.my_account_handler) self.addMenu(self.contact_menu) self.addMenu(self.group_menu) self.addMenu(self.my_profile_menu)
def __init__(self, handler, parent=None): ''' constructor handler -- e3common.Handler.FileHandler ''' QtGui.QMenu.__init__(self, trs('_File'), parent) self._handler = handler status_menu_cls = extension.get_default('menu status') self.status_menu = status_menu_cls(handler.on_status_selected) disconnect_action = QtGui.QAction(ICON('window-close'), tr('Disconnect'), self) quit_action = QtGui.QAction(ICON('application-exit'), tr('Quit'), self) self.addMenu(self.status_menu) self.addAction(disconnect_action) self.addSeparator() self.addAction(quit_action) disconnect_action.triggered.connect( lambda *args: self._handler.on_disconnect_selected()) quit_action.triggered.connect( lambda *args: self._handler.on_quit_selected())
def __init__(self, handler, config, parent=None): ''' constructor handler -- e3common.Handler.OptionsHandler ''' QtGui.QMenu.__init__(self, trs('_Options'), parent) self.handler = handler # "Show" submenu self.show_menu = QtGui.QMenu(tr('Show...')) show_offline = QtGui.QAction(trs('Show _offline contacts'), self) show_empty_groups = QtGui.QAction(trs('Show _empty groups'), self) show_blocked = QtGui.QAction(trs('Show _blocked contacts'), self) show_offline.setCheckable(True) show_empty_groups.setCheckable(True) show_blocked.setCheckable(True) show_offline.setChecked(config.b_show_offline) show_empty_groups.setChecked(config.b_show_empty_groups) show_blocked.setChecked(config.b_show_blocked) self.show_menu.addAction(show_offline) self.show_menu.addAction(show_empty_groups) self.show_menu.addAction(show_blocked) show_offline.triggered.connect( self.handler.on_show_offline_toggled) show_empty_groups.triggered.connect( self.handler.on_show_empty_groups_toggled) show_blocked.triggered.connect( self.handler.on_show_blocked_toggled) order_action_group = QtGui.QActionGroup(self) by_status = QtGui.QAction(trs('Order by _status'), self) by_group = QtGui.QAction(trs('Order by _group'), self) group_offline = QtGui.QAction(trs('G_roup offline contacts'), self) preferences = QtGui.QAction(ICON('document-properties'), tr('Preferences'), self) self.addAction(by_status) self.addAction(by_group) self.addSeparator() self.addMenu(self.show_menu) self.addAction(group_offline) self.addSeparator() self.addAction(preferences) order_action_group.addAction(by_status) order_action_group.addAction(by_group) by_group.setCheckable(True) by_status.setCheckable(True) group_offline.setCheckable(True) by_group.setChecked(config.b_order_by_group) by_status.setChecked(not config.b_order_by_group) group_offline.setChecked(config.b_group_offline) by_group.triggered.connect( self.handler.on_order_by_group_toggled) group_offline.triggered.connect( self.handler.on_group_offline_toggled) preferences.triggered.connect( lambda *args: self.handler.on_preferences_selected()) by_status.toggled.connect( self.handler.on_order_by_status_toggled)
def __init__(self, handler, config, parent=None): ''' constructor handler -- e3common.Handler.OptionsHandler ''' QtGui.QMenu.__init__(self, trs('_Options'), parent) self.handler = handler # "Show" submenu self.show_menu = QtGui.QMenu(tr('Show...')) show_offline = QtGui.QAction(trs('Show _offline contacts'), self) show_empty_groups = QtGui.QAction(trs('Show _empty groups'), self) show_blocked = QtGui.QAction(trs('Show _blocked contacts'), self) show_offline.setCheckable(True) show_empty_groups.setCheckable(True) show_blocked.setCheckable(True) show_offline.setChecked(config.b_show_offline) show_empty_groups.setChecked(config.b_show_empty_groups) show_blocked.setChecked(config.b_show_blocked) self.show_menu.addAction(show_offline) self.show_menu.addAction(show_empty_groups) self.show_menu.addAction(show_blocked) show_offline.triggered.connect(self.handler.on_show_offline_toggled) show_empty_groups.triggered.connect( self.handler.on_show_empty_groups_toggled) show_blocked.triggered.connect(self.handler.on_show_blocked_toggled) order_action_group = QtGui.QActionGroup(self) by_status = QtGui.QAction(trs('Order by _status'), self) by_group = QtGui.QAction(trs('Order by _group'), self) group_offline = QtGui.QAction(trs('G_roup offline contacts'), self) preferences = QtGui.QAction(ICON('document-properties'), tr('Preferences'), self) self.addAction(by_status) self.addAction(by_group) self.addSeparator() self.addMenu(self.show_menu) self.addAction(group_offline) self.addSeparator() self.addAction(preferences) order_action_group.addAction(by_status) order_action_group.addAction(by_group) by_group.setCheckable(True) by_status.setCheckable(True) group_offline.setCheckable(True) by_group.setChecked(config.b_order_by_group) by_status.setChecked(not config.b_order_by_group) group_offline.setChecked(config.b_group_offline) by_group.triggered.connect(self.handler.on_order_by_group_toggled) group_offline.triggered.connect(self.handler.on_group_offline_toggled) preferences.triggered.connect( lambda *args: self.handler.on_preferences_selected()) by_status.toggled.connect(self.handler.on_order_by_status_toggled)