]> git.zarvox.org Git - wp3.git/commitdiff
Boilerplate for a photo-merge class.
authorDrew Fisher <drew.m.fisher@gmail.com>
Sat, 22 Aug 2009 03:06:02 +0000 (22:06 -0500)
committerDrew Fisher <drew.m.fisher@gmail.com>
Sat, 22 Aug 2009 03:06:02 +0000 (22:06 -0500)
chooseaction.py
mainapp.py
mergephotos.py [new file with mode: 0644]

index 44338557850e1e39edb0b9da47c490d9ef63278b..82c13aeff254c783dcf279840acb93d907fc4890 100644 (file)
@@ -34,4 +34,7 @@ class ChooseAction (QWidget):
                pass
        def exportDocument(self):
                fileName = QFileDialog.getSaveFileName(self, "Save new file as:", ".", "OpenDocument Text Documents (*.odt)")
-               print "Will export db as",fileName
+               if not fileName.isEmpty():
+                       if not fileName.endsWith(".odt"): # if they leave off the extension, add it
+                               fileName = fileName.append(".odt")
+                       self.emit(QtCore.SIGNAL("exportDocument(QString)"),fileName)
index ae0102c264accc9e813867d08f73ba673af5db67..e57fe55d1671a1d7b71e8d61376e6df8990e0bc4 100644 (file)
@@ -4,6 +4,7 @@ from PyQt4.QtSql import *
 
 from chooseaction import ChooseAction
 from editperson import EditPerson
+from mergephotos import MergePhotos
 
 class MainApp (QMainWindow):
        schema = "CREATE TABLE people ( id INTEGER PRIMARY KEY AUTOINCREMENT, forename TEXT NOT NULL, surname TEXT NOT NULL, netid TEXT NOT NULL, email TEXT, birthday TEXT, phone TEXT, major TEXT, dorm TEXT, room INTEGER, photo BLOB, createtime TEXT NOT NULL, mtime TEXT NOT NULL);"
@@ -20,8 +21,10 @@ class MainApp (QMainWindow):
                self.center = QStackedWidget()
                self.chooseaction = ChooseAction(self,self.db)
                self.editperson = EditPerson(self,self.db)
+               self.mergephotos = MergePhotos(self,self.db)
                self.center.addWidget(self.chooseaction)
                self.center.addWidget(self.editperson)
+               self.center.addWidget(self.mergephotos)
                self.setCentralWidget(self.center)
 
                self.createActions()
@@ -42,6 +45,7 @@ class MainApp (QMainWindow):
                self.fileQuitAction = QAction("&Quit",self)
                QObject.connect( self.fileQuitAction, SIGNAL("triggered()"), self.quit)
                QObject.connect( self.chooseaction, SIGNAL("editPerson()"), self.editPersonSlot)
+               QObject.connect( self.chooseaction, SIGNAL("exportDocument(QString)"), self.exportDocumentSlot)
                QObject.connect( self.editperson, SIGNAL("done()"), self.returnToMainMenu)
                QObject.connect( self, SIGNAL("databaseChanged(QString)"), self.editperson.updateDB)
                QObject.connect( self, SIGNAL("mergeDone()"), self.editperson.reselect )
@@ -143,6 +147,9 @@ class MainApp (QMainWindow):
        def editPersonSlot(self):
                self.editperson.model.select() # update the table
                self.center.setCurrentWidget(self.editperson)
+       def mergePhotos(self):
+               print "beginning photo merge"
+               self.mergephotos.beginMerge()
 
 
 if __name__ == "__main__" :
diff --git a/mergephotos.py b/mergephotos.py
new file mode 100644 (file)
index 0000000..f9d3198
--- /dev/null
@@ -0,0 +1,16 @@
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+from PyQt4.QtSql import *
+
+class MergePhotos(QWidget):
+       def __init__(self, parent=None, db=None):
+               QWidget.__init__(self, parent)
+               self.db = db
+               self.layout = QGridLayout()
+               self.label = QLabel("Content goes here")
+               self.layout.addWidget(self.label,0,0)
+               self.setLayout(self.layout)
+
+       def beginMerge(self):
+               print QFileDialog.getExistingDirectory( None, "Pick folder of photos", ".")
+