14 raise ImportError,
"You need to install the wxpython lib for this script" 21 EVENT_MARKING_WIDTH = 5
23 def __init__(self, sched_tracer, title, parent = None, id = -1):
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
33 (self.ts_start, self.ts_end) = sched_tracer.interval()
35 self.
nr_rects = sched_tracer.nr_rectangles() + 1
39 self.
panel = wx.Panel(self, size=(self.screen_width, self.screen_height))
44 self.
scroll.EnableScrolling(
True,
True)
66 return val / (10 ** 3) * self.
zoom 69 return (val / self.
zoom) * (10 ** 3)
72 (x, y) = self.
scroll.GetViewStart()
80 offset_px = self.
us_to_px(start - self.ts_start)
81 width_px = self.
us_to_px(end - self.ts_start)
83 offset_py = RootFrame.Y_OFFSET + (nr * (RootFrame.RECT_HEIGHT + RootFrame.RECT_SPACE))
84 width_py = RootFrame.RECT_HEIGHT
88 if top_color
is not None:
90 top_color = wx.Colour(r, g, b)
91 brush = wx.Brush(top_color, wx.SOLID)
93 dc.DrawRectangle(offset_px, offset_py, width_px, RootFrame.EVENT_MARKING_WIDTH)
94 width_py -= RootFrame.EVENT_MARKING_WIDTH
95 offset_py += RootFrame.EVENT_MARKING_WIDTH
98 color = wx.Colour(r, g, b)
99 brush = wx.Brush(color, wx.SOLID)
101 dc.DrawRectangle(offset_px, offset_py, width_px, width_py)
104 start += self.ts_start
119 y -= RootFrame.Y_OFFSET
120 rect = y / (RootFrame.RECT_HEIGHT + RootFrame.RECT_SPACE)
121 height = y % (RootFrame.RECT_HEIGHT + RootFrame.RECT_SPACE)
123 if rect < 0
or rect > self.
nr_rects - 1
or height > RootFrame.RECT_HEIGHT:
131 self.
txt = wx.StaticText(self.
panel, -1, txt, (0, (self.screen_height / 2) + 50))
135 (x, y) = event.GetPositionTuple()
140 t = self.
px_to_us(x) + self.ts_start
150 (xpos, ypos) = self.
scroll.GetViewStart()
167 key = event.GetRawKeyCode()
175 key = event.GetKeyCode()
176 (x, y) = self.
scroll.GetViewStart()
177 if key == wx.WXK_RIGHT:
178 self.
scroll.Scroll(x + 1, y)
179 elif key == wx.WXK_LEFT:
180 self.
scroll.Scroll(x - 1, y)
181 elif key == wx.WXK_DOWN:
182 self.
scroll.Scroll(x, y + 1)
183 elif key == wx.WXK_UP:
184 self.
scroll.Scroll(x, y - 1)
def __init__(self, sched_tracer, title, parent=None, id=-1)
def on_key_press(self, event)
def on_mouse_down(self, event)
def on_paint(self, event)
def rect_from_ypixel(self, y)
def update_summary(self, txt)
def update_rectangles(self, dc, start, end)
def scroll_start_us(self)
def paint_rectangle_zone(self, nr, color, top_color, start, end)
def update_width_virtual(self)