[gedit-latex] Load the meun/toolbar ui from a gtkbuilder file
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-latex] Load the meun/toolbar ui from a gtkbuilder file
- Date: Wed, 29 Jun 2011 06:36:15 +0000 (UTC)
commit 0f688e91742861cc1e54e25c0e7768d2792e839b
Author: John Stowers <john stowers gmail com>
Date: Wed Jun 29 16:39:43 2011 +1200
Load the meun/toolbar ui from a gtkbuilder file
data/ui/Makefile.am | 1 +
data/ui/ui.builder | 89 +++++++++++++++++++++++++++++++++++++
latex/base/config.py | 92 ---------------------------------------
latex/base/windowactivatable.py | 8 ++--
4 files changed, 94 insertions(+), 96 deletions(-)
---
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index 54678a9..4c295d6 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -1,6 +1,7 @@
plugindir = $(datadir)/gedit/plugins/latex/ui
plugin_DATA = \
+ ui.builder \
build_image_dialog.ui \
choose_master_dialog.ui \
configure.ui \
diff --git a/data/ui/ui.builder b/data/ui/ui.builder
new file mode 100644
index 0000000..247a88f
--- /dev/null
+++ b/data/ui/ui.builder
@@ -0,0 +1,89 @@
+<ui>
+ <menubar name="MenuBar">
+ <menu name="FileMenu" action="File">
+ <placeholder name="FileOps_1">
+ <menuitem action="LaTeXNewAction" />
+ </placeholder>
+ <placeholder name="FileOps_3">
+ <menuitem action="LaTeXSaveAsTemplateAction" />
+ </placeholder>
+ </menu>
+ <placeholder name="ExtraMenu_1">
+ <menu action="LaTeXMenuAction">
+ <menuitem action="LaTeXChooseMasterAction" />
+ <separator />
+ <menuitem action="LaTeXGraphicsAction" />
+ <menuitem action="LaTeXTableAction" />
+ <menuitem action="LaTeXListingAction" />
+ <menuitem action="LaTeXUseBibliographyAction" />
+ <separator />
+ <menuitem action="LaTeXCloseEnvironmentAction" />
+ <separator />
+ <menuitem action="LaTeXBuildImageAction" />
+ </menu>
+ <menu action="BibTeXMenuAction">
+ <menuitem action="BibTeXNewEntryAction" />
+ </menu>
+ </placeholder>
+ </menubar>
+ <toolbar name="LaTeXToolbar">
+ <toolitem action="LaTeXFontFamilyAction">
+ <menu action="LaTeXFontFamilyMenuAction">
+ <menuitem action="LaTeXBoldAction" />
+ <menuitem action="LaTeXItalicAction" />
+ <menuitem action="LaTeXEmphasizeAction" />
+ <menuitem action="LaTeXUnderlineAction" />
+ <menuitem action="LaTeXSmallCapitalsAction" />
+ <menuitem action="LaTeXRomanAction" />
+ <menuitem action="LaTeXSansSerifAction" />
+ <menuitem action="LaTeXTypewriterAction" />
+ <separator />
+ <menuitem action="LaTeXBlackboardBoldAction" />
+ <menuitem action="LaTeXCaligraphyAction" />
+ <menuitem action="LaTeXFrakturAction" />
+ </menu>
+ </toolitem>
+ <toolitem action="LaTeXJustifyLeftAction" />
+ <toolitem action="LaTeXJustifyCenterAction" />
+ <toolitem action="LaTeXJustifyRightAction" />
+ <separator />
+ <toolitem action="LaTeXItemizeAction" />
+ <toolitem action="LaTeXEnumerateAction" />
+ <toolitem action="LaTeXDescriptionAction" />
+ <separator />
+ <toolitem action="LaTeXStructureAction">
+ <menu action="LaTeXStructureMenuAction">
+ <menuitem action="LaTeXPartAction" />
+ <menuitem action="LaTeXChapterAction" />
+ <separator />
+ <menuitem action="LaTeXSectionAction" />
+ <menuitem action="LaTeXSubsectionAction" />
+ <menuitem action="LaTeXParagraphAction" />
+ <menuitem action="LaTeXSubparagraphAction" />
+ </menu>
+ </toolitem>
+ <separator />
+ <toolitem action="LaTeXMathAction">
+ <menu action="LaTeXMathMenuAction">
+ <menuitem action="LaTeXMathAction" />
+ <menuitem action="LaTeXDisplayMathAction" />
+ <menuitem action="LaTeXEquationAction" />
+ <menuitem action="LaTeXUnEqnArrayAction" />
+ <menuitem action="LaTeXEqnArrayAction" />
+ </menu>
+ </toolitem>
+ <separator />
+ <toolitem action="LaTeXGraphicsAction" />
+ <toolitem action="LaTeXTableAction" />
+ <toolitem action="LaTeXListingAction" />
+ <toolitem action="LaTeXUseBibliographyAction" />
+ <separator />
+ <toolitem action="LaTeXBuildAction">
+ <menu action="LaTeXBuildMenuAction">
+ <menuitem action="LaTeXBuildImageAction" />
+ <placeholder name="LaTeXBuildPlaceholder_1" />
+ </menu>
+ </toolitem>
+ </toolbar>
+</ui>
+
diff --git a/latex/base/config.py b/latex/base/config.py
index ce7f614..78b01f0 100644
--- a/latex/base/config.py
+++ b/latex/base/config.py
@@ -22,98 +22,6 @@
base.config
"""
-# ui definition
-
-UI = """
- <ui>
- <menubar name="MenuBar">
- <menu name="FileMenu" action="File">
- <placeholder name="FileOps_1">
- <menuitem action="LaTeXNewAction" />
- </placeholder>
- <placeholder name="FileOps_3">
- <menuitem action="LaTeXSaveAsTemplateAction" />
- </placeholder>
- </menu>
- <placeholder name="ExtraMenu_1">
- <menu action="LaTeXMenuAction">
- <menuitem action="LaTeXChooseMasterAction" />
- <separator />
- <menuitem action="LaTeXGraphicsAction" />
- <menuitem action="LaTeXTableAction" />
- <menuitem action="LaTeXListingAction" />
- <menuitem action="LaTeXUseBibliographyAction" />
- <separator />
- <menuitem action="LaTeXCloseEnvironmentAction" />
- <separator />
- <menuitem action="LaTeXBuildImageAction" />
- </menu>
- <menu action="BibTeXMenuAction">
- <menuitem action="BibTeXNewEntryAction" />
- </menu>
- </placeholder>
- </menubar>
- <toolbar name="LaTeXToolbar">
- <toolitem action="LaTeXFontFamilyAction">
- <menu action="LaTeXFontFamilyMenuAction">
- <menuitem action="LaTeXBoldAction" />
- <menuitem action="LaTeXItalicAction" />
- <menuitem action="LaTeXEmphasizeAction" />
- <menuitem action="LaTeXUnderlineAction" />
- <menuitem action="LaTeXSmallCapitalsAction" />
- <menuitem action="LaTeXRomanAction" />
- <menuitem action="LaTeXSansSerifAction" />
- <menuitem action="LaTeXTypewriterAction" />
- <separator />
- <menuitem action="LaTeXBlackboardBoldAction" />
- <menuitem action="LaTeXCaligraphyAction" />
- <menuitem action="LaTeXFrakturAction" />
- </menu>
- </toolitem>
- <toolitem action="LaTeXJustifyLeftAction" />
- <toolitem action="LaTeXJustifyCenterAction" />
- <toolitem action="LaTeXJustifyRightAction" />
- <separator />
- <toolitem action="LaTeXItemizeAction" />
- <toolitem action="LaTeXEnumerateAction" />
- <toolitem action="LaTeXDescriptionAction" />
- <separator />
- <toolitem action="LaTeXStructureAction">
- <menu action="LaTeXStructureMenuAction">
- <menuitem action="LaTeXPartAction" />
- <menuitem action="LaTeXChapterAction" />
- <separator />
- <menuitem action="LaTeXSectionAction" />
- <menuitem action="LaTeXSubsectionAction" />
- <menuitem action="LaTeXParagraphAction" />
- <menuitem action="LaTeXSubparagraphAction" />
- </menu>
- </toolitem>
- <separator />
- <toolitem action="LaTeXMathAction">
- <menu action="LaTeXMathMenuAction">
- <menuitem action="LaTeXMathAction" />
- <menuitem action="LaTeXDisplayMathAction" />
- <menuitem action="LaTeXEquationAction" />
- <menuitem action="LaTeXUnEqnArrayAction" />
- <menuitem action="LaTeXEqnArrayAction" />
- </menu>
- </toolitem>
- <separator />
- <toolitem action="LaTeXGraphicsAction" />
- <toolitem action="LaTeXTableAction" />
- <toolitem action="LaTeXListingAction" />
- <toolitem action="LaTeXUseBibliographyAction" />
- <separator />
- <toolitem action="LaTeXBuildAction">
- <menu action="LaTeXBuildMenuAction">
- <menuitem action="LaTeXBuildImageAction" />
- <placeholder name="LaTeXBuildPlaceholder_1" />
- </menu>
- </toolitem>
- </toolbar>
- </ui>"""
-
# actions
from ..latex.actions import LaTeXMenuAction, LaTeXNewAction, LaTeXChooseMasterAction, \
diff --git a/latex/base/windowactivatable.py b/latex/base/windowactivatable.py
index 77e026f..a47cc2d 100644
--- a/latex/base/windowactivatable.py
+++ b/latex/base/windowactivatable.py
@@ -33,10 +33,10 @@ from ..preferences.dialog import PreferencesDialog
from ..preferences.tools import ToolPreferences
from ..tools import ToolAction
from ..tools.views import ToolView
-from config import UI, WINDOW_SCOPE_VIEWS, EDITOR_SCOPE_VIEWS, ACTIONS
+from .config import WINDOW_SCOPE_VIEWS, EDITOR_SCOPE_VIEWS, ACTIONS
+from .decorators import GeditTabDecorator
+from .resources import find_resource
from . import File, SideView, BottomView, WindowContext
-from decorators import GeditTabDecorator
-
class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Configurable):
__gtype_name__ = "LaTeXWindowActivatable"
@@ -216,7 +216,7 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
# merge ui
self._ui_manager.insert_action_group(self._action_group, -1)
- self._ui_id = self._ui_manager.add_ui_from_string(UI)
+ self._ui_id = self._ui_manager.add_ui_from_file(find_resource("ui/ui.builder"))
# hook the toolbar
self._toolbar = self._ui_manager.get_widget("/LaTeXToolbar")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]