def exif_table(self): from trackerutils import div ctags = div(klass="ctagzone", contents="".join([tag.tag.clink() for tag in self.tags.all()])) photoset = div(klass="photosetzone", contents="".join([tag.tag.photosetlink() for tag in self.tags.all()])) cspot = "" if self.photospot: cspot = self.photospot.clink() cspot = div(klass="cspotzone", contents=cspot or " ") if self.resolutionx and self.resolutiony: size = "%dx%d" % (self.resolutionx, self.resolutiony) else: size = "" dat = ( ("camera", self.camera), ("iso", self.iso), ("mm", self.mm), ("size", size), ("filesize", humanize_size(self.filesize)), ("tags clink", ctags), ("photoset", photoset), ("photospot clink", cspot), ) res = mktable(dat, skip_false=True) return res
def info_table(self): if self.deleted: dd = "%sdeleted" % icon(0) else: dd = "" if self.day: daylink = self.day.vlink() kill_daylink = '<div class="btn btn-default kill_day_btn">X</div>' daylink += " " + kill_daylink else: daylink = None founded = self.founded.exists() and self.founded.get() or False fspot = "" if founded: fspot = founded.clink(text="founded photospot %s" % founded) dat = ( ("deleted", dd), ("day", daylink), ("incoming", icon(self.incoming)), ("setup", icon(self.setup)), ("myphoto", icon(self.myphoto)), ("thumb ok", icon(self.thumb_ok)), ("done", icon(self.tags.filter(tag__name="done").exists())), ("crop", (self.xcrop or self.ycrop) and ("x=%d y=%d" % (self.xcrop, self.ycrop)) or ""), ("taken", self.taken and self.taken.strftime(DATE_DASH_REV_DAY) or ""), ("photo created", self.photo_created.strftime(DATE_DASH_REV_DAY)), ("photo modified", self.photo_modified.strftime(DATE_DASH_REV_DAY)), ("obj created", self.created.strftime(DATE_DASH_REV)), ("obj modified", self.modified.strftime(DATE_DASH_REV)), ("fspot", fspot), ) res = mktable(dat, skip_false=True, nb=True) return res
def name_table(self, include_image=True, clink=False, vlink=False, ajaxlink=False): dat = [ ("id", self.clink(text=self.id)), ("name", self.name), ("hash", self.hash), ("fn", os.path.split(self.fp)[-1]), ] if include_image: dat.insert(2, ("img", self.inhtml(size="thumb", clink=clink, vlink=vlink, ajaxlink=ajaxlink))) res = mktable(dat, skip_false=True) return res
def links_table(self): from trackerutils import div # vtags=div(klass='vtagzone',contents=', '.join([tag.tag.vlink() for tag in self.tags.all()])) vspot = "" if self.photospot: vspot = self.photospot.vlink() vspot = div(klass="vspotzone", contents=vspot or " ") data = (("photospot vlink", vspot),) # ('tags vlink',vtags), res = mktable(data, skip_false=False) return res
def get_photospothtml(self): if self.photospot: cl = self.photospot.clink() vl = self.photospot.vlink() data = [ ("name", self.photospot.name), ("clink", cl), ("vlink", vl), ("count", self.photospot.photos.count()), ] return mktable(data) else: return ""