From: Drew Fisher Date: Wed, 1 Jul 2009 04:37:22 +0000 (-0700) Subject: Main app UI mockup. X-Git-Url: http://git.zarvox.org/shortlog/feed?a=commitdiff_plain;h=f5b6356b543b1607fa01b1a32e995e427e2d940e;p=wp3.git Main app UI mockup. --- diff --git a/chooseaction.py b/chooseaction.py new file mode 100644 index 0000000..fed6600 --- /dev/null +++ b/chooseaction.py @@ -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("

Select a task:

") + 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 index 0000000..c28cadf --- /dev/null +++ b/mainapp.py @@ -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("

Filler

") + 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_() + diff --git a/netidstep.py b/netidstep.py index bbe9131..1c83fb5 100644 --- a/netidstep.py +++ b/netidstep.py @@ -5,8 +5,9 @@ class NetIDStep(QWidget): def __init__(self, parent=None): QWidget.__init__(self,parent) self.title = QLabel("

Whitepages v3

Collecting contact information for the dorm

") - 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) diff --git a/newpersonwizard.py b/newpersonwizard.py index 1aa15a2..6238437 100644 --- a/newpersonwizard.py +++ b/newpersonwizard.py @@ -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)