Hide navigation the plugin selector when only the default plugin is loaded

svn: r17341
This commit is contained in:
Nick Hall 2011-04-29 20:55:53 +00:00
parent 390c71e6d0
commit 35628aa699
2 changed files with 18 additions and 12 deletions

View File

@ -54,38 +54,42 @@ class Navigator(object):
frame = gtk.Frame() frame = gtk.Frame()
hbox = gtk.HBox() hbox = gtk.HBox()
hbox.show()
frame.add(hbox) frame.add(hbox)
frame.show()
select_button = gtk.ToggleButton() self.select_button = gtk.ToggleButton()
select_button.set_relief(gtk.RELIEF_NONE) self.select_button.set_relief(gtk.RELIEF_NONE)
select_hbox = gtk.HBox() select_hbox = gtk.HBox()
#self.title_label = gtk.Label('') self.title_label = gtk.Label('')
arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE) arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
#select_hbox.pack_start(self.title_label, False) select_hbox.pack_start(self.title_label, False)
select_hbox.pack_end(arrow, False) select_hbox.pack_end(arrow, False)
select_button.add(select_hbox) self.select_button.add(select_hbox)
select_button.connect('button_press_event', self.__menu_button_pressed) self.select_button.connect('button_press_event',
self.__menu_button_pressed)
#close_button = gtk.Button() #close_button = gtk.Button()
#img = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) #img = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
#close_button.set_image(img) #close_button.set_image(img)
#close_button.set_relief(gtk.RELIEF_NONE) #close_button.set_relief(gtk.RELIEF_NONE)
#close_button.connect('clicked', self.cb_close_clicked) #close_button.connect('clicked', self.cb_close_clicked)
hbox.pack_start(select_button, False) hbox.pack_start(self.select_button, False)
#hbox.pack_end(close_button, False) #hbox.pack_end(close_button, False)
self.top.pack_end(frame, False) self.top.pack_end(frame, False)
self.menu = gtk.Menu() self.menu = gtk.Menu()
self.menu.show() self.menu.show()
self.menu.connect('deactivate', cb_menu_deactivate, select_button) self.menu.connect('deactivate', cb_menu_deactivate, self.select_button)
self.notebook = gtk.Notebook() self.notebook = gtk.Notebook()
self.notebook.show() self.notebook.show()
self.notebook.set_show_tabs(False) self.notebook.set_show_tabs(False)
self.notebook.set_show_border(False) self.notebook.set_show_border(False)
self.notebook.connect('switch_page', self.cb_switch_page) self.notebook.connect('switch_page', self.cb_switch_page)
self.top.show()
self.top.pack_start(self.notebook, True) self.top.pack_start(self.notebook, True)
def get_top(self): def get_top(self):
@ -110,6 +114,9 @@ class Navigator(object):
menu_item.connect('activate', self.cb_menu_activate, index) menu_item.connect('activate', self.cb_menu_activate, index)
menu_item.show() menu_item.show()
if self.notebook.get_n_pages() == 2:
self.select_button.show_all()
def view_changed(self, cat_num, view_num): def view_changed(self, cat_num, view_num):
""" """
Called when a Gramps view is changed. Called when a Gramps view is changed.
@ -138,9 +145,8 @@ class Navigator(object):
""" """
Called when the user has switched to a new sidebar plugin page. Called when the user has switched to a new sidebar plugin page.
""" """
pass if self.pages:
#if self.pages: self.title_label.set_text(self.pages[index][0])
#self.title_label.set_text(self.pages[index][0])
def cb_close_clicked(self, button): def cb_close_clicked(self, button):
""" """

View File

@ -590,7 +590,7 @@ class ViewManager(CLIManager):
self.navigator = Navigator(self) self.navigator = Navigator(self)
self.ebox.add(self.navigator.get_top()) self.ebox.add(self.navigator.get_top())
hpane.add1(self.ebox) hpane.add1(self.ebox)
hpane.show_all() hpane.show()
self.notebook = gtk.Notebook() self.notebook = gtk.Notebook()
self.notebook.set_scrollable(True) self.notebook.set_scrollable(True)