def update_color_schema(self): if not self.data: return if self.parent.value_type == 1: dat = self.data.domain[self.parent.attr_value] if isinstance(dat, DiscreteVariable): # use a defined discrete palette self.img.setLookupTable(dat.colors) return # use a continuous palette data = self.color_cb.itemData(self.palette_index, role=Qt.UserRole) _, colors = max(data.items()) cols = color_palette_table(colors) self.img.setLookupTable(cols)
def update_color_schema(self): if not self.data: return if self.parent.value_type == 1: dat = self.data.domain[self.parent.attr_value] if isinstance(dat, DiscreteVariable): # use a defined discrete palette self.img.setLookupTable(dat.colors) return # use a continuous palette data = self.color_cb.itemData(self.palette_index, role=Qt.UserRole) _, colors = max(data.items()) cols = color_palette_table(colors) self.img.setLookupTable(cols)
def make_continent_view(self, type, callback, append_to): cc = ContinentCountries() if (type == 'rep'): data = cc.rep_continents elif (type == 'par'): data = cc.par_continents list = QTreeView() model = QStandardItemModel(0, 1) for key, values in sorted(data.items()): continent = QStandardItem(key) continent.setCheckable(True) for country in values: country = QStandardItem(country) country.setCheckable(True) continent.setChild(continent.rowCount(), country) model.setItem(model.rowCount(), continent) if (type == 'rep'): self.rep_top_item = model.index(0, 0) elif (type == 'par'): self.par_top_item = model.index(0, 0) model.itemChanged.connect(callback) list.setModel(model) list.setEditTriggers(QAbstractItemView.NoEditTriggers) list.setHeaderHidden(True) list.expandAll() proxy_model = FindFilterProxyModel() proxy_model.setSourceModel(model) proxy_model.setFilterKeyColumn(-1) list.setModel(proxy_model) list.expandAll() append_to.layout().addWidget(list) return [list, proxy_model, model]
def update_color_schema(self): if not self.threshold_low < self.threshold_high: # TODO this belongs here, not in the parent self.parent.Warning.threshold_error() return else: self.parent.Warning.threshold_error.clear() data = self.color_cb.itemData(self.palette_index, role=Qt.UserRole) _, colors = max(data.items()) cols = color_palette_table( colors, threshold_low=self.threshold_low, threshold_high=self.threshold_high) self.img.setLookupTable(cols) # use defined discrete palette if self.parent.value_type == 1: dat = self.data.domain[self.parent.attr_value] if isinstance(dat, DiscreteVariable): self.img.setLookupTable(dat.colors)