Sidebar/tab handling

svn: r1402
This commit is contained in:
Don Allingham 2003-03-27 03:16:09 +00:00
parent 17fd356d6f
commit 83176b00c9
3 changed files with 85 additions and 81 deletions

View File

@ -986,11 +986,14 @@ class GrampsPreferences:
def display_preferences_box(db):
GrampsPreferences(db)
_view_str = "/apps/gramps/view"
def save_view(val):
set_bool("/apps/gramps/view",val)
set_bool(_view_str, not val)
sync()
def get_view():
return get_bool("/apps/gramps/view",1)
return not client.get_bool(_view_str)
def save_filter(val):
set_bool("/apps/gramps/filter",val)

View File

@ -937,7 +937,7 @@
</child>
<child>
<widget class="GtkNotebook" id="notebook1">
<widget class="GtkNotebook" id="views">
<property name="border_width">3</property>
<property name="width_request">750</property>
<property name="visible">True</property>
@ -972,7 +972,7 @@
<child>
<widget class="GtkLabel" id="label184">
<property name="visible">True</property>
<property name="label" translatable="yes">Filter</property>
<property name="label" translatable="yes">Filter:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
@ -1025,7 +1025,7 @@
<child>
<widget class="GtkLabel" id="qual">
<property name="label" translatable="yes">Qualifier</property>
<property name="label" translatable="yes">Qualifier:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
@ -1126,10 +1126,11 @@
<child>
<widget class="GtkNotebook" id="ptabs">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
<property name="show_border">True</property>
<property name="show_border">False</property>
<property name="tab_pos">GTK_POS_BOTTOM</property>
<property name="scrollable">False</property>
<property name="tab_hborder">4</property>

View File

@ -207,7 +207,7 @@ class Gramps:
self.tab_list = []
self.filter_list = self.gtop.get_widget("filter_list")
self.notebook = self.gtop.get_widget("notebook1")
self.views = self.gtop.get_widget("views")
self.merge_button= self.gtop.get_widget("merge")
self.canvas = self.gtop.get_widget("canvas1")
self.toolbar = self.gtop.get_widget("toolbar1")
@ -240,7 +240,7 @@ class Gramps:
self.init_filters()
self.toolbar.set_style(GrampsCfg.toolbar)
self.notebook.set_show_tabs(0)
self.views.set_show_tabs(0)
self.family_view = FamilyView.FamilyView(self)
@ -287,7 +287,7 @@ class Gramps:
"on_findname_activate" : self.on_findname_activate,
"on_home_clicked" : self.on_home_clicked,
"on_new_clicked" : self.on_new_clicked,
"on_notebook1_switch_page" : self.on_notebook1_switch_page,
"on_notebook1_switch_page" : self.on_views_switch_page,
"on_ok_button1_clicked" : self.on_ok_button1_clicked,
"on_open_activate" : self.on_open_activate,
"on_pedigree1_activate" : self.on_pedigree1_activate,
@ -317,8 +317,8 @@ class Gramps:
"on_writing_extensions_activate" : self.on_writing_extensions_activate,
})
self.enable_sidebar(self.use_sidebar)
self.enable_filter(self.use_filter)
self.enable_sidebar(self.use_sidebar)
self.topWindow.show()
def change_alpha_page(self,obj,junk,page):
@ -330,7 +330,7 @@ class Gramps:
self.apply_filter(self.person_tree)
def edit_button_clicked(self,obj):
cpage = self.notebook.get_current_page()
cpage = self.views.get_current_page()
if cpage == 0:
self.load_selected_people(obj)
elif cpage == 3:
@ -341,7 +341,7 @@ class Gramps:
self.media_view.on_edit_clicked(obj)
def add_button_clicked(self,obj):
cpage = self.notebook.get_current_page()
cpage = self.views.get_current_page()
if cpage == 0:
self.load_new_person(obj)
elif cpage == 3:
@ -352,7 +352,7 @@ class Gramps:
self.media_view.on_add_clicked(obj)
def remove_button_clicked(self,obj):
cpage = self.notebook.get_current_page()
cpage = self.views.get_current_page()
if cpage == 0:
self.delete_person_clicked(obj)
elif cpage == 3:
@ -378,15 +378,15 @@ class Gramps:
def on_sidebar_activate(self,obj):
val = obj.get_active()
self.enable_sidebar(val)
GrampsCfg.save_view(val)
def enable_sidebar(self,val):
if val:
self.sidebar.show()
self.notebook.set_show_tabs(0)
self.views.set_show_tabs(0)
else:
self.sidebar.hide()
self.notebook.set_show_tabs(1)
self.views.set_show_tabs(1)
GrampsCfg.save_view(val)
def enable_filter(self,val):
if val:
@ -431,11 +431,11 @@ class Gramps:
def on_find_activate(self,obj):
"""Display the find box"""
if self.notebook.get_current_page() == 4:
if self.views.get_current_page() == 4:
Find.FindPlace(self.active_person.getId(),self.find_goto_place,self.db)
elif self.notebook.get_current_page() == 3:
elif self.views.get_current_page() == 3:
Find.FindSource(self.source_view.source_list,self.find_goto_source,self.db)
elif self.notebook.get_current_page() == 5:
elif self.views.get_current_page() == 5:
Find.FindMedia(self.media_view.media_list,self.find_goto_media,self.db)
else:
Find.FindPerson(self.person_list,self.find_goto_to,self.db)
@ -473,7 +473,7 @@ class Gramps:
def on_merge_activate(self,obj):
"""Calls up the merge dialog for the selection"""
page = self.notebook.get_current_page()
page = self.views.get_current_page()
if page == 0:
mlist = self.person_tree.get_selected_objects()
@ -641,7 +641,7 @@ class Gramps:
"""Brute force display update, updating all the pages"""
self.complete_rebuild()
page = self.notebook.get_current_page()
page = self.views.get_current_page()
if page == 1:
self.family_view.load_family()
@ -663,7 +663,7 @@ class Gramps:
def update_display(self,changed):
"""Incremental display update, update only the displayed page"""
page = self.notebook.get_current_page()
page = self.views.get_current_page()
if page == 0:
if changed:
@ -864,7 +864,7 @@ class Gramps:
def autosave_database(self):
path = self.db.getSavePath()
if not path:
return
return 1
filename = os.path.normpath(os.path.abspath(filename))
Utils.clear_timer()
@ -1121,19 +1121,19 @@ class Gramps:
def on_person_list1_activate(self,obj):
"""Switches to the person list view"""
self.notebook.set_current_page(0)
self.views.set_current_page(0)
def on_family1_activate(self,obj):
"""Switches to the family view"""
self.notebook.set_current_page(1)
self.views.set_current_page(1)
def on_pedigree1_activate(self,obj):
"""Switches to the pedigree view"""
self.notebook.set_current_page(2)
self.views.set_current_page(2)
def on_sources_activate(self,obj):
"""Switches to the sources view"""
self.notebook.set_current_page(3)
self.views.set_current_page(3)
def on_places_activate(self,obj):
"""Switches to the places view"""
@ -1145,13 +1145,13 @@ class Gramps:
self.place_view.load_places()
self.place_loaded = 1
self.modify_statusbar()
self.notebook.set_current_page(4)
self.views.set_current_page(4)
def on_media_activate(self,obj):
"""Switches to the media view"""
self.notebook.set_current_page(5)
self.views.set_current_page(5)
def on_notebook1_switch_page(self,obj,junk,page):
def on_views_switch_page(self,obj,junk,page):
"""Load the appropriate page after a notebook switch"""
if page == 0:
self.enable_buttons(1)