Merge lp:~agateau/ubiquity/kde-fix-keyboard-selection-glitch into lp:ubiquity

Proposed by Aurélien Gâteau
Status: Work in progress
Proposed branch: lp:~agateau/ubiquity/kde-fix-keyboard-selection-glitch
Merge into: lp:ubiquity
Diff against target: 46 lines (+25/-3)
1 file modified
ubiquity/plugins/ubi-console-setup.py (+25/-3)
To merge this branch: bzr merge lp:~agateau/ubiquity/kde-fix-keyboard-selection-glitch
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Needs Resubmitting
Rohan Garg (community) Approve
Review via email: mp+218569@code.launchpad.net

Description of the change

The keyboard layout combobox used to refresh its content every time it is changed. This breaks manipulating the combobox with the arrow keys. With this patch the keyboard layout and keyboard variant comboboxes are only updated if the new content differs.

To post a comment you must log in.
Revision history for this message
Rohan Garg (rohangarg) wrote :

Looks good to me.

review: Approve
Revision history for this message
Jonathan Riddell (jr) wrote :

Trying to recreate this issue with trusty images running ubiquity 2.18.7 and 2.18.8 I could successfully change the keyboard selection with the keyboard. I didn't notice any difference when applying this patch. tested on virtualbox.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

The development of ubiquity has moved to git, still hosted on
launchpad. If this merge proposal is still relevant, please resubmit
it against the git branches found at
https://code.launchpad.net/ubiquity

Sorry for any inconvenience caused.

review: Needs Resubmitting

Unmerged revisions

6187. By Aurélien Gâteau

Avoid glitch when changing keyboard layout

The keyboard layout combobox used to refresh its content every time it is
changed. This breaks manipulating the combobox with the arrow keys. With this
patch the keyboard layout and keyboard variant comboboxes are only updated if
the new content differs.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubiquity/plugins/ubi-console-setup.py'
2--- ubiquity/plugins/ubi-console-setup.py 2013-06-07 12:11:18 +0000
3+++ ubiquity/plugins/ubi-console-setup.py 2014-05-07 08:29:54 +0000
4@@ -320,7 +320,31 @@
5 if layout is not None and variant is not None:
6 self.controller.dbfilter.apply_keyboard(layout, variant)
7
8+ def _update_combobox(self, combobox, new_lst):
9+ """
10+ Updates the items of a combobox, but only if the new item list is
11+ different. Not updating the items if the list is the same avoids
12+ triggering signals about current item changes which break keyboard
13+ navigation.
14+
15+ Returns True if the list has changed, False if not.
16+ """
17+ old_lst = []
18+ for idx in range(combobox.count()):
19+ old_lst.append(combobox.itemText(idx))
20+
21+ new_lst = [misc.utf8(x) for x in sorted(new_lst)]
22+
23+ if old_lst == new_lst:
24+ return False
25+ combobox.clear()
26+ combobox.addItems(new_lst)
27+ return True
28+
29 def set_keyboard_choices(self, choices):
30+ has_changed = self._update_combobox(self.page.keyboard_layout_combobox, choices)
31+ if not has_changed:
32+ return
33 self.page.keyboard_layout_combobox.clear()
34 for choice in sorted(choices):
35 self.page.keyboard_layout_combobox.addItem(misc.utf8(choice))
36@@ -347,9 +371,7 @@
37 return str(self.page.keyboard_layout_combobox.currentText())
38
39 def set_keyboard_variant_choices(self, choices):
40- self.page.keyboard_variant_combobox.clear()
41- for choice in sorted(choices):
42- self.page.keyboard_variant_combobox.addItem(misc.utf8(choice))
43+ self._update_combobox(self.page.keyboard_variant_combobox, choices)
44
45 @plugin.only_this_page
46 def set_keyboard_variant(self, variant):

Subscribers

People subscribed via source and target branches

to status/vote changes: