Example #1
0
    def __init__(self):
        BaseApplet.__init__(self)
        self.ind = appindicator.Indicator(
            "Webilder Indicator",
            os.path.abspath(
                pkg_resources.resource_filename(__name__, 'ui/camera48.png')),
            appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        propxml = """
    <popup name="button3">
        <menuitem name="Item 1" action="Browse"/>
        <menuitem name="Item 2" action="NextPhoto"/>
        <menuitem name="Item 3" action="Leech"/>
        <menuitem name="Item 6" action="DeleteCurrent"/>
        <menuitem name="Item 4" action="Pref"/>
        <menuitem name="Item 5" action="About"/>
        <menuitem name="Item 5" action="Quit"/>
    </popup>
    """
        uimanager = gtk.UIManager()
        uimanager.add_ui_from_string(propxml)
        action_group = gtk.ActionGroup("WebilderActions")
        action_group.add_actions([
            ("Pref", "gtk-preferences", _("_Preferences"), "<control>P",
             _("Open the preferences dialog"), self.preferences),
            ("About", "gtk-about", _("_About"), "<control>A",
             _("About Webilder"), self.about),
            ("Browse", "gtk-directory", _("_Browse Photos"), "<control>B",
             _("Browse your photo colleciton"), self.browse),
            ("NextPhoto", "gtk-go-forward", _("_Next Photo"), "<control>N",
             _("Switch wallpaper to the next photo"), self.next_photo),
            ("Leech", None, _("_Download Photos"), "<control>D",
             _("Download new photos"), self.leech),
            ("DeleteCurrent", "gtk-delete", _("Delete Current"), None,
             _("Delete the current photo from your collection"),
             self.delete_current),
            ("Quit", "gtk-quit", _("Quit"), None,
             _("Quit Webilder Desktop Indicator"), self.quit),
        ])
        leech_action = action_group.get_action("Leech")
        leech_action.set_gicon(
            gio.FileIcon(
                gio.File(
                    pkg_resources.resource_filename(__name__,
                                                    'ui/camera48.png'))))

        uimanager.insert_action_group(action_group, 0)

        menu = uimanager.get_widget('/button3')
        self.ind.set_menu(menu)

        gobject.timeout_add(60 * 1000, self.timer_event)
        self.photo_browser = None
        self.download_dlg = None
    def install_ui(self):
        manager = self._window.get_ui_manager()

        self._action_group = gtk.ActionGroup("PlumaCommanderPluginActions")
        self._action_group.add_toggle_actions([
            ('CommanderModeAction', None, _('Commander Mode'), '<Ctrl>period',
             _('Start commander mode'), self.on_commander_mode)
        ])

        manager.insert_action_group(self._action_group, -1)
        self._merge_id = manager.add_ui_from_string(ui_str)
Example #3
0
 def activate(self, window):
     actions = [
         ('ZenCodingMenuAction', None, '_Zen Coding', None,
          "Zen Coding tools", None),
         ('ZenCodingExpandAction', None, '_Expand abbreviation', '<Ctrl>E',
          "Expand abbreviation to raw HTML/CSS", self.expand_abbreviation),
         ('ZenCodingExpandWAction', None, 'E_xpand dynamic abbreviation...',
          '<Ctrl><Alt>E', "Dynamically expand abbreviation as you type",
          self.expand_with_abbreviation),
         ('ZenCodingWrapAction', None, '_Wrap with abbreviation...',
          '<Ctrl><Shift>E', "Wrap with code expanded from abbreviation",
          self.wrap_with_abbreviation),
         ('ZenCodingInwardAction', None, 'Balance tag _inward',
          '<Ctrl><Alt>I', "Select inner tag's content",
          self.match_pair_inward),
         ('ZenCodingOutwardAction', None, 'Balance tag _outward',
          '<Ctrl><Alt>O', "Select outer tag's content",
          self.match_pair_outward),
         ('ZenCodingMergeAction', None, '_Merge lines', '<Ctrl><Alt>M',
          "Merge all lines of the current selection", self.merge_lines),
         ('ZenCodingPrevAction', None, '_Previous edit point', '<Alt>Left',
          "Place the cursor at the previous edit point",
          self.prev_edit_point),
         ('ZenCodingNextAction', None, '_Next edit point', '<Alt>Right',
          "Place the cursor at the next edit point", self.next_edit_point),
         ('ZenCodingRemoveAction', None, '_Remove tag', '<Ctrl><Alt>R',
          "Remove a tag", self.remove_tag),
         ('ZenCodingSplitAction', None, 'Split or _join tag',
          '<Ctrl><Alt>J', "Toggle between single and double tag",
          self.split_join_tag),
         ('ZenCodingCommentAction', None, 'Toggle _comment', '<Ctrl><Alt>C',
          "Toggle an XML or HTML comment", self.toggle_comment)
     ]
     windowdata = dict()
     window.set_data("ZenCodingPluginDataKey", windowdata)
     windowdata["action_group"] = gtk.ActionGroup(
         "PlumaZenCodingPluginActions")
     windowdata["action_group"].add_actions(actions, window)
     manager = window.get_ui_manager()
     manager.insert_action_group(windowdata["action_group"], -1)
     windowdata["ui_id"] = manager.add_ui_from_string(zencoding_ui_str)
     window.set_data("ZenCodingPluginInfo", windowdata)
     self.editor = ZenEditor()
     error = self.editor.get_user_settings_error()
     if error:
         md = gtk.MessageDialog(window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,
                                gtk.BUTTONS_CLOSE,
                                "There is an error in user settings:")
         message = "{0} on line {1} at character {2}\n\nUser settings will not be available."
         md.set_title("Zen Coding error")
         md.format_secondary_text(
             message.format(error['msg'], error['lineno'], error['offset']))
         md.run()
         md.destroy()
    def create_menu(self):
        menu_items = '''<ui>
        <menubar name="MenuBar">
          <menu action="File">
            <menuitem action="Save"/>
            <menuitem action="Save As"/>
            <menuitem action="Open"/>
            <separator/>
            <menuitem action="AddLayer" label="Add Layer"/>
            <separator/>
            <menuitem action="Quit"/>
          </menu>
          <menu action="Edit">
            <menuitem action="Layers" label="Layers"/>
            <menuitem action="Preferences"/>
          </menu>
          <menu action="Help">
            <menuitem action="About"/>
          </menu>
        </menubar>
        </ui>'''

        uimanager = gtk.UIManager()
        accel = uimanager.get_accel_group()
        self.add_accel_group(accel)

        actions = gtk.ActionGroup('ImageCreator')
        self.actions = actions
        actions.add_actions([
            (
                'Quit',
                gtk.STOCK_QUIT,
                None,
                None,
                None,
                self.menu_quit,
            ), ('File', None, '_File'),
            ('Save', gtk.STOCK_SAVE, None, None, None, self.save_cb),
            ('Save As', gtk.STOCK_SAVE_AS, None, None, None, self.save_as_cb),
            ('Open', gtk.STOCK_OPEN, None, None, None, self.open_cb),
            ('AddLayer', None, 'Add Layer', None, None, self.add_layer_cb),
            ('Edit', None, '_Edit'), ('Help', None, '_Help'),
            ('Layers', None, 'Layers', None, None, self.layers_cb),
            ('Preferences', gtk.STOCK_PREFERENCES, None, None, None,
             self.preferences_cb),
            ('About', gtk.STOCK_ABOUT, None, None, None, self.about_cb)
        ])
        uimanager.insert_action_group(actions, 0)
        uimanager.add_ui_from_string(menu_items)

        menubar = uimanager.get_widget('/MenuBar')
        menubar.show_all()

        return menubar
Example #5
0
    def activate(self, window):

        # create the browser pane
        panel = window.get_side_panel()
        image = gtk.Image()
        drawable = gtk.gdk.get_default_root_window()
        colormap = drawable.get_colormap()
        pixmap, mask = gtk.gdk.pixmap_colormap_create_from_xpm_d(
            drawable, colormap, None, icon)
        image.set_from_pixmap(pixmap, mask)
        self.classbrowser = ClassBrowser(window)
        panel.add_item(self.classbrowser, "Class Browser", image)

        # create the tabwatch to monitor open files in gedit
        self.tabwatch = TabWatch(window, self.classbrowser)

        # store per window data in the window object
        windowdata = {
            "ClassBrowser": self.classbrowser,
            "TabWatch": self.tabwatch
        }

        submenu = """
            <ui>
              <menubar name="MenuBar">
                <menu name="SearchMenu" action="Search">
                  <placeholder name="SearchOps_7">
                        <menuitem action="JumpPreviousTag"/>
                        <menuitem action="JumpNextTag"/>
                  </placeholder>
                </menu>
              </menubar>
            </ui>
            """

        manager = window.get_ui_manager()
        windowdata["action_group"] = gtk.ActionGroup(
            "GeditClassBrowserPluginActions")
        windowdata["action_group"].add_actions(
            [
                # name, stock id, label, accelerator, tooltip
                ('JumpNextTag', gtk.STOCK_GO_DOWN, _('Jump to next tag'),
                 "<control>e", _("Jump to next tag"), self.next_tag),
                ('JumpPreviousTag', gtk.STOCK_GO_UP,
                 _('Jump to previous tag'), "<control><shift>e",
                 _("Jump to previous tag"), self.previous_tag)
            ],
            window)

        manager.insert_action_group(windowdata["action_group"], 0)
        windowdata["ui_id"] = manager.new_merge_id()
        manager.add_ui_from_string(submenu)
        window.set_data("ClassBrowserPluginWindowDataKey", windowdata)
        self.register_parsers(window)
Example #6
0
    def __init__(self, shell, plugin):
        gobject.GObject.__init__(self)
        self.shell = shell
        self.sp = shell.get_player()
        self.db = shell.get_property('db')
        self.plugin = plugin

        self.top_five = None
        self.current_artist = None
        self.current_album = None
        self.current_song = None
        self.visible = True

        # cache for artist/album information: valid for a month, can be used indefinitely
        # if offline, discarded if unused for six months
        self.info_cache = rb.URLCache(name='info',
                                      path=os.path.join(
                                          'context-pane', 'info'),
                                      refresh=30,
                                      discard=180)
        # cache for rankings (artist top tracks and top albums): valid for a week,
        # can be used for a month if offline
        self.ranking_cache = rb.URLCache(name='ranking',
                                         path=os.path.join(
                                             'context-pane', 'ranking'),
                                         refresh=7,
                                         lifetime=30)

        # maybe move this into an idle handler?
        self.info_cache.clean()
        self.ranking_cache.clean()

        self.init_gui()
        self.init_tabs()

        self.connect_signals()
        self.load_top_five(self.ds['artist'])

        # Set currently displayed tab
        # TODO: make this persistent via gconf key
        self.current = 'artist'
        self.tab[self.current].activate()

        # Add button to toggle visibility of pane
        self.action = ('ToggleContextView', 'gtk-info',
                       _('Toggle Conte_xt Pane'), None,
                       _('Change the visibility of the context pane'),
                       self.toggle_visibility, True)
        self.action_group = gtk.ActionGroup('ContextPluginActions')
        self.action_group.add_toggle_actions([self.action])
        uim = self.shell.get_ui_manager()
        uim.insert_action_group(self.action_group, 0)
        self.ui_id = uim.add_ui_from_string(context_ui)
        uim.ensure_update()
Example #7
0
 def __setupActions(self, m):
     actiongroup = gtk.ActionGroup("binview")
     actiongroup.add_actions((
         ("AddFile", gtk.STOCK_ADD, _("Add Filesrc"), None, None,
          self.addFileAction),
         ("Delete", gtk.STOCK_DELETE, None, None, None,
          self.deleteSelectionAction),
         ("Bin", None, _("_Bin")),
     ))
     m.insert_action_group(actiongroup)
     m.add_ui_from_string(ui)
    def __init__(self, library, window, menupath):
        super(ToolMenu, self).__init__()
        self._library = library
        self._window = window
        self._menupath = menupath

        self._merge_id = 0
        self._action_group = gtk.ActionGroup("ExternalToolsPluginToolActions")
        self._signals = []

        self.update()
Example #9
0
    def __init__(self):
        gtk.EventBox.__init__(self)

        self._loading = True

        # Status text, page number, file number, resolution, path, filename
        self.status = gtk.Statusbar()
        self.add(self.status)

        # Create popup menu for enabling/disabling status boxes.
        self.ui_manager = gtk.UIManager()
        self.tooltipstatus = TooltipStatusHelper(self.ui_manager, self.status)
        ui_description = """
        <ui>
            <popup name="Statusbar">
                <menuitem action="pagenumber" />
                <menuitem action="filenumber" />
                <menuitem action="resolution" />
                <menuitem action="rootpath" />
                <menuitem action="filename" />
            </popup>
        </ui>
        """
        self.ui_manager.add_ui_from_string(ui_description)

        actiongroup = gtk.ActionGroup('mcomix-statusbar')
        actiongroup.add_toggle_actions([
            ('pagenumber', None, _('Show page numbers'), None, None,
             self.toggle_status_visibility),
            ('filenumber', None, _('Show file numbers'), None, None,
             self.toggle_status_visibility),
            ('resolution', None, _('Show resolution'), None, None,
             self.toggle_status_visibility),
            ('rootpath', None, _('Show path'), None, None,
             self.toggle_status_visibility),
            ('filename', None, _('Show filename'), None, None,
             self.toggle_status_visibility)
        ])
        self.ui_manager.insert_action_group(actiongroup, 0)

        # Hook mouse release event
        self.connect('button-release-event', self._button_released)
        self.set_events(gtk.gdk.BUTTON_PRESS_MASK
                        | gtk.gdk.BUTTON_RELEASE_MASK)

        # Default status information
        self._page_info = ''
        self._file_info = ''
        self._resolution = ''
        self._root = ''
        self._filename = ''
        self._update_sensitivity()

        self._loading = False
    def insert_menu(self):
        manager = self._window.get_ui_manager()

        self._action_group = gtk.ActionGroup("GeditColorPickerPluginActions")
        self._action_group.add_actions( \
                [("ColorPicker", None, _("Pick _Color..."), None, \
                _("Pick a color from a dialog"), \
                lambda a: self._plugin.on_color_picker_activate(self._window))])

        manager.insert_action_group(self._action_group, -1)
        self._ui_id = manager.add_ui_from_string(ui_str)
Example #11
0
 def __create_ui(self):
     self.__actiongroup = ag = gtk.ActionGroup('OutputWindowActions')
     actions = [
         ('FileMenu', None, 'File'),
         ('Close', gtk.STOCK_CLOSE, '_Close', 'Return', 'Close window', self.__close_cb),
         ]
     ag.add_actions(actions)
     self._ui = gtk.UIManager()
     self._ui.insert_action_group(ag, 0)
     self._ui.add_ui_from_string(self.__ui_string)
     self.add_accel_group(self._ui.get_accel_group()) 
Example #12
0
    def add_menu(self):
        actions = [
            ('ToDo', gtk.STOCK_EDIT, _('TODO-List'), '<Control><Alt>t', _("List all TODO marks from your current project"), self.show_todo_marks)
        ]

        action_group = gtk.ActionGroup("ToDoActions")
        action_group.add_actions(actions, self.window)

        self.manager = self.window.get_ui_manager()
        self.manager.insert_action_group(action_group, -1)
        self.manager.add_ui_from_string(ui_str)
Example #13
0
    def activate(self, shell):
        self.__action = gtk.Action('SendTo', _('Send to...'),
                                   _('Send files by mail, instant message...'),
                                   '')
        self.__action.connect('activate', self.send_to, shell)

        self.__action_group = gtk.ActionGroup('SendToActionGroup')
        self.__action_group.add_action(self.__action)
        shell.get_ui_manager().insert_action_group(self.__action_group)

        self.__ui_id = shell.get_ui_manager().add_ui_from_string(ui_definition)
        def _install_menu(self):
                manager = self._window.get_ui_manager()
                self._action_group = gtk.ActionGroup("GeditQuickOpenPluginActions")
                self._action_group.add_actions([
                        ("QuickOpen", gtk.STOCK_OPEN, _("Quick open"),
                         '<Ctrl><Alt>O', _("Quickly open documents"),
                         self.on_quick_open_activate)
                ])

                manager.insert_action_group(self._action_group, -1)
                self._ui_id = manager.add_ui_from_string(ui_str)
Example #15
0
    def __init__(self, gom, core):
        gtk.UIManager.__init__(self)

        self.ui_id = 0
        self.gom = gom
        self.uicore = core

        self.graph_menu = '''
        <ui>
            <popup name="Popup">
                <menu action="Graph options" position="top"></menu>
                <menuitem action="options" position="top"/>
                <separator/>
                <menuitem action="do_asn"/>
                <separator/>
                <menuitem action="asn_cluster"/>
                <menuitem action="get_to_from"/>
                <menuitem action="get_from_to"/>
                <menuitem action="get_vulns_ip"/>
                <separator/>
                <menuitem action="get_weighted_ip"/>
                <menuitem action="get_weighted_port"/>
            </popup>
        </ui>
        '''
        self.uicore = core

        # Add the accelerator group
        self.accel = self.get_accel_group()

        # Create an ActionGroup
        self.actiongroup = gtk.ActionGroup('Popup')

        # Add actions
        self.actiongroup.add_actions( [('Graph options', None, ' Graph Options ')] )
        self.actiongroup.add_actions( [('options', None, ' Graph Options ')] )
        self.actiongroup.add_actions( [('do_asn', gtk.STOCK_EXECUTE, ' Get ASN ', None, 'ToolTip', self.doAsn )] )
        self.actiongroup.add_actions( [('asn_cluster', gtk.STOCK_CONVERT, ' ASN Clustered ', None, 'ToolTip', self.doNormal )] )
        self.actiongroup.add_actions( [('get_to_from', gtk.STOCK_CONVERT, ' Ports per IP ', None, 'ToolTip', self.doToFrom )], ['ports_ip'] )
        self.actiongroup.add_actions( [('get_from_to', gtk.STOCK_CONVERT, ' IP per Port ', None, 'ToolTip', self.doToFrom )], ['ip_ports'] )
        self.actiongroup.add_actions( [('get_vulns_ip', gtk.STOCK_CONVERT, ' Vulns per Port ', None, 'ToolTip', self.doToFrom )], ['ports_vuln'] )
        self.actiongroup.add_actions( [('get_weighted_ip', gtk.STOCK_CONVERT, ' Weighted IP ', None, 'ToolTip', self.doWeighted )], ['ip'] )
        self.actiongroup.add_actions( [('get_weighted_port', gtk.STOCK_CONVERT, ' Weighted Ports ', None, 'ToolTip', self.doWeighted )], ['port'] )

        # Add the actiongroup to the uimanager
        self.insert_action_group(self.actiongroup, 0)

        # Add a UI description
        self.add_ui_from_string(self.graph_menu)

        # Menu
        ui_id = self.add_ui_from_string(self.graph_menu)
        #self.set_uiID(ui_id)
        self.popmenu = self.get_widget('/Popup')
Example #16
0
    def create_menuitem(self, string, action):
        rclick_menu = gtk.MenuItem(string)
        if action:
            rclick_menu.connect("activate", action, string)
        rclick_menu.show()
        return rclick_menu

        # Create the menubar and toolbar
        action_group = gtk.ActionGroup("DocWindowActions")
        action_group.add_actions(entries)
        return action_group
Example #17
0
	def add_bindings_to_window(self, window):
		self.ui = window.get_ui_manager()
		self.action_group=gtk.ActionGroup("Switcher")
		self.actionSwitchDocument = gtk.Action("actionSwitchDocument", "Switch document", "Switch between windows", 0) 
		self.action_group.add_action_with_accel(self.actionSwitchDocument,"<Control>grave")
		self.actionSwitchDocument.connect("activate", self.on_switch_document, window)
		self.ui.insert_action_group(self.action_group, -1)
		self.gid = self.ui.new_merge_id();
		self.ui.add_ui(self.gid, "/MenuBar/DocumentsMenu/", "Plugin", "actionSwitchDocument",gtk.UI_MANAGER_SEPARATOR , 0) 
		self.ui.add_ui(self.gid, "/MenuBar/DocumentsMenu/", "Menu", "actionSwitchDocument",gtk.UI_MANAGER_MENUITEM , 0) 
		self.treeview.connect("row-activated", self.on_row_activated, window)
Example #18
0
    def create_menuitem(self, string, action):
        menu_items = gtk.MenuItem(string)
        menu_items.connect("activate", action, string)
        menu_items.show()
        return menu_items

        # Create the menubar and toolbar
        action_group = gtk.ActionGroup("DocWindowActions")
        action_group.add_actions(entries)

        return action_group
Example #19
0
    def __init__(self):
        gtk.Window.__init__(self)
        self.set_icon_from_file(W3AF_ICON)

        self.graph = xdot.Graph()

        window = self

        window.set_title('HTTP Response Cluster')
        window.set_default_size(512, 512)
        vbox = gtk.VBox()
        window.add(vbox)

        self.widget = xdot.DotWidget()

        # Create a UIManager instance
        uimanager = self.uimanager = gtk.UIManager()

        # Add the accelerator group to the toplevel window
        accelgroup = uimanager.get_accel_group()
        window.add_accel_group(accelgroup)

        # Create an ActionGroup
        actiongroup = gtk.ActionGroup('Actions')
        self.actiongroup = actiongroup

        # Create actions
        actiongroup.add_actions((
            ('ZoomIn', gtk.STOCK_ZOOM_IN, None, None, None,
             self.widget.on_zoom_in),
            ('ZoomOut', gtk.STOCK_ZOOM_OUT, None, None, None,
             self.widget.on_zoom_out),
            ('ZoomFit', gtk.STOCK_ZOOM_FIT, None, None, None,
             self.widget.on_zoom_fit),
            ('Zoom100', gtk.STOCK_ZOOM_100, None, None, None,
             self.widget.on_zoom_100),
        ))

        # Add the actiongroup to the uimanager
        uimanager.insert_action_group(actiongroup, 0)

        # Add a UI description
        uimanager.add_ui_from_string(self.ui)

        # Create a Toolbar
        toolbar = uimanager.get_widget('/ToolBar')
        vbox.pack_start(toolbar, False)

        vbox.pack_start(self.widget)

        self.set_focus(self.widget)

        self.show_all()
Example #20
0
    def __init__(self, window, pluginManager):
        self.window = window
        self.pluginManager = pluginManager

        action = ( "ShowPythonDefs", gtk.STOCK_JUSTIFY_FILL, "Show Python Defs", "", \
            "Shows all source code def's", self.on_run )            
        self.action_group = gtk.ActionGroup( "PythonPluginActions" )
        self.action_group.add_actions( [action] )

        manager = window.get_ui_manager()
        manager.insert_action_group( self.action_group, -1 )
        self.ui_id = manager.add_ui_from_string( ui )
Example #21
0
    def _insert_menu(self):
        manager = self._window.get_ui_manager()

        self._action_group = gtk.ActionGroup("SortDocumentGroup")
        self._action_group.add_actions([
            ("SortDocumentAction", gtk.STOCK_SORT_DESCENDING,
             _("Sort document alphabetically"), '<Control><Shift>o',
             _("Sort document alphabetically"), self.on_compare_file)
        ])
        manager.insert_action_group(self._action_group, -1)

        self._ui_id = manager.add_ui_from_string(ui_str)
Example #22
0
 def __init__(self, known_keys, ws_client):
     self.known_keys = known_keys
     self.ws_client = ws_client
     self.uimanager = gtk.UIManager()
     self.actiongroup = gtk.ActionGroup('MenuBar')
     self.add_prefix_choices()
     self.add_key_choices()
     self.actiongroup.add_actions(self.action_details)
     self.actiongroup.add_toggle_actions(self.prefixes_action_details)
     self.actiongroup.add_toggle_actions(self.toggle_action_details)
     self.uimanager.insert_action_group(self.actiongroup, pos=0)
     self.uimanager.add_ui_from_string(self.ui_config_string)
	def __init__( self, plugin, window ):
		self._window = window
		self._plugin = plugin
		self._project = ProjectData()
		if not is_mate:
			self._encoding = gedit.gedit_encoding_get_current()
			self._history_file = os.path.expanduser( '~' ) + "/.gnome2/gedit/plugins/gedit-project-manager-history"
		else:
			self._encoding = gedit.pluma_encoding_get_current()
			self._history_file = os.path.expanduser( '~' ) + "/.config/pluma/plugins/gedit-project-manager-history"
			
		self._history = list()
		self._action_group = gtk.ActionGroup( "ProjectPluginActions" )
		self._history_action_group = gtk.ActionGroup( "ProjectPluginHistoryActions" )
		self._state = self.STATE_PROJECT_NO_FILES_NO
		self._add_remove_state = None
		self._message = list()
		
		self._init_history()
		self._insert_menu()
		self._create_choosers()
Example #24
0
	def _insert_menu( self ):
		manager = self._window.get_ui_manager()
		self._action_group = gtk.ActionGroup( "SnapOpenPluginActions" )
		snapopen_menu_action = gtk.Action( name="SnapOpenMenuAction", label="Snap", tooltip="Snap tools", stock_id=None )
		self._action_group.add_action( snapopen_menu_action )
		snapopen_action = gtk.Action( name="SnapOpenAction", label="Snap Open...\t", tooltip="Open file by autocomplete...", stock_id=gtk.STOCK_JUMP_TO )
		snapopen_action.connect( "activate", lambda a: self.on_snapopen_action() )
		self._action_group.add_action_with_accel( snapopen_action, "<Ctrl><Alt>o" )
		manager.insert_action_group( self._action_group, 0 )
		self._ui_id = manager.new_merge_id()
		manager.add_ui_from_string( ui_str )
		manager.ensure_update()
Example #25
0
 def setup_action_groups (self):
     self.shoppingListSaverActionGroup = gtk.ActionGroup('ShoppingListSaverActionGroup')
     self.shoppingListSaverActionGroup.add_actions([
         ('SaveAsRecipe',# name
          gtk.STOCK_SAVE_AS,# stock
          _('Save List as Recipe'), # text
          _('<Ctrl><Shift>S'), # key-command
          _('Save current shopping list as a recipe for future use'), # tooltip
          self.save_as_recipe# callback
          ),
         ])
     self.action_groups.append(self.shoppingListSaverActionGroup)
Example #26
0
 def setup_menu(self):
     """
     Setup the popup menu
     """
     self.action_group = gtk.ActionGroup('PopupActions')
     actions = (('Close', gtk.STOCK_CLOSE, None, None,
                 _('Close this translation'), self.on_close), )
     self.action_group.add_actions(actions)
     self.ui = gtk.UIManager()
     self.ui.insert_action_group(self.action_group, 0)
     self.ui.add_ui_from_string(self.ui_string)
     self.menu = self.ui.get_widget("/PopupMenu")
Example #27
0
    def activate(self, window):
        """Activate plugin."""

        self.window = window
        self.action_group = gtk.ActionGroup('AlignPluginActions')
        self.action_group.add_actions([
            ('Align', None, _('Ali_gn...'), None,
             _('Align the selected text to columns'), self.on_align_activate)
        ])
        uim = window.get_ui_manager()
        uim.insert_action_group(self.action_group, -1)
        self.ui_id = uim.add_ui_from_string(UI)
Example #28
0
    def __init__(self):
        '''
    Gets references to important widgets, establishes event handlers,
    configures the tree view, and initializes the tree with the contents of the
    desktop.
    '''
        # mark the root of this window with its PID so we can easily identify it
        # as this app
        root_atk = atk.get_root()
        root_atk.set_description(str(os.getpid()))

        self.node = Node()

        self.window = AccerciserMainWindow(self.node)
        self.window.connect('destroy', self._onQuit)

        # Start hotkey manager
        self.hotkey_manager = HotkeyManager()
        self.bookmarks_store = BookmarkStore(self.node)

        # load plugins
        self.plugin_manager = \
            PluginManager(self.node, self.hotkey_manager,
                          self.window.pluginview1, self.window.pluginview2)

        # connect signal handlers and show the GUI in its initial state
        self.window.show_all()

        main_actions = gtk.ActionGroup('MainActions')
        ui_manager.uimanager.insert_action_group(main_actions, 0)
        main_actions.add_actions([
            ('Quit', gtk.STOCK_QUIT, None, '<control>q', 'Quit Accerciser',
             self._onQuit),
            ('Preferences', gtk.STOCK_PREFERENCES, _('_Preferences...'),
             '<control>p', 'Show preferences', self._onShowPreferences),
            ('Contents', gtk.STOCK_HELP, _('_Contents'), 'F1',
             'View contents of manual', self._onHelp),
            ('About', gtk.STOCK_ABOUT, None, None, 'About Accerciser',
             self._onAbout)
        ])

        for action_name, menu_path in [('Quit', ui_manager.FILE_MENU_PATH),
                                       ('Preferences',
                                        ui_manager.EDIT_MENU_PATH),
                                       ('Contents', ui_manager.HELP_MENU_PATH),
                                       ('About', ui_manager.HELP_MENU_PATH)]:
            action = main_actions.get_action(action_name)
            ui_manager.uimanager.add_ui(ui_manager.uimanager.new_merge_id(),
                                        menu_path, action_name, action_name,
                                        gtk.UI_MANAGER_MENUITEM, False)

        self.last_focused = None
        self.window.show_all()
Example #29
0
    def install_ui(self):
        manager = self._window.get_ui_manager()

        self._action_group = gtk.ActionGroup("GeditMultiEditPluginActions")
        self._action_group.add_actions([
            ('MultiEditModeAction',
             None, _('Multi Edit Mode'), '<Ctrl><Shift>C',
             _('Start multi edit mode'), self.on_multi_edit_mode)
        ])

        manager.insert_action_group(self._action_group, -1)
        self._merge_id = manager.add_ui_from_string(ui_str)
Example #30
0
 def __init__(self):
     self._action_group = gtk.ActionGroup("diff_file_and_refresh")
     self._action_group.add_actions([
         ("diff_save", gtk.STOCK_SAVE, _('_Save'), None,
          _('Save the diff to previously nominated file'), self._save_acb),
         ("diff_save_as", gtk.STOCK_SAVE_AS, _('Save _as'), None,
          _('Save the diff to a nominated file'), self._save_as_acb),
         ("diff_refresh", gtk.STOCK_REFRESH, _('_Refresh'), None,
          _('Refresh contents of the diff'), self._refresh_acb),
     ])
     self._save_file = None
     self.check_set_save_sensitive()