def saveCharacteristic(self):
     controller = Controller()
     
     charname = self.txtCharacteristic.text()
     datatype = self.getDataType( self.cmbDataType.currentText() )
     description = self.txtDescription.text()
     
     if self.characteristic == "":
         if controller.existsGlobalCharacteristic( charname ):
             QMessageBox.information(self,"Add Personal Characteristic","Personal Characteristic Already Exists.")
             return
         else:
             controller.addGlobalCharacteristic(charname, "Personal", datatype, description)
     else:
         char = controller.getGlobalCharacteristic( self.characteristic )
         char.editData(charname, "Personal", datatype, description)
     
     self.parent.loadCharacteristics()
     
     self.close()
 def moveSelectedHouseholdCharacteristics(self):
    ''' Add selected available household characteristics to Project'''
    numSelected = self.countRowsSelected(self.tblAvailableHouseholdCharacteristics)
    if  numSelected != 0:
         selectedRows = self.getSelectedRows(self.tblAvailableHouseholdCharacteristics)
         for row in selectedRows:
             charname = self.tblAvailableHouseholdCharacteristics.model().item(row,0).text()
            
             if not self.project.existsProjectCharacteristic(charname):
                 controller = Controller()
                 char = controller.getGlobalCharacteristic(charname)
                 self.project.addProjectCharacteristic(char.name, char.chartype, char.datatype)
             else:
                 msg = "The household characteristic labelled, %s, has already been added to project" % (charname)
                 QMessageBox.information(self,"Project Configuration",msg)
                 
         self.displaySelectedHouseholdCharacteristics()
    else:
        msg = "Please select the household characteristics you want to add."
        QMessageBox.information(self,"Project Configuration",msg) 
 def showDetails(self):
     controller = Controller()
     char = controller.getGlobalCharacteristic(self.characteristic)
     self.txtCharacteristic.setText( char.name )
     self.txtDescription.setText( char.description )
     self.cmbDataType.setCurrentIndex( self.cmbDataType.findText( char.datatypestr ) )