Exemple #1
0
    def __init__(self, fname, parent, names):

        self.statuscount = 0
        self.alt = False
        register_stock_icons()

        global mained
        mained = self

        # Create the toplevel window
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window = window

        window.set_position(gtk.WIN_POS_CENTER)
        www = gtk.gdk.screen_width()
        hhh = gtk.gdk.screen_height()

        if pedconfig.pedconfig.full_screen:
            window.set_default_size(www, hhh)
        else:
            window.set_default_size(7 * www / 8, 5 * hhh / 8)
            window.move(www / 32, hhh / 10)

        window.set_icon_from_file(get_img_path("pyedit.png"))
        merge = gtk.UIManager()
        window.set_data("ui-manager", merge)
        merge.insert_action_group(create_action_group(self), 0)
        window.add_accel_group(merge.get_accel_group())

        try:
            mergeid = merge.add_ui_from_string(ui_info)
        except gobject.GError, msg:
            print "Building menus failed: %s" % msg
    def createMenuBar(self):
        '''
        Create the main menu bar
        
        @return gtk.MenuBar
        '''
        ui = gtk.UIManager()
        self.add_accel_group(ui.get_accel_group())
        ui.add_ui_from_string(LOGIN_MENU_DATA)

        group = gtk.ActionGroup('MainMenuBarGroup')
        group.add_actions([('Exit', gtk.STOCK_QUIT, _('_Exit'), None, None,
                            self.delete_event),
                           ('Preferences', gtk.STOCK_PREFERENCES,
                            _('_Preferences'), '<control>P', None,
                            self.showOptions),
                           ('Online Help', gtk.STOCK_HELP, _('_Online Help'),
                            None, None, util.showHelp),
                           ('About', gtk.STOCK_ABOUT, _('_About'), None, None,
                            gtkutil.showAbout), ('Help', None, _('_Help')),
                           ('Options', None, _('_Tools')),
                           ('File', None, _('_File'))])

        ui.insert_action_group(group, 0)
        return ui.get_widget('/MainMenuBar')
Exemple #3
0
    def __init__(self, parent=None):
        gtk.Window.__init__(self)
        try:
            self.set_screen(parent.get_screen())
        except AttributeError:
            self.connect('destroy', lambda *w: gtk.main_quit())
        self.set_title(self.__class__.__name__)
        self.set_border_width(0)

        actions = gtk.ActionGroup("Actions")
        actions.add_actions(entries)
        actions.add_toggle_actions(toggle_entries)
        actions.add_radio_actions(color_entries, COLOR_RED,
                                  activate_radio_action)
        actions.add_radio_actions(shape_entries, SHAPE_OVAL,
                                  activate_radio_action)

        ui = gtk.UIManager()
        ui.insert_action_group(actions, 0)
        self.add_accel_group(ui.get_accel_group())

        try:
            mergeid = ui.add_ui_from_string(ui_info)
        except gobject.GError, msg:
            print "building menus failed: %s" % msg
Exemple #4
0
    def initMenu(self, window):
        # Create a UIManager instance
        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('seeditUIManager')
        self.actiongroup = actiongroup

        # Create actions
        actiongroup.add_actions([
            ('About', gtk.STOCK_DIALOG_INFO, _("_About"), None, _('About'),
             self.showAbout),
            ('Manual', gtk.STOCK_HELP, _("_Help"), None, _('Manual'),
             self.showManual),
            ('Help', None, _('_Help')),
        ])

        # 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 MenuBar
        menubar = uimanager.get_widget('/MenuBar')
        return menubar
Exemple #5
0
 def _handle_click(self, view, event):
     pathinfo = view.get_path_at_pos(int(event.x), int(event.y))
     if (event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS
             and pathinfo is None):
         self._handle_activation()
     if event.button == 3:
         ui_string = """<ui><popup name='Popup'>
                        <menuitem action='Open'/>
                        </popup> </ui>"""
         actions = [('Open', gtk.STOCK_OPEN,
                     rose.config_editor.FILE_PANEL_MENU_OPEN)]
         uimanager = gtk.UIManager()
         actiongroup = gtk.ActionGroup('Popup')
         actiongroup.add_actions(actions)
         uimanager.insert_action_group(actiongroup, pos=0)
         uimanager.add_ui_from_string(ui_string)
         if pathinfo is None:
             path = None
             col = None
         else:
             path, col = pathinfo[:2]
         open_item = uimanager.get_widget('/Popup/Open')
         open_item.connect(
             "activate", lambda m: self._handle_activation(view, path, col))
         this_menu = uimanager.get_widget('/Popup')
         this_menu.popup(None, None, None, event.button, event.time)
