commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue common/src/cursing/Button.py common/src/cu...


From: Jason Cater
Subject: gnue common/src/cursing/Button.py common/src/cu...
Date: Thu, 07 Nov 2002 11:37:03 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/11/07 11:37:03

Modified files:
        common/src/cursing: Button.py ComboBox.py Dialog.py 
                            FileSelectPad.py FocusedLabel.py Frame.py 
                            GroupBox.py Label.py MenuBar.py Progress.py 
                            ScreenContainer.py ScrollBar.py StatusBar.py 
                            TextArea.py TextBox.py 
        forms/src/uidrivers/curses: UIdriver.py 
        reports/src    : GRRun.py 
Added files:
        common/src/cursing: Notebook.py 

Log message:
        * Added support for Frame panels that are controlled by their parent 
container
        * Added an "absolute x,y" attribute to each Control object, so they can 
transparently work in Frames
        * Moved MenuBar to the Frame model
        * Started work on a Notebook control

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Notebook.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Button.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/ComboBox.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Dialog.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/FileSelectPad.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/FocusedLabel.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Frame.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/GroupBox.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.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/MenuBar.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/Progress.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/ScreenContainer.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/ScrollBar.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/StatusBar.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/TextArea.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/cursing/TextBox.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/uidrivers/curses/UIdriver.py.diff?cvsroot=OldCVS&tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRRun.py.diff?cvsroot=OldCVS&tr1=1.19&tr2=1.20&r1=text&r2=text

Patches:
Index: gnue/common/src/cursing/Button.py
diff -c gnue/common/src/cursing/Button.py:1.6 
gnue/common/src/cursing/Button.py:1.7
*** gnue/common/src/cursing/Button.py:1.6       Fri Oct 11 19:44:12 2002
--- gnue/common/src/cursing/Button.py   Thu Nov  7 11:37:03 2002
***************
*** 106,112 ****
      else:
        self.SetColor(sio.C_BUTTON)
        self.LoLight()
!     tROW, tCOL = self.Y, self.X
      tCaption = self.CAPTION
      tW = self.W
      tAW = tW - 2
--- 106,112 ----
      else:
        self.SetColor(sio.C_BUTTON)
        self.LoLight()
!     tROW, tCOL = self._ABSY, self._ABSX
      tCaption = self.CAPTION
      tW = self.W
      tAW = tW - 2
Index: gnue/common/src/cursing/ComboBox.py
diff -c gnue/common/src/cursing/ComboBox.py:1.4 
gnue/common/src/cursing/ComboBox.py:1.5
*** gnue/common/src/cursing/ComboBox.py:1.4     Thu Oct 10 21:46:06 2002
--- gnue/common/src/cursing/ComboBox.py Thu Nov  7 11:37:03 2002
***************
*** 57,64 ****
      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))
--- 57,64 ----
      Screen = self.PARENT.Screen()
      Screen.AutoRefresh = 0
      self.SetColor(1)
!     X = self._ABSX
!     Y = self._ABSY
      W = self.W
      Screen.PrintAt(Y,X,chr(tiVLINE))
      Screen.PrintAt(Y,X+W-1,chr(tiVLINE))
Index: gnue/common/src/cursing/Dialog.py
diff -c gnue/common/src/cursing/Dialog.py:1.6 
gnue/common/src/cursing/Dialog.py:1.7
*** gnue/common/src/cursing/Dialog.py:1.6       Fri Oct 11 19:44:12 2002
--- gnue/common/src/cursing/Dialog.py   Thu Nov  7 11:37:03 2002
***************
*** 26,38 ****
  # NOTES:
  #
  
  from gnue.common import GDebug
  from constants import *
  import sio
  from utility import _paintBorder
  from ScreenContainer import ScreenContainer
  
