[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/common/src/cursing Button.py CheckBox.py C...
From: |
Jason Cater |
Subject: |
gnue/common/src/cursing Button.py CheckBox.py C... |
Date: |
Wed, 09 Oct 2002 23:04:41 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/10/09 23:04:41
Modified files:
common/src/cursing: Button.py CheckBox.py CheckBoxGroup.py
ComboBox.py Control.py Dialog.py
DirChooser.py FileSelectPad.py
FileSelector.py FocusedLabel.py Frame.py
GraphicObject.py InputBox.py Label.py
Menu.py MenuBar.py MenuItem.py MsgBoxOK.py
MsgBoxTimer.py MsgBoxYesNo.py Progress.py
RadioButton.py RadioGroup.py
ScreenContainer.py ScrollBar.py TextBox.py
VButton.py VScrollBar.py constants.py sio.py
utility.py
Log message:
lots and lots of cleanup
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Button.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/CheckBox.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/CheckBoxGroup.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/ComboBox.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Control.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Dialog.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/DirChooser.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/FileSelectPad.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/FileSelector.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/FocusedLabel.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Frame.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/GraphicObject.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/InputBox.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Label.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Menu.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/MenuBar.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/MenuItem.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/MsgBoxOK.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/MsgBoxTimer.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/MsgBoxYesNo.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Progress.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/RadioButton.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/RadioGroup.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/ScreenContainer.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/ScrollBar.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/TextBox.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/VButton.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/VScrollBar.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/constants.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/sio.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/utility.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gnue/common/src/cursing/Button.py
diff -c gnue/common/src/cursing/Button.py:1.1
gnue/common/src/cursing/Button.py:1.2
*** gnue/common/src/cursing/Button.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/Button.py Wed Oct 9 23:04:41 2002
***************
*** 37,51 ****
class Button(Control):
def __init__(self, Parent, ButtonName, Y, X, W, Caption, **properties):
apply (Control.__init__, (self, Parent, ButtonName), properties)
! self.SetProperty("PARENT", Parent)
! self.SetProperty("X", X)
! self.SetProperty("Y", Y)
! self.SetProperty("CLASS", "BUTTON")
! self.SetProperty("W", W)
! self.SetProperty("H", 1)
! self.SetProperty("FOCUS", tiFALSE)
! self.SetProperty("CANGETFOCUS", tiTRUE)
! self.SetProperty("CAPTION", Caption) #
self.SetMethod("SYSGOTFOCUS", self.GotFocus) # system event
self.SetMethod("SYSLOSTFOCUS", self.LostFocus) # system event
self.SetMethod("SYSPAINT", self.Paint) # system event
--- 37,51 ----
class Button(Control):
def __init__(self, Parent, ButtonName, Y, X, W, Caption, **properties):
apply (Control.__init__, (self, Parent, ButtonName), properties)
! self.PARENT = Parent
! self.X = X
! self.Y = Y
! self.CLASS = "BUTTON"
! self.W = W
! self.H = 1
! self.FOCUS = 0
! self.CANGETFOCUS = 1
! self.CAPTION = Caption #
self.SetMethod("SYSGOTFOCUS", self.GotFocus) # system event
self.SetMethod("SYSLOSTFOCUS", self.LostFocus) # system event
self.SetMethod("SYSPAINT", self.Paint) # system event
***************
*** 53,101 ****
self.SetMethod("LOSTFOCUS", None) # user event
self.SetMethod("GOTFOCUS", None) # user event
self.SetMethod("SYSRUN", self.Run) # system event
! self.SetProperty("EXITFORM", tiFALSE)
def Run(self, v1, v2, v3): # handle user actions
! Container = self.GetProperty("PARENT").GetProperty("SCREEN")
! if v1 == tiTRUE:
self.ExecMethod("CLICK", self, None, None)
! if self.GetProperty("EXITFORM") == tiTRUE:
! return tiTRUE
self.ExecMethod("SYSGOTFOCUS", None, None, None)
global BACKWARDS
while 1:
ch = Container.GetChar()
! if self.GetProperty("PARENT").BreakOrder(ch) == tiTRUE:
return
! if self.active == tiFALSE:
! return tiFALSE
if ch in (Container.TokNextField, Container.TokRightArrow):
! BACKWARDS = tiFALSE
! return tiFALSE
elif ch == Container.TokLeftArrow:
! BACKWARDS=tiTRUE
! return tiFALSE
! elif ch == self.GetProperty("PARENT").GetProperty("SCREEN").TokActivate:
self.ExecMethod("CLICK", self, None, None)
! if self.GetProperty("EXITFORM") == tiTRUE:
! return(tiTRUE)
self.ExecMethod("SYSGOTFOCUS", None, None, None)
def Paint(self, HaveFocus, v2, v3): # event args not used
"""
control's paint event
There are two ways to tell if we have focus or not. HaveFocus will == 1
when
! the user is sitting on the control **OR** the property FOCUS will ==
tiTRUE.
But, as you see, this is controlled by the person creating the control.
"""
! Container = self.GetProperty("PARENT").GetProperty("SCREEN")
if Container == None:
raise "Container is Nothing in def Paint!"
if HaveFocus:
self.HiLight()
else:
self.LoLight()
! tROW, tCOL = self.GetProperty("Y"), self.GetProperty("X")
! tCaption = self.GetProperty("CAPTION")
! tW = self.GetProperty("W")
tAW = tW - 2
if len(tCaption) > tAW:
tCaption = tCaption[: tAW]
--- 53,101 ----
self.SetMethod("LOSTFOCUS", None) # user event
self.SetMethod("GOTFOCUS", None) # user event
self.SetMethod("SYSRUN", self.Run) # system event
! self.EXITFORM = 0
def Run(self, v1, v2, v3): # handle user actions
! Container = self.PARENT.SCREEN
! if v1 :
self.ExecMethod("CLICK", self, None, None)
! if self.EXITFORM:
! return 1
self.ExecMethod("SYSGOTFOCUS", None, None, None)
global BACKWARDS
while 1:
ch = Container.GetChar()
! if self.PARENT.BreakOrder(ch) :
return
! if self.active == 0:
! return 0
if ch in (Container.TokNextField, Container.TokRightArrow):
! BACKWARDS = 0
! return 0
elif ch == Container.TokLeftArrow:
! BACKWARDS=1
! return 0
! elif ch == self.PARENT.SCREEN.TokActivate:
self.ExecMethod("CLICK", self, None, None)
! if self.EXITFORM:
! return(1)
self.ExecMethod("SYSGOTFOCUS", None, None, None)
def Paint(self, HaveFocus, v2, v3): # event args not used
"""
control's paint event
There are two ways to tell if we have focus or not. HaveFocus will == 1
when
! the user is sitting on the control **OR** the property FOCUS will .
But, as you see, this is controlled by the person creating the control.
"""
! Container = self.PARENT.SCREEN
if Container == None:
raise "Container is Nothing in def Paint!"
if HaveFocus:
self.HiLight()
else:
self.LoLight()
! tROW, tCOL = self.Y, self.X
! tCaption = self.CAPTION
! tW = self.W
tAW = tW - 2
if len(tCaption) > tAW:
tCaption = tCaption[: tAW]
***************
*** 114,126 ****
Container.PrintAt(tROW, tCOL, "[" + tCaption + "]")
def GotFocus(self, Arg1, Arg2, Arg3):
! self.SetProperty("FOCUS", tiTRUE)
self.ExecMethod("SYSPAINT", 1, 0, 0)
! return tiTRUE
def LostFocus(self, Arg1, Arg2, Arg3):
! self.SetProperty("FOCUS", tiFALSE)
self.ExecMethod("SYSPAINT", 0, 0, 0)
! return tiTRUE
--- 114,126 ----
Container.PrintAt(tROW, tCOL, "[" + tCaption + "]")
def GotFocus(self, Arg1, Arg2, Arg3):
! self.FOCUS = 1
self.ExecMethod("SYSPAINT", 1, 0, 0)
! return 1
def LostFocus(self, Arg1, Arg2, Arg3):
! self.FOCUS = 0
self.ExecMethod("SYSPAINT", 0, 0, 0)
! return 1
Index: gnue/common/src/cursing/CheckBox.py
diff -c gnue/common/src/cursing/CheckBox.py:1.1
gnue/common/src/cursing/CheckBox.py:1.2
*** gnue/common/src/cursing/CheckBox.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/CheckBox.py Wed Oct 9 23:04:41 2002
***************
*** 41,49 ****
def __init__( self, Root, Name, Y,X, Caption, Id, **properties):
apply( RadioButton.__init__,
(self, Root, Name, Y,X, Caption, Id), properties)
! cap = self.GetProperty( "CAPTION")
cap = cap[:1] + 'O' + cap[2:]
! self.SetProperty( "CAPTION", cap)
self._active = 'X'
self._inactive = 'O'
--- 41,49 ----
def __init__( self, Root, Name, Y,X, Caption, Id, **properties):
apply( RadioButton.__init__,
(self, Root, Name, Y,X, Caption, Id), properties)
! cap = self.CAPTION
cap = cap[:1] + 'O' + cap[2:]
! self.CAPTION = cap
self._active = 'X'
self._inactive = 'O'
Index: gnue/common/src/cursing/CheckBoxGroup.py
diff -c gnue/common/src/cursing/CheckBoxGroup.py:1.1
gnue/common/src/cursing/CheckBoxGroup.py:1.2
*** gnue/common/src/cursing/CheckBoxGroup.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/CheckBoxGroup.py Wed Oct 9 23:04:41 2002
***************
*** 46,59 ****
self._activeState = 0
def _ToggleItem( self, item, v2,v3):
! if item.GetProperty("ACTIVE") == tiTRUE:
! item.SetProperty("ACTIVE", tiFALSE)
! self._activeState &= ~(int(math.pow(2,item.GetProperty("ID"))))
! item.Paint(tiFALSE,None,None)
else:
! item.SetProperty("ACTIVE", tiTRUE)
! self._activeState |= int(math.pow(2,item.GetProperty("ID")))
! item.Paint(tiTRUE,None,None)
def AddItem(self,itemId,Caption,X=-1,Y=-1,W=-1):
posX = X
--- 46,59 ----
self._activeState = 0
def _ToggleItem( self, item, v2,v3):
! if item.ACTIVE:
! item.ACTIVE = 0
! self._activeState &= ~(int(math.pow(2,item.ID)))
! item.Paint(0,None,None)
else:
! item.ACTIVE = 1
! self._activeState |= int(math.pow(2,item.ID))
! item.Paint(1,None,None)
def AddItem(self,itemId,Caption,X=-1,Y=-1,W=-1):
posX = X
***************
*** 61,71 ****
posW = W
if posW == -1:
! posW = self.GetProperty("W")
if posX == -1:
! posX = self.GetProperty("X")
if posY == -1:
! posY = self.GetProperty("Y") + len(self.buttons) #self.GetProperty("H")
if len(Caption) > posW-3:
cutoff = len(Caption) - (posW-3 )
--- 61,71 ----
posW = W
if posW == -1:
! posW = self.W
if posX == -1:
! posX = self.X
if posY == -1:
! posY = self.Y+ len(self.buttons) #self.H
if len(Caption) > posW-3:
cutoff = len(Caption) - (posW-3 )
***************
*** 73,82 ****
button = CheckBox(self.Parent,str(itemId), \
posY, \
posX, Caption, itemId)
! button.SetProperty("ACTIVE", tiFALSE)
self.Parent.AddControl(button)
button.SetMethod("CLICK",self._ToggleItem)
self.buttons.append(button)
! self.SetProperty("H", self.GetProperty("H") + 1)
--- 73,82 ----
button = CheckBox(self.Parent,str(itemId), \
posY, \
posX, Caption, itemId)
! button.ACTIVE = 0
self.Parent.AddControl(button)
button.SetMethod("CLICK",self._ToggleItem)
self.buttons.append(button)
! self.H = self.H+ 1
Index: gnue/common/src/cursing/ComboBox.py
diff -c gnue/common/src/cursing/ComboBox.py:1.1
gnue/common/src/cursing/ComboBox.py:1.2
*** gnue/common/src/cursing/ComboBox.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/ComboBox.py Wed Oct 9 23:04:41 2002
***************
*** 42,59 ****
"""
def __init__(self,Parent,BoxName, Y, X, W, **properties):
apply(Control.__init__,(self,Parent,BoxName),properties)
! self.SetProperty("PARENT",Parent)
! self.SetProperty("Y",Y)
! self.SetProperty("X",X)
! self.SetProperty("W",W)
! self.SetProperty("H",2)
menuName = (W-5) * ' '
self._menu = Menu(Parent,'cbm',Y,X+1,menuName)
self._button = Button(Parent,'cbbutt',Y,X+W-4,3,chr(tiDAW))
self._button.SetMethod("CLICK", self._Show)
! self._menu.SetProperty("CANGETFOCUS",tiFALSE)
self._menu.SetMethod("CHOSEN",self._chosen)
! self._menu.maxLengthFixed = tiTRUE
self._menu.maxLength = W - 4
self._chosen = None
Parent.AddControl(self._menu)
--- 42,59 ----
"""
def __init__(self,Parent,BoxName, Y, X, W, **properties):
apply(Control.__init__,(self,Parent,BoxName),properties)
! self.PARENT = Parent
! self.Y = Y
! self.X = X
! self.W = W
! self.H = 2
menuName = (W-5) * ' '
self._menu = Menu(Parent,'cbm',Y,X+1,menuName)
self._button = Button(Parent,'cbbutt',Y,X+W-4,3,chr(tiDAW))
self._button.SetMethod("CLICK", self._Show)
! self._menu.CANGETFOCUS = 0
self._menu.SetMethod("CHOSEN",self._chosen)
! self._menu.maxLengthFixed = 1
self._menu.maxLength = W - 4
self._chosen = None
Parent.AddControl(self._menu)
***************
*** 61,76 ****
self.SetMethod("SYSPAINT", self.Paint)
def Paint(self,v1,v2,v3):
! Screen = self.GetProperty("PARENT").Screen()
! Screen.AutoRefresh = tiFALSE
self.SetColor(1)
! X = self.GetProperty("X")
! Y = self.GetProperty("Y")
! W = self.GetProperty("W")
Screen.PrintAt(Y,X,chr(tiVLINE))
Screen.PrintAt(Y,X+W-1,chr(tiVLINE))
Screen.PrintAt(Y+1,X, chr(tiLLC) + (W-2) * chr(tiHLINE) + chr(tiLRC))
! Screen.AutoRefresh = tiTRUE
def _Show(self,v1,v2,v3):
self._menu.ShowOff(None,None,None)
--- 61,76 ----
self.SetMethod("SYSPAINT", self.Paint)
def Paint(self,v1,v2,v3):
! Screen = self.PARENT.Screen()
! Screen.AutoRefresh = 0
self.SetColor(1)
! X = self.X
! Y = self.Y
! W = self.W
Screen.PrintAt(Y,X,chr(tiVLINE))
Screen.PrintAt(Y,X+W-1,chr(tiVLINE))
Screen.PrintAt(Y+1,X, chr(tiLLC) + (W-2) * chr(tiHLINE) + chr(tiLRC))
! Screen.AutoRefresh = 1
def _Show(self,v1,v2,v3):
self._menu.ShowOff(None,None,None)
Index: gnue/common/src/cursing/Control.py
diff -c gnue/common/src/cursing/Control.py:1.1
gnue/common/src/cursing/Control.py:1.2
*** gnue/common/src/cursing/Control.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/Control.py Wed Oct 9 23:04:41 2002
***************
*** 39,53 ****
""" Base class for all control (means possibly interactice) elements
"""
def __init__(self, Parent, CName, **properties):
! apply (GraphicObject.__init__, (self, Parent.GetProperty("SCREEN")),
properties)
! self.SetProperty("NAME", CName)
! self.SetProperty("X", -1)
! self.SetProperty("Y", -1)
! self.SetProperty("VISIBLE", tiTRUE)
! self.SetProperty("FOCUS", tiFALSE)
! self.SetProperty("CANGETFOCUS", tiTRUE)
! self.SetProperty("PARENT",Parent)
self.Methods = {}
self.Methods["CLICK"] = None
self.Methods["PAINT"] = None
--- 39,53 ----
""" Base class for all control (means possibly interactice) elements
"""
def __init__(self, Parent, CName, **properties):
! apply (GraphicObject.__init__, (self, Parent.SCREEN),
properties)
! self.NAME = CName
! self.X = -1
! self.Y = -1
! self.VISIBLE = 1
! self.FOCUS = 0
! self.CANGETFOCUS = 1
! self.PARENT = Parent
self.Methods = {}
self.Methods["CLICK"] = None
self.Methods["PAINT"] = None
***************
*** 56,63 ****
self.Methods["ACTION"] = None
def DetermineAndSetColor(self, HasFocus):
! if self.active==tiTRUE:
! if HasFocus == tiTRUE:
self.SetColor(2)
else:
self.SetColor(1)
--- 56,63 ----
self.Methods["ACTION"] = None
def DetermineAndSetColor(self, HasFocus):
! if self.active:
! if HasFocus :
self.SetColor(2)
else:
self.SetColor(1)
***************
*** 65,71 ****
self.SetColor(4)
def CreateProperty(self, Property, Value):
! self.SetProperty(Property, Value)
def SetMethod(self, MethodName, MethodValue):
self.Methods[MethodName] = MethodValue
--- 65,71 ----
self.SetColor(4)
def CreateProperty(self, Property, Value):
! self.__dict__[Property] = Value
def SetMethod(self, MethodName, MethodValue):
self.Methods[MethodName] = MethodValue
***************
*** 88,98 ****
def DeActivate(self, state):
if self.active != state:
! if state == tiTRUE:
! self.SetColor(self.GetProperty("PRIOR_COLOR"))
else:
! self.SetProperty("PRIOR_COLOR",
! self.GetProperty("LOLIGHT_COLOR"))
self.SetColor(4)
self.LoLight()
self.active = state
--- 88,97 ----
def DeActivate(self, state):
if self.active != state:
! if state :
! self.SetColor(self.PRIOR_COLOR)
else:
! self.PRIOR_COLOR = self.LOLIGHT_COLOR
self.SetColor(4)
self.LoLight()
self.active = state
***************
*** 106,114 ****
def GetHeight(self):
! return self.GetProperty("H")
def GetWidth(self):
! return self.GetProperty("W")
--- 105,113 ----
def GetHeight(self):
! return self.H
def GetWidth(self):
! return self.W
Index: gnue/common/src/cursing/Dialog.py
diff -c gnue/common/src/cursing/Dialog.py:1.1
gnue/common/src/cursing/Dialog.py:1.2
*** gnue/common/src/cursing/Dialog.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/Dialog.py Wed Oct 9 23:04:41 2002
***************
*** 45,60 ****
def __init__(self, ParentContainer, r1=0, c1=0, r2=0, c2=0, **properties):
SIOInstance = ParentContainer.Screen()
apply (ScreenContainer.__init__, (self, SIOInstance), properties)
! self.SetProperty("PARENT", ParentContainer)
self.scrnbuff = {}
self.Controls = []
! self.SetProperty("SCREEN", SIOInstance)
! self.SetProperty("STARTPOINT", 0)
! self.SetProperty("DIALOGWINDOW", None)
! self.SetProperty("R1", r1)
! self.SetProperty("R2", r2)
! self.SetProperty("C1", c1)
! self.SetProperty("C2", c2)
# need to add some sanity checks for bad params here:
#if r1 > 0 and r1 <= SIOInstance.MAXROW:
--- 45,60 ----
def __init__(self, ParentContainer, r1=0, c1=0, r2=0, c2=0, **properties):
SIOInstance = ParentContainer.Screen()
apply (ScreenContainer.__init__, (self, SIOInstance), properties)
! self.PARENT = ParentContainer
self.scrnbuff = {}
self.Controls = []
! self.SCREEN = SIOInstance
! self.STARTPOINT = 0
! self.DIALOGWINDOW = None
! self.R1 = r1
! self.R2 = r2
! self.C1 = c1
! self.C2 = c2
# need to add some sanity checks for bad params here:
#if r1 > 0 and r1 <= SIOInstance.MAXROW:
***************
*** 68,77 ****
self._DialogWidth = c2 - c1
self._DialogHeight = r2 - r1
! self.SetProperty("INSET", tiFALSE)
! self.buffer = self.Screen().CaptureScreen(self.GetProperty("R1"),
! self.GetProperty("C1"),
! self.GetProperty("R2"), self.GetProperty("C2"))
def __del__(self):
pass
--- 68,77 ----
self._DialogWidth = c2 - c1
self._DialogHeight = r2 - r1
! self.INSET = 0
! self.buffer = self.Screen().CaptureScreen(self.R1,
! self.C1,
! self.R2, self.C2)
def __del__(self):
pass
***************
*** 81,92 ****
Make sure the control is visible in the limited area of the
dialog box
"""
! cRow = TheControl.GetProperty("Y")
! cRow = cRow + self.GetProperty("R1")
! cCol = TheControl.GetProperty("X")
! cCol = cCol + self.GetProperty("C1")
! TheControl.SetProperty("Y", cRow)
! TheControl.SetProperty("X", cCol)
ScreenContainer.AddControl(self,TheControl)
def AddControl(self,control):
--- 81,92 ----
Make sure the control is visible in the limited area of the
dialog box
"""
! cRow = TheControl.Y
! cRow = cRow + self.R1
! cCol = TheControl.X
! cCol = cCol + self.C1
! TheControl.Y = cRow
! TheControl.X = cCol
ScreenContainer.AddControl(self,TheControl)
def AddControl(self,control):
***************
*** 95,116 ****
def _PaintBorder(self):
self.LoLight()
_paintBorder( self, self._Y,self._X, self._DialogHeight,
! self._DialogWidth, self.GetProperty("INSET"))
def RunDialog(self):
self._PaintBorder()
t = self.Run()
self.Screen().RestoreScreen(self._Y,self._X,
! self.GetProperty("R2"), self.GetProperty("C2"),
self.buffer)
! self.GetProperty("SCREEN").Refresh()
! self.GetProperty("PARENT").Paint()
return t
def Height(self):
! return self.GetProperty("R2") - self._Y
def Width(self):
! return self.GetProperty("C2") - self._X
--- 95,116 ----
def _PaintBorder(self):
self.LoLight()
_paintBorder( self, self._Y,self._X, self._DialogHeight,
! self._DialogWidth, self.INSET)
def RunDialog(self):
self._PaintBorder()
t = self.Run()
self.Screen().RestoreScreen(self._Y,self._X,
! self.R2, self.C2,
self.buffer)
! self.SCREEN.Refresh()
! self.PARENT.Paint()
return t
def Height(self):
! return self.R2- self._Y
def Width(self):
! return self.C2- self._X
Index: gnue/common/src/cursing/DirChooser.py
diff -c gnue/common/src/cursing/DirChooser.py:1.1
gnue/common/src/cursing/DirChooser.py:1.2
*** gnue/common/src/cursing/DirChooser.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/DirChooser.py Wed Oct 9 23:04:41 2002
***************
*** 45,67 ****
"""
def __init__(self, Root, Y, X, W, Start, Name="", **properties):
apply(Control.__init__, (self, Root, Name), properties)
! self.SetProperty("X",X)
! self.SetProperty("Y",Y)
! self.SetProperty("W",int(W))
! self.SetProperty("H", 1)
! self.SetProperty("SCREEN", Root)
self.back_button = Button(Root,'backButt',1,1,8,'back')
self.up_button = Button(Root,'upButt',1,9,8,'up')
self.back_button.SetMethod("CLICK",self.Back)
self.up_button.SetMethod("CLICK",self.Up)
Root.AddControl(self.back_button)
Root.AddControl(self.up_button)
! self.back_button.DeActivate(tiFALSE)
self.startDir = Start
self.dir_chooser_bar = MenuBar(Root,1,18)
self.dir_chooser = self.dir_chooser_bar.NewMenu('dir_chooser',
(int(W)-19)*' ')
! self.dir_chooser.maxLengthFixed = tiTRUE
self.dir_chooser.maxLength = W-19
self.dir_chooser.SetMethod("CHOSEN",self.Chosen)
self.dir_chooser.Finalize()
--- 45,67 ----
"""
def __init__(self, Root, Y, X, W, Start, Name="", **properties):
apply(Control.__init__, (self, Root, Name), properties)
! self.X = X
! self.Y = Y
! self.W = int(W)
! self.H = 1
! self.SCREEN = Root
self.back_button = Button(Root,'backButt',1,1,8,'back')
self.up_button = Button(Root,'upButt',1,9,8,'up')
self.back_button.SetMethod("CLICK",self.Back)
self.up_button.SetMethod("CLICK",self.Up)
Root.AddControl(self.back_button)
Root.AddControl(self.up_button)
! self.back_button.DeActivate(0)
self.startDir = Start
self.dir_chooser_bar = MenuBar(Root,1,18)
self.dir_chooser = self.dir_chooser_bar.NewMenu('dir_chooser',
(int(W)-19)*' ')
! self.dir_chooser.maxLengthFixed = 1
self.dir_chooser.maxLength = W-19
self.dir_chooser.SetMethod("CHOSEN",self.Chosen)
self.dir_chooser.Finalize()
***************
*** 77,88 ****
if len(self.lastPath) != 0:
self.__Scan(self.lastPath.pop())
if len(self.lastPath) == 0:
! self.back_button.DeActivate(tiFALSE)
def Chosen(self, control, ItemId, arg3):
if len(self.lastPath) == 0:
self.lastPath.append(self.dir_entries[0])
! self.back_button.DeActivate(tiTRUE)
elif self.lastPath.count(self.dir_entries[0]) == 0:
if len(self.lastPath) < self.__PathMax:
self.lastPath.append( self.dir_entries[0])
--- 77,88 ----
if len(self.lastPath) != 0:
self.__Scan(self.lastPath.pop())
if len(self.lastPath) == 0:
! self.back_button.DeActivate(0)
def Chosen(self, control, ItemId, arg3):
if len(self.lastPath) == 0:
self.lastPath.append(self.dir_entries[0])
! self.back_button.DeActivate(1)
elif self.lastPath.count(self.dir_entries[0]) == 0:
if len(self.lastPath) < self.__PathMax:
self.lastPath.append( self.dir_entries[0])
***************
*** 96,104 ****
def __Scan(self,path):
if os.access(path, os.R_OK | os.X_OK) and os.path.isdir(path):
if path != '/':
! self.up_button.DeActivate(tiTRUE)
else:
! self.up_button.DeActivate(tiFALSE)
count = 0
self.dir_entries = {}
self.dir_entries[count] = path
--- 96,104 ----
def __Scan(self,path):
if os.access(path, os.R_OK | os.X_OK) and os.path.isdir(path):
if path != '/':
! self.up_button.DeActivate(1)
else:
! self.up_button.DeActivate(0)
count = 0
self.dir_entries = {}
self.dir_entries[count] = path
***************
*** 119,129 ****
if self.dir_entries.has_key(count):
count += 1
for i in range(0,len(self.lastPath)):
! doit = tiTRUE
for j in self.dir_entries.keys():
if self.dir_entries[j] == self.lastPath[i]:
! doit = tiFALSE
! if doit == tiTRUE:
self.dir_entries[count] = self.lastPath[i]
self.dir_chooser.AddItem(count,self.lastPath[i])
count += 1
--- 119,129 ----
if self.dir_entries.has_key(count):
count += 1
for i in range(0,len(self.lastPath)):
! doit = 1
for j in self.dir_entries.keys():
if self.dir_entries[j] == self.lastPath[i]:
! doit = 0
! if doit :
self.dir_entries[count] = self.lastPath[i]
self.dir_chooser.AddItem(count,self.lastPath[i])
count += 1
***************
*** 132,142 ****
apply( inform,(self.dir_entries[0],))
self.dir_chooser.ExecMethod("SYSPAINT",None,None,None)
self.dir_chooser.ExecMethod("REFRESH",None,None,None)
! return tiTRUE
! return tiFALSE
def Paint(self, arg1,arg2,arg3):
! self.GetProperty("SCREEN").Paint()
def AddPath(self, path, arg1, arg2):
self.__Scan(path)
--- 132,142 ----
apply( inform,(self.dir_entries[0],))
self.dir_chooser.ExecMethod("SYSPAINT",None,None,None)
self.dir_chooser.ExecMethod("REFRESH",None,None,None)
! return 1
! return 0
def Paint(self, arg1,arg2,arg3):
! self.SCREEN.Paint()
def AddPath(self, path, arg1, arg2):
self.__Scan(path)
Index: gnue/common/src/cursing/FileSelectPad.py
diff -c gnue/common/src/cursing/FileSelectPad.py:1.1
gnue/common/src/cursing/FileSelectPad.py:1.2
*** gnue/common/src/cursing/FileSelectPad.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/FileSelectPad.py Wed Oct 9 23:04:41 2002
***************
*** 48,73 ****
def __init__(self, Root, Y, X,H, W, **properties):
apply(Control.__init__, (self, Root, ''), properties)
! self.SetProperty("Y",Y)
! self.SetProperty("ROWS",H)
! self.SetProperty("X",X)
! self.SetProperty("H",H)
! self.SetProperty("W",W)
! self.SetProperty("PARENT", Root)
! self._X = self.GetProperty("X")
! self._Y = self.GetProperty("Y")
! self._W = self.GetProperty("W")
! self._H = self.GetProperty("H")
! self.SetProperty("MYROOT",Root)
! self.SetProperty("NAME",'fileselectpad')
self.SetMethod("SYSRUN",self.Run)
self.SetMethod("GOTFOCUS",self.GotFocus)
self.SetMethod("LOSTFOCUS",self.LostFocus)
# self.SetMethod("SYSPAINT",self.Paint)
self.SetMethod("PAINT",self.Paint)
! self.SetProperty("CANGETFOCUS", tiTRUE)
! self.SetProperty("COLWIDTH",25)
! self.SetProperty("COLDISP", W / self.GetProperty("COLWIDTH"))
self.pad = None
self.hilit = 1
self.xoffset = -1
--- 48,73 ----
def __init__(self, Root, Y, X,H, W, **properties):
apply(Control.__init__, (self, Root, ''), properties)
! self.Y = Y
! self.ROWS = H
! self.X = X
! self.H = H
! self.W = W
! self.PARENT = Root
! self._X = self.X
! self._Y = self.Y
! self._W = self.W
! self._H = self.H
! self.MYROOT = Root
! self.NAME = 'fileselectpad'
self.SetMethod("SYSRUN",self.Run)
self.SetMethod("GOTFOCUS",self.GotFocus)
self.SetMethod("LOSTFOCUS",self.LostFocus)
# self.SetMethod("SYSPAINT",self.Paint)
self.SetMethod("PAINT",self.Paint)
! self.CANGETFOCUS = 1
! self.COLWIDTH = 25
! self.COLDISP = W / self.COLWIDTH
self.pad = None
self.hilit = 1
self.xoffset = -1
***************
*** 76,87 ****
self.LoLight()
self.dirlist = []
self.sb = None
! self.changed = tiTRUE
! self.__first = tiTRUE
def Run(self,v1,v2,v3):
! rows = self.GetProperty("ROWS")
! if v1 == tiTRUE:
self.__SetHilit(v2,v3)
if self.sb != None:
self.sb.Set(self.hilit / rows)
--- 76,87 ----
self.LoLight()
self.dirlist = []
self.sb = None
! self.changed = 1
! self.__first = 1
def Run(self,v1,v2,v3):
! rows = self.ROWS
! if v1 :
self.__SetHilit(v2,v3)
if self.sb != None:
self.sb.Set(self.hilit / rows)
***************
*** 95,107 ****
self.path += '/'
apply(action,(self,self.path +
self.dirlist[self.hilit-1][self.__prefix_width__:],None))
self.Paint(0,0,0)
! Container = self.GetProperty("SCREEN")
while 1:
self.__DrawItem(self.hilit,1)
! if self.active != tiTRUE:
! return tiFALSE
ch = Container.GetChar()
! if self.GetProperty("PARENT").BreakOrder(ch) == tiTRUE:
return
if ch in (Container.TokNextField,):
return
--- 95,107 ----
self.path += '/'
apply(action,(self,self.path +
self.dirlist[self.hilit-1][self.__prefix_width__:],None))
self.Paint(0,0,0)
! Container = self.SCREEN
while 1:
self.__DrawItem(self.hilit,1)
! if self.active != 1:
! return 0
ch = Container.GetChar()
! if self.PARENT.BreakOrder(ch) :
return
if ch in (Container.TokNextField,):
return
***************
*** 114,125 ****
elif ch == Container.TokDownArrow:
self.hilit += 1
if self.Verify(None,None,None) and self.sb != None:
! col = (self.hilit) / self.GetProperty("ROWS")
self.sb.Set(col-1)
elif ch == Container.TokUpArrow:
self.hilit -= 1
if self.Verify(None,None,None) and self.sb != None:
! col = (self.hilit) / self.GetProperty("ROWS")
self.sb.Set(col-1)
elif ch == Container.TokLeftArrow:
self.hilit -= rows
--- 114,125 ----
elif ch == Container.TokDownArrow:
self.hilit += 1
if self.Verify(None,None,None) and self.sb != None:
! col = (self.hilit) / self.ROWS
self.sb.Set(col-1)
elif ch == Container.TokUpArrow:
self.hilit -= 1
if self.Verify(None,None,None) and self.sb != None:
! col = (self.hilit) / self.ROWS
self.sb.Set(col-1)
elif ch == Container.TokLeftArrow:
self.hilit -= rows
***************
*** 139,156 ****
self.Paint(0,0,0)
def GotFocus(self,v1,v2,v3):
! self._X = self.GetProperty("X")
! self._Y = self.GetProperty("Y")
! self._W = self.GetProperty("W")
! self._H = self.GetProperty("H")
! self.SetProperty("FOCUS",tiTRUE)
self.Paint(None,None,None)
! return tiTRUE
def LostFocus(self,v1,v2,v3):
! self.SetProperty("FOCUS",tiFALSE)
self.Paint(None,None,None)
! return tiTRUE
def Display(self, path):
if self.pad != None:
--- 139,156 ----
self.Paint(0,0,0)
def GotFocus(self,v1,v2,v3):
! self._X = self.X
! self._Y = self.Y
! self._W = self.W
! self._H = self.H
! self.FOCUS = 1
self.Paint(None,None,None)
! return 1
def LostFocus(self,v1,v2,v3):
! self.FOCUS = 0
self.Paint(None,None,None)
! return 1
def Display(self, path):
if self.pad != None:
***************
*** 162,206 ****
self.dirlist = os.listdir(path)
self.__SortAndMarkDirList()
count = len(self.dirlist)
! rows = self.GetProperty("H")
! colwidth = self.GetProperty("COLWIDTH")
if (count) * colwidth > self.__area():
rows -= 1
! setupSB = tiTRUE
else:
! setupSB = tiFALSE
! self.SetProperty("ROWS",rows)
cols = ((count / rows) * colwidth)
! self.pad = curses.newpad(rows+1,cols+((self.GetProperty("COLDISP")+1) *
(colwidth)))
self.__initScrollBar( setupSB, (count / rows) )
if curses.has_colors():
self.pad.bkgdset(' ',curses.color_pair(1))
self.pad.erase()
! self.fillpad(tiTRUE)
self.Paint(None,None,None)
! self.GetProperty("SCREEN").Refresh()
! self.__first = tiFALSE
def __initScrollBar(self, activate, cols):
! if activate == tiTRUE:
if self.sb != None:
self.sb.Init(cols)
else:
! self.sb =
ScrollBar(self.GetProperty("PARENT"),'filesb',self.GetProperty("H")+3,2,
self.GetProperty("W"))
! self.GetProperty("PARENT").AddControl(self.sb)
self._cols = cols
self.sb.Init(cols)
! self.GetProperty("PARENT").Refresh(None,None,None)
self.sb.SetMethod("CHANGED", self.SetCol)
elif self.sb != None:
! self.GetProperty("PARENT").DelControl(self.sb)
self.sb.__del__()
! self.GetProperty("PARENT").Refresh(None,None,None)
self.sb = None
def SetCol(self,newCol,MaxCol,arg3):
self.__DrawItem(self.hilit,1)
! rows = self.GetProperty("ROWS")
if newCol <= self._cols and newCol >= 0:
self.hilit = (rows * (newCol)) + self.yoffset + 1
if self.hilit < 0:
--- 162,206 ----
self.dirlist = os.listdir(path)
self.__SortAndMarkDirList()
count = len(self.dirlist)
! rows = self.H
! colwidth = self.COLWIDTH
if (count) * colwidth > self.__area():
rows -= 1
! setupSB = 1
else:
! setupSB = 0
! self.ROWS = rows
cols = ((count / rows) * colwidth)
! self.pad = curses.newpad(rows+1,cols+((self.COLDISP+1) * (colwidth)))
self.__initScrollBar( setupSB, (count / rows) )
if curses.has_colors():
self.pad.bkgdset(' ',curses.color_pair(1))
self.pad.erase()
! self.fillpad(1)
self.Paint(None,None,None)
! self.SCREEN.Refresh()
! self.__first = 0
def __initScrollBar(self, activate, cols):
! if activate :
if self.sb != None:
self.sb.Init(cols)
else:
! self.sb = ScrollBar(self.PARENT,'filesb',self.H+3,2, self.W)
! self.PARENT.AddControl(self.sb)
self._cols = cols
self.sb.Init(cols)
! self.PARENT.Refresh(None,None,None)
self.sb.SetMethod("CHANGED", self.SetCol)
elif self.sb != None:
! self.PARENT.DelControl(self.sb)
self.sb.__del__()
! self.PARENT.Refresh(None,None,None)
self.sb = None
def SetCol(self,newCol,MaxCol,arg3):
self.__DrawItem(self.hilit,1)
! rows = self.ROWS
if newCol <= self._cols and newCol >= 0:
self.hilit = (rows * (newCol)) + self.yoffset + 1
if self.hilit < 0:
***************
*** 212,218 ****
if active != None and self.Verify(None,None,None):
apply(active,(self,self.dirlist[self.hilit-1][self.__prefix_width__:],None))
self.Paint(None, None,None)
! self.GetProperty("PARENT").Screen().Refresh()
def __SortAndMarkDirList(self):
path = self.path
--- 212,218 ----
if active != None and self.Verify(None,None,None):
apply(active,(self,self.dirlist[self.hilit-1][self.__prefix_width__:],None))
self.Paint(None, None,None)
! self.PARENT.Screen().Refresh()
def __SortAndMarkDirList(self):
path = self.path
***************
*** 253,310 ****
else:
self.dirlist[i] = self.dirlist[i][:4] + '-' + self.dirlist[i][5:]
def __area(self):
! return self.GetProperty("H") * self.GetProperty("W")
def Paint(self,arg1,arg2,arg3):
! if self.pad != None and self.__first == tiFALSE:
self.__DrawItem(self.hilit,3)
! rows = self.GetProperty("ROWS")
! colwidth = self.GetProperty("COLWIDTH")
self.yoffset = (self.hilit-1) % rows
newXoffset = ((self.hilit-1) / rows ) * colwidth
self.xoffset = newXoffset
self.pad.refresh(0, self.xoffset,self._Y,self._X,
self._Y + self._H,self._X + self._W)
! def fillpad(self, showProgress = tiFALSE):
! rows = self.GetProperty("ROWS")
xoffset = 0
yoffset = 0
! step = tiFALSE
pb = None
! if showProgress == tiTRUE:
! pb = self.GetProperty("PROGRESS")
if pb != None and len(self.dirlist) > self.__threshhold__:
! pb.DeActivate(tiTRUE)
pb.Init(len(self.dirlist))
! step = tiTRUE
for i in range(1,len(self.dirlist)+1):
color = 1
! if step == tiTRUE:
pb.Step()
! if i == self.hilit and self.GetProperty("FOCUS")==tiTRUE:
color = 3
elif self.dirlist[i-1][2] != 'r':
color = 4
self.__DrawItem(i,color)
if i % rows == 0:
! xoffset += self.GetProperty("COLWIDTH")
yoffset = 0
else:
yoffset += 1
! if step == tiTRUE:
pb.Init(1)
! pb.DeActivate(tiFALSE)
! self.changed = tiTRUE
def __DrawItem(self,id,col):
if self.pad != None and len(self.dirlist)>0:
! rows = self.GetProperty("ROWS")
! hilitCol = ((id-1) / rows) * self.GetProperty("COLWIDTH")
hilitRow = (id-1) % rows
mods = 0
self.pad.addstr(hilitRow,hilitCol,'')
! String = str(self.dirlist[id-1][:self.GetProperty("COLWIDTH")-2])
if String[2]!='r' and col == 1:
col = 4
if curses.has_colors():
--- 253,310 ----
else:
self.dirlist[i] = self.dirlist[i][:4] + '-' + self.dirlist[i][5:]
def __area(self):
! return self.H* self.W
def Paint(self,arg1,arg2,arg3):
! if self.pad != None and self.__first == 0:
self.__DrawItem(self.hilit,3)
! rows = self.ROWS
! colwidth = self.COLWIDTH
self.yoffset = (self.hilit-1) % rows
newXoffset = ((self.hilit-1) / rows ) * colwidth
self.xoffset = newXoffset
self.pad.refresh(0, self.xoffset,self._Y,self._X,
self._Y + self._H,self._X + self._W)
! def fillpad(self, showProgress = 0):
! rows = self.ROWS
xoffset = 0
yoffset = 0
! step = 0
pb = None
! if showProgress :
! pb = self.PROGRESS
if pb != None and len(self.dirlist) > self.__threshhold__:
! pb.DeActivate(1)
pb.Init(len(self.dirlist))
! step = 1
for i in range(1,len(self.dirlist)+1):
color = 1
! if step :
pb.Step()
! if i == self.hilit and self.FOCUS:
color = 3
elif self.dirlist[i-1][2] != 'r':
color = 4
self.__DrawItem(i,color)
if i % rows == 0:
! xoffset += self.COLWIDTH
yoffset = 0
else:
yoffset += 1
! if step :
pb.Init(1)
! pb.DeActivate(0)
! self.changed = 1
def __DrawItem(self,id,col):
if self.pad != None and len(self.dirlist)>0:
! rows = self.ROWS
! hilitCol = ((id-1) / rows) * self.COLWIDTH
hilitRow = (id-1) % rows
mods = 0
self.pad.addstr(hilitRow,hilitCol,'')
! String = str(self.dirlist[id-1][:self.COLWIDTH-2])
if String[2]!='r' and col == 1:
col = 4
if curses.has_colors():
***************
*** 320,327 ****
self.pad.addstr(str(String[j]), mods)
def __SetHilit(self, YPOS, XPOS):
self.__DrawItem(self.hilit,1)
! colNo = (self.xoffset + (XPOS-self.GetProperty("X"))) /
self.GetProperty("COLWIDTH")
! self.hilit = ( colNo * self.GetProperty("ROWS")) +
(YPOS-self.GetProperty("Y")) + 1
if self.hilit < 1:
self.hilit = 1
if self.hilit > len(self.dirlist):
--- 320,327 ----
self.pad.addstr(str(String[j]), mods)
def __SetHilit(self, YPOS, XPOS):
self.__DrawItem(self.hilit,1)
! colNo = (self.xoffset + (XPOS-self.X)) / self.COLWIDTH
! self.hilit = ( colNo * self.ROWS) + (YPOS-self.Y) + 1
if self.hilit < 1:
self.hilit = 1
if self.hilit > len(self.dirlist):
Index: gnue/common/src/cursing/FileSelector.py
diff -c gnue/common/src/cursing/FileSelector.py:1.1
gnue/common/src/cursing/FileSelector.py:1.2
*** gnue/common/src/cursing/FileSelector.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/FileSelector.py Wed Oct 9 23:04:41 2002
***************
*** 61,73 ****
self.start = os.environ['PWD']
# allow arbitrary path to be sent in as 'START'
if self.HasProperty("START"):
! self.start = self.GetProperty("START")
! self.SetProperty("W",W)
self.filePad = FileSelectPad(self,3,2,H-8,W-4)
self.filePad.SetMethod("ACTION",self._SetPath)
self.filePad.SetMethod("ACTIVE",self._SetFileName)
self.progressBar = Progress(self,'filedisppb',H-3,2,W-14,1)
! self.filePad.SetProperty("PROGRESS", self.progressBar)
self.AddControl(self.filePad)
self.AddControl(self.progressBar)
self.fileNameInp = TextBox(self,'filenameinp',H-2, 2, W - 14)
--- 61,73 ----
self.start = os.environ['PWD']
# allow arbitrary path to be sent in as 'START'
if self.HasProperty("START"):
! self.start = self.START
! self.W = W
self.filePad = FileSelectPad(self,3,2,H-8,W-4)
self.filePad.SetMethod("ACTION",self._SetPath)
self.filePad.SetMethod("ACTIVE",self._SetFileName)
self.progressBar = Progress(self,'filedisppb',H-3,2,W-14,1)
! self.filePad.PROGRESS = self.progressBar
self.AddControl(self.filePad)
self.AddControl(self.progressBar)
self.fileNameInp = TextBox(self,'filenameinp',H-2, 2, W - 14)
***************
*** 94,107 ****
def Cancel(self,control,arg2,arg3):
self.dirChooser.dir_entries = []
self.fileNameInp.SetText('')
! control.SetProperty("EXITFORM",tiTRUE)
! self.__accept = tiFALSE
! return tiFALSE
def Accept(self,control,arg2,arg3):
! control.SetProperty("EXITFORM",tiTRUE)
! self.__accept = tiTRUE
! return tiTRUE
def GetPath(self):
if self.dirChooser.HasEntries():
--- 94,107 ----
def Cancel(self,control,arg2,arg3):
self.dirChooser.dir_entries = []
self.fileNameInp.SetText('')
! control.EXITFORM = 1
! self.__accept = 0
! return 0
def Accept(self,control,arg2,arg3):
! control.EXITFORM = 1
! self.__accept = 1
! return 1
def GetPath(self):
if self.dirChooser.HasEntries():
***************
*** 123,129 ****
apply(Dialog.Paint,(self,))
def _SetPath(self,Control, Path, Arg3):
! if self.dirChooser.AddPath(Path,None,None) == tiTRUE:
self.fileNameInp.SetText("")
def _SetFileName(self,Control, Name, Arg3):
--- 123,129 ----
apply(Dialog.Paint,(self,))
def _SetPath(self,Control, Path, Arg3):
! if self.dirChooser.AddPath(Path,None,None) :
self.fileNameInp.SetText("")
def _SetFileName(self,Control, Name, Arg3):
Index: gnue/common/src/cursing/FocusedLabel.py
diff -c gnue/common/src/cursing/FocusedLabel.py:1.1
gnue/common/src/cursing/FocusedLabel.py:1.2
*** gnue/common/src/cursing/FocusedLabel.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/FocusedLabel.py Wed Oct 9 23:04:41 2002
***************
*** 44,50 ****
def __init__(self, Parent, LabelName, Y, X, Caption, **properties):
apply (Label.__init__, (self, Parent, LabelName, Y, X, Caption),
properties)
! self.SetProperty("CANGETFOCUS", tiTRUE)
self.SetMethod("SYSRUN", self.Run)
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSGOTFOCUS", self.GotFocus)
--- 44,50 ----
def __init__(self, Parent, LabelName, Y, X, Caption, **properties):
apply (Label.__init__, (self, Parent, LabelName, Y, X, Caption),
properties)
! self.CANGETFOCUS = 1
self.SetMethod("SYSRUN", self.Run)
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSGOTFOCUS", self.GotFocus)
***************
*** 52,102 ****
self.SetMethod("CLICK", None)
def Run(self, v1, v2, v3):
! Container = self.GetProperty("PARENT").Screen()
! if v1 == tiTRUE:
self.ExecMethod("CLICK", self, None, None)
if self.HasProperty("EXITFORM"):
! if self.GetProperty("EXITFORM") == tiTRUE:
! return tiTRUE
while 1:
global BACKWARDS
ch = Container.GetChar()
! if self.GetProperty("PARENT").BreakOrder(ch) == tiTRUE:
return
if ch in (Container.TokDownArrow, Container.TokNextField,
Container.TokUpArrow):
! BACKWARDS = tiFALSE
if ch == Container.TokUpArrow:
! BACKWARDS = tiTRUE
return
elif ch == Container.TokActivate:
self.ExecMethod("CLICK", self, None, None)
if self.HasProperty("EXITFORM"):
! if self.GetProperty("EXITFORM") == tiTRUE:
! return tiTRUE
self.ExecMethod("SYSGOTFOCUS", None, None, None)
def Paint(self, HasFocus, v2, v3):
! Container = self.GetProperty("PARENT").Screen()
! if self.active==tiTRUE:
! if HasFocus == tiTRUE:
self.SetColor(2)
else:
self.SetColor(1)
self.LoLight()
! Y = self.GetProperty("Y")
! X = self.GetProperty("X")
! caption = self.GetProperty("CAPTION")
Container.PrintAt(Y,X,caption)
! if self.active == tiTRUE:
self.SetColor(1)
self.LoLight()
def GotFocus(self, v1, v2, v3):
! self.Paint(tiTRUE, None, None)
! return tiTRUE
def LostFocus(self, v1, v2, v3):
! self.Paint(tiFALSE, None, None)
! return tiTRUE
--- 52,102 ----
self.SetMethod("CLICK", None)
def Run(self, v1, v2, v3):
! Container = self.PARENT.Screen()
! if v1 :
self.ExecMethod("CLICK", self, None, None)
if self.HasProperty("EXITFORM"):
! if self.EXITFORM:
! return 1
while 1:
global BACKWARDS
ch = Container.GetChar()
! if self.PARENT.BreakOrder(ch) :
return
if ch in (Container.TokDownArrow, Container.TokNextField,
Container.TokUpArrow):
! BACKWARDS = 0
if ch == Container.TokUpArrow:
! BACKWARDS = 1
return
elif ch == Container.TokActivate:
self.ExecMethod("CLICK", self, None, None)
if self.HasProperty("EXITFORM"):
! if self.EXITFORM:
! return 1
self.ExecMethod("SYSGOTFOCUS", None, None, None)
def Paint(self, HasFocus, v2, v3):
! Container = self.PARENT.Screen()
! if self.active:
! if HasFocus :
self.SetColor(2)
else:
self.SetColor(1)
self.LoLight()
! Y = self.Y
! X = self.X
! caption = self.CAPTION
Container.PrintAt(Y,X,caption)
! if self.active :
self.SetColor(1)
self.LoLight()
def GotFocus(self, v1, v2, v3):
! self.Paint(1, None, None)
! return 1
def LostFocus(self, v1, v2, v3):
! self.Paint(0, None, None)
! return 1
Index: gnue/common/src/cursing/Frame.py
diff -c gnue/common/src/cursing/Frame.py:1.1
gnue/common/src/cursing/Frame.py:1.2
*** gnue/common/src/cursing/Frame.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/Frame.py Wed Oct 9 23:04:41 2002
***************
*** 41,60 ****
"""
def __init__( self, Root, Name, Y,X,W,H, Title='', **properties):
apply(Control.__init__,(self, Root, Name), properties)
! self.active = tiFALSE
! self.SetProperty("Y", Y)
! self.SetProperty("X", X)
! self.SetProperty("W", W)
! self.SetProperty("H", H)
! self.SetProperty("TITLETEXT", Title)
! self.SetProperty("CANGETFOCUS", tiFALSE)
self.SetMethod("SYSPAINT", self.Paint)
def Paint(self,v1,v2,v3):
! Y = self.GetProperty("Y")
! X = self.GetProperty("X")
! H = self.GetProperty("H")
! W = self.GetProperty("W")
_paintBorder(self, Y, X, H, W)
--- 41,60 ----
"""
def __init__( self, Root, Name, Y,X,W,H, Title='', **properties):
apply(Control.__init__,(self, Root, Name), properties)
! self.active = 0
! self.Y = Y
! self.X = X
! self.W = W
! self.H = H
! self.TITLETEXT = Title
! self.CANGETFOCUS = 0
self.SetMethod("SYSPAINT", self.Paint)
def Paint(self,v1,v2,v3):
! Y = self.Y
! X = self.X
! H = self.H
! W = self.W
_paintBorder(self, Y, X, H, W)
Index: gnue/common/src/cursing/GraphicObject.py
diff -c gnue/common/src/cursing/GraphicObject.py:1.1
gnue/common/src/cursing/GraphicObject.py:1.2
*** gnue/common/src/cursing/GraphicObject.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/GraphicObject.py Wed Oct 9 23:04:41 2002
***************
*** 54,63 ****
self._Properties = self.__dict__
self._Properties.update( properties)
self.SCREEN = sioScreen
! self.breakUp = tiFALSE
self.SetColor( colorLow,colorHi)
self.PRIOR_COLOR = colorLow
! self.active = tiTRUE
def GetProperty(self, pptyName):
--- 54,63 ----
self._Properties = self.__dict__
self._Properties.update( properties)
self.SCREEN = sioScreen
! self.breakUp = 0
self.SetColor( colorLow,colorHi)
self.PRIOR_COLOR = colorLow
! self.active = 1
def GetProperty(self, pptyName):
Index: gnue/common/src/cursing/InputBox.py
diff -c gnue/common/src/cursing/InputBox.py:1.1
gnue/common/src/cursing/InputBox.py:1.2
*** gnue/common/src/cursing/InputBox.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/InputBox.py Wed Oct 9 23:04:41 2002
***************
*** 59,83 ****
apply(Dialog.__init__, (self, Parent, r1, c1, r2, c2), properties)
tCmdOK = Button(self, "OKBtn", 5, (DialogWidth - 10) / 4, 10, "OK")
! tCmdOK.SetProperty("EXITFORM", tiTRUE)
self.AddDialogControl(tCmdOK)
tCmdCancel = Button(self, "CnclBtn", 5, 2 + (2 * ((DialogWidth - 10)) /
4), 10, "Cancel")
! tCmdCancel.SetProperty("EXITFORM", tiTRUE)
self.AddDialogControl(tCmdCancel)
self.AddDialogControl(Label(self, "lbl", 1, 2, Prompt))
self.tTextBox = TextBox(self, "txtBox", 2, 2, DialogWidth - 4,
DefaultText)
! self.tTextBox.SetProperty("DEPTH", len(DefaultText))
self.AddDialogControl(self.tTextBox)
! self.SetProperty("STARTPOINT", 3)
def Show(self):
self.Screen().LoLight()
t = self.RunDialog()
if t == 0: # User hit OK
! t = self.tTextBox.GetProperty("TEXT")
else:
t = None
return t
--- 59,83 ----
apply(Dialog.__init__, (self, Parent, r1, c1, r2, c2), properties)
tCmdOK = Button(self, "OKBtn", 5, (DialogWidth - 10) / 4, 10, "OK")
! tCmdOK.EXITFORM = 1
self.AddDialogControl(tCmdOK)
tCmdCancel = Button(self, "CnclBtn", 5, 2 + (2 * ((DialogWidth - 10)) /
4), 10, "Cancel")
! tCmdCancel.EXITFORM = 1
self.AddDialogControl(tCmdCancel)
self.AddDialogControl(Label(self, "lbl", 1, 2, Prompt))
self.tTextBox = TextBox(self, "txtBox", 2, 2, DialogWidth - 4,
DefaultText)
! self.tTextBox.DEPTH = len(DefaultText)
self.AddDialogControl(self.tTextBox)
! self.STARTPOINT = 3
def Show(self):
self.Screen().LoLight()
t = self.RunDialog()
if t == 0: # User hit OK
! t = self.tTextBox.TEXT
else:
t = None
return t
Index: gnue/common/src/cursing/Label.py
diff -c gnue/common/src/cursing/Label.py:1.1
gnue/common/src/cursing/Label.py:1.2
*** gnue/common/src/cursing/Label.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/Label.py Wed Oct 9 23:04:41 2002
***************
*** 44,62 ****
update events and the user can't interact with it.
"""
! def __init__(self, Parent, LabelName, Y, X, Caption, Width=tiFALSE,
**properties):
apply (Control.__init__, (self, Parent, LabelName), properties)
self.PadHeight = 2 # pad the height by this much if multiline
! self.SetProperty("PARENT", Parent)
! self.SetProperty("X", X)
! self.SetProperty("Y", Y)
# for more carefully formatted output
! if Width == tiFALSE:
! self.SetProperty("W", len(Caption))
else:
! self.SetProperty("W", Width)
# if there are newlines in the Cation: set the height of this
# label appropriately
--- 44,62 ----
update events and the user can't interact with it.
"""
! def __init__(self, Parent, LabelName, Y, X, Caption, Width=0,
**properties):
apply (Control.__init__, (self, Parent, LabelName), properties)
self.PadHeight = 2 # pad the height by this much if multiline
! self.PARENT = Parent
! self.X = X
! self.Y = Y
# for more carefully formatted output
! if Width == 0:
! self.W = len(Caption)
else:
! self.W = Width
# if there are newlines in the Cation: set the height of this
# label appropriately
***************
*** 77,103 ****
# "Send Height: %i" % (myht)
myht = len(mylist) + self.PadHeight
! self.SetProperty( "H", myht)
# otherwise, leave alone
else:
! self.SetProperty("H", 1)
! self.SetProperty("CLASS", "LABEL")
! self.SetProperty("CAPTION", Caption)
! self.SetProperty("CANGETFOCUS", tiFALSE)
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSGOTFOCUS", None)
self.SetMethod("SYSLOSTFOCUS", None)
def Paint(self, v1, v2, v3):
! Container = self.GetProperty("PARENT").Screen()
if Container == None:
raise "Containeris Nothing in def Paint!"
self.LoLight()
! Y = self.GetProperty("Y")
! X = self.GetProperty("X")
! caption = self.GetProperty("CAPTION")
Container.PrintAt(Y,X,caption)
--- 77,103 ----
# "Send Height: %i" % (myht)
myht = len(mylist) + self.PadHeight
! self.H = myht
# otherwise, leave alone
else:
! self.H = 1
! self.CLASS = "LABEL"
! self.CAPTION = Caption
! self.CANGETFOCUS = 0
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSGOTFOCUS", None)
self.SetMethod("SYSLOSTFOCUS", None)
def Paint(self, v1, v2, v3):
! Container = self.PARENT.Screen()
if Container == None:
raise "Containeris Nothing in def Paint!"
self.LoLight()
! Y = self.Y
! X = self.X
! caption = self.CAPTION
Container.PrintAt(Y,X,caption)
Index: gnue/common/src/cursing/Menu.py
diff -c gnue/common/src/cursing/Menu.py:1.1 gnue/common/src/cursing/Menu.py:1.2
*** gnue/common/src/cursing/Menu.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/Menu.py Wed Oct 9 23:04:41 2002
***************
*** 27,37 ****
#
from gnue.common import GDebug
-
- #
- # Menu.py
- #
-
from constants import *
from FocusedLabel import FocusedLabel
from Dialog import Dialog
--- 27,32 ----
***************
*** 42,99 ****
"""
"""
def __init__(self,Parent,MenuName,Y,X,DisplayName = "", **properties):
! self.maxLengthFixed = tiFALSE
DisplayName = self.__FixDisplay(DisplayName)
apply(FocusedLabel.__init__, (self,Parent,MenuName,Y,X,DisplayName),
properties)
! self.SetProperty("PARENT", Parent)
self.SetMethod("CLICK",self.ShowOff)
self.items = []
self.maxLength = 0
def Run(self,v1,v2,v3):
! if v1 == tiTRUE:
self.ExecMethod("CLICK", self, None, None)
! if self.GetProperty("EXITFORM") == tiTRUE:
! return tiTRUE
! Container = self.GetProperty("SCREEN");
global BACKWARDS
while 1:
! if self.active != tiTRUE:
! self.breakUp = tiTRUE
! if self.breakUp == tiTRUE:
! self.breakUp = tiFALSE
! return tiFALSE
ch = Container.GetChar()
! if self.GetProperty("PARENT").BreakOrder(ch) == tiTRUE:
return
if ch in (Container.TokNextField, Container.TokRightArrow):
! BACKWARDS=tiFALSE
return
elif ch == Container.TokLeftArrow:
! BACKWARDS=tiTRUE
return
elif ch in (Container.TokDownArrow, Container.TokActivate):
self.ExecMethod("CLICK", self, None, None)
! if self.GetProperty("EXITFORM") == tiTRUE:
! self.GetProperty("PARENT").Paint()
! if self.GetProperty("PARENT").__class__ != ScreenContainer:
! self.GetProperty("PARENT").Refresh(None,None,None)
! return tiTRUE
self.ExecMethod("SYSGOTFOCUS", None, None, None)
def ShowOff(self,arg1, arg2,arg3):
MenuHeight = len(self.items) + 2
MenuWidth = self.maxLength
! X = self.GetProperty("X")
! Y = self.GetProperty("Y") + 1
! Parent = self.GetProperty("PARENT")
! Screen = Parent.GetProperty("SCREEN")
self.myscreen = Screen.CaptureScreen( Y, X, Y + MenuHeight ,
X + MenuWidth )
MenuWin = Dialog(Parent, Y, X, Y + MenuHeight, X + MenuWidth )
count = 1
! self.SetProperty("EXITFORM",tiFALSE)
! for i in range(0,len(self.items)):
text = ''
if self.items[i][0] == -1:
text = (self.maxLength - 4) * chr(tiHLINE)
--- 37,94 ----
"""
"""
def __init__(self,Parent,MenuName,Y,X,DisplayName = "", **properties):
! self.maxLengthFixed = 0
DisplayName = self.__FixDisplay(DisplayName)
apply(FocusedLabel.__init__, (self,Parent,MenuName,Y,X,DisplayName),
properties)
! self.PARENT = Parent
self.SetMethod("CLICK",self.ShowOff)
self.items = []
self.maxLength = 0
def Run(self,v1,v2,v3):
! if v1 :
self.ExecMethod("CLICK", self, None, None)
! if self.EXITFORM:
! return 1
! Container = self.SCREEN;
global BACKWARDS
while 1:
! if self.active != 1:
! self.breakUp = 1
! if self.breakUp :
! self.breakUp = 0
! return 0
ch = Container.GetChar()
! if self.PARENT.BreakOrder(ch) :
return
if ch in (Container.TokNextField, Container.TokRightArrow):
! BACKWARDS=0
return
elif ch == Container.TokLeftArrow:
! BACKWARDS=1
return
elif ch in (Container.TokDownArrow, Container.TokActivate):
self.ExecMethod("CLICK", self, None, None)
! if self.EXITFORM:
! self.PARENT.Paint()
! if self.PARENT.__class__ != ScreenContainer:
! self.PARENT.Refresh(None,None,None)
! return 1
self.ExecMethod("SYSGOTFOCUS", None, None, None)
def ShowOff(self,arg1, arg2,arg3):
MenuHeight = len(self.items) + 2
MenuWidth = self.maxLength
! X = self.X
! Y += 1
! Parent = self.PARENT
! Screen = Parent.SCREEN
self.myscreen = Screen.CaptureScreen( Y, X, Y + MenuHeight ,
X + MenuWidth )
MenuWin = Dialog(Parent, Y, X, Y + MenuHeight, X + MenuWidth )
count = 1
! self.EXITFORM = 0
! for i in range(len(self.items)):
text = ''
if self.items[i][0] == -1:
text = (self.maxLength - 4) * chr(tiHLINE)
***************
*** 101,120 ****
newTitle = self.items[i][1]
text = self.__FixDisplay(newTitle)
item = MenuItem(MenuWin,str(self.items[i][0]),count,2,text)
! item.SetProperty("ITEMID",self.items[i][0])
count += 1
item.SetMethod("CLICK",self.ItemSelected)
MenuWin.AddDialogControl(item)
item.DeActivate(self.items[i][2])
MenuWin.SetColor(colorLow)
! MenuWin.SetProperty("INSET",tiTRUE)
MenuWin.RunDialog()
Parent.Paint()
Parent.Screen().Refresh()
def __FixDisplay(self, newTitle):
erg = newTitle
! if self.maxLengthFixed == tiTRUE:
newLen = len(newTitle)
oldLen = self.maxLength - 4
if newLen >= oldLen:
--- 96,115 ----
newTitle = self.items[i][1]
text = self.__FixDisplay(newTitle)
item = MenuItem(MenuWin,str(self.items[i][0]),count,2,text)
! item.ITEMID = self.items[i][0]
count += 1
item.SetMethod("CLICK",self.ItemSelected)
MenuWin.AddDialogControl(item)
item.DeActivate(self.items[i][2])
MenuWin.SetColor(colorLow)
! MenuWin.INSET = 1
MenuWin.RunDialog()
Parent.Paint()
Parent.Screen().Refresh()
def __FixDisplay(self, newTitle):
erg = newTitle
! if self.maxLengthFixed :
newLen = len(newTitle)
oldLen = self.maxLength - 4
if newLen >= oldLen:
***************
*** 126,144 ****
return erg
def Finalize(self):
! self.GetProperty("PARENT").AddControl(self)
def ItemSelected(self,control, arg2,arg3):
MenuHeight = len(self.items) + 2
MenuWidth = self.maxLength
! X = self.GetProperty("X")
! Y = self.GetProperty("Y") + 1
! Parent = self.GetProperty("PARENT")
! Screen = Parent.GetProperty("SCREEN")
Screen.RestoreScreen(Y,X, Y + MenuHeight , X + MenuWidth ,
self.myscreen )
if(self.GetMethod("CHOSEN") <> None):
!
apply(self.GetMethod("CHOSEN"),(self,control.GetProperty("ITEMID"),control.GetProperty("TITLE")))
def DeActivateItem(self,itemId,state):
for i in range(0,len(self.items)):
--- 121,139 ----
return erg
def Finalize(self):
! self.PARENT.AddControl(self)
def ItemSelected(self,control, arg2,arg3):
MenuHeight = len(self.items) + 2
MenuWidth = self.maxLength
! X = self.X
! Y = self.Y+ 1
! Parent = self.PARENT
! Screen = Parent.SCREEN
Screen.RestoreScreen(Y,X, Y + MenuHeight , X + MenuWidth ,
self.myscreen )
if(self.GetMethod("CHOSEN") <> None):
! apply(self.GetMethod("CHOSEN"),(self,control.ITEMID,control.TITLE))
def DeActivateItem(self,itemId,state):
for i in range(0,len(self.items)):
***************
*** 146,168 ****
self.items[i][2] = state
return
! def AddItem(self, itemId, itemCaption, initialState = tiTRUE):
self.items.append( [ itemId, itemCaption, initialState ] )
if not self.maxLengthFixed and self.maxLength < len(itemCaption)+4:
self.maxLength = len(itemCaption)+4
def InsertSeperator(self):
! self.items.append( [ -1, '', tiFALSE ])
def ChangeTitle(self,newTitle):
newLen = len(newTitle)
! oldLen = len(self.GetProperty("CAPTION"))
if newLen >= oldLen:
newTitle = self.__FixDisplay(newTitle)
! self.SetProperty("CAPTION", newTitle[:oldLen])
else:
newTitle = newTitle + (oldLen-newLen)*' '
! self.SetProperty("CAPTION", newTitle)
def Clear(self):
self.items = []
--- 141,163 ----
self.items[i][2] = state
return
! def AddItem(self, itemId, itemCaption, initialState = 1):
self.items.append( [ itemId, itemCaption, initialState ] )
if not self.maxLengthFixed and self.maxLength < len(itemCaption)+4:
self.maxLength = len(itemCaption)+4
def InsertSeperator(self):
! self.items.append( [ -1, '', 0 ])
def ChangeTitle(self,newTitle):
newLen = len(newTitle)
! oldLen = len(self.CAPTION)
if newLen >= oldLen:
newTitle = self.__FixDisplay(newTitle)
! self.CAPTION = newTitle[:oldLen]
else:
newTitle = newTitle + (oldLen-newLen)*' '
! self.CAPTION = newTitle
def Clear(self):
self.items = []
Index: gnue/common/src/cursing/MenuBar.py
diff -c gnue/common/src/cursing/MenuBar.py:1.1
gnue/common/src/cursing/MenuBar.py:1.2
*** gnue/common/src/cursing/MenuBar.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/MenuBar.py Wed Oct 9 23:04:41 2002
***************
*** 41,77 ****
"""
def __init__(self, Root, Y, X , **properties):
apply(Control.__init__, (self,Root,''),properties)
! self.theScreen = Root.GetProperty("SCREEN")
! self.theRootWin = Root
! self.SetProperty("CANGETFOCUS",tiFALSE)
self.SetMethod("SYSPAINT",self.Paint)
! self.SetProperty("Y",Y)
! self.SetProperty("X",X)
! self.SetProperty("H",2)
! self.SetProperty("W",0)
self.menus = []
def NewMenu(self,Name,Caption):
! newEntry = Menu(self.theRootWin, Name, 0,0, Caption)
self._AddMenu(newEntry)
return newEntry
def Paint(self,v1,v2,v3):
! self.theScreen.PrintAt(self.GetProperty("Y")+1,
! self.GetProperty("X"),
! (self.GetProperty("W")+2)*chr(tiHLINE))
def _AddMenu(self,menu):
self.menus.append(menu)
newX = 0
if len(self.menus) == 1:
! newX = self.GetProperty("X")
else:
! newX = self.menus[-2:-1][0].GetProperty("X")
! newX += len(self.menus[-2:-1][0].GetProperty("CAPTION")) + 2
! self.SetProperty("W",
! self.GetProperty("W")+len(self.menus[-1].GetProperty("CAPTION"))+1)
! menu.SetProperty("X",newX)
! menu.SetProperty("Y",self.GetProperty("Y"))
--- 41,76 ----
"""
def __init__(self, Root, Y, X , **properties):
apply(Control.__init__, (self,Root,''),properties)
! self.screen = Root.SCREEN
! self.rootwin = Root
! self.CANGETFOCUS = 0
self.SetMethod("SYSPAINT",self.Paint)
! self.Y = Y
! self.X = X
! self.H = 2
! self.W = 0
self.menus = []
def NewMenu(self,Name,Caption):
! newEntry = Menu(self.rootwin, Name, 0,0, Caption)
self._AddMenu(newEntry)
return newEntry
def Paint(self,v1,v2,v3):
! self.screen.PrintAt(self.Y+1,
! self.X,
! (self.W+2)*chr(tiHLINE))
def _AddMenu(self,menu):
self.menus.append(menu)
newX = 0
if len(self.menus) == 1:
! newX = self.X
else:
! newX = self.menus[-2:-1][0].X
! newX += len(self.menus[-2:-1][0].CAPTION) + 2
! self.W += len(self.menus[-1].CAPTION)+1
! menu.X = newX
! menu.Y = self.Y
Index: gnue/common/src/cursing/MenuItem.py
diff -c gnue/common/src/cursing/MenuItem.py:1.1
gnue/common/src/cursing/MenuItem.py:1.2
*** gnue/common/src/cursing/MenuItem.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/MenuItem.py Wed Oct 9 23:04:41 2002
***************
*** 27,91 ****
#
from gnue.common import GDebug
-
- #
- # MenuItem.py
- #
-
from constants import *
from FocusedLabel import FocusedLabel
class MenuItem(FocusedLabel):
- """
- """
def __init__(self,Parent,MenuName,Y,X,DisplayName = "", **properties):
apply(FocusedLabel.__init__, (self,Parent,MenuName,Y,X,DisplayName),
properties)
! self.SetProperty("TITLE",DisplayName)
def Run(self,v1,v2,v3):
! Container = self.GetProperty("PARENT").Screen()
! if v1 == tiTRUE:
self.ExecMethod("CLICK", self, None, None)
! return tiTRUE
while 1:
ch = Container.GetChar()
! if self.GetProperty("PARENT").BreakOrder(ch) == tiTRUE:
return
global BACKWARDS
if ch in (Container.TokRightArrow, Container.TokLeftArrow):
! BACKWARDS=tiFALSE
if ch == Container.TokLeftArrow:
! BACKWARDS=tiTRUE
! parent = self.GetProperty("PARENT")
! parent.breakUp = tiTRUE
! return tiTRUE
elif ch in (Container.TokDownArrow, Container.TokNextField):
! BACKWARDS=tiFALSE
! return tiFALSE
elif ch in (Container.TokUpArrow,):
! BACKWARDS=tiTRUE
! return tiFALSE
elif ch == Container.TokActivate:
self.ExecMethod("CLICK",self,None,None)
! return tiTRUE
else:
self.ExecMethod("SYSGOTFOCUS",None,None,None)
def Paint(self, HasFocus, v2, v3):
! Container = self.GetProperty("PARENT").Screen()
! if self.active==tiTRUE:
! if HasFocus == tiTRUE:
self.SetColor(2)
else:
self.SetColor(1)
else:
self.SetColor(4)
self.LoLight()
! Y = self.GetProperty("Y")
! X = self.GetProperty("X")
! caption = self.GetProperty("CAPTION")
Container.PrintAt(Y,X,caption)
! if self.active == tiTRUE:
self.SetColor(1)
self.LoLight()
--- 27,84 ----
#
from gnue.common import GDebug
from constants import *
from FocusedLabel import FocusedLabel
class MenuItem(FocusedLabel):
def __init__(self,Parent,MenuName,Y,X,DisplayName = "", **properties):
apply(FocusedLabel.__init__, (self,Parent,MenuName,Y,X,DisplayName),
properties)
! self.TITLE = DisplayName
def Run(self,v1,v2,v3):
! Container = self.PARENT.Screen()
! if v1 :
self.ExecMethod("CLICK", self, None, None)
! return 1
while 1:
ch = Container.GetChar()
! if self.PARENT.BreakOrder(ch) :
return
global BACKWARDS
if ch in (Container.TokRightArrow, Container.TokLeftArrow):
! BACKWARDS=0
if ch == Container.TokLeftArrow:
! BACKWARDS=1
! parent = self.PARENT
! parent.breakUp = 1
! return 1
elif ch in (Container.TokDownArrow, Container.TokNextField):
! BACKWARDS=0
! return 0
elif ch in (Container.TokUpArrow,):
! BACKWARDS=1
! return 0
elif ch == Container.TokActivate:
self.ExecMethod("CLICK",self,None,None)
! return 1
else:
self.ExecMethod("SYSGOTFOCUS",None,None,None)
def Paint(self, HasFocus, v2, v3):
! Container = self.PARENT.Screen()
! if self.active:
! if HasFocus :
self.SetColor(2)
else:
self.SetColor(1)
else:
self.SetColor(4)
self.LoLight()
! Y = self.Y
! X = self.X
! caption = self.CAPTION
Container.PrintAt(Y,X,caption)
! if self.active :
self.SetColor(1)
self.LoLight()
Index: gnue/common/src/cursing/MsgBoxOK.py
diff -c gnue/common/src/cursing/MsgBoxOK.py:1.1
gnue/common/src/cursing/MsgBoxOK.py:1.2
*** gnue/common/src/cursing/MsgBoxOK.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/MsgBoxOK.py Wed Oct 9 23:04:41 2002
***************
*** 63,69 ****
apply(Dialog.__init__, (self, Parent, r1, c1, r2, c2), properties)
tCmd = Button(self, "TheBtn", 5, (DialogWidth - 6) / 2, 6, "OK")
! tCmd.SetProperty("EXITFORM", tiTRUE)
self.AddDialogControl(tCmd)
self.AddDialogControl(Label(self, "TheMsg", 1, 2, Message))
--- 63,69 ----
apply(Dialog.__init__, (self, Parent, r1, c1, r2, c2), properties)
tCmd = Button(self, "TheBtn", 5, (DialogWidth - 6) / 2, 6, "OK")
! tCmd.EXITFORM = 1
self.AddDialogControl(tCmd)
self.AddDialogControl(Label(self, "TheMsg", 1, 2, Message))
Index: gnue/common/src/cursing/MsgBoxTimer.py
diff -c gnue/common/src/cursing/MsgBoxTimer.py:1.1
gnue/common/src/cursing/MsgBoxTimer.py:1.2
*** gnue/common/src/cursing/MsgBoxTimer.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/MsgBoxTimer.py Wed Oct 9 23:04:41 2002
***************
*** 63,69 ****
apply(Dialog.__init__, (self, Parent, r1, c1, r2, c2), properties)
tCmd = Button(self, "TheBtn", 5, (DialogWidth - 6) / 2, 6, "OK")
! tCmd.SetProperty("EXITFORM", tiTRUE)
self.AddDialogControl(tCmd)
self.AddDialogControl(Label(self, "TheMsg", 1, 2, Message))
--- 63,69 ----
apply(Dialog.__init__, (self, Parent, r1, c1, r2, c2), properties)
tCmd = Button(self, "TheBtn", 5, (DialogWidth - 6) / 2, 6, "OK")
! tCmd.EXITFORM = 1
self.AddDialogControl(tCmd)
self.AddDialogControl(Label(self, "TheMsg", 1, 2, Message))
Index: gnue/common/src/cursing/MsgBoxYesNo.py
diff -c gnue/common/src/cursing/MsgBoxYesNo.py:1.1
gnue/common/src/cursing/MsgBoxYesNo.py:1.2
*** gnue/common/src/cursing/MsgBoxYesNo.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/MsgBoxYesNo.py Wed Oct 9 23:04:41 2002
***************
*** 62,71 ****
apply(Dialog.__init__, (self, Parent, r1, c1, r2, c2), properties)
tCmdYes = Button(self, "YesBtn", 5, (DialogWidth - 7) / 4, 7, "Yes")
! tCmdYes.SetProperty("EXITFORM", tiTRUE)
self.AddDialogControl(tCmdYes)
tCmdNo = Button(self, "NoBtn", 5, 2 + (2 * ((DialogWidth - 7)) / 4), 7,
"No")
! tCmdNo.SetProperty("EXITFORM", tiTRUE)
self.AddDialogControl(tCmdNo)
self.AddDialogControl(Label(self, "TheMsg", 1, 2, Message))
--- 62,71 ----
apply(Dialog.__init__, (self, Parent, r1, c1, r2, c2), properties)
tCmdYes = Button(self, "YesBtn", 5, (DialogWidth - 7) / 4, 7, "Yes")
! tCmdYes.EXITFORM = 1
self.AddDialogControl(tCmdYes)
tCmdNo = Button(self, "NoBtn", 5, 2 + (2 * ((DialogWidth - 7)) / 4), 7,
"No")
! tCmdNo.EXITFORM = 1
self.AddDialogControl(tCmdNo)
self.AddDialogControl(Label(self, "TheMsg", 1, 2, Message))
Index: gnue/common/src/cursing/Progress.py
diff -c gnue/common/src/cursing/Progress.py:1.1
gnue/common/src/cursing/Progress.py:1.2
*** gnue/common/src/cursing/Progress.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/Progress.py Wed Oct 9 23:04:41 2002
***************
*** 47,104 ****
"""
def __init__(self, Parent, ProgressName, Y, X, W, Max, **properties):
apply (Control.__init__, (self, Parent, ProgressName), properties)
! self.SetProperty("PARENT", Parent)
! self.SetProperty("X", X)
! self.SetProperty("Y", Y)
! self.SetProperty("W", W)
! self.SetProperty("H", 1)
! self.SetProperty("MAX", Max)
! self.SetProperty("VALUE", 0)
! self.SetProperty("CANGETFOCUS", tiFALSE)
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("PAINT", self.Paint)
self.SetMethod("REFRESH", self.Paint)
self.SetColor(3)
! self.SetProperty("PRIOR_COLOR",3)
# working area is the prescribed with - 4 for effect
! self.WorkingArea = float(self.GetProperty("W") - 4)
def Paint(self, ActionHilighted=None, v2=None, v3=None):
"Paint the progrss bar on the screen"
! Screen = self.GetProperty("PARENT").GetProperty("SCREEN")
# set the lolight
self.LoLight()
# PERCENT used space.
! UsedSpace = float(self.GetProperty("VALUE")) / \
! float(self.GetProperty("MAX"))
# Space actually marked so far:
MarkedSpace = int((UsedSpace * self.WorkingArea))
# if amount marked up is less than the working area
if MarkedSpace <= self.WorkingArea:
! Screen.AutoRefresh = tiFALSE
! Screen.PrintAt(self.GetProperty("Y"), self.GetProperty("X"), "[ ")
! Screen.PrintAt(self.GetProperty("Y"),
! self.GetProperty("X") + self.GetProperty("W") - 2, " ]")
for i in range(0, MarkedSpace):
! Screen.PutAt(self.GetProperty("Y"),
! self.GetProperty("X") + 2 + i, ' ', curses.A_STANDOUT)
! Screen.AutoRefresh = tiTRUE
Screen.Refresh()
def Init(self, Max):
"Initialize the progress bar"
self.pbClear() # previous usages will leave the area tainted.
if self.active:
! self.SetProperty("MAX",Max)
! self.SetProperty("VALUE",0)
! self.Paint(tiFALSE, None,None)
# self.ExecMethod("REFRESH",None,None,None)
def Step(self):
if self.active:
! now = self.GetProperty("VALUE")
now += 1
! self.SetProperty("VALUE", now)
self.Paint(0,0,0)
# self.ExecMethod("REFRESH",None,None,None)
--- 47,104 ----
"""
def __init__(self, Parent, ProgressName, Y, X, W, Max, **properties):
apply (Control.__init__, (self, Parent, ProgressName), properties)
! self.PARENT = Parent
! self.X = X
! self.Y = Y
! self.W = W
! self.H = 1
! self.MAX = Max
! self.VALUE = 0
! self.CANGETFOCUS = 0
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("PAINT", self.Paint)
self.SetMethod("REFRESH", self.Paint)
self.SetColor(3)
! self.PRIOR_COLOR = 3
# working area is the prescribed with - 4 for effect
! self.WorkingArea = float(self.W- 4)
def Paint(self, ActionHilighted=None, v2=None, v3=None):
"Paint the progrss bar on the screen"
! Screen = self.PARENT.SCREEN
# set the lolight
self.LoLight()
# PERCENT used space.
! UsedSpace = float(self.VALUE) / \
! float(self.MAX)
# Space actually marked so far:
MarkedSpace = int((UsedSpace * self.WorkingArea))
# if amount marked up is less than the working area
if MarkedSpace <= self.WorkingArea:
! Screen.AutoRefresh = 0
! Screen.PrintAt(self.Y, self.X, "[ ")
! Screen.PrintAt(self.Y,
! self.X+ self.W- 2, " ]")
for i in range(0, MarkedSpace):
! Screen.PutAt(self.Y,
! self.X+ 2 + i, ' ', curses.A_STANDOUT)
! Screen.AutoRefresh = 1
Screen.Refresh()
def Init(self, Max):
"Initialize the progress bar"
self.pbClear() # previous usages will leave the area tainted.
if self.active:
! self.MAX = Max
! self.VALUE = 0
! self.Paint(0, None,None)
# self.ExecMethod("REFRESH",None,None,None)
def Step(self):
if self.active:
! now = self.VALUE
now += 1
! self.VALUE = now
self.Paint(0,0,0)
# self.ExecMethod("REFRESH",None,None,None)
***************
*** 109,124 ****
def pbClear(self):
"Clear the progress bar of any progress marks"
# fetch up the screen
! Screen = self.GetProperty("PARENT").GetProperty("SCREEN")
! Screen.AutoRefresh = tiFALSE
# set the color to be consistent with initial state
self.LoLight()
! Screen.PrintAt(self.GetProperty("Y"), self.GetProperty("X"), "[ ")
! Screen.PrintAt(self.GetProperty("Y"),
! self.GetProperty("X") + self.GetProperty("W") - 2, " ]")
for i in range(0, self.WorkingArea):
! Screen.PutAt(self.GetProperty("Y"),
! self.GetProperty("X") + 2 + i, ' ', curses.A_NORMAL)
! Screen.AutoRefresh = tiTRUE
Screen.Refresh()
--- 109,124 ----
def pbClear(self):
"Clear the progress bar of any progress marks"
# fetch up the screen
! Screen = self.PARENT.SCREEN
! Screen.AutoRefresh = 0
# set the color to be consistent with initial state
self.LoLight()
! Screen.PrintAt(self.Y, self.X, "[ ")
! Screen.PrintAt(self.Y,
! self.X+ self.W- 2, " ]")
for i in range(0, self.WorkingArea):
! Screen.PutAt(self.Y,
! self.X+ 2 + i, ' ', curses.A_NORMAL)
! Screen.AutoRefresh = 1
Screen.Refresh()
Index: gnue/common/src/cursing/RadioButton.py
diff -c gnue/common/src/cursing/RadioButton.py:1.1
gnue/common/src/cursing/RadioButton.py:1.2
*** gnue/common/src/cursing/RadioButton.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/RadioButton.py Wed Oct 9 23:04:41 2002
***************
*** 41,62 ****
def __init__(self,Root, Name, Y, X, Caption, Id, **properties):
Caption = ' o ' + Caption
apply(FocusedLabel.__init__,(self,Root,Name,Y,X,Caption),properties)
! self.SetProperty("ID",Id)
self.SetMethod("PAINT",self.Paint)
! self.SetProperty("X",X)
! self.SetProperty("Y",Y)
! self.SetProperty("W",len(Caption))
! self.SetProperty("H",1)
self._active = 'x'
self._inactive = 'o'
def Paint(self, v1,v2,v3):
! cap = self.GetProperty("CAPTION")
bullet = self._inactive
! if self.GetProperty("ACTIVE") == tiTRUE:
bullet = self._active # chr(tiBULL)
cap = cap[:1] + bullet + cap[2:]
! self.SetProperty("CAPTION",cap)
FocusedLabel.Paint(self,v1,v2,v3)
--- 41,62 ----
def __init__(self,Root, Name, Y, X, Caption, Id, **properties):
Caption = ' o ' + Caption
apply(FocusedLabel.__init__,(self,Root,Name,Y,X,Caption),properties)
! self.ID = Id
self.SetMethod("PAINT",self.Paint)
! self.X = X
! self.Y = Y
! self.W = len(Caption)
! self.H = 1
self._active = 'x'
self._inactive = 'o'
def Paint(self, v1,v2,v3):
! cap = self.CAPTION
bullet = self._inactive
! if self.ACTIVE:
bullet = self._active # chr(tiBULL)
cap = cap[:1] + bullet + cap[2:]
! self.CAPTION = cap
FocusedLabel.Paint(self,v1,v2,v3)
Index: gnue/common/src/cursing/RadioGroup.py
diff -c gnue/common/src/cursing/RadioGroup.py:1.1
gnue/common/src/cursing/RadioGroup.py:1.2
*** gnue/common/src/cursing/RadioGroup.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/RadioGroup.py Wed Oct 9 23:04:41 2002
***************
*** 41,62 ****
"""
def __init__(self, Root, GroupName, Y, X, W,**properties):
apply(Control.__init__,(self,Root,GroupName),properties)
! self.SetProperty("Y",Y)
! self.SetProperty("X",X)
! self.SetProperty("W",W)
! self.SetProperty("H",0)
self.Parent = Root
self.Name = GroupName
self.SetMethod("SYSPAINT",self.Paint)
! self.SetProperty("CANGETFOCUS", tiFALSE)
self.buttons = []
self.activeItem = None
! self._paint = tiTRUE
def Paint(self,v1,v2,v3):
for i in self.buttons:
i.Paint(None,None,None)
! self.GetProperty("PARENT").Screen().Refresh()
def AddItem(self,itemId,Caption,X=-1,Y=-1,W=-1):
posX = X
--- 41,62 ----
"""
def __init__(self, Root, GroupName, Y, X, W,**properties):
apply(Control.__init__,(self,Root,GroupName),properties)
! self.Y = Y
! self.X = X
! self.W = W
! self.H = 0
self.Parent = Root
self.Name = GroupName
self.SetMethod("SYSPAINT",self.Paint)
! self.CANGETFOCUS = 0
self.buttons = []
self.activeItem = None
! self._paint = 1
def Paint(self,v1,v2,v3):
for i in self.buttons:
i.Paint(None,None,None)
! self.PARENT.Screen().Refresh()
def AddItem(self,itemId,Caption,X=-1,Y=-1,W=-1):
posX = X
***************
*** 64,74 ****
posW = W
if posW == -1:
! posW = self.GetProperty("W")
if posX == -1:
! posX = self.GetProperty("X")
if posY == -1:
! posY = self.GetProperty("Y") + len(self.buttons) #self.GetProperty("H")
if len(Caption) > posW-3:
cutoff = len(Caption) - (posW-3 )
--- 64,74 ----
posW = W
if posW == -1:
! posW = self.W
if posX == -1:
! posX = self.X
if posY == -1:
! posY = self.Y+ len(self.buttons) #self.H
if len(Caption) > posW-3:
cutoff = len(Caption) - (posW-3 )
***************
*** 76,86 ****
button = RadioButton(self.Parent,str(itemId), \
posY, \
posX, Caption, itemId)
! button.SetProperty("ACTIVE", tiFALSE)
self.Parent.AddControl(button)
button.SetMethod("CLICK",self._ToggleItem)
self.buttons.append(button)
! self.SetProperty("H", self.GetProperty("H") + 1)
def AddButton(self, button):
if string.find(str(button.__class__), '.RadioButton') != -1:
--- 76,86 ----
button = RadioButton(self.Parent,str(itemId), \
posY, \
posX, Caption, itemId)
! button.ACTIVE = 0
self.Parent.AddControl(button)
button.SetMethod("CLICK",self._ToggleItem)
self.buttons.append(button)
! self.H = self.H+ 1
def AddButton(self, button):
if string.find(str(button.__class__), '.RadioButton') != -1:
***************
*** 89,103 ****
def GetActiveItem(self):
if self.activeItem == None:
return None
! return self.activeItem.GetProperty("ID")
def _ToggleItem(self,item,v2,v3):
if self.activeItem != None:
! self.activeItem.SetProperty("ACTIVE",tiFALSE)
self.activeItem.Paint(None,None,None)
self.activeItem = item
! item.SetProperty("ACTIVE",tiTRUE)
! item.Paint(tiTRUE,None,None)
self.Parent.Screen().Refresh()
--- 89,103 ----
def GetActiveItem(self):
if self.activeItem == None:
return None
! return self.activeItem.ID
def _ToggleItem(self,item,v2,v3):
if self.activeItem != None:
! self.activeItem.ACTIVE = 0
self.activeItem.Paint(None,None,None)
self.activeItem = item
! item.ACTIVE = 1
! item.Paint(1,None,None)
self.Parent.Screen().Refresh()
Index: gnue/common/src/cursing/ScreenContainer.py
diff -c gnue/common/src/cursing/ScreenContainer.py:1.1
gnue/common/src/cursing/ScreenContainer.py:1.2
*** gnue/common/src/cursing/ScreenContainer.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/ScreenContainer.py Wed Oct 9 23:04:41 2002
***************
*** 55,62 ****
apply(GraphicObject.__init__, (self, SIOInstance), properties)
! self.SetProperty("STARTPOINT", 0)
! self.breakUp = tiFALSE
self.SetColor(1)
self.nextCtl = None
self.eventX = -1
--- 55,62 ----
apply(GraphicObject.__init__, (self, SIOInstance), properties)
! self.STARTPOINT = 0
! self.breakUp = 0
self.SetColor(1)
self.nextCtl = None
self.eventX = -1
***************
*** 82,90 ****
ControlObj.InheritProperties(self)
self.Controls.append(ControlObj)
self.Metrics[ControlObj] = (
! ControlObj.GetProperty("Y"), ControlObj.GetProperty("X"),
! ControlObj.GetProperty("Y") + ControlObj.GetProperty("H"),
! ControlObj.GetProperty("X") + ControlObj.GetProperty("W"))
def DelControl(self,ControlObj = None):
--- 82,90 ----
ControlObj.InheritProperties(self)
self.Controls.append(ControlObj)
self.Metrics[ControlObj] = (
! ControlObj.Y, ControlObj.X,
! ControlObj.Y+ ControlObj.H,
! ControlObj.X+ ControlObj.W)
def DelControl(self,ControlObj = None):
***************
*** 95,119 ****
self.Controls.remove(ControlObj)
def Screen(self):
! """Return GetProperty( "SCREEN") to caller."""
! return self.GetProperty("SCREEN")
def Paint(self):
"""
Paint EVERY Control registered in this ScreenContainer
instance. Effectively repainting the entire container iteratively.
"""
! self.Screen().AutoRefresh = tiFALSE
self.LoLight()
for Control in self.Controls:
Control.ExecMethod("SYSPAINT", None, None, None)
! self.Screen().AutoRefresh = tiTRUE
self.Screen().Refresh()
def FindControlByName(self, ControlName):
"Return control object from self.Controls based on label 'NAME'."
for c in self.Controls:
! if c.GetProperty("NAME") == ControlName:
return c
return None
--- 95,119 ----
self.Controls.remove(ControlObj)
def Screen(self):
! """Return SCREENto caller."""
! return self.SCREEN
def Paint(self):
"""
Paint EVERY Control registered in this ScreenContainer
instance. Effectively repainting the entire container iteratively.
"""
! self.Screen().AutoRefresh = 0
self.LoLight()
for Control in self.Controls:
Control.ExecMethod("SYSPAINT", None, None, None)
! self.Screen().AutoRefresh = 1
self.Screen().Refresh()
def FindControlByName(self, ControlName):
"Return control object from self.Controls based on label 'NAME'."
for c in self.Controls:
! if c.NAME== ControlName:
return c
return None
***************
*** 130,148 ****
self.Paint()
# myControlStackIndex
! myCsi = self.GetProperty("STARTPOINT")
# Sanity check the Csi
if myCsi == None:
myCsi = 0
# event loop runs forever
while 1:
! activate = tiFALSE
# if breakUp is set to TermInfoTrue, return ControlStackIndex
# less one.
! if self.breakUp == tiTRUE:
! self.breakUp = tiFALSE
return myCsi-1
# Sanity check the Control Stack index (again!), reset index to
--- 130,148 ----
self.Paint()
# myControlStackIndex
! myCsi = self.STARTPOINT
# Sanity check the Csi
if myCsi == None:
myCsi = 0
# event loop runs forever
while 1:
! activate = 0
# if breakUp is set to TermInfoTrue, return ControlStackIndex
# less one.
! if self.breakUp :
! self.breakUp = 0
return myCsi-1
# Sanity check the Control Stack index (again!), reset index to
***************
*** 168,185 ****
# reset the next Control value to None
self.nextCtl = None
# My control is set and ready, mark it to be activated.
! activate = tiTRUE
# if this control has explicitly been set to 'non-active' with
# Control.DeActivate or Control.SetActiveState then don't
# initialize it.
! if myCtl.active == tiFALSE:
# assign the next active control stack index to myCsi
myCsi = self.__GetNextActiveCtlIndex(myCsi)
# Otherwise, we have an 'active' Control!
# "only go to the control if it can get focus"
! elif myCtl.GetProperty("CANGETFOCUS") == tiTRUE:
# call system level gotfocus
myCtl.ExecMethod("SYSGOTFOCUS", None, None, None)
# If a custom GOTFOCUS method has been assigned,
--- 168,185 ----
# reset the next Control value to None
self.nextCtl = None
# My control is set and ready, mark it to be activated.
! activate = 1
# if this control has explicitly been set to 'non-active' with
# Control.DeActivate or Control.SetActiveState then don't
# initialize it.
! if myCtl.active == 0:
# assign the next active control stack index to myCsi
myCsi = self.__GetNextActiveCtlIndex(myCsi)
# Otherwise, we have an 'active' Control!
# "only go to the control if it can get focus"
! elif myCtl.CANGETFOCUS:
# call system level gotfocus
myCtl.ExecMethod("SYSGOTFOCUS", None, None, None)
# If a custom GOTFOCUS method has been assigned,
***************
*** 192,204 ****
if UserGotFocus(myCtl, None, None):
# do system level run
if myCtl.ExecMethod( "SYSRUN", activate,
! self.eventY, self.eventX) == tiTRUE:
return myCsi
else:
# otherwise, _just_ do system level run
if myCtl.ExecMethod("SYSRUN", activate,
! self.eventY, self.eventX) == tiTRUE:
return myCsi
# When in the world do we get program control here?!
--- 192,204 ----
if UserGotFocus(myCtl, None, None):
# do system level run
if myCtl.ExecMethod( "SYSRUN", activate,
! self.eventY, self.eventX) :
return myCsi
else:
# otherwise, _just_ do system level run
if myCtl.ExecMethod("SYSRUN", activate,
! self.eventY, self.eventX) :
return myCsi
# When in the world do we get program control here?!
***************
*** 215,221 ****
else:
myCsi = self.__GetNextActiveCtlIndex(myCsi)
! activate = tiFALSE
def BreakOrder(self, Char):
--- 215,221 ----
else:
myCsi = self.__GetNextActiveCtlIndex(myCsi)
! activate = 0
def BreakOrder(self, Char):
***************
*** 229,240 ****
event = curses.getmouse()
if event[4] & curses.BUTTON1_CLICKED:
item = self.__ControlAt(event[2],event[1])
! if item != None and item.active == tiTRUE:
self.eventY = event[2]
self.eventX = event[1]
self.nextCtl = item
! return tiTRUE
! return tiFALSE
#
--- 229,240 ----
event = curses.getmouse()
if event[4] & curses.BUTTON1_CLICKED:
item = self.__ControlAt(event[2],event[1])
! if item != None and item.active :
self.eventY = event[2]
self.eventX = event[1]
self.nextCtl = item
! return 1
! return 0
#
***************
*** 244,250 ****
def __GetNextActiveCtlIndex(self, active):
step = 1
global BACKWARDS
! if BACKWARDS == tiTRUE:
step = -1
limit = len(self.Controls)
if active < 0 or active >= limit:
--- 244,250 ----
def __GetNextActiveCtlIndex(self, active):
step = 1
global BACKWARDS
! if BACKWARDS :
step = -1
limit = len(self.Controls)
if active < 0 or active >= limit:
***************
*** 257,263 ****
elif active >= limit:
active = 0
Con = self.Controls[active]
! if Con.active == tiTRUE:
return active
++i
return None
--- 257,263 ----
elif active >= limit:
active = 0
Con = self.Controls[active]
! if Con.active :
return active
++i
return None
***************
*** 266,272 ****
def __ControlAt(self, Y, X):
for i in range(0, len(self.Controls)):
metric = self.Metrics[self.Controls[i]]
! if Y >= metric[0] and Y < metric[2] and X >= metric[1] and X <
metric[3] and self.Controls[i].active==tiTRUE:
return self.Controls[i]
return None
--- 266,272 ----
def __ControlAt(self, Y, X):
for i in range(0, len(self.Controls)):
metric = self.Metrics[self.Controls[i]]
! if Y >= metric[0] and Y < metric[2] and X >= metric[1] and X <
metric[3] and self.Controls[i].active:
return self.Controls[i]
return None
Index: gnue/common/src/cursing/ScrollBar.py
diff -c gnue/common/src/cursing/ScrollBar.py:1.1
gnue/common/src/cursing/ScrollBar.py:1.2
*** gnue/common/src/cursing/ScrollBar.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/ScrollBar.py Wed Oct 9 23:04:41 2002
***************
*** 46,57 ****
"""
def __init__(self, Parent, SBName, Y, X, W, **properties):
apply(Control.__init__, (self,Parent,SBName),properties)
! self.SetProperty("CANGETFOCUS", tiTRUE)
! self.SetProperty("H",1)
! self.SetProperty("W",W)
! self.SetProperty("Y",Y)
! self.SetProperty("X",X)
! self.SetProperty("PARENT", Parent)
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSRUN",self.Run)
self.SetMethod("GOTFOCUS", self.__GotFocus)
--- 46,57 ----
"""
def __init__(self, Parent, SBName, Y, X, W, **properties):
apply(Control.__init__, (self,Parent,SBName),properties)
! self.CANGETFOCUS = 1
! self.H = 1
! self.W = W
! self.Y = Y
! self.X = X
! self.PARENT = Parent
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSRUN",self.Run)
self.SetMethod("GOTFOCUS", self.__GotFocus)
***************
*** 63,72 ****
def __initButtons(self):
if string.find(str(self.__class__), '.ScrollBar') != -1:
! Y = self.GetProperty("Y")
! X = self.GetProperty("X")
! W = self.GetProperty("W")
! Parent = self.GetProperty("PARENT")
self.rightarrow = Button(Parent,'rightarrow',Y,X+W - 3,3,'>')
self.rightarrow.SetMethod("CLICK",self._Inc)
Parent.AddControl(self.rightarrow)
--- 63,72 ----
def __initButtons(self):
if string.find(str(self.__class__), '.ScrollBar') != -1:
! Y = self.Y
! X = self.X
! W = self.W
! Parent = self.PARENT
self.rightarrow = Button(Parent,'rightarrow',Y,X+W - 3,3,'>')
self.rightarrow.SetMethod("CLICK",self._Inc)
Parent.AddControl(self.rightarrow)
***************
*** 78,105 ****
Parent.AddControl(self.leftarrow)
def __GotFocus(self,v1,v2,v3):
! self.SetProperty("FOCUS",tiTRUE)
self.Paint(None,None,None)
! return tiTRUE
def __LostFocus(self,v1,v2,v3):
! self.SetProperty("FOCUS",tiFALSE)
self.Paint(None,None,None)
! return tiTRUE
def Run(self, v1,v2,v3):
! if v1 == tiTRUE:
self.ExecMethod("CLICK", self, v2, v3)
! Container = self.GetProperty("PARENT").Screen()
global BACKWARDS
while 1:
ch = Container.GetChar()
! if self.GetProperty("PARENT").BreakOrder(ch) == tiTRUE:
return
if ch in (Container.TokNextField, Container.TokDownArrow,
Container.TokUpArrow):
! BACKWARDS = tiFALSE
if ch == Container.TokUpArrow:
! BACKWARDS = tiTRUE
return
elif ch == Container.TokLeftArrow:
self._Dec(None,None,None)
--- 78,105 ----
Parent.AddControl(self.leftarrow)
def __GotFocus(self,v1,v2,v3):
! self.FOCUS = 1
self.Paint(None,None,None)
! return 1
def __LostFocus(self,v1,v2,v3):
! self.FOCUS = 0
self.Paint(None,None,None)
! return 1
def Run(self, v1,v2,v3):
! if v1 :
self.ExecMethod("CLICK", self, v2, v3)
! Container = self.PARENT.Screen()
global BACKWARDS
while 1:
ch = Container.GetChar()
! if self.PARENT.BreakOrder(ch) :
return
if ch in (Container.TokNextField, Container.TokDownArrow,
Container.TokUpArrow):
! BACKWARDS = 0
if ch == Container.TokUpArrow:
! BACKWARDS = 1
return
elif ch == Container.TokLeftArrow:
self._Dec(None,None,None)
***************
*** 119,126 ****
def Init(self, Max):
self._max = Max
self._val = 0
! self.WorkingArea = float(self.GetProperty("W")-9)
! self.start = self.GetProperty("X") + 3
self.UsedSpace = int(math.floor(self.WorkingArea / float(self._max)))
self.stepsize = self.WorkingArea / self._max
if self.UsedSpace < 1:
--- 119,126 ----
def Init(self, Max):
self._max = Max
self._val = 0
! self.WorkingArea = float(self.W-9)
! self.start = self.X+ 3
self.UsedSpace = int(math.floor(self.WorkingArea / float(self._max)))
self.stepsize = self.WorkingArea / self._max
if self.UsedSpace < 1:
***************
*** 129,155 ****
def Paint(self,v1,v2,v3):
Pos = int(math.ceil(float(self._val) * (self.stepsize))) + self.start
! Screen = self.GetProperty("PARENT").Screen()
! Screen.AutoRefresh = tiFALSE
# clear the bar region in reverse standard-color
self.SetColor(1)
self.LoLight()
for i in range(0, int(self.WorkingArea)):
! Screen.PutAt(self.GetProperty("Y"), self.start + i, ' ',
curses.A_REVERSE)
# correct position
if Pos >= (self.WorkingArea + self.start):
Pos = (self.start + self.WorkingArea)
elif Pos < (self.start + self.UsedSpace):
Pos = self.start + self.UsedSpace
# draw the handle hilight
! if self.GetProperty("FOCUS")==tiTRUE:
self.SetColor(3)
else:
self.SetColor(2)
self.LoLight()
for i in range(0, self.UsedSpace):
! Screen.PutAt(self.GetProperty("Y"), (Pos - self.UsedSpace) + i, ' ',
curses.A_REVERSE)
! Screen.AutoRefresh = tiTRUE
Screen.Refresh()
def Dec(self,arg1,arg2,arg3):
--- 129,155 ----
def Paint(self,v1,v2,v3):
Pos = int(math.ceil(float(self._val) * (self.stepsize))) + self.start
! Screen = self.PARENT.Screen()
! Screen.AutoRefresh = 0
# clear the bar region in reverse standard-color
self.SetColor(1)
self.LoLight()
for i in range(0, int(self.WorkingArea)):
! Screen.PutAt(self.Y, self.start + i, ' ', curses.A_REVERSE)
# correct position
if Pos >= (self.WorkingArea + self.start):
Pos = (self.start + self.WorkingArea)
elif Pos < (self.start + self.UsedSpace):
Pos = self.start + self.UsedSpace
# draw the handle hilight
! if self.FOCUS:
self.SetColor(3)
else:
self.SetColor(2)
self.LoLight()
for i in range(0, self.UsedSpace):
! Screen.PutAt(self.Y, (Pos - self.UsedSpace) + i, ' ', curses.A_REVERSE)
! Screen.AutoRefresh = 1
Screen.Refresh()
def Dec(self,arg1,arg2,arg3):
***************
*** 179,185 ****
self.Paint(None,None,None)
def __del__(self):
! Parent = self.GetProperty("PARENT")
Parent.DelControl(self.rightarrow)
Parent.DelControl(self.leftarrow)
Parent.DelControl(self.left2arrow)
--- 179,185 ----
self.Paint(None,None,None)
def __del__(self):
! Parent = self.PARENT
Parent.DelControl(self.rightarrow)
Parent.DelControl(self.leftarrow)
Parent.DelControl(self.left2arrow)
Index: gnue/common/src/cursing/TextBox.py
diff -c gnue/common/src/cursing/TextBox.py:1.1
gnue/common/src/cursing/TextBox.py:1.2
*** gnue/common/src/cursing/TextBox.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/TextBox.py Wed Oct 9 23:04:41 2002
***************
*** 45,61 ****
def __init__(self, Parent, TextboxName, Y, X, W, DefaultValue="",
**properties):
apply(Control.__init__, (self, Parent, TextboxName), properties)
! self.SetProperty("PARENT", Parent)
! self.SetProperty("CLASS", "TEXTBOX")
! self.SetProperty("X", X)
! self.SetProperty("Y", Y)
! self.SetProperty("W", W)
! self.SetProperty("H", 1)
! self.SetProperty("TEXT", DefaultValue)
! self.SetProperty("CANGETFOCUS", tiTRUE)
! self.SetProperty("FOCUS", tiFALSE)
! self.SetProperty("DEPTH", 0) # our position in the text: 0..N
! self.SetProperty("MAXLENGTH", -1) # if -1, text length is unlimited
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSGOTFOCUS", self.GotFocus)
--- 45,61 ----
def __init__(self, Parent, TextboxName, Y, X, W, DefaultValue="",
**properties):
apply(Control.__init__, (self, Parent, TextboxName), properties)
! self.PARENT = Parent
! self.CLASS = "TEXTBOX"
! self.X = X
! self.Y = Y
! self.W = W
! self.H = 1
! self.TEXT = DefaultValue
! self.CANGETFOCUS = 1
! self.FOCUS = 0
! self.DEPTH = 0 # our position in the text: 0..N
! self.MAXLENGTH = -1 # if -1, text length is unlimited
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSGOTFOCUS", self.GotFocus)
***************
*** 66,110 ****
self.SetMethod("GOTFOCUS", None)
self.last_act = 1 # 1 = forward, 0 = backward
self.laststart = 0
! self.SetProperty("EDITABLE", tiTRUE)
def Run(self, v1, v2, v3):
! Container = self.GetProperty("PARENT").Screen()
! if self.GetProperty("EDITABLE") == tiTRUE:
try:
curses.curs_set(1)
except:
pass
! if v1 == tiTRUE:
! Depth = self.GetProperty("DEPTH")
! offset = (v3 - self.GetProperty("X"))
! textlen = len(self.GetProperty("TEXT"))
! if Depth < self.GetProperty("W"):
Depth = offset
else:
! Depth = Depth - (self.GetProperty("W") - offset)
if Depth < 0:
Depth = 0
elif Depth > textlen:
Depth = textlen
! self.SetProperty("DEPTH",Depth)
self.Paint(0,0,0)
while 1:
ch = Container.GetChar()
! if self.GetProperty("PARENT").BreakOrder(ch) == tiTRUE:
try:
curses.curs_set(0)
except:
pass
return
! Depth = self.GetProperty("DEPTH")
! Text = self.GetProperty("TEXT")
global BACKWARDS
if ch in (Container.TokDownArrow, Container.TokNextField,
Container.TokActivate, Container.TokUpArrow):
! BACKWARDS = tiFALSE
if ch == Container.TokUpArrow:
! BACKWARDS = tiTRUE
! if self.ExecMethod( "VERIFY", self.GetProperty("TEXT"), None, None)
== tiTRUE:
try:
curses.curs_set(0)
except:
--- 66,110 ----
self.SetMethod("GOTFOCUS", None)
self.last_act = 1 # 1 = forward, 0 = backward
self.laststart = 0
! self.EDITABLE = 1
def Run(self, v1, v2, v3):
! Container = self.PARENT.Screen()
! if self.EDITABLE:
try:
curses.curs_set(1)
except:
pass
! if v1 :
! Depth = self.DEPTH
! offset = (v3 - self.X)
! textlen = len(self.TEXT)
! if Depth < self.W:
Depth = offset
else:
! Depth = Depth - (self.W- offset)
if Depth < 0:
Depth = 0
elif Depth > textlen:
Depth = textlen
! self.DEPTH = Depth
self.Paint(0,0,0)
while 1:
ch = Container.GetChar()
! if self.PARENT.BreakOrder(ch) :
try:
curses.curs_set(0)
except:
pass
return
! Depth = self.DEPTH
! Text = self.TEXT
global BACKWARDS
if ch in (Container.TokDownArrow, Container.TokNextField,
Container.TokActivate, Container.TokUpArrow):
! BACKWARDS = 0
if ch == Container.TokUpArrow:
! BACKWARDS = 1
! if self.ExecMethod( "VERIFY", self.TEXT, None, None) :
try:
curses.curs_set(0)
except:
***************
*** 130,136 ****
Depth = 0
Text = Text[0:Depth] + Text[Depth+1:len(Text)]
else:
! if ch <= 256 and self.GetProperty("EDITABLE") == tiTRUE:
if Depth == len(Text): # at end
Text = Text + chr(ch)
elif Depth == 0: # at the beginning
--- 130,136 ----
Depth = 0
Text = Text[0:Depth] + Text[Depth+1:len(Text)]
else:
! if ch <= 256 and self.EDITABLE:
if Depth == len(Text): # at end
Text = Text + chr(ch)
elif Depth == 0: # at the beginning
***************
*** 142,175 ****
Text = Text[:Depth] + chr(ch) + Text[Depth:]
Depth = Depth + 1
self.last_act = 1
! self.SetProperty("DEPTH", Depth)
! self.SetProperty("TEXT", Text)
self.Paint(None, None, None)
def BogusVerify(self, TheControl, TheText, v3):
! return tiTRUE
def Paint(self, v1, v2, v3):
! Container = self.GetProperty("PARENT").Screen()
! Text = self.GetProperty("TEXT")
TextLen = len(Text)
! W = self.GetProperty("W")
! Depth = self.GetProperty("DEPTH")
Visuals = ''
self.LoLight()
if TextLen <= W or Depth < W:
Visuals = Text + ((W - TextLen) * chr(tiHLINE))
if len(Visuals) > W:
Visuals = Visuals[:W-1] + ">"
! Container.PrintAt(self.GetProperty("Y"), self.GetProperty("X"), Visuals)
! Container.GotoYX(self.GetProperty( "Y"), self.GetProperty("X") + Depth)
else:
if Depth >= W:
Visuals = "<" + Text[Depth - (W - 1):] + (((W - 1) - TextLen) *
chr(tiHLINE))
if len(Visuals) > W:
Visuals = Visuals[:W]
! Container.PrintAt(self.GetProperty("Y"), self.GetProperty("X"),
Visuals)
! Container.GotoYX(self.GetProperty("Y"), self.GetProperty("X") + W)
def LostFocus(self, v1, v2, v3):
self.SetColor(1)
--- 142,175 ----
Text = Text[:Depth] + chr(ch) + Text[Depth:]
Depth = Depth + 1
self.last_act = 1
! self.DEPTH = Depth
! self.TEXT = Text
self.Paint(None, None, None)
def BogusVerify(self, TheControl, TheText, v3):
! return 1
def Paint(self, v1, v2, v3):
! Container = self.PARENT.Screen()
! Text = self.TEXT
TextLen = len(Text)
! W = self.W
! Depth = self.DEPTH
Visuals = ''
self.LoLight()
if TextLen <= W or Depth < W:
Visuals = Text + ((W - TextLen) * chr(tiHLINE))
if len(Visuals) > W:
Visuals = Visuals[:W-1] + ">"
! Container.PrintAt(self.Y, self.X, Visuals)
! Container.GotoYX(self.Y, self.X+ Depth)
else:
if Depth >= W:
Visuals = "<" + Text[Depth - (W - 1):] + (((W - 1) - TextLen) *
chr(tiHLINE))
if len(Visuals) > W:
Visuals = Visuals[:W]
! Container.PrintAt(self.Y, self.X, Visuals)
! Container.GotoYX(self.Y, self.X+ W)
def LostFocus(self, v1, v2, v3):
self.SetColor(1)
***************
*** 177,191 ****
def GotFocus(self, v1, v2, v3):
self.SetColor(3)
! Container = self.GetProperty("PARENT").Screen()
! Container.GotoYX(self.GetProperty("Y"), self.GetProperty("X") +
self.GetProperty("DEPTH"))
self.Paint(None, None, None)
def SetText(self, newText):
! self.SetProperty("TEXT",newText)
self.Paint(0,0,0)
def GetText(self):
! return self.GetProperty("TEXT")
--- 177,191 ----
def GotFocus(self, v1, v2, v3):
self.SetColor(3)
! Container = self.PARENT.Screen()
! Container.GotoYX(self.Y, self.X+ self.DEPTH)
self.Paint(None, None, None)
def SetText(self, newText):
! self.TEXT = newText
self.Paint(0,0,0)
def GetText(self):
! return self.TEXT
Index: gnue/common/src/cursing/VButton.py
diff -c gnue/common/src/cursing/VButton.py:1.1
gnue/common/src/cursing/VButton.py:1.2
*** gnue/common/src/cursing/VButton.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/VButton.py Wed Oct 9 23:04:41 2002
***************
*** 41,59 ****
"""
def __init__(self, Parent, ButtonName,Y,X,H,Caption,**properties):
apply(Button.__init__, (self, Parent, ButtonName, Y, X, H,
Caption),properties)
! self.SetProperty("W",1)
! self.SetProperty("H",H)
def Paint(self, HaveFocus, v2,v3):
! Container = self.GetProperty("PARENT").GetProperty("SCREEN")
if Container == None:
raise "Container is Nothing in def Paint!"
if HaveFocus:
self.HiLight()
else:
self.LoLight()
! tROW, tCOL = self.GetProperty("Y"), self.GetProperty("X")
! tCaption = self.GetProperty("CAPTION")
! tW = self.GetProperty("H")
tAW = tW - 2
if len(tCaption) > tAW:
tCaption = tCaption[: tAW]
--- 41,59 ----
"""
def __init__(self, Parent, ButtonName,Y,X,H,Caption,**properties):
apply(Button.__init__, (self, Parent, ButtonName, Y, X, H,
Caption),properties)
! self.W = 1
! self.H = H
def Paint(self, HaveFocus, v2,v3):
! Container = self.PARENT.SCREEN
if Container == None:
raise "Container is Nothing in def Paint!"
if HaveFocus:
self.HiLight()
else:
self.LoLight()
! tROW, tCOL = self.Y, self.X
! tCaption = self.CAPTION
! tW = self.H
tAW = tW - 2
if len(tCaption) > tAW:
tCaption = tCaption[: tAW]
Index: gnue/common/src/cursing/VScrollBar.py
diff -c gnue/common/src/cursing/VScrollBar.py:1.1
gnue/common/src/cursing/VScrollBar.py:1.2
*** gnue/common/src/cursing/VScrollBar.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/VScrollBar.py Wed Oct 9 23:04:41 2002
***************
*** 44,60 ****
"""
def __init__(self, Parent, SBName, Y, X, H, **properties):
apply(ScrollBar.__init__, (self, Parent, SBName, Y,X,1),properties)
! self.SetProperty("H",H)
! self.SetProperty("W",1)
! self.SetProperty("Y",Y)
! self.SetProperty("X",X)
self.__initButtons()
def __initButtons(self):
! Y = self.GetProperty("Y")
! X = self.GetProperty("X")
! H = self.GetProperty("H")
! Parent = self.GetProperty("PARENT")
self.rightarrow = VButton(Parent,'rightarrow',Y+H-6,X,3,'^')
self.rightarrow.SetMethod("CLICK",self._Dec)
Parent.AddControl(self.rightarrow)
--- 44,60 ----
"""
def __init__(self, Parent, SBName, Y, X, H, **properties):
apply(ScrollBar.__init__, (self, Parent, SBName, Y,X,1),properties)
! self.H = H
! self.W = 1
! self.Y = Y
! self.X = X
self.__initButtons()
def __initButtons(self):
! Y = self.Y
! X = self.X
! H = self.H
! Parent = self.PARENT
self.rightarrow = VButton(Parent,'rightarrow',Y+H-6,X,3,'^')
self.rightarrow.SetMethod("CLICK",self._Dec)
Parent.AddControl(self.rightarrow)
***************
*** 68,75 ****
def Init(self, Max):
self._max = Max
self._val = 0
! self.WorkingArea = float(self.GetProperty("H")-9)
! self.start = self.GetProperty("Y") + 3
self.UsedSpace = int(math.floor(self.WorkingArea / float(self._max)))
self.stepsize = self.WorkingArea / self._max
if self.UsedSpace < 1:
--- 68,75 ----
def Init(self, Max):
self._max = Max
self._val = 0
! self.WorkingArea = float(self.H-9)
! self.start = self.Y+ 3
self.UsedSpace = int(math.floor(self.WorkingArea / float(self._max)))
self.stepsize = self.WorkingArea / self._max
if self.UsedSpace < 1:
***************
*** 78,108 ****
def Paint(self,v1,v2,v3):
Pos = int(math.ceil(float(self._val) * (self.stepsize))) + self.start
! Screen = self.GetProperty("PARENT").Screen()
! Screen.AutoRefresh = tiFALSE
# clear the bar region in reverse standard-color
self.SetColor(1)
self.LoLight()
for i in range(0, int(self.WorkingArea)):
! Screen.PutAt( self.start + i,self.GetProperty("X"), ' ',
curses.A_REVERSE)
# correct position
if Pos >= (self.WorkingArea + self.start):
Pos = (self.start + self.WorkingArea)
elif Pos < (self.start + self.UsedSpace):
Pos = self.start + self.UsedSpace
# draw the handle in "menu"-hilight
! if self.GetProperty("FOCUS")==tiTRUE:
self.SetColor(3)
else:
self.SetColor(2)
self.LoLight()
for i in range(0, self.UsedSpace):
! Screen.PutAt((Pos - self.UsedSpace) + i,self.GetProperty("X"), ' ',
curses.A_REVERSE)
! Screen.AutoRefresh = tiTRUE
Screen.Refresh()
def _ChangePos(self,arg1,newY,arg3):
! Screen = self.GetProperty("PARENT").Screen()
Y = newY - self.start
Screen.PrintAt(0,0,'Y = ' + str(Y) + ' ' + str(self.WorkingArea))
if Y >= (self.WorkingArea-1):
--- 78,108 ----
def Paint(self,v1,v2,v3):
Pos = int(math.ceil(float(self._val) * (self.stepsize))) + self.start
! Screen = self.PARENT.Screen()
! Screen.AutoRefresh = 0
# clear the bar region in reverse standard-color
self.SetColor(1)
self.LoLight()
for i in range(0, int(self.WorkingArea)):
! Screen.PutAt( self.start + i,self.X, ' ', curses.A_REVERSE)
# correct position
if Pos >= (self.WorkingArea + self.start):
Pos = (self.start + self.WorkingArea)
elif Pos < (self.start + self.UsedSpace):
Pos = self.start + self.UsedSpace
# draw the handle in "menu"-hilight
! if self.FOCUS:
self.SetColor(3)
else:
self.SetColor(2)
self.LoLight()
for i in range(0, self.UsedSpace):
! Screen.PutAt((Pos - self.UsedSpace) + i,self.X, ' ', curses.A_REVERSE)
! Screen.AutoRefresh = 1
Screen.Refresh()
def _ChangePos(self,arg1,newY,arg3):
! Screen = self.PARENT.Screen()
Y = newY - self.start
Screen.PrintAt(0,0,'Y = ' + str(Y) + ' ' + str(self.WorkingArea))
if Y >= (self.WorkingArea-1):
***************
*** 114,120 ****
self._Action()
def __del__(self):
! Parent = self.GetProperty("PARENT")
Parent.DelControl(self.rightarrow)
Parent.DelControl(self.leftarrow)
Parent.DelControl(self.left2arrow)
--- 114,120 ----
self._Action()
def __del__(self):
! Parent = self.PARENT
Parent.DelControl(self.rightarrow)
Parent.DelControl(self.leftarrow)
Parent.DelControl(self.left2arrow)
Index: gnue/common/src/cursing/constants.py
diff -c gnue/common/src/cursing/constants.py:1.1
gnue/common/src/cursing/constants.py:1.2
*** gnue/common/src/cursing/constants.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/constants.py Wed Oct 9 23:04:41 2002
***************
*** 34,41 ****
# terminfo constants
- tiTRUE = -1
- tiFALSE = 0
colorLow = 1
colorHi = 2
--- 34,39 ----
***************
*** 64,69 ****
#
# direction of iteration through controls
global BACKWARDS
! BACKWARDS = tiFALSE
--- 62,67 ----
#
# direction of iteration through controls
global BACKWARDS
! BACKWARDS = 0
Index: gnue/common/src/cursing/sio.py
diff -c gnue/common/src/cursing/sio.py:1.1 gnue/common/src/cursing/sio.py:1.2
*** gnue/common/src/cursing/sio.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/sio.py Wed Oct 9 23:04:41 2002
***************
*** 48,54 ****
"""
def __init__(self):
! self.Started = tiFALSE
self.MAXCOL = -1
self.MAXROW = -1
--- 48,54 ----
"""
def __init__(self):
! self.Started = 0
self.MAXCOL = -1
self.MAXROW = -1
***************
*** 129,136 ****
if events == 0:
self.PrintAt(self.MAXROW, self.MAXCOL-8, 'SCHEISSE: no mouse.')
! self.AutoRefresh = tiTRUE
! self.Started = tiTRUE
self.PrintMods = 0
return(self.s)
--- 129,136 ----
if events == 0:
self.PrintAt(self.MAXROW, self.MAXCOL-8, 'SCHEISSE: no mouse.')
! self.AutoRefresh = 1
! self.Started = 1
self.PrintMods = 0
return(self.s)
***************
*** 168,181 ****
if scrnbuff == {}:
return
! self.AutoRefresh = tiFALSE
self.LoLight()
for rows in range(r1, r2):
for cols in range(c1, c2):
self.PutAt(rows,cols, scrnbuff[str(rows)+"X"+str(cols)])
! self.AutoRefresh = tiTRUE
self.Refresh()
--- 168,181 ----
if scrnbuff == {}:
return
! self.AutoRefresh = 0
self.LoLight()
for rows in range(r1, r2):
for cols in range(c1, c2):
self.PutAt(rows,cols, scrnbuff[str(rows)+"X"+str(cols)])
! self.AutoRefresh = 1
self.Refresh()
***************
*** 237,243 ****
# will suffice?
#print "Row: %s, Col: %s" % (Row, Col)
self.s.move( Row, Col)
! if self.AutoRefresh == tiTRUE:
self.s.refresh()
--- 237,243 ----
# will suffice?
#print "Row: %s, Col: %s" % (Row, Col)
self.s.move( Row, Col)
! if self.AutoRefresh :
self.s.refresh()
***************
*** 249,255 ****
PrevMod |= Mods
refreshState = self.AutoRefresh
! self.AutoRefresh = tiFALSE
for i in range(0,len(String)):
if ti_chars.has_key(ord(String[i])):
--- 249,255 ----
PrevMod |= Mods
refreshState = self.AutoRefresh
! self.AutoRefresh = 0
for i in range(0,len(String)):
if ti_chars.has_key(ord(String[i])):
***************
*** 260,266 ****
self.AutoRefresh = refreshState
! if self.AutoRefresh == tiTRUE:
self.s.refresh()
--- 260,266 ----
self.AutoRefresh = refreshState
! if self.AutoRefresh :
self.s.refresh()
***************
*** 315,325 ****
def Cls(self):
"""
"""
! self.AutoRefresh = tiFALSE
for row in range(0, self.MAXROW+1):
self.PrintAt(row, 0, " " * self.MAXCOL)
self.SetColor(1)
! self.AutoRefresh = tiTRUE
def Refresh(self):
--- 315,325 ----
def Cls(self):
"""
"""
! self.AutoRefresh = 0
for row in range(0, self.MAXROW+1):
self.PrintAt(row, 0, " " * self.MAXCOL)
self.SetColor(1)
! self.AutoRefresh = 1
def Refresh(self):
Index: gnue/common/src/cursing/utility.py
diff -c gnue/common/src/cursing/utility.py:1.1
gnue/common/src/cursing/utility.py:1.2
*** gnue/common/src/cursing/utility.py:1.1 Wed Oct 9 22:44:22 2002
--- gnue/common/src/cursing/utility.py Wed Oct 9 23:04:41 2002
***************
*** 34,51 ****
from constants import *
! def _paintBorder(dialog, Y, X, H, W, integrateUpper = tiFALSE):
""" draw a border with curses_graphics
"""
! Screen = dialog.GetProperty("SCREEN")
dialog.LoLight()
! dialog.AutoRefresh = tiFALSE
upperRC = tiURC
upperLC = tiULC
! if integrateUpper == tiTRUE:
upperRC = tiUTEE
upperLC = tiUTEE
--- 34,51 ----
from constants import *
! def _paintBorder(dialog, Y, X, H, W, integrateUpper = 0):
""" draw a border with curses_graphics
"""
! Screen = dialog.SCREEN
dialog.LoLight()
! dialog.AutoRefresh = 0
upperRC = tiURC
upperLC = tiULC
! if integrateUpper :
upperRC = tiUTEE
upperLC = tiUTEE
***************
*** 61,68 ****
# add title-text ?
if dialog.HasProperty("TITLETEXT"):
! Screen.PrintAt( Y, X + 2, ' ' + dialog.GetProperty("TITLETEXT") + ' ')
! dialog.AutoRefresh = tiTRUE
--- 61,68 ----
# add title-text ?
if dialog.HasProperty("TITLETEXT"):
! Screen.PrintAt( Y, X + 2, ' ' + dialog.TITLETEXT+ ' ')
! dialog.AutoRefresh = 1