~evfool/ubuntuone-control-panel/fix729530

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
# -*- coding: utf-8 -*-

# Authors: Natalia B 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/>.
"""Execute the graphical interface for the Ubuntu One control panel."""

# Invalid name "ubuntuone-control-panel-gtk", pylint: disable=C0103

import sys

import dbus.mainloop.glib

from optparse import OptionParser

from ubuntuone.controlpanel.gtk.gui import ControlPanelWindow

dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)


def parser_options():
    """Parse command line parameters."""
    usage = "Usage: %prog [option]"
    result = OptionParser(usage=usage)
    result.add_option("", "--switch-to", dest="switch_to", type="string",
                      metavar="PANEL_NAME",
                      help="Start the Ubuntu One Control Panel (GTK) in the "
                           "PANEL_NAME tab. Possible values are: "
                           "dashboard, volumes, devices, applications")
    result.add_option("-a", "--alert", dest="alert", action="store_true",
                      help="Start the Ubuntu One Control Panel (GTK) alerting "
                      "the user to its presence.")
    return result


if __name__ == "__main__":
    parser = parser_options()
    (options, args) = parser.parse_args(sys.argv)
    gui = ControlPanelWindow(switch_to=options.switch_to, alert=options.alert)
    gui.main()