Merge lp:~tiagosh/checkbox/welcome-persist into lp:checkbox

Proposed by Tiago Salem Herrmann
Status: Merged
Merged at revision: 1331
Proposed branch: lp:~tiagosh/checkbox/welcome-persist
Merge into: lp:checkbox
Diff against target: 239 lines (+75/-7)
6 files modified
checkbox/user_interface.py (+1/-0)
checkbox_qt/qt_interface.py (+14/-2)
debian/changelog (+4/-0)
plugins/user_interface.py (+23/-0)
qt/frontend/qtfront.cpp (+27/-4)
qt/frontend/qtfront.h (+6/-1)
To merge this branch: bzr merge lp:~tiagosh/checkbox/welcome-persist
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+97729@code.launchpad.net

Description of the change

This MR will make the Qt Ui use the new persistent layer.
Additionally it will make the checkbox present at the bottom of the welcome screen work properly, remembering its value on future runs.

To post a comment you must log in.
lp:~tiagosh/checkbox/welcome-persist updated
1318. By Tiago Salem Herrmann

merge trunk

Revision history for this message
Daniel Manrique (roadmr) wrote :

OK, after some massaging to get this to merge against current trunk, it's now working, so I'll push it to trunk. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'checkbox/user_interface.py'
--- checkbox/user_interface.py 2012-03-07 21:24:47 +0000
+++ checkbox/user_interface.py 2012-03-15 19:42:04 +0000
@@ -68,6 +68,7 @@
68 self.title = title68 self.title = title
69 self.data_path = data_path69 self.data_path = data_path
70 self.progress = None70 self.progress = None
71 self.ui_flags = {}
7172
72 self.report_url = None73 self.report_url = None
73 self.direction = NEXT74 self.direction = NEXT
7475
=== modified file 'checkbox_qt/qt_interface.py'
--- checkbox_qt/qt_interface.py 2012-03-12 21:27:15 +0000
+++ checkbox_qt/qt_interface.py 2012-03-15 19:42:04 +0000
@@ -59,7 +59,10 @@
59 self.onClosedFrontend, "closedFrontend")59 self.onClosedFrontend, "closedFrontend")
60 self.bus.add_signal_receiver(60 self.bus.add_signal_receiver(
61 self.onReviewTestsClicked, "reviewTestsClicked")61 self.onReviewTestsClicked, "reviewTestsClicked")
62 self.bus.add_signal_receiver(
63 self.onWelcomeCheckboxToggled, "welcomeCheckboxToggled")
62 self.qtiface.setInitialState()64 self.qtiface.setInitialState()
65
63 self._set_main_title()66 self._set_main_title()
6467
65 def onReviewTestsClicked(self):68 def onReviewTestsClicked(self):
@@ -68,8 +71,14 @@
68 def onWelcomeScreenRequested(self):71 def onWelcomeScreenRequested(self):
69 pass72 pass
7073
71 def onClosedFrontend(self):74 def onWelcomeCheckboxToggled(self, checked):
72 self.direction = KeyboardInterrupt75 self.ui_flags["show_welcome_message"] = bool(checked)
76
77 def onClosedFrontend(self, finished):
78 if bool(finished):
79 self.direction = NEXT
80 else:
81 self.direction = KeyboardInterrupt
73 self.loop.quit()82 self.loop.quit()
7483
75 def _set_main_title(self, test_name=None):84 def _set_main_title(self, test_name=None):
@@ -99,6 +108,9 @@
99 #Reset window title108 #Reset window title
100 self._set_main_title()109 self._set_main_title()
101110
111 if not self.ui_flags == {}:
112 self.qtiface.setUiFlags(self.ui_flags)
113
102 self.qtiface.showText(text)114 self.qtiface.showText(text)
103 self.wait_on_signals(fullTestsClicked=onFullTestsClicked)115 self.wait_on_signals(fullTestsClicked=onFullTestsClicked)
104116
105117
=== modified file 'debian/changelog'
--- debian/changelog 2012-03-15 14:05:42 +0000
+++ debian/changelog 2012-03-15 19:42:04 +0000
@@ -7,6 +7,10 @@
7 plugins/user_interface.py, qt/frontend/qtfront.cpp, qt/frontend/qtfront.h:7 plugins/user_interface.py, qt/frontend/qtfront.cpp, qt/frontend/qtfront.h:
8 Correctly update automated test execution status in the Selection tab8 Correctly update automated test execution status in the Selection tab
9 (LP: #950105).9 (LP: #950105).
10 * set interface.direction to NEXT if all the tests were executed and the user
11 either analyzed or submitted the results. (LP: #956329)
12 * use the ui persistent storage to keep some ui configuration
13 values. (LP: #937626)
1014
11 [Jeff Lane]15 [Jeff Lane]
12 * Reset default checkbox log level to INFO from DEBUG to make logs less16 * Reset default checkbox log level to INFO from DEBUG to make logs less
1317
=== modified file 'plugins/user_interface.py'
--- plugins/user_interface.py 2012-03-07 21:24:47 +0000
+++ plugins/user_interface.py 2012-03-15 19:42:04 +0000
@@ -16,6 +16,7 @@
16# You should have received a copy of the GNU General Public License16# You should have received a copy of the GNU General Public License
17# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.17# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
18#18#
19from checkbox.contrib.persist import Persist, MemoryBackend
19from checkbox.plugin import Plugin20from checkbox.plugin import Plugin
20from checkbox.properties import Path, String21from checkbox.properties import Path, String
21from checkbox.user_interface import PREV22from checkbox.user_interface import PREV
@@ -44,9 +45,21 @@
44 # Path where data files are stored.45 # Path where data files are stored.
45 data_path = Path(required=False)46 data_path = Path(required=False)
4647
48 @property
49 def persist(self):
50 if self._persist is None:
51 self._persist = Persist(backend=MemoryBackend())
52
53 return self._persist.root_at("user_interface")
54
47 def register(self, manager):55 def register(self, manager):
48 super(UserInterface, self).register(manager)56 super(UserInterface, self).register(manager)
4957
58 self._persist = None
59
60 self._manager.reactor.call_on("prompt-begin", self.prompt_begin)
61 self._manager.reactor.call_on("stop", self.save_persist)
62 self._manager.reactor.call_on("begin-persist", self.begin_persist)
50 self._manager.reactor.call_on("run", self.run)63 self._manager.reactor.call_on("run", self.run)
51 self._manager.reactor.call_on("launchpad-report", self.launchpad_report)64 self._manager.reactor.call_on("launchpad-report", self.launchpad_report)
5265
@@ -58,6 +71,16 @@
58 #information about each job that completes71 #information about each job that completes
59 interface.update_status(job)72 interface.update_status(job)
6073
74 def begin_persist(self, persist):
75 self._persist = persist
76
77 def prompt_begin(self, interface):
78 self._interface.ui_flags = self.persist.get("ui_flags", {})
79
80 def save_persist(self, *args):
81 self.persist.set("ui_flags", self._interface.ui_flags)
82 self.persist.save()
83
61 def set_progress(self, progress):84 def set_progress(self, progress):
62 self._interface.progress = progress85 self._interface.progress = progress
63 86
6487
=== modified file 'qt/frontend/qtfront.cpp'
--- qt/frontend/qtfront.cpp 2012-03-08 17:15:05 +0000
+++ qt/frontend/qtfront.cpp 2012-03-15 19:42:04 +0000
@@ -39,7 +39,9 @@
39 m_model(0),39 m_model(0),
40 m_statusModel(new QStandardItemModel()),40 m_statusModel(new QStandardItemModel()),
41 m_currentTab(1),41 m_currentTab(1),
42 m_skipTestMessage(false)42 m_skipTestMessage(false),
43 isFirstTimeWelcome(true),
44 m_doneTesting(false)
43{45{
44 m_mainWindow = (QWidget*)new CustomQWidget();46 m_mainWindow = (QWidget*)new CustomQWidget();
45 ui->setupUi(m_mainWindow);47 ui->setupUi(m_mainWindow);
@@ -62,7 +64,8 @@
62 connect(ui->previousTestButton, SIGNAL(clicked()), this, SLOT(onPreviousTestClicked()));64 connect(ui->previousTestButton, SIGNAL(clicked()), this, SLOT(onPreviousTestClicked()));
63 connect(ui->buttonSubmitResults, SIGNAL(clicked()), this, SLOT(onSubmitTestsClicked()));65 connect(ui->buttonSubmitResults, SIGNAL(clicked()), this, SLOT(onSubmitTestsClicked()));
64 connect(ui->buttonViewResults, SIGNAL(clicked()), this, SLOT(onReviewTestsClicked()));66 connect(ui->buttonViewResults, SIGNAL(clicked()), this, SLOT(onReviewTestsClicked()));
65 connect(m_mainWindow, SIGNAL(closed()), this, SIGNAL(closedFrontend()));67 connect(m_mainWindow, SIGNAL(closed()), this, SLOT(onClosedFrontend()));
68 connect(ui->checkBox, SIGNAL(toggled(bool)), SIGNAL(welcomeCheckboxToggled(bool)));
66 connect(ui->treeView, SIGNAL(collapsed(QModelIndex)), this, SLOT(onJobItemChanged(QModelIndex)));69 connect(ui->treeView, SIGNAL(collapsed(QModelIndex)), this, SLOT(onJobItemChanged(QModelIndex)));
67 connect(ui->treeView, SIGNAL(expanded(QModelIndex)), this, SLOT(onJobItemChanged(QModelIndex)));70 connect(ui->treeView, SIGNAL(expanded(QModelIndex)), this, SLOT(onJobItemChanged(QModelIndex)));
68 connect(ui->treeView->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->statusView->verticalScrollBar(), SLOT(setValue(int)));71 connect(ui->treeView->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->statusView->verticalScrollBar(), SLOT(setValue(int)));
@@ -102,6 +105,18 @@
102105
103}106}
104107
108void QtFront::setUiFlags(QVariantMap flags)
109{
110 // process all ui flags
111 QVariant checked = flags["show_welcome_message"];
112 ui->checkBox->setChecked(checked.toBool());
113}
114
115void QtFront::onClosedFrontend()
116{
117 emit closedFrontend(m_doneTesting);
118}
119
105void QtFront::onSelectAllContextMenu(const QPoint& pos)120void QtFront::onSelectAllContextMenu(const QPoint& pos)
106{121{
107 if (currentState != TREE || !m_model)122 if (currentState != TREE || !m_model)
@@ -212,19 +227,28 @@
212{227{
213 ui->buttonSubmitResults->setEnabled(false);228 ui->buttonSubmitResults->setEnabled(false);
214 ui->lineEditEmailAddress->setEnabled(false);229 ui->lineEditEmailAddress->setEnabled(false);
230 m_doneTesting = true;
215 emit submitTestsClicked();231 emit submitTestsClicked();
216}232}
217233
218void QtFront::onReviewTestsClicked()234void QtFront::onReviewTestsClicked()
219{235{
236 m_doneTesting = true;
220 emit reviewTestsClicked();237 emit reviewTestsClicked();
221}238}
222239
223void QtFront::showText(QString text)240void QtFront::showText(QString text)
224{241{
225 if (currentState == WELCOME) {242 if (currentState == WELCOME) {
243 if(isFirstTimeWelcome) {
244 isFirstTimeWelcome = false;
245 if (ui->checkBox->isChecked()) {
246 QTimer::singleShot(100, this, SLOT(onFullTestsClicked()));
247 }
248 } else {
249 ui->tabWidget->setCurrentIndex(0);
250 }
226 m_mainWindow->show();251 m_mainWindow->show();
227 ui->tabWidget->setCurrentIndex(0);
228 ui->welcomeTextBox->setPlainText(text);252 ui->welcomeTextBox->setPlainText(text);
229 } else if (currentState == SUBMISSION) {253 } else if (currentState == SUBMISSION) {
230 ui->submissionWarningLabel->setText(text);254 ui->submissionWarningLabel->setText(text);
@@ -546,6 +570,5 @@
546 qDebug() << "error registering object";570 qDebug() << "error registering object";
547 return false;571 return false;
548 }572 }
549
550 return true;573 return true;
551}574}
552575
=== modified file 'qt/frontend/qtfront.h'
--- qt/frontend/qtfront.h 2012-03-08 17:15:05 +0000
+++ qt/frontend/qtfront.h 2012-03-15 19:42:04 +0000
@@ -51,6 +51,7 @@
51 QString getEmailAddress();51 QString getEmailAddress();
52 void showTest(QString purpose, QString steps, QString verification, QString info, QString testType, QString testName, bool enableTestButton);52 void showTest(QString purpose, QString steps, QString verification, QString info, QString testType, QString testName, bool enableTestButton);
53 QString showInfo(QString text, QStringList options, QString defaultoption);53 QString showInfo(QString text, QStringList options, QString defaultoption);
54 void setUiFlags(QVariantMap flags);
54 void updateAutoTestStatus(QString status, QString testName);55 void updateAutoTestStatus(QString status, QString testName);
5556
56private slots:57private slots:
@@ -69,6 +70,7 @@
69 void updateTestStatus(QStandardItem *item, QString status);70 void updateTestStatus(QStandardItem *item, QString status);
70 void updateTestStatus(QString status = QString());71 void updateTestStatus(QString status = QString());
71 void onSelectAllContextMenu(const QPoint& pos);72 void onSelectAllContextMenu(const QPoint& pos);
73 void onClosedFrontend();
7274
73signals:75signals:
74 void fullTestsClicked();76 void fullTestsClicked();
@@ -84,7 +86,8 @@
84 void welcomeScreenRequested();86 void welcomeScreenRequested();
85 // when the user clicks welcome from the tests selection tree87 // when the user clicks welcome from the tests selection tree
86 void welcomeClicked();88 void welcomeClicked();
87 void closedFrontend();89 void closedFrontend(bool testsFinished);
90 void welcomeCheckboxToggled(bool toogled);
8891
89private:92private:
90 bool registerService();93 bool registerService();
@@ -100,6 +103,8 @@
100 int m_currentTab;103 int m_currentTab;
101 bool m_skipTestMessage;104 bool m_skipTestMessage;
102 QString m_currentTestName;105 QString m_currentTestName;
106 bool isFirstTimeWelcome;
107 bool m_doneTesting;
103};108};
104109
105#endif // QTFRONT_H110#endif // QTFRONT_H

Subscribers

People subscribed via source and target branches