* src/GrampsWidgets.py: Add monitored widgets for type and combo
* src/EditFamily.py: use MonitoredType * src/EditSourceRef.py: complete monitoring of values * src/gramps.glade: add text field svn: r5966
This commit is contained in:
parent
ac5d9287bd
commit
a167440cc6
@ -1,3 +1,9 @@
|
|||||||
|
2006-02-20 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/GrampsWidgets.py: Add monitored widgets for type and combo
|
||||||
|
* src/EditFamily.py: use MonitoredType
|
||||||
|
* src/EditSourceRef.py: complete monitoring of values
|
||||||
|
* src/gramps.glade: add text field
|
||||||
|
|
||||||
2006-02-19 Don Allingham <don@gramps-project.org>
|
2006-02-19 Don Allingham <don@gramps-project.org>
|
||||||
* src/DisplayTabs.py: connect new EditSourceRef editor
|
* src/DisplayTabs.py: connect new EditSourceRef editor
|
||||||
* src/EditSourceRef.py: update data on save
|
* src/EditSourceRef.py: update data on save
|
||||||
|
@ -303,20 +303,11 @@ class EditFamily(DisplayState.ManagedWindow):
|
|||||||
self.family.set_gramps_id,
|
self.family.set_gramps_id,
|
||||||
self.family.get_gramps_id)
|
self.family.get_gramps_id)
|
||||||
|
|
||||||
rel_types = dict(Utils.family_relations)
|
self.data_type = GrampsWidgets.MonitoredType(
|
||||||
|
self.top.get_widget('marriage_type'), self.family.set_relationship,
|
||||||
|
self.family.get_relationship, dict(Utils.family_relations),
|
||||||
|
RelLib.Family.CUSTOM)
|
||||||
|
|
||||||
mtype = self.family.get_relationship()
|
|
||||||
if mtype:
|
|
||||||
defval = mtype[0]
|
|
||||||
else:
|
|
||||||
defval = None
|
|
||||||
|
|
||||||
reltype = self.top.get_widget('marriage_type')
|
|
||||||
self.type_sel = AutoComp.StandardCustomSelector(
|
|
||||||
rel_types, reltype, RelLib.Family.CUSTOM, defval)
|
|
||||||
reltype.connect('changed',
|
|
||||||
lambda x: self.family.set_relationship(self.type_sel.get_values()))
|
|
||||||
|
|
||||||
def load_data(self):
|
def load_data(self):
|
||||||
fhandle = self.family.get_father_handle()
|
fhandle = self.family.get_father_handle()
|
||||||
self.update_father(fhandle)
|
self.update_father(fhandle)
|
||||||
|
@ -160,6 +160,19 @@ class EditSourceRef(DisplayState.ManagedWindow):
|
|||||||
self.top.get_widget('pub_info'), self.source.set_publication_info,
|
self.top.get_widget('pub_info'), self.source.set_publication_info,
|
||||||
self.source.get_publication_info,False)
|
self.source.get_publication_info,False)
|
||||||
|
|
||||||
|
self.text_data = MonitoredText(
|
||||||
|
self.top.get_widget('text'), self.source_ref.set_text,
|
||||||
|
self.source_ref.get_text,False)
|
||||||
|
|
||||||
|
self.type_mon = MonitoredMenu(
|
||||||
|
self.top.get_widget('confidence'), self.source_ref.set_confidence_level,
|
||||||
|
self.source_ref.get_confidence_level, [
|
||||||
|
(_('Very Low'), RelLib.SourceRef.CONF_VERY_LOW),
|
||||||
|
(_('Low'), RelLib.SourceRef.CONF_LOW),
|
||||||
|
(_('Normal'), RelLib.SourceRef.CONF_NORMAL),
|
||||||
|
(_('High'), RelLib.SourceRef.CONF_HIGH),
|
||||||
|
(_('Very High'), RelLib.SourceRef.CONF_VERY_HIGH)])
|
||||||
|
|
||||||
def _add_source_page(self,page):
|
def _add_source_page(self,page):
|
||||||
self.notebook_src.insert_page(page)
|
self.notebook_src.insert_page(page)
|
||||||
self.notebook_src.set_tab_label(page,page.get_tab_widget())
|
self.notebook_src.set_tab_label(page,page.get_tab_widget())
|
||||||
@ -209,10 +222,6 @@ class EditSourceRef(DisplayState.ManagedWindow):
|
|||||||
|
|
||||||
def ok_clicked(self,obj):
|
def ok_clicked(self,obj):
|
||||||
|
|
||||||
# first, save source if changed
|
|
||||||
# etype = self.type_selector.get_values()
|
|
||||||
# self.update_source(etype,self.date,eplace_obj)
|
|
||||||
|
|
||||||
trans = self.db.transaction_begin()
|
trans = self.db.transaction_begin()
|
||||||
self.db.commit_source(self.source,trans)
|
self.db.commit_source(self.source,trans)
|
||||||
if self.source_added:
|
if self.source_added:
|
||||||
|
@ -31,6 +31,8 @@ from gettext import gettext as _
|
|||||||
import gobject
|
import gobject
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
|
import AutoComp
|
||||||
|
|
||||||
class LinkLabel(gtk.EventBox):
|
class LinkLabel(gtk.EventBox):
|
||||||
|
|
||||||
def __init__(self,label,func,handle):
|
def __init__(self,label,func,handle):
|
||||||
@ -232,3 +234,59 @@ class MonitoredEntry:
|
|||||||
self.obj.set_text(get_val())
|
self.obj.set_text(get_val())
|
||||||
self.obj.connect('changed', lambda x: self.set_val(unicode(x.get_text())))
|
self.obj.connect('changed', lambda x: self.set_val(unicode(x.get_text())))
|
||||||
self.obj.set_editable(not read_only)
|
self.obj.set_editable(not read_only)
|
||||||
|
|
||||||
|
class MonitoredText:
|
||||||
|
|
||||||
|
def __init__(self,obj,set_val,get_val,read_only=False):
|
||||||
|
self.buf = obj.get_buffer()
|
||||||
|
self.set_val = set_val
|
||||||
|
self.get_val = get_val
|
||||||
|
|
||||||
|
if get_val():
|
||||||
|
self.buf.set_text(get_val())
|
||||||
|
self.buf.connect('changed', self.on_change)
|
||||||
|
obj.set_editable(not read_only)
|
||||||
|
|
||||||
|
def on_change(self,obj):
|
||||||
|
s,e = self.buf.get_bounds()
|
||||||
|
self.set_val(unicode(self.buf.get_text(s,e,False)))
|
||||||
|
|
||||||
|
class MonitoredType:
|
||||||
|
|
||||||
|
def __init__(self,obj,set_val,get_val,mapping,custom):
|
||||||
|
self.set_val = set_val
|
||||||
|
self.get_val = get_val
|
||||||
|
|
||||||
|
self.obj = obj
|
||||||
|
|
||||||
|
val = get_val()
|
||||||
|
if val:
|
||||||
|
default = val[0]
|
||||||
|
else:
|
||||||
|
default = None
|
||||||
|
|
||||||
|
self.sel = AutoComp.StandardCustomSelector(
|
||||||
|
mapping, obj, custom, default)
|
||||||
|
|
||||||
|
self.obj.connect('changed', self.on_change)
|
||||||
|
|
||||||
|
def on_change(self, obj):
|
||||||
|
self.set_val(self.sel.get_values())
|
||||||
|
|
||||||
|
class MonitoredMenu:
|
||||||
|
|
||||||
|
def __init__(self,obj,set_val,get_val,mapping):
|
||||||
|
self.set_val = set_val
|
||||||
|
self.get_val = get_val
|
||||||
|
|
||||||
|
self.obj = obj
|
||||||
|
self.model = gtk.ListStore(str,int)
|
||||||
|
for t,v in mapping:
|
||||||
|
self.model.append(row=[t,v])
|
||||||
|
self.obj.set_model(self.model)
|
||||||
|
self.obj.set_active(get_val())
|
||||||
|
self.obj.connect('changed',self.on_change)
|
||||||
|
|
||||||
|
def on_change(self, obj):
|
||||||
|
self.set_val(self.model.get_value(obj.get_active_iter(),1))
|
||||||
|
|
||||||
|
@ -17872,6 +17872,64 @@ Very High</property>
|
|||||||
<property name="type">tab</property>
|
<property name="type">tab</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkScrolledWindow" id="scrolledwindow101">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||||
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkTextView" id="text">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="editable">True</property>
|
||||||
|
<property name="overwrite">False</property>
|
||||||
|
<property name="accepts_tab">True</property>
|
||||||
|
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||||
|
<property name="cursor_visible">True</property>
|
||||||
|
<property name="pixels_above_lines">0</property>
|
||||||
|
<property name="pixels_below_lines">0</property>
|
||||||
|
<property name="pixels_inside_wrap">0</property>
|
||||||
|
<property name="left_margin">0</property>
|
||||||
|
<property name="right_margin">0</property>
|
||||||
|
<property name="indent">0</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="tab_expand">False</property>
|
||||||
|
<property name="tab_fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label615">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Text</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.5</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="type">tab</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user