コード例 #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
ファイル: frmhousehold_delete.py プロジェクト: r4vi/open-ihm
 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
ファイル: frmhouseholds.py プロジェクト: r4vi/open-ihm
	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
ファイル: frmcurrencymanager.py プロジェクト: r4vi/open-ihm
    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
ファイル: mixins.py プロジェクト: snim2mirror/openihm
 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
ファイル: mixins.py プロジェクト: snim2mirror/openihm
 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
ファイル: mixins.py プロジェクト: snim2mirror/openihm
 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
ファイル: mixins.py プロジェクト: snim2mirror/openihm
 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
ファイル: frmfindhousehold.py プロジェクト: r4vi/open-ihm
	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
ファイル: GenericDBOP.py プロジェクト: r4vi/open-ihm
	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()