def __init__ (self, kd={}, rm=None): if KeyManager.__single: raise KeyManager.__single else: KeyManager.__single = self self.kd = kd if not rm: import recipeManager rm = recipeManager.default_rec_manager() self.rm = rm self.cooking_verbs=cooking_verbs # This needs to be made sane i18n-wise self.ignored = defaults.IGNORE self.ignored.extend(self.cooking_verbs) self.ignored_regexp = re.compile("[,; ]?(" + '|'.join(self.ignored) + ")[,; ]?") if self.rm.fetch_len(self.rm.keylookup_table) == 0: self.initialize_from_defaults() self.initialize_categories()
format_ingdiff_line(right[n])] ) tv = gtk.TreeView() r = gtk.CellRendererText() tc = gtk.TreeViewColumn('Left',r,markup=0) tc2 = gtk.TreeViewColumn('Right',r,markup=1) tv.append_column(tc) tv.append_column(tc2) tv.set_model(ls) return tv if __name__ == '__main__': import recipeManager, gtk rd = recipeManager.default_rec_manager() r1 = 33 r2 = 241 #empty_hash = get_ingredient_hash([],None) #rr = {}; ii = {}; ir = {}; count = 0 # for rec in rd.fetch_all(rd.recipe_table,deleted=False): # count += 1 # rh,ih = hash_recipe(rec,rd) # ch = rh+ih # if count % 10 == 0: print count,rec.id,ch # #print ch,rec.id # if ir.has_key(ch): # print rec.id,rec.title,'is a complete duplicate of',ir[ch].id,ir[ch].title # print 'Merge would be: ',merge_recipes(rd,[rec,ir[ch]]) # else:
ls.append( [format_ingdiff_line(left[n]), format_ingdiff_line(right[n])]) tv = Gtk.TreeView() r = Gtk.CellRendererText() tc = Gtk.TreeViewColumn('Left', r, markup=0) tc2 = Gtk.TreeViewColumn('Right', r, markup=1) tv.append_column(tc) tv.append_column(tc2) tv.set_model(ls) return tv if __name__ == '__main__': import recipeManager rd = recipeManager.default_rec_manager() r1 = 33 r2 = 241 #empty_hash = get_ingredient_hash([],None) #rr = {}; ii = {}; ir = {}; count = 0 # for rec in rd.fetch_all(rd.recipe_table,deleted=False): # count += 1 # rh,ih = hash_recipe(rec,rd) # ch = rh+ih # if count % 10 == 0: print count,rec.id,ch # #print ch,rec.id # if ir.has_key(ch): # print rec.id,rec.title,'is a complete duplicate of',ir[ch].id,ir[ch].title # print 'Merge would be: ',merge_recipes(rd,[rec,ir[ch]]) # else: