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
54
55
56
57
58
59
|
# -*- coding: utf-8 -*-
#
# Copyright 2011 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/>.
"""Provide the correct ui main module."""
import sys
from PyQt4 import QtCore
# Module used to include the resources into this file
# Unused import images_rc, pylint: disable=W0611
from ubuntuone.controlpanel.gui.qt.ui import images_rc
# pylint: enable=W0611
from ubuntuone.controlpanel.gui.qt.uniqueapp import UniqueApplication
# Invalid name "source", pylint: disable=C0103
if sys.platform == 'win32':
from ubuntuone.controlpanel.gui.qt.main import windows
source = windows
else:
from ubuntuone.controlpanel.gui.qt.main import linux
source = linux
# pylint: enable=C0103
def main(switch_to='', alert=False, minimized=False, with_icon=False):
"""Start the Qt mainloop and open the main window."""
# The following cannot be imported outside this function
# because u1trial already provides a reactor.
app = UniqueApplication(sys.argv, "ubuntuone-control-panel")
source.main(app)
qss = QtCore.QResource(":/ubuntuone.qss")
app.setStyleSheet(qss.data())
from ubuntuone.controlpanel.gui.qt.gui import start
# Unused variable 'window', 'icon', pylint: disable=W0612
icon, window = start(lambda: source.main_quit(app),
minimized=minimized, with_icon=with_icon)
# pylint: enable=W0612
if icon:
app.new_instance.connect(icon.restore_window)
source.main_start(app)
|