Merge lp:~tiagosh/checkbox/dbus-timeout into lp:checkbox

Proposed by Tiago Salem Herrmann
Status: Merged
Merged at revision: 1350
Proposed branch: lp:~tiagosh/checkbox/dbus-timeout
Merge into: lp:checkbox
Diff against target: 127 lines (+34/-6)
4 files modified
checkbox_qt/qt_interface.py (+23/-2)
debian/changelog (+4/-0)
qt/frontend/qtfront.cpp (+3/-2)
qt/frontend/qtfront.h (+4/-2)
To merge this branch: bzr merge lp:~tiagosh/checkbox/dbus-timeout
Reviewer Review Type Date Requested Status
TienFu Chen (community) Approve
Review via email: mp+98881@code.launchpad.net

Commit message

fix some dbus timeouts that could make it impossible for an user to recover from a previous session

Description of the change

This MR fixes some dbus timeouts that could make it impossible to recover from a previous session if an user takes more than 15 seconds to decide between "Recover" and "Restart".

To post a comment you must log in.
Revision history for this message
TienFu Chen (ctf) wrote :

I built the package for Precise and verified the patch, works fine.
Tiago, thanks for the work.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox_qt/qt_interface.py'
2--- checkbox_qt/qt_interface.py 2012-03-21 09:23:09 +0000
3+++ checkbox_qt/qt_interface.py 2012-03-22 17:07:20 +0000
4@@ -36,13 +36,18 @@
5
6 OPTION_TO_ANSWER = dict((o, a)
7 for a, o in ANSWER_TO_OPTION.items())
8+def dummy_handle_reply(r=None):
9+ return
10
11+def dummy_handle_error(e=None):
12+ return
13
14 class QTInterface(UserInterface):
15 def __init__(self, title, data_path):
16 super(QTInterface, self).__init__(title, data_path)
17 self._app_title = title
18 notReady = True
19+ infoResult = None
20 while notReady:
21 try:
22 self.bus = dbus.SessionBus(mainloop=DBusGMainLoop())
23@@ -233,10 +238,26 @@
24 return False
25
26 def show_info(self, text, options=[], default=None):
27- return self.qtiface.showInfo(text, options, default)
28+ def onInfoBoxResult(result):
29+ self.infoResult = str(result)
30+ self.loop.quit()
31+
32+ self.qtiface.showInfo(text, options, default,
33+ reply_handler=dummy_handle_reply,
34+ error_handler=dummy_handle_error)
35+ self.wait_on_signals(
36+ infoBoxResult=onInfoBoxResult)
37+ return self.infoResult
38
39 def show_error(self, text):
40- self.qtiface.showError(text)
41+ def onErrorBoxClosed():
42+ self.loop.quit()
43+
44+ self.qtiface.showError(text,
45+ reply_handler=dummy_handle_reply,
46+ error_handler=dummy_handle_error)
47+ self.wait_on_signals(
48+ errorBoxClosed=onErrorBoxClosed)
49
50 def update_status(self, job):
51 if 'type' in job and job["type"] == "test":
52
53=== modified file 'debian/changelog'
54--- debian/changelog 2012-03-21 22:09:17 +0000
55+++ debian/changelog 2012-03-22 17:07:20 +0000
56@@ -13,6 +13,10 @@
57 checkbox_qt/qt_interface.py, plugins/jobs_prompt.py: The selection tree is
58 now updated when recovering from a previous run (LP: #937696)
59
60+ [Tiago Salem Herrmann]
61+ * checkbox_qt/qt_interface.py, qt/frontend/qtfront.cpp, qt/frontend/qtfront.h:
62+ Do async calls to some ui methods and avoid unexpected dbus timeouts (LP: #962333)
63+
64 -- Jeff Lane <jeff@ubuntu.com> Wed, 21 Mar 2012 18:08:46 -0400
65
66 checkbox (0.13.5) precise; urgency=low
67
68=== modified file 'qt/frontend/qtfront.cpp'
69--- qt/frontend/qtfront.cpp 2012-03-20 22:31:41 +0000
70+++ qt/frontend/qtfront.cpp 2012-03-22 17:07:20 +0000
71@@ -245,6 +245,7 @@
72 void QtFront::showError(QString text)
73 {
74 QMessageBox::critical(ui->tabWidget, "Error", text);
75+ emit errorBoxClosed();
76 }
77
78 void QtFront::setWindowTitle(QString title)
79@@ -515,7 +516,7 @@
80 }
81 }
82
83-QString QtFront::showInfo(QString text, QStringList options, QString defaultoption)
84+void QtFront::showInfo(QString text, QStringList options, QString defaultoption)
85 {
86 // workaround, show the main window if the welcome screen wasn't shown yet
87 m_mainWindow->show();
88@@ -532,7 +533,7 @@
89 dialog->exec();
90 QString result = buttonMap[dialog->clickedButton()];
91 delete dialog;
92- return result;
93+ emit infoBoxResult(result);
94 }
95
96 QString QtFront::getEmailAddress()
97
98=== modified file 'qt/frontend/qtfront.h'
99--- qt/frontend/qtfront.h 2012-03-20 22:31:41 +0000
100+++ qt/frontend/qtfront.h 2012-03-22 17:07:20 +0000
101@@ -44,7 +44,7 @@
102 void showText(QString text);
103 void setWindowTitle(QString title);
104 void startProgressBar(QString text);
105- void showError(QString text);
106+ Q_NOREPLY void showError(QString text);
107 void stopProgressBar();
108 void showTree(QString text, QVariantMap options, QVariantMap defaults);
109 void showEntry(QString text);
110@@ -54,7 +54,7 @@
111 void showTest(QString purpose, QString steps, QString verification, QString info, QString comment, QString testType, QString testName, bool enableTestButton);
112 void showTestControls(bool enableTestControls);
113 void setFocusTestYesNo(bool status);
114- QString showInfo(QString text, QStringList options, QString defaultoption);
115+ Q_NOREPLY void showInfo(QString text, QStringList options, QString defaultoption);
116 void setUiFlags(QVariantMap flags);
117 void updateAutoTestStatus(QString status, QString testName);
118
119@@ -87,6 +87,8 @@
120 void reviewTestsClicked();
121 void closedFrontend(bool testsFinished);
122 void welcomeCheckboxToggled(bool toogled);
123+ void infoBoxResult(QString result);
124+ void errorBoxClosed();
125
126 private:
127 bool registerService();

Subscribers

People subscribed via source and target branches