Below is the file 'System.py' from this revision. You can also download the file.
#!/usr/bin/env python # what do we need to track in System # # 1/ Location of Journal Store # 2/ Location of Ledger Store # 3/ Location of Chart of Accounts Store # # 4/ Max Journal ID # # # # Store as a shelf from time import time, sleep #FOO#DOOR = 1 #FOO#SWITCH = 2 #FOO#KEY = 3 TICK = 4 class System: def __init__(self): #VS self.events = [] # self.connected = False self.file = None self.db = None self.cursor = None self.store = None pass def status(self): pass def next_event(self, timeout = None): if timeout < 0: timeout = 0 if len(self.events) > 0: timeout = 0 # while True: # (r, _, _) = select([self.rfh], [], [], timeout) # if r: # self.get_response(async = True) # timeout = 0 # else: # break if len(self.events) == 0: return (TICK, time()) ret = self.events[0] del self.events[0] return ret