Re: [gedit-list] Custom menu-bar (and toolbar)items. (Solved)
- From: arcachofo <santigoro gmail com>
- To: gedit-list gnome org
- Subject: Re: [gedit-list] Custom menu-bar (and toolbar)items. (Solved)
- Date: Fri, 19 Jun 2009 11:40:04 -0700 (PDT)
Example: a new menu-bar entry with 2 items, 2 new toolbar items:
................
ui_str = """<ui>
<menubar name="MenuBar">
<placeholder name="menu_2">
<separator />
<separator />
<menu name="PIC" action="PIC">
<menuitem name="Configurar" action="Configurar"/>
<separator />
<menuitem name="Borrar_PIC" action="Borrar_PIC" />
</menu>
</placeholder>
</menubar>
<toolbar name="ToolBar">
<separator />
<toolitem name="Conectar_PIC" action="Conectar_PIC" />
<toolitem name="Grabar_PIC" action="Grabar_PIC" />
</toolbar>
</ui>
"""
...............
...............
def _insert_menu(self, window):
# Get the GtkUIManager
self._manager = self.window.get_ui_manager()
# Create a new action group
self._action_group = gtk.ActionGroup("PICPluginActions")
self._action_group.add_actions([("PIC", gtk.STOCK_EXECUTE, "PIC"),
("Configurar", gtk.STOCK_PREFERENCES,
_("Configuracion"), None,
_("configurar programador, compilador y modelo de
PIC"),
self.on_configurar)])
self._action_group.add_actions([("Borrar_PIC", gtk.STOCK_CLOSE,
_("Borrar PIC"), None,
_("Borrar el PIC"),
self.on_borrar)])
self._action_group.add_actions([("Conectar_PIC", gtk.STOCK_CONNECT,
_("Conect"), None,
_("conectar con el PIC, reconocer modelo de PIC"),
self.on_conectar)])
self._action_group.add_actions([("Grabar_PIC",
gtk.STOCK_GOTO_BOTTOM,
_("Grabar"), None,
_("Grabar archivo actual al PIC"),
self.on_grabar)])
# Insert the action group
self._manager.insert_action_group(self._action_group, -1)
# Merge the UI
self._ui_id = self._manager.add_ui_from_string(ui_str)
--
View this message in context: http://www.nabble.com/Custom-menu-bar-%28and-toolbar%29items.-%28Solved%29-tp23982702p24116848.html
Sent from the Gnome - Gedit mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]