]> git.zarvox.org Git - wp3.git/commitdiff
Add a menu for multiple photo import techniques.
authorDrew Fisher <drew.m.fisher@gmail.com>
Tue, 25 Aug 2009 00:53:06 +0000 (19:53 -0500)
committerDrew Fisher <drew.m.fisher@gmail.com>
Tue, 25 Aug 2009 00:53:06 +0000 (19:53 -0500)
We would like to support importing photos by both timestamp and
filename.  To accomplish this, we must have a menu to do so.

mainapp.py
mergephotos.py

index 8d0296953d10eebc19c1f598251f83217f4911d7..f48f2de6c92426322892567905ce5e8767c11d3a 100644 (file)
@@ -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)
index acd26b68fe688ae30a6243dc4c8d26f5b0cdef98..b9c33a93bf5145ba7d35a6d996f95baa34557e17 100644 (file)
@@ -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("<h2>Importing Photos</h2>")
+               self.label.setAlignment(Qt.AlignCenter)
+
+               self.button1 = QCommandLinkButton("Merge photos by NetID", "Add photos to records without photos by importing photos named <netid>.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()") )