6
def __init__(self, arg):
7
if InputDispatcher.di.has_key(arg):
8
raise Exception("Duplicated argument:"+arg)
12
def __call__(self, func):
13
if hasattr(self, 'tmparg'):
14
InputDispatcher.di[self.tmparg] = func
17
def dispatch(cls, inpu):
20
if InputDispatcher.di.has_key(inpu):
21
return InputDispatcher.di[inpu]()
23
raise Exception("No registred reciver for:"+inpu)
27
#highlightTypeField.setValue("highlightTypeUserVersusExpert")
28
sys.stdout.write('\a')
32
renderMethod = renderMethodField.getValue()
36
renderMethodField.setValue(renderMethod)
39
def doShiftWindowLeft():
40
windowCenter = windowCenterField.getValue()
41
windowWidth = windowWidthField.getValue()
42
if (windowCenter - (windowWidth/2)) > 0:
43
windowCenter = windowCenter - 1
44
windowCenterField.setValue(windowCenter)
47
def doShiftWindowRight():
48
windowCenter = windowCenterField.getValue()
49
windowWidth = windowWidthField.getValue()
50
if (windowCenter + (windowWidth/2)) < 255:
51
windowCenter = windowCenter + 1
52
windowCenterField.setValue(windowCenter)
55
def doDecreaseWindowWidth():
56
windowCenter = windowCenterField.getValue()
57
windowWidth = windowWidthField.getValue()
58
if (windowCenter - (windowWidth/2)) > 0 and windowWidth > 2:
59
windowWidthField.setValue(windowWidth - 1)
62
def doIncreaseWindowWidth():
63
windowCenter = windowCenterField.getValue()
64
windowWidth = windowWidthField.getValue()
65
if (windowCenter + (windowWidth/2)) < 255 and windowWidth < 255 and windowCenter - (windowWidth/2) > 1:
66
windowWidthField.setValue(windowWidth + 1)
69
def doDecreaseCutRadius():
70
cutRadiusField.setValue(cutRadiusField.getValue() / 1.1)
73
def doIncreaseCutRadius():
74
cutRadiusField.setValue(cutRadiusField.getValue() * 1.1)
77
def doDecreaseDrillSpeed():
78
drillSpeedField.setValue(drillSpeedField.getValue() / 1.1)
81
def doIncreaseDrillSpeed():
82
drillSpeedField.setValue(drillSpeedField.getValue() * 1.1)
85
def doToggleSegment():
86
segment = segmentField.getValue()
88
segmentField.setValue(128)
89
elif (segment == 128):
90
segmentField.setValue(192)
91
elif (segment == 192):
92
segmentField.setValue(255)
93
elif (segment == 255):
94
segmentField.setValue(64)
97
def doIncreaseHardness():
98
segment = segmentField.getValue()
100
hardness64Field.setValue(hardness64Field.getValue() + 0.01)
101
elif (segment == 128):
102
hardness128Field.setValue(hardness128Field.getValue() + 0.01)
103
elif (segment == 192):
104
hardness192Field.setValue(hardness192Field.getValue() + 0.01)
105
elif (segment == 255):
106
hardness255Field.setValue(hardness255Field.getValue() + 0.01)
108
@InputDispatcher('[')
109
def doDecreaseHardness():
110
segment = segmentField.getValue()
112
hardness64Field.setValue(hardness64Field.getValue() - 0.01)
113
elif (segment == 128):
114
hardness128Field.setValue(hardness128Field.getValue() - 0.01)
115
elif (segment == 192):
116
hardness192Field.setValue(hardness192Field.getValue() - 0.01)
117
elif (segment == 255):
118
hardness255Field.setValue(hardness255Field.getValue() - 0.01)
120
@InputDispatcher('@')
121
def doToggleSetHardness():
122
hardnessSetEnabledField.setValue(not hardnessSetEnabledField.getValue()) #Toggle between true/false
124
@InputDispatcher('-')
125
def doResetTimePlayback():
126
resetTimePlaybackField.setValue(True)
127
playbackDirectionField.setValue(0)
129
@InputDispatcher('n')
130
def doDecreaseTimePlayback():
131
playbackDirectionField.setValue(-1)
132
runPlaybackField.setValue(False)
134
@InputDispatcher('m')
135
def doIncreaseTimePlayback():
136
playbackDirectionField.setValue(1)
137
runPlaybackField.setValue(False)
139
@InputDispatcher('p')
140
def doIncreaseTimePlayback():
141
runPlaybackField.setValue(not runPlaybackField.getValue())
143
@InputDispatcher('P')
145
playHapticField.setValue(True)
147
@InputDispatcher('S')
150
saveVolumeField.setValue(True)
151
if saveHapticField.getValue() == True:
153
length = len(tempPos)
154
FILE = open("positionTest.txt",'w')
159
print 'Haptic saved to file'
160
saveHapticField.setValue(False)
162
@InputDispatcher('A')
163
def doToggleSaveHaptic():
164
saveHapticField.setValue(not saveHapticField.getValue()) #Toggle between true/false
166
@InputDispatcher('5')
167
def doSaveStatisitcsToFile():
168
saveStatisticsToFileField.setValue(True)
169
sys.stdout.write('\a')
171
@InputDispatcher('6')
172
def doSaveExpertToFile():
173
saveExpertToFileField.setValue(True)
174
sys.stdout.write('\a')
176
@InputDispatcher('7')
177
def doHighlightTypeNormal():
178
highlightTypeField.setValue("highlightTypeNormal")
179
sys.stdout.write('\a')
181
@InputDispatcher('8')
182
def doHighlightTypeExpert():
183
highlightTypeField.setValue("highlightTypeExpert")
184
sys.stdout.write('\a')
186
@InputDispatcher('9')
187
def doHighlightTypeSegment():
188
highlightTypeField.setValue("highlightTypeSegment")
189
sys.stdout.write('\a')
191
@InputDispatcher('0')
192
def doHighlightTypeUserVsExpert():
193
highlightTypeField.setValue("highlightTypeUserVersusExpert")
194
sys.stdout.write('\a')