14
14
# You should have received a copy of the GNU General Public License along
15
15
# with this program. If not, see <http://www.gnu.org/licenses/>.
17
"""Provide the correct reactor and ui integration."""
17
"""Provide the correct ui main module."""
39
39
def main(switch_to='', alert=False, minimized=False, with_icon=False):
40
"""Start the Qt reactor and open the main window."""
40
"""Start the Qt mainloop and open the main window."""
41
41
# The following cannot be imported outside this function
42
42
# because u1trial already provides a reactor.
44
# The main loop MUST be initialized before importing the reactor
45
44
app = UniqueApplication(sys.argv, "ubuntuone-control-panel")
47
47
qss = QtCore.QResource(":/ubuntuone.qss")
48
48
app.setStyleSheet(qss.data())
50
# Reimport 'qt4reactor', 'reactor', 'start', pylint: disable=W0404, F0401
54
from twisted.internet import reactor
55
50
from ubuntuone.controlpanel.gui.qt.gui import start
56
# pylint: enable=W0404, F0401
58
# Module 'reactor' has no 'run'/'stop' member, pylint: disable=E1101
60
52
# Unused variable 'window', 'icon', pylint: disable=W0612
61
icon, window = start(reactor.stop,
53
icon, window = start(lambda: source.main_quit(app),
62
54
minimized=minimized, with_icon=with_icon)
63
55
# pylint: enable=W0612
65
57
app.new_instance.connect(icon.restore_window)
68
# pylint: enable=E1101
59
source.main_start(app)