Skip to content

Commit d687c2a

Browse files
committed
disable attr for count
1 parent 14e6f7f commit d687c2a

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

orangecontrib/geo/widgets/owchoropleth.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,17 @@ def _add_controls(self):
555555
self.agg_attr_model = DomainModel(valid_types=(ContinuousVariable,
556556
DiscreteVariable))
557557

558-
gui.comboBox(agg_box, self, 'agg_attr', label='Attribute:',
559-
callback=self.setup_plot, model=self.agg_attr_model,
560-
**options)
561-
562558
gui.comboBox(agg_box, self, 'agg_func', label='Agg.:',
563559
items=AGG_FUNCS, callback=self.setup_plot, **options)
564560

561+
self.agg_attr_combo = gui.comboBox(agg_box, self, 'agg_attr',
562+
label='Attribute:',
563+
callback=self.setup_plot,
564+
model=self.agg_attr_model,
565+
**options)
566+
565567
gui.hSlider(agg_box, self, 'admin_level', None, 0, 2, 1,
566-
label='Detail: ',
567-
callback=self.setup_plot)
568+
label='Detail:', callback=self.setup_plot)
568569

569570
plot_gui = OWPlotGUI(self)
570571
visualization_box = gui.vBox(area, True)
@@ -609,10 +610,18 @@ def init_attr_values(self):
609610
self.attr_lat, self.attr_lon = attr_lat, attr_lon
610611

611612
def setup_plot(self):
612-
if self.attr_lat is None or self.attr_lon is None or \
613-
self.agg_attr is None:
613+
self.agg_attr_combo.setEnabled(not self.agg_func == "Count")
614+
615+
if self.attr_lat is None or self.attr_lon is None:
614616
return
615617

618+
if self.agg_attr is None:
619+
if self.agg_func != "Count":
620+
return
621+
else:
622+
# for counting we just need a placeholder
623+
self.agg_attr = self.attr_lat
624+
616625
self.Error.aggregation_discrete.clear()
617626
if self.agg_attr.is_discrete and \
618627
self.agg_func not in AGG_FUNCS_DISCRETE:

0 commit comments

Comments
 (0)