Mercurial > MadButterfly
annotate pyink/frameline.py @ 1532:4a92b639a1cd
Clear selection set when switching current scene.
To clear selection set after switching away from current to another scene.
It avoids Inkscape select on nodes they are not saw after switching.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 30 Sep 2011 12:31:33 +0800 |
parents | 45e9566ea5c0 |
children | 9aff42a7e2b9 |
rev | line source |
---|---|
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
1 # -*- indent-tabs-mode: t; tab-width: 8; python-indent: 4; fill-column: 79 -*- |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
2 # vim: sw=4:ts=8:sts=4:textwidth=79 |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
3 import pygtk |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
4 pygtk.require("2.0") |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
5 import gtk |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
6 import gtk.gdk |
949
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
7 import pango |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
8 import gobject |
1221
33aa2d63e240
When we select a new object, search the scene group which contain it and make it as the active frame.
wycc
parents:
1217
diff
changeset
|
9 import traceback |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
10 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
11 def color_to_rgb(v): |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
12 return (((v >> 16) & 0xff) * 65535 / 0xff, |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
13 ((v >> 8) & 0xff) * 65535 / 0xff, |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
14 (v & 0xff) * 65535 / 0xff) |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
15 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
16 class keyframe(object): |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
17 def __init__(self, frame_idx): |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
18 self.idx = frame_idx |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
19 self.left_tween = False |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
20 self.right_tween = False |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
21 self.right_tween_type = 0 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
22 self.ref = '' |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
23 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
24 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
25 |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
26 class frameruler(gtk.DrawingArea): |
952
88bf64efcc1d
rename _type_id to _type, it is GGbject type actually
Thinker K.F. Li <thinker@codemud.net>
parents:
951
diff
changeset
|
27 _type = 0 |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
28 _frame_width = 10 # Width for each frame is 10 pixels |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
29 _mark_color = 0x808080 # color of mark lines |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
30 _number_color = 0x000000 # color of frame number |
949
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
31 _number_sz = 8 # font size of frame number |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
32 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
33 def __new__(clz, *args): |
952
88bf64efcc1d
rename _type_id to _type, it is GGbject type actually
Thinker K.F. Li <thinker@codemud.net>
parents:
951
diff
changeset
|
34 if not frameruler._type: |
88bf64efcc1d
rename _type_id to _type, it is GGbject type actually
Thinker K.F. Li <thinker@codemud.net>
parents:
951
diff
changeset
|
35 frameruler._type = gobject.type_register(frameruler) |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
36 pass |
952
88bf64efcc1d
rename _type_id to _type, it is GGbject type actually
Thinker K.F. Li <thinker@codemud.net>
parents:
951
diff
changeset
|
37 fr = gobject.new(frameruler._type) |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
38 return fr |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
39 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
40 def __init__(self, num_frames=20): |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
41 self.connect('expose_event', self._fr_expose) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
42 self._num_frames = num_frames |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
43 pass |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
44 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
45 def _fr_expose(self, widget, event): |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
46 self.update() |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
47 pass |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
48 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
49 def queue_draw(self): |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
50 print 'queue_draw' |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
51 self.update() |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
52 pass |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
53 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
54 def queue_draw_area(self, x, y, w, h): |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
55 print 'queue_draw_area' |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
56 pass |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
57 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
58 def update(self): |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
59 win = self.window |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
60 w_x, w_y, w_w, w_h, depth = win.get_geometry() |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
61 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
62 gc = gtk.gdk.GC(win) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
63 |
949
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
64 # |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
65 # Set color of mark lines |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
66 # |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
67 color_rgb = color_to_rgb(self._mark_color) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
68 color = gtk.gdk.Color(*color_rgb) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
69 gc.set_rgb_fg_color(color) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
70 |
949
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
71 # |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
72 # Mark mark lines |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
73 # |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
74 mark_h = w_h / 10 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
75 for i in range(self._num_frames): |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
76 mark_x = (i + 1) * self._frame_width |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
77 win.draw_line(gc, mark_x, 0, mark_x, mark_h) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
78 win.draw_line(gc, mark_x, w_h - mark_h - 1, mark_x, w_h - 1) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
79 pass |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
80 |
950
1bb0780f1036
Add more border line to frameline and frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
949
diff
changeset
|
81 win.draw_line(gc, 0, w_h - 1, w_w, w_h -1) |
1bb0780f1036
Add more border line to frameline and frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
949
diff
changeset
|
82 |
949
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
83 # |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
84 # Set color of frame number |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
85 # |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
86 color_rgb = color_to_rgb(self._number_color) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
87 color = gtk.gdk.Color(*color_rgb) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
88 gc.set_rgb_fg_color(color) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
89 |
949
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
90 font_desc = pango.FontDescription() |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
91 font_desc.set_size(self._number_sz * pango.SCALE) |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
92 |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
93 number_y = (w_h - self._number_sz) / 2 |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
94 |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
95 # |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
96 # Draw frame number |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
97 # |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
98 layout = self.create_pango_layout('1') |
949
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
99 layout.set_font_description(font_desc) |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
100 win.draw_layout(gc, 0, number_y, layout) |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
101 for i in range(4, self._num_frames, 5): |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
102 mark_x = i * self._frame_width |
949
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
103 layout.set_text(str(i + 1)) |
c9bf47cc621f
Set font size for frame number in frameruler
Thinker K.F. Li <thinker@codemud.net>
parents:
948
diff
changeset
|
104 win.draw_layout(gc, mark_x, number_y, layout) |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
105 pass |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
106 pass |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
107 pass |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
108 |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
109 ## \brief Drawing on the screen for a frameline. |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
110 # |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
111 # This class contain all functions that drawing thing on the screen for a |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
112 # frameline. It is used by descendants to drawing a frameline. This class is |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
113 # only responsible to draw screen, the logical part is the responsible of |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
114 # deriving classes. |
953
2346d3238e03
frame-button-press event of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
952
diff
changeset
|
115 # |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
116 # This class should only include functions about drawing, no any control, logic |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
117 # function, and state should be implemented here. This class should change/or |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
118 # read states of instances. It is stateless. |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
119 # |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
120 class frameline_draw(gtk.DrawingArea): |
952
88bf64efcc1d
rename _type_id to _type, it is GGbject type actually
Thinker K.F. Li <thinker@codemud.net>
parents:
951
diff
changeset
|
121 _type = 0 |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
122 _frame_width = 10 # Width for each frame is 10 pixels |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
123 _select_color = 0xee2222 # color of border of selected frame |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
124 _key_mark_color = 0x000000 # color of marks for key frames. |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
125 _key_mark_sz = 4 # width and height of a key frame mark |
945
8db3dd03508f
Draw line to connect continious tween frames
Thinker K.F. Li <thinker@codemud.net>
parents:
944
diff
changeset
|
126 _tween_color = 0x808080 # color of tween line |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
127 # bg colors of tween frames |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
128 _tween_bgcolors = [0x80ff80, 0xff8080, 0xffff80] |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
129 # Colors for normal frames |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
130 _normal_bgcolors = [0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xcccccc] |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
131 _normal_border = 0xaaaaaa # border color of normal frames. |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
132 _active_border = 0xff3030 # border color of an active frame |
954
75bc6d9f4e0a
Show hover mark when the pointer over a frame
Thinker K.F. Li <thinker@codemud.net>
parents:
953
diff
changeset
|
133 _hover_border_color = 0xa0a0a0 # border when the pointer over a frame |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
134 |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
135 def __new__(clz, *args): |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
136 if not clz._type: |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
137 clz._type = gobject.type_register(clz) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
138 pass |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
139 fl_obj = gobject.new(clz._type) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
140 return fl_obj |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
141 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
142 def _draw_tween(self, first_idx, last_idx, tween_type): |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
143 win = self.window |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
144 w_x, w_y, w_w, w_h, depth = win.get_geometry() |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
145 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
146 # |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
147 # Get background color of a tween |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
148 # |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
149 bg_idx = tween_type |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
150 bg_color_v = self._tween_bgcolors[bg_idx] |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
151 bg_color_rgb = color_to_rgb(bg_color_v) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
152 bg_color = gtk.gdk.Color(*bg_color_rgb) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
153 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
154 gc = self._gc |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
155 gc.set_rgb_fg_color(bg_color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
156 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
157 draw_x = first_idx * self._frame_width + 1 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
158 draw_w = (last_idx - first_idx + 1) * self._frame_width - 1 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
159 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
160 win.draw_rectangle(gc, True, draw_x, 0, draw_w, w_h) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
161 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
162 # |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
163 # Set color of tween line |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
164 # |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
165 line_v = self._tween_color |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
166 line_rgb = color_to_rgb(line_v) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
167 line_color = gtk.gdk.Color(*line_rgb) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
168 gc.set_rgb_fg_color(line_color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
169 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
170 # |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
171 # Draw tween line |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
172 # |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
173 line_x1 = int((first_idx + 0.5) * self._frame_width) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
174 line_x2 = line_x1 + (last_idx - first_idx) * self._frame_width |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
175 line_y = int(w_h * 2 / 3) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
176 win.draw_line(gc, line_x1, line_y, line_x2, line_y) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
177 pass |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
178 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
179 def _draw_normal_frame(self, idx): |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
180 win = self.window |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
181 w_x, w_y, w_w, w_h, depth = win.get_geometry() |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
182 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
183 gc = self._gc |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
184 bg_idx = idx % len(self._normal_bgcolors) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
185 rgb = color_to_rgb(self._normal_bgcolors[bg_idx]) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
186 color = gtk.gdk.Color(*rgb) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
187 gc.set_rgb_fg_color(color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
188 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
189 f_x = self._frame_width * idx |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
190 win.draw_rectangle(gc, True, f_x + 1, 0, self._frame_width - 1, w_h) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
191 next_f_x = f_x + self._frame_width |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
192 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
193 border_rgb = color_to_rgb(self._normal_border) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
194 border_color = gtk.gdk.Color(*border_rgb) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
195 gc.set_rgb_fg_color(border_color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
196 gc.set_line_attributes(1, gtk.gdk.LINE_SOLID, |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
197 gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
198 win.draw_line(gc, next_f_x, 0, next_f_x, w_h) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
199 pass |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
200 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
201 ## \brief Draw a bottom line from start to the point before stop frame. |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
202 # |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
203 def _draw_bottom_line(self, start_idx, stop_idx): |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
204 win = self.window |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
205 w_x, w_y, w_w, w_h, depth = win.get_geometry() |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
206 gc = self._gc |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
207 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
208 border_rgb = color_to_rgb(self._normal_border) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
209 border_color = gtk.gdk.Color(*border_rgb) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
210 gc.set_rgb_fg_color(border_color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
211 start_x = start_idx * self._frame_width |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
212 stop_x = stop_idx * self._frame_width |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
213 win.draw_line(gc, start_x, w_h - 1, stop_x, w_h - 1) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
214 pass |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
215 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
216 def _draw_active(self, idx): |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
217 win = self.window |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
218 w_x, w_y, w_w, w_h, depth = win.get_geometry() |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
219 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
220 color_v = self._active_border |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
221 color_rgb = color_to_rgb(color_v) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
222 color = gtk.gdk.Color(*color_rgb) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
223 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
224 gc = self._gc |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
225 gc.set_rgb_fg_color(color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
226 |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
227 line_x1 = idx * self._frame_width + 1 |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
228 line_x2 = line_x1 + self._frame_width - 2 |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
229 |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
230 win.draw_line(gc, line_x1, 0, line_x1, w_h - 2) |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
231 win.draw_line(gc, line_x2, 0, line_x2, w_h - 2) |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
232 win.draw_line(gc, line_x1, w_h - 2, line_x2, w_h - 2) |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
233 win.draw_line(gc, line_x1, 0, line_x2, 0) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
234 pass |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
235 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
236 def _draw_keyframe_(self, frame_idx): |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
237 win = self.window |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
238 w_x, w_y, w_w, w_h, depth = win.get_geometry() |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
239 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
240 color_v = self._key_mark_color |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
241 color_rgb = color_to_rgb(color_v) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
242 color = gtk.gdk.Color(*color_rgb) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
243 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
244 gc = self._gc |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
245 gc.set_rgb_fg_color(color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
246 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
247 mark_sz = self._key_mark_sz |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
248 mark_x = int((frame_idx + 0.5) * self._frame_width - mark_sz / 2) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
249 mark_y = w_h * 2 / 3 - mark_sz / 2 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
250 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
251 win.draw_rectangle(gc, True, mark_x, mark_y, mark_sz, mark_sz) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
252 pass |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
253 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
254 ## \brief Show a mark for the pointer for a frame. |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
255 # |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
256 def _draw_hover(self, frame_idx): |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
257 win = self.window |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
258 w_x, w_y, w_w, w_h, depth = win.get_geometry() |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
259 gc = self._gc |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
260 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
261 color_rgb = color_to_rgb(self._hover_border_color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
262 color = gtk.gdk.Color(*color_rgb) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
263 gc.set_rgb_fg_color(color) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
264 |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
265 line_x1 = frame_idx * self._frame_width + 2 |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
266 line_x2 = line_x1 + self._frame_width - 4 |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
267 |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
268 win.draw_line(gc, line_x1, 1, line_x1, w_h - 3) |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
269 win.draw_line(gc, line_x2, 1, line_x2, w_h - 3) |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
270 win.draw_line(gc, line_x1, 1, line_x2, 1) |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
271 win.draw_line(gc, line_x1, w_h - 3, line_x2, w_h - 3) |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
272 pass |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
273 pass |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
274 |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
275 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
276 ## \brief Drawing frameline according state of a frameline. |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
277 # |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
278 # Thsi class calls methods of class frameline_draw to drawing frameline. But, |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
279 # this class is state awared. It according states of an instance to determines |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
280 # calling methods and arguments. This class decorates methods of |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
281 # frameline_draw class according states of an instance. |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
282 # |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
283 # This classs reading state of a frameline, but it does not change and control |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
284 # states. The deriving classes are responsible to change and control states. |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
285 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
286 class frameline_draw_state(frameline_draw): |
971 | 287 # tween types |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
288 TWEEN_TYPE_NONE = 0 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
289 TWEEN_TYPE_MOVE = 1 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
290 TWEEN_TYPE_SHAPE = 2 |
953
2346d3238e03
frame-button-press event of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
952
diff
changeset
|
291 |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
292 def __init__(self, num_frames): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
293 frameline_draw.__init__(self) |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
294 |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
295 self._num_frames = num_frames |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
296 self._keys = [] |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
297 self._active_frame = -1 |
968
a715301b5879
Start drawing after an expose event
Thinker K.F. Li <thinker@codemud.net>
parents:
967
diff
changeset
|
298 self._drawing = False |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
299 self._last_hover = -1 # frame index of last hover |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
300 pass |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
301 |
954
75bc6d9f4e0a
Show hover mark when the pointer over a frame
Thinker K.F. Li <thinker@codemud.net>
parents:
953
diff
changeset
|
302 def _draw_keyframe(self, frame_idx): |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
303 # Only keyframes that is not right-side of NONE type tween should be |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
304 # draw. |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
305 pos = self._find_keyframe(frame_idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
306 key = self._keys[pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
307 if key.left_tween and not key.right_tween: |
1154
1c9ef65c74b2
Stop showing for second key frame of a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1153
diff
changeset
|
308 return |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
309 |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
310 self._draw_keyframe_(frame_idx) |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
311 pass |
954
75bc6d9f4e0a
Show hover mark when the pointer over a frame
Thinker K.F. Li <thinker@codemud.net>
parents:
953
diff
changeset
|
312 |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
313 def _draw_keyframes(self): |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
314 for key in self._keys: |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
315 self._draw_keyframe(key.idx) |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
316 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
317 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
318 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
319 ## \brief Redraw a frame specified by an index. |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
320 # |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
321 def _draw_frame(self, frame_idx): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
322 if not self._drawing: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
323 return |
954
75bc6d9f4e0a
Show hover mark when the pointer over a frame
Thinker K.F. Li <thinker@codemud.net>
parents:
953
diff
changeset
|
324 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
325 pos = self._find_keyframe_floor(frame_idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
326 try: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
327 key = self._keys[pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
328 except IndexError: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
329 key = None |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
330 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
331 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
332 if key and (key.right_tween or |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
333 (key.left_tween and key.idx == frame_idx)): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
334 # |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
335 # in tween |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
336 # |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
337 first_pos, last_pos = self._find_tween_range(pos) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
338 first_key = self._keys[first_pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
339 last_key = self._keys[last_pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
340 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
341 self._draw_tween_of_key(first_pos) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
342 else: # not in tween |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
343 self._draw_normal_frame(frame_idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
344 self._draw_bottom_line(frame_idx, frame_idx + 1) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
345 if key and (key.idx == frame_idx): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
346 self._draw_keyframe(frame_idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
347 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
348 pass |
954
75bc6d9f4e0a
Show hover mark when the pointer over a frame
Thinker K.F. Li <thinker@codemud.net>
parents:
953
diff
changeset
|
349 pass |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
350 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
351 def _draw_all_frames(self): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
352 if not self._drawing: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
353 return |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
354 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
355 i = 0 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
356 key_pos = 0 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
357 try: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
358 key = self._keys[key_pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
359 except IndexError: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
360 key = keyframe(self._num_frames) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
361 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
362 num_frames = self._num_frames |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
363 while i < num_frames: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
364 if key.idx == i and key.right_tween: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
365 # |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
366 # Skip tween keys |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
367 # |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
368 first_tween_pos, last_tween_pos = \ |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
369 self._find_tween_range(key_pos) |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
370 first_tween_key = self._keys[first_tween_pos] |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
371 last_tween_key = self._keys[last_tween_pos] |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
372 self._draw_tween(first_tween_key.idx, last_tween_key.idx, |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
373 first_tween_key.right_tween_type) |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
374 last_tween_key = self._keys[last_tween_pos] |
1158
1d1f2a1e43f6
Fix the issue of drawing consquence tween frames
Thinker K.F. Li <thinker@codemud.net>
parents:
1154
diff
changeset
|
375 key_pos = last_tween_pos + 1 |
1d1f2a1e43f6
Fix the issue of drawing consquence tween frames
Thinker K.F. Li <thinker@codemud.net>
parents:
1154
diff
changeset
|
376 try: |
1d1f2a1e43f6
Fix the issue of drawing consquence tween frames
Thinker K.F. Li <thinker@codemud.net>
parents:
1154
diff
changeset
|
377 key = self._keys[key_pos] |
1d1f2a1e43f6
Fix the issue of drawing consquence tween frames
Thinker K.F. Li <thinker@codemud.net>
parents:
1154
diff
changeset
|
378 except: |
1d1f2a1e43f6
Fix the issue of drawing consquence tween frames
Thinker K.F. Li <thinker@codemud.net>
parents:
1154
diff
changeset
|
379 key = keyframe(self._num_frames) |
1d1f2a1e43f6
Fix the issue of drawing consquence tween frames
Thinker K.F. Li <thinker@codemud.net>
parents:
1154
diff
changeset
|
380 pass |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
381 i = last_tween_key.idx + 1 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
382 else: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
383 self._draw_normal_frame(i) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
384 if key.idx == i: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
385 key_pos = key_pos+1 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
386 try: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
387 key = self._keys[key_pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
388 except: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
389 key = keyframe(self._num_frames) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
390 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
391 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
392 i = i + 1 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
393 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
394 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
395 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
396 self._draw_bottom_line(0, num_frames) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
397 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
398 self._draw_keyframes() |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
399 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
400 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
401 def _draw_tween_of_key(self, key_pos): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
402 if not self._drawing: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
403 return |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
404 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
405 first_pos, last_pos = self._find_tween_range(key_pos) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
406 first_key = self._keys[first_pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
407 last_key = self._keys[last_pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
408 |
1152
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
409 self._draw_tween(first_key.idx, last_key.idx, |
d333baa702a9
Refactory drawing function of frameline to frameline_draw
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
410 first_key.right_tween_type) |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
411 self._draw_bottom_line(first_key.idx, last_key.idx + 1) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
412 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
413 for i in range(first_pos, last_pos + 1): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
414 key = self._keys[i] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
415 self._draw_keyframe(key.idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
416 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
417 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
418 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
419 def _draw_active_frame(self): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
420 if not self._drawing: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
421 return |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
422 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
423 if self._active_frame == -1: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
424 return |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
425 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
426 self._draw_active(self._active_frame) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
427 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
428 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
429 def _draw_hover_frame(self, frame_idx): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
430 if not self._drawing: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
431 return |
1215
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
432 |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
433 last_hover = self._last_hover |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
434 |
1215
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
435 if last_hover != -1: |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
436 self._draw_frame(last_hover) |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
437 pass |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
438 |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
439 if frame_idx < self._num_frames and frame_idx >= 0: |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
440 self._draw_hover(frame_idx) |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
441 self._last_hover = frame_idx |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
442 else: |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
443 self._last_hover = -1 |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
444 pass |
1215
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
445 |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
446 # |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
447 # Redraw active frame if active frame in a tween that is same as the |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
448 # one that the give frame or last hover frame is in. |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
449 # |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
450 if self._active_frame in (frame_idx, last_hover): |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
451 self._draw_active_frame() |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
452 return |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
453 |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
454 for idx in (frame_idx, last_hover): |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
455 key_pos = self._find_keyframe_floor(idx) |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
456 if key_pos != -1: |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
457 key = self._keys[key_pos] |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
458 if key.right_tween or \ |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
459 (key.left_tween and key.idx == idx): |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
460 # The given frame is in a tween |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
461 first_pos, last_pos = self._find_tween_range(key_pos) |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
462 start = self._keys[first_pos].idx |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
463 end = self._keys[last_pos].idx |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
464 if self._active_frame >= start and \ |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
465 self._active_frame <= end: |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
466 # The active frame is in the tween |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
467 self._draw_active_frame() |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
468 break |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
469 pass |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
470 pass |
8e372ae69010
Fix the issue of showing active mark for a frame in a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1214
diff
changeset
|
471 pass |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
472 pass |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
473 |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
474 ## \brief Start future drawing actions |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
475 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
476 def start_drawing(self): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
477 if not hasattr(self, '_gc'): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
478 win = self.window |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
479 self._gc = gtk.gdk.GC(win) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
480 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
481 # register for button press event |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
482 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
483 emask = win.get_events() |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
484 emask = emask | gtk.gdk.BUTTON_PRESS_MASK | \ |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
485 gtk.gdk.POINTER_MOTION_MASK |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
486 win.set_events(emask) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
487 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
488 self._drawing = True |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
489 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
490 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
491 ## \brief Stop any future drawing actions |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
492 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
493 # When doing massive udpate, to stop drawing the screen make |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
494 # application more effecient. The screen is updated by calling |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
495 # update() method after massive update and calliing start_drawing(). |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
496 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
497 def stop_drawing(self): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
498 self._drawing = False |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
499 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
500 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
501 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
502 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
503 ## Show frame status of a layer |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
504 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
505 # \section frameline_sigs Signals |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
506 # - 'frame-button-pree' for user press on a frame. |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
507 # - callback(widget, frame_idx, button) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
508 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
509 # All methos that change state of the frameline, must call methods to update |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
510 # the screen. |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
511 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
512 class frameline(frameline_draw_state): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
513 _sig_frame_but_press = None |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
514 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
515 FRAME_BUT_PRESS = 'frame-button-press' |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
516 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
517 def __new__(clz, *args): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
518 fl_obj = frameline_draw_state.__new__(clz, *args) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
519 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
520 if not clz._sig_frame_but_press: |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
521 but_press = gobject.signal_new(frameline.FRAME_BUT_PRESS, |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
522 frameline._type, |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
523 gobject.SIGNAL_RUN_FIRST, |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
524 gobject.TYPE_NONE, |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
525 (gobject.TYPE_INT, |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
526 gobject.TYPE_INT)) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
527 clz._sig_frame_but_press = but_press |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
528 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
529 return fl_obj |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
530 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
531 def __init__(self, num_frames=20): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
532 frameline_draw_state.__init__(self, num_frames) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
533 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
534 self.connect('button-press-event', self._press_hdl) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
535 self.connect('expose-event', self._fl_expose) |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
536 self.connect('motion-notify-event', self._motion_n_leave_hdl) |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
537 self.connect('leave-notify-event', self._motion_n_leave_hdl) |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
538 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
539 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
540 def __len__(self): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
541 return self._num_frames |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
542 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
543 def _find_keyframe(self, idx): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
544 key_indic = [key.idx for key in self._keys] |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
545 key_pos = key_indic.index(idx) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
546 return key_pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
547 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
548 def _find_keyframe_floor(self, frame_idx): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
549 pos = 0 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
550 keys = [key.idx for key in self._keys] |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
551 keys.append(frame_idx) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
552 keys.sort() |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
553 keys.reverse() |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
554 pos = (len(keys) - 1) - keys.index(frame_idx) - 1 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
555 return pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
556 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
557 ## \brief Find the range a continous tween. |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
558 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
559 def _find_tween_range(self, key_pos): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
560 key = self._keys[key_pos] |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
561 if not (key.left_tween or key.right_tween): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
562 raise ValueError, 'the keyframe is not in a tween' |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
563 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
564 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
565 # Initialize tween type and first_pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
566 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
567 if key.right_tween: |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
568 tween_type = key.right_tween_type |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
569 first_pos = key_pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
570 else: |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
571 # key.left_tween is True since the key is in a tween. |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
572 first_pos = key_pos -1 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
573 key = self._keys[first_pos] |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
574 tween_type = key.right_tween_type |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
575 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
576 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
577 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
578 # Find first_pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
579 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
580 while first_pos and key.left_tween: |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
581 right_pos = first_pos - 1 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
582 right_key = self._keys[right_pos] |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
583 if right_key.right_tween_type != tween_type: |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
584 break |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
585 first_pos = right_pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
586 key = right_key |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
587 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
588 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
589 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
590 # Find last_pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
591 # |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
592 max_pos = len(self._keys) - 1 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
593 last_pos = key_pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
594 key = self._keys[last_pos] |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
595 while last_pos < max_pos and self._keys[last_pos].right_tween: |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
596 if key.right_tween_type != tween_type: |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
597 break |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
598 last_pos = last_pos + 1 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
599 key = self._keys[last_pos] |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
600 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
601 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
602 return first_pos, last_pos |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
603 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
604 def _press_hdl(self, widget, event): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
605 frame = event.x / self._frame_width |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
606 but = event.button |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
607 self.emit(frameline.FRAME_BUT_PRESS, frame, but) |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
608 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
609 |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
610 def _motion_n_leave_hdl(self, widget, event): |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
611 if event.type == gtk.gdk.LEAVE_NOTIFY: |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
612 frame_idx = -1 |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
613 else: |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
614 frame_idx = int(event.x / self._frame_width) |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
615 pass |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
616 |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
617 self._draw_hover_frame(frame_idx) |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
618 pass |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
619 |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
620 def _fl_expose(self, widget, event): |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
621 win = self.window |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
622 self.start_drawing() |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
623 self.update() |
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
624 pass |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
625 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
626 def set_tween_type(self, frame_idx, tween_type): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
627 pos = self._find_keyframe(frame_idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
628 key = self._keys[pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
629 assert key.right_tween |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
630 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
631 key.right_tween_type = tween_type |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
632 self._draw_tween_of_key(pos) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
633 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
634 self._draw_active_frame() |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
635 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
636 |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
637 def update(self): |
954
75bc6d9f4e0a
Show hover mark when the pointer over a frame
Thinker K.F. Li <thinker@codemud.net>
parents:
953
diff
changeset
|
638 self._draw_all_frames() |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
639 self._draw_active_frame() |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
640 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
641 |
947 | 642 ## Add a key frame |
643 # | |
644 # A key frame is the frame that user specify actions. For | |
645 # example, move a object or add new objects at the frame. | |
1241 | 646 def mark_keyframe(self, idx, ref=None): |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
647 try: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
648 pos = self._find_keyframe(idx) # it is not already a keyframe. |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
649 except ValueError: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
650 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
651 else: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
652 raise ValueError, 'the frame is already a key frame' |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
653 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
654 key_indic = [key.idx for key in self._keys] |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
655 key_indic.append(idx) |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
656 key_indic.sort() |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
657 insert_pos = key_indic.index(idx) |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
658 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
659 key = keyframe(idx) |
972
8a7e5914a84b
Add addScenes to generate scene definition according to the current framelines.
wycc
parents:
971
diff
changeset
|
660 key.ref = ref |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
661 if insert_pos > 0 and self._keys[insert_pos - 1].right_tween: |
1164
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
662 if self._keys[insert_pos-1].idx == idx-1: |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
663 self._keys[insert_pos-1].right_tween = False |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
664 self._keys[insert_pos:insert_pos] = [key] |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
665 return |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
666 else: |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
667 key2 = keyframe(idx-1) |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
668 key2.ref = self._keys[insert_pos-1].ref |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
669 key2.left_tween = True |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
670 self._keys[insert_pos:insert_pos] = [key2,key] |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
671 key.left_tween = False |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
672 key.right_tween = True |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
673 key.right_tween_type = self._keys[insert_pos - 1].right_tween_type |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
674 pass |
1164
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
675 else: |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
676 self._keys[insert_pos:insert_pos] = [key] |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
677 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
678 if self._drawing: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
679 self._draw_keyframe(idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
680 pass |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
681 pass |
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
682 |
1231
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
683 ## \brief Remove a frame from the frameline. |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
684 # |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
685 # The frames after specified one would move to head in one position. It |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
686 # means sub one from positions of all frame after given frame. |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
687 # |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
688 def rm_frame(self, idx): |
1174 | 689 pos = self._find_keyframe_floor(idx) |
690 if pos != -1: | |
691 key = self._keys[pos] | |
692 if key.idx == idx: | |
1241 | 693 self.unmark_keyframe(idx) |
1247
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
694 else: |
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
695 pos = pos + 1 |
1231
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
696 pass |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
697 |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
698 while pos < len(self._keys): |
1247
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
699 key = self._keys[pos] |
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
700 key.idx = key.idx - 1 |
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
701 pos = pos + 1 |
1231
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
702 pass |
1174 | 703 pass |
1247
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
704 |
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
705 self._draw_all_frames() |
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
706 self._draw_active_frame() |
1174 | 707 pass |
708 | |
1231
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
709 ## \brief Inser a frame before given frame. |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
710 # |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
711 # All frame at and after given frame position move to tail in one position. |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
712 # It means to add one to positions of all key frames at/after given frame. |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
713 # |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
714 def add_frame(self,idx): |
1174 | 715 pos = self._find_keyframe_floor(idx) |
716 if pos != -1: | |
717 key = self._keys[pos] | |
1247
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
718 if key.idx != idx: |
1174 | 719 pos = pos + 1 |
1231
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
720 pass |
1247
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
721 |
1231
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
722 while pos < len(self._keys): |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
723 key = self._keys[pos] |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
724 key.idx = key.idx + 1 |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
725 pos = pos + 1 |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
726 pass |
1174 | 727 pass |
1247
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
728 |
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
729 self._draw_all_frames() |
45e9566ea5c0
Fix bugs of inserting/removing frames.
Thinker K.F. Li <thinker@codemud.net>
parents:
1241
diff
changeset
|
730 self._draw_active_frame() |
1174 | 731 pass |
1180
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
732 |
1241 | 733 def unmark_keyframe(self, idx): |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
734 key_pos = self._find_keyframe(idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
735 key = self._keys[key_pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
736 del self._keys[key_pos] |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
737 |
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
738 if key.right_tween ^ key.left_tween: |
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
739 # |
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
740 # tween in one side |
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
741 # |
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
742 if key.right_tween: |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
743 right_key = self._keys[key_pos] |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
744 right_key.left_tween = False |
1200
213f03dbfc41
Fix issue of removing a scene
Thinker K.F. Li <thinker@codemud.net>
parents:
1197
diff
changeset
|
745 redraw_range = (key.idx, right_key.idx + 1) |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
746 else: |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
747 left_key = self._keys[key_pos - 1] |
1154
1c9ef65c74b2
Stop showing for second key frame of a tween
Thinker K.F. Li <thinker@codemud.net>
parents:
1153
diff
changeset
|
748 left_key.right_tween = False |
1200
213f03dbfc41
Fix issue of removing a scene
Thinker K.F. Li <thinker@codemud.net>
parents:
1197
diff
changeset
|
749 redraw_range = (left_key.idx, key.idx + 1) |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
750 pass |
1200
213f03dbfc41
Fix issue of removing a scene
Thinker K.F. Li <thinker@codemud.net>
parents:
1197
diff
changeset
|
751 for i in range(*redraw_range): |
213f03dbfc41
Fix issue of removing a scene
Thinker K.F. Li <thinker@codemud.net>
parents:
1197
diff
changeset
|
752 self._draw_frame(i) |
213f03dbfc41
Fix issue of removing a scene
Thinker K.F. Li <thinker@codemud.net>
parents:
1197
diff
changeset
|
753 pass |
213f03dbfc41
Fix issue of removing a scene
Thinker K.F. Li <thinker@codemud.net>
parents:
1197
diff
changeset
|
754 pass |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
755 else: |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
756 self._draw_frame(idx) |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
757 pass |
967
5c013e3cadd0
Provide the facility to stop drawing for massive content update.
Thinker K.F. Li <thinker@codemud.net>
parents:
966
diff
changeset
|
758 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
759 self._draw_active_frame() |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
760 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
761 |
946
f82ac6740a32
change wording in doc
Thinker K.F. Li <thinker@codemud.net>
parents:
945
diff
changeset
|
762 ## Tween the key frame specified by an index and the key frame at right. |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
763 # |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
764 # \see http://www.entheosweb.com/Flash/shape_tween.asp |
1153
5abf419d66e5
Refactory methods of state awared drawing to frameline_draw_state
Thinker K.F. Li <thinker@codemud.net>
parents:
1152
diff
changeset
|
765 def tween(self, idx, tween_type=frameline_draw_state.TWEEN_TYPE_NONE): |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
766 pos = self._find_keyframe(idx) |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
767 key = self._keys[pos] |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
768 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
769 try: |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
770 right_key = self._keys[pos + 1] |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
771 except IndexError: |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
772 raise ValueError, 'no right key frame' |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
773 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
774 key.right_tween = True |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
775 right_key.left_tween = True |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
776 key.right_tween_type = tween_type |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
777 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
778 self._draw_tween_of_key(pos) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
779 self._draw_active_frame() |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
780 pass |
1231
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
781 |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
782 ## \brief Remove right tween for given key frame. |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
783 # |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
784 def untween(self, idx): |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
785 pos = self._find_keyframe(idx) |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
786 key = self._keys[pos] |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
787 right_key = self._keys[pos + 1] |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
788 |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
789 if not key.right_tween: |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
790 return |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
791 |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
792 key.right_tween = False |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
793 key.right_tween_type = frameline_draw_state.TWEEN_TYPE_NONE |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
794 right_key.left_tween = False |
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
795 pass |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
796 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
797 def get_tween_type(self, idx): |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
977
diff
changeset
|
798 for i in range(0,len(self._keys)): |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
977
diff
changeset
|
799 key = self._keys[i] |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
977
diff
changeset
|
800 if key.left_tween is True: continue |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
977
diff
changeset
|
801 if key.idx == idx: |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
802 return key.right_tween_type |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
803 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
804 pass |
1206
1d476b35dc79
Merge and move code of tracking max frame number to MBScene_dom_monitor
Thinker K.F. Li <thinker@codemud.net>
diff
changeset
|
805 |
1187 | 806 ## Get the maximum frame number in a layer(frameline) |
807 # Return the frame number | |
808 def max_frame(self): | |
1206
1d476b35dc79
Merge and move code of tracking max frame number to MBScene_dom_monitor
Thinker K.F. Li <thinker@codemud.net>
diff
changeset
|
809 keys = self._keys |
1d476b35dc79
Merge and move code of tracking max frame number to MBScene_dom_monitor
Thinker K.F. Li <thinker@codemud.net>
diff
changeset
|
810 if not keys: |
1d476b35dc79
Merge and move code of tracking max frame number to MBScene_dom_monitor
Thinker K.F. Li <thinker@codemud.net>
diff
changeset
|
811 return 0 |
1d476b35dc79
Merge and move code of tracking max frame number to MBScene_dom_monitor
Thinker K.F. Li <thinker@codemud.net>
diff
changeset
|
812 return keys[-1].idx |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
813 |
1180
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
814 ## \bref Return range of blocks of conesequence frames (tweens). |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
815 # |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
816 # Return range and type of tweens and key frames that is not start or stop |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
817 # of a tween. |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
818 def get_frame_blocks(self): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
819 blocks = [] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
820 for pos, key in enumerate(self._keys): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
821 if key.right_tween: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
822 next_key = self._keys[pos + 1] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
823 block = (key.idx, next_key.idx, key.right_tween_type) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
824 elif not key.left_tween: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
825 block = (key.idx, key.idx, 0) |
1161
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1158
diff
changeset
|
826 else: |
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1158
diff
changeset
|
827 continue |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
828 blocks.append(block) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
829 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
830 return blocks |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
831 |
1180
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
832 ## \brief Return the range of a block of consequence frames (tween). |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
833 # |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
834 # - If the index frame is in a tween, it returns the range of the tween. |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
835 # |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
836 # - If the indexed frame is a key frame with no right_tween, returns the |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
837 # range that start and stop are both equivalent to idx. |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
838 # |
1193
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
839 # - If both earlier two are not meat, the previesou keyframe or tween is |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
840 # returned. |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
841 # |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
842 # - Otherwise, raise an exception. |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
843 # |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
844 # \param idx is the index number of a frame. |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
845 # \return A tuple of (start, stop, tween_type) |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
846 # |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
847 def get_frame_block_floor(self, idx): |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
848 pos = self._find_keyframe_floor(idx) |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
849 if pos != -1: |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
850 key = self._keys[pos] |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
851 if key.right_tween: |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
852 next_key = self._keys[pos + 1] |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
853 return key.idx, next_key.idx, key.right_tween_type |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
854 if key.left_tween: |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
855 prev_key = self._keys[pos - 1] |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
856 return prev_key.idx, key.idx, prev_key.right_tween_type |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
857 return key.idx, key.idx, 0 |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
858 raise ValueError, \ |
1231
d28b1b840bfc
Integrate MBDOM_UI to MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
1230
diff
changeset
|
859 'no any key frame at left side (%d)' % (idx) |
1193
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
860 |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
861 ## \brief Return the range of a block of consequence frames (tween). |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
862 # |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
863 # - If the index frame is in a tween, it returns the range of the tween. |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
864 # |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
865 # - If the indexed frame is a key frame with no right_tween, returns the |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
866 # range that start and stop are both equivalent to idx. |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
867 # |
1180
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
868 # - Otherwise, raise an exception. |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
869 # |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
870 # \param idx is the index number of a frame. |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
871 # \return A tuple of (start, stop, tween_type) |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
872 # |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
873 def get_frame_block(self, idx): |
1193
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
874 start, stop, tween_type = self.get_frame_block_floor(idx) |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
875 if stop < idx: |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
876 raise ValueError, \ |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
877 'the frame specified by idx is not in any tween or a key frame' |
0e3a65b7b00c
Simplify extendScened()
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
878 return start, stop, tween_type |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
879 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
880 def get_frame_data(self, idx): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
881 pos = self._find_keyframe(idx) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
882 key = self._keys[pos] |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
883 return key.ref |
1221
33aa2d63e240
When we select a new object, search the scene group which contain it and make it as the active frame.
wycc
parents:
1217
diff
changeset
|
884 |
1217
93acb8568ad3
Update frameline when loading a document
Thinker K.F. Li <thinker@codemud.net>
parents:
1215
diff
changeset
|
885 def set_frame_data(self, idx, value): |
93acb8568ad3
Update frameline when loading a document
Thinker K.F. Li <thinker@codemud.net>
parents:
1215
diff
changeset
|
886 pos = self._find_keyframe(idx) |
93acb8568ad3
Update frameline when loading a document
Thinker K.F. Li <thinker@codemud.net>
parents:
1215
diff
changeset
|
887 key = self._keys[pos] |
93acb8568ad3
Update frameline when loading a document
Thinker K.F. Li <thinker@codemud.net>
parents:
1215
diff
changeset
|
888 key.ref = value |
93acb8568ad3
Update frameline when loading a document
Thinker K.F. Li <thinker@codemud.net>
parents:
1215
diff
changeset
|
889 pass |
93acb8568ad3
Update frameline when loading a document
Thinker K.F. Li <thinker@codemud.net>
parents:
1215
diff
changeset
|
890 |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
891 ## Set active frame |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
892 # |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
893 # The active frame is the frame that is working on. |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
894 # |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
895 def active_frame(self, idx): |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
896 if idx < 0 or idx >= self._num_frames: |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
897 raise IndexError, 'value of index (%d) is out of range' % (idx) |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
898 |
967
5c013e3cadd0
Provide the facility to stop drawing for massive content update.
Thinker K.F. Li <thinker@codemud.net>
parents:
966
diff
changeset
|
899 if self._active_frame != -1: |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
900 self._draw_frame(self._active_frame) |
967
5c013e3cadd0
Provide the facility to stop drawing for massive content update.
Thinker K.F. Li <thinker@codemud.net>
parents:
966
diff
changeset
|
901 pass |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
902 self._active_frame = idx |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
903 self._draw_active_frame() |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
904 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
905 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
906 def deactive(self): |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
907 self._draw_frame(self._active_frame) |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
908 self._active_frame = -1 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
909 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
910 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
911 def set_num_frames(self, num): |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
912 self._num_frames = num |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
913 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
914 |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
915 def reset(self): |
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
916 self._keys = [] |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
917 self._active_frame = -1 |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1131
diff
changeset
|
918 self._draw_all_frames() |
966
ca993c473379
Function of removing key frames
Thinker K.F. Li <thinker@codemud.net>
parents:
965
diff
changeset
|
919 pass |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
920 |
1230 | 921 def get_active_frame(self): |
922 return self._active_frame | |
923 | |
1214
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
924 ## \brief Called when mouse leave the widget. |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
925 # |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
926 # This is here for buggy pygtk. It does not send leave-notify-event. We |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
927 # need this to workaround. |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
928 # |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
929 def mouse_leave(self): |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
930 self._draw_hover_frame(-1) |
e55499f7505a
Fix the issues with multiple framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
1206
diff
changeset
|
931 pass |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
932 pass |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
933 |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
934 if __name__ == '__main__': |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
935 window = gtk.Window(gtk.WINDOW_TOPLEVEL) |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
936 fr = frameruler(40) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
937 fr.set_size_request(300, 20) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
938 |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
939 fl = frameline(40) |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
940 fl.set_size_request(300, 20) |
1241 | 941 fl.mark_keyframe(15) |
942 fl.mark_keyframe(3) | |
971 | 943 fl.tween(3) |
1241 | 944 fl.mark_keyframe(9) |
945 fl.mark_keyframe(20) | |
971 | 946 fl.tween(9) |
947 fl.active_frame(1) | |
1241 | 948 fl.unmark_keyframe(15) |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
949 print 'num of frames: %d' % (len(fl)) |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
950 |
953
2346d3238e03
frame-button-press event of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
952
diff
changeset
|
951 def press_sig(fl, frame, but): |
2346d3238e03
frame-button-press event of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
952
diff
changeset
|
952 print 'press_sig button %d for frame %d' % (but, frame) |
2346d3238e03
frame-button-press event of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
952
diff
changeset
|
953 pass |
2346d3238e03
frame-button-press event of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
952
diff
changeset
|
954 fl.connect(frameline.FRAME_BUT_PRESS, press_sig) |
2346d3238e03
frame-button-press event of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
952
diff
changeset
|
955 |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
956 box = gtk.VBox() |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
957 |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
958 box.pack_start(fr, False) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
959 box.pack_start(fl, False) |
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
960 window.add(box) |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
961 |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
962 fr.show() |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
963 fl.show() |
948
518c61784355
Add frameruler to show ruler for framelines
Thinker K.F. Li <thinker@codemud.net>
parents:
947
diff
changeset
|
964 box.show() |
944
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
965 window.show() |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
966 gtk.main() |
b0edd13779ee
Implement a frameline widget
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
967 pass |