def editModifier(self): """ edit selected modifier """ mod = self.getSelectedModifier() # make sure there is mod selected if mod is None: logUICall.log(get_ui_string("widget.ms.warning.node.required"), logUICall.WARNING) return # show edit dialog box for selected modifier self.dlgEditMod.setNode(self.ms, mod) ans = self.dlgEditMod.exec_() # accepted means apply change if ans == QDialog.Accepted: # NOTE: dlgEditMod already should have performed all the checks on # values/weights pair, we can safely assume that data is clean # to be used #[zone_name, bldg_type, startIdx, endIdx, modidx, modifier, node] = mod if self.dlgEditMod.node is not None: modifier = StatisticModifier(self.dlgEditMod.modifier_name) for value, weight in map(None, self.dlgEditMod.values, self.dlgEditMod.weights): modifier.values[value] = weight self.dlgEditMod.node.set_modifier(self.dlgEditMod.modidx, modifier) self.app.visualizeMappingScheme(self.ms)
def addModifier(self): """ add a modifier to mapping scheme. update table view """ # show edit dialog box for new modifier self.dlgEditMod.setNode(self.ms, None, addNew=True) ans = self.dlgEditMod.exec_() # accepted means apply change if ans == QDialog.Accepted: # NOTE: dlgEditMod already should have performed all the checks on # values/weights pair, we can safely assume that data is clean # to be used if self.dlgEditMod.node is not None: modifier = StatisticModifier(self.dlgEditMod.modifier_name) for value, weight in map(None, self.dlgEditMod.values, self.dlgEditMod.weights): modifier.values[value] = weight self.dlgEditMod.node.set_modifier(self.dlgEditMod.modidx, modifier) self.app.visualizeMappingScheme(self.ms)