components/desktop/os-welcome/files/os-next-steps.py
author Rich Burridge <rich.burridge@oracle.com>
Thu, 08 Sep 2016 09:15:40 -0700
changeset 6861 6110892450ff
parent 6645 d90f1572c3aa
child 7079 315c9793dc1e
permissions -rw-r--r--
22890928 deliver gawk section 3am man pages in /usr/share/man/man3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6645
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     1
#!/usr/bin/python2.7
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     2
# -*- coding: utf-8 -*-
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     3
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     4
#
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     5
# Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     6
#
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     7
# This program is free software; you can redistribute it and/or modify
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     8
# it under the terms of the GNU General Public License as published by
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     9
# the Free Software Foundation; either version 2 of the License, or
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    10
# (at your option) any later version.
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    11
#
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    12
# This program is distributed in the hope that it will be useful,
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    15
# GNU General Public License for more details.
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    16
#
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    18
# along with this program; if not, write to the Free Software
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    19
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    20
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    21
import locale
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    22
import gettext
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    23
from gettext import gettext as _
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    24
import os
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    25
import string
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    26
import re
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    27
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    28
import gi
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    29
gi.require_version('Gtk', '3.0')
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    30
from gi.repository import GObject, Gtk, Gdk, GdkPixbuf, Gio
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    31
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    32
def N_(message): return message
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    33
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    34
PACKAGE	  = "os-next-steps"
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    35
VERSION	  = "12"
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    36
GETTEXT_PACKAGE	  = "os-welcome"
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    37
LOCALEDIR = "/usr/share/locale"
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    38
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    39
release_string = "Oracle Solaris 12"
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    40
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    41
# There's probably a nicer way of including UTF-8 strings than this
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    42
bullet_point = u'\u2022'
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    43
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    44
default_link_color = Gdk.Color (0, 0, 65535)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    45
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    46
help_link= {
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    47
	'header' : N_("Get Help"),
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    48
	'icon' : "resources.png",
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    49
	'url_links' : [ ["http://docs.oracle.com/cd/E53394_01/pdf/E54847.pdf", N_("##What's new## with <b>Oracle Solaris 11.3</b>")], ["http://www.oracle.com/us/support/systems/index.html", N_("##Get world class support## with <b>Oracle Premier Support</b>")], ["https://localhost:6787/", N_("##Explore## the <b>Oracle Solaris Dashboard</b> with system analytics and more")] ],
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    50
}
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    51
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    52
personalize_link= {
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    53
	'header' : N_("Personalize"),
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    54
	'icon' : "personalize.png",
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    55
	'program_links' : [ ["gnome-appearance-properties.desktop", N_("##Change themes## with <b>System > Preferences > Appearance</b>")], ["at-properties.desktop", N_("##Enable Accessibility## with <b>System > Preferences > Assistive Technologies</b>")] ],
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    56
}
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    57
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    58
participate_link= {
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    59
	'header' : N_("Participate"),
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    60
	'icon' : "participate.png",
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    61
	'url_links' : [ ["https://community.oracle.com/community/server_%26_storage_systems/solaris", N_("##Join in on the discussion## of the <b>Oracle Solaris Forums</b>")], ["http://www.oracle.com/technetwork/server-storage/solaris11/community/index.html", N_("##Catch the latest## from the <b>Oracle Solaris Community</b>")] ],
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    62
}
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    63
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    64
ICON_PATH = "/usr/share/os-about/"
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    65
DESKTOP_ITEM_PATH = "/usr/share/applications/"
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    66
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    67
class WindowedLabel (Gtk.Label):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    68
    '''Custom Gtk.Label with an overlapping input-only Gdk.Window'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    69
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    70
    event_window = None
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    71
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    72
    def __init__ (self, debug = False):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    73
	'''Initialize object and plug all signals'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    74
	self.debug = debug
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    75
	super (WindowedLabel, self).__init__ ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    76
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    77
    def do_realize (self):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    78
	'''Create a custom GDK window with which we will be able to play'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    79
	Gtk.Label.do_realize (self)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    80
	event_mask = self.get_events () | Gdk.EventMask.BUTTON_PRESS_MASK \
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    81
					| Gdk.EventMask.BUTTON_RELEASE_MASK \
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    82
					| Gdk.EventMask.KEY_PRESS_MASK
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    83
	attr = Gdk.WindowAttr()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    84
	attr.window_type = Gdk.WindowType.CHILD
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    85
	attr.wclass = Gdk.WindowWindowClass.INPUT_ONLY
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    86
	attr.event_mask = event_mask
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    87
	attr.x = self.get_allocation().x
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    88
	attr.y = self.get_allocation().y
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    89
	attr.width = self.get_allocation().width
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    90
	attr.height = self.get_allocation().height
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    91
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    92
	self.event_window = Gdk.Window (
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    93
	    parent = self.get_parent_window (),
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    94
	    attributes = attr,
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    95
	    attributes_mask = (Gdk.WindowAttributesType.X |
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    96
			       Gdk.WindowAttributesType.Y)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    97
	    )
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    98
	self.event_window.set_user_data (self)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    99
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   100
    def do_unrealize (self):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   101
	'''Destroy event window on unrealize'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   102
	self.event_window.set_user_data (None)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   103
	self.event_window.destroy ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   104
	Gtk.Label.do_unrealize (self)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   105
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   106
    def do_size_allocate (self, allocation):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   107
	'''Move & resize the event window to fit the Label's one'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   108
	Gtk.Label.do_size_allocate (self, allocation)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   109
	if self.get_realized():
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   110
	    self.event_window.move_resize (allocation.x, allocation.y,
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   111
					   allocation.width, allocation.height)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   112
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   113
    def do_map (self):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   114
	'''Show event window'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   115
	Gtk.Label.do_map (self)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   116
	self.event_window.show ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   117
	'''Raise the event window to make sure it is over the Label's one'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   118
	self.event_window.raise_ ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   119
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   120
    def do_unmap (self):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   121
	'''Hide event window on unmap'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   122
	self.event_window.hide ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   123
	Gtk.Label.do_unmap (self)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   124
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   125
GObject.type_register (WindowedLabel)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   126
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   127
class HyperLink (WindowedLabel):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   128
    '''Clickable www link label'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   129
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   130
    url		= ""
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   131
    is_app_link = False
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   132
    menu	= None
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   133
    selection	= None
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   134
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   135
    def __init__ (self, label, url, app_link):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   136
	'''Initialize object'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   137
	super (HyperLink, self).__init__ ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   138
	markup = "<b><u>%s</u></b>" % label
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   139
	self.set_markup (markup)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   140
	self.set_selectable (True)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   141
	self.url = url
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   142
	self.is_app_link = app_link
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   143
	self.create_menu ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   144
	link_color = self.style_get_property ("link-color")
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   145
	if not link_color:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   146
	    link_color = default_link_color
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   147
	self.modify_fg (Gtk.StateType.NORMAL, link_color)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   148
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   149
    def open_url (self, *args):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   150
	'''Use GNOME API to open the url'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   151
	try:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   152
	    Gtk.show_uri (None, self.url, Gtk.get_current_event_time())
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   153
	except Exception, e:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   154
	    print '''Warning: could not open "%s": %s''' % (self.url, e)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   155
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   156
    def open_link (self, *args):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   157
	try:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   158
	    ditem = Gio.DesktopAppInfo.new (self.url)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   159
	    ditem.launch ([])
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   160
	except Exception, e:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   161
	    print '''Warning: could not execute file "%s" : %s''' % (self.url, e)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   162
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   163
    def copy_url (self, *args):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   164
	'''Copy URL to Clipboard'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   165
	clipboard = Gtk.clipboard_get ("CLIPBOARD")
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   166
	clipboard.set_text (self.url)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   167
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   168
    def create_menu (self):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   169
	'''Create the popup menu that will be displayed upon right click'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   170
	self.menu = Gtk.Menu ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   171
	if self.is_app_link:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   172
		open_item = Gtk.MenuItem (_("_Open Link"), use_underline = True)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   173
		open_item.connect ("activate", self.open_link)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   174
	else:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   175
		open_item = Gtk.MenuItem (_("_Open URL"), use_underline = True)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   176
		open_item.connect ("activate", self.open_url)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   177
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   178
	open_item.show ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   179
	self.menu.append (open_item)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   180
	copy_item = Gtk.MenuItem (_("_Copy URL"), use_underline = True)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   181
	copy_item.connect ("activate", self.copy_url)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   182
	copy_item.show ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   183
	self.menu.append (copy_item)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   184
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   185
    def display_menu (self, button, time, place = False):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   186
	'''Display utility popup menu'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   187
	if place:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   188
	    alloc = self.get_allocation ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   189
	    pos = self.event_window.get_origin ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   190
	    x = pos[0]
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   191
	    y = pos[1] + alloc.height
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   192
	    func = lambda *a: (x, y, True)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   193
	else:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   194
	    func = None
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   195
	self.menu.popup (None, None, func, None, button, time)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   196
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   197
    def do_map (self):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   198
	'''Select the HAND2 cursor on map'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   199
	WindowedLabel.do_map (self)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   200
	cursor = Gdk.Cursor.new(Gdk.CursorType.HAND2)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   201
	self.event_window.set_cursor (cursor)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   202
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   203
    def do_button_press_event (self, event):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   204
	'''Update selection bounds infos or display popup menu'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   205
	if event.button == 1:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   206
	    self.selection = self.get_selection_bounds ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   207
	elif event.button == 3:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   208
	    self.display_menu (event.button, event.time)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   209
	    return True
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   210
	WindowedLabel.do_button_press_event (self, event)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   211
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   212
    def do_button_release_event (self, event):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   213
	'''Open url if selection hasn't changed since initial press'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   214
	if event.button == 1:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   215
	    selection = self.get_selection_bounds ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   216
	    if selection == self.selection:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   217
		if self.is_app_link:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   218
			self.open_link ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   219
		else:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   220
			self.open_url ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   221
		return True
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   222
	WindowedLabel.do_button_release_event (self, event)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   223
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   224
    def do_key_press_event (self, event):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   225
	'''Open url when Return key is pressed'''
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   226
	if event.keyval == Gdk.KEY_Return:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   227
	    if self.is_app_link:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   228
		self.open_link ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   229
	    else:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   230
		self.open_url ()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   231
	    return True
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   232
	elif event.keyval == Gdk.KEY_Menu \
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   233
	  or (event.keyval == Gdk.KEY_F10 \
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   234
	      and event.get_state() & Gtk.accelerator_get_default_mod_mask() == \
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   235
		  Gdk.ModifierType.SHIFT_MASK):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   236
	    self.display_menu (event.keyval, event.time, place = True)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   237
	    return True
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   238
	WindowedLabel.do_key_press_event (self, event)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   239
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   240
GObject.type_register (HyperLink)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   241
class DialogOSNextSteps(Gtk.Dialog):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   242
	def __init__(self, parent=None):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   243
		Gtk.Dialog.__init__(self, self.__class__.__name__, parent, 0, None)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   244
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   245
		self.connect('destroy', lambda *w: Gtk.main_quit())
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   246
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   247
		Gtk.Window.set_default_icon_from_file ("/usr/share/os-about/about-os-window-icon.png")
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   248
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   249
		self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('white'))
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   250
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   251
		# Set the dialog default spacing for about
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   252
		self.set_title(_("Start here with Oracle Solaris 12"))
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   253
		self.set_border_width(5)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   254
		self.set_resizable(False)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   255
		self.vbox.set_border_width(2)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   256
		self.action_area.set_border_width(5)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   257
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   258
		vbox = Gtk.VBox(False, 8)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   259
		vbox.set_border_width(5)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   260
		self.vbox.pack_start(vbox, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   261
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   262
		# Logo
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   263
		logo = Gtk.Image()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   264
		pixbuf = GdkPixbuf.Pixbuf.new_from_file (ICON_PATH + "about-os-logo.png")
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   265
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   266
#		scale = 48.0 / pixbuf.get_height()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   267
#		width_scale = pixbuf.get_width() * scale
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   268
#		height_scale = pixbuf.get_height() * scale
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   269
#		pixbuf = pixbuf.scale_simple (int(width_scale), int(height_scale), GdkPixbuf.InterpType.BILINEAR)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   270
		logo.set_from_pixbuf (pixbuf)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   271
		logo_hbox = Gtk.HBox(True, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   272
		logo_hbox.pack_start(logo, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   273
		vbox.pack_start(logo_hbox, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   274
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   275
		close_button=self.add_button(Gtk.STOCK_CLOSE,Gtk.ResponseType.CANCEL)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   276
		self.set_default_response (Gtk.ResponseType.CANCEL)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   277
		close_button.grab_default()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   278
		close_button.grab_focus()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   279
		close_button.connect('clicked', lambda *w: Gtk.main_quit())
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   280
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   281
		self.create_section(help_link, vbox)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   282
		self.create_section(personalize_link, vbox)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   283
		self.create_section(participate_link, vbox)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   284
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   285
		self.show_all()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   286
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   287
	def create_section(self, section_link, vbox):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   288
		section_hbox = Gtk.HBox(False, 10)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   289
		vbox.pack_start(section_hbox, True, True, 10)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   290
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   291
		header = Gtk.Image()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   292
		header.set_from_file (ICON_PATH + section_link['icon'])
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   293
		section_hbox.pack_start(header, False, False, 2)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   294
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   295
		header_vbox = Gtk.VBox(False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   296
		section_hbox.pack_start(header_vbox, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   297
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   298
		label = Gtk.Label()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   299
		label.set_alignment(0, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   300
		label.set_markup("<span><b>%s</b></span>" % _(section_link['header']))
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   301
		label.set_justify(Gtk.Justification.LEFT)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   302
		header_vbox.pack_start(label, False, False, 2)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   303
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   304
		detail_vbox = Gtk.VBox(False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   305
		detail_vbox.set_spacing(2)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   306
		header_vbox.pack_start(detail_vbox, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   307
		self.fill_section(section_link, detail_vbox)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   308
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   309
	def fill_section (self, section_link, vbox):
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   310
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   311
		if 'program_links' in section_link:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   312
			for i in section_link['program_links']:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   313
				hbox = Gtk.HBox(False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   314
				label = Gtk.Label()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   315
				label.set_markup(bullet_point + " ")
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   316
				label.set_justify(Gtk.Justification.LEFT)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   317
				hbox.pack_start(label, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   318
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   319
				tmp = _(i[1]).split('##')
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   320
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   321
				label = Gtk.Label()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   322
				label.set_markup(tmp[0])
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   323
				hbox.pack_start(label, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   324
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   325
				link_button = HyperLink (tmp[1],i[0], True)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   326
				hbox.pack_start(link_button, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   327
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   328
				label = Gtk.Label()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   329
				label.set_markup(tmp[2])
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   330
				hbox.pack_start(label, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   331
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   332
				vbox.pack_start(hbox, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   333
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   334
		if 'url_links' in section_link:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   335
			for i in section_link['url_links']:
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   336
				hbox = Gtk.HBox(False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   337
				label = Gtk.Label()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   338
				label.set_markup(bullet_point + " ")
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   339
				label.set_justify(Gtk.Justification.LEFT)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   340
				hbox.pack_start(label, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   341
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   342
				tmp = _(i[1]).split('##')
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   343
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   344
				label = Gtk.Label()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   345
				label.set_markup(tmp[0])
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   346
				hbox.pack_start(label, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   347
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   348
				link_button = HyperLink (tmp[1], i[0], False)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   349
				hbox.pack_start(link_button, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   350
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   351
				label = Gtk.Label()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   352
				label.set_markup(tmp[2])
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   353
				hbox.pack_start(label, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   354
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   355
				vbox.pack_start(hbox, False, False, 0)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   356
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   357
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   358
def main():
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   359
	locale.setlocale (locale.LC_ALL, "")
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   360
	gettext.textdomain (GETTEXT_PACKAGE)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   361
	gettext.install (GETTEXT_PACKAGE, LOCALEDIR)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   362
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   363
	style_provider = Gtk.CssProvider()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   364
	css = """
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   365
	GtkDialog {
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   366
	  background-image: url('/usr/share/os-about/about-os-background.jpg');
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   367
	  background-position: left top;
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   368
	}
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   369
	"""
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   370
	style_provider.load_from_data(css)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   371
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   372
	Gtk.StyleContext.add_provider_for_screen(
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   373
		Gdk.Screen.get_default(),
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   374
		style_provider,
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   375
		Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   376
	)
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   377
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   378
	DialogOSNextSteps()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   379
	Gtk.main()
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   380
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   381
if __name__ == '__main__':
d90f1572c3aa 24450546 Move os-welcome to Userland and update it for S12 branding
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   382
	main()