~mvo/ubuntu-sso-client/strawman-lp711413

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/python

# ubuntu-sso-login-gui - GUI for registration and login for Ubuntu SSO
#
# Author: Natalia Bidart <natalia.bidart@canonical.com>
#
# Copyright 2010 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <http://www.gnu.org/licenses/>.
"""Script to run the Ubuntu SSO client GUI."""

import gtk
import sys

from ubuntu_sso.gui import UbuntuSSOClientGUI


APP_NAME = 'Ubuntu'
TC_URI = 'http://one.ubuntu.com/terms'
HELP_TEXT = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' \
            'Nam sed lorem nibh. Suspendisse gravida nulla non nunc suscipit' \
            ' pulvinar tempus ut augue.'

main_quit = lambda *args, **kwargs: gtk.main_quit()


if __name__ == '__main__':
    win = gtk.Window()
    win.set_title(APP_NAME)
    win.set_position(gtk.WIN_POS_CENTER)
    win.set_size_request(800, 600)
    win.show()
    xid = win.window.xid

    if len(sys.argv) > 1 and sys.argv[1] == '--login':
        app = UbuntuSSOClientGUI(close_callback=main_quit, app_name=APP_NAME,
                                 tc_uri=None, help_text=HELP_TEXT,
                                 window_id=xid, login_only=True)
    else:
        app = UbuntuSSOClientGUI(close_callback=main_quit, app_name=APP_NAME,
                                 tc_uri=TC_URI, help_text=HELP_TEXT,
                                 window_id=xid)
    gtk.main()