equal
deleted
inserted
replaced
277 if values[1] == "debug": |
277 if values[1] == "debug": |
278 pass |
278 pass |
279 elif values[1] == "program": |
279 elif values[1] == "program": |
280 message = _("Programs can't be used by other POUs!") |
280 message = _("Programs can't be used by other POUs!") |
281 elif values[1] in ["function", "functionBlock"]: |
281 elif values[1] in ["function", "functionBlock"]: |
282 words = tagname.split("::") |
|
283 if pou_name == values[0]: |
282 if pou_name == values[0]: |
284 message = _("\"%s\" can't use itself!") % pou_name |
283 message = _("\"%s\" can't use itself!") % pou_name |
285 elif pou_type == "function" and values[1] != "function": |
284 elif pou_type == "function" and values[1] != "function": |
286 message = _("Function Blocks can't be used in Functions!") |
285 message = _("Function Blocks can't be used in Functions!") |
287 elif self.ParentWindow.Controler.PouIsUsedBy(pou_name, values[0], self.ParentWindow.Debug): |
286 elif self.ParentWindow.Controler.PouIsUsedBy(pou_name, values[0], self.ParentWindow.Debug): |
1242 self.current_id = 0 |
1241 self.current_id = 0 |
1243 # Start by reseting Viewer |
1242 # Start by reseting Viewer |
1244 self.Flush() |
1243 self.Flush() |
1245 self.ResetView() |
1244 self.ResetView() |
1246 self.ResetBuffer() |
1245 self.ResetBuffer() |
1247 instance = {} |
1246 |
1248 # List of ids of already loaded blocks |
1247 # List of ids of already loaded blocks |
1249 instances = self.Controler.GetEditedElementInstancesInfos(self.TagName, debug=self.Debug) |
1248 instances = self.Controler.GetEditedElementInstancesInfos(self.TagName, debug=self.Debug) |
1250 # Load Blocks until they are all loaded |
1249 # Load Blocks until they are all loaded |
1251 while len(instances) > 0: |
1250 while len(instances) > 0: |
1252 self.loadInstance(instances.popitem(0)[1], instances, selection) |
1251 self.loadInstance(instances.popitem(0)[1], instances, selection) |
1839 connection.SetSize(*self.GetScaledSize(*connection.GetMinSize())) |
1838 connection.SetSize(*self.GetScaledSize(*connection.GetMinSize())) |
1840 |
1839 |
1841 # Calculate position of connector at the right of start connector |
1840 # Calculate position of connector at the right of start connector |
1842 connector = connection.GetConnectors()["inputs"][0] |
1841 connector = connection.GetConnectors()["inputs"][0] |
1843 rel_pos = connector.GetRelPosition() |
1842 rel_pos = connector.GetRelPosition() |
1844 direction = connector.GetDirection() |
|
1845 start_point = start_connector.GetPosition(False) |
1843 start_point = start_connector.GetPosition(False) |
1846 end_point = (start_point[0] + LD_WIRE_SIZE, start_point[1]) |
1844 end_point = (start_point[0] + LD_WIRE_SIZE, start_point[1]) |
1847 connection.SetPosition(end_point[0] - rel_pos[0], |
1845 connection.SetPosition(end_point[0] - rel_pos[0], |
1848 end_point[1] - rel_pos[1]) |
1846 end_point[1] - rel_pos[1]) |
1849 |
1847 |
1872 connection.SetSize(*self.GetScaledSize(*connection.GetMinSize())) |
1870 connection.SetSize(*self.GetScaledSize(*connection.GetMinSize())) |
1873 |
1871 |
1874 # Calculate position of connection at the left of end connector |
1872 # Calculate position of connection at the left of end connector |
1875 connector = connection.GetConnectors()["outputs"][0] |
1873 connector = connection.GetConnectors()["outputs"][0] |
1876 rel_pos = connector.GetRelPosition() |
1874 rel_pos = connector.GetRelPosition() |
1877 direction = connector.GetDirection() |
|
1878 end_point = end_connector.GetPosition(False) |
1875 end_point = end_connector.GetPosition(False) |
1879 start_point = (end_point[0] - LD_WIRE_SIZE, end_point[1]) |
1876 start_point = (end_point[0] - LD_WIRE_SIZE, end_point[1]) |
1880 connection.SetPosition(start_point[0] - rel_pos[0], |
1877 connection.SetPosition(start_point[0] - rel_pos[0], |
1881 start_point[1] - rel_pos[1]) |
1878 start_point[1] - rel_pos[1]) |
1882 |
1879 |
2312 event.Skip() |
2309 event.Skip() |
2313 |
2310 |
2314 def OnViewerMotion(self, event): |
2311 def OnViewerMotion(self, event): |
2315 if self.Editor.HasCapture() and not event.Dragging(): |
2312 if self.Editor.HasCapture() and not event.Dragging(): |
2316 return |
2313 return |
2317 refresh = False |
|
2318 dc = self.GetLogicalDC() |
2314 dc = self.GetLogicalDC() |
2319 pos = GetScaledEventPosition(event, dc, self.Scaling) |
2315 pos = GetScaledEventPosition(event, dc, self.Scaling) |
2320 if event.MiddleIsDown() or self.Mode == MODE_MOTION: |
2316 if event.MiddleIsDown() or self.Mode == MODE_MOTION: |
2321 if self.StartMousePos is not None and self.StartScreenPos is not None: |
2317 if self.StartMousePos is not None and self.StartScreenPos is not None: |
2322 new_pos = event.GetPosition() |
2318 new_pos = event.GetPosition() |
3680 x, y = self.GetViewStart() |
3676 x, y = self.GetViewStart() |
3681 xp = max(0, min(x - rotation * 3, self.Editor.GetVirtualSize()[0] / self.Editor.GetScrollPixelsPerUnit()[0])) |
3677 xp = max(0, min(x - rotation * 3, self.Editor.GetVirtualSize()[0] / self.Editor.GetScrollPixelsPerUnit()[0])) |
3682 self.RefreshVisibleElements(xp=xp) |
3678 self.RefreshVisibleElements(xp=xp) |
3683 self.Scroll(xp, y) |
3679 self.Scroll(xp, y) |
3684 elif event.ControlDown(): |
3680 elif event.ControlDown(): |
3685 dc = self.GetLogicalDC() |
|
3686 self.SetScale(self.CurrentScale + rotation, mouse_event=event) |
3681 self.SetScale(self.CurrentScale + rotation, mouse_event=event) |
3687 self.ParentWindow.RefreshDisplayMenu() |
3682 self.ParentWindow.RefreshDisplayMenu() |
3688 else: |
3683 else: |
3689 x, y = self.GetViewStart() |
3684 x, y = self.GetViewStart() |
3690 yp = max(0, min(y - rotation * 3, self.Editor.GetVirtualSize()[1] / self.Editor.GetScrollPixelsPerUnit()[1])) |
3685 yp = max(0, min(y - rotation * 3, self.Editor.GetVirtualSize()[1] / self.Editor.GetScrollPixelsPerUnit()[1])) |