Merge lp:~kubuntu-packagers/apport/qt5 into lp:apport

Proposed by Harald Sitter on 2015-03-25
Status: Merged
Merged at revision: 2931
Proposed branch: lp:~kubuntu-packagers/apport/qt5
Merge into: lp:apport
Diff against target: 202 lines (+52/-64)
2 files modified
kde/apport-kde (+43/-43)
test/test_ui_kde.py (+9/-21)
To merge this branch: bzr merge lp:~kubuntu-packagers/apport/qt5
Reviewer Review Type Date Requested Status
Martin Pitt 2015-03-25 Approve on 2015-03-26
Dmitry Shachnev (community) Needs Fixing on 2015-03-25
Review via email: mp+254082@code.launchpad.net

Description of the Change

port apport-kde to qt5 (in fact it's qt-only now)

To post a comment you must log in.
Dmitry Shachnev (mitya57) :
review: Needs Fixing
Dmitry Shachnev (mitya57) wrote :

Also, the code still uses things like KMessageBox and KStandardGuiItem, even as they are no longer imported.

lp:~kubuntu-packagers/apport/qt5 updated on 2015-03-25
2933. By Harald Sitter on 2015-03-25

fix kmessagebox usage, load translations for qmessagebox, use explicit import

2934. By Harald Sitter on 2015-03-25

repair broken annotation

Martin Pitt (pitti) wrote :

LGTM, thank you! Merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'kde/apport-kde'
2--- kde/apport-kde 2015-02-06 07:42:03 +0000
3+++ kde/apport-kde 2015-03-25 15:37:32 +0000
4@@ -1,7 +1,8 @@
5 #!/usr/bin/python
6
7-'''KDE 4 Apport User Interface'''
8+'''Qt 5 Apport User Interface'''
9
10+# Copyright (C) 2015 Harald Sitter <sitter@kde.org>
11 # Copyright (C) 2007 - 2009 Canonical Ltd.
12 # Author: Richard A. Johnson <nixternal@ubuntu.com>
13 #
14@@ -17,16 +18,29 @@
15
16 try:
17 import apport
18- from PyQt4.QtCore import *
19- from PyQt4.QtGui import (QDialog, QLabel, QCheckBox, QRadioButton,
20- QTreeWidget, QTreeWidgetItem, QFileDialog,
21- QDialogButtonBox, QProgressBar, QLineEdit,
22- QPushButton, QIcon, QPainter, QMovie)
23- from PyQt4 import uic
24- from PyKDE4.kdecore import (ki18n, KAboutData, KCmdLineArgs,
25- KLocalizedString)
26- from PyKDE4.kdeui import (KApplication, KMessageBox, KIcon,
27- KStandardGuiItem)
28+ from PyQt5.QtCore import (QByteArray,
29+ QLibraryInfo,
30+ QLocale,
31+ Qt,
32+ QTimer,
33+ QTranslator)
34+ from PyQt5.QtGui import (QIcon,
35+ QMovie,
36+ QPainter)
37+ from PyQt5.QtWidgets import (QApplication,
38+ QCheckBox,
39+ QDialog,
40+ QDialogButtonBox,
41+ QLabel,
42+ QLineEdit,
43+ QMessageBox,
44+ QProgressBar,
45+ QPushButton,
46+ QRadioButton,
47+ QTreeWidget,
48+ QTreeWidgetItem,
49+ QFileDialog)
50+ from PyQt5 uic
51 import apport.ui
52 from apport import unicode_gettext as _
53 import sip
54@@ -372,10 +386,10 @@
55 return return_value
56
57 def ui_info_message(self, title, text):
58- KMessageBox.information(None, _(text), _(title))
59+ QMessageBox.information(None, _(title), _(text))
60
61 def ui_error_message(self, title, text):
62- KMessageBox.information(None, _(text), _(title))
63+ QMessageBox.information(None, _(title), _(text))
64
65 def ui_start_info_collection_progress(self):
66 # show a spinner if we already have the main window
67@@ -396,13 +410,13 @@
68 self.progress.set()
69 self.progress.show()
70
71- KApplication.processEvents()
72+ QApplication.processEvents()
73
74 def ui_pulse_info_collection_progress(self):
75 if self.progress:
76 self.progress.set()
77 # for a spinner we just need to handle events
78- KApplication.processEvents()
79+ QApplication.processEvents()
80
81 def ui_stop_info_collection_progress(self):
82 if self.progress:
83@@ -412,7 +426,7 @@
84 self.dialog.movie.stop()
85 self.dialog.spinner.hide()
86
87- KApplication.processEvents()
88+ QApplication.processEvents()
89
90 def ui_start_upload_progress(self):
91 self.progress = ProgressDialog(
92@@ -427,18 +441,17 @@
93 self.progress.set(progress)
94 else:
95 self.progress.set()
96- KApplication.processEvents()
97+ QApplication.processEvents()
98
99 def ui_stop_upload_progress(self):
100 self.progress.hide()
101
102 def ui_question_yesno(self, text):
103- response = KMessageBox.questionYesNoCancel(
104- None, _(text), '', KStandardGuiItem.yes(), KStandardGuiItem.no(),
105- KStandardGuiItem.cancel())
106- if response == KMessageBox.Yes:
107+ response = QMessageBox.question(None, '', 'text',
108+ QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
109+ if response == QMessageBox.Yes:
110 return True
111- if response == KMessageBox.No:
112+ if response == QMessageBox.No:
113 return False
114 return None
115
116@@ -504,27 +517,14 @@
117 if not os.environ.get('DISPLAY'):
118 apport.fatal('This program needs a running X session. Please see "man apport-cli" for a command line version of Apport.')
119
120- appName = 'apport-kde'
121- catalog = 'apport'
122- programName = ki18n(b'Apport KDE')
123- version = '1.0'
124- description = ki18n(b'KDE 4 frontend for the apport crash report system')
125- license = KAboutData.License_GPL
126- copyright = ki18n(b'2009 Canonical Ltd.')
127- text = KLocalizedString()
128- homePage = 'https://wiki.ubuntu.com/Apport'
129- bugEmail = 'kubuntu-devel@lists.ubuntu.com'
130-
131- aboutData = KAboutData(appName, catalog, programName, version, description,
132- license, copyright, text, homePage, bugEmail)
133-
134- aboutData.addAuthor(ki18n(b'Richard A. Johnson'), ki18n(b'Author'))
135- aboutData.addAuthor(ki18n(b'Michael Hofmann'), ki18n(b'Original Qt4 Author'))
136-
137- KCmdLineArgs.init([''], aboutData)
138-
139- app = KApplication()
140- app.setWindowIcon(KIcon('apport'))
141+ app = QApplication(sys.argv)
142+ app.setApplicationName('apport-kde')
143+ app.setApplicationDisplayName(_('Apport'))
144+ app.setWindowIcon(QIcon.fromTheme('apport'))
145+ translator = QTranslator()
146+ translator.load("qtbase_" + QLocale.system().name(),
147+ QLibraryInfo.location(QLibraryInfo.TranslationsPath))
148+ app.installTranslator(translator)
149
150 UserInterface = MainUserInterface()
151 sys.exit(UserInterface.run_argv())
152
153=== modified file 'test/test_ui_kde.py'
154--- test/test_ui_kde.py 2013-08-30 10:40:19 +0000
155+++ test/test_ui_kde.py 2015-03-25 15:37:32 +0000
156@@ -1,5 +1,6 @@
157-'''KDE 4 Apport User Interface tests'''
158+'''Qt 5 Apport User Interface tests'''
159
160+# Copyright (C) 2015 Harald Sitter <sitter@kde.org>
161 # Copyright (C) 2012 Canonical Ltd.
162 # Author: Evan Dandrea <evan.dandrea@canonical.com>
163 #
164@@ -17,10 +18,8 @@
165
166 from mock import patch
167 try:
168- from PyQt4.QtCore import QTimer, QCoreApplication
169- from PyQt4.QtGui import QTreeWidget
170- from PyKDE4.kdecore import ki18n, KCmdLineArgs, KAboutData, KLocalizedString
171- from PyKDE4.kdeui import KApplication
172+ from PyQt5.QtCore import QTimer, QCoreApplication
173+ from PyQt5.QtGui import QApplication, QTreeWidget, QIcon
174 except ImportError as e:
175 sys.stderr.write('SKIP: PyQt/PyKDE not available: %s\n' % str(e))
176 sys.exit(0)
177@@ -592,20 +591,9 @@
178 self.assertFalse(self.app.dialog.send_error_report.isVisible())
179 self.assertFalse(self.app.dialog.send_error_report.isChecked())
180
181-appName = 'apport-kde'
182-catalog = 'apport'
183-programName = ki18n(b'Apport KDE')
184-version = '1.0'
185-description = ki18n(b'KDE 4 frontend tests for the apport')
186-license = KAboutData.License_GPL
187-copyright = ki18n(b'2012 Canonical Ltd.')
188-text = KLocalizedString()
189-homePage = 'https://wiki.ubuntu.com/AutomatedProblemReports'
190-bugEmail = 'kubuntu-devel@lists.ubuntu.com'
191-
192-aboutData = KAboutData(appName, catalog, programName, version, description,
193- license, copyright, text, homePage, bugEmail)
194-
195-KCmdLineArgs.init([''], aboutData)
196-app = KApplication()
197+app = QApplication(sys.argv)
198+app.applicationName = 'apport-kde'
199+app.applicationDisplayName = _('Apport')
200+app.windowIcon = QIcon.fromTheme('apport')
201+
202 unittest.main()

Subscribers

People subscribed via source and target branches