tagger prints more

This commit is contained in:
q
2015-02-13 20:44:30 +02:00
parent cdf690c2e2
commit d1c9d120bb

View File

@@ -64,7 +64,7 @@ class Click:
self._resize_init()
self._init_db(sqlfile)
self._print_tags()
self.root.mainloop()
@@ -102,7 +102,7 @@ class Click:
refer_height=refer_size[1]
else:
refer_width=int(float(self.root.winfo_screenwidth()-220))
refer_height=self.root.winfo_screenheight()-100
refer_height=self.root.winfo_screenheight()-150
new_height=refer_height
new_width= int(float(self.img_copy.size[0])/float(self.img_copy.size[1])*new_height)
if new_width>refer_width:
@@ -131,8 +131,19 @@ class Click:
print("Added %s:%s"%(self.image_name,self.tagTexts[x]))
return
def _init_db(self, sqlfile):
def _print_tags(self):
self.db[0].execute("SELECT hash FROM list WHERE file = ?",( os.path.realpath( self.image_name), ))
hashes=self.db[0].fetchall()
if len(hashes)==0:
print("Image %s not in database!" % (self.image_name) )
self._next(None)
return
self.db[0].execute("SELECT tag FROM tags WHERE hash = ?",( hashes[0][0], ))
print("tags: "+",".join([x[0] for x in self.db[0]]))
return
def _init_db(self, sqlfile):
if not os.path.exists(sqlfile):
print("Cannot find SQLite file: "+sqlfile)
sys.exit(1)
@@ -149,6 +160,6 @@ else:
imagelist=sorted([f for f in os.listdir(opt.path) if IMGMATCH.match(f)])
for i,l in enumerate(imagelist):
print("%s %d"%( l, len(imagelist)-i+1))
print("%s %d"%( l, len(imagelist)-i))
clicker = Click(l,opt.tags,opt.sqlfile)