[pitivi] timeline: Move UI data to xml file



commit 4338bb089e293fcb88b4e9aabc95b22434e3f69a
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun Jan 12 01:14:51 2014 +0100

    timeline: Move UI data to xml file

 data/ui/Makefile.am           |    1 +
 data/ui/mainwindow.xml        |    4 ---
 data/ui/timelinecontainer.xml |   44 +++++++++++++++++++++++++++++++
 pitivi/timeline/timeline.py   |   58 +++-------------------------------------
 4 files changed, 50 insertions(+), 57 deletions(-)
---
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index 8c54e29..c78335a 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -14,6 +14,7 @@ ui_DATA = \
        renderingdialog.ui \
        renderingprogress.ui \
        startupwizard.ui \
+       timelinecontainer.xml \
        titleeditor.ui \
        $(NULL)
 
diff --git a/data/ui/mainwindow.xml b/data/ui/mainwindow.xml
index 3545fb3..c605dc0 100644
--- a/data/ui/mainwindow.xml
+++ b/data/ui/mainwindow.xml
@@ -53,9 +53,5 @@
     <separator />
     <toolitem action="FullScreen" />
   </toolbar>
-  <toolbar name="TimelineToolBar">
-        <placeholder name="Timeline" />
-        <separator />
-  </toolbar>
   <accelerator action="RenderProject" />
 </ui>
diff --git a/data/ui/timelinecontainer.xml b/data/ui/timelinecontainer.xml
new file mode 100644
index 0000000..ffb6b8e
--- /dev/null
+++ b/data/ui/timelinecontainer.xml
@@ -0,0 +1,44 @@
+<ui>
+  <menubar name="MainMenuBar">
+    <menu action="View">
+      <placeholder name="Timeline">
+        <menuitem action="ZoomIn" />
+        <menuitem action="ZoomOut" />
+        <menuitem action="ZoomFit" />
+      </placeholder>
+    </menu>
+    <menu action="Timeline">
+      <placeholder name="Timeline">
+        <menuitem action="Split" />
+        <menuitem action="DeleteObj" />
+        <separator />
+        <menuitem action="GroupObj" />
+        <menuitem action="UngroupObj" />
+        <menuitem action="AlignObj" />
+        <separator />
+        <menuitem action="Keyframe" />
+        <menuitem action="Prevkeyframe" />
+        <menuitem action="Nextkeyframe" />
+        <separator />
+        <menuitem action="PlayPause" />
+        <menuitem action="Screenshot" />
+      </placeholder>
+    </menu>
+  </menubar>
+  <toolbar name="TimelineToolBar">
+    <placeholder name="Timeline">
+      <separator />
+      <toolitem action="Split" />
+      <toolitem action="DeleteObj" />
+      <toolitem action="GroupObj" />
+      <toolitem action="UngroupObj" />
+      <toolitem action="AlignObj" />
+    </placeholder>
+  </toolbar>
+  <accelerator action="PlayPause" />
+  <accelerator action="DeleteObj" />
+  <accelerator action="ControlEqualAccel" />
+  <accelerator action="ControlKPAddAccel" />
+  <accelerator action="ControlKPSubtractAccel" />
+  <accelerator action="Keyframe" />
+</ui>
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 5c85c40..1d01757 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -20,7 +20,6 @@
 # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import sys
 import os
 
 import gi
@@ -32,10 +31,11 @@ from gi.repository import Gst, GES, GObject, Clutter, Gtk, GLib, Gdk
 
 from pitivi.autoaligner import AlignmentProgressDialog, AutoAligner
 from pitivi.check import at_least_version
-from pitivi.utils.timeline import Zoomable, Selection, SELECT, TimelineError
-from pitivi.settings import GlobalSettings
+from pitivi.configure import get_ui_dir
 from pitivi.dialogs.prefs import PreferencesDialog
+from pitivi.settings import GlobalSettings
 from pitivi.utils.loggable import Loggable
+from pitivi.utils.timeline import Zoomable, Selection, SELECT, TimelineError
 from pitivi.utils.ui import EXPANDED_SIZE, SPACING, PLAYHEAD_WIDTH, CONTROL_WIDTH, TYPE_PITIVI_EFFECT
 from pitivi.utils.widgets import ZoomBox
 
@@ -93,53 +93,6 @@ SELECTION_MARQUEE_COLOR = Clutter.Color.new(100, 100, 100, 200)
 PLAYHEAD_COLOR = Clutter.Color.new(200, 0, 0, 255)
 SNAPPING_INDICATOR_COLOR = Clutter.Color.new(50, 150, 200, 200)
 
-ui = '''
-<ui>
-    <menubar name="MainMenuBar">
-        <menu action="View">
-            <placeholder name="Timeline">
-                <menuitem action="ZoomIn" />
-                <menuitem action="ZoomOut" />
-                <menuitem action="ZoomFit" />
-            </placeholder>
-        </menu>
-        <menu action="Timeline">
-            <placeholder name="Timeline">
-                <menuitem action="Split" />
-                <menuitem action="DeleteObj" />
-                <separator />
-                <menuitem action="GroupObj" />
-                <menuitem action="UngroupObj" />
-                <menuitem action="AlignObj" />
-                <separator />
-                <menuitem action="Keyframe" />
-                <menuitem action="Prevkeyframe" />
-                <menuitem action="Nextkeyframe" />
-                <separator />
-                <menuitem action="PlayPause" />
-                <menuitem action="Screenshot" />
-            </placeholder>
-        </menu>
-    </menubar>
-    <toolbar name="TimelineToolBar">
-        <placeholder name="Timeline">
-            <separator />
-            <toolitem action="Split" />
-            <toolitem action="DeleteObj" />
-            <toolitem action="GroupObj" />
-            <toolitem action="UngroupObj" />
-            <toolitem action="AlignObj" />
-        </placeholder>
-    </toolbar>
-    <accelerator action="PlayPause" />
-    <accelerator action="DeleteObj" />
-    <accelerator action="ControlEqualAccel" />
-    <accelerator action="ControlKPAddAccel" />
-    <accelerator action="ControlKPSubtractAccel" />
-    <accelerator action="Keyframe" />
-</ui>
-'''
-
 
 """
 Convention throughout this file:
@@ -709,8 +662,9 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
         self.pipeline = None
         self.bTimeline = None
 
-        self._createUi()
+        self.ui_manager.add_ui_from_file(os.path.join(get_ui_dir(), "timelinecontainer.xml"))
         self._createActions()
+        self._createUi()
 
         self._setUpDragAndDrop()
 
@@ -1066,8 +1020,6 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
         self.playhead_actions.add_actions(playhead_actions)
         self.ui_manager.insert_action_group(self.playhead_actions, -1)
 
-        self.ui_manager.add_ui_from_string(ui)
-
     def _updateScrollPosition(self, adjustment):
         self._scroll_pos_ns = Zoomable.pixelToNs(self.hadj.get_value())
         point = Clutter.Point()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]