]> git.zarvox.org Git - wp3.git/commitdiff
Main app UI mockup.
authorDrew Fisher <drew.m.fisher@gmail.com>
Wed, 1 Jul 2009 04:37:22 +0000 (21:37 -0700)
committerDrew Fisher <drew.m.fisher@gmail.com>
Wed, 1 Jul 2009 04:37:22 +0000 (21:37 -0700)
chooseaction.py [new file with mode: 0644]
mainapp.py [new file with mode: 0644]
netidstep.py
newpersonwizard.py

diff --git a/chooseaction.py b/chooseaction.py
new file mode 100644 (file)
index 0000000..fed6600
--- /dev/null
@@ -0,0 +1,23 @@
+from PyQt4 import QtCore
+from PyQt4.QtGui import *
+from newpersonwizard import NewPersonWizard
+
+class ChooseAction (QWidget):
+       def __init__(self, parent=None):
+               QWidget.__init__(self,parent)
+               self.l1 = QLabel("<center><h1>Select a task:<h1></center>")
+               self.pb1 = QCommandLinkButton("Add a person to the directory","If you haven't seen this program before, hit this button.")
+               self.pb2 = QCommandLinkButton("Edit a directory record","If you've already added your data, but want to edit it, hit this button.")
+               self.pb3 = QCommandLinkButton("Import photos","To match picture from a camera to entered data, hit this button.")
+               self.pb4 = QCommandLinkButton("Export as document","To export the directory as a document for printing, hit this button.")
+               self.layout = QGridLayout()
+               self.layout.addWidget(self.l1,0,0,1,3)
+               self.layout.addWidget(self.pb1,1,1,1,1)
+               self.layout.addWidget(self.pb2,2,1,1,1)
+               self.layout.addWidget(self.pb3,3,1,1,1)
+               self.layout.addWidget(self.pb4,4,1,1,1)
+               QtCore.QObject.connect(self.pb1, QtCore.SIGNAL("clicked()"), self.addPerson)
+               self.setLayout(self.layout)
+       def addPerson(self):
+               wiz = NewPersonWizard()
+               wiz.exec_()
diff --git a/mainapp.py b/mainapp.py
new file mode 100644 (file)
index 0000000..c28cadf
--- /dev/null
@@ -0,0 +1,62 @@
+from PyQt4 import QtCore
+from PyQt4.QtGui import *
+
+from chooseaction import ChooseAction
+
+class MainApp (QMainWindow):
+       def __init__(self, Parent=None):
+               QMainWindow.__init__(self, Parent)
+               self.setWindowTitle("Whitepages V3")
+
+               self.center = ChooseAction(self)
+               #self.center = QLabel("<center><h1>Filler</h1></center>")
+               self.setCentralWidget(self.center)
+
+               self.createActions()
+               self.createMenus()
+
+               self.statusBar().showMessage("Ready")
+               self.setUnifiedTitleAndToolBarOnMac(True);
+               self.resize(800,600)
+               self.show()
+
+       def createActions(self):
+               self.fileNewAction = QAction("&New Database",self)
+               QtCore.QObject.connect( self.fileNewAction, QtCore.SIGNAL("triggered()"), self.newFile)
+               self.fileOpenAction = QAction("&Open Database",self)
+               QtCore.QObject.connect( self.fileOpenAction, QtCore.SIGNAL("triggered()"), self.openFile)
+               self.fileImportAction = QAction("&Import (Merge)", self)
+               QtCore.QObject.connect( self.fileImportAction, QtCore.SIGNAL("triggered()"), self.mergeWizard)
+               self.fileQuitAction = QAction("&Quit",self)
+               QtCore.QObject.connect( self.fileQuitAction, QtCore.SIGNAL("triggered()"), self.quit)
+               
+       
+       def createMenus(self):
+               self.fileMenu = self.menuBar().addMenu("&File")
+               self.fileMenu.addAction(self.fileNewAction)
+               self.fileMenu.addAction(self.fileOpenAction)
+               self.fileMenu.addAction(self.fileImportAction)
+               self.fileMenu.addSeparator()
+               self.fileMenu.addAction(self.fileQuitAction)
+
+
+       def newFile(self):
+               print "Close the existing database, create a new one."
+       def openFile(self):
+               fileName = QFileDialog.getOpenFileName(self, "Open dataset", ".", "Databases (*.db)")
+               print "and then we'd open the db",fileName
+       def mergeWizard(self):
+               fileName = QFileDialog.getOpenFileName(self, "Import which dataset?", ".", "Databases (*.db)" )
+               print "and then we'd import data from",fileName
+       def quit(self):
+               # You could do cleanup, like closing/flushing the database, an "Are you sure you want to quit?"
+               # modal dialog, or saving the window layout/state.
+               qApp.quit()
+
+
+
+if __name__ == "__main__" :
+       app = QApplication([""])
+       widget = MainApp()
+       app.exec_()
+
index bbe9131294693a3af3dde1f4645be0ede548344d..1c83fb56ae8daab4f2084b92d80f599b778b721a 100644 (file)
@@ -5,8 +5,9 @@ class NetIDStep(QWidget):
        def __init__(self, parent=None):
                QWidget.__init__(self,parent)
                self.title = QLabel("<h1>Whitepages v3</h1><h2>Collecting contact information for the dorm</h2>")
-               self.instructions = QLabel("&Enter your NetID:")
+               self.instructions = QLabel("Enter your NetID:")
                self.netid = QLineEdit()
+               self.instructions.setFocusProxy(self.netid)
                self.grid = QGridLayout()
                self.grid.addWidget(self.title,0,0,1,2)
                self.grid.addWidget(self.instructions,1,0,1,1)
index 1aa15a2dfdcd293d7f243ee8d15471faa2240463..6238437912796ce6bd8e986059782f84a631ee54 100644 (file)
@@ -5,9 +5,9 @@ from netidstep import NetIDStep
 from ldapstep import LDAPStep
 from donestep import DoneStep
 
-class NewPersonWizard(QWidget):
+class NewPersonWizard(QDialog):
        def __init__(self, parent=None):
-               QWidget.__init__(self, parent)
+               QDialog.__init__(self, parent)
                self.setWindowTitle("Whitepages v3")
                self.steps = []
                self.currentstep = 0
@@ -33,10 +33,11 @@ class NewPersonWizard(QWidget):
                        QtCore.QObject.connect( s, QtCore.SIGNAL('submit()'), self.next)
                        self.layout.addWidget(s,0,0,2,2)
                        s.hide()
-               self.layout.addWidget(self.prev_button,2,0,1,1)
                self.layout.addWidget(self.next_button,2,1,1,1)
+               self.layout.addWidget(self.prev_button,2,0,1,1)
                self.setLayout(self.layout)
                self.resize(400,300)
+               self.setModal(True)
                self.show()
                self.steps[0].show()
                QtCore.QObject.connect( self.prev_button, QtCore.SIGNAL('clicked()'), self.prev)