/[gnue]/gnue-pos/src/POSClient.py
ViewVC logotype

Diff of /gnue-pos/src/POSClient.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by jcater, Thu Jun 19 20:48:11 2003 UTC revision 1.8 by jcater, Mon Jun 23 03:48:57 2003 UTC
# Line 92  class POSClient(GClientApp, events.Event Line 92  class POSClient(GClientApp, events.Event
92        except:        except:
93          self.handleStartupError (_("No Register Name Specified."))          self.handleStartupError (_("No Register Name Specified."))
94    
95        self._initHardware(registername)
96    
97      #      #
98      # Get the user supplied parameters      # Get the user supplied parameters
99      #      #
100  ##    userParameters = self.getCommandLineParameters(self.ARGUMENTS[1:])      ##userParameters = self.getCommandLineParameters(self.ARGUMENTS[1:])
101    
102      # Hack for McMillan packaging on win32      # Hack for McMillan packaging on win32
103      # TODO: This was copied over from GFClient in forms; does PoS need it?      # TODO: This was copied over from GFClient in forms; does PoS need it?
# Line 121  class POSClient(GClientApp, events.Event Line 122  class POSClient(GClientApp, events.Event
122    
123      self.frontend.run()      self.frontend.run()
124    
125    
126    
127      #
128      # Load all the hardware from the config file
129      #
130      def _initHardware(self, registername):
131        options = gConfigDict()
132        mapping = {}
133    
134        for key in options.keys():
135          try:
136            p1, p2 = key.split("_",1)
137          except:
138            continue
139    
140          if p1.lower()[:6] == 'device':
141            try:
142              num = int(p1[6:])
143            except ValueError:
144              continue
145    
146            try:
147              mp = mapping[num]
148            except KeyError:
149              mp = {}
150              mapping[num] = mp
151    
152            mp[p2.lower()] = options[key]
153    
154    
155        for device, params in mapping.items():
156          dr = params['driver'].lower().replace('/','.')
157          try:
158            module = dyn_import('gnue.pointofsale.hardware.%s' % dr)
159          except ImportError, mesg:
160            GDebug.printMesg(5, mesg)
161            try:
162              module = dyn_import(dr)
163            except ImportError, mesg:
164              GDebug.printMesg(5, mesg)
165              self.handleStartupError('Unable to load device #%2d (%s) -- Driver not found' % (device, params['driver']))
166    
167          print "Loading hardware driver: %s" % params['driver']
168          module.Driver(self, params)
169    
170    
171  if __name__ == '__main__':  if __name__ == '__main__':
172    POSClient().run()    POSClient().run()
173    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26