Merge lp:~ralsina/ubuntuone-control-panel/fix_917322 into lp:ubuntuone-control-panel

Proposed by Roberto Alsina
Status: Merged
Approved by: Natalia Bidart
Approved revision: 258
Merged at revision: 255
Proposed branch: lp:~ralsina/ubuntuone-control-panel/fix_917322
Merge into: lp:ubuntuone-control-panel
Diff against target: 77 lines (+7/-13)
4 files modified
setup.py (+2/-1)
ubuntuone/controlpanel/gui/qt/main/__init__.py (+4/-0)
ubuntuone/controlpanel/gui/qt/main/linux.py (+0/-5)
ubuntuone/controlpanel/gui/qt/main/windows.py (+1/-7)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/fix_917322
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+89041@code.launchpad.net

Commit message

Use uncompressed resources and the same qss loading code in both platforms to avoid future inconsistencies.

Description of the change

IRL test:

python setup.py build
python bin/ubuntuone-control-panel-qt

See orange buttons? Yay! See gray buttons? Nay!

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

Can we have the stylesheet loading code in the multiplatform main (since now is the same code), and perhaps have the .qss name be platform-dependent (no need to do that last bit now - perhaps when we actually have 2 different qss)?

review: Needs Fixing
256. By Roberto Alsina

move qss loading into the cross-platform main

Revision history for this message
Roberto Alsina (ralsina) wrote :

> Looks good!
>
> Can we have the stylesheet loading code in the multiplatform main (since now
> is the same code), and perhaps have the .qss name be platform-dependent (no
> need to do that last bit now - perhaps when we actually have 2 different qss)?

Done in revno 256

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

ubuntuone/controlpanel/gui/qt/main/__init__.py:
    45: [E0602, main] Undefined variable 'QtCore'

ubuntuone/controlpanel/gui/qt/main/linux.py:
    20: [W0611] Unused import QtCore

ubuntuone/controlpanel/gui/qt/main/windows.py:
    19: [W0611] Unused import QtCore

nessita@dali:~/canonical/controlpanel/review_fix_917322$ DEBUG=True PYTHONPATH=. bin/ubuntuone-control-panel-qt
Traceback (most recent call last):
  File "bin/ubuntuone-control-panel-qt", line 63, in <module>
    with_icon=options.with_icon)
  File "/home/nessita/canonical/controlpanel/review_fix_917322/ubuntuone/controlpanel/gui/qt/main/__init__.py", line 45, in main
    qss = QtCore.QResource(":/ubuntuone.qss")
NameError: global name 'QtCore' is not defined

review: Needs Fixing
257. By Roberto Alsina

Note to self: when IRL testing on windows, make sure u1cp is not already running, or you will IRL test the old version

Revision history for this message
Roberto Alsina (ralsina) wrote :

Sorry, turns out that I really, really, really should take care to kill u1cp before doing IRL tests on windows ;-)

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

These lint issues are still present:

== Python Lint Notices ==

ubuntuone/controlpanel/gui/qt/main/linux.py:
    20: [W0611] Unused import QtCore

ubuntuone/controlpanel/gui/qt/main/windows.py:
    19: [W0611] Unused import QtCore

review: Needs Fixing
258. By Roberto Alsina

lint

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'setup.py'
2--- setup.py 2011-12-16 14:58:44 +0000
3+++ setup.py 2012-01-26 12:46:25 +0000
4@@ -116,7 +116,8 @@
5 path = os.getenv('PATH')
6 os.putenv('PATH', path + os.path.pathsep + os.path.join(
7 os.path.dirname(PyQt4.__file__), 'bin'))
8- if os.system('pyrcc4 "%s" -o "%s"' % (qrc_file, py_file)) > 0:
9+ if os.system('pyrcc4 -no-compress "%s" -o "%s"' %
10+ (qrc_file, py_file)) > 0:
11 self.warn('Unable to generate python module {py_file}'
12 ' for resource file {qrc_file}'.format(
13 py_file=py_file, qrc_file=qrc_file))
14
15=== modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py'
16--- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-01-04 11:43:14 +0000
17+++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-01-26 12:46:25 +0000
18@@ -18,6 +18,8 @@
19
20 import sys
21
22+from PyQt4 import QtCore
23+
24 # Module used to include the resources into this file
25 # Unused import images_rc, pylint: disable=W0611
26 from ubuntuone.controlpanel.gui.qt.ui import images_rc
27@@ -42,6 +44,8 @@
28 # The main loop MUST be initialized before importing the reactor
29 app = UniqueApplication(sys.argv, "ubuntuone-control-panel")
30 source.main(app)
31+ qss = QtCore.QResource(":/ubuntuone.qss")
32+ app.setStyleSheet(qss.data())
33
34 # Reimport 'qt4reactor', 'reactor', 'start', pylint: disable=W0404, F0401
35 import qt4reactor
36
37=== modified file 'ubuntuone/controlpanel/gui/qt/main/linux.py'
38--- ubuntuone/controlpanel/gui/qt/main/linux.py 2011-11-11 19:27:07 +0000
39+++ ubuntuone/controlpanel/gui/qt/main/linux.py 2012-01-26 12:46:25 +0000
40@@ -17,14 +17,9 @@
41 """Main method to be used on linux."""
42
43 from dbus.mainloop.qt import DBusQtMainLoop
44-from PyQt4 import QtCore
45
46
47 def main(app):
48 """Apply style sheet."""
49 # The DBus main loop MUST be initialized before importing the reactor
50 DBusQtMainLoop(set_as_default=True)
51-
52- # Apply Style Sheet -- The linux version may be different
53- qss = QtCore.QResource(":/ubuntuone.qss")
54- app.setStyleSheet(qss.data())
55
56=== modified file 'ubuntuone/controlpanel/gui/qt/main/windows.py'
57--- ubuntuone/controlpanel/gui/qt/main/windows.py 2011-11-11 19:40:10 +0000
58+++ ubuntuone/controlpanel/gui/qt/main/windows.py 2012-01-26 12:46:25 +0000
59@@ -16,7 +16,7 @@
60
61 """Main method to be used on windows."""
62
63-from PyQt4 import QtGui, QtCore
64+from PyQt4 import QtGui
65
66
67 def main(app):
68@@ -24,9 +24,3 @@
69 # Apply font to the entire application
70 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-R.ttf')
71 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-B.ttf')
72-
73- # Apply Style Sheet -- The windows version may be different
74- qss_file = QtCore.QFile(":/ubuntuone.qss")
75- qss_file.open(QtCore.QFile.ReadOnly)
76- stylesheet = QtCore.QLatin1String(qss_file.readAll())
77- app.setStyleSheet(stylesheet)

Subscribers

People subscribed via source and target branches