editors/Viewer.py
changeset 2177 10aa87518401
parent 1953 5736d25bb393
child 2229 3c94bac4526e
equal deleted inserted replaced
2176:748017ca4151 2177:10aa87518401
    64                    wx.StockCursor(wx.CURSOR_SIZEWE),
    64                    wx.StockCursor(wx.CURSOR_SIZEWE),
    65                    wx.StockCursor(wx.CURSOR_SIZENS)]
    65                    wx.StockCursor(wx.CURSOR_SIZENS)]
    66 
    66 
    67 
    67 
    68 def AppendMenu(parent, help, id, kind, text):
    68 def AppendMenu(parent, help, id, kind, text):
    69     if wx.VERSION >= (2, 6, 0):
    69     parent.Append(help=help, id=id, kind=kind, text=text)
    70         parent.Append(help=help, id=id, kind=kind, text=text)
       
    71     else:
       
    72         parent.Append(helpString=help, id=id, kind=kind, item=text)
       
    73 
    70 
    74 
    71 
    75 if wx.Platform == '__WXMSW__':
    72 if wx.Platform == '__WXMSW__':
    76     faces = {
    73     faces = {
    77         'times': 'Times New Roman',
    74         'times': 'Times New Roman',
   533     """
   530     """
   534     Class that implements a Viewer based on a wx.ScrolledWindow for drawing and
   531     Class that implements a Viewer based on a wx.ScrolledWindow for drawing and
   535     manipulating graphic elements
   532     manipulating graphic elements
   536     """
   533     """
   537 
   534 
   538     if wx.VERSION < (2, 6, 0):
       
   539         def Bind(self, event, function, id=None):
       
   540             if id is not None:
       
   541                 event(self, id, function)
       
   542             else:
       
   543                 event(self, function)
       
   544 
       
   545     # Add list of menu items to the given menu
   535     # Add list of menu items to the given menu
   546     def AddMenuItems(self, menu, items):
   536     def AddMenuItems(self, menu, items):
   547         for item in items:
   537         for item in items:
   548             if item is None:
   538             if item is None:
   549                 menu.AppendSeparator()
   539                 menu.AppendSeparator()
   898             bitmap = wx.EmptyBitmap(*self.Editor.GetClientSize())
   888             bitmap = wx.EmptyBitmap(*self.Editor.GetClientSize())
   899             dc = wx.MemoryDC(bitmap)
   889             dc = wx.MemoryDC(bitmap)
   900         else:
   890         else:
   901             dc = wx.ClientDC(self.Editor)
   891             dc = wx.ClientDC(self.Editor)
   902         dc.SetFont(self.GetFont())
   892         dc.SetFont(self.GetFont())
   903         if wx.VERSION >= (2, 6, 0):
   893         self.Editor.DoPrepareDC(dc)
   904             self.Editor.DoPrepareDC(dc)
       
   905         else:
       
   906             self.Editor.PrepareDC(dc)
       
   907         dc.SetUserScale(self.ViewScale[0], self.ViewScale[1])
   894         dc.SetUserScale(self.ViewScale[0], self.ViewScale[1])
   908         return dc
   895         return dc
   909 
   896 
   910     def RefreshRect(self, rect, eraseBackground=True):
   897     def RefreshRect(self, rect, eraseBackground=True):
   911         self.Editor.RefreshRect(rect, eraseBackground)
   898         self.Editor.RefreshRect(rect, eraseBackground)