Allow editing and creation of objects from LinkEditor
svn: r19739
This commit is contained in:
parent
23ceaabbd4
commit
2724cf2c7a
@ -90,12 +90,14 @@ class EditLink(ManagedWindow.ManagedWindow):
|
||||
self.uri_list.append_text(text)
|
||||
self.table.attach(self.uri_list, 1, 2, 0, 1)
|
||||
self.pick_item = self.top.get_object('button1')
|
||||
#self.edit_item = self.top.get_object('button2')
|
||||
self.new_button = self.top.get_object('new')
|
||||
self.edit_button = self.top.get_object('edit')
|
||||
self.selected = self.top.get_object('label1')
|
||||
self.url_link = self.top.get_object('entry1')
|
||||
self.uri_list.connect("changed", self._on_type_changed)
|
||||
self.pick_item.connect("clicked", self._on_pick_one)
|
||||
#self.edit_item.connect("clicked", self._on_edit_one)
|
||||
self.new_button.connect("clicked", self._on_new)
|
||||
self.edit_button.connect("clicked", self._on_edit_one)
|
||||
if self.url.startswith("gramps://"):
|
||||
object_class, prop, value = self.url[9:].split("/", 2)
|
||||
if object_class == "Event":
|
||||
@ -136,8 +138,23 @@ class EditLink(ManagedWindow.ManagedWindow):
|
||||
def display_link(self, obj_class, prop, value):
|
||||
return self.simple_access.display(obj_class, prop, value)
|
||||
|
||||
def _on_new_callback(self, obj):
|
||||
object_class = obj.__class__.__name__
|
||||
self.selected.set_text(self.display_link(
|
||||
object_class, "handle", obj.handle))
|
||||
self.url_link.set_text("gramps://%s/%s/%s" %
|
||||
(object_class, "handle", obj.handle))
|
||||
|
||||
def _on_new(self, widget):
|
||||
from gui.editors import EditObject
|
||||
object_class = OBJECT_MAP[self.uri_list.get_active()]
|
||||
EditObject(self.dbstate,
|
||||
self.uistate,
|
||||
self.track,
|
||||
object_class,
|
||||
callback=self._on_new_callback)
|
||||
|
||||
def _on_edit_one(self, widget):
|
||||
# Not used due to modal dialog in StyledTextEditor
|
||||
from gui.editors import EditObject
|
||||
uri = self.url_link.get_text()
|
||||
if uri.startswith("gramps://"):
|
||||
@ -180,9 +197,13 @@ class EditLink(ManagedWindow.ManagedWindow):
|
||||
if self.uri_list.get_active() == WEB:
|
||||
self.url_link.set_sensitive(True)
|
||||
self.pick_item.set_sensitive(False)
|
||||
self.new_button.set_sensitive(False)
|
||||
self.edit_button.set_sensitive(False)
|
||||
else:
|
||||
self.url_link.set_sensitive(False)
|
||||
self.pick_item.set_sensitive(True)
|
||||
self.new_button.set_sensitive(True)
|
||||
self.edit_button.set_sensitive(True)
|
||||
|
||||
def get_uri(self):
|
||||
if self.uri_list.get_active() == WEB:
|
||||
|
@ -4,27 +4,96 @@
|
||||
<!-- interface-requires grampswidgets 0.0 -->
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<object class="GtkDialog" id="editurl">
|
||||
<property name="modal">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="default_width">600</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox29">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area29">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button125">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button124">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup">Accept changes and close window</property>
|
||||
<property name="tooltip_text" translatable="yes">Accept changes and close window</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button130">
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox37">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table27">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_columns">3</property>
|
||||
<property name="n_columns">4</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label219">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Gramps item:</property>
|
||||
<property name="use_underline">True</property>
|
||||
@ -40,6 +109,7 @@
|
||||
<child>
|
||||
<object class="GtkLabel" id="label220">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Internet Address:</property>
|
||||
<property name="use_underline">True</property>
|
||||
@ -56,6 +126,7 @@
|
||||
<child>
|
||||
<object class="GtkLabel" id="label591">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Link Type:</property>
|
||||
<property name="use_underline">True</property>
|
||||
@ -71,10 +142,14 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
@ -85,6 +160,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="button1-atkobject">
|
||||
@ -94,6 +170,7 @@
|
||||
<child>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-index</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="image1-atkobject">
|
||||
@ -114,14 +191,17 @@
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -137,81 +217,53 @@
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="new">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="x_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="edit">
|
||||
<property name="label" translatable="yes">Edit</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<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"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area29">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button125">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button124">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup">Accept changes and close window</property>
|
||||
<property name="tooltip_text" translatable="yes">Accept changes and close window</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button130">
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
|
Loading…
Reference in New Issue
Block a user