-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinputnumber.py
More file actions
58 lines (49 loc) · 1.97 KB
/
inputnumber.py
File metadata and controls
58 lines (49 loc) · 1.97 KB
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
###########################################################################
# Copyright (C) 2008 by kosh
# <kosh@kosh.aesaeion.com>
#
# Copyright: See COPYING file that comes with this distribution
#
###########################################################################
#This software is released under GNU public license. See details in the URL:
#http://www.gnu.org/copyleft/gpl.html
from userobject import UserObject
#For Security control and init
from AccessControl import ClassSecurityInfo
import Globals
class InputNumber(UserObject):
"Input number class for items common to float and int"
meta_type = "InputNumber"
security = ClassSecurityInfo()
data = 0.0
calculated = None
scriptChangePath = ''
classConfig = {}
classConfig['scriptChangePath'] = {'name':'Path to change notification script', 'type': 'path'}
security.declareProtected("Access contents information", "float")
def float(self):
"Return the floating point of this number"
if self.data:
return float(self.data)
elif self.calculated is not None:
return float(self.calculated)
else:
return 0.0
security.declareProtected("Access contents information", "int")
def int(self):
"Return the floating point of this number"
if self.data:
return int(self.data)
elif self.calculated is not None:
return int(self.calculated)
else:
return 0
security.declarePrivate('populatorInformation')
def populatorInformation(self):
"return a string that this metods pair can read back to load data in this object"
return self.data
security.declareProtected('Change CompoundDoc', 'store')
def store(self, value):
"set the calculation value of this object"
self.populatorLoader(value)
Globals.InitializeClass(InputNumber)