예제 #1
0
def main():

    GlobalRoleList.add_role(Role("Baker", "B", 2))
    GlobalRoleList.add_role(Role("Steward", "S", 9))
    GlobalRoleList.add_role(Role("Fisherman", "F", 7))
    bob = Worker()
    bob.name = "Bob"
    bob.email = "*****@*****.**"
    bob.phoneNumber = "0116"
    testdate = date(2012, 12, 31)
    bob.blacklist_date(testdate)
    app = QtGui.QApplication(sys.argv)
    w = PersonWidget(None)
    w.setWindowTitle("Person")
    w.person(bob)
    w.show()

    sys.exit(app.exec_())
예제 #2
0
    def _loadInPopulationTables(self):
        _c = self._connection.cursor()
        self._institution.people = []
        personCacheDict = {'Name': 'PersonObject'}
        for row in _c.execute('SELECT * FROM Population ORDER BY name'):
            p = Worker()
            p.name = row[0]
            p.address = row[1]
            p.email = row[2]
            p.phoneNumber = row[3]
            self._institution.people.append(p)
            personCacheDict[p.name] = p

        for row in _c.execute('SELECT * FROM PopulationAvailability'):
            personCacheDict[row[0]].blacklist_date(row[1])

        for row in _c.execute('SELECT * FROM PopulationQualifications'):
            r = GlobalRoleList.role_from_desc(row[1])
            personCacheDict[row[0]].roles().add(r)

        self._personCacheDict = personCacheDict