P
p_tierchen
Dear reader,
the application is an interface to a sqlite database and stores image
metadata (such as year, event, photographer, people on image etc.). i use
pyqt4 for the interface and developed this application on a linux platform
(python 2.5.4). friends of mine liked what i have done an want it for their
windows computers. so i setup a test system (win XP and python 2.6.?).
copying the code to this system and starting it: works as intended. however
they complain python whats this, this is sooo complicated etc. so i took
refuge in using py2exe, planing to give them a zip compressed archive ...
testing this option i found out that on the surface all looks nice (GUI and
functions etc) however:
extending to "larger" datasets (>~50 images) some of the for loops stop
after some time.
e.g:
def update_allImages(self):
self.set_statusbar(unicode("Daten werden für alle angezeigten Bilder
eingetragen"))
for row in range(self.liwi.count()):
item=self.liwi.item(row)
md5=item.toolTip()#.split("<")[0]
md5=unicode(md5.split("<")[0])
self.md5TOimdata[md5].addyear(self.ui.year_comboBox.currentText())
self.md5TOimdata[md5].addEvent(self.ui.event_comboBox.currentText())
self.md5TOimdata[md5].addauth(self.ui.Author_cb.currentText())
comment=self.ui.CommentInput_text.toPlainText()
if comment:
comment.append("; ")
self.md5TOimdata[md5].addcomment(comment)
for i in range(self.ui.people_listWidget.count()):
pitem=self.ui.people_listWidget.item(i)
name=pitem.text()
self.md5TOimdata[md5].addperson(name)
item.setToolTip(self.md5TOimdata[md5].generateToolTip())
self.liwi.setCurrentItem(item)
self.md5TOimdata[md5].update_DB()
self.set_statusbar(unicode("Alles eingetragen: Bereit"))
sorry for the german strings in the statusbar (to be changed in future
versions)
in the third line the problematic "for" starts. at about item 42 or 43 the
statusbar stays on what is in line 2 and nothing more happens. so the first
42 items get updated the rest not. well i can restart this process but
success is limited only view more items get updated. note that this code
works fine in linux and in windows (python commandline) but hangs as
described after py2exe.
a second example is when i try to load many images (~130) again here is a
for loop iterating over filenames. the pure python versions work as they
should but not the py2exe.
def ImLoad(self):
""" This method is called by clicking on the "load images" button.
It loads the
selected images from the source and copies them to the db
filesystem.
Of course it is checked whether the image is allready in the db
(no insertion
happens) or if its is even loaded (not going to be loaded twice)
"""
fileNames = QtGui.QFileDialog.getOpenFileNames(self,
"Bild(er) laden", "", "Bild Dateien (*.png *.jpg *.bmp *.tif)")
for fileName in fileNames:
#work is done
therefore i think its in the" for" loops.
thanks in advance. just ask if you need more info. kind regards Jo
the application is an interface to a sqlite database and stores image
metadata (such as year, event, photographer, people on image etc.). i use
pyqt4 for the interface and developed this application on a linux platform
(python 2.5.4). friends of mine liked what i have done an want it for their
windows computers. so i setup a test system (win XP and python 2.6.?).
copying the code to this system and starting it: works as intended. however
they complain python whats this, this is sooo complicated etc. so i took
refuge in using py2exe, planing to give them a zip compressed archive ...
testing this option i found out that on the surface all looks nice (GUI and
functions etc) however:
extending to "larger" datasets (>~50 images) some of the for loops stop
after some time.
e.g:
def update_allImages(self):
self.set_statusbar(unicode("Daten werden für alle angezeigten Bilder
eingetragen"))
for row in range(self.liwi.count()):
item=self.liwi.item(row)
md5=item.toolTip()#.split("<")[0]
md5=unicode(md5.split("<")[0])
self.md5TOimdata[md5].addyear(self.ui.year_comboBox.currentText())
self.md5TOimdata[md5].addEvent(self.ui.event_comboBox.currentText())
self.md5TOimdata[md5].addauth(self.ui.Author_cb.currentText())
comment=self.ui.CommentInput_text.toPlainText()
if comment:
comment.append("; ")
self.md5TOimdata[md5].addcomment(comment)
for i in range(self.ui.people_listWidget.count()):
pitem=self.ui.people_listWidget.item(i)
name=pitem.text()
self.md5TOimdata[md5].addperson(name)
item.setToolTip(self.md5TOimdata[md5].generateToolTip())
self.liwi.setCurrentItem(item)
self.md5TOimdata[md5].update_DB()
self.set_statusbar(unicode("Alles eingetragen: Bereit"))
sorry for the german strings in the statusbar (to be changed in future
versions)
in the third line the problematic "for" starts. at about item 42 or 43 the
statusbar stays on what is in line 2 and nothing more happens. so the first
42 items get updated the rest not. well i can restart this process but
success is limited only view more items get updated. note that this code
works fine in linux and in windows (python commandline) but hangs as
described after py2exe.
a second example is when i try to load many images (~130) again here is a
for loop iterating over filenames. the pure python versions work as they
should but not the py2exe.
def ImLoad(self):
""" This method is called by clicking on the "load images" button.
It loads the
selected images from the source and copies them to the db
filesystem.
Of course it is checked whether the image is allready in the db
(no insertion
happens) or if its is even loaded (not going to be loaded twice)
"""
fileNames = QtGui.QFileDialog.getOpenFileNames(self,
"Bild(er) laden", "", "Bild Dateien (*.png *.jpg *.bmp *.tif)")
for fileName in fileNames:
#work is done
therefore i think its in the" for" loops.
thanks in advance. just ask if you need more info. kind regards Jo