2007-01-10 22:19:05 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
# Copyright (C) 2007, Eduardo Silva (edsiper@gmail.com).
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
import os
|
|
|
|
import gtk
|
2007-03-10 04:39:55 +01:00
|
|
|
import pango
|
2007-01-10 22:19:05 +01:00
|
|
|
|
2007-03-10 23:16:40 +01:00
|
|
|
from label import Label
|
|
|
|
from label import Style
|
|
|
|
|
2007-01-10 22:19:05 +01:00
|
|
|
class XO_System(gtk.Fixed):
|
2007-03-10 04:39:55 +01:00
|
|
|
|
2007-01-10 22:19:05 +01:00
|
|
|
def __init__(self):
|
|
|
|
gtk.Fixed.__init__(self)
|
2007-03-10 04:39:55 +01:00
|
|
|
self.set_border_width(12)
|
2007-01-10 22:19:05 +01:00
|
|
|
|
2007-03-10 04:39:55 +01:00
|
|
|
table = gtk.Table(2, 2)
|
|
|
|
table.set_border_width(15)
|
|
|
|
table.set_col_spacings(7)
|
|
|
|
table.set_row_spacings(7)
|
|
|
|
|
|
|
|
# BUILD
|
2007-01-10 22:19:05 +01:00
|
|
|
build = self._get_system_build()
|
2007-03-10 23:16:40 +01:00
|
|
|
label_build = Label('OLPC Build:', Label.DESCRIPTION)
|
|
|
|
label_build_value = Label(str(build), Label.DESCRIPTION)
|
2007-03-10 04:39:55 +01:00
|
|
|
|
2007-03-29 03:50:25 +02:00
|
|
|
# FIRMWARE
|
|
|
|
firmware = self._get_firmware_version()
|
|
|
|
label_firmware = Label('XO Firmware:', Label.DESCRIPTION)
|
|
|
|
label_firmware_value = Label(firmware, Label.DESCRIPTION)
|
|
|
|
|
2007-03-10 04:39:55 +01:00
|
|
|
# KERNEL
|
|
|
|
sysinfo = os.uname()
|
2007-03-10 23:16:40 +01:00
|
|
|
label_kernel = Label('Kernel Version:', Label.DESCRIPTION)
|
|
|
|
label_kernel_value = Label(sysinfo[0] + '-' + sysinfo[2], Label.DESCRIPTION)
|
2007-01-10 22:19:05 +01:00
|
|
|
|
2007-03-10 04:39:55 +01:00
|
|
|
# OLPC Build
|
|
|
|
table.attach(label_build, 0, 1, 0, 1)
|
|
|
|
table.attach(label_build_value, 1,2, 0,1)
|
2007-03-29 03:50:25 +02:00
|
|
|
|
|
|
|
# XO Firmware
|
|
|
|
table.attach(label_firmware, 0, 1, 1, 2)
|
|
|
|
table.attach(label_firmware_value, 1, 2, 1, 2)
|
|
|
|
|
2007-03-10 04:39:55 +01:00
|
|
|
# Kernel Version
|
2007-03-29 03:50:25 +02:00
|
|
|
table.attach(label_kernel, 0, 1, 2, 3)
|
|
|
|
table.attach(label_kernel_value, 1, 2, 2, 3)
|
2007-01-10 22:19:05 +01:00
|
|
|
|
|
|
|
frame = gtk.Frame('System Information')
|
2007-03-10 23:16:40 +01:00
|
|
|
style = Style()
|
|
|
|
style.set_title_font(frame);
|
2007-03-10 04:39:55 +01:00
|
|
|
frame.add(table)
|
2007-01-10 22:19:05 +01:00
|
|
|
|
|
|
|
self.add(frame)
|
|
|
|
self.show_all()
|
|
|
|
|
|
|
|
def _get_system_build(self):
|
|
|
|
build_file_path = '/boot/olpc_build'
|
2007-03-29 03:50:25 +02:00
|
|
|
|
2007-01-10 22:19:05 +01:00
|
|
|
try:
|
|
|
|
f = open(build_file_path, 'r')
|
2007-03-10 04:39:55 +01:00
|
|
|
build = int(f.read())
|
2007-01-10 22:19:05 +01:00
|
|
|
f.close()
|
2007-03-29 03:50:25 +02:00
|
|
|
|
2007-01-10 22:19:05 +01:00
|
|
|
return build
|
|
|
|
except:
|
|
|
|
return "None"
|
2007-03-29 03:50:25 +02:00
|
|
|
|
|
|
|
# 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"
|
|
|
|
|