Exemple #6
0
	def __init__(self):
		gtk.VBox.__init__(self)
		# XDotWidget
		xdotwidget = self.xdotwidget = xdot.DotWidget()
		# Toolbar
		uimanager = gtk.UIManager()
		actiongroup = gtk.ActionGroup('Actions')
		actiongroup.add_actions((
			('ZoomIn', gtk.STOCK_ZOOM_IN, None, None, None, self.xdotwidget.on_zoom_in),
			('ZoomOut', gtk.STOCK_ZOOM_OUT, None, None, None, self.xdotwidget.on_zoom_out),
			('ZoomFit', gtk.STOCK_ZOOM_FIT, None, None, None, self.xdotwidget.on_zoom_fit),
			('Zoom100', gtk.STOCK_ZOOM_100, None, None, None, self.xdotwidget.on_zoom_100),
		))
		uimanager.insert_action_group(actiongroup, 0)
		uimanager.add_ui_from_string(self.ui)
		toolbar = uimanager.get_widget('/ToolBar')
		toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)
		toolbar.set_style(gtk.TOOLBAR_ICONS)
		toolbar.set_show_arrow(False)
		label = self.label = gtk.Label()
		hbox = gtk.HBox(False, 5)
		hbox.pack_start(toolbar, False)
		hbox.pack_start(label, False)
		self.pack_start(hbox, False)
		self.pack_start(xdotwidget)
Exemple #7
0
 def createMenuBar(self):
     '''
     Create the main menu bar
     
     
     @return: gtk.Menubar
     '''
     ui = gtk.UIManager()
     self.add_accel_group( ui.get_accel_group() )
     ui.add_ui_from_string(MENU_DATA)
     
     group = gtk.ActionGroup('MainMenuBarGroup')
     group.add_actions([('Exit', gtk.STOCK_QUIT, _('_Exit'), None, None, self.onDelete_event),
                        ('Create Game', None, _('_Create Game'), '<control>G', None, self.chatwin.createGameWindow),
                        ('Preferences', gtk.STOCK_PREFERENCES, _('_Preferences'), '<control>P', None, self.showOptions),
                        ('Online Help', gtk.STOCK_HELP, _('_Online Help'), None, None, util.showHelp),
                        ('About', gtk.STOCK_ABOUT, _('_About'), None, None, gtkutil.showAbout),
                        ('Help', None, _('_Help')),
                        ('Server', None, _('_Server')),
                        ('View', None, _('_View')),
                        ('Options', None, _('_Tools')),
                        ('File', None, _('_File'))])
     
     group.add_toggle_actions([('Full Screen', None, _('_Full Screen'), 'F11', 'Toggle Full Screen Mode', self.fullScreen_cb)])
     
     ui.insert_action_group(group, 0)
     return ui.get_widget('/MainMenuBar')
    def __init__(self, notebook):
        self.notebook = notebook
        self.path = None
        self.current_editor = None

        self.ui_manager = gtk.UIManager()

        self.action_group = gtk.ActionGroup("main")
        self._add_actions(self.action_group)

        self.ui_manager.insert_action_group(self.action_group, 0)

        self.ui_manager.add_ui_from_string(self.UI_STRING)
        self.ui_manager.ensure_update()

        menu = self.ui_manager.get_widget("/TopMenu")
        toolbar = self.ui_manager.get_widget("/ToolBar")

        self._create_window(menu, toolbar)

        # We want each toplevel to have separate modality
        window_group = gtk.WindowGroup()
        window_group.add_window(self.window)

        self.window.add_accel_group(self.ui_manager.get_accel_group())

        self.main_vbox.show_all()
        self.window.connect('key-press-event', self.on_key_press_event)
        self.window.connect('delete-event', self.on_delete_event)
        self.window.connect('notify::is-active', self.on_notify_is_active)
