def __init__(self, g): UI.__init__(self) #self.apiToken = apiToken self.google = g # TODO: verify on creation that (self.data.short_name, self.data.fraternity, self.data.name) in list of contacts creates a unique person, if it doesn't we need to rethink the keys HouseData = collections.namedtuple( 'HouseData', spreadsheet_constants.house_data_header) ContactData = collections.namedtuple( 'ContactData', spreadsheet_constants.contact_data_header) print('Using the following namedtuple class for house data:') print(HouseData._fields) print('Using the following namedtuple class for contact data:') print(ContactData._fields) # maybe we should hold Iaddressees and Iemailaddresses in two lists self.houses = [] self.contacts = [] for data in g.get_clean_data( spreadsheet_constants.sheet_names['houses'], spreadsheet_constants.ffill_column_names['houses'] )[1:]: # skip the header self.houses.append( House( HouseData( *(data[:spreadsheet_constants.house_data_header_length] )))) for data in g.get_clean_data( spreadsheet_constants.sheet_names['contacts'], spreadsheet_constants.ffill_column_names['contacts'] )[1:]: # skip the header # look up the right house in the list of houses lookup_tuple = tuple( data[:spreadsheet_constants.columns_that_define_unique_house]) for house in self.houses: if lookup_tuple == house.data[:spreadsheet_constants. columns_that_define_unique_house]: self.contacts.append( Contact( ContactData( *(data[:spreadsheet_constants. contact_data_header_length - 1]), house.data)) ) # subtract 1 so we can add the house data named tuple to the contact data break print('Loaded {} houses and {} people'.format(len(self.houses), len(self.contacts)))
def __init__ (self, store, pics): if has_gtk == 0: raise GtkUnavailable UI.__init__(self, store) self.gladexml = gtk.glade.XML(GLADE_INTERFACE) dic = { "on_quit1_activate" : self.quit, "on_quit_without_saving2_activate" : self.die, "on_save1_activate" : self.save_store, "on_main_destroy" : self.die, "on_SaveButton_clicked" : self.savenext, "on_SameButton_clicked" : self.samenext, "on_SkipButton_clicked" : self.next, "on_about1_activate" : self.about, "on_closebutton1_clicked" : self.about_close, "on_saveandquit_activate" : self.savequit, } self.gladexml.signal_autoconnect(dic) self.status = self.gladexml.get_widget("Status") self.name = self.gladexml.get_widget("ImageName") self.title = self.gladexml.get_widget("TitleField") self.desc = self.gladexml.get_widget("DescriptionField") self.image = self.gladexml.get_widget("Image") self.saveButton= self.gladexml.get_widget("SaveButton") self.sameButton= self.gladexml.get_widget("SameButton") self.skipButton= self.gladexml.get_widget("SkipButton") self.aboutbox= self.gladexml.get_widget("AboutBox") self.progressBar = self.gladexml.get_widget("AnswerProgress") abouttitle = self.gladexml.get_widget("AboutTitle") abouttitle.set_label(re.sub("VERSION", Version.v, abouttitle.get_label())) self.args = pics if len(self.args) > 0: self.progress_step = 1.0 / len(self.args) self.show_picturedata(self.args[0]) self.args = self.args[1:] else: self.error("No image specified") sys.exit(0) gtk.main() sys.exit(0)
def __init__(self): UI.__init__(self)