Lines Matching refs:self

23 	def __init__(self, sched_tracer, title, parent = None, id = -1):  argument
24 wx.Frame.__init__(self, parent, id, title)
26 (self.screen_width, self.screen_height) = wx.GetDisplaySize()
27 self.screen_width -= 10
28 self.screen_height -= 10
29 self.zoom = 0.5
30 self.scroll_scale = 20
31 self.sched_tracer = sched_tracer
32 self.sched_tracer.set_root_win(self)
33 (self.ts_start, self.ts_end) = sched_tracer.interval()
34 self.update_width_virtual()
35 self.nr_rects = sched_tracer.nr_rectangles() + 1
36self.height_virtual = RootFrame.Y_OFFSET + (self.nr_rects * (RootFrame.RECT_HEIGHT + RootFrame.REC…
39 self.panel = wx.Panel(self, size=(self.screen_width, self.screen_height))
42 self.scroll = wx.ScrolledWindow(self.panel)
43self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_s…
44 self.scroll.EnableScrolling(True, True)
45 self.scroll.SetFocus()
48 self.scroll_panel = wx.Panel(self.scroll, size=(self.screen_width - 15, self.screen_height / 2))
49 self.scroll_panel.Bind(wx.EVT_PAINT, self.on_paint)
50 self.scroll_panel.Bind(wx.EVT_KEY_DOWN, self.on_key_press)
51 self.scroll_panel.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_down)
52 self.scroll.Bind(wx.EVT_PAINT, self.on_paint)
53 self.scroll.Bind(wx.EVT_KEY_DOWN, self.on_key_press)
54 self.scroll.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_down)
56 self.scroll.Fit()
57 self.Fit()
59self.scroll_panel.SetDimensions(-1, -1, self.width_virtual, self.height_virtual, wx.SIZE_USE_EXIST…
61 self.txt = None
63 self.Show(True)
65 def us_to_px(self, val): argument
66 return val / (10 ** 3) * self.zoom
68 def px_to_us(self, val): argument
69 return (val / self.zoom) * (10 ** 3)
71 def scroll_start(self): argument
72 (x, y) = self.scroll.GetViewStart()
73 return (x * self.scroll_scale, y * self.scroll_scale)
75 def scroll_start_us(self): argument
76 (x, y) = self.scroll_start()
77 return self.px_to_us(x)
79 def paint_rectangle_zone(self, nr, color, top_color, start, end): argument
80 offset_px = self.us_to_px(start - self.ts_start)
81 width_px = self.us_to_px(end - self.ts_start)
86 dc = self.dc
103 def update_rectangles(self, dc, start, end): argument
104 start += self.ts_start
105 end += self.ts_start
106 self.sched_tracer.fill_zone(start, end)
108 def on_paint(self, event): argument
109 dc = wx.PaintDC(self.scroll_panel)
110 self.dc = dc
112 width = min(self.width_virtual, self.screen_width)
113 (x, y) = self.scroll_start()
114 start = self.px_to_us(x)
115 end = self.px_to_us(x + width)
116 self.update_rectangles(dc, start, end)
118 def rect_from_ypixel(self, y): argument
123 if rect < 0 or rect > self.nr_rects - 1 or height > RootFrame.RECT_HEIGHT:
128 def update_summary(self, txt): argument
129 if self.txt:
130 self.txt.Destroy()
131 self.txt = wx.StaticText(self.panel, -1, txt, (0, (self.screen_height / 2) + 50))
134 def on_mouse_down(self, event): argument
136 rect = self.rect_from_ypixel(y)
140 t = self.px_to_us(x) + self.ts_start
142 self.sched_tracer.mouse_down(rect, t)
145 def update_width_virtual(self): argument
146 self.width_virtual = self.us_to_px(self.ts_end - self.ts_start)
148 def __zoom(self, x): argument
149 self.update_width_virtual()
150 (xpos, ypos) = self.scroll.GetViewStart()
151 xpos = self.us_to_px(x) / self.scroll_scale
152self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_s…
153 self.Refresh()
155 def zoom_in(self): argument
156 x = self.scroll_start_us()
157 self.zoom *= 2
158 self.__zoom(x)
160 def zoom_out(self): argument
161 x = self.scroll_start_us()
162 self.zoom /= 2
163 self.__zoom(x)
166 def on_key_press(self, event): argument
169 self.zoom_in()
172 self.zoom_out()
176 (x, y) = self.scroll.GetViewStart()
178 self.scroll.Scroll(x + 1, y)
180 self.scroll.Scroll(x - 1, y)
182 self.scroll.Scroll(x, y + 1)
184 self.scroll.Scroll(x, y - 1)