Exemple #9
0
    def create_ui(self, window):
        """Creates the menubar"""
        ui_string = """<ui>
               <menubar name='Menubar'>
                <menu action='HelpMenu'>
                 <menuitem action='About'/>
                </menu>
                <menu action='Action'>
                 <menuitem action='Mark as read all'/>
                 <menuitem action='Search unread articles'/>
                </menu>
               </menubar>
              </ui>"""

        ag = gtk.ActionGroup('WindowActions')
        actions = [
            ('HelpMenu', None, '_Help'),
            ('About', gtk.STOCK_ABOUT, '_About', None, 'About',
             self.show_about),
            ('Action', None, '_Action'),
            ('Mark as read all', None, '_Mark as read all',
             '<Control><Shift>a', 'About', self.mark_as_read_all),
            ('Search unread articles', None, '_Search unread articles',
             '<Control>s', 'Search unread articles', self.search_unread),
        ]
        ag.add_actions(actions)
        self.ui = gtk.UIManager()
        self.ui.insert_action_group(ag, 0)
        self.ui.add_ui_from_string(ui_string)
        self.window.add_accel_group(self.ui.get_accel_group())
Exemple #10
0
    def __init__(self, engine, parent=None):
        #b Set
        self.engine = engine
        self.engine_state = EngineState(engine=engine)
        self.engine_display_widgets_list = []
        for inst in engine.list_instances():
            for glade_dir in args["glade_dirs"]:
                glade_filename = glade_dir + "/" + inst[1] + ".glade"
                if (os.path.isfile(glade_filename)):
                    self.engine_display_widgets_list.append(
                        EngineDisplayWidgets(self.engine_state, inst[0],
                                             glade_filename))

        #b Get ourselves going with a window
        register_stock_icons()
        gtk.Window.__init__(self)
        try:
            self.set_screen(parent.get_screen())
        except AttributeError:
            self.connect('destroy', lambda *w: gtk.main_quit())

        self.set_title(self.__class__.__name__)
        self.set_default_size(200, 200)

        #b Create basic actions and shortcuts
        merge = gtk.UIManager()
        self.set_data("ui-manager", merge)
        merge.insert_action_group(self.__create_action_group(), 0)
        self.add_accel_group(merge.get_accel_group())

        #b Build menus and add to menu bar
        try:
            mergeid = merge.add_ui_from_string(menu_bar_info)
        except gobject.GError, msg:
            print "building menus failed: %s" % msg
Exemple #11
0
	def __init__(self, cnmlFile="detail"):
		self.ui = gtk.Builder()
		self.ui.add_from_file("cnml_explorer.ui")
		self.ui.connect_signals(self)

		self.window = self.ui.get_object("window1")
		self.treestore = self.ui.get_object("treestore1")
		self.treeview = self.ui.get_object("treeview1")
		self.statusbar = self.ui.get_object("statusbar1")
		self.actiongroup1 = self.ui.get_object("actiongroup1")

		self.t6 = self.ui.get_object("treeviewcolumn6")
		
		self.uimanager = gtk.UIManager()
		self.uimanager.add_ui_from_file("cnml_explorer_menu.ui")
		self.uimanager.insert_action_group(self.actiongroup1)
		self.menu = self.uimanager.get_widget("/KeyPopup")
		
		self.nodedialog = self.ui.get_object("nodeDialog")
		
		self.opendialog = self.ui.get_object("filechooserdialog1")
		self.opendialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
		
		self.about_ui = self.ui.get_object("aboutdialog1")
		with open("COPYING") as f:
			self.about_ui.set_license(f.read())

		self.completaArbol(cnmlFile)
Exemple #12
0
 def makeMenu(self):
     uiManager = gtk.UIManager()
     self.accelGroup = uiManager.get_accel_group()
     self.window.add_accel_group(self.accelGroup)
     self.actionGroup = gtk.ActionGroup('UIManagerExample')
     self.actionGroup.add_actions([
         ('Open', gtk.STOCK_OPEN, '_Open Image...', None, None,
          self.doFileOpen),
         ('MergeText', None, 'Merge _Text...', '<Control>T', None,
          self.doFileMergeText),
         ('Save', gtk.STOCK_SAVE, '_Save Box Info', None, None,
          self.doFileSave),
         ('Quit', gtk.STOCK_QUIT, None, None, None,
          lambda w: gtk.main_quit()),
         ('File', None, '_File'),
         ('Commands', None, '_Commands'),
         ('Split', None, '_Split Symbol', '<Control>2', None,
          self.doCommandsSplit),
         ('JoinWithNext', None, '_Join with Next Symbol', '<Control>1',
          None, self.doCommandsJoin),
         ('Delete', None, '_Delete Symbol', '<Control>D', None,
          self.doCommandsDelete),
         ('Help', None, '_Help'),
         ('About', None, '_About', None, None, self.doHelpAbout),
         ('Shortcuts', None, '_Keyboard shotcuts', None, None,
          self.doHelpShortcuts),
     ])
     uiManager.insert_action_group(self.actionGroup, 0)
     uiManager.add_ui_from_string(MENU)
     return uiManager.get_widget('/MenuBar')
