annotate pyink/comp_dock.py @ 1303:cf2691a18a7a

Add component dock
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 19 Jan 2011 14:52:29 +0800
parents
children 94e6594dea59
rev   line source
1303
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
1 import gtk
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
2 import os
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
3
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
4 ## \brief User interface for management components and their timelines.
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
5 #
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
6 class comp_dock(gtk.VBox):
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
7 def __init__(self, fname=None):
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
8 super(comp_dock, self).__init__()
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
9
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
10 if not fname:
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
11 dirname = os.path.dirname(__file__)
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
12 fname = os.path.join(dirname, 'component_dock.glade')
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
13 print fname
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
14 pass
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
15
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
16 builder = gtk.Builder()
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
17 builder.add_from_file(fname)
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
18 dock_top = builder.get_object('component_dock_top')
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
19 dock_top_parent = dock_top.get_parent()
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
20 dock_top_parent.remove(dock_top)
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
21 self.pack_start(dock_top)
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
22 dock_top.show()
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
23
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
24 self._builder = builder
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
25 self._dock_top = dock_top
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
26 self._desktop = None
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
27 self._dock_item = None
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
28 pass
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
29
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
30 def install_dock(self, desktop):
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
31 self._desktop = desktop
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
32
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
33 dock = desktop.getDock()
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
34 item = dock.new_item('component_dock',
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
35 'Component and timeline manager',
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
36 'feBlend-icon', dock.ITEM_ST_DOCKED_STATE)
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
37 item_vbox = item.get_vbox()
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
38 item_vbox.pack_start(self)
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
39 self._dock_item = item
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
40
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
41 self.show()
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
42 pass
cf2691a18a7a Add component dock
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
43 pass