예제 #1
0
	def __init__(self, parent):
	    ''' Set up the dialog box interface '''
	    self.parent = parent
	    QDialog.__init__(self)
	    self.setupUi(self)
	    self.parent = parent
	    self.config = Config.dbinfo().copy()
	    
	    # get food energy requirement details by sex and age
	    self.getFoodEnergyRequirements()
예제 #2
0
 def __init__(self, parent):
     ''' Set up the dialog box interface '''
     QDialog.__init__(self)
     self.setupUi(self)
     self.parent = parent
     
     self.config = Config.dbinfo().copy()
     
     # get projects
     self.getHouseholds()
예제 #3
0
	def __init__(self, parent):
	    ''' Set up the dialog box interface '''
	    self.parent = parent
	    QDialog.__init__(self)
	    self.setupUi(self)
	    self.parent = parent
	    self.config = Config.dbinfo().copy()
	    
	    self.lblProjectName.setText( self.parent.projectname ) 
	    # get current project details
	    self.getHouseholds()
예제 #4
0
파일: mixins.py 프로젝트: r4vi/open-ihm
 def executeUpdateQuery(self, query):
     """Execute a query that needs to be committed to the database.
     For example, an INSERT or UPDATE query.
     """
     config = Config.dbinfo().copy()
     db = connector.Connect(**config)             
     cursor = db.cursor()
     cursor.execute(query)
     db.commit()
     cursor.close()
     db.close()
     return
예제 #5
0
 def __init__(self, parent):
     ''' Set up the dialog box interface '''
     self.parent = parent
     QDialog.__init__(self)
     self.setupUi(self)
     self.parent = parent
     self.currentitem = ""
     
     # connect to database
     self.config = Config.dbinfo().copy()
     
     self.listItems()
예제 #6
0
    def __init__(self, parent):
        """ Set up the dialog box interface """
        self.parent = parent
        QDialog.__init__(self)
        self.setupUi(self)
        self.parent = parent
        self.currencyid = 0

        # connect to database
        self.config = Config.dbinfo().copy()

        self.listCurrencies()
예제 #7
0
	def __init__(self, parent, hhid = "", hhname = ""):
		''' Set up the dialog box interface '''
		QDialog.__init__(self)
		self.setupUi(self)
		self.parent = parent
		self.config = Config.dbinfo().copy()
		
		self.lblProjectName.setText( self.parent.projectname ) 
		self.txtHouseholdNo.setText( hhid )
		self.txtHouseholdName.setText ( hhname )
		
		self.getHouseholds()
예제 #8
0
 def executeResultsQuery(self, query):
     """Execute a query for which the database will return results.
     For example a SELECT query.
     """
     config = Config.dbinfo().copy()
     db = connector.Connect(**config)
     cursor = db.cursor()
     cursor.execute(query)
     results = cursor.fetchall()
     cursor.close()
     db.close()
     return results
예제 #9
0
 def executeMultipleUpdateQueries(self, queries):
     """This method is idential to self.executeUpdateQuery
     except that it takes a list of query strings and executes each in turn
     """
     config = Config.dbinfo().copy()
     db = connector.Connect(**config)
     cursor = db.cursor()
     for query in queries:
         cursor.execute(query)
         db.commit()
     cursor.close()
     db.close()
     return
예제 #10
0
 def executeUpdateQuery(self, query, params=None):
     """Execute a query that needs to be committed to the database.
     For example, an INSERT or UPDATE query.
     """
     config = Config.dbinfo().copy()
     db = connector.Connect(**config)
     cursor = db.cursor()
     converted_qt = ParamsUtility.make_parameters_safe(params)
     cursor.execute(query, converted_qt)
     db.commit()
     cursor.close()
     db.close()
     return
예제 #11
0
 def executeMultipleResultsQueries(self, queries):
     """This method is idential to self.executeResultsQuery
     except that it takes a list of query strings, executes each in turn
     and returns a corresponding list of results.
     """
     results = []
     config = Config.dbinfo().copy()
     db = connector.Connect(**config)
     cursor = db.cursor()
     for query in queries:
         cursor.execute(query)
         result = cursor.fetchall()
         results.append(result)
     cursor.close()
     db.close()
     return results
