21 # You should have received a copy of the GNU General Public License |
21 # You should have received a copy of the GNU General Public License |
22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 |
25 |
26 |
|
27 |
|
28 import math |
26 import math |
29 from time import time as gettime |
27 from time import time as gettime |
30 from threading import Lock |
28 from threading import Lock |
31 from future.builtins import round |
|
32 |
29 |
33 import wx |
30 import wx |
34 from six.moves import xrange |
|
35 |
31 |
36 from plcopen.structures import * |
32 from plcopen.structures import * |
37 from plcopen.types_enums import ComputePouName |
33 from plcopen.types_enums import ComputePouName |
38 from PLCControler import ITEM_VAR_LOCAL, ITEM_POU, ITEM_PROGRAM, ITEM_FUNCTIONBLOCK |
34 from PLCControler import ITEM_VAR_LOCAL, ITEM_POU, ITEM_PROGRAM, ITEM_FUNCTIONBLOCK |
39 |
35 |
3398 new_pos = [int(x / self.ViewScale[0]), int(y / self.ViewScale[1])] |
3394 new_pos = [int(x / self.ViewScale[0]), int(y / self.ViewScale[1])] |
3399 else: |
3395 else: |
3400 middle = True |
3396 middle = True |
3401 new_pos = [bbx.x, bbx.y] |
3397 new_pos = [bbx.x, bbx.y] |
3402 result = self.Controler.PasteEditedElementInstances(self.TagName, element, new_pos, middle, self.Debug) |
3398 result = self.Controler.PasteEditedElementInstances(self.TagName, element, new_pos, middle, self.Debug) |
3403 if not isinstance(result, string_types): |
3399 if not isinstance(result, str): |
3404 self.RefreshBuffer() |
3400 self.RefreshBuffer() |
3405 self.RefreshView(selection=result) |
3401 self.RefreshView(selection=result) |
3406 self.RefreshVariablePanel() |
3402 self.RefreshVariablePanel() |
3407 self.ParentWindow.RefreshPouInstanceVariablesPanel() |
3403 self.ParentWindow.RefreshPouInstanceVariablesPanel() |
3408 else: |
3404 else: |