commit-gnue
[Top][All Lists]
Advanced

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

gnue-pos/src/frontends/wx Driver.py


From: Jason Cater
Subject: gnue-pos/src/frontends/wx Driver.py
Date: Thu, 03 Jul 2003 11:53:45 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-pos
Branch:         
Changes by:     Jason Cater <address@hidden>    03/07/03 11:53:45

Modified files:
        src/frontends/wx: Driver.py 

Log message:
        added mixed-case handler for main input field

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-pos/src/frontends/wx/Driver.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: gnue-pos/src/frontends/wx/Driver.py
diff -c gnue-pos/src/frontends/wx/Driver.py:1.9 
gnue-pos/src/frontends/wx/Driver.py:1.10
*** gnue-pos/src/frontends/wx/Driver.py:1.9     Thu Jul  3 00:30:33 2003
--- gnue-pos/src/frontends/wx/Driver.py Thu Jul  3 11:53:45 2003
***************
*** 37,50 ****
  from wxPython.wx import *
  from wxPython.gizmos import *
  from NumberDisplay import NumberDisplay, bigFont
  
  dollarFormat = '$%.02f'
  
  STATUS_USER = 2
  STATUS_TICKET = 1
  
- LOGIN_COLOR = wxColour(255,200,200)
  BASE_COLOR = wxNamedColour("ivory")
  
  class Driver(BaseDriver):
    def init(self):
--- 37,55 ----
  from wxPython.wx import *
  from wxPython.gizmos import *
  from NumberDisplay import NumberDisplay, bigFont
+ import string
  
  dollarFormat = '$%.02f'
  
  STATUS_USER = 2
  STATUS_TICKET = 1
  
  BASE_COLOR = wxNamedColour("ivory")
+ LOGIN_COLOR = wxColour(255,220,220)
+ LOGIN_EVENTS = ('LoginEntered','PasswordEntered')
+ SPECIAL_COLOR = wxColour(220,255,220)
+ SPECIAL_EVENTS = ('TaxExemptionEntered',)
+ 
  
  class Driver(BaseDriver):
    def init(self):
***************
*** 89,96 ****
      except AttributeError:
        pass
  
!     if event.response in ('LoginEntered','PasswordEntered'):
        self.inputField.SetBackgroundColour(LOGIN_COLOR)
      else:
        self.inputField.SetBackgroundColour(BASE_COLOR)
  
--- 94,103 ----
      except AttributeError:
        pass
  
!     if event.response in LOGIN_EVENTS:
        self.inputField.SetBackgroundColour(LOGIN_COLOR)
+     elif event.response in SPECIAL_EVENTS:
+       self.inputField.SetBackgroundColour(SPECIAL_COLOR)
      else:
        self.inputField.SetBackgroundColour(BASE_COLOR)
  
***************
*** 224,229 ****
--- 231,238 ----
      frame.Show(1)
  
      EVT_KEY_DOWN(self.inputField, self.__keypress)
+     self.__intext = 1
+     EVT_CHAR(self.inputField, self.__ontext)
  
    def __OnSize(self, event):
      self.frame.Layout()
***************
*** 246,256 ****
        self.dispatchEvent(self.__event, value=self.inputField.GetValue())
      elif key == WXK_ESCAPE:
        self.inputField.Clear()
!     elif _specialKeys.has_key(key): # and _specialKeys[key] in 
self.__endingEvents:
        self.dispatchEvent(self.__event, value=self.inputField.GetValue(), 
next=_specialKeys[key])
      else:
        event.Skip()
  
  
  _specialKeys = {
     WXK_MULTIPLY: 'RequestQuantity',
--- 255,275 ----
        self.dispatchEvent(self.__event, value=self.inputField.GetValue())
      elif key == WXK_ESCAPE:
        self.inputField.Clear()
!     elif _specialKeys.has_key(key) and _specialKeys[key] in 
self.__endingEvents:
        self.dispatchEvent(self.__event, value=self.inputField.GetValue(), 
next=_specialKeys[key])
      else:
        event.Skip()
  
+   def __ontext(self, event):
+     if event.GetKeyCode() != 32:
+       wxCallAfter(self.__fixtext)
+     event.Skip()
+ 
+   def __fixtext(self):
+     ip = self.inputField.GetInsertionPoint()
+     self.inputField.SetValue(string.capwords(self.inputField.GetValue()))
+     self.inputField.SetInsertionPoint(ip)
+ 
  
  _specialKeys = {
     WXK_MULTIPLY: 'RequestQuantity',
***************
*** 260,263 ****
     WXK_F12: 'RequestTaxExemption',
    }
  
- print _specialKeys
\ No newline at end of file
--- 279,281 ----




reply via email to

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