297 self.ParentWindow = window |
297 self.ParentWindow = window |
298 self.Controler = controler |
298 self.Controler = controler |
299 |
299 |
300 self.SetDropTarget(ViewerDropTarget(self)) |
300 self.SetDropTarget(ViewerDropTarget(self)) |
301 |
301 |
|
302 dc = wx.ClientDC(self) |
|
303 fontsize = 10 |
|
304 self.Font = wx.Font(fontsize, wx.SWISS, wx.NORMAL, wx.NORMAL) |
|
305 dc.SetFont(self.Font) |
|
306 width, height = dc.GetTextExtent("A") |
|
307 while height > 17: |
|
308 fontsize -= 1 |
|
309 self.Font = wx.Font(fontsize, wx.SWISS, wx.NORMAL, wx.NORMAL) |
|
310 dc.SetFont(self.Font) |
|
311 width, height = dc.GetTextExtent("A") |
|
312 |
302 # Link Viewer event to corresponding methods |
313 # Link Viewer event to corresponding methods |
303 self.Bind(wx.EVT_PAINT, self.OnPaint) |
314 self.Bind(wx.EVT_PAINT, self.OnPaint) |
304 self.Bind(wx.EVT_LEFT_DOWN, self.OnViewerLeftDown) |
315 self.Bind(wx.EVT_LEFT_DOWN, self.OnViewerLeftDown) |
305 self.Bind(wx.EVT_LEFT_UP, self.OnViewerLeftUp) |
316 self.Bind(wx.EVT_LEFT_UP, self.OnViewerLeftUp) |
306 self.Bind(wx.EVT_LEFT_DCLICK, self.OnViewerLeftDClick) |
317 self.Bind(wx.EVT_LEFT_DCLICK, self.OnViewerLeftDClick) |
340 def GetLogicalDC(self, buffered=False): |
351 def GetLogicalDC(self, buffered=False): |
341 if buffered: |
352 if buffered: |
342 dc = wx.BufferedPaintDC(self) |
353 dc = wx.BufferedPaintDC(self) |
343 else: |
354 else: |
344 dc = wx.ClientDC(self) |
355 dc = wx.ClientDC(self) |
345 if wx.Platform == '__WXMSW__': |
356 dc.SetFont(self.Font) |
346 dc.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)) |
|
347 else: |
|
348 dc.SetFont(wx.NORMAL_FONT) |
|
349 if wx.VERSION >= (2, 6, 0): |
357 if wx.VERSION >= (2, 6, 0): |
350 self.DoPrepareDC(dc) |
358 self.DoPrepareDC(dc) |
351 else: |
359 else: |
352 self.PrepareDC(dc) |
360 self.PrepareDC(dc) |
353 return dc |
361 return dc |