def newWorker():
    bob = Worker()
    bob.name = ('Bob')
    bob.does_nothing()
    bob.add_role('S')
    bob.add_role('B')
    testDate = date(2012, 12, 31)
    testDate2 = date(2011, 12, 31)
    bob.clear_blacklist()
    bob.blacklist_date(testDate)
    bob.blacklist_date(testDate2)
    bob.phone_number = '0115'
    bob.address = 'a'
    bob.email = 'b'
    return bob
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_())
Beispiel #3
0
    def _get_people(self):
        self._population = []

        for i in range(1, self._population_sheet.nrows):
            if self._population_sheet.cell_type(i, 0) is 0:
                break
            else:
                p = Worker()
                p.name = self._population_sheet.cell_value(i, 0)
                p.phone_number = self._population_sheet.cell_value(i, 1)
                p.email = self._population_sheet.cell_value(i, 2)
                p.address = self._population_sheet.cell_value(i, 3)
                self._get_qualifications(i, p)
                self._get_dates(i, p)
                if p.name in map(name, self._population):
                    raise ExcellImportExportError('There were people with the same name : ' + p.name)
                else:
                    self._population.append(p)
Beispiel #4
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