annotate pyink/comp_dock.py @ 1305:573a51b1eb37

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