Exemple #13
0
    def do_setup_menu(self):
        verbs = [(
                'Menu',
                None,
                'Menu', 
                ),
                (
                'SetKey', 
                None, 
                'Set Key', 
                None, 
                'Set key to use for push-to-talk', 
                self.set_key, 
            ),]
        for interface in self.INTERFACES:
            if self.audio_interface.verb != interface.verb:
                verbs.append((
                                interface.verb, 
                                None, 
                                interface.verb, 
                                None, 
                                '', 
                                self.change_interface, 
                        ),)

        action_group = gtk.ActionGroup('Actions')
        action_group.add_actions(verbs)

        self.manager = gtk.UIManager()
        self.manager.insert_action_group(action_group, 0)
        self.manager.add_ui_from_string(self.menu_xml)
        self.menu = self.manager.get_widget('/Menubar/Menu/SetKey').props.parent
        self.connect('popup-menu', self.on_popup_menu)
Exemple #14
0
    def __init__(self, parent=None):
        global app
        app = self
        gtk.Window.__init__(self)
        try:
            self.set_screen(parent.get_screen())
        except AttributeError:
            self.connect('destroy', lambda *w: gtk.main_quit())

        self.design = Design(self)

        actions = gtk.ActionGroup("Actions")
        actions.add_actions(menu_entries)

        ui = gtk.UIManager()
        ui.insert_action_group(actions, 0)
        self.add_accel_group(ui.get_accel_group())

        # better path to 'ui.xml' needed
        uifile = os.path.join(os.path.dirname(sys.argv[0]), "ui.xml")

        try:
            mergeid = ui.add_ui_from_file(uifile)
        except gobject.GError, msg:
            print "error building menus: %s" % (msg)
Exemple #15
0
 def __init__(self, arg, *args, **kwargs):
     self.builder = gtk.Builder()
     if "domain" in kwargs:
         self.builder.set_translation_domain(kwargs["domain"])
     self.items = {}
     if isinstance(arg, gtk.Widget):
         self.items[args[0]] = arg
         args = ()
         if args or kwargs:
             raise ValueError
         self.toplevel = arg
     else:
         self.builder.add_objects_from_file(arg, args)
         self.toplevel = self.builder.get_object(args[0])
     self.manager = gtk.UIManager()
     if isinstance(self.toplevel, gtk.Window):
         self.toplevel.add_accel_group(self.manager.get_accel_group())
     # Make Adjustment accessible
     for name in args:
         # Allow for ActionGroup detection
         self[name] = self.builder.get_object(name)
     # Cache
     for widget in self.builder.get_objects():
         try:
             name = gtk.Buildable.get_name(widget)
         except TypeError:
             pass
         else:
             self[name] = widget
     self.connected = False
Exemple #16
0
 def _popup_menu(self, iter_, event):
     # Pop up a menu for the main list view.
     """Launch a popup menu for add/clone/remove."""
     ui_config_string = """<ui> <popup name='Popup'>
                           <menuitem action="Remove"/>
                           </popup></ui>"""
     text = rose.config_editor.CHOICE_MENU_REMOVE
     actions = [("Remove", gtk.STOCK_DELETE, text)]
     uimanager = gtk.UIManager()
     actiongroup = gtk.ActionGroup('Popup')
     actiongroup.add_actions(actions)
     uimanager.insert_action_group(actiongroup, pos=0)
     uimanager.add_ui_from_string(ui_config_string)
     remove_item = uimanager.get_widget('/Popup/Remove')
     remove_item.connect("activate",
                         lambda b: self._remove_iter(iter_))
     menu = uimanager.get_widget('/Popup')
     for menuitem in self._get_custom_menu_items():
         menuitem._listview_model = self.get_model()
         menuitem._listview_iter = iter_
         menuitem.connect_after(
             "button-press-event",
             lambda b, e: self._handle_reordering()
         )
         menu.append(menuitem)
     menu.popup(None, None, None, event.button, event.time)
     return False
