def __init__(self, app, taxonomy, ranges): """ constructor """ super(DialogMSOptions, self).__init__() self.ui = Ui_msOptionsDialog() self.ui.setupUi(self) self.app = app self.attributeList = WidgetAttributeList(self, app, taxonomy, [], ranges) self.attributeList.move(30, 90) self.attributeList.setFixedSize( self.width() - 30 - 2 * UI_PADDING, self.ui.buttons.y() - 90 - 2 * UI_PADDING) # connect slot (ui event) self.ui.buttons.accepted.connect(self.accept) self.ui.buttons.rejected.connect(self.reject) self.ui.radioEmptyMS.toggled.connect(self.setMSOption) self.ui.radioBuildMS.toggled.connect(self.setMSOption) # additional settings self.setFixedSize(self.size()) # no resize self.ui.radioEmptyMS.click() # default to empty MS
def __init__(self, app, taxonomy, ranges): """ constructor """ super(DialogMSOptions, self).__init__() self.ui = Ui_msOptionsDialog() self.ui.setupUi(self) self.app = app self.attributeList = WidgetAttributeList(self, app, taxonomy, [], ranges) self.attributeList.move(30, 90) self.attributeList.setFixedSize(self.width() - 30 - 2*UI_PADDING, self.ui.buttons.y() - 90 - 2*UI_PADDING) # connect slot (ui event) self.ui.buttons.accepted.connect(self.accept) self.ui.buttons.rejected.connect(self.reject) self.ui.radioEmptyMS.toggled.connect(self.setMSOption) self.ui.radioBuildMS.toggled.connect(self.setMSOption) # additional settings self.setFixedSize(self.size()) # no resize self.ui.radioEmptyMS.click() # default to empty MS
class DialogMSOptions(Ui_msOptionsDialog, QDialog): """ dialog specifying options for creating mapping scheme """ BUILD_EMPTY, BUILD_FROM_SURVEY = range(2) def __init__(self, app, taxonomy, ranges): """ constructor """ super(DialogMSOptions, self).__init__() self.ui = Ui_msOptionsDialog() self.ui.setupUi(self) self.app = app self.attributeList = WidgetAttributeList(self, app, taxonomy, [], ranges) self.attributeList.move(30, 90) self.attributeList.setFixedSize( self.width() - 30 - 2 * UI_PADDING, self.ui.buttons.y() - 90 - 2 * UI_PADDING) # connect slot (ui event) self.ui.buttons.accepted.connect(self.accept) self.ui.buttons.rejected.connect(self.reject) self.ui.radioEmptyMS.toggled.connect(self.setMSOption) self.ui.radioBuildMS.toggled.connect(self.setMSOption) # additional settings self.setFixedSize(self.size()) # no resize self.ui.radioEmptyMS.click() # default to empty MS def exec_(self): #self.attributeList.refreshAttributeList(self.attributeList.attribute_order) return super(DialogMSOptions, self).exec_() # property accessor/mutators ############################### @property def attributes(self): return self.attributeList.attributes @attributes.setter def attributes(self, attributes): self.attributeList.attributes = attributes @property def attribute_order(self): return self.attributeList.attribute_order @attribute_order.setter def attribute_order(self, order): self.attributeList.attribute_order = order if len(order) > 0: self.ui.radioBuildMS.setChecked(True) @property def attribute_ranges(self): return self.attributeList.attribute_ranges @attribute_ranges.setter def attribute_ranges(self, ranges): self.attributeList.attribute_ranges = ranges @property def use_sampling(self): return self.ui.ck_use_sampling.isChecked() @use_sampling.setter def use_sampling(self, value): self.ui.ck_use_sampling.setChecked(value) # ui event handler ############################### @logUICall @pyqtSlot() def setMSOption(self): """ adjust options when option radio button is selected """ sender = self.sender() if sender.isChecked(): if sender == self.ui.radioEmptyMS: self.build_option = self.BUILD_EMPTY self.attributeList.setEnabled(False) elif sender == self.ui.radioBuildMS: self.build_option = self.BUILD_FROM_SURVEY self.attributeList.setEnabled(True) else: logUICall.log('\tdo nothing. should not even be here', logUICall.WARNING)
class DialogMSOptions(Ui_msOptionsDialog, QDialog): """ dialog specifying options for creating mapping scheme """ BUILD_EMPTY, BUILD_FROM_SURVEY=range(2) def __init__(self, app, taxonomy, ranges): """ constructor """ super(DialogMSOptions, self).__init__() self.ui = Ui_msOptionsDialog() self.ui.setupUi(self) self.app = app self.attributeList = WidgetAttributeList(self, app, taxonomy, [], ranges) self.attributeList.move(30, 90) self.attributeList.setFixedSize(self.width() - 30 - 2*UI_PADDING, self.ui.buttons.y() - 90 - 2*UI_PADDING) # connect slot (ui event) self.ui.buttons.accepted.connect(self.accept) self.ui.buttons.rejected.connect(self.reject) self.ui.radioEmptyMS.toggled.connect(self.setMSOption) self.ui.radioBuildMS.toggled.connect(self.setMSOption) # additional settings self.setFixedSize(self.size()) # no resize self.ui.radioEmptyMS.click() # default to empty MS def exec_(self): #self.attributeList.refreshAttributeList(self.attributeList.attribute_order) return super(DialogMSOptions, self).exec_() # property accessor/mutators ############################### @property def attributes(self): return self.attributeList.attributes @attributes.setter def attributes(self, attributes): self.attributeList.attributes = attributes @property def attribute_order(self): return self.attributeList.attribute_order @attribute_order.setter def attribute_order(self, order): self.attributeList.attribute_order = order if len(order) > 0: self.ui.radioBuildMS.setChecked(True) @property def attribute_ranges(self): return self.attributeList.attribute_ranges @attribute_ranges.setter def attribute_ranges(self, ranges): self.attributeList.attribute_ranges = ranges @property def use_sampling(self): return self.ui.ck_use_sampling.isChecked() @use_sampling.setter def use_sampling(self, value): self.ui.ck_use_sampling.setChecked(value) # ui event handler ############################### @logUICall @pyqtSlot() def setMSOption(self): """ adjust options when option radio button is selected """ sender = self.sender() if sender.isChecked(): if sender == self.ui.radioEmptyMS: self.build_option = self.BUILD_EMPTY self.attributeList.setEnabled(False) elif sender == self.ui.radioBuildMS: self.build_option = self.BUILD_FROM_SURVEY self.attributeList.setEnabled(True) else: logUICall.log('\tdo nothing. should not even be here', logUICall.WARNING)