Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] GeoCoding: Properly implement deferred commit #185

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions orangecontrib/geo/widgets/owgeocoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self):
top = self.controlArea

def _radioChanged():
self.commit()
self.commit.deferred()

modes = gui.radioButtons(top, self, 'is_decoding', callback=_radioChanged)

Expand Down Expand Up @@ -127,13 +127,13 @@ def _radioChanged():
self.domainmodels.append(model)
combo = gui.comboBox(
box, self, 'lat_attr', label='Latitude:', orientation=Qt.Horizontal,
callback=lambda: self.commit(), sendSelectedValue=True, model=model)
callback=self.commit.deferred, sendSelectedValue=True, model=model)
combo = gui.comboBox(
box, self, 'lon_attr', label='Longitude:', orientation=Qt.Horizontal,
callback=lambda: self.commit(), sendSelectedValue=True, model=model)
callback=self.commit.deferred, sendSelectedValue=True, model=model)
gui.comboBox(
box, self, 'admin', label='Administrative level:', orientation=Qt.Horizontal,
callback=lambda: self.commit(),
callback=self.commit.deferred,
items=('Country',
'1st-level subdivision (state, region, province, municipality, ...)',
'2nd-level subdivisions (1st-level & US counties)'),)
Expand All @@ -146,7 +146,7 @@ def _radioChanged():
gui.checkBox(
top, self, 'append_features',
label='E&xtend coded data with additional region properties',
callback=lambda: self.commit(),
callback=self.commit.deferred,
toolTip='Extend coded data with region properties, such as'
'ISO codes, continent, subregion, region type, '
'economy type, FIPS/HASC codes, region capital etc. as available.')
Expand Down Expand Up @@ -189,7 +189,7 @@ def save_and_commit():
edit.text(),
Qt.EditRole)
if save:
owwidget.commit()
owwidget.commit.deferred()
return
edit.clear()

Expand All @@ -206,11 +206,11 @@ def save_and_commit():

def on_region_attr_changed(self):
self.guess_region_type()
self.commit()
self.commit.deferred()

def on_region_type_changed(self, value):
self.str_type = value
self.commit()
self.commit.deferred()

def guess_region_type(self):
if self.data is None:
Expand All @@ -224,7 +224,7 @@ def guess_region_type(self):
self.str_type = str_type
self.str_type_combo.setCurrentText(self.str_type)


@gui.deferred
def commit(self):
output = None
if self.data is not None and len(self.data):
Expand Down Expand Up @@ -327,7 +327,7 @@ def set_data(self, data):

if data is None or not len(data):
self.clear()
self.commit()
self.commit.now()
return

for model in self.domainmodels:
Expand All @@ -347,7 +347,7 @@ def set_data(self, data):
self.str_type = next(iter(self.ID_TYPE))
self.str_type_combo.setCurrentText(self.str_type)

self.commit()
self.commit.now()

def clear(self):
self.data = None
Expand Down
Loading