16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2002 Free Software Foundation |
# Copyright 2002-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# Button.py |
# Button.py |
29 |
from gnue.common import GDebug |
from gnue.common import GDebug |
30 |
from constants import * |
from constants import * |
31 |
from Control import Control |
from Control import Control |
32 |
|
import curses |
33 |
import sio |
import sio |
34 |
|
|
35 |
# |
# |
55 |
self.SetMethod("GOTFOCUS", None) # user event |
self.SetMethod("GOTFOCUS", None) # user event |
56 |
self.SetMethod("SYSRUN", self.Run) # system event |
self.SetMethod("SYSRUN", self.Run) # system event |
57 |
self.EXITFORM = 0 |
self.EXITFORM = 0 |
58 |
self.COLOR = sio.C_BUTTON |
self.SetColor('BUTTON','BUTTON_FOCUS') |
|
self.FOCUSCOLOR = sio.C_BUTTON_FOCUS |
|
|
# self.SetColor(sio.C_BUTTON) |
|
59 |
|
|
60 |
|
|
61 |
def Run(self, v1, v2, v3): # handle user actions |
def Run(self, v1, v2, v3): # handle user actions |
100 |
if Container == None: |
if Container == None: |
101 |
raise "No container!" |
raise "No container!" |
102 |
if HaveFocus: |
if HaveFocus: |
103 |
self.SetColor(sio.C_BUTTON_FOCUS) |
color = self.FOCUSCOLOR |
|
self.HiLight() |
|
104 |
else: |
else: |
105 |
self.SetColor(sio.C_BUTTON) |
color = self.COLOR |
|
self.LoLight() |
|
106 |
tROW, tCOL = self._ABSY, self._ABSX |
tROW, tCOL = self._ABSY, self._ABSX |
107 |
tCaption = self.CAPTION |
tCaption = self.CAPTION |
108 |
tW = self.W |
tW = self.W |
121 |
spaces += 1 |
spaces += 1 |
122 |
|
|
123 |
tCaption = (" " * leadingSpaces) + tCaption + (" " * spaces) |
tCaption = (" " * leadingSpaces) + tCaption + (" " * spaces) |
124 |
Container.PrintAt(tROW, tCOL, "<" + tCaption + ">") |
Container.PrintAt(tROW, tCOL, "<" + tCaption + ">", color) |
125 |
|
|
126 |
def GotFocus(self, Arg1, Arg2, Arg3): |
def GotFocus(self, Arg1, Arg2, Arg3): |
127 |
self.FOCUS = 1 |
self.FOCUS = 1 |