예제 #1
0
 def on_btn_scan_clicked(self):
     items = self.tbl_scan_path.selectedItems()
     for i in items[::2]:
         path = ScanPath.objects.get(path=i.text())
         for dirpath, dirnames, filenames in os.walk(path.path):
             print "Scanning %s ..." % dirpath
             sp, created = ScanPath.objects.get_or_create(path=dirpath)
             has_photo = False
             for f in filenames:
                 if f.endswith('.jpg'):
                     has_photo = True
                     print "Save photo %s ..." % f
                     try:
                         get_square_thumb_80(sp.path, f)
                         save_photo(sp, f)
                     except Exception, e:
                         logging.exception(e)
             if not has_photo:
                 sp.delete()
예제 #2
0
 def on_btn_scan_clicked(self):
     items = self.tbl_scan_path.selectedItems()
     for i in items[::2]:
         path = ScanPath.objects.get(path=i.text())
         for dirpath, dirnames, filenames in os.walk(path.path):
             print "Scanning %s ..." % dirpath
             sp, created = ScanPath.objects.get_or_create(path=dirpath)
             has_photo = False
             for f in filenames:
                 if f.endswith('.jpg'):
                     has_photo = True
                     print "Save photo %s ..." % f
                     try:
                         get_square_thumb_80(sp.path, f)
                         save_photo(sp, f)
                     except Exception, e:
                         logging.exception(e)
             if not has_photo:
                 sp.delete()
예제 #3
0
 def on_lst_memori_item_clicked(self, item):
     for i in range(10):
         for j in range(10):
             self.grid_photos.itemAtPosition(i, j).widget().setPixmap(None)
     idx = 0
     for i in self.events[self.lst_memori.indexFromItem(item).row()][::-1]:
         if idx >= 100:
             return
         photo = i.root.path + i.path
         thumb = get_square_thumb_80(i.root.path, i.path)
         img = QPixmap(thumb)
         lbl = self.grid_photos.itemAtPosition(idx / 10, idx % 10).widget()
         lbl.setPixmap(img)
         idx += 1
예제 #4
0
 def on_lst_memori_item_clicked(self, item):
     for i in range(10):
         for j in range(10):
             self.grid_photos.itemAtPosition(i, j).widget().setPixmap(None)
     idx = 0
     for i in self.events[self.lst_memori.indexFromItem(item).row()][::-1]:
         if idx >= 100:
             return
         photo = i.root.path + i.path
         thumb = get_square_thumb_80(i.root.path, i.path)
         img = QPixmap(thumb)
         lbl = self.grid_photos.itemAtPosition(idx / 10, idx % 10).widget()
         lbl.setPixmap(img)
         idx += 1