MCPcopy Create free account
hub / github.com/ActiveState/code / pyAlbum

Class pyAlbum

recipes/Python/271246_pyAlbumpy/recipe-271246.py:40–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38"""
39
40class pyAlbum:
41
42 def __init__(self, dirName, title, scale1, scale2, exifFlag = 1):
43 self.count = 0
44 self.dirName = dirName
45 self.title = title
46 self.scale1 = scale1
47 self.scale2 = scale2
48 self.exifFlag = exifFlag
49 self.slideName = "htmls"
50
51 def retPrevFile(self, index):
52 if(index == 0):
53 return "<span class=\"no_go\">&laquo; <b>No Previous</b></span>"
54 else:
55 str = """&laquo; <a href="%s">Previous</a>""" % (self.slideName + self.files[self.count - 1] + '.htm')
56 return str
57
58 def retNextFile(self, index):
59 if(index == len(self.files) - 1):
60 return "<span class=\"no_go\"><b>No Next</b> &raquo;</span>"
61 else:
62 str = """<a href="%s">Next</a> &raquo;""" % (self.slideName + self.files[self.count + 1] + '.htm')
63 return str
64
65 def retPipe(self, index):
66 return " | "
67 if(index > 0 and index < len(self.files) - 1):
68 return " | "
69 else:
70 return ""
71
72 def getScale1(self):
73 os.chdir(self.dirName)
74 os.mkdir(self.slideName)
75 global scale1
76 scale1 = raw_input("Enter scaling factor for Thumbnails: ")
77 try:
78 scale1 = float(scale1)
79 except ValueError:
80 print "Invalid value entered!"
81 getScale1()
82 if scale1 > 1.0:
83 print "Scaling factor should be less than 1!"
84 getScale1()
85
86 def getScale2():
87 global scale2
88 scale2 = raw_input("Enter scaling factor for Images: ")
89 try:
90 scale2 = float(scale2)
91 except ValueError:
92 print "Invalid value entered!"
93 getScale2()
94 if scale2 > 1.0:
95 print "Scaling factor should be less than 1!"
96 getScale2()
97

Callers 1

recipe-271246.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected