-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathScriptOp.py
69 lines (50 loc) · 1.77 KB
/
ScriptOp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from Operation import Operation
import cad
from nc.nc import *
from Object import PyProperty
type = 0
class ScriptOp(Operation):
def __init__(self):
Operation.__init__(self)
self.str = ''
self.ReadDefaultValues()
def WriteXml(self):
cad.SetXmlValue('script', self.str)
Operation.WriteXml(self)
def ReadXml(self):
self.str = cad.GetXmlValue('script')
Operation.ReadXml(self)
def TypeName(self):
return "ScriptOp"
def GetType(self):
return type
def op_icon(self):
# the name of the PNG file in the HeeksCNC icons folder
return "scriptop"
def HasEdit(self):
return True
def Edit(self):
import ScriptOpDlg
res = ScriptOpDlg.Do(self)
return res
def MakeACopy(self):
copy = ScriptOp()
copy.CopyFrom(self)
return copy
def CopyFrom(self, object):
Operation.CopyFrom(self, object)
self.str = object.str
def GetProperties(self):
properties = []
properties.append(PyProperty('Script', 'str', self))
properties[-1].type = cad.PROPERTY_TYPE_LONG_STRING
properties += Operation.GetProperties(self)
return properties
def DoGCodeCalls(self):
exec(self.str, globals())
class PyMultiLineProperty(PyProperty):
def __init__(self, title, value_name, object, num_lines, recalculate = None):
PyProperty.__init__(self, title, value_name, object, recalculate)
self.number_of_lines = number_of_lines
def GetNumberOfLines(self):
return self.number_of_lines