Mercurial > MadButterfly
annotate pyink/pyink.py @ 1324:740b3239030e
Clear dup group before running animation.
User may change content of groups. TweenObject would not aware the
changes if we don't clear the dup group before running animation.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 30 Jan 2011 20:03:21 +0800 |
parents | ffbbd3aa218d |
children | 0a2034f490e5 |
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 |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
30 print hash(desktop) |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
31 pass |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
32 |
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 ## \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
|
35 # |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
36 def act_desktop(inkscape, ptr): |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
37 # 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
|
38 desktop = pybInkscape.GPointer_2_PYSPDesktop(ptr) |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
39 |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
40 top = desktop.getToplevel() |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
41 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
|
42 return |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
43 |
1323
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
44 if desktop in all_desktop_mbscenes: |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
45 return # already initialized |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
46 |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
47 _init_mbscene(inkscape, ptr) |
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
48 pass |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
49 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
50 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
51 def pyink_start(): |
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) |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
53 pass |
1323
ffbbd3aa218d
Make a component from a group.
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
54 |
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 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
|
57 print hash(view) |
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 |