changeset 1303:cf2691a18a7a

Add component dock
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 19 Jan 2011 14:52:29 +0800
parents c53331c55a23
children 94e6594dea59
files pyink/MBScene.py pyink/comp_dock.py pyink/component_dock.glade
diffstat 3 files changed, 223 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/MBScene.py	Wed Jan 19 10:01:09 2011 +0800
+++ b/pyink/MBScene.py	Wed Jan 19 14:52:29 2011 +0800
@@ -58,6 +58,7 @@
 	self.desktop = desktop
 	self.window = win
 	self.top = None
+	self._comp_dock = None
 	self.last_update = None
 	pybInkscape.inkscape.connect('change_selection', self.do_selection)
 	self.last_select = None
@@ -355,6 +356,8 @@
 	pass
 
     def show(self):
+	from comp_dock import comp_dock
+	
 	self.OK = True
 	if not self._root:
 	    self._root = self.desktop.doc().root().repr
@@ -383,6 +386,10 @@
 	self._add_buttons(hbox)
 	vbox.pack_start(hbox, expand=False)
 
+	dock = comp_dock()
+	dock.install_dock(self.desktop)
+	self._comp_dock = dock
+
 	self.top.show_all()
 	self.last_update = None
 	return False
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyink/comp_dock.py	Wed Jan 19 14:52:29 2011 +0800
@@ -0,0 +1,43 @@
+import gtk
+import os
+
+## \brief User interface for management components and their timelines.
+#
+class comp_dock(gtk.VBox):
+    def __init__(self, fname=None):
+        super(comp_dock, self).__init__()
+        
+        if not fname:
+            dirname = os.path.dirname(__file__)
+            fname = os.path.join(dirname, 'component_dock.glade')
+            print fname
+            pass
+
+        builder = gtk.Builder()
+        builder.add_from_file(fname)
+        dock_top = builder.get_object('component_dock_top')
+        dock_top_parent = dock_top.get_parent()
+        dock_top_parent.remove(dock_top)
+        self.pack_start(dock_top)
+        dock_top.show()
+
+        self._builder = builder
+        self._dock_top = dock_top
+        self._desktop = None
+        self._dock_item = None
+        pass
+
+    def install_dock(self, desktop):
+        self._desktop = desktop
+
+        dock = desktop.getDock()
+        item = dock.new_item('component_dock',
+                             'Component and timeline manager',
+                             'feBlend-icon', dock.ITEM_ST_DOCKED_STATE)
+        item_vbox = item.get_vbox()
+        item_vbox.pack_start(self)
+        self._dock_item = item
+        
+        self.show()
+        pass
+    pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyink/component_dock.glade	Wed Jan 19 14:52:29 2011 +0800
@@ -0,0 +1,173 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="window1">
+    <child>
+      <object class="GtkVBox" id="component_dock_top">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkVBox" id="vbox2">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="xpad">5</property>
+                <property name="label" translatable="yes">Components</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkTreeView" id="treeview_components">
+                <property name="height_request">100</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHButtonBox" id="hbuttonbox1">
+                <property name="visible">True</property>
+                <property name="spacing">5</property>
+                <property name="layout_style">start</property>
+                <child>
+                  <object class="GtkButton" id="add_comp">
+                    <property name="label">gtk-add</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="remove_comp">
+                    <property name="label">gtk-remove</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="padding">1</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHSeparator" id="hseparator1">
+            <property name="visible">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">5</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox3">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="xpad">5</property>
+                <property name="label" translatable="yes">Actions / timelines</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkTreeView" id="treeview_timelines">
+                <property name="height_request">100</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHButtonBox" id="hbuttonbox2">
+                <property name="visible">True</property>
+                <property name="spacing">5</property>
+                <property name="layout_style">start</property>
+                <child>
+                  <object class="GtkButton" id="add_timline">
+                    <property name="label">gtk-add</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="remove_timeline">
+                    <property name="label">gtk-remove</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="padding">2</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GtkActionGroup" id="actiongroup1"/>
+  <object class="GtkActionGroup" id="actiongroup2"/>
+  <object class="GtkActionGroup" id="actiongroup3"/>
+</interface>