~photostory/photostory/cleanup

« back to all changes in this revision

Viewing changes to app.py

  • Committer: David
  • Date: 2010-07-21 21:19:33 UTC
  • Revision ID: david@david-laptop-20100721211933-wqa64e2gfruaxrmz
Made the paths of files in the deletePic() function relative paths instead of absolute paths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
            date = cal.get_date()
137
137
            if date in self.db:
138
138
                os.remove(self.db[date])
139
 
                pic.set_from_file("/usr/share/photostory/data/nopic.png")
 
139
                pic.set_from_file("data/nopic.png")
140
140
                if date == todayDate:
141
141
                    takeBut.set_label("Take today's picture")
142
142
                    takeBut.set_sensitive(True)
143
143
                gaps = 0
144
144
                i = 0
145
145
                for element in self.db:
146
 
                    oldPath = "/usr/share/photostory/pictures/" + str(i) + ".png"
 
146
                    oldPath = "pictures/" + str(i) + ".png"
147
147
                    if not os.path.exists(oldPath):
148
148
                        gaps += 1
149
149
                        i += 1
150
 
                    oldPath = "/usr/share/photostory/pictures/" + str(i) + ".png"
 
150
                    oldPath = "pictures/" + str(i) + ".png"
151
151
                    if os.path.exists(oldPath):
152
152
                        key = getKey(self.db, oldPath)
153
 
                        newPath = "/usr/share/photostory/pictures/" + str(i-gaps) + ".png"
 
153
                        newPath = "pictures/" + str(i-gaps) + ".png"
154
154
                        os.rename(oldPath, newPath)
155
155
                        self.db[key] = newPath
156
156
                    i += 1