Ejemplo n.º 1
0
 def _updateSysinfo(self,  target):
     domain_info.doUpdate()
     self._labelPower.set_text('Bat: %s %%' %(domain_info.getSysinfo()['Battery'].strip()))
     
     for x in ['GPS', 'Bluetooth', 'WiFi']:
         if domain_info.getSysinfo()[x].strip().lower() == "true":
             color = 'blue'
         else:
             color = 'red'
         self._labelsStatus[x].set_markup('<span foreground="%s">%s</span>' %(color, x))
     self._labelGSM.set_text('GSM: %s %%' %(domain_info.getSysinfo()['GSM'].strip()))
     for table in self._infoTables.values():
         model = table.get_model()
         treeiter = model.get_iter_first()
         while treeiter:
             desc = model.get_value(treeiter, 0)
             model.set_value(treeiter, 1, domain_info.getSysinfo()[desc])
             treeiter = model.iter_next(treeiter)
Ejemplo n.º 2
0
    def _getSysinfoPanel(self):
        box = gtk.VBox(False, 5)
        
        self.infoLabels = {}
        self._infoTables = {}
        self._cell = {}
        if INFO_GROUPS.has_key('Status') and len(INFO_GROUPS['Status']) > 0:
            bStatus = gtk.HBox(True, 3)
            try:
                self._labelPower = gtk.Label('Bat: %s %%' %(domain_info.getSysinfo()['Battery'].strip()))
                bStatus.pack_start(self._labelPower, True, False, 0)
                self._labelsStatus = {}
                for x in ['GPS', 'Bluetooth', 'WiFi']:
                    self._labelsStatus[x] = gtk.Label() #x)
                    bStatus.pack_start(self._labelsStatus[x], True, False, 0)
                    if domain_info.getSysinfo()[x].strip().lower() == "true":
                        color = 'blue'
                    else:
                        color = 'red'
                    self._labelsStatus[x].set_markup('<span foreground="%s">%s</span>' %(color, x))
                self._labelGSM = gtk.Label('GSM: %s %%' %(domain_info.getSysinfo()['GSM'].strip()))
                bStatus.pack_end(self._labelGSM, True, False, 0)
            except KeyError:
                pass    # well; something is wrong in the config file :(
            
            box.pack_start(bStatus, False, True, 0)
            separator = gtk.HSeparator()
            box.pack_start(separator, False, True, 5)
        
        for group in INFO_GROUPS.keys():
            if group == 'Status':
                continue    # covered with extra box above
            if len(INFO_GROUPS[group]) > 0:
                infoHeading = gtk.Label() #"System information - %s" %(group))
                infoHeading.set_markup("<i>%s</i>" %(group));
                box.pack_start(infoHeading, False, False, 0)
                
                store = gtk.ListStore(str,str)
                
                for desc in INFO_GROUPS[group]:
#                    print ("appending %s %s" %(desc, domain_info.getSysinfo()[desc]))
                    store.append([desc, domain_info.getSysinfo()[desc]])

                self._infoTables[group] = gtk.TreeView(model=store)
                cell = gtk.CellRendererText()
                col = gtk.TreeViewColumn("Attribute", cell, text=0)
                col.pack_start(cell, False)
                self._infoTables[group].append_column(col)
                
                self._cell[desc] = gtk.CellRendererText()
                col = gtk.TreeViewColumn("Value", self._cell[desc], text=1)
                col.pack_start(self._cell[desc], True)
                self._infoTables[group].append_column(col)
                
                box.pack_start(self._infoTables[group], False, False, 0)
                separator = gtk.HSeparator()
                box.pack_start(separator, False, True, 5)

        boxButtons = gtk.HBox(False, 5)
        bAbout = gtk.Button('Update System Information from FreeRunner')
        bAbout.connect('clicked', self._updateSysinfo)
        boxButtons.pack_start(bAbout,  True,  False,  0)
        box.pack_start(boxButtons,  False,  False, 0)

        return box