Exemple #17
0
 def __create_ui(self):
     self.__actiongroup = ag = gtk.ActionGroup('WindowActions')
     actions = [
         ('FileMenu', None, _('_File')),
         ('Save', gtk.STOCK_SAVE, _('_Save'), '<control>s',
          _('Save to current file'), self.__save_cb),
         ('SaveAs', gtk.STOCK_SAVE, _('Save _As'), '<control><shift>s',
          _('Save to a new file'), self.__save_as_cb),
         ('Revert', None, '_Revert', None, _('Revert to saved text'),
          self.__revert_cb),
         ('Close', gtk.STOCK_CLOSE, _('_Close'), '<control>Return',
          _('Save and close'), self.__close_cb),
         ('EditMenu', None, '_Edit'),
         ('Undo', gtk.STOCK_UNDO, _('_Undo'), '<control>z',
          _('Undo previous action'), self.__undo_cb),
         ('Redo', gtk.STOCK_REDO, _('_Redo'), '<control><shift>Z',
          _('Redo action'), self.__redo_cb),
         ('Find', gtk.STOCK_FIND, _('_Find'), '<control>f', _('Find text'),
          self.__search_cb),
         ('GotoLine', gtk.STOCK_JUMP_TO, _('_Go to Line'), '<control>l',
          _('Jump to line number'), self.__goto_line_cb),
         ('ToolsMenu', None, _('_Tools')),
         ('About', gtk.STOCK_ABOUT, _('_About'), None, _('About Hotwire'),
          self.__help_about_cb),
     ]
     toggle_actions = [
         ('ReadOnly', None, _('Read _Only'), None,
          _('Toggle read-only mode'), self.__toggle_read_only_cb),
     ]
     ag.add_actions(actions)
     ag.add_toggle_actions(toggle_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())
 def _build_popup_ui(self):
     """
     Create actions and ui of context menu
     """
     from QuickReports import create_quickreport_menu
     
     self.popupmanager = gtk.UIManager()
     #add custom actions
     (ui_top, action_groups) = self._top_contextmenu()
     for action in action_groups :
         self.popupmanager.insert_action_group(action, -1)
     #see which quick reports are available now:
     ui_qr = ''
     if self.QR_CATEGORY > -1 :
         (ui_qr, reportactions) = create_quickreport_menu(self.QR_CATEGORY,
                                 self.dbstate, self.uistate, 
                                 self.obj.get_handle())
         self.report_action = gtk.ActionGroup("/PersonReport")
         self.report_action.add_actions(reportactions)
         self.report_action.set_visible(True)
         self.popupmanager.insert_action_group(self.report_action, -1)
     
     popupui = '''
     <ui>
       <popup name="Popup">''' + ui_top + '''
         <separator/>''' + ui_qr + '''
       </popup>
     </ui>'''
     
     self.popupmanager.add_ui_from_string(popupui)
Exemple #19
0
    def __init__(self, parent=None):

        register_stock_icons()
        #winx = 11

        # Create the toplevel window
        gtk.Window.__init__(self)

        winx = 14
        #self #.get_window();

        try:
            self.set_screen(parent.get_screen())
        except AttributeError:
            self.connect('destroy', lambda *w: gtk.main_quit())

        #self.set_title(self.__class__.__name__)
        self.set_default_size(800, 600)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_title("Hello App")

        merge = gtk.UIManager()
        self.set_data("ui-manager", merge)
        merge.insert_action_group(self.__create_action_group(), 0)
        self.add_accel_group(merge.get_accel_group())

        try:
            mergeid = merge.add_ui_from_string(ui_info)
        except gobject.GError, msg:
            print "Building menus failed: %s" % msg
Exemple #20
0
    def create_ui(self):
        self.ui = gtk.UIManager()
        accelgroup = self.ui.get_accel_group()
        actiongroup = gtk.ActionGroup("OutboxWindowActions")
        self.win.add_accel_group(accelgroup)
        obcuts = load_shortcuts("outbox")
        actions = [("Outbox", None, _("_Outbox")),
                   ("send_article", "xpn_send_queued_art",
                    _("_Send Queued Articles"), obcuts["send_article"],
                    _("Send Queued Articles"), self.sendQueuedArticles),
                   ("send_mail", "xpn_send_queued_mail",
                    _("Send Queued _Mails"), obcuts["send_mail"],
                    _("Send Queued Mails"), self.sendQueuedMails),
                   ("edit", "xpn_post", _("_Edit Article/Mail"),
                    obcuts["edit"], _("Edit Article/Mail"), self.openArticle),
                   ("delete", "xpn_delete",
                    _("_Delete Article/Mail"), obcuts["delete"],
                    _("Delete Article/Mail"), self.deleteArticle),
                   ("exit", "xpn_exit", _("_Exit"), obcuts["exit"], _("Exit"),
                    self.destroy)]

        for action in actions:
            if len(action) < 7:
                actiongroup.add_actions([action])
            else:
                actiongroup.add_actions([action[0:6]], action[6:])

        self.ui.insert_action_group(actiongroup, 0)
        merge_id = self.ui.add_ui_from_string(ui_string)
