2007-03-03 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_GrampsGEDDB.py: readonly database for GEDCOM * src/Editors/_EditNote.py: add additional fields * src/RelLib/_Note.py: cleanup * src/DisplayTabs/_NoteModel.py: display correctly * src/GrampsWidgets.py: readonly support for checkbox * src/glade/gramps.glade: note fixes * src/DisplayModels/_NoteModel.py: display data correctly * src/GrampsDbUtils/_GedcomParse.py: cleanup * example/gramps/example.gramps: new note support * example/gedcom/sample.ged: new note support svn: r8264
This commit is contained in:
parent
cd570de9e3
commit
a7ad83b3ff
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2007-03-03 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsDb/_GrampsGEDDB.py: readonly database for GEDCOM
|
||||
* src/Editors/_EditNote.py: add additional fields
|
||||
* src/RelLib/_Note.py: cleanup
|
||||
* src/DisplayTabs/_NoteModel.py: display correctly
|
||||
* src/GrampsWidgets.py: readonly support for checkbox
|
||||
* src/glade/gramps.glade: note fixes
|
||||
* src/DisplayModels/_NoteModel.py: display data correctly
|
||||
* src/GrampsDbUtils/_GedcomParse.py: cleanup
|
||||
* example/gramps/example.gramps: new note support
|
||||
* example/gedcom/sample.ged: new note support
|
||||
|
||||
2007-03-02 Brian Matherly <brian@gramps-project.org>
|
||||
* src/plugins/AncestorChart2.py:
|
||||
* src/plugins/DescendChart.py:
|
||||
|
@ -13,6 +13,8 @@
|
||||
1 GEDC
|
||||
2 VERS 5.5
|
||||
2 FORM LINEAGE-LINKED
|
||||
1 PLAC
|
||||
2 FORM city, state
|
||||
1 _SCHEMA
|
||||
2 INDI
|
||||
3 _FA1
|
||||
|
@ -26,6 +26,7 @@
|
||||
#-------------------------------------------------------------------------
|
||||
import time
|
||||
import logging
|
||||
import re
|
||||
log = logging.getLogger(".")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -90,6 +91,11 @@ class NoteModel(BaseModel):
|
||||
|
||||
def column_preview(self,data):
|
||||
note = " ".join(data[2].split())
|
||||
note = re.sub(r'(<.*?>)', '', note)
|
||||
note = note.replace('&', '&')
|
||||
note = note.replace('<', '<')
|
||||
note = note.replace('>', '>')
|
||||
|
||||
if len(note) > 80:
|
||||
return note[:80]+"..."
|
||||
else:
|
||||
|
@ -41,6 +41,6 @@ class NoteModel(gtk.ListStore):
|
||||
note = self.db.get_note_from_handle(handle)
|
||||
self.append(row=[
|
||||
str(note.get_type()),
|
||||
note.get().replace('\n', ' ')[:80],
|
||||
note.delete_tags(note.get()).replace('\n', ' ')[:80],
|
||||
handle,
|
||||
])
|
||||
|
@ -102,15 +102,27 @@ class EditNote(EditPrimary):
|
||||
self.top.get_widget("type"),
|
||||
self.obj.set_type,
|
||||
self.obj.get_type,
|
||||
self.db.readonly,
|
||||
)
|
||||
self.db.readonly)
|
||||
|
||||
self.check = MonitoredCheckbox(
|
||||
self.obj,
|
||||
self.format,
|
||||
self.obj.set_format,
|
||||
self.obj.get_format,
|
||||
)
|
||||
readonly = self.db.readonly)
|
||||
|
||||
self.gid = MonitoredEntry(
|
||||
self.top.get_widget('id'),
|
||||
self.obj.set_gramps_id,
|
||||
self.obj.get_gramps_id,
|
||||
self.db.readonly)
|
||||
|
||||
self.marker = MonitoredDataType(
|
||||
self.top.get_widget('marker'),
|
||||
self.obj.set_marker,
|
||||
self.obj.get_marker,
|
||||
self.db.readonly,
|
||||
self.db.get_marker_types())
|
||||
|
||||
def _connect_signals(self):
|
||||
"""
|
||||
@ -131,11 +143,6 @@ class EditNote(EditPrimary):
|
||||
|
||||
self.text = gtk.TextView()
|
||||
self.text.set_accepts_tab(True)
|
||||
# Accelerator dictionary used for formatting shortcuts
|
||||
# key: tuple(key, modifier)
|
||||
# value: widget, to emit 'activate' signal on
|
||||
self.accelerator = {}
|
||||
self.text.connect('key-press-event', self._on_key_press_event)
|
||||
|
||||
if self.obj and self.obj.get_format():
|
||||
self.format.set_active(True)
|
||||
@ -143,28 +150,28 @@ class EditNote(EditPrimary):
|
||||
else:
|
||||
self.format.set_active(False)
|
||||
self.text.set_wrap_mode(gtk.WRAP_WORD)
|
||||
self.spellcheck = Spell.Spell(self.text)
|
||||
|
||||
self.format.connect('toggled', self.flow_changed)
|
||||
|
||||
scroll = gtk.ScrolledWindow()
|
||||
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
scroll.set_shadow_type(gtk.SHADOW_IN)
|
||||
scroll.add(self.text)
|
||||
# FIXME: is this signal called at all
|
||||
scroll.connect('focus-out-event', self.update)
|
||||
|
||||
self.buf = EditorBuffer()
|
||||
self.text.set_buffer(self.buf)
|
||||
|
||||
if self.obj:
|
||||
self.empty = False
|
||||
self.buf.set_text(self.obj.get(markup=True))
|
||||
else:
|
||||
self.empty = True
|
||||
|
||||
if not self.dbstate.db.readonly:
|
||||
self.accelerator = {}
|
||||
hbox = gtk.HBox()
|
||||
hbox.set_spacing(0)
|
||||
hbox.set_border_width(0)
|
||||
vbox.pack_start(hbox, False)
|
||||
|
||||
vbox.pack_start(scroll, True)
|
||||
vbox.set_spacing(6)
|
||||
vbox.set_border_width(6)
|
||||
|
||||
self.buf = EditorBuffer()
|
||||
self.text.set_buffer(self.buf)
|
||||
tooltips = gtk.Tooltips()
|
||||
for tip, stock, markup, accel in BUTTON:
|
||||
if markup:
|
||||
@ -181,12 +188,22 @@ class EditNote(EditPrimary):
|
||||
else:
|
||||
hbox.pack_start(gtk.VSeparator(), False)
|
||||
|
||||
if self.obj:
|
||||
self.empty = False
|
||||
self.buf.set_text(self.obj.get(markup=True))
|
||||
#log.debug("Text: %s" % self.buf.get_text())
|
||||
else:
|
||||
self.empty = True
|
||||
vbox.pack_start(scroll, True)
|
||||
vbox.set_spacing(6)
|
||||
vbox.set_border_width(6)
|
||||
|
||||
if self.dbstate.db.readonly:
|
||||
self.text.set_editable(False)
|
||||
return vbox
|
||||
|
||||
# Accelerator dictionary used for formatting shortcuts
|
||||
# key: tuple(key, modifier)
|
||||
# value: widget, to emit 'activate' signal on
|
||||
self.text.connect('key-press-event', self._on_key_press_event)
|
||||
|
||||
self.spellcheck = Spell.Spell(self.text)
|
||||
|
||||
self.format.connect('toggled', self.flow_changed)
|
||||
|
||||
self.buf.connect('changed', self.update)
|
||||
self.buf.connect_after('apply-tag', self.update)
|
||||
|
@ -59,6 +59,7 @@ class GrampsGEDDB(GrampsInMemDB):
|
||||
|
||||
self.bookmarks = GrampsDbBookmarks(self.metadata.get('bookmarks',[]))
|
||||
self.db_is_open = True
|
||||
self.readonly = True
|
||||
return 1
|
||||
|
||||
def load_from(self, other_database, filename, callback):
|
||||
|
@ -834,6 +834,10 @@ class GedcomParser(UpdateCallback):
|
||||
TOKEN_NAME : self.__header_subm_name,
|
||||
}
|
||||
|
||||
self.place_form = {
|
||||
TOKEN_FORM : self.__place_form,
|
||||
}
|
||||
|
||||
# look for existing place titles, build a map
|
||||
self.place_names = {}
|
||||
cursor = dbase.get_place_cursor()
|
||||
@ -4171,7 +4175,16 @@ class GedcomParser(UpdateCallback):
|
||||
@param state: The current state
|
||||
@type state: CurrentState
|
||||
"""
|
||||
self.__parse_place_form(2)
|
||||
self.__parse_level(state, self.place_form, self.__undefined)
|
||||
|
||||
def __place_form(self, line, state):
|
||||
"""
|
||||
@param line: The current line in GedLine format
|
||||
@type line: GedLine
|
||||
@param state: The current state
|
||||
@type state: CurrentState
|
||||
"""
|
||||
self.place_parser.parse_form(line)
|
||||
|
||||
def __header_date(self, line, state):
|
||||
"""
|
||||
@ -4219,8 +4232,7 @@ class GedcomParser(UpdateCallback):
|
||||
|
||||
def __parse_source_reference(self, src_ref, level, handle):
|
||||
"""Reads the data associated with a SOUR reference"""
|
||||
state = GedcomUtils.CurrentState()
|
||||
state.level = level+1
|
||||
state = GedcomUtils.CurrentState(level=level+1)
|
||||
state.src_ref = src_ref
|
||||
state.handle = handle
|
||||
self.__parse_level(state, self.srcref_parse_tbl, self.__ignore)
|
||||
@ -4237,34 +4249,6 @@ class GedcomParser(UpdateCallback):
|
||||
if self.__level_is_finished(line, level):
|
||||
return
|
||||
|
||||
def ignore_change_data(self, level):
|
||||
line = self.__get_next_line()
|
||||
if line.token == TOKEN_CHAN:
|
||||
self.__skip_subordinate_levels(level+1)
|
||||
else:
|
||||
self._backup()
|
||||
|
||||
def __parse_place_form(self, level):
|
||||
while True:
|
||||
line = self.__get_next_line()
|
||||
|
||||
if self.__level_is_finished(line, level):
|
||||
break
|
||||
elif line.token == TOKEN_FORM:
|
||||
self.place_parser.parse_form(line)
|
||||
else:
|
||||
self.__not_recognized(level+1)
|
||||
|
||||
def __parse_date(self, level):
|
||||
while True:
|
||||
line = self.__get_next_line()
|
||||
if self.__level_is_finished(line, level):
|
||||
break
|
||||
elif line.token == TOKEN_TIME:
|
||||
pass
|
||||
else:
|
||||
self.__not_recognized(level+1)
|
||||
|
||||
def handle_source(self, line, level):
|
||||
source_ref = RelLib.SourceRef()
|
||||
if line.data and line.data[0] != "@":
|
||||
@ -4316,12 +4300,6 @@ class GedcomParser(UpdateCallback):
|
||||
|
||||
self.dbase.pmap_index = new_pmax
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
def __parse_change(self, line, obj, level):
|
||||
"""
|
||||
CHANGE_DATE:=
|
||||
|
@ -309,7 +309,7 @@ class PrivacyButton:
|
||||
|
||||
class MonitoredCheckbox:
|
||||
|
||||
def __init__(self, obj, button, set_val, get_val, on_toggle=None):
|
||||
def __init__(self, obj, button, set_val, get_val, on_toggle=None, readonly = False):
|
||||
self.button = button
|
||||
self.button.connect('toggled', self._on_toggle)
|
||||
self.on_toggle = on_toggle
|
||||
@ -317,6 +317,7 @@ class MonitoredCheckbox:
|
||||
self.set_val = set_val
|
||||
self.get_val = get_val
|
||||
self.button.set_active(get_val())
|
||||
self.button.set_sensitive(not readonly)
|
||||
|
||||
def _on_toggle(self, obj):
|
||||
self.set_val(obj.get_active())
|
||||
|
@ -72,8 +72,8 @@ class Note(BasicPrimaryObject):
|
||||
Converts the object to a serialized tuple of data
|
||||
"""
|
||||
return (self.handle, self.gramps_id, self.text, self.format,
|
||||
self.type.serialize(),self.change,
|
||||
self.marker.serialize(),self.private)
|
||||
self.type.serialize(), self.change, self.marker.serialize(),
|
||||
self.private)
|
||||
|
||||
def unserialize(self, data):
|
||||
"""
|
||||
|
@ -15073,8 +15073,8 @@ Very High</property>
|
||||
<widget class="GtkTable" id="table79">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">1</property>
|
||||
<property name="n_columns">3</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">4</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
@ -15082,7 +15082,51 @@ Very High</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label707">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Type</property>
|
||||
<property name="label" translatable="yes">Type:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBoxEntry" id="type">
|
||||
<property name="visible">True</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label708">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">ID:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
@ -15108,15 +15152,64 @@ Very High</property>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBoxEntry" id="type">
|
||||
<widget class="GtkEntry" id="id">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<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"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label709">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Marker:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBoxEntry" id="marker">
|
||||
<property name="visible">True</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options">fill</property>
|
||||
@ -15136,10 +15229,10 @@ Very High</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
|
Loading…
Reference in New Issue
Block a user