[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5732 - in trunk/gnue-common: doc/technotes src/cursing src/cursing/test
From: |
jcater |
Subject: |
r5732 - in trunk/gnue-common: doc/technotes src/cursing src/cursing/tests src/logic src/logic/adapters |
Date: |
Fri, 16 Apr 2004 18:38:33 -0500 (CDT) |
Author: jcater
Date: 2004-04-16 18:38:32 -0500 (Fri, 16 Apr 2004)
New Revision: 5732
Added:
trunk/gnue-common/doc/technotes/00013.txt
trunk/gnue-common/src/cursing/Container.py
Removed:
trunk/gnue-common/src/cursing/ScreenContainer.py
Modified:
trunk/gnue-common/src/cursing/Button.py
trunk/gnue-common/src/cursing/ComboBox.py
trunk/gnue-common/src/cursing/Control.py
trunk/gnue-common/src/cursing/Dialog.py
trunk/gnue-common/src/cursing/FileSelectPad.py
trunk/gnue-common/src/cursing/FocusedLabel.py
trunk/gnue-common/src/cursing/Frame.py
trunk/gnue-common/src/cursing/GraphicObject.py
trunk/gnue-common/src/cursing/GroupBox.py
trunk/gnue-common/src/cursing/InputBox.py
trunk/gnue-common/src/cursing/Label.py
trunk/gnue-common/src/cursing/Menu.py
trunk/gnue-common/src/cursing/MenuBar.py
trunk/gnue-common/src/cursing/MenuItem.py
trunk/gnue-common/src/cursing/Notebook.py
trunk/gnue-common/src/cursing/Progress.py
trunk/gnue-common/src/cursing/ScrollBar.py
trunk/gnue-common/src/cursing/StatusBar.py
trunk/gnue-common/src/cursing/TextArea.py
trunk/gnue-common/src/cursing/TextBox.py
trunk/gnue-common/src/cursing/VButton.py
trunk/gnue-common/src/cursing/VScrollBar.py
trunk/gnue-common/src/cursing/__init__.py
trunk/gnue-common/src/cursing/sio.py
trunk/gnue-common/src/cursing/tests/demo.py
trunk/gnue-common/src/logic/adapters/python.py
trunk/gnue-common/src/logic/language.py
Log:
Committing some old curses stuff to get out of way until I can work on again
Added: trunk/gnue-common/doc/technotes/00013.txt
===================================================================
--- trunk/gnue-common/doc/technotes/00013.txt 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/doc/technotes/00013.txt 2004-04-16 23:38:32 UTC (rev
5732)
@@ -0,0 +1,19 @@
+Title: Programmatic overview of curses module
+Status: Current
+
+
+
+
+
+ GraphicObject
+ - Container
+ - Frame
+ - Dialog
+ - MenuBar
+ - Application
+ - Control
+ - TextBox
+ - Label
+ - (etc)
+
+
Modified: trunk/gnue-common/src/cursing/Button.py
===================================================================
--- trunk/gnue-common/src/cursing/Button.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/Button.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -103,7 +103,7 @@
color = self.FOCUSCOLOR
else:
color = self.COLOR
- tROW, tCOL = self._ABSY, self._ABSX
+ tROW, tCOL = self.Y, self.X
tCaption = self.CAPTION
tW = self.W
tAW = tW - 2
Modified: trunk/gnue-common/src/cursing/ComboBox.py
===================================================================
--- trunk/gnue-common/src/cursing/ComboBox.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/ComboBox.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -63,8 +63,8 @@
# Screen = self.PARENT.Screen()
# Screen.AutoRefresh = 0
# self.SetColor(1)
-# X = self._ABSX
-# Y = self._ABSY
+# X = self.X
+# Y = self.Y
# W = self.W
## Screen.PrintAt(Y,X,chr(tiVLINE))
## Screen.PrintAt(Y,X+W-1,chr(tiVLINE))
Copied: trunk/gnue-common/src/cursing/Container.py (from rev 5572,
trunk/gnue-common/src/cursing/ScreenContainer.py)
===================================================================
--- trunk/gnue-common/src/cursing/ScreenContainer.py 2004-03-29 23:11:33 UTC
(rev 5572)
+++ trunk/gnue-common/src/cursing/Container.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -0,0 +1,147 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2002-2004 Free Software Foundation
+#
+# FILE:
+# Container.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+
+import math
+import curses
+##try:
+## from curses import panel
+##except ImportError:
+## raise "The use of curses requires at least Python 2.1"
+
+from constants import *
+import sio
+from utility import _paintBorder
+from GraphicObject import GraphicObject
+
+class Container(GraphicObject):
+ """
+ Screen Container
+ """
+
+ def __init__(self, **properties):
+ """
+ Zero Controls list and Metrics dictionary. Chainload GraphicObject
+ parent class. Event initialization.
+ """
+ SIOInstance = sio.sio()
+
+ self.Controls = [] # Stack of control objects
+ self.Panels = []
+ self.Metrics = {} # ditionary of dimensions, keyed by control obj
+ self.VISIBLE = 1
+
+ GraphicObject.__init__(self, SIOInstance, **properties)
+
+ self.STARTPOINT = 0
+ self.breakUp = 0
+ self.SetColor(SIOInstance.colors.C_BACKGROUND)
+ self.nextCtl = None
+ self.eventX = -1
+ self.eventY = -1
+ self._CurrentFocus = None
+ self._CurrentFrame = self
+ self.R1 = 0
+ self.C1 = 0
+ self._ChildOffsetX = 0
+ self._ChildOffsetY = 0
+
+
+ def SetProperty(self, PropertyName, PropertyValue):
+ """
+ """
+ GraphicObject.SetProperty(self, PropertyName, PropertyValue)
+ if self.IsPropertyInherited(PropertyName):
+ for i in xrange(0, len(self.Controls)):
+ self.Controls[i].SetProperty(PropertyName, PropertyValue)
+
+ def AddPanel(self, panel):
+ self.Panels.append(panel)
+
+ def AddControl(self, control):
+ """
+ Add a control to the screen container. Control object is 'setup' and
+ appened to the Controls list, ABSOLUTE corners are registered in a
+ 4 member tuple (Y,X,H,W) in Metrics, keyed by control name.
+ """
+
+ control.InheritProperties(self)
+ self.Controls.append(control)
+ self.Metrics[control] = (
+ control.Y, control.X,
+ control.Y+ control.H,
+ control.X+ control.W)
+
+ return control
+
+ def DelControl(self,control = None):
+ """Delete a control from the Control stack, and it's dimension
+ properties from the Metrics dict."""
+ if self.Controls.count(control) != 0:
+ del self.Metrics[control]
+ self.Controls.remove(control)
+
+ def Screen(self):
+ """Return SCREEN to caller."""
+ return self.SCREEN
+
+ def Paint(self, captureRefresh = 1):
+ """
+ Paint EVERY Control registered in this Container
+ instance. Effectively repainting the entire container iteratively.
+ """
+ if not self.VISIBLE:
+ return
+
+ if captureRefresh:
+ self.SCREEN.AutoRefresh = 0
+
+ for Control in self.Controls:
+ Control.ExecMethod("SYSPAINT", None, None, None)
+
+ if captureRefresh:
+ 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
+
+
+ def printAt(x, y, text):
+
+
+ def __PaintBorder(self, caption=None):
+ DialogWidth = self.Width()
+ DialogHeight = self.Height()
+ _paintBorder( self, 0,0, DialogHeight, DialogWidth, caption=caption)
+
Modified: trunk/gnue-common/src/cursing/Control.py
===================================================================
--- trunk/gnue-common/src/cursing/Control.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/Control.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -31,23 +31,30 @@
from GraphicObject import GraphicObject
class Control(GraphicObject):
- def __init__(self, Parent, CName, **properties):
+ VISIBLE = True
+ CANGETFOCUS=True
+ FOCUS=False
+ NAME=""
+ Methods = {}
+
+ def __init__(self, Parent, x, y, w=1, h=1, **properties):
GraphicObject.__init__(self, Parent.SCREEN, **properties)
- self.NAME = CName
self.SetColor('DIALOG','BACKGROUND')
- self.X = -1
- self.Y = -1
- self.VISIBLE = 1
- self.FOCUS = 0
- self.CANGETFOCUS = 1
+ self.X = x
+ self.Y = y
+ self.H = h
+ self.W = w
+
self.PARENT = Parent
- self.Methods = {}
self.Methods["CLICK"] = None
self.Methods["PAINT"] = None
self.Methods["GOTFOCUS"] = None
self.Methods["LOSTFOCUS"] = None
self.Methods["ACTION"] = None
+ Parent.AddControl(self)
+
+
## def DetermineAndSetColor(self, HasFocus):
## if self.active:
## if HasFocus :
Modified: trunk/gnue-common/src/cursing/Dialog.py
===================================================================
--- trunk/gnue-common/src/cursing/Dialog.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/Dialog.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -35,9 +35,9 @@
from constants import *
import sio
from utility import _paintBorder
-from ScreenContainer import ScreenContainer
+from Container import Container
-class Dialog(ScreenContainer):
+class Dialog(Container):
"""
like a full screen container, but only a smaller portion of it.
the user defines a screen region which makes up the dialog...
@@ -46,7 +46,7 @@
def __init__(self, ParentContainer, r1=0, c1=0, r2=0, c2=0, caption="",
border=1, dropshadow=1, **properties):
SIOInstance = ParentContainer.Screen()
- ScreenContainer.__init__(self, SIOInstance,**properties)
+ Container.__init__(self, SIOInstance,**properties)
self.PARENT = ParentContainer
self.scrnbuff = {}
self.Controls = []
@@ -65,13 +65,13 @@
# need to add some sanity checks for bad params here:
#if r1 > 0 and r1 <= SIOInstance.MAXROW:
- self._Y = r1
+ self.Y = r1
#else:
- # self._Y = 0
+ # self.Y = 0
#if c1 > 0 and c1 <= SIOInstance.MAXCOL:
- self._X = c1
+ self.X = c1
#else:
- # self._X = 0
+ # self.X = 0
self._DialogWidth = c2 - c1
self._DialogHeight = r2 - r1
@@ -91,7 +91,7 @@
if not self.BORDER:
return
- _paintBorder( self, self._Y,self._X, self._DialogHeight + 2,
+ _paintBorder( self, self.Y,self.X, self._DialogHeight + 2,
self._DialogWidth + 2, self.INSET, caption=self.CAPTION,
color = self.COLOR,
captionColor=self.SCREEN.colors.C_DIALOG_TITLE)
@@ -109,7 +109,7 @@
self._PaintBorder()
self._PaintDropShadow()
t = self.Run()
- self.Screen().RestoreScreen(self._Y,self._X,
+ self.Screen().RestoreScreen(self.Y,self.X,
self.R2 + self.DROPSHADOW + self.BORDER*2,
self.C2 + self.DROPSHADOW + self.BORDER*2,
self.buffer)
@@ -118,9 +118,9 @@
return t
def Height(self):
- return self.R2- self._Y
+ return self.R2- self.Y
def Width(self):
- return self.C2- self._X
+ return self.C2- self.X
Modified: trunk/gnue-common/src/cursing/FileSelectPad.py
===================================================================
--- trunk/gnue-common/src/cursing/FileSelectPad.py 2004-04-16 23:12:41 UTC
(rev 5731)
+++ trunk/gnue-common/src/cursing/FileSelectPad.py 2004-04-16 23:38:32 UTC
(rev 5732)
@@ -49,8 +49,8 @@
self.H = H
self.W = W
self.PARENT = Root
- self._X = self.X
- self._Y = self.Y
+ self.X = self.X
+ self.Y = self.Y
self._W = self.W
self._H = self.H
self.MYROOT = Root
@@ -134,8 +134,8 @@
self.Paint(0,0,0)
def GotFocus(self,v1,v2,v3):
- self._X = self.X
- self._Y = self.Y
+ self.X = self.X
+ self.Y = self.Y
self._W = self.W
self._H = self.H
self.FOCUS = 1
@@ -258,8 +258,8 @@
self.yoffset = (self.hilit-1) % rows
newXoffset = ((self.hilit-1) / rows ) * colwidth
self.xoffset = newXoffset
- self.pad.refresh(0, self.xoffset,self._ABSY,self._ABSX,
- self._ABSY + self._H,self._ABSX + self._W)
+ 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
Modified: trunk/gnue-common/src/cursing/FocusedLabel.py
===================================================================
--- trunk/gnue-common/src/cursing/FocusedLabel.py 2004-04-16 23:12:41 UTC
(rev 5731)
+++ trunk/gnue-common/src/cursing/FocusedLabel.py 2004-04-16 23:38:32 UTC
(rev 5732)
@@ -79,8 +79,8 @@
color = self.COLOR
else:
color = self.COLOR
- Y = self._ABSY
- X = self._ABSX
+ Y = self.Y
+ X = self.X
caption = self.CAPTION
Container.PrintAt(Y,X,caption, color)
Modified: trunk/gnue-common/src/cursing/Frame.py
===================================================================
--- trunk/gnue-common/src/cursing/Frame.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/Frame.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -30,18 +30,19 @@
from constants import *
import sio
from utility import _paintBorder
-from ScreenContainer import ScreenContainer
+from Container import Container
-class Frame(ScreenContainer):
+class Frame(Container):
"""
like a full screen container, but only a smaller portion of it.
the user defines a screen region which makes up the frame...
they may only put controls within this region.
"""
- def __init__(self, ParentContainer, r1=0, c1=0, r2=0, c2=0, caption="",
+ def __init__(self, ParentContainer, y=0, x=0, h=2, w=2, caption="",
border=1, dropshadow=1, **properties):
- SIOInstance = ParentContainer.Screen()
- ScreenContainer.__init__(self, SIOInstance, **properties)
+ SIOInstance = sio.sio()
+
+ Container.__init__(self, **properties)
self.PARENT = ParentContainer
self.PARENT.AddFrame(self)
self.VISIBLE = 0
@@ -51,10 +52,10 @@
self.STARTPOINT = 0
self.DIALOGWINDOW = None
self.CAPTION = caption
- self.R1 = r1
- self.R2 = r2
- self.C1 = c1
- self.C2 = c2
+ self.R1 = r1 = y
+ self.R2 = r2 = y + h - 1
+ self.C1 = c1 = x
+ self.C2 = c2 = x + w - 1
self._ChildOffsetX = border
self._ChildOffsetY = border
self.DROPSHADOW = dropshadow
@@ -62,13 +63,13 @@
# need to add some sanity checks for bad params here:
#if r1 > 0 and r1 <= SIOInstance.MAXROW:
- self._Y = r1
+ self.Y = r1
#else:
- # self._Y = 0
+ # self.Y = 0
#if c1 > 0 and c1 <= SIOInstance.MAXCOL:
- self._X = c1
+ self.X = c1
#else:
- # self._X = 0
+ # self.X = 0
self._DialogWidth = c2 - c1
self._DialogHeight = r2 - r1
@@ -92,7 +93,7 @@
if not self.BORDER:
return
- _paintBorder( self, self._Y,self._X, self._DialogHeight + 2,
+ _paintBorder( self, self.Y,self.X, self._DialogHeight + 2,
self._DialogWidth + 2, self.INSET, caption=self.CAPTION,
color=self.SCREEN.colors.C_DIALOG,
captionColor=self.SCREEN.colors.C_DIALOG_TITLE)
@@ -117,14 +118,14 @@
gDebug(0,'PAINTING %s' % self)
for l in range(self._DialogHeight):
- self.SCREEN.PrintAt(self._Y+l, self._X, " " * self._DialogWidth,
self.COLOR)
+ self.SCREEN.PrintAt(self.Y+l, self.X, " " * self._DialogWidth,
self.COLOR)
self._PaintDropShadow()
- ScreenContainer.Paint(self,*args, **parms)
+ Container.Paint(self,*args, **parms)
def Height(self):
- return self.R2- self._Y
+ return self.R2- self.Y
def Width(self):
- return self.C2- self._X
+ return self.C2- self.X
Modified: trunk/gnue-common/src/cursing/GraphicObject.py
===================================================================
--- trunk/gnue-common/src/cursing/GraphicObject.py 2004-04-16 23:12:41 UTC
(rev 5731)
+++ trunk/gnue-common/src/cursing/GraphicObject.py 2004-04-16 23:38:32 UTC
(rev 5732)
@@ -33,7 +33,7 @@
class GraphicObject:
"""
- GraphicObject is the base class for ScreenContainer: the full screen
+ GraphicObject is the base class for Container: the full screen
container, as well as for Control: the base class for all of the on-
screen controls.
Modified: trunk/gnue-common/src/cursing/GroupBox.py
===================================================================
--- trunk/gnue-common/src/cursing/GroupBox.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/GroupBox.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -46,8 +46,8 @@
self.SetMethod("SYSPAINT", self.Paint)
def Paint(self,v1,v2,v3):
- Y = self._ABSY
- X = self._ABSX
+ Y = self.Y
+ X = self.X
H = self.H
W = self.W
_paintBorder(self, Y, X, H, W, caption = self.CAPTION, color=self.COLOR)
Modified: trunk/gnue-common/src/cursing/InputBox.py
===================================================================
--- trunk/gnue-common/src/cursing/InputBox.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/InputBox.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -56,7 +56,7 @@
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)
Modified: trunk/gnue-common/src/cursing/Label.py
===================================================================
--- trunk/gnue-common/src/cursing/Label.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/Label.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -32,6 +32,7 @@
from string import split
from Control import Control
import sio
+import curses
class Label(Control):
"""
@@ -40,18 +41,16 @@
update events and the user can't interact with it.
"""
- def __init__(self, Parent, LabelName, Y, X, Caption, Width=0,
- **properties):
- Control.__init__(self, Parent, LabelName, **properties)
+ CANGETFOCUS = False
+ CLASS="LABEL"
+
+ def __init__(self, Parent, Caption, x, y, width=0, **properties):
+ Control.__init__(self, Parent, x, y, width or len(Caption), 1,
**properties)
self.PadHeight = 2 # pad the height by this much if multiline
self.PARENT = Parent
- self.X = X
- self.Y = Y
- self.W = Width
- self.CLASS = "LABEL"
self.CAPTION = Caption
- self.CANGETFOCUS = 0
+
self.SetMethod("SYSPAINT", self.Paint)
self.SetMethod("SYSGOTFOCUS", None)
self.SetMethod("SYSLOSTFOCUS", None)
@@ -59,6 +58,7 @@
self.SetColor('LABEL')
self.SetText(Caption)
+
def SetText (self, Caption):
# for more carefully formatted output
if self.W == 0:
@@ -94,8 +94,8 @@
if Container == None:
raise "No container--can't paint!"
self.LoLight()
- Y = self._ABSY
- X = self._ABSX
+ Y = self.Y
+ X = self.X
caption = self.CAPTION
Container.PrintAt(Y,X,caption, self.COLOR)
Modified: trunk/gnue-common/src/cursing/Menu.py
===================================================================
--- trunk/gnue-common/src/cursing/Menu.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/Menu.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -31,7 +31,7 @@
from FocusedLabel import FocusedLabel
from Dialog import Dialog
from MenuItem import MenuItem
-from ScreenContainer import *
+from Container import *
import sio
class Menu(FocusedLabel):
@@ -73,7 +73,7 @@
self.ExecMethod("CLICK", self, None, None)
if self.EXITFORM:
self.PARENT.Paint()
- if self.PARENT.__class__ != ScreenContainer:
+ if self.PARENT.__class__ != Container:
self.PARENT.Refresh(None,None,None)
return 1
self.ExecMethod("SYSGOTFOCUS", None, None, None)
Modified: trunk/gnue-common/src/cursing/MenuBar.py
===================================================================
--- trunk/gnue-common/src/cursing/MenuBar.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/MenuBar.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -73,8 +73,8 @@
# def Paint(self, *args, **parms):
# Container = self.PARENT.Screen()
# color = self.COLOR
-# #Y = self._ABSY
-# #X = self._ABSX
+# #Y = self.Y
+# #X = self.X
# Y = self.Y
# X = self.X
# caption = self.CAPTION
Modified: trunk/gnue-common/src/cursing/MenuItem.py
===================================================================
--- trunk/gnue-common/src/cursing/MenuItem.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/MenuItem.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -79,8 +79,8 @@
# color = self.COLOR
# else:
# color = self.COLOR
-# Y = self._ABSY
-# X = self._ABSX
+# Y = self.Y
+# X = self.X
# caption = self.CAPTION
# Container.PrintAt(Y,X,caption, color)
Modified: trunk/gnue-common/src/cursing/Notebook.py
===================================================================
--- trunk/gnue-common/src/cursing/Notebook.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/Notebook.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -42,7 +42,7 @@
**properties):
SIOInstance = ParentContainer.Screen()
Frame.__init__(ParentContainer, r1, c1, r2, c2, border=1, dropshadow=0)
- ScreenContainer.__init__(self, SIOInstance, **properties)
+ Container.__init__(self, SIOInstance, **properties)
self._ChildOffsetY += 2
def __del__(self):
@@ -54,7 +54,7 @@
def _PaintBorder(self):
self.LoLight()
- _paintBorder( self, self._Y+2, self._X, self._DialogHeight + 2,
+ _paintBorder( self, self.Y+2, self.X, self._DialogHeight + 2,
self._DialogWidth + 2, self.INSET, caption=self.CAPTION,
captionColor=sio.C_DIALOG_TITLE)
@@ -120,7 +120,7 @@
self.ExecMethod("CLICK", self, None, None)
if self.EXITFORM:
self.PARENT.Paint()
- if self.PARENT.__class__ != ScreenContainer:
+ if self.PARENT.__class__ != Container:
self.PARENT.Refresh(None,None,None)
return 1
self.ExecMethod("SYSGOTFOCUS", None, None, None)
Modified: trunk/gnue-common/src/cursing/Progress.py
===================================================================
--- trunk/gnue-common/src/cursing/Progress.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/Progress.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -72,12 +72,12 @@
# if amount marked up is less than the working area
if MarkedSpace <= self.WorkingArea:
Screen.AutoRefresh = 0
- Screen.PrintAt(self._ABSY, self._ABSX, "[ ")
- Screen.PrintAt(self._ABSY,
- self._ABSX+ self.W- 2, " ]")
+ Screen.PrintAt(self.Y, self.X, "[ ")
+ Screen.PrintAt(self.Y,
+ self.X+ self.W- 2, " ]")
for i in range(0, MarkedSpace):
- Screen.PutAt(self._ABSY,
- self._ABSX+ 2 + i, ' ', curses.A_STANDOUT)
+ Screen.PutAt(self.Y,
+ self.X+ 2 + i, ' ', curses.A_STANDOUT)
Screen.AutoRefresh = 1
Screen.Refresh()
Deleted: trunk/gnue-common/src/cursing/ScreenContainer.py
===================================================================
--- trunk/gnue-common/src/cursing/ScreenContainer.py 2004-04-16 23:12:41 UTC
(rev 5731)
+++ trunk/gnue-common/src/cursing/ScreenContainer.py 2004-04-16 23:38:32 UTC
(rev 5732)
@@ -1,391 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2002-2004 Free Software Foundation
-#
-# FILE:
-# ScreenContainer.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-
-import math
-import curses
-##try:
-## from curses import panel
-##except ImportError:
-## raise "The use of curses requires at least Python 2.1"
-
-from constants import *
-import sio
-from utility import _paintBorder
-from GraphicObject import GraphicObject
-Frame = None
-
-class ScreenContainer(GraphicObject):
- """
- full screen container -- allows the user to place controls on the
- entire screen
- """
-
- def __init__(self, SIOInstance, **properties):
- """
- Zero Controls list and Metrics dictionary. Chainload GraphicObject
- parent class. Event initialization.
- """
-
- # Nasty, nasty, nasty, nasty... to avoid a recursive import
- global Frame
- if not Frame:
- from Frame import Frame
-
- self.Controls = [] # Stack of control objects
- self.Frames = [] # Stack of child frames
- self.FrameStackOrder = [] # The display/stack order of frames
- self.Panels = []
- self.Metrics = {} # ditionary of dimensions, keyed by control obj
- self.VISIBLE = 1
-
- GraphicObject.__init__(self, SIOInstance, **properties)
-
- self.STARTPOINT = 0
- self.breakUp = 0
- self.SetColor(SIOInstance.colors.C_BACKGROUND)
- self.nextCtl = None
- self.eventX = -1
- self.eventY = -1
- self._CurrentFocus = None
- self._CurrentFrame = self
- self.R1 = 0
- self.C1 = 0
- self._ChildOffsetX = 0
- self._ChildOffsetY = 0
-
-
- def SetProperty(self, PropertyName, PropertyValue):
- """
- """
- GraphicObject.SetProperty(self, PropertyName, PropertyValue)
- if self.IsPropertyInherited(PropertyName):
- for i in xrange(0, len(self.Controls)):
- self.Controls[i].SetProperty(PropertyName, PropertyValue)
-
- def AddPanel(self, panel):
- self.Panels.append(panel)
-
- def AddFrame(self, frame):
- self.Frames.append(frame)
- self.FrameStackOrder.insert(0,frame)
- frame.InheritProperties(self)
-
- def DelFrame(self, frame):
- self.Frames.pop(self.Frames.index(frame))
- self.FrameStackOrder.pop(self.FrameStackOrder.index(frame))
- for child in frame.Controls:
- del self.Metrics[child]
-
- def RaiseFrame(self, frame):
- self._CurrentFocus = None
- self._CurrentFrame = frame
- frame.VISIBLE = 1
- self.FrameStackOrder.pop(self.Frames.index(frame))
- self.FrameStackOrder.insert(0,frame)
- frame.Paint()
-
- def AddControl(self, control):
- """
- Add a control to the screen container. Control object is 'setup' and
- appened to the Controls list, ABSOLUTE corners are registered in a
- 4 member tuple (Y,X,H,W) in Metrics, keyed by control name.
- """
-
- control._ABSY = control.Y + self.R1 + self._ChildOffsetY
- control._ABSX = control.X + self.C1 + self._ChildOffsetX
-
- control.InheritProperties(self)
- self.Controls.append(control)
- self.Metrics[control] = (
- control._ABSY, control._ABSX,
- control._ABSY+ control.H,
- control._ABSX+ control.W)
-
- return control
-
- def DelControl(self,control = None):
- """Delete a control from the Control stack, and it's dimension
- properties from the Metrics dict."""
- if self.Controls.count(control) != 0:
- del self.Metrics[control]
- self.Controls.remove(control)
-
- def Screen(self):
- """Return SCREEN to caller."""
- return self.SCREEN
-
- def Paint(self, captureRefresh = 1):
- """
- Paint EVERY Control registered in this ScreenContainer
- instance. Effectively repainting the entire container iteratively.
- """
- if not self.VISIBLE:
- return
-
- if captureRefresh:
- self.SCREEN.AutoRefresh = 0
-
- for Control in self.Controls:
- Control.ExecMethod("SYSPAINT", None, None, None)
- for frame in self.FrameStackOrder:
- frame.Paint(0)
-
- if captureRefresh:
- 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
-
- def Height(self):
- """Return the actual _count_ size of the height."""
- return self.SCREEN.MAXROW + 1
-
- def Width(self):
- """Return the actual _count_ size of the width."""
- return self.SCREEN.MAXCOL + 1
-
- def Run(self):
- self.Paint()
-
- # myControlStackIndex
- myCsi = self.STARTPOINT
- # Sanity check the Csi
- if myCsi == None:
- myCsi = 0
-
- gDebug(0, 'I am a running fewl; s/I/%s/' % self)
- gDebug(0, self._CurrentFrame)
- gDebug(0, self.Controls)
-
- # 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
- # zero on exception.
- try:
- myCtl = self._CurrentFrame.Controls[myCsi]
- except:
- myCsi = 0
- try:
- myCtl = self._CurrentFrame.Controls[myCsi]
- except:
- print "WARNING: No widgets!!"
- return
-
- # if nextControl is not at the initial state: ie. in the "loaded"
- # state:
- if self.nextCtl != None:
- # get and set the next desired ControlStackIndex based on
- # the next queued up control
- myCsi = self._CurrentFrame.Controls.index(self.nextCtl)
- # reassign myCtl control to the next desired.
- myCtl = self.nextCtl
- # 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:
- self._CurrentFocus = myCtl
- # call system level gotfocus
- myCtl.ExecMethod("SYSGOTFOCUS", None, None, None)
- # If a custom GOTFOCUS method has been assigned,
- # has the user supply a Got Focus routine?
- UserGotFocus = myCtl.GetMethod("GOTFOCUS")
-
- # call user level gotfocus method
- if UserGotFocus <> None:
- # if it's alright to get focus, do so
- 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?!
- myCtl.ExecMethod("SYSLOSTFOCUS", None, None, None)
- UserLostFocus = myCtl.GetMethod("LOSTFOCUS")
-
- if UserLostFocus <> None:
- if UserLostFocus(myCtl, None, None):
- myCsi = self.__GetNextActiveCtlIndex(myCsi)
- else:
- myCsi = self.__GetNextActiveCtlIndex(myCsi)
-
- # if the Control is 'active', BUT can't get focus:
- else:
- myCsi = self.__GetNextActiveCtlIndex(myCsi)
-
- activate = 0
-
-
-
- def SetFocus(self, myCtl, activate=1, run=1):
-
- if self._CurrentFocus:
- if not self._LoseFocus(self._CurrentFocus):
- return None
-
- self._CurrentFocus = myCtl
-
- myCtl.ExecMethod("SYSGOTFOCUS", None, None, None)
- # If a custom GOTFOCUS method has been assigned,
- # has the user supply a Got Focus routine?
- UserGotFocus = myCtl.GetMethod("GOTFOCUS")
-
- if run:
- # call user level gotfocus method
- if UserGotFocus <> None:
- # if it's alright to get focus, do so
- if UserGotFocus(myCtl, None, None):
- # do system level run
- if myCtl.ExecMethod( "SYSRUN", activate,
- self.eventY, self.eventX) :
- return 0
-
- else:
- # otherwise, _just_ do system level run
- if myCtl.ExecMethod("SYSRUN", activate,
- self.eventY, self.eventX) :
- return 0
-
-
- def _LoseFocus(self, myCtl):
-
- myCtl.ExecMethod("SYSLOSTFOCUS", None, None, None)
- UserLostFocus = myCtl.GetMethod("LOSTFOCUS")
-
- if UserLostFocus <> None:
- if UserLostFocus(myCtl, None, None):
- return 1
- else:
- return 0
-
- # if the Control is 'active', BUT can't get focus:
- else:
- return 1
-
-
-
- def BreakOrder(self, Char):
- """
- BreakOrder checks user event input for mouse events. If mouse
- event, the item clicked on is checked for activity, the click
- coordinates are placed in self.eventX and Y, AND nextCtl is set to
- the clicked on item. Otherwise returns TermInfo False."""
-
- if Char == curses.KEY_MOUSE:
- event = curses.getmouse()
- if event[4] & curses.BUTTON1_CLICKED:
- item = self.GetControlAt(event[2],event[1])
- if isinstance(item, Frame):
- item = Frame.Controls
-
- if item != None and item.active :
- self.eventY = event[2]
- self.eventX = event[1]
- self.nextCtl = item
- return 1
- return 0
-
-
- def KeystrokeHook(self, Char):
- return Char
-
-
-#
-# private functions
-#
-
- def __GetNextActiveCtlIndex(self, active):
- step = BACKWARDS and -1 or 1
- limit = len(self._CurrentFrame.Controls)
- if active < 0 or active >= limit:
- return None
- i = 0
- while i < limit:
- active += step
- if active < 0:
- active = limit-1
- elif active >= limit:
- active = 0
- Con = self._CurrentFrame.Controls[active]
- if Con.active :
- return active
- ++i
- return None
-
-
- def GetControlAt(self, Y, X):
- # Check any child frames first
- for frame in self.FrameStackOrder:
- if frame.VISIBLE and frame.C1 <= X <= frame.C2 and frame.R1 <= Y <=
frame.R2:
- return frame.GetControlAt(Y, X) or frame
-
- # Now check our controls
- for control in self.Controls:
- metric = self.Metrics[control]
- if Y >= metric[0] and Y < metric[2] and X >= metric[1] and X < metric[3]
and control.active:
- return control
- return None
-
-
- def __PaintBorder(self, caption=None):
- DialogWidth = self.Width()
- DialogHeight = self.Height()
- _paintBorder( self, 0,0, DialogHeight, DialogWidth, caption=caption)
-
Modified: trunk/gnue-common/src/cursing/ScrollBar.py
===================================================================
--- trunk/gnue-common/src/cursing/ScrollBar.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/ScrollBar.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -124,15 +124,15 @@
self.Paint(None,None,None)
def Paint(self,v1,v2,v3):
- ## TODO: This is all wrong... it only partially supports _ABSX
- Pos = int(math.ceil(float(self._val) * (self.stepsize))) + self.start +
self._ABSX
+ ## TODO: This is all wrong... it only partially supports _X
+ Pos = int(math.ceil(float(self._val) * (self.stepsize))) + self.start +
self.X
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._ABSY, self.start + i + self._ABSX, ' ',
curses.A_REVERSE)
+ Screen.PutAt(self.Y, self.start + i + self.X, ' ', curses.A_REVERSE)
# correct position
if Pos >= (self.WorkingArea + self.start):
Pos = (self.start + self.WorkingArea)
@@ -145,7 +145,7 @@
self.SetColor(2)
self.LoLight()
for i in range(0, self.UsedSpace):
- Screen.PutAt(self._ABSY, (Pos - self.UsedSpace) + i, ' ',
curses.A_REVERSE)
+ Screen.PutAt(self.Y, (Pos - self.UsedSpace) + i, ' ', curses.A_REVERSE)
Screen.AutoRefresh = 1
Screen.Refresh()
Modified: trunk/gnue-common/src/cursing/StatusBar.py
===================================================================
--- trunk/gnue-common/src/cursing/StatusBar.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/StatusBar.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -124,13 +124,13 @@
if self._visible:
size =self.FIELD_SIZES[index]
- X = self.FIELD_X[index] + self._ABSX - self.X
+ X = self.FIELD_X[index] + self.X - self.X
caption = string.ljust(caption[:size], size)
Container = self.PARENT.Screen()
y,x = Container.GetYX()
self.HiLight
- Container.PrintAt(self._ABSY,X,caption,
Container.colors.C_STATUSBAR_FIELD)
+ Container.PrintAt(self.Y,X,caption, Container.colors.C_STATUSBAR_FIELD)
Container.GotoYX(y,x)
@@ -144,14 +144,14 @@
if Container == None:
raise "No container--can't paint!"
# self.LoLight()
- Y = self._ABSY
+ Y = self.Y
- Container.PrintAt(Y,self._ABSX,self._EmptyStatusBar,
Container.colors.C_STATUSBAR)
+ Container.PrintAt(Y,self.X,self._EmptyStatusBar,
Container.colors.C_STATUSBAR)
for index in range(self.NUM_FIELDS):
size =self.FIELD_SIZES[index]
- X = self.FIELD_X[index] + self._ABSX - self.X
+ X = self.FIELD_X[index] + self.X - self.X
caption = string.ljust(self.TEXT[index][:size], size)
Container.PrintAt(Y,X,caption, Container.colors.C_STATUSBAR_FIELD)
Modified: trunk/gnue-common/src/cursing/TextArea.py
===================================================================
--- trunk/gnue-common/src/cursing/TextArea.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/TextArea.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -173,26 +173,26 @@
Visuals = line + ((W - TextLen) * "_")
if len(Visuals) > W:
Visuals = Visuals[:W-1] + ">"
- Container.PrintAt(self._ABSY+i, self._ABSX, Visuals, self.FOCUS and
self.FOCUSCOLOR or self.COLOR)
- Container.GotoYX(self._ABSY+i, self._ABSX+ Depth)
+ Container.PrintAt(self.Y+i, self.X, Visuals, self.FOCUS and
self.FOCUSCOLOR or self.COLOR)
+ Container.GotoYX(self.Y+i, self.X+ Depth)
else:
if Depth >= W:
Visuals = "<" + Text[Depth - (W - 1):] + (((W - 1) - TextLen) * "_")
if len(Visuals) > W:
Visuals = Visuals[:W]
- Container.PrintAt(self._ABSY+i, self._ABSX, Visuals, self.FOCUS and
self.FOCUSCOLOR or self.COLOR)
- Container.GotoYX(self._ABSY+i, self._ABSX+ W)
+ Container.PrintAt(self.Y+i, self.X, Visuals, self.FOCUS and
self.FOCUSCOLOR or self.COLOR)
+ Container.GotoYX(self.Y+i, self.X+ W)
i += 1
for j in range(self.H - i):
- Container.PrintAt(self._ABSY + i + j, self._ABSX, "_" * W, self.FOCUS
and self.FOCUSCOLOR or self.COLOR)
+ Container.PrintAt(self.Y + i + j, self.X, "_" * W, self.FOCUS and
self.FOCUSCOLOR or self.COLOR)
def SetCursor(self, location):
self.DEPTH = location
Container = self.PARENT.Screen()
curses.curs_set(1)
- Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH)
+ Container.GotoYX(self.Y, self.X+ self.DEPTH)
self.Paint(None, None, None)
def LostFocus(self, v1, v2, v3):
@@ -206,7 +206,7 @@
self.SetColor('TEXTBOX_FOCUS')
Container = self.PARENT.Screen()
self.Paint(None, None, None)
- Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH)
+ Container.GotoYX(self.Y, self.X+ self.DEPTH)
def SetValue(self, newText, repaint=1):
self.TEXT = newText
Modified: trunk/gnue-common/src/cursing/TextBox.py
===================================================================
--- trunk/gnue-common/src/cursing/TextBox.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/TextBox.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -47,7 +47,7 @@
self.Y = Y
self.W = W
self.H = 1
- self.TEXT = DefaultValue
+ self.TEXT = str(DefaultValue)
self.CANGETFOCUS = 1
self.FOCUS = 0
self.DEPTH = 0 # our position in the text: 0..N
@@ -167,16 +167,20 @@
def Paint(self, v1, v2, v3):
Container = self.PARENT.SCREEN
- TextLen = len(self.TEXT)
+ try:
+ Text = self.TEXT
+ TextLen = len(self.TEXT)
+ except:
+ Text = ""
+ TextLen = 0
if self.FOCUS:
color = self.FOCUSCOLOR
else:
color = self.COLOR
+
if self.PASSWORD:
Text = "*" * TextLen
- else:
- Text = self.TEXT
W = self.W
Depth = self.DEPTH
@@ -186,21 +190,21 @@
Visuals = Text + ((W - TextLen) * "_")
if len(Visuals) > W:
Visuals = Visuals[:W-1] + ">"
- Container.PrintAt(self._ABSY, self._ABSX, Visuals, color)
- Container.GotoYX(self._ABSY, self._ABSX+ Depth)
+ Container.PrintAt(self.Y, self.X, Visuals, color)
+ Container.GotoYX(self.Y, self.X+ Depth)
else:
if Depth >= W:
Visuals = "<" + Text[Depth - (W - 1):] + (((W - 1) - TextLen) * "_")
if len(Visuals) > W:
Visuals = Visuals[:W]
- Container.PrintAt(self._ABSY, self._ABSX, Visuals, self.FOCUS and
self.FOCUSCOLOR or self.COLOR)
- Container.GotoYX(self._ABSY, self._ABSX+ W)
+ Container.PrintAt(self.Y, self.X, Visuals, self.FOCUS and
self.FOCUSCOLOR or self.COLOR)
+ Container.GotoYX(self.Y, self.X+ W)
def SetCursor(self, location):
self.DEPTH = location
Container = self.PARENT.Screen()
curses.curs_set(1)
- Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH)
+ Container.GotoYX(self.Y, self.X+ self.DEPTH)
self.Paint(None, None, None)
def LostFocus(self, v1, v2, v3):
@@ -213,7 +217,7 @@
self.FOCUS = 1
Container = self.PARENT.Screen()
curses.curs_set(1)
- Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH)
+ Container.GotoYX(self.Y, self.X+ self.DEPTH)
self.Paint(None, None, None)
def SetValue(self, newText, repaint=1):
Modified: trunk/gnue-common/src/cursing/VButton.py
===================================================================
--- trunk/gnue-common/src/cursing/VButton.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/VButton.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -50,7 +50,7 @@
color = self.FOCUSCOLOR
else:
color = self.COLOR
- tROW, tCOL = self._ABSY, self._ABSX
+ tROW, tCOL = self.Y, self.X
tCaption = self.CAPTION
tW = self.H
tAW = tW - 2
Modified: trunk/gnue-common/src/cursing/VScrollBar.py
===================================================================
--- trunk/gnue-common/src/cursing/VScrollBar.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/VScrollBar.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -74,12 +74,12 @@
self.Paint(None,None,None)
def Paint(self,v1,v2,v3):
- Pos = int(math.ceil(float(self._val) * (self.stepsize))) + self._ABSY +
self.start
+ Pos = int(math.ceil(float(self._val) * (self.stepsize))) + self.Y +
self.start
Screen = self.PARENT.Screen()
Screen.AutoRefresh = 0
# clear the bar region in reverse standard-color
for i in range(0, int(self.WorkingArea)):
- Screen.PutAt( self._ABSY + self.start + i,self._ABSX, '|',
Screen.colors.C_BACKGROUND)
+ Screen.PutAt( self.Y + self.start + i,self.X, '|',
Screen.colors.C_BACKGROUND)
# correct position
if Pos >= (self.WorkingArea + self.start):
Pos = (self.start + self.WorkingArea)
@@ -92,7 +92,7 @@
color = self.SCREEN.colors.C_SCROLL_SLIDER
for i in range(0, self.UsedSpace):
- Screen.PutAt((self._ABSY + Pos - self.UsedSpace) + i,self._ABSX, '0',
color)
+ Screen.PutAt((self.Y + Pos - self.UsedSpace) + i,self.X, '0', color)
Screen.AutoRefresh = 1
Screen.Refresh()
Modified: trunk/gnue-common/src/cursing/__init__.py
===================================================================
--- trunk/gnue-common/src/cursing/__init__.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/__init__.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -30,39 +30,40 @@
from constants import *
__classes__ = [
- "sio ",
- "Button ",
- "CheckBox ",
- "CheckBoxGroup ",
- "ComboBox ",
- "Control ",
- "Dialog ",
- "DirChooser ",
- "FileSelectPad ",
- "FileSelector ",
- "FocusedLabel ",
- "Frame ",
- "GraphicObject ",
- "GroupBox ",
- "InputBox ",
- "Label ",
- "Menu ",
- "MenuBar ",
- "MenuItem ",
- "MsgBoxOK ",
- "MsgBoxYesNo ",
- "Progress ",
- "RadioButton ",
- "RadioGroup ",
- "ScreenContainer ",
- "ScrollBar ",
- "StatusBar ",
- "TextBox ",
- "TextArea ",
- "VButton ",
+ "sio",
+ "Application",
+ "Button",
+ "CheckBox",
+ "CheckBoxGroup",
+ "ComboBox",
+ "Container",
+ "Control",
+ "Dialog",
+ "DirChooser",
+ "FileSelectPad",
+ "FileSelector",
+ "FocusedLabel",
+ "Frame",
+ "GraphicObject",
+ "GroupBox",
+ "InputBox",
+ "Label",
+ "Menu",
+ "MenuBar",
+ "MenuItem",
+ "MsgBoxOK",
+ "MsgBoxYesNo",
+ "Progress",
+ "RadioButton",
+ "RadioGroup",
+ "ScrollBar",
+ "StatusBar",
+ "TextBox",
+ "TextArea",
+ "VButton",
"VScrollBar "
]
for module in __classes__ :
exec "from %s import %s" % (module, module)
-
+
Modified: trunk/gnue-common/src/cursing/sio.py
===================================================================
--- trunk/gnue-common/src/cursing/sio.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/sio.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -56,7 +56,16 @@
#C_STATUSBAR = 10
#C_STATUSBAR_FIELD = 10 # 7
-class sio:
+
+def sio(*args, **parms):
+ global _sio
+ if not _sio:
+ _sio = _Sio(*args, **parms)
+ return _sio
+
+_sio = None
+
+class _Sio:
"""
This class basically acts as an interface to curses.
@@ -307,8 +316,8 @@
"""
"""
return
-
+
if curses.has_colors():
# TODO: should this be curses.color_pair(colorHi)?
#self.PrintMods = curses.color_pair(colorHi)
Modified: trunk/gnue-common/src/cursing/tests/demo.py
===================================================================
--- trunk/gnue-common/src/cursing/tests/demo.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/cursing/tests/demo.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -3,7 +3,7 @@
import os
import traceback
-from gnue.common.cursing import *
+from gnue.common.cursing import *
#
# testing routines
@@ -30,8 +30,8 @@
LOLIGHT_COLOR=3, HILIGHT_COLOR=4).Show ()
# reset the progress bar
ProgressBar.pbClear()
-
+
def UserClick2( TheControl, Arg2, Arg3):
"""
"""
@@ -57,8 +57,8 @@
MsgBoxOK(TheParent, "Why did you cancel?").Show()
else:
MsgBoxOK(TheParent, "So, You say your name is: " + i).Show()
-
-
+
+
def UserGotFocus2(TheControl, Arg2, Arg3):
"""
"""
@@ -75,14 +75,14 @@
Screen.LoLight()
Screen.PrintAt(4,3," " * 50)
return 1
-
+
def UserLostFocus0(TheControl, Arg2, Arg3):
"""
"""
return 1
-
+
def menuControl( control, ItemId, arg3):
"""
"""
@@ -139,7 +139,7 @@
# get a handle for the progress bar
pb = parent.FindControlByName( "progressbar")
# inititalize the File Selector object
- fs = FileSelector(parent, 0,0,0,0, TITLETEXT='File Selection',
+ fs = FileSelector(parent, 0,0,0,0, TITLETEXT='File Selection',
START=os.environ['PWD'])
# When a file is selected
@@ -206,21 +206,21 @@
menu2.SetMethod( "CHOSEN", menu2Control)
menu2.Finalize()
menu2.DeActivate(0)
-
+
# the text box beneath the menus
tb = TextBox(wBase, "txt1", 7, 5, 20, "")
tb.SetMethod("LOSTFOCUS", UserLostFocus0)
tb.DeActivate(0)
wBase.AddControl(tb)
-
+
# the labels for the buttons
wBase.AddControl( Label(wBase, "lbl0", 9,10, "User Name:"))
wBase.AddControl( Label(wBase, "lbl1", 10,10, "1st Button:"))
wBase.AddControl( Label(wBase, "lbl2", 11,10, "2nd Button:"))
- wBase.AddControl( Label(wBase, "lbl3", 12,10, "3rd Button:",
+ wBase.AddControl( Label(wBase, "lbl3", 12,10, "3rd Button:",
LOLIGHT_COLOR=3))
wBase.AddControl( Label(wBase, "lbl4", 13,10, "4th Button:"))
-
+
tb2 = Button(wBase, "HELLO", 10, 22, 10, "Dialog")
tb2.SetMethod("CLICK", DialogTest)
wBase.AddControl(tb2)
@@ -232,7 +232,7 @@
t = Button(wBase, "HELLO3", 12, 22, 10, "Progress")
t.SetMethod("CLICK", doProgress)
wBase.AddControl(t)
-
+
t2 = Button(wBase, "QUIT", 13,22,10,"Quit")
t2.SetColor (1, 2)
t2.SetMethod("CLICK", UserClick2)
Modified: trunk/gnue-common/src/logic/adapters/python.py
===================================================================
--- trunk/gnue-common/src/logic/adapters/python.py 2004-04-16 23:12:41 UTC
(rev 5731)
+++ trunk/gnue-common/src/logic/adapters/python.py 2004-04-16 23:38:32 UTC
(rev 5732)
@@ -18,7 +18,7 @@
#
# Copyright 2001-2004 Free Software Foundation
#
-# $Id: $
+# $Id$
import string
@@ -180,8 +180,8 @@
'<%s>' % self._context.shortname.encode ('utf-8'), 'exec')
except:
raise language.CompileError, self._traceback (1)
-
+
# ---------------------------------------------------------------------------
# Execute the function
# ---------------------------------------------------------------------------
Modified: trunk/gnue-common/src/logic/language.py
===================================================================
--- trunk/gnue-common/src/logic/language.py 2004-04-16 23:12:41 UTC (rev
5731)
+++ trunk/gnue-common/src/logic/language.py 2004-04-16 23:38:32 UTC (rev
5732)
@@ -18,7 +18,7 @@
#
# Copyright 2001-2004 Free Software Foundation
#
-# $Id: $
+# $Id$
from gnue.common.utils.FileUtils import dyn_import
@@ -103,7 +103,7 @@
environ = adapter.createNewContext ()
environ.shortname = "testing"
environ.description = "Execution context for self testing"
-
+
code = """
print "Hello World!"
print "My name is %s." % name
@@ -111,7 +111,7 @@
"""
print "Creating a new virtual code object ..."
- method = environ.buildFunction ('myFunctionName', code,
+ method = environ.buildFunction ('myFunctionName', code,
{'name': "", 'value': 0})
params = {'name': 'foo', 'value': 'bar'}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5732 - in trunk/gnue-common: doc/technotes src/cursing src/cursing/tests src/logic src/logic/adapters,
jcater <=