- # TODO: This should be based off of Frame
  class Dialog(ScreenContainer):
    """
      like a full screen container, but only a smaller portion of it.
--- 26,42 ----
  # NOTES:
  #
  
+ ###
+ ### TODO: This desparately needs to
+ ###       subclass the new Frame class
+ ###
+ 
  from gnue.common import GDebug
  from constants import *
  import sio
  from utility import _paintBorder
  from ScreenContainer import ScreenContainer
  
  class Dialog(ScreenContainer):
    """
      like a full screen container, but only a smaller portion of it.
Index: gnue/common/src/cursing/FileSelectPad.py
diff -c gnue/common/src/cursing/FileSelectPad.py:1.3 
gnue/common/src/cursing/FileSelectPad.py:1.4
*** gnue/common/src/cursing/FileSelectPad.py:1.3        Wed Oct  9 23:42:11 2002
--- gnue/common/src/cursing/FileSelectPad.py    Thu Nov  7 11:37:03 2002
***************
*** 257,265 ****
        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
--- 257,265 ----
        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._ABSY,self._ABSX,
!         self._ABSY + self._H,self._ABSX + self._W)
      
    def fillpad(self, showProgress = 0):
      rows = self.ROWS
Index: gnue/common/src/cursing/FocusedLabel.py
diff -c gnue/common/src/cursing/FocusedLabel.py:1.3 
gnue/common/src/cursing/FocusedLabel.py:1.4
*** gnue/common/src/cursing/FocusedLabel.py:1.3 Wed Oct  9 23:42:11 2002
--- gnue/common/src/cursing/FocusedLabel.py     Thu Nov  7 11:37:03 2002
***************
*** 78,85 ****
        else:
          self.SetColor(1)
      self.LoLight()
!     Y = self.Y
!     X = self.X
      caption = self.CAPTION
      Container.PrintAt(Y,X,caption)
      if self.active :
--- 78,85 ----
        else:
          self.SetColor(1)
      self.LoLight()
!     Y = self._ABSY
!     X = self._ABSX
      caption = self.CAPTION
      Container.PrintAt(Y,X,caption)
      if self.active :
Index: gnue/common/src/cursing/Frame.py
diff -c gnue/common/src/cursing/Frame.py:1.6 
gnue/common/src/cursing/Frame.py:1.7
*** gnue/common/src/cursing/Frame.py:1.6        Thu Oct 17 19:35:01 2002
--- gnue/common/src/cursing/Frame.py    Thu Nov  7 11:37:03 2002
***************
*** 43,48 ****
--- 43,50 ----
      SIOInstance = ParentContainer.Screen()
      apply (ScreenContainer.__init__, (self, SIOInstance), properties)
      self.PARENT = ParentContainer
+     self.PARENT.AddFrame(self)
+     self.VISIBLE = 0
      self.scrnbuff = {}
      self.Controls = []
      self.SCREEN = SIOInstance
***************
*** 53,58 ****
--- 55,62 ----
      self.R2 = r2
      self.C1 = c1
      self.C2 = c2
+     self._ChildOffsetX = border
+     self._ChildOffsetY = border 
      self.DROPSHADOW = dropshadow
      self.BORDER = border
  
***************
*** 76,99 ****
    def __del__(self):
       pass
  
!   def AddFrameControl(self, TheControl):
!     """
!       Make sure the control is visible in the limited area of the
!       dialog box
!     """
!     cRow = TheControl.Y
!     cRow = cRow + self.R1 + self.BORDER
!     cCol = TheControl.X
!     cCol = cCol + self.C1 + self.BORDER
!     TheControl.Y = cRow
!     TheControl.X = cCol
!     self.PARENT.AddControl(TheControl)
!     return TheControl
! 
!   def AddControl(self,control):
!     return self.AddFrameControl(control)
  
    def _PaintBorder(self):
      if not self.BORDER:
        return
  
--- 80,90 ----
    def __del__(self):
       pass
  
!   def Show(self):
!     return self.PARENT.RaiseFrame(self)
  
    def _PaintBorder(self):
