# -*- coding: utf-8 -*-
#
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import locale
import gettext
import subprocess
import string
import re
import gi
# This is the only release string we need to change. Otherwise we
# refer to both releases as 'Oracle Solaris' to cut down on localization
# We don't technically use this string at the moment, but this
# may change
def get_machine_info():
# This is gross, assumes the file output is regular
if file_buffer is None:
return _("Unknown")
else:
def get_solaris_version():
"-a", "name=pkg.human-version", "-o", "value",
"entire"],
if p.returncode == 0:
return stdoutdata.rstrip()
else:
return release_string
def get_machine_memory():
# This is also gross, assumes the file output is regular
else:
KILOBYTE_FACTOR = 1024.0
if size < KILOBYTE_FACTOR:
return _("%u bytes") % size
else:
if size < MEGABYTE_FACTOR:
return _("%.1f KB") % displayed_size
elif size < GIGABYTE_FACTOR:
return _("%.1f MB") % displayed_size
else:
return _("%.1f GB") % displayed_size
# Set the dialog default spacing for about
# Logo
# System Information
# Add some vertical space with an empty hbox
# Version
release_label.set_markup("<span size=\"small\"><b>%s:</b></span> <span size=\"small\">%s</span>" % (_(release_text), get_solaris_version()))
# Used Space
used_label.set_markup("<span size=\"small\"><b>%s:</b></span> <span size=\"small\">%s</span>" % (_(space_text), format_size_for_display(used)))
# Available Space
avail_label.set_markup("<span size=\"small\"><b>%s:</b></span> <span size=\"small\">%s</span>" % (_(available_text), format_size_for_display(avail)))
# Memory Information
memory_label.set_markup("<span size=\"small\"><b>%s:</b></span> <span size=\"small\">%s</span>" % (_(memory_text), get_machine_memory()))
return None
"file:///usr/share/doc/os-welcome/html/index.html",
return None
def main():
css = """
GtkDialog {
background-image: url('/usr/share/os-about/about-os-background.jpg');
background-position: left top;
}
GtkTextView, GtkScrolledWindow {
background: none;
border: none;
}
"""
)
if __name__ == '__main__':
main()