Exemple #21
0
    def __init__(self, edit_dialog):
        gtk.ScrolledWindow.__init__(self)
        self._edit_dialog = edit_dialog
        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        # The ListStore layout is (thumbnail, basename, full path).
        self._liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str)
        self._iconview = gtk.IconView(self._liststore)
        self._iconview.set_pixbuf_column(0)
        self._iconview.set_tooltip_column(1)
        self._iconview.set_reorderable(True)
        self._iconview.set_selection_mode(gtk.SELECTION_MULTIPLE)
        self._iconview.connect('button_press_event', self._button_press)
        self._iconview.connect('key_press_event', self._key_press)
        self._iconview.connect_after('drag_begin', self._drag_begin)
        self.add(self._iconview)

        self._ui_manager = gtk.UIManager()
        ui_description = """
        <ui>
            <popup name="Popup">
                <menuitem action="remove" />
            </popup>
        </ui>
        """
        self._ui_manager.add_ui_from_string(ui_description)
        actiongroup = gtk.ActionGroup('comix-edit-archive-image-area')
        actiongroup.add_actions([
            ('remove', gtk.STOCK_REMOVE, _('Remove from archive'), None, None,
                self._remove_pages)])
        self._ui_manager.insert_action_group(actiongroup, 0)
Exemple #22
0
 def __create_ui(self):
     self.__using_accels = True
     self.__ag = ag = gtk.ActionGroup('WindowActions')
     self.__actions = actions = [
         ('FileMenu', None, _('File')),
         ('DetachTab', None, _('_Detach Tab'), '<control><shift>D',
          'Move tab into new window', self.__detach_cb),
         ('TabSearch', None, '_Search Tabs', '<control><shift>L',
          'Search across tab names', self.__quickswitch_tab_cb),
         ('Close', gtk.STOCK_CLOSE, _('_Close'), '<control><shift>W',
          'Close the current tab', self.__close_cb),
         ('EditMenu', None, _('Edit')),
         ('Copy', 'gtk-copy', _('_Copy'), '<control><shift>C',
          'Copy selected text', self.__copy_cb),
         ('Paste', 'gtk-paste', _('_Paste'), '<control><shift>V',
          'Paste text', self.__paste_cb),
         ('ViewMenu', None, _('View')),
         ('ToolsMenu', None, _('Tools')),
         ('About', gtk.STOCK_ABOUT, _('_About'), None, 'About HotVTE',
          self.__help_about_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())
Exemple #23
0
    def _make_session_menu(self, sid, event):
        xml = """
<ui>
  <popup name="menu">
    <menuitem action="stop"/>
    <menuitem action="cancel"/>
    <menuitem action="restart"/>
  </popup>
</ui>
"""
        ag = gtk.ActionGroup("menu")

        actions = [("stop", _("Stop"), not event.is_final()),
                   ("cancel", _("Cancel"), not event.is_final()),
                   ("restart", _("Restart"), event.get_restart_info())]
        for action, label, sensitive in actions:
            a = gtk.Action(action, label, None, None)
            a.connect("activate", self._mh_xfer, event)
            a.set_sensitive(bool(sensitive))
            ag.add_action(a)

        uim = gtk.UIManager()
        uim.insert_action_group(ag, 0)
        uim.add_ui_from_string(xml)

        return uim.get_widget("/menu")
Exemple #24
0
    def __init__(self):
        gtk.Window.__init__(self)
        self.set_title('Dot Viewer')
        self.set_default_size(512, 512)
        vbox = gtk.VBox()
        self.add(vbox)

        self.graph = xdot.Graph()
        self.widget = xdot.DotWidget()
        self.uimanager = gtk.UIManager()

        accelgroup = self.uimanager.get_accel_group()
        self.add_accel_group(accelgroup)

        actiongroup = gtk.ActionGroup('Actions')
        actiongroup.add_actions((
            ('Reload', gtk.STOCK_REFRESH, None, None, None, self.on_reload),
            ('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),
        ))
        self.uimanager.insert_action_group(actiongroup, 0)

        self.uimanager.add_ui_from_string(self.ui)
        toolbar = self.uimanager.get_widget('/ToolBar')
        vbox.pack_start(toolbar, False)
        vbox.pack_start(self.widget)
        self.set_focus(self.widget)
        self.show_all()
Exemple #25
0
 def __init__(self):
   gtk.StatusIcon.__init__(self)
   menu = '''
     <ui>
      <menubar name="Menubar">
       <menu action="Menu">
        <menuitem action="Search"/>
        <menuitem action="Preferences"/>
        <separator/>
        <menuitem action="About"/>
       </menu>
      </menubar>
     </ui>
   '''
   actions = [
     ('Menu',  None, 'Menu'),
     ('Search', None, '_Search...', None, 'Search files with MetaTracker', self.on_activate),
     ('Preferences', gtk.STOCK_PREFERENCES, '_Preferences...', None, 'Change MetaTracker preferences', self.on_preferences),
     ('About', gtk.STOCK_ABOUT, '_About...', None, 'About MetaTracker', self.on_about)]
   ag = gtk.ActionGroup('Actions')
   ag.add_actions(actions)
   self.manager = gtk.UIManager()
   self.manager.insert_action_group(ag, 0)
   self.manager.add_ui_from_string(menu)
   self.menu = self.manager.get_object('/Menubar/Menu/About').props.parent
   search = self.manager.get_object('/Menubar/Menu/Search')
   search.get_children()[0].set_markup('<b>_Search...</b>')
   search.get_children()[0].set_use_underline(True)
   search.get_children()[0].set_use_markup(True)
   search.get_children()[1].set_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_MENU)
   self.set_from_stock(gtk.STOCK_FIND)
   self.set_tooltip('Tracker Desktop Search')
   self.set_visible(True)
   self.connect('activate', self.on_activate)
   self.connect('popup-menu', self.on_popup_menu)
Exemple #26
0
    def __init__(self, parent=None):
        gtk.Window.__init__(self)
        self.editors.add(self)
        try:
            self.set_screen(parent.get_screen())
        except AttributeError:
            self.connect('delete-event', self.close)

        self.set_title("odML Editor")
        self.set_default_size(800, 600)

        icons = load_icon_pixbufs("odml-logo")
        self.set_icon_list(*icons)

        merge = gtk.UIManager()
        merge.connect('connect-proxy', self.on_uimanager__connect_proxy)
        merge.connect('disconnect-proxy', self.on_uimanager__disconnect_proxy)
        self.set_data("ui-manager", merge)
        merge.insert_action_group(self.__create_action_group(), 0)
        self.add_accel_group(merge.get_accel_group())

        try:
            mergeid = merge.add_ui_from_string(ui_info)
        except gobject.GError, msg:
            print "building menus failed: %s" % msg
Exemple #27
0
	def __init__(self, parent=None):
		register_stock_icons()
		# Create the toplevel window
		gtk.Window.__init__(self)
		try:
			self.set_screen(parent.get_screen())
		except AttributeError:
			self.connect('destroy', lambda *w: gtk.main_quit())

		self.set_title("colupatr")
		self.set_default_size(640, 350)
		self.snipsdir = os.path.join(os.path.expanduser("~"),".oletoy")


		self.lebe = 0

		merge = gtk.UIManager()
		self.set_data("ui-manager", merge)
		merge.insert_action_group(self.__create_action_group(), 0)
		self.add_accel_group(merge.get_accel_group())

		try:
			mergeid = merge.add_ui_from_string(ui_info)
		except gobject.GError, msg:
			print("building menus failed: %s" % msg)
Exemple #28
0
 def create_menu(self):
     ui_string = """<ui>
     <menubar>
         <menu name='Commands' action='Commands'>
             <menuitem action='Search'/>
             <menuitem action='RunTerminal'/>
         </menu>
         <menu name='Configurations' action='Configurations'>
             <menuitem action='Config'/>
         </menu>
         <placeholder name='OtherMenus'/>
         <menu name='HelpMenu' action='HelpMenu'>
             <menuitem action='HelpAbout'/>
         </menu>
     </menubar>
     </ui>
     """
     actions = [
         ('Commands', None, '_Commands'),
         ('Search', gtk.STOCK_FIND, None, None, None, self.search_window),
         ('RunTerminal', gtk.STOCK_EXECUTE, _("Run terminal"), None, None,
          self.run_terminal),
         ('Configurations', None, '_Configurations'),
         ('Config', gtk.STOCK_PREFERENCES, None, None, None,
          self.config_window),
         ('HelpMenu', gtk.STOCK_HELP),
         ('HelpAbout', None, 'A_bout', None, None, self.help_about),
     ]
     self.ag = gtk.ActionGroup('edit')
     self.ag.add_actions(actions)
     self.ui = gtk.UIManager()
     self.ui.insert_action_group(self.ag, 0)
     self.ui.add_ui_from_string(ui_string)
     self.add_accel_group(self.ui.get_accel_group())
     return self.ui.get_widget('/menubar')
Exemple #29
0
    def __init__(self, project):
        gtk.StatusIcon.__init__(self)

        self.project = project

        menu = '''
            <ui>
             <menubar name="Menubar">
              <menu action="Menu">
               <separator/>
               <menuitem action="Quit"/>
              </menu>
             </menubar>
            </ui>
        '''
        actions = [
            ('Menu',  None, 'Menu'),
            ('Quit', gtk.STOCK_QUIT, '_Quit...', None, 'Quit Time Tracker', self.on_quit)]
        ag = gtk.ActionGroup('Actions')
        ag.add_actions(actions)
        self.manager = gtk.UIManager()
        self.manager.insert_action_group(ag, 0)
        self.manager.add_ui_from_string(menu)
        self.menu = self.manager.get_widget('/Menubar/Menu/Quit').props.parent

        self.set_from_icon_name("hamster-time-tracker")
        self.set_name(_('Time Tracker'))

        self.connect('activate', self.on_activate)
        self.connect('popup-menu', self.on_popup_menu)
Exemple #30
0
    def create_ui(self, window):
        """Creates the menubar"""
        ui_string = """<ui>
  <menubar name='Menubar'>
    <menu action='ArchivoMenu'>
      <menuitem action='Nuevo feed'/>
      <menuitem action='Nueva categoria'/>
      <menuitem action='Eliminar feed'/>
      <menuitem action='Eliminar categoria'/>
      <separator/>
      <menuitem action='Salir'/>
    </menu>
    <menu action='EditarMenu'>
      <menuitem action='Editar'/>
      <menuitem action='Preferencias'/>
    </menu>
    <menu action='RedMenu'>
      <menuitem action='Actualizar'/>
      <menuitem action='Actualizar todo'/>
    </menu>
    <menu action='AyudaMenu'>
      <menuitem action='Acerca de'/>
    </menu>
  </menubar>
</ui>"""

        # Una opción para que se muestren los iconos:
        # gconf-editor: Desktop -> Gnome -> Interface -> menus_have_icons (y buttons_have_icons)
        ag = gtk.ActionGroup('WindowActions')
        actions = [
            ('ArchivoMenu', None, '_Archivo'),
            ('Nuevo feed', gtk.STOCK_FILE, 'Nuevo _feed', '<control>F',
             'Crea un feed', self.add_feed),
            ('Nueva categoria', gtk.STOCK_DIRECTORY, 'Nueva _categoria',
             '<control>C', 'Crea una categoria', self.add_category),
            ('Eliminar feed', gtk.STOCK_CLEAR, 'Eliminar _feed', '<alt>F',
             'Elimina un feed', self.delete_feed),
            ('Eliminar categoria', gtk.STOCK_CLOSE, 'Eliminar _categoria',
             '<alt>C', 'Elimina una categoria', self.delete_category),
            ('Salir', gtk.STOCK_QUIT, '_Salir', '<control>S', 'Salir',
             self.delete_event),
            ('EditarMenu', None, '_Editar'),
            ('Editar', gtk.STOCK_EDIT, '_Editar', '<control>E',
             'Edita el elemento seleccionado', self.edit),
            ('Preferencias', gtk.STOCK_EXECUTE, '_Preferencias', '<control>P',
             'Muestra las preferencias', self.callback),
            ('RedMenu', None, '_Red'),
            ('Actualizar', None, '_Actualizar', '<control>A',
             'Actualiza el feed seleccionado', self.callback),
            ('Actualizar todo', gtk.STOCK_REFRESH, 'Actualiza_r todo',
             '<control>R', 'Actualiza todos los feeds', self.callback),
            ('AyudaMenu', None, 'A_yuda'),
            ('Acerca de', gtk.STOCK_ABOUT, 'Acerca de', None, 'Acerca de',
             self.help_about),
        ]
        ag.add_actions(actions)
        self.ui = gtk.UIManager()
        self.ui.insert_action_group(ag, 0)
        self.ui.add_ui_from_string(ui_string)
        self.window.add_accel_group(self.ui.get_accel_group())