Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2dd4d16

Browse files
committed
use 32bit APIs for control values, refactor slightly
1 parent 52a42e9 commit 2dd4d16

1 file changed

Lines changed: 28 additions & 42 deletions

File tree

Mac/Tools/IDE/Wcontrols.py

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ def settitle(self, title):
9494

9595
def gettitle(self):
9696
return self._title
97+
98+
def set(self, value):
99+
if self._control:
100+
self._control.SetControl32BitValue(value)
101+
else:
102+
self._value = value
103+
104+
def get(self):
105+
if self._control:
106+
return self._control.GetControl32BitValue()
107+
else:
108+
return self._value
109+
97110

98111
class Button(ControlWidget):
99112

@@ -165,19 +178,7 @@ def push(self):
165178

166179
def toggle(self):
167180
self.set(not self.get())
168-
169-
def set(self, value):
170-
if self._control:
171-
self._control.SetControlValue(value)
172-
else:
173-
self._value = value
174-
175-
def get(self):
176-
if self._control:
177-
return self._control.GetControlValue()
178-
else:
179-
return self._value
180-
181+
181182

182183
class RadioButton(ControlWidget):
183184

@@ -217,13 +218,7 @@ def set(self, value):
217218
button._control.SetControlValue(button == self)
218219
else:
219220
button._value = (button == self)
220-
221-
def get(self):
222-
if self._control:
223-
return self._control.GetControlValue()
224-
else:
225-
return self._value
226-
221+
227222

228223
class Scrollbar(ControlWidget):
229224

@@ -234,9 +229,9 @@ def __init__(self, possize, callback = None, value = 0, min = 0, max = 0):
234229
ControlWidget.__init__(self, possize, "", procID, callback, value, min, max)
235230

236231
# interface
237-
def set(self, value):
238-
if self._callback:
239-
Wbase.CallbackCall(self._callback, 1, value)
232+
# def set(self, value):
233+
# if self._callback:
234+
# Wbase.CallbackCall(self._callback, 1, value)
240235

241236
def up(self):
242237
if self._callback:
@@ -255,16 +250,19 @@ def pagedown(self):
255250
Wbase.CallbackCall(self._callback, 1, '--')
256251

257252
def setmin(self, min):
258-
self._control.SetControlMinimum(min)
253+
self._control.SetControl32BitMinimum(min)
254+
255+
def setmax(self, max):
256+
self._control.SetControl32BitMaximum(max)
259257

260-
def setmax(self, min):
261-
self._control.SetControlMinimum(max)
258+
def setviewsize(self, view):
259+
self._control.SetControlViewSize(view)
262260

263261
def getmin(self):
264-
return self._control.GetControlMinimum()
262+
return self._control.GetControl32BitMinimum()
265263

266264
def getmax(self):
267-
return self._control.GetControlMinimum()
265+
return self._control.GetControl32BitMaximum()
268266

269267
# internals
270268
def click(self, point, modifiers):
@@ -299,7 +297,7 @@ def click(self, point, modifiers):
299297

300298
def _hit(self, part):
301299
if part == Controls.inThumb:
302-
value = self._control.GetControlValue()
300+
value = self._control.GetControl32BitValue()
303301
elif part == Controls.inUpButton:
304302
value = "+"
305303
elif part == Controls.inDownButton:
@@ -329,19 +327,7 @@ def adjust(self, oldbounds):
329327
else:
330328
Qd.FrameRect(self._bounds)
331329
self.GetWindow().ValidWindowRect(self._bounds)
332-
333-
def set(self, value):
334-
if self._control:
335-
self._control.SetControlValue(value)
336-
else:
337-
self._value = value
338-
339-
def get(self):
340-
if self._control:
341-
return self._control.GetControlValue()
342-
else:
343-
return self._value
344-
330+
345331

346332
def _scalebarvalue(absmin, absmax, curmin, curmax):
347333
if curmin <= absmin and curmax >= absmax:

0 commit comments

Comments
 (0)