Premshree Pillai ([info]premshree) wrote in [info]pyac,
@ 2004-09-27 16:17:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Fix for slides creation
If you have used PyAC for creating slides of presentations, you must’ve faced problems in the oredering of slides—that’s because the slides are sorted by name, which means a slide named Slide10.JPG is ordered before one that's name Slide2.JPG. To fix it, you will have to make changes to the doFiles() function. The modified function should like like this:
def doFiles(self):
	self.files = []
	for x in os.listdir(self.dirName):
		os.chdir(self.dirName)
		if(os.path.isfile(x)):
			self.files.append(x)

	files_no = []
	for x in self.files:
		m = re.match("([A-Za-z]*)(\d*)\.(JPG)", x)
		if m != None :
			slide_name = m.group(1)
			image_ext = m.group(3)
			files_no.append(m.group(2))
	files_no_counter = 0
	while files_no_counter < len(files_no):
		files_no[files_no_counter] = int(files_no[files_no_counter])
		files_no_counter = files_no_counter + 1
	files_no.sort()
	files_counter = 0
	while files_counter < len(self.files):
		self.files[files_counter] = slide_name + str(files_no[files_counter]) + "." + 

image_ext
		files_counter = files_counter + 1
This fix along with other changes will make way to the next version of PyAC.


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…