-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinputint.py
48 lines (40 loc) · 1.46 KB
/
inputint.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
#This software is released under GNU public license. See details in the URL:
#http://www.gnu.org/copyleft/gpl.html
from inputnumber import InputNumber
#For Security control and init
from AccessControl import ClassSecurityInfo
import Globals
import types
class InputInt(InputNumber):
"Input text class"
meta_type = "InputInt"
security = ClassSecurityInfo()
data = 0
calculated = None
security.declareProtected('View management screens', 'edit')
def edit(self, pageId=None, *args, **kw):
"Inline edit short object"
temp = []
if self.calculated is not None:
temp.append(str(self.calculated))
temp.append(self.input_number('data', self.data, pageId=pageId))
return ''.join(temp)
security.declareProtected('View', 'view')
def view(self):
"Inline draw view"
return self.int()
security.declareProtected('Change CompoundDoc', 'setCalculationValue')
def setCalculationValue(self, value):
"set the calculation value of this object"
if value and isinstance(value, types.FloatType):
self.setObject('calculated', int(value))
security.declarePrivate('populatorLoader')
def populatorLoader(self, string):
"load the data into this object if it matches me"
try:
self.setObject('data', int(string))
except ValueError:
pass
Globals.InitializeClass(InputInt)
import register
register.registerClass(InputInt)