-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 3 Sep 2008 14:09:52 +0200
Luca Bruno <[EMAIL PROTECTED]> wrote:

> Fixed in patch 0001.
> 
> 0002 patch:
> Uses a list instead of an editor for CC addresses, which is less error prone.
> We can yet specify the mode to get_multiline and use the list for < ADVANCED 
> users and the editor for >= ADVANCED users,
> or if you don't like it just drop the patch.
> 
> 0003 patch:
> small but important bug fixes
> 

0001: should be applied because it fixes some bugs
0002: when listing bugs, you can now filter the results

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAki+9MUACgkQw9Qj+8Kak3FFiwCeK4TaJkRe+GjKa+pELSkKSoaw
DdYAnjyGiH5x7vI7AOu5k9O6q1JcAOQF
=bbA8
-----END PGP SIGNATURE-----
From 498e772cb8268b46f509f29bf19effab42115ce6 Mon Sep 17 00:00:00 2001
From: Luca Bruno <[EMAIL PROTECTED]>
Date: Wed, 3 Sep 2008 20:58:51 +0200
Subject: [PATCH] gtk2: fixed SyncReturn and increase Page.next_page_num when really switching the assistant page

---
 debian/changelog        |    1 +
 reportbug/ui/gtk2_ui.py |   14 +++++---------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 475ca37..799d4d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -40,6 +40,7 @@ reportbug (3.99.0) UNRELEASED; urgency=low
       + added GetListPage to improve the get_multiline wrapper
       + fixed return value for default entries in select_options wrapper
       + fixed long_message layout
+      + fixed SyncReturn and increase Page.next_page_num when really switching the assistant page
 
     [ Sandro Tosi ]
     - debian/control
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 6eaee17..1e3113a 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -421,7 +421,7 @@ application = ReportbugApplication ()
 
 class SyncReturn (RuntimeError):
     def __init__ (self, result):
-        RuntimeError.__init__ (result)
+        RuntimeError.__init__ (self, result)
         self.result = result
 
 class ReportbugConnector (object):
@@ -450,7 +450,6 @@ class Page (ReportbugConnector):
         self.widget.set_border_width (6)
         self.widget.show_all ()
         self.page_num = Page.next_page_num
-        Page.next_page_num += 1
 
     def execute_operation (self, *args, **kwargs):
         self.switch_in ()
@@ -473,6 +472,7 @@ class Page (ReportbugConnector):
 
     # The user will see this as next page
     def switch_in (self):
+        Page.next_page_num += 1
         self.assistant.insert_page (self.widget, self.page_num)
         self.set_page_complete (self.default_complete)
         self.set_page_type (self.page_type)
@@ -735,7 +735,6 @@ class HandleBTSQueryPage (TreePage):
 
         self.application.run_once_in_main_thread (self.assistant.set_progress_label, progress_label)
 
