editors/Viewer.py
changeset 1744 69dfdb26f600
parent 1743 c3c3d1318130
child 1745 f9d32913bad4
equal deleted inserted replaced
1743:c3c3d1318130 1744:69dfdb26f600
   260                 if pou_name == values[0]:
   260                 if pou_name == values[0]:
   261                     message = _("\"%s\" can't use itself!") % pou_name
   261                     message = _("\"%s\" can't use itself!") % pou_name
   262                 elif pou_type == "function" and values[1] != "function":
   262                 elif pou_type == "function" and values[1] != "function":
   263                     message = _("Function Blocks can't be used in Functions!")
   263                     message = _("Function Blocks can't be used in Functions!")
   264                 elif self.ParentWindow.Controler.PouIsUsedBy(pou_name, values[0], self.ParentWindow.Debug):
   264                 elif self.ParentWindow.Controler.PouIsUsedBy(pou_name, values[0], self.ParentWindow.Debug):
   265                     message = _("\"{a1}\" is already used by \"{a2}\"!").format(a1 = pou_name, a2 = values[0])
   265                     message = _("\"{a1}\" is already used by \"{a2}\"!").format(a1=pou_name, a2=values[0])
   266                 else:
   266                 else:
   267                     blockname = values[2]
   267                     blockname = values[2]
   268                     if len(values) > 3:
   268                     if len(values) > 3:
   269                         blockinputs = values[3]
   269                         blockinputs = values[3]
   270                     else:
   270                     else:
   275                         message = _("\"%s\" pou already exists!") % blockname
   275                         message = _("\"%s\" pou already exists!") % blockname
   276                     elif blockname.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
   276                     elif blockname.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
   277                         message = _("\"%s\" element for this pou already exists!") % blockname
   277                         message = _("\"%s\" element for this pou already exists!") % blockname
   278                     else:
   278                     else:
   279                         id = self.ParentWindow.GetNewId()
   279                         id = self.ParentWindow.GetNewId()
   280                         block = FBD_Block(self.ParentWindow, values[0], blockname, id, inputs = blockinputs)
   280                         block = FBD_Block(self.ParentWindow, values[0], blockname, id, inputs=blockinputs)
   281                         width, height = block.GetMinSize()
   281                         width, height = block.GetMinSize()
   282                         if scaling is not None:
   282                         if scaling is not None:
   283                             x = round(float(x) / float(scaling[0])) * scaling[0]
   283                             x = round(float(x) / float(scaling[0])) * scaling[0]
   284                             y = round(float(y) / float(scaling[1])) * scaling[1]
   284                             y = round(float(y) / float(scaling[1])) * scaling[1]
   285                             width = round(float(width) / float(scaling[0]) + 0.5) * scaling[0]
   285                             width = round(float(width) / float(scaling[0]) + 0.5) * scaling[0]
   502     Class that implements a Viewer based on a wx.ScrolledWindow for drawing and
   502     Class that implements a Viewer based on a wx.ScrolledWindow for drawing and
   503     manipulating graphic elements
   503     manipulating graphic elements
   504     """
   504     """
   505 
   505 
   506     if wx.VERSION < (2, 6, 0):
   506     if wx.VERSION < (2, 6, 0):
   507         def Bind(self, event, function, id = None):
   507         def Bind(self, event, function, id=None):
   508             if id is not None:
   508             if id is not None:
   509                 event(self, id, function)
   509                 event(self, id, function)
   510             else:
   510             else:
   511                 event(self, function)
   511                 event(self, function)
   512 
   512 
   678             pos=wx.Point(0, 0), size=wx.Size(0, 0),
   678             pos=wx.Point(0, 0), size=wx.Size(0, 0),
   679             style=wx.HSCROLL | wx.VSCROLL)
   679             style=wx.HSCROLL | wx.VSCROLL)
   680         self.Editor.ParentWindow = self
   680         self.Editor.ParentWindow = self
   681 
   681 
   682     # Create a new Viewer
   682     # Create a new Viewer
   683     def __init__(self, parent, tagname, window, controler, debug = False, instancepath = ""):
   683     def __init__(self, parent, tagname, window, controler, debug=False, instancepath=""):
   684         self.VARIABLE_PANEL_TYPE = controler.GetPouType(tagname.split("::")[1])
   684         self.VARIABLE_PANEL_TYPE = controler.GetPouType(tagname.split("::")[1])
   685 
   685 
   686         EditorPanel.__init__(self, parent, tagname, window, controler, debug)
   686         EditorPanel.__init__(self, parent, tagname, window, controler, debug)
   687         DebugViewer.__init__(self, controler, debug)
   687         DebugViewer.__init__(self, controler, debug)
   688 
   688 
   733 
   733 
   734         self.ElementRefreshList = []
   734         self.ElementRefreshList = []
   735         self.ElementRefreshList_lock = Lock()
   735         self.ElementRefreshList_lock = Lock()
   736 
   736 
   737         dc = wx.ClientDC(self.Editor)
   737         dc = wx.ClientDC(self.Editor)
   738         font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName = faces["mono"])
   738         font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["mono"])
   739         dc.SetFont(font)
   739         dc.SetFont(font)
   740         width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
   740         width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
   741         while width > 260:
   741         while width > 260:
   742             faces["size"] -= 1
   742             faces["size"] -= 1
   743             font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName = faces["mono"])
   743             font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["mono"])
   744             dc.SetFont(font)
   744             dc.SetFont(font)
   745             width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
   745             width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
   746         self.SetFont(font)
   746         self.SetFont(font)
   747         self.MiniTextDC = wx.MemoryDC()
   747         self.MiniTextDC = wx.MemoryDC()
   748         self.MiniTextDC.SetFont(wx.Font(faces["size"] * 0.75, wx.SWISS, wx.NORMAL, wx.NORMAL, faceName = faces["helv"]))
   748         self.MiniTextDC.SetFont(wx.Font(faces["size"] * 0.75, wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["helv"]))
   749 
   749 
   750         self.CurrentScale = None
   750         self.CurrentScale = None
   751         self.SetScale(ZOOM_FACTORS.index(1.0), False)
   751         self.SetScale(ZOOM_FACTORS.index(1.0), False)
   752 
   752 
   753         self.RefreshHighlightsTimer = wx.Timer(self, -1)
   753         self.RefreshHighlightsTimer = wx.Timer(self, -1)
   975                block.GetType() == CONNECTOR and\
   975                block.GetType() == CONNECTOR and\
   976                block.GetName() == name:
   976                block.GetName() == name:
   977                 return block
   977                 return block
   978         return None
   978         return None
   979 
   979 
   980     def RefreshVisibleElements(self, xp = None, yp = None):
   980     def RefreshVisibleElements(self, xp=None, yp=None):
   981         x, y = self.Editor.CalcUnscrolledPosition(0, 0)
   981         x, y = self.Editor.CalcUnscrolledPosition(0, 0)
   982         if xp is not None:
   982         if xp is not None:
   983             x = xp * self.Editor.GetScrollPixelsPerUnit()[0]
   983             x = xp * self.Editor.GetScrollPixelsPerUnit()[0]
   984         if yp is not None:
   984         if yp is not None:
   985             y = yp * self.Editor.GetScrollPixelsPerUnit()[1]
   985             y = yp * self.Editor.GetScrollPixelsPerUnit()[1]
  1218         self.Flush()
  1218         self.Flush()
  1219         self.ResetView()
  1219         self.ResetView()
  1220         self.ResetBuffer()
  1220         self.ResetBuffer()
  1221         instance = {}
  1221         instance = {}
  1222         # List of ids of already loaded blocks
  1222         # List of ids of already loaded blocks
  1223         instances = self.Controler.GetEditedElementInstancesInfos(self.TagName, debug = self.Debug)
  1223         instances = self.Controler.GetEditedElementInstancesInfos(self.TagName, debug=self.Debug)
  1224         # Load Blocks until they are all loaded
  1224         # Load Blocks until they are all loaded
  1225         while len(instances) > 0:
  1225         while len(instances) > 0:
  1226             self.loadInstance(instances.popitem(0)[1], instances, selection)
  1226             self.loadInstance(instances.popitem(0)[1], instances, selection)
  1227 
  1227 
  1228         if (selection is not None and
  1228         if (selection is not None and
  1409         element.SetSize(instance.width, instance.height)
  1409         element.SetSize(instance.width, instance.height)
  1410         for i, output_connector in enumerate(instance.outputs):
  1410         for i, output_connector in enumerate(instance.outputs):
  1411             connector_pos = wx.Point(*output_connector.position)
  1411             connector_pos = wx.Point(*output_connector.position)
  1412             if isinstance(element, FBD_Block):
  1412             if isinstance(element, FBD_Block):
  1413                 connector = element.GetConnector(connector_pos,
  1413                 connector = element.GetConnector(connector_pos,
  1414                     output_name = output_connector.name)
  1414                     output_name=output_connector.name)
  1415             elif i < len(connectors["outputs"]):
  1415             elif i < len(connectors["outputs"]):
  1416                 connector = connectors["outputs"][i]
  1416                 connector = connectors["outputs"][i]
  1417             else:
  1417             else:
  1418                 connector = None
  1418                 connector = None
  1419             if connector is not None:
  1419             if connector is not None:
  1425                     connector.SetPosition(connector_pos)
  1425                     connector.SetPosition(connector_pos)
  1426         for i, input_connector in enumerate(instance.inputs):
  1426         for i, input_connector in enumerate(instance.inputs):
  1427             connector_pos = wx.Point(*input_connector.position)
  1427             connector_pos = wx.Point(*input_connector.position)
  1428             if isinstance(element, FBD_Block):
  1428             if isinstance(element, FBD_Block):
  1429                 connector = element.GetConnector(connector_pos,
  1429                 connector = element.GetConnector(connector_pos,
  1430                     input_name = input_connector.name)
  1430                     input_name=input_connector.name)
  1431             elif i < len(connectors["inputs"]):
  1431             elif i < len(connectors["inputs"]):
  1432                 connector = connectors["inputs"][i]
  1432                 connector = connectors["inputs"][i]
  1433             else:
  1433             else:
  1434                 connector = None
  1434                 connector = None
  1435             if connector is not None:
  1435             if connector is not None:
  1497         return self.Controler.IsOfType(type, reference, self.Debug)
  1497         return self.Controler.IsOfType(type, reference, self.Debug)
  1498 
  1498 
  1499     def IsEndType(self, type):
  1499     def IsEndType(self, type):
  1500         return self.Controler.IsEndType(type)
  1500         return self.Controler.IsEndType(type)
  1501 
  1501 
  1502     def GetBlockType(self, type, inputs = None):
  1502     def GetBlockType(self, type, inputs=None):
  1503         return self.Controler.GetBlockType(type, inputs, self.Debug)
  1503         return self.Controler.GetBlockType(type, inputs, self.Debug)
  1504 
  1504 
  1505 #-------------------------------------------------------------------------------
  1505 #-------------------------------------------------------------------------------
  1506 #                          Search Element functions
  1506 #                          Search Element functions
  1507 #-------------------------------------------------------------------------------
  1507 #-------------------------------------------------------------------------------
  1520         for wire in self.Wires:
  1520         for wire in self.Wires:
  1521             if wire.HitTest(pos) or wire.TestHandle(event) != (0, 0):
  1521             if wire.HitTest(pos) or wire.TestHandle(event) != (0, 0):
  1522                 return wire
  1522                 return wire
  1523         return None
  1523         return None
  1524 
  1524 
  1525     def FindElement(self, event, exclude_group = False, connectors = True):
  1525     def FindElement(self, event, exclude_group=False, connectors=True):
  1526         dc = self.GetLogicalDC()
  1526         dc = self.GetLogicalDC()
  1527         pos = event.GetLogicalPosition(dc)
  1527         pos = event.GetLogicalPosition(dc)
  1528         if self.SelectedElement and not (exclude_group and isinstance(self.SelectedElement, Graphic_Group)):
  1528         if self.SelectedElement and not (exclude_group and isinstance(self.SelectedElement, Graphic_Group)):
  1529             if self.SelectedElement.HitTest(pos, connectors) or self.SelectedElement.TestHandle(event) != (0, 0):
  1529             if self.SelectedElement.HitTest(pos, connectors) or self.SelectedElement.TestHandle(event) != (0, 0):
  1530                 return self.SelectedElement
  1530                 return self.SelectedElement
  1531         for element in self.GetElements():
  1531         for element in self.GetElements():
  1532             if element.HitTest(pos, connectors) or element.TestHandle(event) != (0, 0):
  1532             if element.HitTest(pos, connectors) or element.TestHandle(event) != (0, 0):
  1533                 return element
  1533                 return element
  1534         return None
  1534         return None
  1535 
  1535 
  1536     def FindBlockConnector(self, pos, direction = None, exclude = None):
  1536     def FindBlockConnector(self, pos, direction=None, exclude=None):
  1537         result, error = self.FindBlockConnectorWithError(pos, direction, exclude)
  1537         result, error = self.FindBlockConnectorWithError(pos, direction, exclude)
  1538         return result
  1538         return result
  1539 
  1539 
  1540     def FindBlockConnectorWithError(self, pos, direction = None, exclude = None):
  1540     def FindBlockConnectorWithError(self, pos, direction=None, exclude=None):
  1541         error = False
  1541         error = False
  1542         startblock = None
  1542         startblock = None
  1543         for block in self.Blocks.itervalues():
  1543         for block in self.Blocks.itervalues():
  1544             connector = block.TestConnector(pos, direction, exclude)
  1544             connector = block.TestConnector(pos, direction, exclude)
  1545             if connector:
  1545             if connector:
  1621             if self.Editor.HasCapture():
  1621             if self.Editor.HasCapture():
  1622                 self.Editor.ReleaseMouse()
  1622                 self.Editor.ReleaseMouse()
  1623             self.Editor.PopupMenu(menu)
  1623             self.Editor.PopupMenu(menu)
  1624             menu.Destroy()
  1624             menu.Destroy()
  1625 
  1625 
  1626     def PopupBlockMenu(self, connector = None):
  1626     def PopupBlockMenu(self, connector=None):
  1627         menu = wx.Menu(title='')
  1627         menu = wx.Menu(title='')
  1628         if connector is not None and connector.IsCompatible("BOOL"):
  1628         if connector is not None and connector.IsCompatible("BOOL"):
  1629             self.AddBlockPinMenuItems(menu, connector)
  1629             self.AddBlockPinMenuItems(menu, connector)
  1630         else:
  1630         else:
  1631             edit = self.SelectedElement.GetType() in self.Controler.GetProjectPouNames(self.Debug)
  1631             edit = self.SelectedElement.GetType() in self.Controler.GetProjectPouNames(self.Debug)
  2381             if position.y < SCROLL_ZONE and ystart > 0:
  2381             if position.y < SCROLL_ZONE and ystart > 0:
  2382                 move_window.y = -1
  2382                 move_window.y = -1
  2383             elif position.y > window_size[1] - SCROLL_ZONE:
  2383             elif position.y > window_size[1] - SCROLL_ZONE:
  2384                 move_window.y = 1
  2384                 move_window.y = 1
  2385             if move_window.x != 0 or move_window.y != 0:
  2385             if move_window.x != 0 or move_window.y != 0:
  2386                 self.RefreshVisibleElements(xp = xstart + move_window.x, yp = ystart + move_window.y)
  2386                 self.RefreshVisibleElements(xp=xstart + move_window.x, yp=ystart + move_window.y)
  2387                 self.Scroll(xstart + move_window.x, ystart + move_window.y)
  2387                 self.Scroll(xstart + move_window.x, ystart + move_window.y)
  2388                 self.RefreshScrollBars(move_window.x, move_window.y)
  2388                 self.RefreshScrollBars(move_window.x, move_window.y)
  2389 
  2389 
  2390     def BlockCompatibility(self, startblock=None, endblock=None, direction = None):
  2390     def BlockCompatibility(self, startblock=None, endblock=None, direction=None):
  2391         return True
  2391         return True
  2392 
  2392 
  2393     def GetPopupMenuItems(self):
  2393     def GetPopupMenuItems(self):
  2394         start_connector = self.SelectedElement.GetStartConnected()
  2394         start_connector = self.SelectedElement.GetStartConnected()
  2395         start_direction = start_connector.GetDirection()
  2395         start_direction = start_connector.GetDirection()
  2583             id = self.GetNewId()
  2583             id = self.GetNewId()
  2584             values = dialog.GetValues()
  2584             values = dialog.GetValues()
  2585             values.setdefault("name", "")
  2585             values.setdefault("name", "")
  2586             block = FBD_Block(self, values["type"], values["name"], id,
  2586             block = FBD_Block(self, values["type"], values["name"], id,
  2587                     values["extension"], values["inputs"],
  2587                     values["extension"], values["inputs"],
  2588                     executionControl = values["executionControl"],
  2588                     executionControl=values["executionControl"],
  2589                     executionOrder = values["executionOrder"])
  2589                     executionOrder=values["executionOrder"])
  2590             self.Controler.AddEditedElementBlock(self.TagName, id, values["type"], values.get("name", None))
  2590             self.Controler.AddEditedElementBlock(self.TagName, id, values["type"], values.get("name", None))
  2591             connector = None
  2591             connector = None
  2592             if wire is not None:
  2592             if wire is not None:
  2593                 for input_connector in block.GetConnectors()["inputs"]:
  2593                 for input_connector in block.GetConnectors()["inputs"]:
  2594                     if input_connector.IsCompatible(
  2594                     if input_connector.IsCompatible(
  2746                 connector = transition.GetConditionConnector()
  2746                 connector = transition.GetConditionConnector()
  2747             else:
  2747             else:
  2748                 connector = transition.GetConnectors()["inputs"][0]
  2748                 connector = transition.GetConnectors()["inputs"][0]
  2749             self.AddNewElement(transition, bbox, wire, connector)
  2749             self.AddNewElement(transition, bbox, wire, connector)
  2750 
  2750 
  2751     def AddNewDivergence(self, bbox, poss_div_types = None, wire=None):
  2751     def AddNewDivergence(self, bbox, poss_div_types=None, wire=None):
  2752         dialog = SFCDivergenceDialog(self.ParentWindow, self.Controler, self.TagName, poss_div_types)
  2752         dialog = SFCDivergenceDialog(self.ParentWindow, self.Controler, self.TagName, poss_div_types)
  2753         dialog.SetPreviewFont(self.GetFont())
  2753         dialog.SetPreviewFont(self.GetFont())
  2754         dialog.SetMinElementSize((bbox.width, bbox.height))
  2754         dialog.SetMinElementSize((bbox.width, bbox.height))
  2755         if dialog.ShowModal() == wx.ID_OK:
  2755         if dialog.ShowModal() == wx.ID_OK:
  2756             id = self.GetNewId()
  2756             id = self.GetNewId()
  2810             if "name" in new_values:
  2810             if "name" in new_values:
  2811                 block.SetName(new_values["name"])
  2811                 block.SetName(new_values["name"])
  2812             else:
  2812             else:
  2813                 block.SetName("")
  2813                 block.SetName("")
  2814             block.SetSize(*self.GetScaledSize(new_values["width"], new_values["height"]))
  2814             block.SetSize(*self.GetScaledSize(new_values["width"], new_values["height"]))
  2815             block.SetType(new_values["type"], new_values["extension"], executionControl = new_values["executionControl"])
  2815             block.SetType(new_values["type"], new_values["extension"], executionControl=new_values["executionControl"])
  2816             block.SetExecutionOrder(new_values["executionOrder"])
  2816             block.SetExecutionOrder(new_values["executionOrder"])
  2817             rect = rect.Union(block.GetRedrawRect())
  2817             rect = rect.Union(block.GetRedrawRect())
  2818             self.RefreshBlockModel(block)
  2818             self.RefreshBlockModel(block)
  2819             self.RefreshBuffer()
  2819             self.RefreshBuffer()
  2820             if old_values["executionOrder"] != new_values["executionOrder"]:
  2820             if old_values["executionOrder"] != new_values["executionOrder"]:
  3620         if wx.Platform == '__WXMSW__':
  3620         if wx.Platform == '__WXMSW__':
  3621             wx.CallAfter(self.RefreshVisibleElements)
  3621             wx.CallAfter(self.RefreshVisibleElements)
  3622             self.Editor.Freeze()
  3622             self.Editor.Freeze()
  3623             wx.CallAfter(self.Editor.Thaw)
  3623             wx.CallAfter(self.Editor.Thaw)
  3624         elif event.GetOrientation() == wx.HORIZONTAL:
  3624         elif event.GetOrientation() == wx.HORIZONTAL:
  3625             self.RefreshVisibleElements(xp = event.GetPosition())
  3625             self.RefreshVisibleElements(xp=event.GetPosition())
  3626         else:
  3626         else:
  3627             self.RefreshVisibleElements(yp = event.GetPosition())
  3627             self.RefreshVisibleElements(yp=event.GetPosition())
  3628 
  3628 
  3629         # Handle scroll in debug to fully redraw area and ensuring
  3629         # Handle scroll in debug to fully redraw area and ensuring
  3630         # instance path is fully draw without flickering
  3630         # instance path is fully draw without flickering
  3631         if self.Debug and wx.Platform != '__WXMSW__':
  3631         if self.Debug and wx.Platform != '__WXMSW__':
  3632             x, y = self.GetViewStart()
  3632             x, y = self.GetViewStart()
  3645         if self.StartMousePos is None or self.StartScreenPos is None:
  3645         if self.StartMousePos is None or self.StartScreenPos is None:
  3646             rotation = event.GetWheelRotation() / event.GetWheelDelta()
  3646             rotation = event.GetWheelRotation() / event.GetWheelDelta()
  3647             if event.ShiftDown():
  3647             if event.ShiftDown():
  3648                 x, y = self.GetViewStart()
  3648                 x, y = self.GetViewStart()
  3649                 xp = max(0, min(x - rotation * 3, self.Editor.GetVirtualSize()[0] / self.Editor.GetScrollPixelsPerUnit()[0]))
  3649                 xp = max(0, min(x - rotation * 3, self.Editor.GetVirtualSize()[0] / self.Editor.GetScrollPixelsPerUnit()[0]))
  3650                 self.RefreshVisibleElements(xp = xp)
  3650                 self.RefreshVisibleElements(xp=xp)
  3651                 self.Scroll(xp, y)
  3651                 self.Scroll(xp, y)
  3652             elif event.ControlDown():
  3652             elif event.ControlDown():
  3653                 dc = self.GetLogicalDC()
  3653                 dc = self.GetLogicalDC()
  3654                 self.SetScale(self.CurrentScale + rotation, mouse_event = event)
  3654                 self.SetScale(self.CurrentScale + rotation, mouse_event=event)
  3655                 self.ParentWindow.RefreshDisplayMenu()
  3655                 self.ParentWindow.RefreshDisplayMenu()
  3656             else:
  3656             else:
  3657                 x, y = self.GetViewStart()
  3657                 x, y = self.GetViewStart()
  3658                 yp = max(0, min(y - rotation * 3, self.Editor.GetVirtualSize()[1] / self.Editor.GetScrollPixelsPerUnit()[1]))
  3658                 yp = max(0, min(y - rotation * 3, self.Editor.GetVirtualSize()[1] / self.Editor.GetScrollPixelsPerUnit()[1]))
  3659                 self.RefreshVisibleElements(yp = yp)
  3659                 self.RefreshVisibleElements(yp=yp)
  3660                 self.Scroll(x, yp)
  3660                 self.Scroll(x, yp)
  3661 
  3661 
  3662     def OnMoveWindow(self, event):
  3662     def OnMoveWindow(self, event):
  3663         client_size = self.GetClientSize()
  3663         client_size = self.GetClientSize()
  3664         if self.LastClientSize != client_size:
  3664         if self.LastClientSize != client_size:
  3665             self.LastClientSize = client_size
  3665             self.LastClientSize = client_size
  3666             self.RefreshScrollBars()
  3666             self.RefreshScrollBars()
  3667             self.RefreshVisibleElements()
  3667             self.RefreshVisibleElements()
  3668         event.Skip()
  3668         event.Skip()
  3669 
  3669 
  3670     def DoDrawing(self, dc, printing = False):
  3670     def DoDrawing(self, dc, printing=False):
  3671         if printing:
  3671         if printing:
  3672             if getattr(dc, "printing", False):
  3672             if getattr(dc, "printing", False):
  3673                 font = wx.Font(self.GetFont().GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
  3673                 font = wx.Font(self.GetFont().GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
  3674                 dc.SetFont(font)
  3674                 dc.SetFont(font)
  3675             else:
  3675             else: