def __init__(self): # Current channel self.channel = None # Default config try: configfile = open(os.path.expanduser('~/.irismonitor/default_channel.json')) jsondata = configfile.read() self.channel = eval(json.loads(jsondata)[0] + '()') self.channel.get_config_list().load(jsondata) configfile.close() except IOError: pass # Available channels index = None i = 0 ls_channels = self.builder.get_object("ls_channels") chans = channels.get_list() for x in chans: ls_channels.append((x, channels.get_class(x).__doc__)) if self.channel and x == self.channel.__class__.__name__: index = i i += 1 if index: widget = self.builder.get_object("combo_channels") widget.set_active(index) self.on_channel_change(widget)
def __init__(self): # Current channel self.channel = None # Default config try: configfile = open( os.path.expanduser('~/.irismonitor/default_channel.json')) jsondata = configfile.read() self.channel = eval(json.loads(jsondata)[0] + '()') self.channel.get_config_list().load(jsondata) configfile.close() except IOError: pass # Available channels index = None i = 0 ls_channels = self.builder.get_object("ls_channels") chans = channels.get_list() for x in chans: ls_channels.append((x, channels.get_class(x).__doc__)) if self.channel and x == self.channel.__class__.__name__: index = i i += 1 if index: widget = self.builder.get_object("combo_channels") widget.set_active(index) self.on_channel_change(widget)
import viewers, decoders, channels print 'Iris monitor first main' print 'Available viewers are :' for v in viewers.get_list(): print '\t%s' % v print 'Available decoders are :' for d in decoders.get_list(): print '\t%s' % d print 'Available channels are :' for c in channels.get_list(): print '\t%s' % c
onReceive_col += 1 sys.stdout.write("0x%02X" % ord(byte)) if ord(byte) > 31 and ord(byte) < 127: sys.stdout.write("(") sys.stdout.write(byte) sys.stdout.write(") ") else : sys.stdout.write(" ") if onReceive_col == 8: onReceive_col = 0 sys.stdout.write("\n") events.register(channels.IrisChannel, 'onReceive', onReceive) sys.stdout.write('Available channels are :\n') i = 0 chanlist = channels.get_list() for c in chanlist: sys.stdout.write(' %3d %s\n' % (i, c)) i += 1 sys.stdout.write('Which one would be tested ? ') try: a = int(sys.stdin.readline()) theclass = channels.get_class(chanlist[a]) except ValueError: sys.exit('Invalid number.\n') except IndexError: sys.exit('Unknowed entry.\n') except KeyboardInterrupt: sys.exit('Interrupted test.\n')
sys.stdout.write("0x%02X" % ord(byte)) if ord(byte) > 31 and ord(byte) < 127: sys.stdout.write("(") sys.stdout.write(byte) sys.stdout.write(") ") else: sys.stdout.write(" ") if onReceive_col == 8: onReceive_col = 0 sys.stdout.write("\n") events.register(channels.IrisChannel, 'onReceive', onReceive) sys.stdout.write('Available channels are :\n') i = 0 chanlist = channels.get_list() for c in chanlist: sys.stdout.write(' %3d %s\n' % (i, c)) i += 1 sys.stdout.write('Which one would be tested ? ') try: a = int(sys.stdin.readline()) theclass = channels.get_class(chanlist[a]) except ValueError: sys.exit('Invalid number.\n') except IndexError: sys.exit('Unknowed entry.\n') except KeyboardInterrupt: sys.exit('Interrupted test.\n')