Console: new label with XO Firmware version

This commit is contained in:
Eduardo Silva 2007-03-28 21:50:25 -04:00
parent 1352e5be94
commit b36af52f52
2 changed files with 37 additions and 13 deletions

View File

@ -23,6 +23,8 @@ import string
import gobject import gobject
import drwarea import drwarea
import procmem
class CPU_Usage: class CPU_Usage:
CPU_HZ = 0 CPU_HZ = 0
@ -105,12 +107,12 @@ class XO_CPU(gtk.Frame):
self.add(fixed) self.add(fixed)
DRW_CPU = CPU_Usage() self._DRW_CPU = CPU_Usage()
DRW_CPU.frequency = 1000 # 1 Second self._DRW_CPU.frequency = 1000 # 1 Second
gobject.timeout_add(DRW_CPU.frequency, self._update_cpu_usage, DRW_CPU) gobject.timeout_add(self._DRW_CPU.frequency, self._update_cpu_usage)
def _update_cpu_usage(self, DRW_CPU): def _update_cpu_usage(self):
redraw_all = False redraw_all = False
@ -123,7 +125,7 @@ class XO_CPU(gtk.Frame):
else: else:
length = len(self._cpu_buffer) - 1 length = len(self._cpu_buffer) - 1
self._cpu = DRW_CPU._get_CPU_usage() self._cpu = self._DRW_CPU._get_CPU_usage()
self._cpu_buffer.append(self._cpu) self._cpu_buffer.append(self._cpu)
self._updated = True self._updated = True
@ -160,10 +162,10 @@ class XO_CPU(gtk.Frame):
draw_all = True draw_all = True
else: else:
draw_all = False draw_all = False
context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height)
context.clip() context.clip()
# Drawing horizontal and vertical border lines # Drawing horizontal and vertical border lines
self.dat.draw_border_lines(context) self.dat.draw_border_lines(context)
@ -251,3 +253,4 @@ class XO_CPU(gtk.Frame):
freq+=1 freq+=1
context.stroke() context.stroke()

View File

@ -39,6 +39,11 @@ class XO_System(gtk.Fixed):
label_build = Label('OLPC Build:', Label.DESCRIPTION) label_build = Label('OLPC Build:', Label.DESCRIPTION)
label_build_value = Label(str(build), Label.DESCRIPTION) label_build_value = Label(str(build), Label.DESCRIPTION)
# FIRMWARE
firmware = self._get_firmware_version()
label_firmware = Label('XO Firmware:', Label.DESCRIPTION)
label_firmware_value = Label(firmware, Label.DESCRIPTION)
# KERNEL # KERNEL
sysinfo = os.uname() sysinfo = os.uname()
label_kernel = Label('Kernel Version:', Label.DESCRIPTION) label_kernel = Label('Kernel Version:', Label.DESCRIPTION)
@ -47,10 +52,14 @@ class XO_System(gtk.Fixed):
# OLPC Build # OLPC Build
table.attach(label_build, 0, 1, 0, 1) table.attach(label_build, 0, 1, 0, 1)
table.attach(label_build_value, 1,2, 0,1) table.attach(label_build_value, 1,2, 0,1)
# XO Firmware
table.attach(label_firmware, 0, 1, 1, 2)
table.attach(label_firmware_value, 1, 2, 1, 2)
# Kernel Version # Kernel Version
table.attach(label_kernel, 0, 1, 1, 2) table.attach(label_kernel, 0, 1, 2, 3)
table.attach(label_kernel_value, 1, 2, 1, 2) table.attach(label_kernel_value, 1, 2, 2, 3)
frame = gtk.Frame('System Information') frame = gtk.Frame('System Information')
style = Style() style = Style()
@ -62,13 +71,25 @@ class XO_System(gtk.Fixed):
def _get_system_build(self): def _get_system_build(self):
build_file_path = '/boot/olpc_build' build_file_path = '/boot/olpc_build'
try: try:
f = open(build_file_path, 'r') f = open(build_file_path, 'r')
build = int(f.read()) build = int(f.read())
f.close() f.close()
return build return build
except: except:
return "None" return "None"
# Get XO Firmware Versions
def _get_firmware_version(self):
try:
# Shell command
cmd = "/usr/sbin/olpc-bios-sig"
data = os.popen(cmd).readlines()
return data[0].strip()
except:
return "None"