-        result = None
         try:
             (count, sectitle, hierarchy) = debianbts.get_reports (
                 package, bts, mirrors=mirrors, version=version,
@@ -767,10 +766,7 @@ class HandleBTSQueryPage (TreePage):
             error_dialog ('No record of this package found.')
             raise NoPackage
 
-        if result and result < 0:
-            raise NoReport
-
-        raise SyncReturn (result)
+        raise SyncReturn (None)
 
     def create_widget (self):
         vbox = gtk.VBox (spacing=12)
@@ -1057,11 +1053,11 @@ class ReportbugAssistant (gtk.Assistant):
         # We insert pages between the intro and the progress, so that we give the user the feedback
         # that the applications is still running when he presses the "Forward" button
         self.showing_page = IntroPage (self)
-        self.progress_page = ProgressPage (self)
-        Page.next_page_num = 1
         self.showing_page.switch_in ()
+        self.progress_page = ProgressPage (self)
         self.progress_page.switch_in ()
         self.set_current_page (0)
+        Page.next_page_num = 1
 
 assistant = ReportbugAssistant (application)
 
-- 
1.5.6.5

From 5f7a7c6252862082969354b83f30191db8176cef Mon Sep 17 00:00:00 2001
From: Luca Bruno <[EMAIL PROTECTED]>
Date: Wed, 3 Sep 2008 22:31:28 +0200
Subject: [PATCH] gtk2: filter the list of bugs

---
 debian/changelog        |    1 +
 reportbug/ui/gtk2_ui.py |   76 +++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 64 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 799d4d1..2cda463 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,7 @@ reportbug (3.99.0) UNRELEASED; urgency=low
       + fixed return value for default entries in select_options wrapper
       + fixed long_message layout
       + fixed SyncReturn and increase Page.next_page_num when really switching the assistant page
+      + filter the list of bugs
 
     [ Sandro Tosi ]
     - debian/control
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 1e3113a..b4100e2 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -769,13 +769,28 @@ class HandleBTSQueryPage (TreePage):
         raise SyncReturn (None)
 
     def create_widget (self):
-        vbox = gtk.VBox (spacing=12)
+        vbox = gtk.VBox (spacing=6)
         self.label = gtk.Label ("List of bugs. Select a bug to retrieve and submit more information.")
-        vbox.pack_start (self.label, expand=False)
+        vbox.pack_start (self.label, expand=False, padding=6)
+
+        hbox = gtk.HBox (spacing=6)
+        label = gtk.Label ("Filter:")
+        hbox.pack_start (label, expand=False)
+        self.entry = gtk.Entry ()
+        hbox.pack_start (self.entry)
+        button = gtk.Button ()
+        button.set_image (gtk.image_new_from_stock (gtk.STOCK_CLEAR, gtk.ICON_SIZE_BUTTON))
+        button.connect ('clicked', self.on_filter_clear)
+        hbox.pack_start (button, expand=False)
+        vbox.pack_start (hbox, expand=False)
 
         self.view = gtk.TreeView ()
         self.view.set_rules_hint (True)
         scrolled = create_scrollable (self.view)
+        self.columns = ['ID', 'Tag', 'Package', 'Description', 'Reporter', 'Date', 'Severity', 'Version',
+                        'Filed date', 'Modified date']
+        for col in zip (self.columns, range (len (self.columns))):
+            self.view.append_column (gtk.TreeViewColumn (col[0], gtk.CellRendererText (), text=col[1]))
         vbox.pack_start (scrolled)
 
         button = gtk.Button ("Retrieve and submit bug information")
@@ -787,6 +802,14 @@ class HandleBTSQueryPage (TreePage):
     def connect_signals (self):
         TreePage.connect_signals (self)
         self.view.connect ('row-activated', self.on_retrieve_info)
+        self.entry.connect ('changed', self.on_filter_changed)
+
+    def on_filter_clear (self, button):
+        self.entry.set_text ("")
+
+    def on_filter_changed (self, entry):
+        self.model.filter_text = entry.get_text().lower ()
+        self.filter.refilter ()
 
     def on_retrieve_info (self, *args):
         bug_ids = TreePage.get_value (self)
@@ -806,20 +829,40 @@ class HandleBTSQueryPage (TreePage):
         # The value returned to reportbug doesn't depend by a selection, but by the dialog of a bug
         return None
 
-    def execute (self, buglist, sectitle):
-        self.label.set_text ("%s. Double-click a bug to retrieve and submit more information." % sectitle)
-
-        columns = ['ID', 'Tag', 'Package', 'Description', 'Reporter', 'Date', 'Severity', 'Version',
-                   'Filed date', 'Modified date']
+    def match_filter (self, iter):
+        # Flatten the columns into a single string
+        text = ""
+        for col in range (len (self.columns)):
+            value = self.model.get_value (iter, col)
+            if value:
+                text += self.model.get_value (iter, col) + " "
+
+        text = text.lower ()
+        # Tokens shouldn't be adjacent by default
+        for token in self.model.filter_text.split (' '):
+            if token in text:
+                return True
+        return False
+
+    def filter_visible_func (self, model, iter):
+        matches = self.match_filter (iter)
+        if not self.model.iter_parent (iter) and not matches:
+            # If no children are visible, hide it
+            it = model.iter_children (iter)
+            while it:
+                if self.match_filter (it):
+                    return True
+                it = model.iter_next (it)
+            return False
 
-        self.model = gtk.TreeStore (*([str] * len (columns)))
-        self.view.set_model (self.model)
+        return matches
 
-        for col in zip (columns, range (len (columns))):
-            self.view.append_column (gtk.TreeViewColumn (col[0], gtk.CellRendererText (), text=col[1]))
+    def execute (self, buglist, sectitle):
+        self.label.set_text ("%s. Double-click a bug to retrieve and submit more information." % sectitle)
 
+        self.model = gtk.TreeStore (*([str] * len (self.columns)))
         for category in buglist:
-            row = [None] * len (columns)
+            row = [None] * len (self.columns)
             row[3] = category[0]
             iter = self.model.append (None, row)
             for bug in category[1]:
@@ -827,6 +870,11 @@ class HandleBTSQueryPage (TreePage):
 
         self.selection.set_mode (gtk.SELECTION_MULTIPLE)
 
+        self.model.filter_text = ""
+        self.filter = self.model.filter_new ()
+        self.filter.set_visible_func (self.filter_visible_func)
+        self.view.set_model (self.filter)
+
 class DisplayReportPage (Page):
     default_complete = True
 
@@ -1167,7 +1215,9 @@ forward_operations (application, dialogs)
 
 def test ():
     # Write some tests here
-    print get_multiline ("ENTER")
+    page = HandleBTSQueryPage (assistant)
+    application.run_once_in_main_thread (page.execute_operation, [('asd', (Bug ('#123 [asd] [we] we we Reported by: asd;' ), Bug ('#123 [asd] [we] we we Reported by: asd;')))], 'asd')
+    return application.get_last_value ()
 
 if __name__ == '__main__':
     test ()
-- 
1.5.6.5

_______________________________________________
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint

Reply via email to