Support widget with search_remote when pasting rows
Since 4db597e5b08c the widget value is not set automatically if there is only one result. Closes #13612 (grafted from cade754efb2b09b282576dbdae9d6770c12b1777) --HG-- branch : 7.0
This commit is contained in:
@@ -785,7 +785,18 @@ class ViewTree(View):
|
||||
for col, value in zip(columns, line):
|
||||
widget = self.get_column_widget(col)
|
||||
if widget.get_textual_value(record) != value:
|
||||
widget.value_from_text(record, value)
|
||||
if hasattr(widget, 'search_remote'):
|
||||
field = record.group.fields[widget.attrs['name']]
|
||||
win = widget.search_remote(record, field, value)
|
||||
if len(win.screen.group) == 1:
|
||||
target, = win.screen.group
|
||||
field.set_client(
|
||||
record, (target.id, target.rec_name()))
|
||||
else:
|
||||
field.set_client(record, (None, ''))
|
||||
win.response(win, Gtk.ResponseType.CANCEL)
|
||||
else:
|
||||
widget.value_from_text(record, value)
|
||||
if value and not widget.get_textual_value(record):
|
||||
# Stop setting value if a value is correctly set
|
||||
idx = len(group)
|
||||
|
||||
Reference in New Issue
Block a user