2007-07-17 Don Allingham <don@gramps-project.org>
* src/Editors/_EditSourceRef.py: remove text tab * src/Editors/_EditRepoRef.py: Add privacy to reporef * src/Lru.py: pylint * src/Selectors/_BaseSelector.py: set sort column * src/DbManager.py: clean up of dnd * src/glade/gramps.glade: Add privacy to reporef * src/DisplayModels/_PeopleModel.py: try to speed up sorts using mapper values * src/GrampsDbUtils/_GedcomParse.py: handle source text citations * src/GrampsDbUtils/_ReadGedcom.py: type check * src/GrampsDbUtils/_GedcomLex.py: handle broken conc * src/GrampsDbUtils/_WriteGedcom.py: handle source text citations svn: r8734
This commit is contained in:
parent
8638e1d326
commit
582c56e11e
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
2007-07-17 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Editors/_EditSourceRef.py: remove text tab
|
||||||
|
* src/Editors/_EditRepoRef.py: Add privacy to reporef
|
||||||
|
* src/Lru.py: pylint
|
||||||
|
* src/Selectors/_BaseSelector.py: set sort column
|
||||||
|
* src/DbManager.py: clean up of dnd
|
||||||
|
* src/glade/gramps.glade: Add privacy to reporef
|
||||||
|
* src/DisplayModels/_PeopleModel.py: try to speed up sorts using
|
||||||
|
mapper values
|
||||||
|
* src/GrampsDbUtils/_GedcomParse.py: handle source text citations
|
||||||
|
* src/GrampsDbUtils/_ReadGedcom.py: type check
|
||||||
|
* src/GrampsDbUtils/_GedcomLex.py: handle broken conc
|
||||||
|
* src/GrampsDbUtils/_WriteGedcom.py: handle source text citations
|
||||||
|
|
||||||
2007-07-17 Alex Roitman <shura@gramps-project.org>
|
2007-07-17 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/RelLib/_SourceRef.py (unserialize): Minor change.
|
* src/RelLib/_SourceRef.py (unserialize): Minor change.
|
||||||
* src/RelLib/_Source.py: Remove note.
|
* src/RelLib/_Source.py: Remove note.
|
||||||
|
2
TODO
2
TODO
@ -1,3 +1,5 @@
|
|||||||
|
* Remove GCONF, provide up grade path
|
||||||
|
|
||||||
* Replace the LPRDoc interface (based on gnome-print) with a GTK based
|
* Replace the LPRDoc interface (based on gnome-print) with a GTK based
|
||||||
print routine. This would remove one of the last gnome-specific
|
print routine. This would remove one of the last gnome-specific
|
||||||
libraries, and make portability better. Even more important, the
|
libraries, and make portability better. Even more important, the
|
||||||
|
@ -134,6 +134,7 @@ class DbManager:
|
|||||||
self.active = None
|
self.active = None
|
||||||
|
|
||||||
self.selection = self.dblist.get_selection()
|
self.selection = self.dblist.get_selection()
|
||||||
|
self.dblist.set_rules_hint(True)
|
||||||
|
|
||||||
self.current_names = []
|
self.current_names = []
|
||||||
|
|
||||||
@ -155,6 +156,8 @@ class DbManager:
|
|||||||
self.selection.connect('changed', self.__selection_changed)
|
self.selection.connect('changed', self.__selection_changed)
|
||||||
self.dblist.connect('button-press-event', self.__button_press)
|
self.dblist.connect('button-press-event', self.__button_press)
|
||||||
self.top.connect('drag_data_received', self.__drag_data_received)
|
self.top.connect('drag_data_received', self.__drag_data_received)
|
||||||
|
self.top.connect('drag_motion', self.__drag_motion)
|
||||||
|
self.top.connect('drag_drop', self.__drop_cb)
|
||||||
|
|
||||||
if RCS_FOUND:
|
if RCS_FOUND:
|
||||||
self.rcs.connect('clicked', self.__rcs)
|
self.rcs.connect('clicked', self.__rcs)
|
||||||
@ -646,29 +649,27 @@ class DbManager:
|
|||||||
start_editing=True)
|
start_editing=True)
|
||||||
return new_path
|
return new_path
|
||||||
|
|
||||||
|
def __drag_motion(self, wid, context, x, y, time):
|
||||||
|
context.drag_status(gtk.gdk.ACTION_COPY, time)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def __drop_cb(self, wid, context, x, y, time):
|
||||||
|
context.finish(True, False, time)
|
||||||
|
return True
|
||||||
|
|
||||||
def __drag_data_received(self, widget, context, xpos, ypos, selection,
|
def __drag_data_received(self, widget, context, xpos, ypos, selection,
|
||||||
info, rtime):
|
info, rtime):
|
||||||
"""
|
"""
|
||||||
Handle the reception of drag data
|
Handle the reception of drag data
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# The selection object contains the appropriate information.
|
drag_value = selection.data
|
||||||
# Unfortunately, not all file managers work the same. Nautilus
|
print drag_value
|
||||||
# stores the file name as the text item in selection, while
|
|
||||||
# thunar holds it in uris.
|
|
||||||
|
|
||||||
# Check for Thunar
|
|
||||||
uris = selection.get_uris()
|
|
||||||
|
|
||||||
if uris: # Thunar
|
|
||||||
drag_value = uris[0]
|
|
||||||
elif selection.get_text(): # Nautilus
|
|
||||||
drag_value = selection.get_text().strip()
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
# we are only interested in this if it is a file:// URL.
|
# we are only interested in this if it is a file:// URL.
|
||||||
if drag_value[0:7] == "file://":
|
if drag_value and drag_value[0:7] == "file://":
|
||||||
|
|
||||||
|
drag_value = drag_value.strip()
|
||||||
|
|
||||||
# deterimine the mime type. If it is one that we are interested in,
|
# deterimine the mime type. If it is one that we are interested in,
|
||||||
# we process it
|
# we process it
|
||||||
|
@ -332,7 +332,6 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self.displayed = 0
|
self.displayed = 0
|
||||||
|
|
||||||
while node:
|
while node:
|
||||||
#for node in self.db.get_person_cursor_iter():
|
|
||||||
self.total += 1
|
self.total += 1
|
||||||
handle, d = node
|
handle, d = node
|
||||||
if not (handle in skip or (dfilter and not dfilter.match(handle))):
|
if not (handle in skip or (dfilter and not dfilter.match(handle))):
|
||||||
@ -458,6 +457,8 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
# return values for 'data' row, calling a function
|
# return values for 'data' row, calling a function
|
||||||
# according to column_defs table
|
# according to column_defs table
|
||||||
try:
|
try:
|
||||||
|
if col == 0:
|
||||||
|
return self.mapper.sortnames[node]
|
||||||
try:
|
try:
|
||||||
data = self.lru_data[node]
|
data = self.lru_data[node]
|
||||||
except:
|
except:
|
||||||
|
@ -96,6 +96,11 @@ class EditRepoRef(EditReference):
|
|||||||
self.source,
|
self.source,
|
||||||
self.db.readonly)
|
self.db.readonly)
|
||||||
|
|
||||||
|
self.privacy = PrivacyButton(
|
||||||
|
self.top.get_widget("private_ref"),
|
||||||
|
self.source_ref,
|
||||||
|
self.db.readonly)
|
||||||
|
|
||||||
self.title = MonitoredEntry(
|
self.title = MonitoredEntry(
|
||||||
self.top.get_widget('repo_name'),
|
self.top.get_widget('repo_name'),
|
||||||
self.source.set_name,
|
self.source.set_name,
|
||||||
|
@ -165,9 +165,9 @@ class EditSourceRef(EditReference):
|
|||||||
self.enable_warnbox
|
self.enable_warnbox
|
||||||
))
|
))
|
||||||
|
|
||||||
self.text_tab = self._add_tab(
|
# self.text_tab = self._add_tab(
|
||||||
notebook_ref,
|
# notebook_ref,
|
||||||
TextTab(self.dbstate, self.uistate, self.track,self.source_ref))
|
# TextTab(self.dbstate, self.uistate, self.track,self.source_ref))
|
||||||
|
|
||||||
self.comment_tab = self._add_tab(
|
self.comment_tab = self._add_tab(
|
||||||
notebook_ref,
|
notebook_ref,
|
||||||
|
@ -331,10 +331,8 @@ class Reader:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def set_broken_conc(self, broken):
|
def set_broken_conc(self, broken):
|
||||||
self.func_map = {
|
if broken:
|
||||||
TOKEN_CONT : self.__fix_token_cont,
|
self.func_map[TOKEN_CONC] = self.__fix_token_broken_conc
|
||||||
TOKEN_CONC : self.__fix_token_broken_conc,
|
|
||||||
}
|
|
||||||
|
|
||||||
def readline(self):
|
def readline(self):
|
||||||
if len(self.current_list) <= 1 and not self.eof:
|
if len(self.current_list) <= 1 and not self.eof:
|
||||||
|
@ -303,6 +303,7 @@ class StageOne:
|
|||||||
else:
|
else:
|
||||||
self.famc[value] = [current]
|
self.famc[value] = [current]
|
||||||
elif key == 'CHAR' and not self.enc:
|
elif key == 'CHAR' and not self.enc:
|
||||||
|
assert(type(value) == str or type(value) == unicode)
|
||||||
self.enc = value
|
self.enc = value
|
||||||
|
|
||||||
def get_famc_map(self):
|
def get_famc_map(self):
|
||||||
@ -315,6 +316,7 @@ class StageOne:
|
|||||||
return self.enc.upper()
|
return self.enc.upper()
|
||||||
|
|
||||||
def set_encoding(self, enc):
|
def set_encoding(self, enc):
|
||||||
|
assert(type(enc) == str or type(enc) == unicode)
|
||||||
self.enc = enc
|
self.enc = enc
|
||||||
|
|
||||||
def get_person_count(self):
|
def get_person_count(self):
|
||||||
@ -3474,7 +3476,14 @@ class GedcomParser(UpdateCallback):
|
|||||||
state.src_ref.set_date_object(line.data)
|
state.src_ref.set_date_object(line.data)
|
||||||
|
|
||||||
def __source_data_text(self, line, state):
|
def __source_data_text(self, line, state):
|
||||||
state.src_ref.set_text(line.data)
|
note = RelLib.Note()
|
||||||
|
note.set(line.data)
|
||||||
|
gramps_id = self.dbase.find_next_note_gramps_id()
|
||||||
|
note.set_gramps_id(gramps_id)
|
||||||
|
note.set_type(RelLib.NoteType.SOURCE_TEXT)
|
||||||
|
self.dbase.add_note(note, self.trans)
|
||||||
|
|
||||||
|
state.src_ref.add_note(note.get_handle())
|
||||||
|
|
||||||
def __source_data_note(self, line, state):
|
def __source_data_note(self, line, state):
|
||||||
self.__parse_note(line, state.src_ref, state.level)
|
self.__parse_note(line, state.src_ref, state.level)
|
||||||
|
@ -63,12 +63,15 @@ def importData(database, filename, callback=None, use_trans=False):
|
|||||||
code_set = code.get_active()
|
code_set = code.get_active()
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
else:
|
else:
|
||||||
code_set = None
|
code_set = ""
|
||||||
|
|
||||||
import2(database, filename, callback, code_set, use_trans)
|
import2(database, filename, callback, code_set, use_trans)
|
||||||
|
|
||||||
def import2(database, filename, callback, code_set, use_trans):
|
def import2(database, filename, callback, code_set, use_trans):
|
||||||
# add some checking here
|
# add some checking here
|
||||||
|
|
||||||
|
assert(type(code_set) == str or type(code_set) == unicode)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ifile = open(filename,"rU")
|
ifile = open(filename,"rU")
|
||||||
np = StageOne(ifile)
|
np = StageOne(ifile)
|
||||||
|
@ -1396,6 +1396,8 @@ class GedcomWriter(UpdateCallback):
|
|||||||
|
|
||||||
self.slist.add(src_handle)
|
self.slist.add(src_handle)
|
||||||
|
|
||||||
|
already_printed = None
|
||||||
|
|
||||||
if self.source_refs:
|
if self.source_refs:
|
||||||
# Reference to the source
|
# Reference to the source
|
||||||
self.writeln("%d SOUR @%s@" % (level,src.get_gramps_id()))
|
self.writeln("%d SOUR @%s@" % (level,src.get_gramps_id()))
|
||||||
@ -1409,13 +1411,25 @@ class GedcomWriter(UpdateCallback):
|
|||||||
if conf != RelLib.SourceRef.CONF_NORMAL and conf != -1:
|
if conf != RelLib.SourceRef.CONF_NORMAL and conf != -1:
|
||||||
self.write_long_text("QUAY",level+1, str(quay_map[conf]))
|
self.write_long_text("QUAY",level+1, str(quay_map[conf]))
|
||||||
|
|
||||||
ref_text = ref.get_text()
|
if len(ref.get_note_list()) > 0:
|
||||||
|
|
||||||
|
note_list = [ self.db.get_note_from_handle(h) for h in ref.get_note_list() ]
|
||||||
|
note_list = [ n for n in note_list
|
||||||
|
if n.get_type() == RelLib.NoteType.SOURCE_TEXT]
|
||||||
|
|
||||||
|
if note_list:
|
||||||
|
ref_text = note_list[0].get()
|
||||||
|
already_printed = note_list[0].get_handle()
|
||||||
|
else:
|
||||||
|
ref_text = ""
|
||||||
|
|
||||||
if ref_text != "" or not ref.get_date_object().is_empty():
|
if ref_text != "" or not ref.get_date_object().is_empty():
|
||||||
self.writeln('%d DATA' % (level+1))
|
self.writeln('%d DATA' % (level+1))
|
||||||
if ref_text != "":
|
if ref_text != "":
|
||||||
self.write_long_text("TEXT",level+2,self.cnvtxt(ref_text))
|
self.write_long_text("TEXT",level+2,self.cnvtxt(ref_text))
|
||||||
pfx = "%d DATE" % (level+2)
|
pfx = "%d DATE" % (level+2)
|
||||||
self.print_date(pfx,ref.get_date_object())
|
self.print_date(pfx,ref.get_date_object())
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Inline source
|
# Inline source
|
||||||
|
|
||||||
@ -1436,6 +1450,7 @@ class GedcomWriter(UpdateCallback):
|
|||||||
self.write_long_text("TEXT",level+1,self.cnvtxt(ref_text))
|
self.write_long_text("TEXT",level+1,self.cnvtxt(ref_text))
|
||||||
|
|
||||||
for notehandle in ref.get_note_list():
|
for notehandle in ref.get_note_list():
|
||||||
|
if notehandle != already_printed:
|
||||||
self.write_note(level+1,notehandle)
|
self.write_note(level+1,notehandle)
|
||||||
|
|
||||||
def write_photo(self,photo,level):
|
def write_photo(self,photo,level):
|
||||||
|
38
src/Lru.py
38
src/Lru.py
@ -25,9 +25,9 @@ class Node:
|
|||||||
"""
|
"""
|
||||||
Node to be stored in the LRU structure
|
Node to be stored in the LRU structure
|
||||||
"""
|
"""
|
||||||
def __init__(self, prev, me):
|
def __init__(self, prev, value):
|
||||||
self.prev = prev
|
self.prev = prev
|
||||||
self.me = me
|
self.value = value
|
||||||
self.next = None
|
self.next = None
|
||||||
|
|
||||||
class LRU:
|
class LRU:
|
||||||
@ -36,7 +36,7 @@ class LRU:
|
|||||||
"""
|
"""
|
||||||
def __init__(self, count):
|
def __init__(self, count):
|
||||||
self.count = max(count, 2)
|
self.count = max(count, 2)
|
||||||
self.d = {}
|
self.data = {}
|
||||||
self.first = None
|
self.first = None
|
||||||
self.last = None
|
self.last = None
|
||||||
|
|
||||||
@ -44,19 +44,19 @@ class LRU:
|
|||||||
"""
|
"""
|
||||||
Returns True if the object is contained in the LRU
|
Returns True if the object is contained in the LRU
|
||||||
"""
|
"""
|
||||||
return obj in self.d
|
return obj in self.data
|
||||||
|
|
||||||
def __getitem__(self, obj):
|
def __getitem__(self, obj):
|
||||||
"""
|
"""
|
||||||
Returns item assocated with Obj
|
Returns item assocated with Obj
|
||||||
"""
|
"""
|
||||||
return self.d[obj].me[1]
|
return self.data[obj].value[1]
|
||||||
|
|
||||||
def __setitem__(self, obj, val):
|
def __setitem__(self, obj, val):
|
||||||
"""
|
"""
|
||||||
Sets the item in the LRU, removing an old entry if needed
|
Sets the item in the LRU, removing an old entry if needed
|
||||||
"""
|
"""
|
||||||
if obj in self.d:
|
if obj in self.data:
|
||||||
del self[obj]
|
del self[obj]
|
||||||
nobj = Node(self.last, (obj, val))
|
nobj = Node(self.last, (obj, val))
|
||||||
if self.first is None:
|
if self.first is None:
|
||||||
@ -64,24 +64,24 @@ class LRU:
|
|||||||
if self.last:
|
if self.last:
|
||||||
self.last.next = nobj
|
self.last.next = nobj
|
||||||
self.last = nobj
|
self.last = nobj
|
||||||
self.d[obj] = nobj
|
self.data[obj] = nobj
|
||||||
if len(self.d) > self.count:
|
if len(self.data) > self.count:
|
||||||
if self.first == self.last:
|
if self.first == self.last:
|
||||||
self.first = None
|
self.first = None
|
||||||
self.last = None
|
self.last = None
|
||||||
return
|
return
|
||||||
a = self.first
|
lnk = self.first
|
||||||
a.next.prev = None
|
lnk.next.prev = None
|
||||||
self.first = a.next
|
self.first = lnk.next
|
||||||
a.next = None
|
lnk.next = None
|
||||||
del self.d[a.me[0]]
|
del self.data[lnk.value[0]]
|
||||||
del a
|
del lnk
|
||||||
|
|
||||||
def __delitem__(self, obj):
|
def __delitem__(self, obj):
|
||||||
"""
|
"""
|
||||||
Delete the object from the LRU
|
Delete the object from the LRU
|
||||||
"""
|
"""
|
||||||
nobj = self.d[obj]
|
nobj = self.data[obj]
|
||||||
if nobj.prev:
|
if nobj.prev:
|
||||||
nobj.prev.next = nobj.next
|
nobj.prev.next = nobj.next
|
||||||
else:
|
else:
|
||||||
@ -90,7 +90,7 @@ class LRU:
|
|||||||
nobj.next.prev = nobj.prev
|
nobj.next.prev = nobj.prev
|
||||||
else:
|
else:
|
||||||
self.last = nobj.prev
|
self.last = nobj.prev
|
||||||
del self.d[obj]
|
del self.data[obj]
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
"""
|
"""
|
||||||
@ -99,7 +99,7 @@ class LRU:
|
|||||||
cur = self.first
|
cur = self.first
|
||||||
while cur != None:
|
while cur != None:
|
||||||
cur2 = cur.next
|
cur2 = cur.next
|
||||||
yield cur.me[1]
|
yield cur.value[1]
|
||||||
cur = cur2
|
cur = cur2
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ class LRU:
|
|||||||
cur = self.first
|
cur = self.first
|
||||||
while cur != None:
|
while cur != None:
|
||||||
cur2 = cur.next
|
cur2 = cur.next
|
||||||
yield cur.me
|
yield cur.value
|
||||||
cur = cur2
|
cur = cur2
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class LRU:
|
|||||||
"""
|
"""
|
||||||
Return keys in the LRU using a generator
|
Return keys in the LRU using a generator
|
||||||
"""
|
"""
|
||||||
return iter(self.d)
|
return iter(self.data)
|
||||||
|
|
||||||
def itervalues(self):
|
def itervalues(self):
|
||||||
"""
|
"""
|
||||||
|
@ -86,6 +86,7 @@ class BaseSelector(ManagedWindow.ManagedWindow):
|
|||||||
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
||||||
column.set_fixed_width(item[1])
|
column.set_fixed_width(item[1])
|
||||||
column.set_resizable(True)
|
column.set_resizable(True)
|
||||||
|
column.set_sort_column_id(ix)
|
||||||
tree.append_column(column)
|
tree.append_column(column)
|
||||||
|
|
||||||
def build_menu_names(self,obj):
|
def build_menu_names(self,obj):
|
||||||
|
@ -2360,7 +2360,7 @@
|
|||||||
<property name="rules_hint">True</property>
|
<property name="rules_hint">True</property>
|
||||||
<property name="reorderable">False</property>
|
<property name="reorderable">False</property>
|
||||||
<property name="enable_search">True</property>
|
<property name="enable_search">True</property>
|
||||||
<property name="fixed_height_mode">False</property>
|
<property name="fixed_height_mode">True</property>
|
||||||
<property name="hover_selection">False</property>
|
<property name="hover_selection">False</property>
|
||||||
<property name="hover_expand">False</property>
|
<property name="hover_expand">False</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -12105,11 +12105,42 @@ Very High</property>
|
|||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="y_options">fill</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkToggleButton" id="private_ref">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">Indicates if the record is private</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NONE</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="inconsistent">False</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="image2720">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon_size">4</property>
|
||||||
|
<property name="icon_name">gramps-unlock</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">2</property>
|
||||||
<property name="right_attach">3</property>
|
<property name="right_attach">3</property>
|
||||||
<property name="top_attach">0</property>
|
<property name="top_attach">0</property>
|
||||||
<property name="bottom_attach">1</property>
|
<property name="bottom_attach">1</property>
|
||||||
<property name="x_options">fill</property>
|
<property name="x_options">shrink</property>
|
||||||
<property name="y_options">fill</property>
|
<property name="y_options">shrink</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user