36 def AppendMenu(parent, help, id, kind, text): |
36 def AppendMenu(parent, help, id, kind, text): |
37 if wx.VERSION >= (2, 6, 0): |
37 if wx.VERSION >= (2, 6, 0): |
38 parent.Append(help=help, id=id, kind=kind, text=text) |
38 parent.Append(help=help, id=id, kind=kind, text=text) |
39 else: |
39 else: |
40 parent.Append(helpString=help, id=id, kind=kind, item=text) |
40 parent.Append(helpString=help, id=id, kind=kind, item=text) |
|
41 |
|
42 if wx.Platform == '__WXMSW__': |
|
43 faces = { 'times': 'Times New Roman', |
|
44 'mono' : 'Courier New', |
|
45 'helv' : 'Arial', |
|
46 'other': 'Comic Sans MS', |
|
47 'size' : 10, |
|
48 } |
|
49 else: |
|
50 faces = { 'times': 'Times', |
|
51 'mono' : 'Courier', |
|
52 'helv' : 'Helvetica', |
|
53 'other': 'new century schoolbook', |
|
54 'size' : 12, |
|
55 } |
41 |
56 |
42 #------------------------------------------------------------------------------- |
57 #------------------------------------------------------------------------------- |
43 # Graphic elements Viewer base class |
58 # Graphic elements Viewer base class |
44 #------------------------------------------------------------------------------- |
59 #------------------------------------------------------------------------------- |
45 |
60 |
298 self.Controler = controler |
313 self.Controler = controler |
299 |
314 |
300 self.SetDropTarget(ViewerDropTarget(self)) |
315 self.SetDropTarget(ViewerDropTarget(self)) |
301 |
316 |
302 dc = wx.ClientDC(self) |
317 dc = wx.ClientDC(self) |
303 fontsize = 10 |
318 self.Font = wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["mono"]) |
304 self.Font = wx.Font(fontsize, wx.SWISS, wx.NORMAL, wx.NORMAL) |
|
305 dc.SetFont(self.Font) |
319 dc.SetFont(self.Font) |
306 width, height = dc.GetTextExtent("A") |
320 width, height = dc.GetTextExtent("A") |
307 while height > 17: |
321 while height > 17: |
308 fontsize -= 1 |
322 faces["size"] -= 1 |
309 self.Font = wx.Font(fontsize, wx.SWISS, wx.NORMAL, wx.NORMAL) |
323 self.Font = wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["mono"]) |
310 dc.SetFont(self.Font) |
324 dc.SetFont(self.Font) |
311 width, height = dc.GetTextExtent("A") |
325 width, height = dc.GetTextExtent("A") |
312 |
326 |
313 # Link Viewer event to corresponding methods |
327 # Link Viewer event to corresponding methods |
314 self.Bind(wx.EVT_PAINT, self.OnPaint) |
328 self.Bind(wx.EVT_PAINT, self.OnPaint) |