35 from util.BitmapLibrary import GetBitmap |
35 from util.BitmapLibrary import GetBitmap |
36 from weakref import proxy |
36 from weakref import proxy |
37 |
37 |
38 THUMB_SIZE_RATIO = 1. / 8. |
38 THUMB_SIZE_RATIO = 1. / 8. |
39 |
39 |
|
40 |
40 def ArrowPoints(direction, width, height, xoffset, yoffset): |
41 def ArrowPoints(direction, width, height, xoffset, yoffset): |
41 if direction == wx.TOP: |
42 if direction == wx.TOP: |
42 return [wx.Point(xoffset + 1, yoffset + height - 2), |
43 return [wx.Point(xoffset + 1, yoffset + height - 2), |
43 wx.Point(xoffset + width / 2, yoffset + 1), |
44 wx.Point(xoffset + width / 2, yoffset + 1), |
44 wx.Point(xoffset + width - 1, yoffset + height - 2)] |
45 wx.Point(xoffset + width - 1, yoffset + height - 2)] |
45 else: |
46 else: |
46 return [wx.Point(xoffset + 1, yoffset - height + 1), |
47 return [wx.Point(xoffset + 1, yoffset - height + 1), |
47 wx.Point(xoffset + width / 2, yoffset - 2), |
48 wx.Point(xoffset + width / 2, yoffset - 2), |
48 wx.Point(xoffset + width - 1, yoffset - height + 1)] |
49 wx.Point(xoffset + width - 1, yoffset - height + 1)] |
|
50 |
49 |
51 |
50 class LogScrollBar(wx.Panel): |
52 class LogScrollBar(wx.Panel): |
51 |
53 |
52 def __init__(self, parent, size): |
54 def __init__(self, parent, size): |
53 wx.Panel.__init__(self, parent, size=size) |
55 wx.Panel.__init__(self, parent, size=size) |
177 dc.EndDrawing() |
179 dc.EndDrawing() |
178 event.Skip() |
180 event.Skip() |
179 |
181 |
180 BUTTON_SIZE = (70, 15) |
182 BUTTON_SIZE = (70, 15) |
181 |
183 |
|
184 |
182 class LogButton(): |
185 class LogButton(): |
183 |
186 |
184 def __init__(self, label, callback): |
187 def __init__(self, label, callback): |
185 self.Position = wx.Point(0, 0) |
188 self.Position = wx.Point(0, 0) |
186 self.Size = wx.Size(*BUTTON_SIZE) |
189 self.Size = wx.Size(*BUTTON_SIZE) |
220 self.Position.x + (self.Size.width - w) / 2, |
223 self.Position.x + (self.Size.width - w) / 2, |
221 self.Position.y + (self.Size.height - h) / 2) |
224 self.Position.y + (self.Size.height - h) / 2) |
222 |
225 |
223 DATE_INFO_SIZE = 10 |
226 DATE_INFO_SIZE = 10 |
224 MESSAGE_INFO_SIZE = 18 |
227 MESSAGE_INFO_SIZE = 18 |
|
228 |
225 |
229 |
226 class LogMessage: |
230 class LogMessage: |
227 |
231 |
228 def __init__(self, tv_sec, tv_nsec, level, level_bitmap, msg): |
232 def __init__(self, tv_sec, tv_nsec, level, level_bitmap, msg): |
229 self.Date = datetime.utcfromtimestamp(tv_sec) |
233 self.Date = datetime.utcfromtimestamp(tv_sec) |
278 |
282 |
279 CHANGE_TIMESTAMP_BUTTONS = [(_("1d"), DAY), |
283 CHANGE_TIMESTAMP_BUTTONS = [(_("1d"), DAY), |
280 (_("1h"), HOUR), |
284 (_("1h"), HOUR), |
281 (_("1m"), MINUTE), |
285 (_("1m"), MINUTE), |
282 (_("1s"), SECOND)] |
286 (_("1s"), SECOND)] |
|
287 |
283 |
288 |
284 class LogViewer(DebugViewer, wx.Panel): |
289 class LogViewer(DebugViewer, wx.Panel): |
285 |
290 |
286 def __init__(self, parent, window): |
291 def __init__(self, parent, window): |
287 wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER) |
292 wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER) |