From: Drew Fisher Date: Tue, 25 Aug 2009 00:53:06 +0000 (-0500) Subject: Add a menu for multiple photo import techniques. X-Git-Url: http://git.zarvox.org/signup?a=commitdiff_plain;h=8f535e40884933f67456e287d3a098877c618aa5;p=wp3.git Add a menu for multiple photo import techniques. We would like to support importing photos by both timestamp and filename. To accomplish this, we must have a menu to do so. --- diff --git a/mainapp.py b/mainapp.py index 8d02969..f48f2de 100644 --- a/mainapp.py +++ b/mainapp.py @@ -49,6 +49,7 @@ class MainApp (QMainWindow): QObject.connect( self.chooseaction, SIGNAL("mergePhotos()"), self.mergePhotos) QObject.connect( self.chooseaction, SIGNAL("exportDocument(QString)"), self.exportDocumentSlot) QObject.connect( self.editperson, SIGNAL("done()"), self.returnToMainMenu) + QObject.connect( self.mergephotos, SIGNAL("done()"), self.returnToMainMenu) QObject.connect( self, SIGNAL("databaseChanged(QString)"), self.editperson.updateDB) QObject.connect( self, SIGNAL("mergeDone()"), self.editperson.reselect ) @@ -151,7 +152,8 @@ class MainApp (QMainWindow): self.center.setCurrentWidget(self.editperson) def mergePhotos(self): print "beginning photo merge" - self.mergephotos.beginMerge() + self.center.setCurrentWidget(self.mergephotos) + #self.mergephotos.beginMerge() def exportDocumentSlot(self, filename): writer = ODTWriter(self.db) writer.write(filename) diff --git a/mergephotos.py b/mergephotos.py index acd26b6..b9c33a9 100644 --- a/mergephotos.py +++ b/mergephotos.py @@ -7,11 +7,22 @@ class MergePhotos(QWidget): QWidget.__init__(self, parent) self.db = db self.layout = QGridLayout() - self.label = QLabel("Content goes here") - self.layout.addWidget(self.label,0,0) + self.label = QLabel("

Importing Photos

") + self.label.setAlignment(Qt.AlignCenter) + + self.button1 = QCommandLinkButton("Merge photos by NetID", "Add photos to records without photos by importing photos named .jpg") + self.button2 = QCommandLinkButton("Merge photos by timestamp", "Add photos to records without photos by sorting records and photos by creation time and matching pairs") + self.button3 = QCommandLinkButton("Cancel", "Return to main menu") + QObject.connect( self.button1, SIGNAL("clicked()"), self.beginMergeNetID ) + QObject.connect( self.button2, SIGNAL("clicked()"), self.beginMergeTimestamp ) + QObject.connect( self.button3, SIGNAL("clicked()"), self.done ) + self.layout.addWidget(self.label,0,0,1,3) + self.layout.addWidget(self.button1,1,1,1,1) + self.layout.addWidget(self.button2,2,1,1,1) + self.layout.addWidget(self.button3,3,1,1,1) self.setLayout(self.layout) - def beginMerge(self): + def beginMergeNetID(self): foldertext = QFileDialog.getExistingDirectory( None, "Pick folder of photos", ".") if not foldertext.isEmpty(): print foldertext @@ -41,4 +52,12 @@ class MergePhotos(QWidget): update_q.bindValue(":id", q.value(col_id)) update_q.exec_() print "Auto-imported photo for",q.value(col_netid).toString() + self.done() + + def beginMergeTimestamp(self): + print "merging by timestamp" + self.done() + + def done(self): + self.emit(SIGNAL("done()") )