Skip to content

Commit

Permalink
Merge pull request #185 from janezd/geo-coding-auto-commit
Browse files Browse the repository at this point in the history
[FIX] GeoCoding: Properly implement deferred commit
  • Loading branch information
janezd authored Nov 22, 2024
2 parents 2e0f377 + 39b3c06 commit e630e10
Showing 1 changed file with 11 additions and 11 deletions.
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

0 comments on commit e630e10

Please sign in to comment.