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

Skip to content

Commit a73f78b

Browse files
committed
use proper APIs for activate/deactivate
1 parent 622087a commit a73f78b

1 file changed

Lines changed: 5 additions & 17 deletions

File tree

Mac/Tools/IDE/Wcontrols.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ def show(self, onoff):
6565
def activate(self, onoff):
6666
self._activated = onoff
6767
if self._enabled:
68-
self._control.HiliteControl((not onoff) and 255)
68+
if onoff:
69+
self._control.ActivateControl()
70+
else:
71+
self._control.DeactivateControl()
6972

7073
def draw(self, visRgn = None):
7174
if self._visible:
@@ -105,7 +108,7 @@ def push(self):
105108
if not self._enabled:
106109
return
107110
import time
108-
self._control.HiliteControl(1)
111+
self._control.HiliteControl(Controls.kControlButtonPart)
109112
time.sleep(0.1)
110113
self._control.HiliteControl(0)
111114
if self._callback:
@@ -116,11 +119,6 @@ def enable(self, onoff):
116119
self._control.HiliteControl((not onoff) and 255)
117120
self._enabled = onoff
118121

119-
def activate(self, onoff):
120-
self._activated = onoff
121-
if self._enabled:
122-
self._control.HiliteControl((not onoff) and 255)
123-
124122
def show(self, onoff):
125123
ControlWidget.show(self, onoff)
126124

@@ -332,16 +330,6 @@ def adjust(self, oldbounds):
332330
Qd.FrameRect(self._bounds)
333331
self.GetWindow().ValidWindowRect(self._bounds)
334332

335-
def activate(self, onoff):
336-
self._activated = onoff
337-
if self._visible:
338-
if onoff:
339-
self._control.ShowControl()
340-
else:
341-
self._control.HideControl()
342-
self.draw(None)
343-
self.GetWindow().ValidWindowRect(self._bounds)
344-
345333
def set(self, value):
346334
if self._control:
347335
self._control.SetControlValue(value)

0 commit comments

Comments
 (0)