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

Proposed by Roberto Alsina
Status: Merged
Approved by: Natalia Bidart
Approved revision: 270
Merged at revision: 268
Proposed branch: lp:~ralsina/ubuntuone-control-panel/quit-quit-quit
Merge into: lp:ubuntuone-control-panel
Diff against target: 32 lines (+14/-0)
2 files modified
ubuntuone/controlpanel/gui/qt/gui.py (+4/-0)
ubuntuone/controlpanel/gui/qt/tests/test_gui.py (+10/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/quit-quit-quit
Reviewer Review Type Date Requested Status
Natalia Bidart Approve
dobey (community) Approve
Review via email: mp+95020@code.launchpad.net

Commit message

- Added keyboard shortcuts for quitting the control panel (LP: #900753).

Description of the change

Add keyboard shortcuts for quitting the control panel (Ctrl+w and Ctrl+q).

To test IRL, start it and press Ctrl+q (or Ctrl+w)

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve
268. By Roberto Alsina

close the window instead of quitting the app

269. By Roberto Alsina

moved stuff to MainWindow

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

Could you please remove the leftover in diff line 8?

+ quit_action = None

Thanks!

review: Needs Fixing
270. By Roberto Alsina

removed leftover

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

Looks great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/gui.py'
2--- ubuntuone/controlpanel/gui/qt/gui.py 2012-02-17 14:42:57 +0000
3+++ ubuntuone/controlpanel/gui/qt/gui.py 2012-02-28 21:33:17 +0000
4@@ -32,6 +32,10 @@
5 self.ui.setupUi(self)
6 self.close_callback = close_callback
7 self._setup()
8+ self.quit_action = QtGui.QAction(self,
9+ triggered=self.close)
10+ self.quit_action.setShortcuts(["Ctrl+q", "Ctrl+w"])
11+ self.addAction(self.quit_action)
12
13 def _setup(self):
14 """Do some extra setupping for the UI."""
15
16=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_gui.py'
17--- ubuntuone/controlpanel/gui/qt/tests/test_gui.py 2011-08-26 17:16:16 +0000
18+++ ubuntuone/controlpanel/gui/qt/tests/test_gui.py 2012-02-28 21:33:17 +0000
19@@ -48,3 +48,13 @@
20 self.ui.ui.control_panel.ui.signin.signinCanceled.emit()
21 self.assertEqual(len(self._called[0]), 1)
22 self.assertIsInstance(self._called[0][0], gui.QtGui.QCloseEvent)
23+
24+ def test_quit_action(self):
25+ """Check that the app can quit using the keyboard."""
26+ self.assertEqual(self.ui.quit_action.shortcuts(),
27+ ["Ctrl+q", "Ctrl+w"])
28+ self.ui.close_callback = self._set_called
29+ self.ui.quit_action.trigger()
30+ self.assertFalse(self.ui.isVisible())
31+ self.assertEqual(self._called,
32+ ((), {}), 'close_callback called.')

Subscribers

People subscribed via source and target branches