class maint_minder(): AFX_count = 1000 # CAL_count = 1000 def __init__(self): self.af_dir = os.getenv("AF_DIR",'c:/airfiber') self.AFX = Odometer(self.af_dir + "/odometer/AFX_FIXTURE.odo") self.CAL = Odometer(self.af_dir + "/odometer/CALIBRATION.odo") def maintTest(self): msg = "" if int(self.AFX.get_count()) >= self.AFX_count: msg = msg + "AFX Fixture Maintainence Required\n" # self.CAL.set_count(self.CAL_count) # fixture repair requires calibration # if int(self.CAL.get_count()) >= self.CAL_count: # msg = msg + "Station Calibration Required\n" if len(msg): pw = InfoWindow( None, 'Maintainence Required', msg) def bumpAFX(self): self.AFX.bump_count() def clearAFX(self): print "clearAFX" self.AFX.set_count(0) def bumpCAL(self): self.CAL.bump_count() def clearCAL(self): self.CAL.set_count(0)
class ConfigFrame(Frame): def __init__(self, parent, title, odo_name="" ): Frame.__init__(self, parent) self.op_id = StringVar() self.op_id.set("") self.odo = StringVar() self.odo.set("") self.description = StringVar() self.description.set("") self.swVer = StringVar() self.swVer.set("0.0.0") self.openOdometer(odo_name) self.title = Label(self, text=title); self.title.grid(row=0, column=0, columnspan=2) Separator(self, orient=HORIZONTAL).grid(row=1, column=0, columnspan=2, sticky="nsew") Label(self, text='Station ID: ').grid(row=2, column=0, sticky='w') self.desc = Label(self, textvariable=self.description); self.desc.grid(row=2, column=1, sticky='w') Label(self, text='Operator ID: ').grid(row=3, column=0, sticky='w') Label(self, textvariable=self.op_id).grid(row=3, column=1, sticky='w') Label(self, text='Odometer: ').grid(row=4, column=0, sticky='w') Label(self, textvariable=self.odo).grid(row=4, column=1, sticky='w') Label(self, text='Test Ver:').grid(row=5, column=0, sticky='w') Label(self, textvariable=self.swVer).grid(row=5, column=1, sticky='w') # Label(self, text='%s rev %(revno)s' % (release_tag, version_info)).grid(row=3, column=1, sticky='w') # remove build date as per Greg # Label(self, text='build date:').grid(row=6, column=0, sticky='w') # Label(self, text='%(date)s' % version_info).grid(row=6, column=1) self.grid() def openOdometer( self, odo_name ): self.odometer = Odometer(os.getenv("AF_DIR",'c:/airfiber') + "\odometer\odometer" + odo_name +".ini") self.SetOdometer( self.odometer.get_count() ) def SetDescription(self, id_str): self.description.set(id_str) self.update() def SetOperator(self, op_id): self.op_id.set( op_id ) self.update() def SetOdometer(self, odo): self.odo.set( odo ) self.update() def BumpOdometer(self): self.odometer.bump_count() self.SetOdometer( self.odometer.get_count() ) def SetswVer(self, swVer): self.swVer.set( swVer ) self.update()
class test_station_cfg(ConfigParser): def __init__(self, board_file='testconfig.ini'): ConfigParser.__init__(self) self.read(board_file) self.Odo = Odometer() self.odovalue = StringVar() self.odovalue.set(self.get_odometer()) def print_cfg(self): print 'version = ' + self.get('TS', 'config_version') print 'date = ' + self.get('TS', 'config_date') print 'desc = ' + self.get('TS', 'test_station_id') print 'db = ' + self.get('TS', 'test_db_dir') + self.get('TS', 'test_db_file') print 'com = ' + self.get('TS', 'com_port') print 'odometer= ' + self.get_odometer() def com_port(self): return self.get('TS', 'com_port') def test_database_path(self): return self.get('TS', 'test_db_dir') + self.get('TS', 'test_db_file') def date(self): return self.get('TS', 'config_date') def desc(self): return self.get('TS', 'test_station_id') def version(self): return self.get('TS', 'config_version') def get_odometer(self): return self.Odo.get_count() def bump_odometer(self): self.Odo.bump_count() self.odovalue.set(self.get_odometer())
class test_station_cfg(ConfigParser): def __init__(self, board_file='testconfig.ini'): ConfigParser.__init__(self) self.read(board_file) self.Odo = Odometer() self.odovalue = StringVar() self.odovalue.set(self.get_odometer()) def print_cfg(self): print 'version = ' + self.get('TS', 'config_version') print 'date = ' + self.get('TS', 'config_date') print 'desc = ' + self.get('TS', 'test_station_id') print 'db = ' + self.get('TS', 'test_db_dir') + self.get( 'TS', 'test_db_file') print 'com = ' + self.get('TS', 'com_port') print 'odometer= ' + self.get_odometer() def com_port(self): return self.get('TS', 'com_port') def test_database_path(self): return self.get('TS', 'test_db_dir') + self.get('TS', 'test_db_file') def date(self): return self.get('TS', 'config_date') def desc(self): return self.get('TS', 'test_station_id') def version(self): return self.get('TS', 'config_version') def get_odometer(self): return self.Odo.get_count() def bump_odometer(self): self.Odo.bump_count() self.odovalue.set(self.get_odometer())
class ConfigFrame(Frame): def __init__(self, parent, title, odo_name=""): Frame.__init__(self, parent) self.op_id = StringVar() self.op_id.set("") self.odo = StringVar() self.odo.set("") self.description = StringVar() self.description.set("") self.swVer = StringVar() self.swVer.set("0.0.0") self.openOdometer(odo_name) self.title = Label(self, text=title) self.title.grid(row=0, column=0, columnspan=2) Separator(self, orient=HORIZONTAL).grid(row=1, column=0, columnspan=2, sticky="nsew") Label(self, text='Station ID: ').grid(row=2, column=0, sticky='w') self.desc = Label(self, textvariable=self.description) self.desc.grid(row=2, column=1, sticky='w') Label(self, text='Operator ID: ').grid(row=3, column=0, sticky='w') Label(self, textvariable=self.op_id).grid(row=3, column=1, sticky='w') Label(self, text='Odometer: ').grid(row=4, column=0, sticky='w') Label(self, textvariable=self.odo).grid(row=4, column=1, sticky='w') Label(self, text='Test Ver:').grid(row=5, column=0, sticky='w') Label(self, textvariable=self.swVer).grid(row=5, column=1, sticky='w') # Label(self, text='%s rev %(revno)s' % (release_tag, version_info)).grid(row=3, column=1, sticky='w') # remove build date as per Greg # Label(self, text='build date:').grid(row=6, column=0, sticky='w') # Label(self, text='%(date)s' % version_info).grid(row=6, column=1) self.grid() def openOdometer(self, odo_name): self.odometer = Odometer( os.getenv("AF_DIR", 'c:/airfiber') + "\odometer\odometer" + odo_name + ".ini") self.SetOdometer(self.odometer.get_count()) def SetDescription(self, id_str): self.description.set(id_str) self.update() def SetOperator(self, op_id): self.op_id.set(op_id) self.update() def SetOdometer(self, odo): self.odo.set(odo) self.update() def BumpOdometer(self): self.odometer.bump_count() self.SetOdometer(self.odometer.get_count()) def SetswVer(self, swVer): self.swVer.set(swVer) self.update()