Package: reportbug Version: 11.1.0 Followup-For: Bug #813771 Control: retitle -1 reportbug: Make the MenuPage of ui_gtk be intutive to use,please. Control: severity -1 wishlist Tags: patch Dear Maintainer, As articles threading of this bug reports, the operation of unselecting all the items in MenuPage of ui_gtk is not intuitive. Indeed I looked around the documents as below - a lot of documents about gtk3 - Gnome Human Interface Guidelines - other documents in GNOME.ORG, but I couldn't find any hints about manipulating to unselect in the MenuPages, which consists of gtk treeview. In the "urwid" of the UI of reportbug, the MenuPage consists of checkboxes and radio buttons. This UI is much easier to understand the operation. Then I suggest the MenuPage of ui_gtk also should consist of checkboxes and radio buttons. I will attach the patch to realize my suggestion. And also, I will attach the screenshots of the MenuPage of ui_gtk, which this patch provides. How to Apply this patch: After cloning the latest reportbug source from https://salsa.debian.org/reportbug-team/reportbug.git and do "git am" as below, git-am <attached patch> Would you please consider applying for this patch and releasing a newer version of reportbug? -- Takahide Nojima -- Package-specific info: ** Environment settings: INTERFACE="gtk" ** /home/nojima/.reportbugrc: reportbug_version "11.1.0" mode standard ui text realname "Takahide Nojima" email "nozzy123nozzy@gmail.com" mua 'evolution' smtptls -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 5.14.0-4-amd64 (SMP w/8 CPU threads) Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages reportbug depends on: ii apt 2.3.12 ii python3 3.9.8-1 ii python3-reportbug 11.1.0 ii sensible-utils 0.0.17 reportbug recommends no packages. Versions of packages reportbug suggests: pn claws-mail <none> ii debconf 1.5.79 pn debsums <none> pn default-mta | postfix | exim4 | mail-transport-agent <none> pn dlocate <none> pn emacs-bin-common <none> ii file 1:5.41-2 ii gnupg 2.2.27-2 ii python3-urwid 2.1.2-2 pn reportbug-gtk <none> ii xdg-utils 1.1.3-4.1 Versions of packages python3-reportbug depends on: ii apt 2.3.12 ii file 1:5.41-2 ii python3 3.9.8-1 ii python3-apt 2.3.0+b1 ii python3-debian 0.1.42 ii python3-debianbts 3.2.0 ii python3-requests 2.25.1+dfsg-2 ii sensible-utils 0.0.17 python3-reportbug suggests no packages. -- no debconf information
From a6e7b1d476855d4c733d5e9bdd0f4e143254a826 Mon Sep 17 00:00:00 2001 From: Takahide Nojima <nozzy123nozzy@gmail.com> Date: Sun, 14 Nov 2021 01:29:51 +0900 Subject: Add checkboxes or radio buttons on "MenuPage" of gtk_ui.py to operate intutively. Closes: #813771 Signed-off-by: Takahide Nojima <nozzy123nozzy@gmail.com> --- debian/changelog | 6 ++++ reportbug/ui/gtk_ui.py | 66 ++++++++++++++++++++++++++++++++---------- 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index e219914..8738dce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +reportbug (11.1.1) UNRELEASED; urgency=medium + + * reportbug/ui/gtk_ui.py: Add checkboxies or radiobuttons on MenuPage to allow a user to operate intutively (Close: #813771) + + -- Takahide Nojima <nozzy123nozzy@gmail.com> Wed, 17 Nov 2021 05:40:54 +0000 + reportbug (11.1.0) unstable; urgency=medium [ Nelson A. de Oliveira ] diff --git a/reportbug/ui/gtk_ui.py b/reportbug/ui/gtk_ui.py index 82bea30..9556c61 100644 --- a/reportbug/ui/gtk_ui.py +++ b/reportbug/ui/gtk_ui.py @@ -939,15 +939,22 @@ class GetListPage(TreePage): class WrapRendererText(Gtk.CellRendererText): def do_render(self, cr, widget, background_area, cell_area, flags): _assert_context(ui_context) - self.set_property('wrap-width', cell_area.width) Gtk.CellRendererText.do_render(self, cr, widget, background_area, cell_area, flags) GObject.type_register(WrapRendererText) -class MenuPage(TreePage): - value_column = 0 +class MenuPage(Page): + value_column = 1 + + def __init__(self, *args, **kwargs): + _assert_context(ui_context) + Page.__init__(self, *args, **kwargs) + + def setup_focus(self): + _assert_context(ui_context) + self.view.grab_focus() def create_widget(self): _assert_context(ui_context) @@ -959,33 +966,49 @@ class MenuPage(TreePage): self.view = Gtk.TreeView() self.view.set_rules_hint(True) + self.view.get_selection().set_mode(Gtk.SelectionMode.NONE) + self.chkbox = Gtk.CellRendererToggle() scrolled = create_scrollable(self.view) scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS) vbox.pack_start(scrolled, True, True, 0) vbox.show_all() return vbox + def get_value(self): + _assert_context(ui_context) + result = [] + for row in self.model: + if row[0]: + result.append(markup_free(row[self.value_column])) + if len(result)>0 and not self.multiple: + return result[0] + return result + def connect_signals(self): _assert_context(ui_context) - TreePage.connect_signals(self) - self.view.connect('row-activated', self.activate_forward) + self.chkbox.connect('toggled', self.on_toggle) + + def _is_sutable_radio_button(self): + return not self.multiple and not self.empty_ok def execute(self, par, options, prompt, default=None, any_ok=False, order=None, extras=None, multiple=False): _assert_context(ui_context) GLib.idle_add(self.label.set_text, par) - self.model = Gtk.ListStore(str, str) + self.model = Gtk.ListStore(bool, str, str) self.view.set_model(self.model) - - if multiple: - self.selection.set_mode(Gtk.SelectionMode.MULTIPLE) - - self.view.append_column(Gtk.TreeViewColumn('Option', Gtk.CellRendererText(), markup=0)) + self.multiple=multiple + self.chkbox.set_radio(self._is_sutable_radio_button()) + self.view.append_column(Gtk.TreeViewColumn('Sel', self.chkbox, active=0)) + self.view.append_column(Gtk.TreeViewColumn('Option', Gtk.CellRendererText(), markup=1)) rend = WrapRendererText() rend.set_property('wrap-mode', Pango.WrapMode.WORD) rend.set_property('wrap-width', 300) - self.view.append_column(Gtk.TreeViewColumn('Description', rend, text=1)) + # prevent wired streching size of column every click on radio-button. + desc_column=Gtk.TreeViewColumn('Description', rend, text=2) + desc_column.set_resizable(False) + self.view.append_column(desc_column) default_iter = None # here below, 'text' is the value of the description of the item, but @@ -995,25 +1018,36 @@ class MenuPage(TreePage): for option in order: if option in options: text = ' '.join(options[option].split()) - iter = self.model.append((highlight(option), text)) + iter = self.model.append([False, highlight(option), text]) if option == default: default_iter = iter for option, desc in options.items(): if not order or option not in order: text = ' '.join(desc.split()) - iter = self.model.append((highlight(option), text)) + iter = self.model.append([False, highlight(option), text]) if option == default: default_iter = iter else: for row in options: text = ' '.join(row[1].split()) - iter = self.model.append((highlight(row[0]), text)) + iter = self.model.append([False, highlight(row[0]), text]) if row[0] == default: default_iter = iter if default_iter: - self.selection.select_iter(default_iter) + self.model.set_value(default_iter,0,True) + + self.validate() + def on_toggle(self, widget, path): + if self._is_sutable_radio_button(): + selected_path = Gtk.TreePath(path) + for row in self.model: + row[0] = row.path == selected_path + else: + self.model[path][0] = not self.model[path][0] + + self.validate() class HandleBTSQueryPage(TreePage): default_complete = True -- 2.33.1
Attachment:
Screenshot from 2021-11-21 15-54-25.png
Description: PNG image
Attachment:
Screenshot from 2021-11-21 15-55-07.png
Description: PNG image