+     GDebug.printMesg(2,'(!!!) PaintBorder')
      if not self.BORDER:
        return
  
***************
*** 115,120 ****
--- 106,116 ----
        self.SCREEN.PrintAt( self.R1 + i, self.C2 + self.BORDER*2, " ")
  
      self.SCREEN.SetColor(color)
+ 
+   def Paint(self, *args, **parms):
+     self._PaintBorder()
+     self._PaintDropShadow()
+     ScreenContainer.Paint(self,*args, **parms)
  
  ##  def RunDialog(self):
  ##    self._PaintBorder()
Index: gnue/common/src/cursing/GroupBox.py
diff -c gnue/common/src/cursing/GroupBox.py:1.1 
gnue/common/src/cursing/GroupBox.py:1.2
*** gnue/common/src/cursing/GroupBox.py:1.1     Fri Oct 11 01:10:37 2002
--- gnue/common/src/cursing/GroupBox.py Thu Nov  7 11:37:03 2002
***************
*** 47,54 ****
      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)
--- 47,54 ----
      self.SetMethod("SYSPAINT", self.Paint)
  
    def Paint(self,v1,v2,v3):
!     Y = self._ABSY
!     X = self._ABSX
      H = self.H
      W = self.W
      _paintBorder(self, Y, X, H, W)
Index: gnue/common/src/cursing/Label.py
diff -c gnue/common/src/cursing/Label.py:1.5 
gnue/common/src/cursing/Label.py:1.6
*** gnue/common/src/cursing/Label.py:1.5        Thu Oct 10 21:46:06 2002
--- gnue/common/src/cursing/Label.py    Thu Nov  7 11:37:03 2002
***************
*** 94,101 ****
      if Container == None:
        raise "No container--can't paint!"
      self.LoLight()
!     Y = self.Y
!     X = self.X
      caption = self.CAPTION
      Container.PrintAt(Y,X,caption)
  
--- 94,101 ----
      if Container == None:
        raise "No container--can't paint!"
      self.LoLight()
!     Y = self._ABSY
!     X = self._ABSX
      caption = self.CAPTION
      Container.PrintAt(Y,X,caption)
  
Index: gnue/common/src/cursing/MenuBar.py
diff -c gnue/common/src/cursing/MenuBar.py:1.5 
gnue/common/src/cursing/MenuBar.py:1.6
*** gnue/common/src/cursing/MenuBar.py:1.5      Thu Oct 17 19:35:01 2002
--- gnue/common/src/cursing/MenuBar.py  Thu Nov  7 11:37:03 2002
***************
*** 28,75 ****
  
  from gnue.common import GDebug
  from constants import *
! from Control import Control
  from Menu import Menu
  
! class MenuBar(Control):
!   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.STATUSBAR = None
      self.STATUSBAR_INDEX = 0
!     self.menus = []
  
    def NewMenu(self,Name,Caption):
      newEntry = Menu(self.rootwin, Name, 0,0, Caption, self)
      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 SetStatusBar(self, statusbar, index=0):
      self.STATUSBAR = statusbar
      self.STATUSBAR_INDEX = index
  
    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
  
--- 28,69 ----
  
  from gnue.common import GDebug
  from constants import *
! from Frame import Frame
  from Menu import Menu
  
! 
! class MenuBar(Frame):
!   def __init__(self, Root, Y, X, W,  **properties):
!     Frame.__init__(self, Root, Y, X, Y+1, X + W - 1,
!                    border=0, dropshadow=0, **properties)
      self.rootwin = Root
      self.CANGETFOCUS = 0
      self.Y = Y
      self.X = X
      self.H = 2
      self.W = 0
      self.STATUSBAR = None
      self.STATUSBAR_INDEX = 0
!     self.Controls = []
  
    def NewMenu(self,Name,Caption):
      newEntry = Menu(self.rootwin, Name, 0,0, Caption, self)
      self._AddMenu(newEntry)
      return newEntry
  
    def SetStatusBar(self, statusbar, index=0):
      self.STATUSBAR = statusbar
      self.STATUSBAR_INDEX = index
  
    def _AddMenu(self,menu):
