Ejemplo n.º 1
0
	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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
	def on_channel_change(self,widget=None,data=None):
		if self.channel: 
			self.channel.stop()
		self.builder.get_object('btn_channels_start').set_sensitive(True)
		self.builder.get_object('btn_channel_defsave').set_sensitive(True)
		self.builder.get_object('btn_channel_save').set_sensitive(True)
		self.builder.get_object('btn_channel_load').set_sensitive(True)
		ls_channels = self.builder.get_object('ls_channels')
		self.channel = channels.get_class(ls_channels.get_value(widget.get_active_iter(), 0))()
		self.update_channel_config_list()
Ejemplo n.º 4
0
 def on_channel_change(self, widget=None, data=None):
     if self.channel:
         self.channel.stop()
     self.builder.get_object('btn_channels_start').set_sensitive(True)
     self.builder.get_object('btn_channel_defsave').set_sensitive(True)
     self.builder.get_object('btn_channel_save').set_sensitive(True)
     self.builder.get_object('btn_channel_load').set_sensitive(True)
     ls_channels = self.builder.get_object('ls_channels')
     self.channel = channels.get_class(
         ls_channels.get_value(widget.get_active_iter(), 0))()
     self.update_channel_config_list()
Ejemplo n.º 5
0
		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('Test of `%s`\n' % chanlist[a])
chan = theclass()

config_list = chan.get_config_list()

sys.stdout.write('\nYou should probably change the configuration.\nType `l` if you want to load a file.\n')
if sys.stdin.readline() == 'l\n':
	sys.stdout.write('    OK, type the name of the file: ');
Ejemplo n.º 6
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('Test of `%s`\n' % chanlist[a])
chan = theclass()

config_list = chan.get_config_list()

sys.stdout.write(
    '\nYou should probably change the configuration.\nType `l` if you want to load a file.\n'
)