~evfool/ubuntuone-control-panel/fix729530

1 by natalia.bidart at canonical
Initial directory structure for new project.
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
4
# Authors: Natalia B Bidart <natalia.bidart@canonical.com>
5
#
6
# Copyright 2010 Canonical Ltd.
7
#
8
# This program is free software: you can redistribute it and/or modify it
9
# under the terms of the GNU General Public License version 3, as published
10
# by the Free Software Foundation.
11
#
12
# This program is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranties of
14
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15
# PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with this program.  If not, see <http://www.gnu.org/licenses/>.
19
"""Execute the graphical interface for the Ubuntu One control panel."""
20
32.2.6 by Natalia B. Bidart
Fixing lint issues.
21
# Invalid name "ubuntuone-control-panel-gtk", pylint: disable=C0103
22
48.2.1 by Natalia B. Bidart
Added a command line option to start the UI on a given panel (LP: #702968).
23
import sys
24
3.1.11 by natalia.bidart at canonical
Import fail!
25
import dbus.mainloop.glib
1 by natalia.bidart at canonical
Initial directory structure for new project.
26
48.2.1 by Natalia B. Bidart
Added a command line option to start the UI on a given panel (LP: #702968).
27
from optparse import OptionParser
28
29
from ubuntuone.controlpanel.gtk.gui import ControlPanelWindow
1 by natalia.bidart at canonical
Initial directory structure for new project.
30
3.1.11 by natalia.bidart at canonical
Import fail!
31
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1 by natalia.bidart at canonical
Initial directory structure for new project.
32
32.2.2 by Natalia B. Bidart
Fixing u1lint issues.
33
48.2.1 by Natalia B. Bidart
Added a command line option to start the UI on a given panel (LP: #702968).
34
def parser_options():
35
    """Parse command line parameters."""
36
    usage = "Usage: %prog [option]"
50.1.5 by natalia.bidart at canonical
Fised lint warnings.
37
    result = OptionParser(usage=usage)
38
    result.add_option("", "--switch-to", dest="switch_to", type="string",
48.2.1 by Natalia B. Bidart
Added a command line option to start the UI on a given panel (LP: #702968).
39
                      metavar="PANEL_NAME",
40
                      help="Start the Ubuntu One Control Panel (GTK) in the "
48.2.2 by Natalia B. Bidart
Added a missing space.
41
                           "PANEL_NAME tab. Possible values are: "
50.1.2 by natalia.bidart at canonical
Adding is_processing flag to UbuntuOneBin to be able to unify loading messages.
42
                           "dashboard, volumes, devices, applications")
90.2.8 by eric.casteleijn at canonical
made --alert a boolean option and added -a shortcut
43
    result.add_option("-a", "--alert", dest="alert", action="store_true",
90.2.1 by eric.casteleijn at canonical
added attention seeking option
44
                      help="Start the Ubuntu One Control Panel (GTK) alerting "
90.2.8 by eric.casteleijn at canonical
made --alert a boolean option and added -a shortcut
45
                      "the user to its presence.")
50.1.5 by natalia.bidart at canonical
Fised lint warnings.
46
    return result
48.2.1 by Natalia B. Bidart
Added a command line option to start the UI on a given panel (LP: #702968).
47
48
1 by natalia.bidart at canonical
Initial directory structure for new project.
49
if __name__ == "__main__":
48.2.1 by Natalia B. Bidart
Added a command line option to start the UI on a given panel (LP: #702968).
50
    parser = parser_options()
51
    (options, args) = parser.parse_args(sys.argv)
90.2.1 by eric.casteleijn at canonical
added attention seeking option
52
    gui = ControlPanelWindow(switch_to=options.switch_to, alert=options.alert)
32.2.2 by Natalia B. Bidart
Fixing u1lint issues.
53
    gui.main()