[Pkg-bazaar-commits] ./bzr-gtk/unstable r524: Add search dialog.

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:50:38 UTC 2009


------------------------------------------------------------
revno: 524
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2008-07-01 16:06:55 +0200
message:
  Add search dialog.
added:
  search.py
modified:
  viz/branchwin.py
-------------- next part --------------
=== added file 'search.py'
--- a/search.py	1970-01-01 00:00:00 +0000
+++ b/search.py	2008-07-01 14:06:55 +0000
@@ -0,0 +1,38 @@
+# Copyright (C) 2008 by Jelmer Vernooij <jelmer at samba.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+try:
+    import pygtk
+    pygtk.require("2.0")
+except:
+    pass
+
+import gtk
+from bzrlib.plugins.search import index as _mod_index
+
+class SearchDialog(gtk.Dialog):
+    """Search dialog."""
+    def __init__(self, branch, parent=None):
+        gtk.Dialog.__init__(self, title="Search Revisions",
+                                  parent=parent,
+                                  flags=gtk.DIALOG_MODAL,
+                                  buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
+    
+        # Get arguments
+        self.branch = branch
+        
+        # Show the dialog
+        self.show_all()

=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py	2008-06-29 19:34:29 +0000
+++ b/viz/branchwin.py	2008-07-01 14:06:55 +0000
@@ -238,6 +238,10 @@
             branch_index_menuitem.connect('activate', self._branch_index_cb)
             branch_menu.add(branch_index_menuitem)
 
+            branch_search_menuitem = gtk.MenuItem("_Search")
+            branch_search_menuitem.connect('activate', self._branch_search_cb)
+            branch_menu.add(branch_search_menuitem)
+
         help_menu = gtk.Menu()
         help_menuitem = gtk.MenuItem("_Help")
         help_menuitem.set_submenu(help_menu)
@@ -470,6 +474,10 @@
         from bzrlib.plugins.search import index as _mod_index
         _mod_index.index_url(self.branch.base)
 
+    def _branch_search_cb(self, w):
+        from bzrlib.plugins.gtk.search import SearchDialog
+        SearchDialog(self).run()
+
     def _about_dialog_cb(self, w):
         from bzrlib.plugins.gtk.about import AboutDialog
 



More information about the Pkg-bazaar-commits mailing list