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)
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);"
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()
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 )
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__" :
--- /dev/null
+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", ".")
+