column editing
svn: r6085
This commit is contained in:
parent
0f450408b6
commit
f036c5a44b
@ -1,10 +1,19 @@
|
|||||||
2006-03-05 Don Allingham <don@gramps-project.org>
|
2006-03-05 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/DataViews/_RepositoryView.py: column editing
|
||||||
|
* src/DataViews/_MediaView.py: column editing
|
||||||
|
* src/DataViews/_SourceView.py: column editing
|
||||||
|
* src/DataViews/_PedigreeView.py: column editing
|
||||||
|
* src/DataViews/_PersonView.py: column editing
|
||||||
|
* src/DataViews/_PlaceView.py: column editing
|
||||||
|
* src/ViewManager: column editing
|
||||||
|
* src/PeopleModel.py: fix color
|
||||||
* src/images/stock_lock-open.png: added, so not to require
|
* src/images/stock_lock-open.png: added, so not to require
|
||||||
hicolor theme
|
hicolor theme
|
||||||
* src/images/stock_lock.png: added, so not to require
|
* src/images/stock_lock.png: added, so not to require
|
||||||
hicolor theme
|
hicolor theme
|
||||||
* src/images/Makefile.am: add new files
|
* src/images/Makefile.am: add new files
|
||||||
* src/GrampsWidgets.py: use new image files
|
* src/GrampsWidgets.py: use new image files
|
||||||
|
* src/Sources.py: removed
|
||||||
|
|
||||||
2006-03-04 Don Allingham <don@gramps-project.org>
|
2006-03-04 Don Allingham <don@gramps-project.org>
|
||||||
* src/GrampsDb/_ReadGedcom.py: use new logging scheme
|
* src/GrampsDb/_ReadGedcom.py: use new logging scheme
|
||||||
|
@ -95,6 +95,7 @@ class EventView(PageView.ListView):
|
|||||||
<menuitem action="Edit"/>
|
<menuitem action="Edit"/>
|
||||||
<menuitem action="Remove"/>
|
<menuitem action="Remove"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
|
<menuitem action="ColumnEdit"/>
|
||||||
</menu>
|
</menu>
|
||||||
</menubar>
|
</menubar>
|
||||||
<toolbar name="ToolBar">
|
<toolbar name="ToolBar">
|
||||||
@ -111,6 +112,21 @@ class EventView(PageView.ListView):
|
|||||||
</popup>
|
</popup>
|
||||||
</ui>'''
|
</ui>'''
|
||||||
|
|
||||||
|
def define_actions(self):
|
||||||
|
PageView.ListView.define_actions(self)
|
||||||
|
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||||
|
'_Column Editor', callback=self.column_editor),
|
||||||
|
|
||||||
|
def column_editor(self,obj):
|
||||||
|
import ColumnOrder
|
||||||
|
|
||||||
|
ColumnOrder.ColumnOrder(self.dbstate.db.get_event_column_order(),
|
||||||
|
column_names, self.set_column_order)
|
||||||
|
|
||||||
|
def set_column_order(self,list):
|
||||||
|
self.dbstate.db.set_event_column_order(list)
|
||||||
|
self.build_columns()
|
||||||
|
|
||||||
def on_double_click(self,obj,event):
|
def on_double_click(self,obj,event):
|
||||||
handle = self.first_selected()
|
handle = self.first_selected()
|
||||||
the_event = self.dbstate.db.get_event_from_handle(handle)
|
the_event = self.dbstate.db.get_event_from_handle(handle)
|
||||||
|
@ -75,6 +75,21 @@ class MediaView(PageView.ListView):
|
|||||||
DisplayModels.MediaModel,
|
DisplayModels.MediaModel,
|
||||||
signal_map)
|
signal_map)
|
||||||
|
|
||||||
|
def define_actions(self):
|
||||||
|
PageView.ListView.define_actions(self)
|
||||||
|
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||||
|
'_Column Editor', callback=self.column_editor),
|
||||||
|
|
||||||
|
def column_editor(self,obj):
|
||||||
|
import ColumnOrder
|
||||||
|
|
||||||
|
ColumnOrder.ColumnOrder(self.dbstate.db.get_media_column_order(),
|
||||||
|
column_names, self.set_column_order)
|
||||||
|
|
||||||
|
def set_column_order(self,list):
|
||||||
|
self.dbstate.db.set_media_column_order(list)
|
||||||
|
self.build_columns()
|
||||||
|
|
||||||
def column_order(self):
|
def column_order(self):
|
||||||
return self.dbstate.db.get_media_column_order()
|
return self.dbstate.db.get_media_column_order()
|
||||||
|
|
||||||
@ -118,6 +133,7 @@ class MediaView(PageView.ListView):
|
|||||||
<menuitem action="Edit"/>
|
<menuitem action="Edit"/>
|
||||||
<menuitem action="Remove"/>
|
<menuitem action="Remove"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
|
<menuitem action="ColumnEdit"/>
|
||||||
</menu>
|
</menu>
|
||||||
</menubar>
|
</menubar>
|
||||||
<toolbar name="ToolBar">
|
<toolbar name="ToolBar">
|
||||||
|
@ -515,8 +515,9 @@ class PedigreeView(PageView.PersonNavView):
|
|||||||
def goto_active_person(self,handle=None):
|
def goto_active_person(self,handle=None):
|
||||||
if handle:
|
if handle:
|
||||||
person = self.db.get_person_from_handle(handle)
|
person = self.db.get_person_from_handle(handle)
|
||||||
self.rebuild_trees(person)
|
if person:
|
||||||
self.handle_history(person.handle)
|
self.rebuild_trees(person)
|
||||||
|
self.handle_history(person.handle)
|
||||||
else:
|
else:
|
||||||
self.rebuild_trees(None)
|
self.rebuild_trees(None)
|
||||||
|
|
||||||
|
@ -110,6 +110,18 @@ class PersonView(PageView.PersonNavView):
|
|||||||
|
|
||||||
self.add_toggle_action('Filter', None, '_Filter', None, None,
|
self.add_toggle_action('Filter', None, '_Filter', None, None,
|
||||||
self.filter_toggle)
|
self.filter_toggle)
|
||||||
|
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||||
|
'_Column Editor', callback=self.column_editor),
|
||||||
|
|
||||||
|
def column_editor(self,obj):
|
||||||
|
import ColumnOrder
|
||||||
|
|
||||||
|
ColumnOrder.ColumnOrder(self.dbstate.db.get_person_column_order(),
|
||||||
|
column_names, self.set_column_order)
|
||||||
|
|
||||||
|
def set_column_order(self,list):
|
||||||
|
self.dbstate.db.set_person_column_order(list)
|
||||||
|
self.build_columns()
|
||||||
|
|
||||||
def get_stock(self):
|
def get_stock(self):
|
||||||
"""
|
"""
|
||||||
@ -195,6 +207,7 @@ class PersonView(PageView.PersonNavView):
|
|||||||
<menuitem action="Remove"/>
|
<menuitem action="Remove"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
<menuitem action="SetActive"/>
|
<menuitem action="SetActive"/>
|
||||||
|
<menuitem action="ColumnEdit"/>
|
||||||
</menu>
|
</menu>
|
||||||
</menubar>
|
</menubar>
|
||||||
<toolbar name="ToolBar">
|
<toolbar name="ToolBar">
|
||||||
|
@ -82,6 +82,21 @@ class PlaceView(PageView.ListView):
|
|||||||
DisplayModels.PlaceModel,
|
DisplayModels.PlaceModel,
|
||||||
signal_map)
|
signal_map)
|
||||||
|
|
||||||
|
def define_actions(self):
|
||||||
|
PageView.ListView.define_actions(self)
|
||||||
|
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||||
|
'_Column Editor', callback=self.column_editor),
|
||||||
|
|
||||||
|
def column_editor(self,obj):
|
||||||
|
import ColumnOrder
|
||||||
|
|
||||||
|
ColumnOrder.ColumnOrder(self.dbstate.db.get_place_column_order(),
|
||||||
|
column_names, self.set_column_order)
|
||||||
|
|
||||||
|
def set_column_order(self,list):
|
||||||
|
self.dbstate.db.set_place_column_order(list)
|
||||||
|
self.build_columns()
|
||||||
|
|
||||||
def column_order(self):
|
def column_order(self):
|
||||||
return self.dbstate.db.get_place_column_order()
|
return self.dbstate.db.get_place_column_order()
|
||||||
|
|
||||||
@ -100,6 +115,7 @@ class PlaceView(PageView.ListView):
|
|||||||
<menuitem action="Edit"/>
|
<menuitem action="Edit"/>
|
||||||
<menuitem action="Remove"/>
|
<menuitem action="Remove"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
|
<menuitem action="ColumnEdit"/>
|
||||||
</menu>
|
</menu>
|
||||||
</menubar>
|
</menubar>
|
||||||
<toolbar name="ToolBar">
|
<toolbar name="ToolBar">
|
||||||
|
@ -84,10 +84,24 @@ class RepositoryView(PageView.ListView):
|
|||||||
signal_map)
|
signal_map)
|
||||||
|
|
||||||
|
|
||||||
|
def define_actions(self):
|
||||||
|
PageView.ListView.define_actions(self)
|
||||||
|
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||||
|
'_Column Editor', callback=self.column_editor),
|
||||||
|
|
||||||
|
def column_editor(self,obj):
|
||||||
|
import ColumnOrder
|
||||||
|
|
||||||
|
ColumnOrder.ColumnOrder(self.dbstate.db.get_repository_column_order(),
|
||||||
|
column_names, self.set_column_order)
|
||||||
|
|
||||||
|
def set_column_order(self,list):
|
||||||
|
self.dbstate.db.set_repository_column_order(list)
|
||||||
|
self.build_columns()
|
||||||
|
|
||||||
def column_order(self):
|
def column_order(self):
|
||||||
return self.dbstate.db.get_repository_column_order()
|
return self.dbstate.db.get_repository_column_order()
|
||||||
|
|
||||||
|
|
||||||
def get_stock(self):
|
def get_stock(self):
|
||||||
return 'gramps-repository'
|
return 'gramps-repository'
|
||||||
|
|
||||||
@ -103,6 +117,7 @@ class RepositoryView(PageView.ListView):
|
|||||||
<menuitem action="Edit"/>
|
<menuitem action="Edit"/>
|
||||||
<menuitem action="Remove"/>
|
<menuitem action="Remove"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
|
<menuitem action="ColumnEdit"/>
|
||||||
</menu>
|
</menu>
|
||||||
</menubar>
|
</menubar>
|
||||||
<toolbar name="ToolBar">
|
<toolbar name="ToolBar">
|
||||||
|
@ -77,6 +77,21 @@ class SourceView(PageView.ListView):
|
|||||||
DisplayModels.SourceModel,
|
DisplayModels.SourceModel,
|
||||||
signal_map)
|
signal_map)
|
||||||
|
|
||||||
|
def define_actions(self):
|
||||||
|
PageView.ListView.define_actions(self)
|
||||||
|
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||||
|
'_Column Editor', callback=self.column_editor),
|
||||||
|
|
||||||
|
def column_editor(self,obj):
|
||||||
|
import ColumnOrder
|
||||||
|
|
||||||
|
ColumnOrder.ColumnOrder(self.dbstate.db.get_source_column_order(),
|
||||||
|
column_names, self.set_column_order)
|
||||||
|
|
||||||
|
def set_column_order(self,list):
|
||||||
|
self.dbstate.db.set_source_column_order(list)
|
||||||
|
self.build_columns()
|
||||||
|
|
||||||
def column_order(self):
|
def column_order(self):
|
||||||
return self.dbstate.db.get_source_column_order()
|
return self.dbstate.db.get_source_column_order()
|
||||||
|
|
||||||
@ -95,6 +110,7 @@ class SourceView(PageView.ListView):
|
|||||||
<menuitem action="Edit"/>
|
<menuitem action="Edit"/>
|
||||||
<menuitem action="Remove"/>
|
<menuitem action="Remove"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
|
<menuitem action="ColumnEdit"/>
|
||||||
</menu>
|
</menu>
|
||||||
</menubar>
|
</menubar>
|
||||||
<toolbar name="ToolBar">
|
<toolbar name="ToolBar">
|
||||||
|
@ -382,6 +382,7 @@ class RecentDocsMenu:
|
|||||||
db = GrampsDb.gramps_db_factory(dbtype)()
|
db = GrampsDb.gramps_db_factory(dbtype)()
|
||||||
self.state.change_database(db)
|
self.state.change_database(db)
|
||||||
self.fileopen(name)
|
self.fileopen(name)
|
||||||
|
self.state.signal_change()
|
||||||
RecentFiles.recent_files(name,dbtype)
|
RecentFiles.recent_files(name,dbtype)
|
||||||
self.build()
|
self.build()
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ import Utils
|
|||||||
import DateHandler
|
import DateHandler
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
import QuestionDialog
|
import QuestionDialog
|
||||||
from WindowUtils import GladeIf
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -146,14 +145,16 @@ class GrampsPreferences:
|
|||||||
self.built = 0
|
self.built = 0
|
||||||
self.db = db
|
self.db = db
|
||||||
self.top = gtk.glade.XML(const.gladeFile,"preferences","gramps")
|
self.top = gtk.glade.XML(const.gladeFile,"preferences","gramps")
|
||||||
self.gladeif = GladeIf(self.top)
|
|
||||||
|
|
||||||
self.gladeif.connect('button6','clicked',self.on_close_clicked)
|
self.top.get_widget('button6').connect('clicked',self.on_close_clicked)
|
||||||
self.gladeif.connect('button7','clicked',self.on_propertybox_help)
|
self.top.get_widget('button7').connect('clicked',self.help_clicked)
|
||||||
|
|
||||||
self.window = self.top.get_widget("preferences")
|
self.window = self.top.get_widget("preferences")
|
||||||
self.window.connect('delete_event',self.on_close_clicked)
|
self.window.connect('delete_event',self.on_close_clicked)
|
||||||
self.tree = self.top.get_widget("tree")
|
self.tree = self.top.get_widget("tree")
|
||||||
|
self.image = self.top.get_widget('image')
|
||||||
|
self.image.set_from_file(os.path.join(const.image_dir,'splash.jpg'))
|
||||||
|
|
||||||
self.store = gtk.TreeStore(gobject.TYPE_STRING)
|
self.store = gtk.TreeStore(gobject.TYPE_STRING)
|
||||||
self.selection = self.tree.get_selection()
|
self.selection = self.tree.get_selection()
|
||||||
self.selection.connect('changed',self.select)
|
self.selection.connect('changed',self.select)
|
||||||
@ -379,13 +380,12 @@ class GrampsPreferences:
|
|||||||
if node and self.imap.has_key(path):
|
if node and self.imap.has_key(path):
|
||||||
self.panel.set_current_page(self.imap[path])
|
self.panel.set_current_page(self.imap[path])
|
||||||
|
|
||||||
def on_propertybox_help(self,obj):
|
def help_clicked(self,obj):
|
||||||
GrampsDisplay.help('gramps-prefs')
|
GrampsDisplay.help('gramps-prefs')
|
||||||
|
|
||||||
def on_close_clicked(self,obj=None,dummy=None):
|
def on_close_clicked(self,obj=None,dummy=None):
|
||||||
if not self.save_prefix():
|
if not self.save_prefix():
|
||||||
return False
|
return False
|
||||||
self.gladeif.close()
|
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
@ -280,13 +280,13 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
self.full_name = os.path.abspath(name)
|
self.full_name = os.path.abspath(name)
|
||||||
self.brief_name = os.path.basename(name)
|
self.brief_name = os.path.basename(name)
|
||||||
|
|
||||||
|
self.metadata = self.open_table(self.full_name, "meta", no_txn=True)
|
||||||
|
|
||||||
self.family_map = self.open_table(self.full_name, "family")
|
self.family_map = self.open_table(self.full_name, "family")
|
||||||
self.place_map = self.open_table(self.full_name, "places")
|
self.place_map = self.open_table(self.full_name, "places")
|
||||||
self.source_map = self.open_table(self.full_name, "sources")
|
self.source_map = self.open_table(self.full_name, "sources")
|
||||||
self.media_map = self.open_table(self.full_name, "media")
|
self.media_map = self.open_table(self.full_name, "media")
|
||||||
self.event_map = self.open_table(self.full_name, "events")
|
self.event_map = self.open_table(self.full_name, "events")
|
||||||
self.metadata = self.open_table(self.full_name, "meta",
|
|
||||||
no_txn=True)
|
|
||||||
self.person_map = self.open_table(self.full_name, "person")
|
self.person_map = self.open_table(self.full_name, "person")
|
||||||
self.repository_map = self.open_table(self.full_name, "repository")
|
self.repository_map = self.open_table(self.full_name, "repository")
|
||||||
self.reference_map = self.open_table(self.full_name, "reference_map",
|
self.reference_map = self.open_table(self.full_name, "reference_map",
|
||||||
|
@ -2040,6 +2040,8 @@ class DbState(GrampsDBCallback):
|
|||||||
self.db.connect('place-rebuild',self._place_rebuild)
|
self.db.connect('place-rebuild',self._place_rebuild)
|
||||||
self.active = None
|
self.active = None
|
||||||
self.open = True
|
self.open = True
|
||||||
|
|
||||||
|
def signal_change(self):
|
||||||
self.emit('database-changed',(self.db,))
|
self.emit('database-changed',(self.db,))
|
||||||
|
|
||||||
def no_database(self):
|
def no_database(self):
|
||||||
|
@ -94,7 +94,6 @@ gdir_PYTHON = \
|
|||||||
SelectPerson.py\
|
SelectPerson.py\
|
||||||
Sort.py\
|
Sort.py\
|
||||||
soundex.py\
|
soundex.py\
|
||||||
Sources.py\
|
|
||||||
Spell.py\
|
Spell.py\
|
||||||
SpreadSheetDoc.py\
|
SpreadSheetDoc.py\
|
||||||
StartupDialog.py\
|
StartupDialog.py\
|
||||||
|
@ -256,7 +256,10 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self.prev_handle = node
|
self.prev_handle = node
|
||||||
return COLUMN_DEFS[col][COLUMN_DEF_LIST](self,self.prev_data,node)
|
return COLUMN_DEFS[col][COLUMN_DEF_LIST](self,self.prev_data,node)
|
||||||
except:
|
except:
|
||||||
return u'error'
|
if col == _MARKER_COL:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return u'error'
|
||||||
|
|
||||||
def on_iter_next(self, node):
|
def on_iter_next(self, node):
|
||||||
'''returns the next node at this level of the tree'''
|
'''returns the next node at this level of the tree'''
|
||||||
|
@ -1,276 +0,0 @@
|
|||||||
#
|
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Python modules
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
from gettext import gettext as _
|
|
||||||
import gc
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# GTK/Gnome modules
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
import gtk
|
|
||||||
import gtk.glade
|
|
||||||
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file
|
|
||||||
import cPickle as pickle
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# gramps modules
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
import const
|
|
||||||
import Utils
|
|
||||||
import RelLib
|
|
||||||
import DateEdit
|
|
||||||
import DateHandler
|
|
||||||
import GrampsDisplay
|
|
||||||
import Spell
|
|
||||||
import DisplayState
|
|
||||||
|
|
||||||
from DdTargets import DdTargets
|
|
||||||
from WindowUtils import GladeIf
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# SourceEditor
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class SourceEditor(DisplayState.ManagedWindow):
|
|
||||||
|
|
||||||
def __init__(self, state, uistate, track, srcref, update):
|
|
||||||
|
|
||||||
self.db = state.db
|
|
||||||
self.state = state
|
|
||||||
self.track = track
|
|
||||||
self.uistate = uistate
|
|
||||||
if srcref:
|
|
||||||
submenu_label = _('Source Reference')
|
|
||||||
else:
|
|
||||||
submenu_label = _('New Source Reference')
|
|
||||||
|
|
||||||
DisplayState.ManagedWindow.__init__(self, uistate, self.track, srcref)
|
|
||||||
|
|
||||||
self.update = update
|
|
||||||
self.source_ref = srcref
|
|
||||||
self.showSource = gtk.glade.XML(const.gladeFile,
|
|
||||||
"sourceDisplay","gramps")
|
|
||||||
self.window = self.get_widget("sourceDisplay")
|
|
||||||
|
|
||||||
Utils.set_titles(self.window,
|
|
||||||
self.showSource.get_widget('title'),
|
|
||||||
_('Source Information'))
|
|
||||||
|
|
||||||
self.gladeif = GladeIf(self.showSource)
|
|
||||||
self.gladeif.connect('sourceDisplay','delete_event', self.on_delete_event)
|
|
||||||
self.gladeif.connect('button95','clicked',self.close)
|
|
||||||
self.gladeif.connect('ok','clicked',self.on_sourceok_clicked)
|
|
||||||
self.gladeif.connect('button144','clicked', self.on_help_clicked)
|
|
||||||
self.gladeif.connect('button143','clicked',self.add_src_clicked)
|
|
||||||
addbtn = self.get_widget('button143')
|
|
||||||
addbtn.set_sensitive(not self.db.readonly)
|
|
||||||
|
|
||||||
self.source_field = self.get_widget("sourceList")
|
|
||||||
|
|
||||||
# setup menu
|
|
||||||
self.title_menu = self.get_widget("source_title")
|
|
||||||
cell = gtk.CellRendererText()
|
|
||||||
self.title_menu.pack_start(cell,True)
|
|
||||||
self.title_menu.add_attribute(cell,'text',0)
|
|
||||||
self.title_menu.connect('changed',self.on_source_changed)
|
|
||||||
self.conf_menu = self.get_widget("conf")
|
|
||||||
self.conf_menu.set_sensitive(not self.db.readonly)
|
|
||||||
self.private = self.get_widget("priv")
|
|
||||||
self.private.set_sensitive(not self.db.readonly)
|
|
||||||
self.ok = self.get_widget("ok")
|
|
||||||
self.conf_menu.set_active(srcref.get_confidence_level())
|
|
||||||
|
|
||||||
self.author_field = self.get_widget("sauthor")
|
|
||||||
self.pub_field = self.get_widget("spubinfo")
|
|
||||||
|
|
||||||
self.date_entry_field = self.get_widget("sdate")
|
|
||||||
self.date_entry_field.set_editable(not self.db.readonly)
|
|
||||||
|
|
||||||
if self.source_ref:
|
|
||||||
handle = self.source_ref.get_base_handle()
|
|
||||||
self.active_source = self.db.get_source_from_handle(handle)
|
|
||||||
self.date_obj = self.source_ref.get_date_object()
|
|
||||||
date_str = DateHandler.displayer.display(self.date_obj)
|
|
||||||
self.date_entry_field.set_text(date_str)
|
|
||||||
self.private.set_active(self.source_ref.get_privacy())
|
|
||||||
else:
|
|
||||||
self.date_obj = RelLib.Date()
|
|
||||||
self.active_source = None
|
|
||||||
|
|
||||||
date_stat = self.get_widget("date_stat")
|
|
||||||
date_stat.set_sensitive(not self.db.readonly)
|
|
||||||
self.date_check = DateEdit.DateEdit(
|
|
||||||
self.date_obj, self.date_entry_field,
|
|
||||||
date_stat, self.window)
|
|
||||||
|
|
||||||
self.spage = self.get_widget("spage")
|
|
||||||
self.spage.set_editable(not self.db.readonly)
|
|
||||||
self.scom = self.get_widget("scomment")
|
|
||||||
self.scom.set_editable(not self.db.readonly)
|
|
||||||
self.spell1 = Spell.Spell(self.scom)
|
|
||||||
self.stext = self.get_widget("stext")
|
|
||||||
self.stext.set_editable(not self.db.readonly)
|
|
||||||
self.spell2 = Spell.Spell(self.stext)
|
|
||||||
|
|
||||||
self.draw(self.active_source,fresh=True)
|
|
||||||
self.set_button()
|
|
||||||
self.db.connect('source-add', self.rebuild_menu)
|
|
||||||
self.show()
|
|
||||||
|
|
||||||
def build_menu_names(self,srcref):
|
|
||||||
if srcref:
|
|
||||||
submenu_label = _('Source Reference')
|
|
||||||
else:
|
|
||||||
submenu_label = _('New Source Reference')
|
|
||||||
return (_('Source Reference Editor'),submenu_label)
|
|
||||||
|
|
||||||
def rebuild_menu(self,handle_list):
|
|
||||||
self.build_source_menu(handle_list[0])
|
|
||||||
|
|
||||||
def on_delete_event(self,obj,b):
|
|
||||||
self.gladeif.close()
|
|
||||||
gc.collect()
|
|
||||||
|
|
||||||
def close(self,obj):
|
|
||||||
self.gladeif.close()
|
|
||||||
self.window.destroy()
|
|
||||||
gc.collect()
|
|
||||||
|
|
||||||
def on_help_clicked(self,obj):
|
|
||||||
"""Display the relevant portion of GRAMPS manual"""
|
|
||||||
GrampsDisplay.help('adv-si')
|
|
||||||
|
|
||||||
def set_button(self):
|
|
||||||
if self.active_source:
|
|
||||||
self.ok.set_sensitive(not self.db.readonly)
|
|
||||||
else:
|
|
||||||
self.ok.set_sensitive(False)
|
|
||||||
|
|
||||||
def get_widget(self,name):
|
|
||||||
"""returns the widget associated with the specified name"""
|
|
||||||
return self.showSource.get_widget(name)
|
|
||||||
|
|
||||||
def draw(self,sel=None,fresh=False):
|
|
||||||
if self.source_ref and fresh:
|
|
||||||
self.spage.get_buffer().set_text(self.source_ref.get_page())
|
|
||||||
|
|
||||||
self.stext.get_buffer().set_text(self.source_ref.get_text())
|
|
||||||
self.scom.get_buffer().set_text(self.source_ref.get_note())
|
|
||||||
idval = self.source_ref.get_base_handle()
|
|
||||||
src = self.db.get_source_from_handle(idval)
|
|
||||||
self.active_source = src
|
|
||||||
if src:
|
|
||||||
self.author_field.set_text(src.get_author())
|
|
||||||
self.pub_field.set_text(src.get_publication_info())
|
|
||||||
else:
|
|
||||||
self.author_field.set_text("")
|
|
||||||
self.pub_field.set_text("")
|
|
||||||
self.active_source = sel
|
|
||||||
if sel:
|
|
||||||
self.build_source_menu(sel.get_handle())
|
|
||||||
else:
|
|
||||||
self.build_source_menu(None)
|
|
||||||
|
|
||||||
def build_source_menu(self,selected_handle):
|
|
||||||
keys = self.db.get_source_handles()
|
|
||||||
keys.sort(self.db._sortbysource)
|
|
||||||
|
|
||||||
store = gtk.ListStore(str)
|
|
||||||
|
|
||||||
sel_child = None
|
|
||||||
index = 0
|
|
||||||
sel_index = 0
|
|
||||||
self.handle_list = []
|
|
||||||
for src_id in keys:
|
|
||||||
src = self.db.get_source_from_handle(src_id)
|
|
||||||
title = src.get_title()
|
|
||||||
gid = src.get_gramps_id()
|
|
||||||
|
|
||||||
if len(title) > 40:
|
|
||||||
title = title[0:37] + "..."
|
|
||||||
|
|
||||||
store.append(row=["%s [%s]" % (title,gid)])
|
|
||||||
self.handle_list.append(src_id)
|
|
||||||
if selected_handle == src_id:
|
|
||||||
sel_index = index
|
|
||||||
index += 1
|
|
||||||
self.title_menu.set_model(store)
|
|
||||||
|
|
||||||
if index > 0:
|
|
||||||
self.title_menu.set_sensitive(not self.db.readonly)
|
|
||||||
self.title_menu.set_active(sel_index)
|
|
||||||
else:
|
|
||||||
self.title_menu.set_sensitive(0)
|
|
||||||
|
|
||||||
def on_sourceok_clicked(self,obj):
|
|
||||||
|
|
||||||
shandle = self.source_ref.get_base_handle()
|
|
||||||
if self.active_source != self.db.get_source_from_handle(shandle):
|
|
||||||
self.source_ref.set_base_handle(self.active_source.get_handle())
|
|
||||||
|
|
||||||
conf = self.get_widget("conf").get_active()
|
|
||||||
|
|
||||||
buf = self.scom.get_buffer()
|
|
||||||
comments = unicode(buf.get_text(buf.get_start_iter(),
|
|
||||||
buf.get_end_iter(),False))
|
|
||||||
|
|
||||||
buf = self.stext.get_buffer()
|
|
||||||
text = unicode(buf.get_text(buf.get_start_iter(),
|
|
||||||
buf.get_end_iter(),False))
|
|
||||||
|
|
||||||
buf = self.spage.get_buffer()
|
|
||||||
page = unicode(buf.get_text(buf.get_start_iter(),
|
|
||||||
buf.get_end_iter(),False))
|
|
||||||
|
|
||||||
self.source_ref.set_page(page)
|
|
||||||
self.source_ref.set_date_object(self.date_obj)
|
|
||||||
self.source_ref.set_text(text)
|
|
||||||
self.source_ref.set_note(comments)
|
|
||||||
self.source_ref.set_confidence_level(conf)
|
|
||||||
self.source_ref.set_privacy(self.private.get_active())
|
|
||||||
|
|
||||||
self.update(self.source_ref)
|
|
||||||
self.close(obj)
|
|
||||||
|
|
||||||
def on_source_changed(self,obj):
|
|
||||||
handle = self.handle_list[obj.get_active()]
|
|
||||||
self.active_source = self.db.get_source_from_handle(handle)
|
|
||||||
self.author_field.set_text(self.active_source.get_author())
|
|
||||||
self.pub_field.set_text(self.active_source.get_publication_info())
|
|
||||||
self.set_button()
|
|
||||||
|
|
||||||
def update_display(self,source):
|
|
||||||
self.draw(source,fresh=False)
|
|
||||||
|
|
||||||
def add_src_clicked(self,obj):
|
|
||||||
import EditSource
|
|
||||||
EditSource.EditSource(self.state, self.uistate, self.track, RelLib.Source())
|
|
@ -309,7 +309,7 @@ class ViewManager:
|
|||||||
('OpenRecent', None, 'Open _Recent'),
|
('OpenRecent', None, 'Open _Recent'),
|
||||||
('Quit', gtk.STOCK_QUIT, '_Quit', "<control>q", None, self.quit),
|
('Quit', gtk.STOCK_QUIT, '_Quit', "<control>q", None, self.quit),
|
||||||
('ViewMenu', None, '_View'),
|
('ViewMenu', None, '_View'),
|
||||||
('Preferences', gtk.STOCK_PREFERENCES, '_Preferences'),
|
('Preferences', gtk.STOCK_PREFERENCES, '_Preferences', None, None, self.preferences_activate),
|
||||||
('HelpMenu', None, '_Help'),
|
('HelpMenu', None, '_Help'),
|
||||||
('HomePage', None, _('GRAMPS _home page'), None, None, self.home_page_activate),
|
('HomePage', None, _('GRAMPS _home page'), None, None, self.home_page_activate),
|
||||||
('MailingLists', None, _('GRAMPS _mailing lists'), None, None, self.mailing_lists_activate),
|
('MailingLists', None, _('GRAMPS _mailing lists'), None, None, self.mailing_lists_activate),
|
||||||
@ -375,6 +375,9 @@ class ViewManager:
|
|||||||
def mailing_lists_activate(self,obj):
|
def mailing_lists_activate(self,obj):
|
||||||
GrampsDisplay.url( const.url_mailinglist)
|
GrampsDisplay.url( const.url_mailinglist)
|
||||||
|
|
||||||
|
def preferences_activate(self,obj):
|
||||||
|
GrampsCfg.display_preferences_box(self.state.db)
|
||||||
|
|
||||||
def report_bug_activate(self,obj):
|
def report_bug_activate(self,obj):
|
||||||
GrampsDisplay.url( const.url_bugtracker)
|
GrampsDisplay.url( const.url_bugtracker)
|
||||||
|
|
||||||
@ -662,6 +665,7 @@ class ViewManager:
|
|||||||
self.state.change_database(GrampsDb.gramps_db_factory(const.app_gramps)())
|
self.state.change_database(GrampsDb.gramps_db_factory(const.app_gramps)())
|
||||||
self.uistate.clear_history()
|
self.uistate.clear_history()
|
||||||
self.read_file(filename)
|
self.read_file(filename)
|
||||||
|
self.state.signal_change()
|
||||||
self.change_page(None,None)
|
self.change_page(None,None)
|
||||||
# Add the file to the recent items
|
# Add the file to the recent items
|
||||||
RecentFiles.recent_files(filename,const.app_gramps)
|
RecentFiles.recent_files(filename,const.app_gramps)
|
||||||
@ -685,14 +689,17 @@ class ViewManager:
|
|||||||
if filetype == const.app_gramps:
|
if filetype == const.app_gramps:
|
||||||
self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gramps)())
|
self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gramps)())
|
||||||
success = self.read_file(filename) #,update_msg)
|
success = self.read_file(filename) #,update_msg)
|
||||||
|
self.state.signal_change()
|
||||||
self.change_page(None,None)
|
self.change_page(None,None)
|
||||||
elif filetype == const.app_gramps_xml:
|
elif filetype == const.app_gramps_xml:
|
||||||
self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gramps_xml)())
|
self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gramps_xml)())
|
||||||
success = self.read_file(filename)
|
success = self.read_file(filename)
|
||||||
|
self.state.signal_change()
|
||||||
self.change_page(None,None)
|
self.change_page(None,None)
|
||||||
elif filetype == const.app_gedcom:
|
elif filetype == const.app_gedcom:
|
||||||
self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gedcom)())
|
self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gedcom)())
|
||||||
success = self.read_file(filename)
|
success = self.read_file(filename)
|
||||||
|
self.state.signal_change()
|
||||||
self.change_page(None,None)
|
self.change_page(None,None)
|
||||||
|
|
||||||
if success:
|
if success:
|
||||||
|
@ -2335,9 +2335,8 @@
|
|||||||
<property name="spacing">0</property>
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImage" id="pixmap1">
|
<widget class="GtkImage" id="image">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="pixbuf">splash.jpg</property>
|
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
<property name="yalign">0.5</property>
|
<property name="yalign">0.5</property>
|
||||||
<property name="xpad">0</property>
|
<property name="xpad">0</property>
|
||||||
@ -4327,7 +4326,8 @@ Text Beside Icons</property>
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkImage" id="image2329">
|
<widget class="GtkImage" id="image2329">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="pixbuf">images/edit_sm.png</property>
|
<property name="stock">gtk-edit</property>
|
||||||
|
<property name="icon_size">4</property>
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
<property name="yalign">0.5</property>
|
<property name="yalign">0.5</property>
|
||||||
<property name="xpad">0</property>
|
<property name="xpad">0</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user