annotate pyink/pyink.py @ 1529:af8dd27bf450

Remove layer from button
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 31 Aug 2011 22:30:02 +0800
parents 599b606c4669
children
rev   line source
1150
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
1 import os
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
2
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
3 try:
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
4 if os.environ['PYINK_DBG_ENABLE'] == 'yes':
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
5 import pdb
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
6 pdb.set_trace()
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
7 pass
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
8 pass
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
9 except:
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
10 pass
6586cd10c92f Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents: 943
diff changeset
11
941
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
12 import pybInkscape
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
13 import pygtk
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
14 import gtk
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
15 from MBScene import *
1323
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
16
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
17 all_desktop_mbscenes = {}
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
18
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
19 def _init_mbscene(inkscape, ptr):
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
20 global all_desktop_mbscenes
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
21
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
22 desktop = pybInkscape.GPointer_2_PYSPDesktop(ptr)
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
23
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
24 top = desktop.getToplevel()
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
25 mbscene = MBScene(desktop,top)
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
26 mbscene.show()
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
27
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
28 all_desktop_mbscenes[desktop] = mbscene
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
29 pass
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
30
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
31
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
32 ## \brief Handler for events of activating a desktop.
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
33 #
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
34 def act_desktop(inkscape, ptr):
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
35 # Get Python wrapper of SPDesktop passed by ptr.
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
36 desktop = pybInkscape.GPointer_2_PYSPDesktop(ptr)
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
37
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
38 top = desktop.getToplevel()
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
39 if not top: # has not top window.
941
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
40 return
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
41
1323
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
42 if desktop in all_desktop_mbscenes:
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
43 return # already initialized
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
44
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
45 _init_mbscene(inkscape, ptr)
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
46 pass
941
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
47
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
48
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
49 def pyink_start():
1341
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents: 1326
diff changeset
50 import extensions
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents: 1326
diff changeset
51
1323
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
52 pybInkscape.inkscape.connect('activate_desktop', act_desktop)
1341
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents: 1326
diff changeset
53 extensions.initial()
941
9ba94c577a6f Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff changeset
54 pass
1323
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
55
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
56
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
57 def pyink_context_menu(view, item, menu_factory):
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
58 if view in all_desktop_mbscenes:
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
59 mbscene = all_desktop_mbscenes[view]
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
60 mbscene.context_menu(item, menu_factory)
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
61 pass
ffbbd3aa218d Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents: 1150
diff changeset
62 pass