예제 #12
0
    def __init__(self, parent,  hhid, hhname, expid = 0 ):
		''' Set up the dialog box interface '''
		QDialog.__init__(self)
		self.setupUi(self)
		self.parent 	= parent
		self.pid  = parent.parent.projectid
		self.hhid 		= hhid
		self.expid 		= expid
		
		self.config = Config.dbinfo().copy()
		
		self.getExpenditureTypes()
		
		if ( expid != 0 ):
			self.displayExpenditureDetails()
			self.setWindowTitle( "Edit Household Expenditure" )
		  
		# display household name
		self.lblHouseholdName.setText(hhname)
예제 #13
0
     def __init__(self, parent,  hhid, hhname, incomeid = 0 ):
         ''' Set up the dialog box interface '''
         QDialog.__init__(self)
         self.setupUi(self)
         self.parent 	= parent
         self.hhid 		= hhid
         self.pid = parent.parent.projectid
         self.incomeid 	= incomeid

         self.config = Config.dbinfo().copy()

         self.getGiftsTypes()
         self.getCropTypes()

         if ( incomeid != 0 ):
             self.displayIncomeDetails()
             self.setWindowTitle( "Edit Income Item" )

         # display household name
         self.lblHouseholdName.setText(hhname)
예제 #14
0
    def __init__(self, parent, hhid, hhname, memberid):
        """ Set up the dialog box interface """
        QDialog.__init__(self)
        self.setupUi(self)
        self.parent = parent
        self.hhid = hhid
        self.currentid = memberid

        # configure connect to database
        self.config = Config.dbinfo().copy()

        # add years to the year of birth combo box: current year to 150 years ago
        thisyear = date.today().year
        for year in range(thisyear, thisyear - 151, -1):
            self.cmbYearOfBirth.addItem("%i" % year)

        # display household name
        self.lblHouseholdName.setText(hhname)

        # get and display member details
        self.getMemberDetails()
예제 #15
0
 def __init__(self, parent,  hhid, hhname, incomeid = 0 ):
     ''' Set up the dialog box interface '''
     QDialog.__init__(self)
     self.setupUi(self)
     self.parent 	= parent
     self.hhid 		= hhid
     self.pid = parent.parent.projectid
     self.incomeid 	= incomeid
     
     self.config = Config.dbinfo().copy()
     
     self.getCropTypes()
     
     if ( incomeid != 0 ):
         self.displayIncomeDetails()
         self.setWindowTitle( "Edit Income Item" )
         
     # display household name
     self.lblHouseholdName.setText(hhname)
     
     # lock editing of income source and unit of measure
     self.cboIncomeType.setEditable( False )
     self.txtUnitOfMeasure.setReadOnly( True )
예제 #16
0
	def __init__(self, parent):
		''' Set up the dialog box interface '''
		QDialog.__init__(self)
		self.setupUi(self)
		self.parent = parent
		self.config = Config.dbinfo().copy()
예제 #17
0
 def test_dbinfo(self):
     Config.set_config(dummy_config())
     self.assertEqual(Config.dbinfo(), {'a': 'b'})
예제 #18
0
 def __init__(self,projectid):
     self.database = Database()
     self.pcharstable = 'p' + str(projectid) +'PersonalCharacteristics'
     self.hcharstable = 'p' + str(projectid) +'HouseholdCharacteristics'
     self.pid = projectid
     self.config = Config.dbinfo().copy()
예제 #19
0
	def __init__(self,query):
		# connect to mysql database
		self.config = Config.dbinfo().copy()        	
		self.db = connector.Connect(**self.config)
        	self.cursor = self.db.cursor()		
		self.sqlquery = query
예제 #20
0
 def __init__(self):
     self.database = Database()
     self.config = Config.dbinfo().copy()