Removed internal _new_page method
authorEugene Gagarin <mosfet07@ya.ru>
Tue, 12 May 2009 12:58:58 +0000 (16:58 +0400)
committerEugene Gagarin <mosfet07@ya.ru>
Tue, 12 May 2009 12:58:58 +0000 (16:58 +0400)
src/files/search.py
src/misc.py

index 24e423b..11cb0cd 100755 (executable)
@@ -255,13 +255,6 @@ class Gtk_Presentation(object):
         self.statusbar.push(self.context_id, current_path)
         gtk.main_iteration()
 
-    def _new_page(self, child, title):
-        """Create new notebook page with search output."""
-        pages = self.nb.notebook.get_n_pages()
-        self.nb.new_tab(child, title)
-        child.show_all()
-        self.nb.notebook.set_current_page(pages)
-
     def run(self):
         pass
 
@@ -269,10 +262,8 @@ class Gtk_Presentation(object):
     def show_out_toplevel(self, outtype, results):
         print 'Entering <' + outtype['name'] + '> output mode...'
         out_submodule = __import__('files.' + outtype['name'], None, None, outtype)
-
         self.out_toplevel = out_submodule.Gtk_Presentation(results).toplevel
-
-        self._new_page(self.out_toplevel, outtype['label'])
+        self.nb.new_tab(self.out_toplevel, outtype['label'])
 ###        out_submodule.Gtk_Presentation().show_results(results)
 
 #==============================================================================
index 5127e6d..165453d 100755 (executable)
@@ -33,7 +33,8 @@ def size_hum_read(size):
 #==============================================================================
 
 class NotebookWCloseBtns(object):
-    """gtk.Notebook widget with close buttons."""
+    """gtk.Notebook widget with close buttons. Automatically show_all added
+    child and switch to new page."""
 
     def __init__(self):
         import gtk
@@ -42,13 +43,13 @@ class NotebookWCloseBtns(object):
         self.notebook = gtk.Notebook()
 
     def new_tab(self, child, title, noclose=False):
+        pages = self.notebook.get_n_pages()
         self.notebook.append_page(child)
+        child.show_all()
 
         label = self.create_tab_label(child, title, noclose)
         label.show_all()
         self.notebook.set_tab_label(child, label)
-
-        pages = self.notebook.get_n_pages()
         self.notebook.set_current_page(pages)
 
     def create_tab_label(self, child, title, noclose):