3275: PageView reworking - change all non person views to new classes
svn: r13343
This commit is contained in:
parent
ac74c5bed9
commit
53251826f7
@ -37,7 +37,7 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import PageView
|
||||
from gui.views.listview import ListView
|
||||
import DisplayModels
|
||||
import Utils
|
||||
import Errors
|
||||
@ -61,7 +61,7 @@ from gettext import gettext as _
|
||||
# EventView
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class EventView(PageView.ListView):
|
||||
class EventView(ListView):
|
||||
"""
|
||||
EventView class, derived from the ListView
|
||||
"""
|
||||
@ -85,7 +85,6 @@ class EventView(PageView.ListView):
|
||||
"""
|
||||
Create the Event View
|
||||
"""
|
||||
|
||||
signal_map = {
|
||||
'event-add' : self.row_add,
|
||||
'event-update' : self.row_update,
|
||||
@ -93,12 +92,7 @@ class EventView(PageView.ListView):
|
||||
'event-rebuild' : self.object_build,
|
||||
}
|
||||
|
||||
self.func_list = {
|
||||
'<CONTROL>J' : self.jump,
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
}
|
||||
|
||||
PageView.ListView.__init__(
|
||||
ListView.__init__(
|
||||
self, _('Events'), dbstate, uistate,
|
||||
EventView.COLUMN_NAMES, len(EventView.COLUMN_NAMES),
|
||||
DisplayModels.EventModel,
|
||||
@ -106,6 +100,11 @@ class EventView(PageView.ListView):
|
||||
Bookmarks.EventBookmarks,
|
||||
multiple=True,
|
||||
filter_class=EventSidebarFilter)
|
||||
|
||||
self.func_list = {
|
||||
'<CONTROL>J' : self.jump,
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
}
|
||||
|
||||
Config.client.notify_add("/apps/gramps/interface/filter",
|
||||
self.filter_toggle)
|
||||
@ -183,7 +182,7 @@ class EventView(PageView.ListView):
|
||||
</ui>'''
|
||||
|
||||
def define_actions(self):
|
||||
PageView.ListView.define_actions(self)
|
||||
ListView.define_actions(self)
|
||||
self._add_action('FilterEdit', None, _('Event Filter Editor'),
|
||||
callback=self.filter_editor,)
|
||||
self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||
|
@ -43,7 +43,7 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import PageView
|
||||
from gui.views.listview import ListView
|
||||
import DisplayModels
|
||||
import Bookmarks
|
||||
import Errors
|
||||
@ -56,7 +56,7 @@ from ReportBase import CATEGORY_QR_FAMILY
|
||||
# FamilyListView
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class FamilyListView(PageView.ListView):
|
||||
class FamilyListView(ListView):
|
||||
|
||||
COLUMN_NAMES = [
|
||||
_('ID'),
|
||||
@ -82,18 +82,18 @@ class FamilyListView(PageView.ListView):
|
||||
'family-rebuild' : self.object_build,
|
||||
}
|
||||
|
||||
self.func_list = {
|
||||
'<CONTROL>J' : self.jump,
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
}
|
||||
|
||||
PageView.ListView.__init__(
|
||||
ListView.__init__(
|
||||
self, _('Families'), dbstate, uistate,
|
||||
FamilyListView.COLUMN_NAMES, len(FamilyListView.COLUMN_NAMES),
|
||||
DisplayModels.FamilyModel,
|
||||
signal_map, dbstate.db.get_family_bookmarks(),
|
||||
Bookmarks.FamilyBookmarks, filter_class=FamilySidebarFilter)
|
||||
|
||||
self.func_list = {
|
||||
'<CONTROL>J' : self.jump,
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
}
|
||||
|
||||
Config.client.notify_add("/apps/gramps/interface/filter",
|
||||
self.filter_toggle)
|
||||
|
||||
@ -161,7 +161,7 @@ class FamilyListView(PageView.ListView):
|
||||
def define_actions(self):
|
||||
"""Add the Forward action group to handle the Forward button."""
|
||||
|
||||
PageView.ListView.define_actions(self)
|
||||
ListView.define_actions(self)
|
||||
self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||
_('_Column Editor...'), callback=self._column_editor)
|
||||
|
||||
|
@ -61,6 +61,7 @@ from gui.utils import add_menuitem
|
||||
from ReportBase import CSS_FILES
|
||||
from BasicUtils import name_displayer as _nd
|
||||
from PlaceUtils import conv_lat_lon
|
||||
from gui.views.pageview import PageView
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -487,7 +488,7 @@ class GeoView(HtmlView):
|
||||
])
|
||||
self._add_action_group(self.lock_action)
|
||||
self._add_action('AllPlacesMaps', gtk.STOCK_HOME, _('_All Places'),
|
||||
callback=self._all_places, tip=_("Attempt to view all places in "
|
||||
callback=self._all_places, tip=_("Attempt to view all places in "
|
||||
"the family tree."))
|
||||
self._add_action('PersonMaps', 'gramps-person', _('_Person'),
|
||||
callback=self._person_places,
|
||||
@ -514,7 +515,7 @@ class GeoView(HtmlView):
|
||||
4. set icon and label of the menutoolbutton now that it is realized
|
||||
5. store label so it can be changed when selection changes
|
||||
"""
|
||||
PageView.PageView.change_page(self)
|
||||
PageView.change_page(self)
|
||||
# menutoolbutton actions are stored in PageView class,
|
||||
# obtain the widgets where we need to add to menu
|
||||
actionstyles = self.action_toolmenu['StyleSheet']
|
||||
|
@ -46,7 +46,7 @@ from gettext import gettext as _
|
||||
#-------------------------------------------------------------------------
|
||||
import Errors
|
||||
import const
|
||||
import PageView
|
||||
from gui.views.pageview import PageView
|
||||
import ManagedWindow
|
||||
import ConfigParser
|
||||
from gui.utils import add_menuitem
|
||||
@ -1081,7 +1081,7 @@ class MyScrolledWindow(gtk.ScrolledWindow):
|
||||
if gramplet.state == "minimized":
|
||||
gramplet.set_state("minimized")
|
||||
|
||||
class GrampletView(PageView.PersonNavView):
|
||||
class GrampletView(PageView):
|
||||
"""
|
||||
GrampletView interface
|
||||
"""
|
||||
@ -1090,7 +1090,7 @@ class GrampletView(PageView.PersonNavView):
|
||||
"""
|
||||
Create a GrampletView, with the current dbstate and uistate
|
||||
"""
|
||||
PageView.PersonNavView.__init__(self, _('Gramplets'), dbstate, uistate)
|
||||
PageView.__init__(self, _('Gramplets'), dbstate, uistate)
|
||||
self._popup_xy = None
|
||||
|
||||
def build_widget(self):
|
||||
@ -1377,47 +1377,6 @@ class GrampletView(PageView.PersonNavView):
|
||||
lambda obj:self.set_columns(3)),
|
||||
])
|
||||
self._add_action_group(self.action)
|
||||
# Back, Forward, Home
|
||||
self.fwd_action = gtk.ActionGroup(self.title + '/Forward')
|
||||
self.fwd_action.add_actions([
|
||||
('Forward', gtk.STOCK_GO_FORWARD, _("_Forward"),
|
||||
"<ALT>Right", _("Go to the next person in the history"),
|
||||
self.fwd_clicked)
|
||||
])
|
||||
|
||||
# add the Backward action group to handle the Forward button
|
||||
self.back_action = gtk.ActionGroup(self.title + '/Backward')
|
||||
self.back_action.add_actions([
|
||||
('Back', gtk.STOCK_GO_BACK, _("_Back"),
|
||||
"<ALT>Left", _("Go to the previous person in the history"),
|
||||
self.back_clicked)
|
||||
])
|
||||
self._add_action('HomePerson', gtk.STOCK_HOME, _("_Home"),
|
||||
accel="<Alt>Home",
|
||||
tip=_("Go to the default person"), callback=self.home)
|
||||
self.other_action = gtk.ActionGroup(self.title + '/PersonOther')
|
||||
self.other_action.add_actions([
|
||||
('SetActive', gtk.STOCK_HOME, _("Set _Home Person"), None,
|
||||
None, self.set_default_person),
|
||||
])
|
||||
self._add_action_group(self.back_action)
|
||||
self._add_action_group(self.fwd_action)
|
||||
self._add_action_group(self.other_action)
|
||||
|
||||
def set_active(self):
|
||||
PageView.PersonNavView.set_active(self)
|
||||
self.key_active_changed = self.dbstate.connect('active-changed',
|
||||
self.goto_active_person)
|
||||
|
||||
def set_inactive(self):
|
||||
PageView.PersonNavView.set_inactive(self)
|
||||
self.dbstate.disconnect(self.key_active_changed)
|
||||
|
||||
def goto_active_person(self, handle=None):
|
||||
self.dirty = True
|
||||
if handle:
|
||||
self.handle_history(handle)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
|
||||
def set_columns(self, num):
|
||||
# clear the gramplets:
|
||||
@ -1535,28 +1494,12 @@ class GrampletView(PageView.PersonNavView):
|
||||
return """
|
||||
<ui>
|
||||
<menubar name="MenuBar">
|
||||
<menu action="GoMenu">
|
||||
<placeholder name="CommonGo">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
<separator/>
|
||||
<menuitem action="HomePerson"/>
|
||||
<separator/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="ViewMenu">
|
||||
<menuitem action="Columns1"/>
|
||||
<menuitem action="Columns2"/>
|
||||
<menuitem action="Columns3"/>
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="CommonNavigation">
|
||||
<toolitem action="Back"/>
|
||||
<toolitem action="Forward"/>
|
||||
<toolitem action="HomePerson"/>
|
||||
</placeholder>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
<menuitem action="AddGramplet"/>
|
||||
<menuitem action="RestoreGramplet"/>
|
||||
|
@ -49,7 +49,7 @@ import gtk
|
||||
# Gramps Modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import PageView
|
||||
from gui.views.pageview import PageView
|
||||
import Utils
|
||||
import Config
|
||||
from const import TEMP_DIR
|
||||
@ -414,14 +414,14 @@ class RendererMozilla(Renderer):
|
||||
# HtmlView
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HtmlView(PageView.PageView):
|
||||
class HtmlView(PageView):
|
||||
"""
|
||||
HtmlView is a view showing a top widget with controls, and a bottom part
|
||||
with an embedded webbrowser showing a given URL
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, uistate, title=_('HtmlView')):
|
||||
PageView.PageView.__init__(self, title, dbstate, uistate)
|
||||
PageView.__init__(self, title, dbstate, uistate)
|
||||
self.dbstate = dbstate
|
||||
self.back_action = None
|
||||
self.forward_action = None
|
||||
|
@ -47,7 +47,7 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gui.utils import open_file_with_default_application
|
||||
import PageView
|
||||
from gui.views.listview import ListView
|
||||
import DisplayModels
|
||||
import ThumbNails
|
||||
import const
|
||||
@ -67,7 +67,7 @@ from DdTargets import DdTargets
|
||||
# MediaView
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class MediaView(PageView.ListView):
|
||||
class MediaView(ListView):
|
||||
"""
|
||||
Provide the Media View interface on the GRAMPS main window. This allows
|
||||
people to manage all media items in their database. This is very similar
|
||||
@ -101,7 +101,7 @@ class MediaView(PageView.ListView):
|
||||
'media-rebuild' : self.object_build,
|
||||
}
|
||||
|
||||
PageView.ListView.__init__(
|
||||
ListView.__init__(
|
||||
self, _('Media'), dbstate, uistate,
|
||||
MediaView.COLUMN_NAMES, len(MediaView.COLUMN_NAMES),
|
||||
DisplayModels.MediaModel,
|
||||
@ -212,7 +212,7 @@ class MediaView(PageView.ListView):
|
||||
sure that the common List View actions are defined as well, so we
|
||||
call the parent function.
|
||||
"""
|
||||
PageView.ListView.define_actions(self)
|
||||
ListView.define_actions(self)
|
||||
|
||||
self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||
_('_Column Editor'), callback=self._column_editor)
|
||||
@ -260,7 +260,7 @@ class MediaView(PageView.ListView):
|
||||
"""
|
||||
Builds the View from GTK components
|
||||
"""
|
||||
base = PageView.ListView.build_widget(self)
|
||||
base = ListView.build_widget(self)
|
||||
vbox = gtk.VBox()
|
||||
vbox.set_border_width(0)
|
||||
vbox.set_spacing(4)
|
||||
@ -296,7 +296,7 @@ class MediaView(PageView.ListView):
|
||||
handle the normal operation, then call row_change to make sure that
|
||||
the thumbnail is updated properly if needed.
|
||||
"""
|
||||
PageView.ListView.row_update(self, obj)
|
||||
ListView.row_update(self, obj)
|
||||
if self.active:
|
||||
self.row_change(obj)
|
||||
|
||||
|
@ -36,7 +36,7 @@ import gtk
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import PageView
|
||||
from gui.views.listview import ListView
|
||||
import DisplayModels
|
||||
import Utils
|
||||
import Errors
|
||||
@ -61,7 +61,7 @@ from gettext import gettext as _
|
||||
# NoteView
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class NoteView(PageView.ListView):
|
||||
class NoteView(ListView):
|
||||
|
||||
COLUMN_NAMES = [
|
||||
_('Preview'),
|
||||
@ -89,7 +89,7 @@ class NoteView(PageView.ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
}
|
||||
|
||||
PageView.ListView.__init__(
|
||||
ListView.__init__(
|
||||
self, _('Notes'), dbstate, uistate, NoteView.COLUMN_NAMES,
|
||||
len(NoteView.COLUMN_NAMES), DisplayModels.NoteModel, signal_map,
|
||||
dbstate.db.get_note_bookmarks(),
|
||||
@ -169,7 +169,7 @@ class NoteView(PageView.ListView):
|
||||
</ui>'''
|
||||
|
||||
def define_actions(self):
|
||||
PageView.ListView.define_actions(self)
|
||||
ListView.define_actions(self)
|
||||
self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||
_('_Column Editor'), callback=self._column_editor)
|
||||
self._add_action('FilterEdit', None, _('Note Filter Editor'),
|
||||
|
@ -37,7 +37,7 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import PageView
|
||||
from gui.views.listview import ListView
|
||||
import DisplayModels
|
||||
import Utils
|
||||
import Bookmarks
|
||||
@ -61,7 +61,7 @@ from gettext import gettext as _
|
||||
# RepositoryView
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RepositoryView(PageView.ListView):
|
||||
class RepositoryView(ListView):
|
||||
|
||||
COLUMN_NAMES = [
|
||||
_('Name'),
|
||||
@ -99,7 +99,7 @@ class RepositoryView(PageView.ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
}
|
||||
|
||||
PageView.ListView.__init__(
|
||||
ListView.__init__(
|
||||
self, _('Repositories'), dbstate, uistate,
|
||||
RepositoryView.COLUMN_NAMES, len(RepositoryView.COLUMN_NAMES),
|
||||
DisplayModels.RepositoryModel, signal_map,
|
||||
@ -120,7 +120,7 @@ class RepositoryView(PageView.ListView):
|
||||
return DdTargets.REPO_LINK
|
||||
|
||||
def define_actions(self):
|
||||
PageView.ListView.define_actions(self)
|
||||
ListView.define_actions(self)
|
||||
self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||
_('_Column Editor'), callback=self._column_editor)
|
||||
self._add_action('FilterEdit', None, _('Repository Filter Editor'),
|
||||
|
@ -38,7 +38,7 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import Config
|
||||
import PageView
|
||||
from gui.views.listview import ListView
|
||||
import DisplayModels
|
||||
import Utils
|
||||
import Bookmarks
|
||||
@ -61,7 +61,7 @@ from gettext import gettext as _
|
||||
# SourceView
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SourceView(PageView.ListView):
|
||||
class SourceView(ListView):
|
||||
|
||||
COLUMN_NAMES = [
|
||||
_('Title'),
|
||||
@ -91,7 +91,7 @@ class SourceView(PageView.ListView):
|
||||
'<CONTROL>BackSpace' : self.key_delete,
|
||||
}
|
||||
|
||||
PageView.ListView.__init__(
|
||||
ListView.__init__(
|
||||
self, _('Sources'), dbstate, uistate,
|
||||
SourceView.COLUMN_NAMES, len(SourceView.COLUMN_NAMES),
|
||||
DisplayModels.SourceModel, signal_map,
|
||||
@ -112,7 +112,7 @@ class SourceView(PageView.ListView):
|
||||
return DdTargets.SOURCE_LINK
|
||||
|
||||
def define_actions(self):
|
||||
PageView.ListView.define_actions(self)
|
||||
ListView.define_actions(self)
|
||||
self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||
_('_Column Editor'), callback=self._column_editor)
|
||||
self._add_action('FastMerge', None, _('_Merge'),
|
||||
|
@ -530,7 +530,7 @@ class ListView(NavigationView):
|
||||
search = (False, self.search_bar.get_value())
|
||||
|
||||
# TODO: This line is needed but gives a warning
|
||||
self.list.set_model(None)
|
||||
#self.list.set_model(None)
|
||||
|
||||
if same_col:
|
||||
self.model.reverse_order()
|
||||
@ -587,15 +587,15 @@ class ListView(NavigationView):
|
||||
selected_ids = self.selected_handles()
|
||||
if len(selected_ids) > 0:
|
||||
self.change_active(selected_ids[0])
|
||||
|
||||
if len(selected_ids) == 1:
|
||||
self.list.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
||||
if self.drag_info():
|
||||
if len(selected_ids) == 1:
|
||||
self.list.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
||||
[self.drag_info().target()],
|
||||
gtk.gdk.ACTION_COPY)
|
||||
|
||||
# TODO: This needs putting back again
|
||||
#elif len(selected_ids) > 1:
|
||||
#self.list.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
||||
# TODO: This needs putting back again
|
||||
#elif len(selected_ids) > 1:
|
||||
#self.list.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
||||
#[DdTargets.PERSON_LINK_LIST.target()],
|
||||
#gtk.gdk.ACTION_COPY)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
|
Loading…
Reference in New Issue
Block a user