def __init__(self, parent=None, state=None, dataModel=Impact): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) self.resize(300, 200) self.setWindowTitle( QApplication.translate("ImpactEditor", "Project Impact Editor")) self.gridLayout = QGridLayout(self) self.gridLayout.setMargin(10) self.vlNotification = QVBoxLayout() self.vlNotification.setMargin(0) self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 2) #Add vertical layout for the notification bar self.setNotificationLayout(self.vlNotification) self.lblImpact = QLabel(self) self.lblImpact.setText( QApplication.translate("ImpactEditor", "Socio-Economic Impact")) self.gridLayout.addWidget(self.lblImpact, 1, 0, 1, 1) self.cboImpact = ComboBoxWithOther(self) self.cboImpact.lineEdit().setMaxLength(30) self.gridLayout.addWidget(self.cboImpact, 1, 1, 1, 1) self.lblRank = QLabel(self) self.lblRank.setText(QApplication.translate("ImpactEditor", "Rank")) self.gridLayout.addWidget(self.lblRank, 2, 0, 1, 1) self.cboRank = QComboBox(self) self.cboRank.setMinimumSize(QSize(0, 30)) self.gridLayout.addWidget(self.cboRank, 2, 1, 1, 1) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 2) #Load combobox options loadComboSelections(self.cboImpact.comboBox(), CheckSocioEconomicImpact) self.cboRank.addItem("") self.cboRank.addItem( QApplication.translate("ImpactEditor", "3 (Highest)"), 3) self.cboRank.addItem("2", 2) self.cboRank.addItem( QApplication.translate("ImpactEditor", "1 (Lowest)"), 1) #Configure mappings self.addMapping("itemID",self.cboImpact.comboBox(),True, \ pseudoname=QApplication.translate("ImpactEditor","Priority Service")) self.addMapping("OtherItem", self.cboImpact.lineEdit()) self.addMapping("Rank", self.cboRank, True) #Connect signals self.connect(self.buttonBox, SIGNAL("accepted()"), self.submit) self.connect(self.buttonBox, SIGNAL("rejected()"), self.cancel)
def __init__(self, datamodel=None): MapperMixin.__init__(self, datamodel) #Load combobox items loadComboSelections(self.cboGender, CheckGender) loadComboSelections(self.cboMaritalStatus, CheckMaritalStatus) #Set current date as maximum date self.dtDoB.setMaximumDate(QDate.currentDate()) #Input mask for controlling cellphone number entries. self.txtCellphone.setInputMask("9999-999999") self.txtCellphone.setCursorPosition(0) #Specify mappings self.addMapping("FirstName", self.txtFirstName, True) self.addMapping("LastName", self.txtLastName, True) self.addMapping("Cellphone", self.txtCellphone) self.addMapping("GenderID", self.cboGender, True, pseudoname="Gender") self.addMapping("MaritalStatusID", self.cboMaritalStatus, True, pseudoname="Marital Status") self.addMapping("DateofBirth", self.dtDoB) #Connect signals self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel)
def __init__(self, parent=None, state=None, datamodel=Household): QDialog.__init__(self, parent) self.setupUi(self) MapperMixin.__init__(self, datamodel) #Connect signals self.connect(self.buttonBox, SIGNAL("accepted()"), self.submit) self.connect(self.buttonBox, SIGNAL("rejected()"), self.cancel) #Configure household income FK mapper hhIncomeFKMapper = self.tabWidget.widget(0) hhIncomeFKMapper.setDatabaseModel(HouseholdIncome) hhIncomeFKMapper.setEntitySelector(HouseholdIncomeEditor) hhIncomeFKMapper.setSupportsList(True) hhIncomeFKMapper.setDeleteonRemove(True) hhIncomeFKMapper.setNotificationBar(self._notifBar) hhIncomeFKMapper.initialize() #Configure household savings option FK mapper hhSavingsFKMapper = self.tabWidget.widget(1) hhSavingsFKMapper.setDatabaseModel(HouseholdSaving) hhSavingsFKMapper.setEntitySelector(HouseholdSavingsEditor) hhSavingsFKMapper.setSupportsList(True) hhSavingsFKMapper.setDeleteonRemove(True) hhSavingsFKMapper.addCellFormatter("OptionID", savingOptionFormatter) hhSavingsFKMapper.setNotificationBar(self._notifBar) hhSavingsFKMapper.initialize() #Configure mappings self.addMapping("FemaleNumber", self.sbFemaleNumber) self.addMapping("MaleNumber", self.sbMaleNumber) self.addMapping("AggregateIncome", self.sbMonthlyIncome) self.addMapping("IncomeSources", hhIncomeFKMapper) self.addMapping("SavingOptions", hhSavingsFKMapper)
def __init__(self,parent=None,state = None,datamodel = Household): QDialog.__init__(self,parent) self.setupUi(self) MapperMixin.__init__(self,datamodel) #Connect signals self.connect(self.buttonBox, SIGNAL("accepted()"),self.submit) self.connect(self.buttonBox, SIGNAL("rejected()"),self.cancel) #Configure household income FK mapper hhIncomeFKMapper = self.tabWidget.widget(0) hhIncomeFKMapper.setDatabaseModel(HouseholdIncome) hhIncomeFKMapper.setEntitySelector(HouseholdIncomeEditor) hhIncomeFKMapper.setSupportsList(True) hhIncomeFKMapper.setDeleteonRemove(True) hhIncomeFKMapper.setNotificationBar(self._notifBar) hhIncomeFKMapper.initialize() #Configure household savings option FK mapper hhSavingsFKMapper = self.tabWidget.widget(1) hhSavingsFKMapper.setDatabaseModel(HouseholdSaving) hhSavingsFKMapper.setEntitySelector(HouseholdSavingsEditor) hhSavingsFKMapper.setSupportsList(True) hhSavingsFKMapper.setDeleteonRemove(True) hhSavingsFKMapper.addCellFormatter("OptionID",savingOptionFormatter) hhSavingsFKMapper.setNotificationBar(self._notifBar) hhSavingsFKMapper.initialize() #Configure mappings self.addMapping("FemaleNumber", self.sbFemaleNumber) self.addMapping("MaleNumber", self.sbMaleNumber) self.addMapping("AggregateIncome", self.sbMonthlyIncome) self.addMapping("IncomeSources",hhIncomeFKMapper) self.addMapping("SavingOptions",hhSavingsFKMapper)
def __init__(self,parent = None,model = Survey): QDialog.__init__(self, parent) self.setupUi(self) MapperMixin.__init__(self, model) #Connect signals self.mapping = DeclareMapping.instance() self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel) #Set current date as maximum date currDate = QDate.currentDate() self.dtEnumDate.setMaximumDate(currDate) self.dtEnumDate.setDate(currDate) self._notifBar = NotificationBar(self.vlNotification) Enumerator = self.mapping.tableMapping('enumerator') #Configure Enumerator FK mapper enumFKMapper = self.tabWidget.widget(0) enumFKMapper.setDatabaseModel(Enumerator) enumFKMapper.setEntitySelector(EnumeratorEntityBrowser, VIEW|MANAGE) enumFKMapper.setSupportsList(False) #enumFKMapper.addCellFormatter("GenderID",genderFormatter) #enumFKMapper.addCellFormatter("MaritalStatusID",maritalStatusFormatter) enumFKMapper.setNotificationBar(self._notifBar) enumFKMapper.initialize() Respondent = self.mapping.tableMapping('respondent') respondentFKMapper = self.tabWidget.widget(1) respondentFKMapper.setDatabaseModel(Respondent) respondentFKMapper.setEntitySelector(RespondentEntityBrowser, VIEW|MANAGE) respondentFKMapper.setSupportsList(False) respondentFKMapper.setNotificationBar(self._notifBar) respondentFKMapper.initialize() Witness = self.mapping.tableMapping('witness') witnessFKMapper = self.tabWidget.widget(2) witnessFKMapper.setDatabaseModel(Witness) witnessFKMapper.setEntitySelector(WitnessEntityBrowser, VIEW|MANAGE) witnessFKMapper.setSupportsList(True) witnessFKMapper.setNotificationBar(self._notifBar) witnessFKMapper.initialize() Priority = self.mapping.tableMapping('priority') prFKMapper = self.tabWidget.widget(3) prFKMapper.setDatabaseModel(Priority) prFKMapper.setEntitySelector(PriorityEntityBrowser, VIEW|MANAGE) prFKMapper.setSupportsList(True) prFKMapper.setNotificationBar(self._notifBar) prFKMapper.initialize() #Configure attribute mappings self.addMapping("Code", self.txtSurveyCode, preloadfunc = self.codeGenerator()) self.addMapping("EnumerationDate", self.dtEnumDate) #self.addMapping("Enumerator", enumFKMapper,False) self.addMapping("Respondent", respondentFKMapper,True)
def __init__(self, parent=None, state=None, dataModel=Priority): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) self.resize(290, 200) self.setWindowTitle(QApplication.translate("PriorityServiceEditor", "Priority Service Editor")) self.gridLayout = QGridLayout(self) self.gridLayout.setMargin(10) self.vlNotification = QVBoxLayout() self.vlNotification.setMargin(0) self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 2) # Add vertical layout for the notification bar self.setNotificationLayout(self.vlNotification) self.lblPService = QLabel(self) self.lblPService.setText(QApplication.translate("PriorityServiceEditor", "Service")) self.gridLayout.addWidget(self.lblPService, 1, 0, 1, 1) self.cboPService = ComboBoxWithOther(self) self.cboPService.lineEdit().setMaxLength(30) self.gridLayout.addWidget(self.cboPService, 1, 1, 1, 1) self.lblRank = QLabel(self) self.lblRank.setText(QApplication.translate("PriorityServiceEditor", "Rank")) self.gridLayout.addWidget(self.lblRank, 2, 0, 1, 1) self.cboRank = QComboBox(self) self.cboRank.setMinimumSize(QSize(0, 30)) self.gridLayout.addWidget(self.cboRank, 2, 1, 1, 1) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 2) # Load combobox options loadComboSelections(self.cboPService.comboBox(), CheckInputService) self.cboRank.addItem("") self.cboRank.addItem(QApplication.translate("PriorityServiceEditor", "3 (Highest)"), 3) self.cboRank.addItem("2", 2) self.cboRank.addItem(QApplication.translate("PriorityServiceEditor", "1 (Lowest)"), 1) # Configure mappings self.addMapping( "itemID", self.cboPService.comboBox(), True, pseudoname=QApplication.translate("PriorityServiceEditor", "Priority Service"), ) self.addMapping("OtherItem", self.cboPService.lineEdit()) self.addMapping("Rank", self.cboRank, True) # Connect signals self.connect(self.buttonBox, SIGNAL("accepted()"), self.submit) self.connect(self.buttonBox, SIGNAL("rejected()"), self.cancel)
def __init__(self,parent,model = Garden): BaseGardenEditor.__init__(self,parent) MapperMixin.__init__(self,model) #specify mappings self.addMapping("Identifier", self.txtGardenIdentifier,True) self.addMapping("Acreage", self.sbAcreage) self.addMapping("AverageHarvest", self.sbAverageHarvest) self.addMapping("MonthlyEarning", self.sbMonthlyEarning) self.addMapping("MonthlyLabor", self.sbMonthlyLabor) self.addMapping("PlantingYear", self.dtPlantingYear)
def __init__(self, parent, model=Garden): BaseGardenEditor.__init__(self, parent) MapperMixin.__init__(self, model) #specify mappings self.addMapping("Identifier", self.txtGardenIdentifier, True) self.addMapping("Acreage", self.sbAcreage) self.addMapping("AverageHarvest", self.sbAverageHarvest) self.addMapping("MonthlyEarning", self.sbMonthlyEarning) self.addMapping("MonthlyLabor", self.sbMonthlyLabor) self.addMapping("PlantingYear", self.dtPlantingYear)
def __init__(self, parent=None, state=None, dataModel=GardenSurveyPoint): QDialog.__init__(self, parent) self.setupUi(self) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) # Connect signals self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel) self.coordWidget.setSRID(GardenSurveyPoint) # Define mappings self.addMapping("Geom", self.coordWidget)
def __init__(self, parent=None, state=None, dataModel=GardenSurveyPoint): QDialog.__init__(self, parent) self.setupUi(self) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) #Connect signals self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel) self.coordWidget.setSRID(GardenSurveyPoint) #Define mappings self.addMapping("Geom", self.coordWidget)
def __init__(self, parent=None, state=None, dataModel=HouseholdIncome): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) self.resize(290, 175) self.setWindowTitle( QApplication.translate("HouseholdIncomeEditor", "Household Income Editor")) self.gridLayout = QGridLayout(self) self.vlNotification = QVBoxLayout() self.vlNotification.setMargin(0) self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 2) #Add vertical layout for the notification bar self.setNotificationLayout(self.vlNotification) self.lblActivity = QLabel(self) self.lblActivity.setText( QApplication.translate("HouseholdIncomeEditor", "Activity")) self.gridLayout.addWidget(self.lblActivity, 1, 0, 1, 1) self.txtActivityName = QLineEdit(self) self.txtActivityName.setMinimumSize(QSize(0, 30)) self.txtActivityName.setMaxLength(30) self.gridLayout.addWidget(self.txtActivityName, 1, 1, 1, 1) self.lblAmount = QLabel(self) self.lblAmount.setText( QApplication.translate("HouseholdIncomeEditor", "Estimate Income")) self.gridLayout.addWidget(self.lblAmount, 2, 0, 1, 1) self.sbEstimateIncome = QSpinBox(self) self.sbEstimateIncome.setMinimumSize(QSize(0, 30)) self.sbEstimateIncome.setButtonSymbols(QAbstractSpinBox.NoButtons) self.sbEstimateIncome.setMaximum(1000000000) self.gridLayout.addWidget(self.sbEstimateIncome, 2, 1, 1, 1) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 2) #Configure mappings self.addMapping("Activity", self.txtActivityName, True) self.addMapping("EstimateIncome", self.sbEstimateIncome, True) #Connect signals self.connect(self.buttonBox, SIGNAL("accepted()"), self.submit) self.connect(self.buttonBox, SIGNAL("rejected()"), self.cancel)
def __init__(self, parent, model=None): self._model = model MapperDialog.__init__(self, parent) MapperMixin.__init__(self, self._model) self.buttonBox.accepted.connect(self.close_event) self.buttonBox.rejected.connect(self.cancel) if callable(model): self._table = model.__name__ else: self._table = model.__class__.__name__ self.set_window_title() self.setLayout(self.frmLayout) self.loadMapperDialog()
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setupUi(self) MapperMixin.__init__(self, data_model) self._notifBar = NotificationBar(self.vlNotification) #STR document manager self.doc_manager = SourceDocumentManager(self) self.doc_manager.registerContainer(self.vl_property_deed, PROPERTY_DEED) self.doc_manager.registerContainer(self.vl_registered_property, REGISTERED_PROPERTY_DEED) self.doc_manager.registerContainer(self.vl_tenancy_contract, W_TENANCY_CONTRACT) self.doc_manager.registerContainer(self.vl_oral_tenancy_contract, O_TENANCY_CONTRACT) self.doc_manager.registerContainer(self.vl_doc_other, OTHER_STR_DOCUMENT) self._curr_doc_type = None #Load STR document types self._load_str_doc_types() self._configure_foreign_key_mappers() self._configure_yes_no_selectors() #Connect signals self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel) self.cbo_str_type.comboBox().currentIndexChanged.connect(self._on_str_changed) self.gb_conflict.toggled.connect(self._on_conflict_selected) self.cbo_doc_type.currentIndexChanged.connect(self._on_document_type_changed) self.btn_add_doc.clicked.connect(self.load_str_document_selector) self.addMapping("type", self.cbo_str_type.comboBox(), True, pseudoname = QApplication.translate("SocialTenureEditor", "Social Tenure Relationship Type")) self.addMapping("other_type", self.cbo_str_type.lineEdit()) self.addMapping("pay_land_taxes", self.chk_land_taxes) self.addMapping("has_conflict", self.gb_conflict) self.addMapping("conflict_party", self.txt_conflict_party) self.addMapping("conflict_description", self.txt_conflict_description) self.addMapping("paid", self.chk_paid) self.addMapping("tenure_support", self.txt_tenure_support) self.addMapping("general_docs", self.doc_manager, get_func=general_str_filter) self.addMapping("oral_tenancy_docs", self.doc_manager, get_func=oral_contract_filter) self.addMapping("reg_property_docs", self.doc_manager, get_func=registered_deed_filter) self.addMapping("written_tenancy_docs", self.doc_manager, get_func=written_contract_filter) self.addMapping("property_docs", self.doc_manager, get_func=property_deed_filter)
def __init__(self, parent=None, state=None, dataModel=FoodCrop): QDialog.__init__(self, parent) self.setupUi(self) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) # Connect signals self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel) # Load combobox items loadComboSelections(self.cboCropCategory, CheckFoodCropCategory) # Define mappings self.addMapping("Acreage", self.sbAcreage) self.addMapping("CropName", self.txtCropName, True) self.addMapping("CategoryID", self.cboCropCategory, True, pseudoname="Food crop category")
def __init__(self, parent=None, state=None, dataModel=HouseholdIncome): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) self.resize(290, 175) self.setWindowTitle(QApplication.translate("HouseholdIncomeEditor", "Household Income Editor")) self.gridLayout = QGridLayout(self) self.vlNotification = QVBoxLayout() self.vlNotification.setMargin(0) self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 2) # Add vertical layout for the notification bar self.setNotificationLayout(self.vlNotification) self.lblActivity = QLabel(self) self.lblActivity.setText(QApplication.translate("HouseholdIncomeEditor", "Activity")) self.gridLayout.addWidget(self.lblActivity, 1, 0, 1, 1) self.txtActivityName = QLineEdit(self) self.txtActivityName.setMinimumSize(QSize(0, 30)) self.txtActivityName.setMaxLength(30) self.gridLayout.addWidget(self.txtActivityName, 1, 1, 1, 1) self.lblAmount = QLabel(self) self.lblAmount.setText(QApplication.translate("HouseholdIncomeEditor", "Estimate Income")) self.gridLayout.addWidget(self.lblAmount, 2, 0, 1, 1) self.sbEstimateIncome = QSpinBox(self) self.sbEstimateIncome.setMinimumSize(QSize(0, 30)) self.sbEstimateIncome.setButtonSymbols(QAbstractSpinBox.NoButtons) self.sbEstimateIncome.setMaximum(1000000000) self.gridLayout.addWidget(self.sbEstimateIncome, 2, 1, 1, 1) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 2) # Configure mappings self.addMapping("Activity", self.txtActivityName, True) self.addMapping("EstimateIncome", self.sbEstimateIncome, True) # Connect signals self.connect(self.buttonBox, SIGNAL("accepted()"), self.submit) self.connect(self.buttonBox, SIGNAL("rejected()"), self.cancel)
def __init__(self, parent=None, state=None, dataModel=HouseholdSaving): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) self.resize(290, 175) self.setWindowTitle( QApplication.translate("HouseholdSavingEditor", "Household Saving Editor")) self.gridLayout = QGridLayout(self) self.vlNotification = QVBoxLayout() self.vlNotification.setMargin(0) self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 2) #Add vertical layout for the notification bar self.setNotificationLayout(self.vlNotification) self.lblSavingsOption = QLabel(self) self.lblSavingsOption.setText( QApplication.translate("HouseholdIncomeEditor", "Savings Option")) self.gridLayout.addWidget(self.lblSavingsOption, 1, 0, 1, 1) self.cboSavingsOption = ComboBoxWithOther(self) self.cboSavingsOption.setMinimumSize(QSize(0, 30)) self.gridLayout.addWidget(self.cboSavingsOption, 1, 1, 1, 1) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 2) #Load saving options loadComboSelections(self.cboSavingsOption.comboBox(), CheckSavingsOption) #Configure mappings self.addMapping("OptionID",self.cboSavingsOption.comboBox(),True, \ pseudoname=QApplication.translate("HouseholdSavingEditor","Saving option type")) self.addMapping("OtherOption", self.cboSavingsOption.lineEdit()) #Connect signals self.connect(self.buttonBox, SIGNAL("accepted()"), self.submit) self.connect(self.buttonBox, SIGNAL("rejected()"), self.cancel)
def __init__(self, parent=None, state=None, dataModel=HouseholdSaving): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) self.resize(290, 175) self.setWindowTitle(QApplication.translate("HouseholdSavingEditor", "Household Saving Editor")) self.gridLayout = QGridLayout(self) self.vlNotification = QVBoxLayout() self.vlNotification.setMargin(0) self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 2) # Add vertical layout for the notification bar self.setNotificationLayout(self.vlNotification) self.lblSavingsOption = QLabel(self) self.lblSavingsOption.setText(QApplication.translate("HouseholdIncomeEditor", "Savings Option")) self.gridLayout.addWidget(self.lblSavingsOption, 1, 0, 1, 1) self.cboSavingsOption = ComboBoxWithOther(self) self.cboSavingsOption.setMinimumSize(QSize(0, 30)) self.gridLayout.addWidget(self.cboSavingsOption, 1, 1, 1, 1) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 2) # Load saving options loadComboSelections(self.cboSavingsOption.comboBox(), CheckSavingsOption) # Configure mappings self.addMapping( "OptionID", self.cboSavingsOption.comboBox(), True, pseudoname=QApplication.translate("HouseholdSavingEditor", "Saving option type"), ) self.addMapping("OtherOption", self.cboSavingsOption.lineEdit()) # Connect signals self.connect(self.buttonBox, SIGNAL("accepted()"), self.submit) self.connect(self.buttonBox, SIGNAL("rejected()"), self.cancel)
def __init__(self, parent=None, state=None, dataModel=FoodCrop): QDialog.__init__(self, parent) self.setupUi(self) self.setAttribute(Qt.WA_DeleteOnClose) MapperMixin.__init__(self, dataModel) #Connect signals self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel) #Load combobox items loadComboSelections(self.cboCropCategory, CheckFoodCropCategory) #Define mappings self.addMapping("Acreage", self.sbAcreage) self.addMapping("CropName", self.txtCropName, True) self.addMapping("CategoryID", self.cboCropCategory, True, pseudoname="Food crop category")
def __init__(self,datamodel=None): MapperMixin.__init__(self,datamodel) #Load combobox items #loadComboSelections(self.cboGender,CheckGender) #loadComboSelections(self.cboMaritalStatus,CheckMaritalStatus) #Set current date as maximum date self.dtDoB.setMaximumDate(QDate.currentDate()) #Input mask for controlling cellphone number entries. self.txtCellphone.setInputMask("9999-999999") self.txtCellphone.setCursorPosition(0) #Specify mappings self.addMapping("FirstName", self.txtFirstName, True) self.addMapping("LastName", self.txtLastName, True) self.addMapping("Cellphone", self.txtCellphone) #self.addMapping("GenderID", self.cboGender,True,pseudoname="Gender") #self.addMapping("MaritalStatusID", self.cboMaritalStatus,True,pseudoname="Marital Status") self.addMapping("DateofBirth", self.dtDoB) #Connect signals self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel)
def __init__(self, parent=None, model=Survey): QDialog.__init__(self, parent) self.setupUi(self) MapperMixin.__init__(self, model) #Connect signals self.buttonBox.accepted.connect(self.submit) self.buttonBox.rejected.connect(self.cancel) #Set current date as maximum date currDate = QDate.currentDate() self.dtEnumDate.setMaximumDate(currDate) self.dtEnumDate.setDate(currDate) self._notifBar = NotificationBar(self.vlNotification) #Configure Enumerator FK mapper enumFKMapper = self.tabWidget.widget(0) enumFKMapper.setDatabaseModel(Enumerator) enumFKMapper.setEntitySelector(EnumeratorEntityBrowser) enumFKMapper.setSupportsList(False) enumFKMapper.addCellFormatter("GenderID", genderFormatter) enumFKMapper.addCellFormatter("MaritalStatusID", maritalStatusFormatter) enumFKMapper.setNotificationBar(self._notifBar) enumFKMapper.initialize() #Configure Respondent FK mapper respondentFKMapper = self.tabWidget.widget(1) respondentFKMapper.setDatabaseModel(Respondent) respondentFKMapper.setEntitySelector(RespondentEntityBrowser, VIEW | MANAGE) respondentFKMapper.setSupportsList(False) respondentFKMapper.addCellFormatter("GenderID", genderFormatter) respondentFKMapper.addCellFormatter("MaritalStatusID", maritalStatusFormatter) respondentFKMapper.addCellFormatter("RoleID", respondentRoleFormatter) respondentFKMapper.setNotificationBar(self._notifBar) respondentFKMapper.initialize() #Configure Witnesses FK mapper witnessFKMapper = self.tabWidget.widget(2) witnessFKMapper.setDatabaseModel(Witness) witnessFKMapper.setEntitySelector(WitnessEntityBrowser, VIEW | MANAGE) witnessFKMapper.setSupportsList(True) witnessFKMapper.addCellFormatter("GenderID", genderFormatter) witnessFKMapper.addCellFormatter("MaritalStatusID", maritalStatusFormatter) witnessFKMapper.addCellFormatter("RelationshipID", witnessRelationshipFormatter) witnessFKMapper.setNotificationBar(self._notifBar) witnessFKMapper.initialize() #Configure attribute mappings self.addMapping("Code", self.txtSurveyCode, preloadfunc=self.codeGenerator()) self.addMapping("EnumerationDate", self.dtEnumDate) self.addMapping("Enumerator", enumFKMapper, True) self.addMapping("Respondent", respondentFKMapper, True) self.addMapping("Witnesses", witnessFKMapper, True)