Introduce workspaces with a shared filter/gramplet sidebar
svn: r16160
This commit is contained in:
@@ -100,7 +100,7 @@ class EventView(ListView):
|
||||
FILTER_TYPE = "Event"
|
||||
QR_CATEGORY = CATEGORY_QR_EVENT
|
||||
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
"""
|
||||
Create the Event View
|
||||
"""
|
||||
@@ -126,7 +126,6 @@ class EventView(ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
})
|
||||
|
||||
config.connect("interface.filter", self.filter_toggle)
|
||||
uistate.connect('nameformat-changed', self.build_tree)
|
||||
|
||||
def navigation_type(self):
|
||||
|
@@ -97,7 +97,7 @@ class FamilyView(ListView):
|
||||
FILTER_TYPE = "Family"
|
||||
QR_CATEGORY = CATEGORY_QR_FAMILY
|
||||
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'family-add' : self.row_add,
|
||||
@@ -121,7 +121,6 @@ class FamilyView(ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
})
|
||||
|
||||
config.connect("interface.filter", self.filter_toggle)
|
||||
uistate.connect('nameformat-changed', self.build_tree)
|
||||
|
||||
def navigation_type(self):
|
||||
|
@@ -566,7 +566,7 @@ class FanChartView(NavigationView):
|
||||
"""
|
||||
The Gramplet code that realizes the FanChartWidget.
|
||||
"""
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
NavigationView.__init__(self, _('Fan Chart'),
|
||||
dbstate, uistate,
|
||||
dbstate.db.get_bookmarks(),
|
||||
|
@@ -158,7 +158,6 @@ _UI_DEF = '''\
|
||||
<separator/>
|
||||
<menuitem action="AddPlaceMenu"/>
|
||||
<menuitem action="LinkPlaceMenu"/>
|
||||
<menuitem action="FilterEdit"/>
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
@@ -344,8 +343,9 @@ class GeoView(HtmlView):
|
||||
('preferences.webkit', True),
|
||||
)
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
HtmlView.__init__(self, dbstate, uistate, title=_("GeoView"))
|
||||
def __init__(self, dbstate, uistate, wspace):
|
||||
HtmlView.__init__(self, dbstate, uistate, wspace, title=_("GeoView"))
|
||||
self.wspace = wspace
|
||||
self.dbstate = dbstate
|
||||
self.uistate = uistate
|
||||
self.dbstate.connect('database-changed', self._new_database)
|
||||
@@ -704,9 +704,9 @@ class GeoView(HtmlView):
|
||||
self.box1.pack_start(self.title, False, False, padding=2)
|
||||
self.box1.show_all()
|
||||
if self.displaytype == "places":
|
||||
self.build_filters_container(self.filter, PlaceSidebarFilter)
|
||||
self.wspace.add_filter(PlaceSidebarFilter)
|
||||
elif self.displaytype == "event":
|
||||
self.build_filters_container(self.filter, EventSidebarFilter)
|
||||
self.wspace.add_filter(EventSidebarFilter)
|
||||
return self.box1
|
||||
|
||||
def _entry_key_event(self, widget, event):
|
||||
@@ -1235,9 +1235,6 @@ class GeoView(HtmlView):
|
||||
self._add_action('EventMapsMenu', 'geo-show-event', _('_Event'),
|
||||
callback=self._event_places,
|
||||
tip=_("Attempt to view places connected to all events."))
|
||||
self._add_toggle_action('FilterEdit', None, _('_Filter Sidebar'),
|
||||
callback=self.filter_toggle_action)
|
||||
config.connect('interface.filter', self.filter_toggle)
|
||||
|
||||
####################################################################
|
||||
# BOOKMARKS
|
||||
@@ -1481,7 +1478,6 @@ class GeoView(HtmlView):
|
||||
self._savezoomandposition(500) # every 500 millisecondes
|
||||
self.endinit = True
|
||||
self.uistate.clear_filter_results()
|
||||
self.filter_toggle(None, None, None, None)
|
||||
self._set_provider_icon()
|
||||
self._geo_places()
|
||||
|
||||
@@ -1491,7 +1487,6 @@ class GeoView(HtmlView):
|
||||
"""
|
||||
if not self.uistate.get_active('Person'):
|
||||
return
|
||||
self.filter_toggle(None, None, None, None)
|
||||
self._geo_places()
|
||||
|
||||
def _all_places(self, hanle=None): # pylint: disable-msg=W0613
|
||||
@@ -1499,7 +1494,8 @@ class GeoView(HtmlView):
|
||||
Specifies the place for the home person to display with mapstraction.
|
||||
"""
|
||||
self.displaytype = "places"
|
||||
self.build_filters_container(self.filter, PlaceSidebarFilter)
|
||||
self.wspace.remove_filter()
|
||||
self.wspace.add_filter(PlaceSidebarFilter)
|
||||
self._geo_places()
|
||||
|
||||
def _person_places(self, handle=None): # pylint: disable-msg=W0613
|
||||
@@ -1507,7 +1503,7 @@ class GeoView(HtmlView):
|
||||
Specifies the person places.
|
||||
"""
|
||||
self.displaytype = "person"
|
||||
self.no_filter()
|
||||
self.wspace.remove_filter()
|
||||
if not self.uistate.get_active('Person'):
|
||||
return
|
||||
self._geo_places()
|
||||
@@ -1517,7 +1513,7 @@ class GeoView(HtmlView):
|
||||
Specifies the family places to display with mapstraction.
|
||||
"""
|
||||
self.displaytype = "family"
|
||||
self.no_filter()
|
||||
self.wspace.remove_filter()
|
||||
if not self.uistate.get_active('Person'):
|
||||
return
|
||||
self._geo_places()
|
||||
@@ -1527,7 +1523,8 @@ class GeoView(HtmlView):
|
||||
Specifies all event places to display with mapstraction.
|
||||
"""
|
||||
self.displaytype = "event"
|
||||
self.build_filters_container(self.filter, EventSidebarFilter)
|
||||
self.wspace.remove_filter()
|
||||
self.wspace.add_filter(EventSidebarFilter)
|
||||
self._geo_places()
|
||||
|
||||
def _new_database(self, database):
|
||||
@@ -2576,74 +2573,6 @@ class GeoView(HtmlView):
|
||||
except Errors.WindowActiveError: # pylint: disable-msg=W0704
|
||||
pass # pylint: disable-msg=W0702
|
||||
|
||||
####################################################################
|
||||
# Filters
|
||||
####################################################################
|
||||
def build_filters_container(self, box, filter_class):
|
||||
"""
|
||||
Used to create the filters on Geoview.
|
||||
Depending on the events view or places, view we must generate the
|
||||
good filter.
|
||||
We need to remove the old filter if it exists then add the new one.
|
||||
"""
|
||||
try:
|
||||
self.vbox.destroy()
|
||||
except: # pylint: disable-msg=W0704
|
||||
pass # pylint: disable-msg=W0702
|
||||
map(self.hpaned.remove, self.hpaned.get_children())
|
||||
self.vbox = gtk.VBox()
|
||||
self.hpaned.pack_start(self.vbox, True, True)
|
||||
self.filter_sidebar = filter_class(self.dbstate, self.uistate,
|
||||
self.filter_clicked)
|
||||
self.filter_pane = self.filter_sidebar.get_widget()
|
||||
self.hpaned.pack_end(self.filter_pane, False, False)
|
||||
box.show_all()
|
||||
self.filter_toggle(None, None, None, None)
|
||||
|
||||
def no_filter(self):
|
||||
"""
|
||||
We don't need a filter for the current view.
|
||||
"""
|
||||
try:
|
||||
self.filter_pane.hide()
|
||||
except: # pylint: disable-msg=W0704
|
||||
pass # pylint: disable-msg=W0702
|
||||
|
||||
def filter_toggle(self, client, cnxn_id, entry, data):
|
||||
# pylint: disable-msg=W0613
|
||||
"""
|
||||
We must show or hide the filter depending on the filter toggle button.
|
||||
"""
|
||||
if not self.endinit:
|
||||
return
|
||||
|
||||
if self.displaytype == "places" or self.displaytype == "event":
|
||||
if config.get('interface.filter'):
|
||||
self.filter.show()
|
||||
else:
|
||||
self.filter.hide()
|
||||
|
||||
def filter_toggle_action(self, obj):
|
||||
"""
|
||||
Depending on the filter toggle button action, we must show or hile
|
||||
the filter then save the state in the config file.
|
||||
"""
|
||||
if self.displaytype == "places" or self.displaytype == "event":
|
||||
if obj.get_active():
|
||||
self.filter.show()
|
||||
active = True
|
||||
else:
|
||||
self.filter.hide()
|
||||
active = False
|
||||
config.set('interface.filter', active)
|
||||
|
||||
def filter_clicked(self):
|
||||
"""
|
||||
We have clicked on the Find button into the filter box.
|
||||
"""
|
||||
self.generic_filter = self.filter_sidebar.get_filter()
|
||||
self.build_tree()
|
||||
|
||||
def build_tree(self):
|
||||
"""
|
||||
Builds the new view depending on the filter.
|
||||
|
@@ -45,7 +45,7 @@ class GrampletView(PageView):
|
||||
GrampletView interface
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, wspace):
|
||||
"""
|
||||
Create a GrampletView, with the current dbstate and uistate
|
||||
"""
|
||||
|
@@ -441,7 +441,7 @@ class HtmlView(PageView):
|
||||
with an embedded webbrowser showing a given URL
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, uistate, title=_('HtmlView')):
|
||||
def __init__(self, dbstate, uistate, wspace, title=_('HtmlView')):
|
||||
PageView.__init__(self, title, dbstate, uistate)
|
||||
self.dbstate = dbstate
|
||||
self.back_action = None
|
||||
|
@@ -113,7 +113,7 @@ class MediaView(ListView):
|
||||
|
||||
_DND_TYPE = DdTargets.URI_LIST
|
||||
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'media-add' : self.row_add,
|
||||
@@ -137,9 +137,6 @@ class MediaView(ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
})
|
||||
|
||||
config.connect("interface.filter",
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return 'Media'
|
||||
|
||||
|
@@ -92,7 +92,7 @@ class NoteView(ListView):
|
||||
FILTER_TYPE = "Note"
|
||||
QR_CATEGORY = CATEGORY_QR_NOTE
|
||||
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'note-add' : self.row_add,
|
||||
@@ -115,9 +115,6 @@ class NoteView(ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
})
|
||||
|
||||
config.connect("interface.filter",
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return 'Note'
|
||||
|
||||
|
@@ -667,7 +667,7 @@ class PedigreeView(NavigationView):
|
||||
('interface.pedview-show-unknown-people', True),
|
||||
)
|
||||
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
NavigationView.__init__(self, _('Pedigree'), dbstate, uistate,
|
||||
dbstate.db.get_bookmarks(),
|
||||
Bookmarks.PersonBookmarks,
|
||||
|
@@ -53,7 +53,7 @@ class PersonListView(BasePersonView):
|
||||
"""
|
||||
A hierarchical view of the top three levels of places.
|
||||
"""
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
BasePersonView.__init__(self, dbstate, uistate,
|
||||
_('Person View'), PersonListModel,
|
||||
nav_group=nav_group)
|
||||
|
@@ -55,7 +55,7 @@ class PersonTreeView(BasePersonView):
|
||||
"""
|
||||
A hierarchical view of the top three levels of places.
|
||||
"""
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
BasePersonView.__init__(self, dbstate, uistate,
|
||||
_('People Tree View'), PersonTreeModel,
|
||||
nav_group=nav_group)
|
||||
|
@@ -47,7 +47,7 @@ class PlaceListView(PlaceBaseView):
|
||||
"""
|
||||
Flat place view. (Original code in PlaceBaseView).
|
||||
"""
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, wspace):
|
||||
PlaceBaseView.__init__(self, dbstate, uistate,
|
||||
_('Place View'), PlaceListModel,
|
||||
nav_group=0)
|
||||
|
@@ -93,7 +93,7 @@ class PlaceTreeView(PlaceBaseView):
|
||||
100, 150, 150, 100, 150])
|
||||
)
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, wspace):
|
||||
PlaceBaseView.__init__(self, dbstate, uistate,
|
||||
_('Place Tree View'), PlaceTreeModel,
|
||||
nav_group=0, markup=PlaceBaseView.MARKUP_COLS)
|
||||
|
@@ -129,7 +129,7 @@ class RelationshipView(NavigationView):
|
||||
('preferences.releditbtn', True),
|
||||
)
|
||||
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
NavigationView.__init__(self, _('Relationships'),
|
||||
dbstate, uistate,
|
||||
dbstate.db.get_bookmarks(),
|
||||
|
@@ -109,7 +109,7 @@ class RepositoryView(ListView):
|
||||
FILTER_TYPE = "Repository"
|
||||
QR_CATEGORY = CATEGORY_QR_REPOSITORY
|
||||
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'repository-add' : self.row_add,
|
||||
@@ -132,9 +132,6 @@ class RepositoryView(ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
})
|
||||
|
||||
config.connect("interface.filter",
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return 'Repository'
|
||||
|
||||
|
@@ -93,7 +93,7 @@ class SourceView(ListView):
|
||||
FILTER_TYPE = "Source"
|
||||
QR_CATEGORY = CATEGORY_QR_SOURCE
|
||||
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'source-add' : self.row_add,
|
||||
@@ -116,9 +116,6 @@ class SourceView(ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
})
|
||||
|
||||
config.connect("interface.filter",
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return 'Source'
|
||||
|
||||
|
Reference in New Issue
Block a user