comparison pyink/frameline.py @ 945:8db3dd03508f

Draw line to connect continious tween frames
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 16 Nov 2010 12:51:53 +0800
parents b0edd13779ee
children f82ac6740a32
comparison
equal deleted inserted replaced
944:b0edd13779ee 945:8db3dd03508f
24 _type_id = 0 24 _type_id = 0
25 _frame_width = 10 # Width for each frame is 10 pixels 25 _frame_width = 10 # Width for each frame is 10 pixels
26 _select_color = 0xee2222 # color of border of selected frame 26 _select_color = 0xee2222 # color of border of selected frame
27 _key_mark_color = 0x000000 # color of marks for key frames. 27 _key_mark_color = 0x000000 # color of marks for key frames.
28 _key_mark_sz = 4 # width and height of a key frame mark 28 _key_mark_sz = 4 # width and height of a key frame mark
29 _tween_color = 0x000000 # color of tween line 29 _tween_color = 0x808080 # color of tween line
30 _tween_bgcolors = [0x80ff80, 0xff8080] # bg colors of tween frames 30 _tween_bgcolors = [0x80ff80, 0xff8080] # bg colors of tween frames
31 # Colors for normal frames 31 # Colors for normal frames
32 _normal_bgcolors = [0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xcccccc] 32 _normal_bgcolors = [0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xcccccc]
33 _normal_border = 0xaaaaaa # border color of normal frames. 33 _normal_border = 0xaaaaaa # border color of normal frames.
34 _active_border = 0xff3030 # border color of an active frame 34 _active_border = 0xff3030 # border color of an active frame
72 72
73 draw_x = first_key.idx * self._frame_width + 1 73 draw_x = first_key.idx * self._frame_width + 1
74 draw_w = (last_key.idx - first_key.idx + 1) * self._frame_width - 1 74 draw_w = (last_key.idx - first_key.idx + 1) * self._frame_width - 1
75 75
76 win.draw_rectangle(gc, True, draw_x, 0, draw_w, w_h) 76 win.draw_rectangle(gc, True, draw_x, 0, draw_w, w_h)
77
78 #
79 # Set color of tween line
80 #
81 line_v = self._tween_color
82 line_rgb = color_to_rgb(line_v)
83 line_color = gtk.gdk.Color(*line_rgb)
84 gc.set_rgb_fg_color(line_color)
85
86 #
87 # Draw tween line
88 #
89 line_x1 = (first_key.idx + 0.5) * self._frame_width
90 line_x2 = line_x1 + (last_key.idx - first_key.idx) * self._frame_width
91 line_y = w_h * 2 / 3
92 win.draw_line(gc, line_x1, line_y, line_x2, line_y)
77 pass 93 pass
78 94
79 def _draw_frame(self, idx): 95 def _draw_frame(self, idx):
80 win = self.window 96 win = self.window
81 w_x, w_y, w_w, w_h, depth = win.get_geometry() 97 w_x, w_y, w_w, w_h, depth = win.get_geometry()