Fix TextOption and EnumeratedListOption in MenuOptions.py.
svn: r9514
This commit is contained in:
parent
253990ff81
commit
71be179625
@ -1,3 +1,6 @@
|
|||||||
|
2007-12-15 Brian Matherly <brian@gramps-project.org>
|
||||||
|
* src/PluginUtils/_MenuOptions.py: Fix TextOption and EnumeratedListOption.
|
||||||
|
|
||||||
2007-12-15 Gary Burton <gary.burton@zen.co.uk>
|
2007-12-15 Gary Burton <gary.burton@zen.co.uk>
|
||||||
* src/DisplayTabs/_ChildModel.py:
|
* src/DisplayTabs/_ChildModel.py:
|
||||||
* src/Editors/_EditFamily.py: add fallback for birth date (feature #1448)
|
* src/Editors/_EditFamily.py: add fallback for birth date (feature #1448)
|
||||||
|
@ -248,13 +248,13 @@ class TextOption(Option):
|
|||||||
Add a TextOption to the dialog.
|
Add a TextOption to the dialog.
|
||||||
"""
|
"""
|
||||||
value = self.get_value()
|
value = self.get_value()
|
||||||
self.gobj = gtk.TextView()
|
self.gtext = gtk.TextView()
|
||||||
self.gobj.get_buffer().set_text("\n".join(value))
|
self.gtext.get_buffer().set_text("\n".join(value))
|
||||||
self.gobj.set_editable(1)
|
self.gtext.set_editable(1)
|
||||||
swin = gtk.ScrolledWindow()
|
self.gobj = gtk.ScrolledWindow()
|
||||||
swin.set_shadow_type(gtk.SHADOW_IN)
|
self.gobj.set_shadow_type(gtk.SHADOW_IN)
|
||||||
swin.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
|
self.gobj.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
|
||||||
swin.add(self.gobj)
|
self.gobj.add(self.gtext)
|
||||||
# Required for tooltip
|
# Required for tooltip
|
||||||
self.gobj.add_events(gtk.gdk.ENTER_NOTIFY_MASK)
|
self.gobj.add_events(gtk.gdk.ENTER_NOTIFY_MASK)
|
||||||
self.gobj.add_events(gtk.gdk.LEAVE_NOTIFY_MASK)
|
self.gobj.add_events(gtk.gdk.LEAVE_NOTIFY_MASK)
|
||||||
@ -263,7 +263,7 @@ class TextOption(Option):
|
|||||||
"""
|
"""
|
||||||
Parse the text option (multi-line text).
|
Parse the text option (multi-line text).
|
||||||
"""
|
"""
|
||||||
b = self.gobj.get_buffer()
|
b = self.gtext.get_buffer()
|
||||||
text_val = unicode( b.get_text( b.get_start_iter(),
|
text_val = unicode( b.get_text( b.get_start_iter(),
|
||||||
b.get_end_iter(),
|
b.get_end_iter(),
|
||||||
False) )
|
False) )
|
||||||
@ -357,21 +357,23 @@ class EnumeratedListOption(Option):
|
|||||||
v = self.get_value()
|
v = self.get_value()
|
||||||
active_index = 0
|
active_index = 0
|
||||||
current_index = 0
|
current_index = 0
|
||||||
self.gobj = gtk.combo_box_new_text()
|
self.combo = gtk.combo_box_new_text()
|
||||||
|
self.gobj = gtk.EventBox()
|
||||||
|
self.gobj.add(self.combo)
|
||||||
for (value,description) in self.get_items():
|
for (value,description) in self.get_items():
|
||||||
self.gobj.append_text(description)
|
self.combo.append_text(description)
|
||||||
if value == v:
|
if value == v:
|
||||||
active_index = current_index
|
active_index = current_index
|
||||||
current_index += 1
|
current_index += 1
|
||||||
self.gobj.set_active( active_index )
|
self.combo.set_active( active_index )
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
"""
|
"""
|
||||||
Parse the EnumeratedListOption and return.
|
Parse the EnumeratedListOption and return.
|
||||||
"""
|
"""
|
||||||
index = self.gobj.get_active()
|
index = self.combo.get_active()
|
||||||
items = self.get_items()
|
items = self.get_items()
|
||||||
value = items[index]
|
value,description = items[index]
|
||||||
return value
|
return value
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -638,7 +640,8 @@ class MenuOptions:
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def add_menu_option(self,option):
|
def add_menu_option(self,category,name,option):
|
||||||
|
self.menu.add_option(category,name, option)
|
||||||
self.options_dict[name] = option.get_value()
|
self.options_dict[name] = option.get_value()
|
||||||
self.options_help[name] = option.get_help()
|
self.options_help[name] = option.get_help()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user