!     self.Controls.append(menu)
      newX = 0
!     if len(self.Controls) > 1:
!       newX  = self.Controls[-2:-1][0].X
!       newX += len(self.Controls[-2:-1][0].CAPTION) + 2
  
      menu.X = newX
      menu.Y = self.Y
+ 
+     self.AddControl(menu)
  
Index: gnue/common/src/cursing/Progress.py
diff -c gnue/common/src/cursing/Progress.py:1.3 
gnue/common/src/cursing/Progress.py:1.4
*** gnue/common/src/cursing/Progress.py:1.3     Wed Oct  9 23:42:11 2002
--- gnue/common/src/cursing/Progress.py Thu Nov  7 11:37:03 2002
***************
*** 69,86 ****
        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.
--- 69,86 ----
        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._ABSY, self._ABSX, "[ ")
!       Screen.PrintAt(self._ABSY,
!         self._ABSX+ self.W- 2, " ]")
        for i in range(0, MarkedSpace):
!         Screen.PutAt(self._ABSY,
!           self._ABSX+ 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.
Index: gnue/common/src/cursing/ScreenContainer.py
diff -c gnue/common/src/cursing/ScreenContainer.py:1.6 
gnue/common/src/cursing/ScreenContainer.py:1.7
*** gnue/common/src/cursing/ScreenContainer.py:1.6      Sun Oct 13 23:59:23 2002
--- gnue/common/src/cursing/ScreenContainer.py  Thu Nov  7 11:37:03 2002
***************
*** 38,43 ****
--- 38,44 ----
  import sio
  from utility import _paintBorder
  from GraphicObject import GraphicObject
+ Frame = None
  
  class ScreenContainer(GraphicObject):
    """
***************
*** 50,57 ****
--- 51,67 ----
      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.Metrics  = {}  # ditionary of dimensions, keyed by control obj
+     self.VISIBLE = 1
  
      apply(GraphicObject.__init__, (self, SIOInstance), properties)
  
***************
*** 62,68 ****
      self.eventX = -1
      self.eventY = -1
      self._CurrentFocus = None
! 
  
  
    def SetProperty(self, PropertyName, PropertyValue):
--- 72,82 ----
      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):
***************
*** 73,118 ****
        for i in xrange(0, len(self.Controls)):
          self.Controls[i].SetProperty(PropertyName, PropertyValue)
  
  
!   def AddControl(self, ControlObj = None):
      """
      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 ControlObj name.
      """
-     if ControlObj <> None:
-       ControlObj.InheritProperties(self)
-       self.Controls.append(ControlObj)
-       self.Metrics[ControlObj] = (
-         ControlObj.Y, ControlObj.X,
-         ControlObj.Y+ ControlObj.H,
-         ControlObj.X+ ControlObj.W)
  
!     return ControlObj
  
  
!   def DelControl(self,ControlObj = None):
      """Delete a control from the Control stack, and it's dimension
      properties from the Metrics dict."""
!     if  self.Controls.count(ControlObj) != 0:
!       del self.Metrics[ControlObj]
!       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'."
--- 87,160 ----
        for i in xrange(0, len(self.Controls)):
          self.Controls[i].SetProperty(PropertyName, PropertyValue)
  
+   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._CurrentFrame = frame
+     frame.VISIBLE = 1
+     self.FrameStackOrder.pop(self.Frames.index(frame))
+     self.FrameStackOrder.insert(0,frame)
  
!   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
!       self.LoLight()
! 
      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'."
***************
*** 123,133 ****
  
    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()
--- 165,175 ----
  
    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()
***************
*** 151,161 ****
        # Sanity check the Control Stack index (again!), reset index to
        # zero on exception.
        try:
!         myCtl = self.Controls[myCsi]
        except:
          myCsi = 0
          try:
!           myCtl = self.Controls[myCsi]
          except:
            print "WARNING: No widgets!!"
            return
--- 193,203 ----
        # 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
***************
*** 165,171 ****
        if self.nextCtl != None:
          # get and set the next desired ControlStackIndex based on
          # the next queued up control
!         myCsi = self.Controls.index(self.nextCtl)
          # reassign myCtl control to the next desired.
          myCtl = self.nextCtl
          # reset the next Control value to None
--- 207,213 ----
        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
***************
*** 342,348 ****
      if Char == curses.KEY_MOUSE:
        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]
--- 384,393 ----
      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]
***************
*** 360,370 ****
  #
  
    def __GetNextActiveCtlIndex(self, active):
!     step = 1
!     global BACKWARDS
!     if BACKWARDS :
!       step = -1
!     limit = len(self.Controls)
      if active < 0 or active >= limit:
        return None
      i = 0
--- 405,412 ----
  #
  
    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
***************
*** 374,391 ****
          active = limit-1
        elif active >= limit:
          active = 0
!       Con = self.Controls[active]
        if Con.active :
          return active
        ++i
      return None
  
  
!   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
  
  
--- 416,439 ----
          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 <= 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
  
  
Index: gnue/common/src/cursing/ScrollBar.py
diff -c gnue/common/src/cursing/ScrollBar.py:1.4 
gnue/common/src/cursing/ScrollBar.py:1.5
*** gnue/common/src/cursing/ScrollBar.py:1.4    Thu Oct 10 21:46:06 2002
--- gnue/common/src/cursing/ScrollBar.py        Thu Nov  7 11:37:03 2002
***************
*** 103,109 ****
          self._Inc(None, None, None)
  
    def _ChangePos(self,arg1,arg2,newX):
!     X = newX - self.start 
      if X >= (self.WorkingArea-1):
        val = self._max
      else:
--- 103,109 ----
          self._Inc(None, None, None)
  
    def _ChangePos(self,arg1,arg2,newX):
!     X = newX - self.start
      if X >= (self.WorkingArea-1):
        val = self._max
      else:
***************
*** 116,122 ****
      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:
--- 116,122 ----
      self._max = Max
      self._val = 0
      self.WorkingArea = float(self.W-9)
!     self.start = 3
      self.UsedSpace = int(math.floor(self.WorkingArea / float(self._max)))
      self.stepsize = self.WorkingArea / self._max
      if self.UsedSpace < 1:
***************
*** 124,150 ****
      self.Paint(None,None,None)
  
    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()
  
--- 124,151 ----
      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
      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)
      # 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._ABSY, (Pos - self.UsedSpace) + i, ' ', 
curses.A_REVERSE)
      Screen.AutoRefresh = 1
      Screen.Refresh()
  
Index: gnue/common/src/cursing/StatusBar.py
diff -c gnue/common/src/cursing/StatusBar.py:1.1 
gnue/common/src/cursing/StatusBar.py:1.2
*** gnue/common/src/cursing/StatusBar.py:1.1    Fri Oct 11 19:44:12 2002
--- gnue/common/src/cursing/StatusBar.py        Thu Nov  7 11:37:03 2002
***************
*** 36,42 ****
  
  class StatusBar(Control):
    """
!     This class implements a status bar. Sizes is a tuple of integers, 
      specifying the size of each Field.  Of any sizes are 0, then they
      are automatically expanded.
    """
--- 36,42 ----
  
  class StatusBar(Control):
    """
!     This class implements a status bar. Sizes is a tuple of integers,
      specifying the size of each Field.  Of any sizes are 0, then they
      are automatically expanded.
    """
***************
*** 50,55 ****
--- 50,56 ----
      self.Y = Y
      self.W = W
      self.H = 1
+     self.CANGETFOCUS=0
      self.NUM_FIELDS = numfields = len(Sizes)
      self.FIELD_SIZES = Sizes = list(Sizes)
      self.FIELD_X = []
***************
*** 124,136 ****
  
      if self._visible:
        size =self.FIELD_SIZES[index]
!       X = self.FIELD_X[index]
        caption = string.ljust(caption[:size], size)
  
        GDebug.printMesg(1,'Visible, so adding %s' % caption)
        Container = self.PARENT.Screen()
        #Container.SetColor(sio.C_STATUSBAR_FIELD)
!       Container.PrintAt(self.Y,X,caption)#, 
curses.color_pair(sio.C_STATUSBAR_FIELD))
  
  
  
--- 125,137 ----
  
      if self._visible:
        size =self.FIELD_SIZES[index]
!       X = self.FIELD_X[index] + self._ABSX - self.X
        caption = string.ljust(caption[:size], size)
  
        GDebug.printMesg(1,'Visible, so adding %s' % caption)
        Container = self.PARENT.Screen()
        #Container.SetColor(sio.C_STATUSBAR_FIELD)
!       Container.PrintAt(self._ABSY,X,caption)#, 
curses.color_pair(sio.C_STATUSBAR_FIELD))
  
  
  
***************
*** 140,154 ****
      if Container == None:
        raise "No container--can't paint!"
      self.LoLight()
!     Y = self.Y
  
!     Container.PrintAt(Y,self.X,self._EmptyStatusBar)#,
             #curses.color_pair(sio.C_STATUSBAR))
  
      for index in range(self.NUM_FIELDS):
  
        size =self.FIELD_SIZES[index]
!       X = self.FIELD_X[index]
        caption = string.ljust(self.TEXT[index][:size], size)
  
  #      Container.SetColor(sio.C_STATUSBAR_FIELD)
--- 141,155 ----
      if Container == None:
        raise "No container--can't paint!"
      self.LoLight()
!     Y = self._ABSY
  
!     Container.PrintAt(Y,self._ABSX,self._EmptyStatusBar)#,
             #curses.color_pair(sio.C_STATUSBAR))
  
      for index in range(self.NUM_FIELDS):
  
        size =self.FIELD_SIZES[index]
!       X = self.FIELD_X[index] + self._ABSX - self.X
        caption = string.ljust(self.TEXT[index][:size], size)
  
  #      Container.SetColor(sio.C_STATUSBAR_FIELD)
Index: gnue/common/src/cursing/TextArea.py
diff -c gnue/common/src/cursing/TextArea.py:1.3 
gnue/common/src/cursing/TextArea.py:1.4
*** gnue/common/src/cursing/TextArea.py:1.3     Sun Oct 13 23:59:23 2002
--- gnue/common/src/cursing/TextArea.py Thu Nov  7 11:37:03 2002
***************
*** 173,191 ****
          Visuals = line + ((W - TextLen) * "_")
          if len(Visuals) > W:
            Visuals = Visuals[:W-1] + ">"
!         Container.PrintAt(self.Y+i, self.X, Visuals)
!         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.Y+i, self.X, Visuals)
!           Container.GotoYX(self.Y+i, self.X+  W)
        i += 1
  
        for j in range(self.H - i):
!         Container.PrintAt(self.Y + i + j, self.X, "_" * W)
  
  
    def SetCursor(self, location):
--- 173,191 ----
          Visuals = line + ((W - TextLen) * "_")
          if len(Visuals) > W:
            Visuals = Visuals[:W-1] + ">"
!         Container.PrintAt(self._ABSY+i, self._ABSX, Visuals)
!         Container.GotoYX(self._ABSY+i, self._ABSX+ 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)
!           Container.GotoYX(self._ABSY+i, self._ABSX+  W)
        i += 1
  
        for j in range(self.H - i):
!         Container.PrintAt(self._ABSY + i + j, self._ABSX, "_" * W)
  
  
    def SetCursor(self, location):
***************
*** 202,208 ****
      self.SetColor(sio.C_TEXTBOX_FOCUS)
      Container = self.PARENT.Screen()
      self.Paint(None, None, None)
!     Container.GotoYX(self.Y, self.X+ self.DEPTH)
  
    def SetValue(self, newText):
      self.TEXT = newText
--- 202,208 ----
      self.SetColor(sio.C_TEXTBOX_FOCUS)
      Container = self.PARENT.Screen()
      self.Paint(None, None, None)
!     Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH)
  
    def SetValue(self, newText):
      self.TEXT = newText
Index: gnue/common/src/cursing/TextBox.py
diff -c gnue/common/src/cursing/TextBox.py:1.8 
gnue/common/src/cursing/TextBox.py:1.9
*** gnue/common/src/cursing/TextBox.py:1.8      Sun Oct 13 23:59:23 2002
--- gnue/common/src/cursing/TextBox.py  Thu Nov  7 11:37:03 2002
***************
*** 175,195 ****
        Visuals = Text + ((W - TextLen) * "_")
        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) * "_")
          if len(Visuals) > W:
            Visuals = Visuals[:W]
!         Container.PrintAt(self.Y, self.X, Visuals)
!         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.Y, self.X+ self.DEPTH)
      self.Paint(None, None, None)
  
    def LostFocus(self, v1, v2, v3):
--- 175,195 ----
        Visuals = Text + ((W - TextLen) * "_")
        if len(Visuals) > W:
          Visuals = Visuals[:W-1] + ">"
!       Container.PrintAt(self._ABSY, self._ABSX, Visuals)
!       Container.GotoYX(self._ABSY, self._ABSX+ 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)
!         Container.GotoYX(self._ABSY, self._ABSX+  W)
  
    def SetCursor(self, location):
      self.DEPTH = location
      Container = self.PARENT.Screen()
      curses.curs_set(1)
!     Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH)
      self.Paint(None, None, None)
  
    def LostFocus(self, v1, v2, v3):
***************
*** 202,208 ****
      self.SetColor(sio.C_TEXTBOX_FOCUS)
      Container = self.PARENT.Screen()
      curses.curs_set(1)
!     Container.GotoYX(self.Y, self.X+ self.DEPTH)
      self.Paint(None, None, None)
  
    def SetValue(self, newText):
--- 202,208 ----
      self.SetColor(sio.C_TEXTBOX_FOCUS)
      Container = self.PARENT.Screen()
      curses.curs_set(1)
!     Container.GotoYX(self._ABSY, self._ABSX+ self.DEPTH)
      self.Paint(None, None, None)
  
    def SetValue(self, newText):
Index: gnue/forms/src/uidrivers/curses/UIdriver.py
diff -c gnue/forms/src/uidrivers/curses/UIdriver.py:1.17 
gnue/forms/src/uidrivers/curses/UIdriver.py:1.18
*** gnue/forms/src/uidrivers/curses/UIdriver.py:1.17    Mon Nov  4 21:45:24 2002
--- gnue/forms/src/uidrivers/curses/UIdriver.py Thu Nov  7 11:37:03 2002
***************
*** 63,68 ****
--- 63,71 ----
    if not _SIO:
      _SIO = sio()
      _SIO.BeginScreenAccess()
+     print "Setting cleanup function"
+     sys._clean_curses_exit = sys.exit
+     sys.exit = _restore
    return _SIO
  
  #
***************
*** 210,219 ****
      self.textHeight = 1   # The pixel height of text inside a widget
  
  
!     menuBar = MenuBar(self.mainWindow,0,0)
  
!     for _menu in menu.keys():
!       newMenu=menuBar.NewMenu(_menu,_menu)
        for menuitem in menu[_menu]:
          if menuitem['id'] > 0:
            newMenu.AddItem(menuitem['id'],menuitem['text'])
--- 213,222 ----
      self.textHeight = 1   # The pixel height of text inside a widget
  
  
!     menuBar = MenuBar(self.mainWindow,0,0, self._screen.MAXCOL)
  
!     for _menu in ['file','edit','data','help']:
!       newMenu=menuBar.NewMenu(_menu,_menu.capitalize())
        for menuitem in menu[_menu]:
          if menuitem['id'] > 0:
            newMenu.AddItem(menuitem['id'],menuitem['text'])
***************
*** 231,237 ****
      self.statusBar.SetText(3,'0/0')
      self.statusBar.SetText(4,'1/1')
  
!     self.mainWindow.AddControl(menuBar)
      self.mainWindow.AddControl(self.statusBar)
      self.mainWindow.Paint()
  
--- 234,240 ----
      self.statusBar.SetText(3,'0/0')
      self.statusBar.SetText(4,'1/1')
  
! #    self.mainWindow.AddControl(menuBar)
      self.mainWindow.AddControl(self.statusBar)
      self.mainWindow.Paint()
  
***************
*** 247,252 ****
--- 250,256 ----
  ##     self.mainWindow.SetSize(formSize)
  ##     self.mainWindow.SetTitle(str(self._form.title))
      self.mainWindow.panel =  self._pageList[0]
+     self.mainWindow.panel.Show()
  ##     self.mainWindow.panel.SetSize(formSize)
  ##     self._pageList[0].Show(1)
  
***************
*** 279,284 ****
--- 283,289 ----
    #
    def _exit(self):
      self.mainWindow.EndScreenAccess()
+     _restore()
  
  
    def _setStatusBar(self,*args):
***************
*** 581,591 ****
        width = event.screenWidth
  
  
!     newWidget = Frame(event.container, y, x,  y+height-1, x+width-1 )
      ###newWidget.DeActivate(0)
      event.interface._pageList.append(newWidget)
  
!     newWidget.KeystrokeHook = 
keyboardEvtHandler(_EVENTPROCESSOR)._processEvent
  
      return newWidget
  
--- 586,596 ----
        width = event.screenWidth
  
  
!     newWidget = Frame(event.container, y, x,  y+height-1, x+width-1 , 
object._parent.title)
      ###newWidget.DeActivate(0)
      event.interface._pageList.append(newWidget)
  
! ####    newWidget.KeystrokeHook = 
keyboardEvtHandler(_EVENTPROCESSOR)._processEvent
  
      return newWidget
  
***************
*** 700,708 ****
    if initialize:
      newWidget.SetMethod("CLICK", mouseEvtHandler(_EVENTPROCESSOR))
  
- ##     # TODO: this should use one instance
- ##     newWidget.PushEventHandler(mouseEvtHandler(_EVENTPROCESSOR))
- ##     newWidget.PushEventHandler(keyboardEvtHandler(_EVENTPROCESSOR))
  
  class uiBaseEvtHandler:
    def __init__(self,eventList,eventProcessor):
--- 705,710 ----
***************
*** 877,880 ****
--- 879,897 ----
           rv[loginData[2][i][0]] = textctrlList[i].TEXT
  
         return rv
+ 
+ 
+ def _restore(*args, **parms):
+   # Set everything back to normal
+   try:
+ #    _SIO.keypad(0)
+     curses.echo()
+     curses.nocbreak()
+     curses.endwin()          # Terminate curses
+   except:
+     pass
+ 
+   sys._clean_curses_exit(*args, **parms)
+ 
+ 
  
Index: gnue/reports/src/GRRun.py
diff -c gnue/reports/src/GRRun.py:1.19 gnue/reports/src/GRRun.py:1.20
*** gnue/reports/src/GRRun.py:1.19      Mon Nov  4 19:48:00 2002
--- gnue/reports/src/GRRun.py   Thu Nov  7 11:37:03 2002
***************
*** 261,266 ****
--- 261,267 ----
      except GRExceptions.ReportUnreadable, msg:
        self.handleStartupError (msg)
  
+     sys.exit()
  
    #
    # List filters available on the server




reply via email to

[Prev in Thread] Current Thread [Next in Thread]