/usr/bin/SEEL-panel-widget is in seelablet 0.1.9-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | #!/usr/bin/python3
from __future__ import print_function
import time,sys,string,serial.tools.list_ports
from threading import Thread
if sys.version_info.major < 3:
import gtk
import appindicator
else:
from gi.repository import Gtk as gtk
from gi.repository import AppIndicator3 as appindicator
from subprocess import call
class ThreadedLauncher(Thread):
def __init__(self,args):
self.args=args
Thread.__init__(self)
def run(self):
call(self.args)
class messenger():
def __init__(self):
self.ind = appindicator.Indicator("SEELablet-indicator", "SEELablet-menu", appindicator.CATEGORY_APPLICATION_STATUS)
#self.ind.set_status(appindicator.STATUS_ATTENTION)
self.ind.set_status(appindicator.STATUS_ACTIVE)
self.ind.set_attention_icon("system-devices-panel-alert")
self.ind.set_icon("system-devices-panel-information")
self.ind.set_label("SEEL")
self.menu_setup()
self.ind.set_menu(self.menu)
self.launched_threads = []
def menu_setup(self):
self.menu = gtk.Menu()
self.menu_entries=[]
self.menu_group=None
#self.devmenu = gtk.MenuItem('Devices')
#self.devmenu.show()
#self.devlist = gtk.Menu()
#self.devmenu.set_submenu(self.devlist)
#self.menu.append(self.devmenu)
self.__addsep__()
self.scope_menu = gtk.MenuItem(label="_Experiments_" , use_underline=True)
self.scope_menu.connect("activate", self.launch_experiments)
self.scope_menu.show()
self.menu.append(self.scope_menu)
self.__addsep__()
#add quit button
self.quit_item = gtk.MenuItem(label="_Quit_" , use_underline=True)
self.quit_item.connect("activate", self.quit)
self.quit_item.show()
self.menu.append(self.quit_item)
def __addsep__(self):
#add separator
sep = gtk.SeparatorMenuItem()
sep.show()
self.menu.append(sep) #add a separator
def launch_experiments(self,widget):
if self.menu_group:
for a in self.menu_group.get_group():
if a.get_active():
L = a.get_label()
T=ThreadedLauncher(["Experiments", "-P",L])
T.start()
self.launched_threads.append(T)
def main(self):
gtk.timeout_add(500, self.check_for_devices) #check every 500ms
gtk.main()
def check_for_devices(self):
#print ('check msg')
L = serial.tools.list_ports.comports()
shortlist=[]
for a in L:
if ('ACM' in a[1]) and ('04d8:00df' in a[2]):
shortlist.append(a)
total = len(shortlist)
for a in self.menu_entries[total:]:
self.menu.remove(a)
self.menu_entries = self.menu_entries[:total]
for a in range(total-len(self.menu_entries)):
rp=gtk.RadioMenuItem( label='assas',group=self.menu_group)
if self.menu_group==None:rp.set_active(True)
self.menu_group = rp
#menu_item.show()
rp.show()
self.menu.insert(rp,0)
self.menu_entries.append(rp)
for a in range(total):
self.menu_entries[a].set_label(shortlist[a][0])
#self.menu_entries[a].handler_disconnect(0)
#self.menu_entries[a].connect("activate", self.device_selected, a)
return True
def device_selected(self,devnum,num):
print (devnum,num)
def quit(self,widget):
print ('bye bye')
sys.exit(0)
A=messenger()
A.main()
|