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 |
# TextBox.py |
# TextBox.py |
65 |
self.laststart = 0 |
self.laststart = 0 |
66 |
self.EDITABLE = 1 |
self.EDITABLE = 1 |
67 |
|
|
68 |
self.SetColor(sio.C_TEXTBOX) |
self.SetColor('TEXTBOX', 'TEXTBOX_FOCUS') |
69 |
|
|
70 |
def Run(self, v1, v2, v3): |
def Run(self, v1, v2, v3): |
71 |
Container = self.PARENT.Screen() |
Container = self.PARENT.Screen() |
173 |
Visuals = line + ((W - TextLen) * "_") |
Visuals = line + ((W - TextLen) * "_") |
174 |
if len(Visuals) > W: |
if len(Visuals) > W: |
175 |
Visuals = Visuals[:W-1] + ">" |
Visuals = Visuals[:W-1] + ">" |
176 |
Container.PrintAt(self._ABSY+i, self._ABSX, Visuals) |
Container.PrintAt(self._ABSY+i, self._ABSX, Visuals, self.FOCUS and self.FOCUSCOLOR or self.COLOR) |
177 |
Container.GotoYX(self._ABSY+i, self._ABSX+ Depth) |
Container.GotoYX(self._ABSY+i, self._ABSX+ Depth) |
178 |
else: |
else: |
179 |
if Depth >= W: |
if Depth >= W: |
180 |
Visuals = "<" + Text[Depth - (W - 1):] + (((W - 1) - TextLen) * "_") |
Visuals = "<" + Text[Depth - (W - 1):] + (((W - 1) - TextLen) * "_") |
181 |
if len(Visuals) > W: |
if len(Visuals) > W: |
182 |
Visuals = Visuals[:W] |
Visuals = Visuals[:W] |
183 |
Container.PrintAt(self._ABSY+i, self._ABSX, Visuals) |
Container.PrintAt(self._ABSY+i, self._ABSX, Visuals, self.FOCUS and self.FOCUSCOLOR or self.COLOR) |
184 |
Container.GotoYX(self._ABSY+i, self._ABSX+ W) |
Container.GotoYX(self._ABSY+i, self._ABSX+ W) |
185 |
i += 1 |
i += 1 |
186 |
|
|
187 |
for j in range(self.H - i): |
for j in range(self.H - i): |
188 |
Container.PrintAt(self._ABSY + i + j, self._ABSX, "_" * W) |
Container.PrintAt(self._ABSY + i + j, self._ABSX, "_" * W, self.FOCUS and self.FOCUSCOLOR or self.COLOR) |
189 |
|
|
190 |
|
|
191 |
def SetCursor(self, location): |
def SetCursor(self, location): |
192 |
self.DEPTH = location |
self.DEPTH = location |
193 |
|
Container = self.PARENT.Screen() |
194 |
curses.curs_set(1) |
curses.curs_set(1) |
195 |
|
Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH) |
196 |
self.Paint(None, None, None) |
self.Paint(None, None, None) |
197 |
|
|
198 |
def LostFocus(self, v1, v2, v3): |
def LostFocus(self, v1, v2, v3): |
199 |
self.SetColor(sio.C_TEXTBOX) |
curses.curs_set(0) |
200 |
|
self.SetColor('TEXTBOX') |
201 |
Container = self.PARENT.Screen() |
Container = self.PARENT.Screen() |
202 |
self.Paint(None, None, None) |
if self.PARENT.VISIBLE: |
203 |
|
self.Paint(0,0,0) |
204 |
|
|
205 |
def GotFocus(self, v1, v2, v3): |
def GotFocus(self, v1, v2, v3): |
206 |
self.SetColor(sio.C_TEXTBOX_FOCUS) |
self.SetColor('TEXTBOX_FOCUS') |
207 |
Container = self.PARENT.Screen() |
Container = self.PARENT.Screen() |
208 |
self.Paint(None, None, None) |
self.Paint(None, None, None) |
209 |
Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH) |
Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH) |
210 |
|
|
211 |
def SetValue(self, newText): |
def SetValue(self, newText, repaint=1): |
212 |
self.TEXT = newText |
self.TEXT = newText |
213 |
self.Paint(0,0,0) |
if self.PARENT.VISIBLE: |
214 |
|
self.Paint(0,0,0) |
215 |
|
|
216 |
def GetValue(self): |
def GetValue(self): |
217 |
return self.TEXT |
return self.TEXT |