184 lines
5.7 KiB
Python
184 lines
5.7 KiB
Python
#!/usr/bin/env python
|
|
#coding: utf-8
|
|
|
|
import os
|
|
import platform
|
|
import sys
|
|
from PyQt4.QtCore import *
|
|
from PyQt4.QtGui import *
|
|
|
|
class AssignmentTab(QWidget):
|
|
|
|
def __init__(self, parent=None):
|
|
super(AssignmentTab, self).__init__(parent)
|
|
|
|
self.assignmentsTable = QTableWidget()
|
|
|
|
self.addAssignmentButton = QPushButton("Add assignment")
|
|
self.editAssignmentButton = QPushButton("Edit assignment")
|
|
self.assignmentDoneButton = QPushButton("Done")
|
|
|
|
|
|
## self.assignments = assignmentdata.AssignmentContainer()
|
|
## self.assignmentTable = QTableWidget()
|
|
## self.setCentralWidget(self.assignmentTable)
|
|
##
|
|
vlayout = QVBoxLayout()
|
|
hlayout = QHBoxLayout()
|
|
|
|
hlayout.addWidget(self.addAssignmentButton)
|
|
hlayout.addWidget(self.editAssignmentButton)
|
|
hlayout.addWidget(self.assignmentDoneButton)
|
|
|
|
vlayout.addWidget(self.assignmentsTable)
|
|
vlayout.addLayout(hlayout)
|
|
|
|
self.setLayout(vlayout)
|
|
|
|
## def updateTable(self, current=None):
|
|
##
|
|
## self.assignmentTable.clear()
|
|
## self.assignmentTable.setRowCount(len(self.assignments))
|
|
## self.assignmentTable.setColumnCount(7)
|
|
## self.assignmentTable.setHorizontalHeaderLabels(["Date", "Course", "Description", "Available" , "Begun", "Finished", "Delivered"])
|
|
## self.assignmentTable.setAlternatingRowColors(True)
|
|
## self.assignmentTable.setEditTriggers(QTableWidget.NoEditTriggers)
|
|
## self.assignmentTable.setSelectionBehavior(QTableWidget.SelectRows)
|
|
## self.assignmentTable.setSelectionMode(QTableWidget.SingleSelection)
|
|
## selected = None
|
|
|
|
|
|
class AssignmentDlg(QDialog):
|
|
|
|
def __init__(self, parent=None):
|
|
super(AssignmentDlg, self).__init__(parent)
|
|
|
|
dateLabel = QLabel(self.trUtf8("&Date"))
|
|
courseLabel = QLabel(self.trUtf8("&Course"))
|
|
descriptionLabel = QLabel(self.trUtf8("De&scription"))
|
|
availableLabel = QLabel(self.trUtf8("&Available"))
|
|
begunLabel = QLabel(self.trUtf8("&Begun"))
|
|
finishedLabel = QLabel(self.trUtf8("&Finished"))
|
|
deliveredLabel = QLabel(self.trUtf8("De&livered"))
|
|
|
|
dateEdit = QLineEdit()
|
|
courseEdit = QLineEdit()
|
|
descriptionEdit = QLineEdit()
|
|
availableEdit = QCheckBox()
|
|
begunEdit = QCheckBox()
|
|
finishedEdit = QCheckBox()
|
|
deliveredEdit = QCheckBox()
|
|
|
|
dateLabel.setBuddy(dateEdit)
|
|
courseLabel.setBuddy(courseEdit)
|
|
descriptionLabel.setBuddy(descriptionEdit)
|
|
availableLabel.setBuddy(availableEdit)
|
|
begunLabel.setBuddy(begunEdit)
|
|
finishedLabel.setBuddy(finishedEdit)
|
|
deliveredLabel.setBuddy(deliveredEdit)
|
|
|
|
self.layout = QGridLayout()
|
|
self.layout.addWidget(dateLabel, 0, 0)
|
|
self.layout.addWidget(courseLabel, 1, 0)
|
|
self.layout.addWidget(descriptionLabel, 2, 0)
|
|
self.layout.addWidget(availableLabel, 3, 0)
|
|
self.layout.addWidget(begunLabel, 4, 0)
|
|
self.layout.addWidget(finishedLabel, 5, 0)
|
|
self.layout.addWidget(deliveredLabel, 6, 0)
|
|
self.layout.addWidget(dateEdit, 0, 1)
|
|
self.layout.addWidget(courseEdit, 1, 1)
|
|
self.layout.addWidget(descriptionEdit, 2, 1)
|
|
self.layout.addWidget(availableEdit, 3, 1)
|
|
self.layout.addWidget(begunEdit, 4, 1)
|
|
self.layout.addWidget(finishedEdit, 5, 1)
|
|
self.layout.addWidget(deliveredEdit, 6, 1)
|
|
self.setLayout(self.layout)
|
|
|
|
|
|
class AddAssignmentDlg(AssignmentDlg):
|
|
|
|
def __init__(self, parent=None):
|
|
super(AddAssignmentDlg, self).__init__(parent)
|
|
|
|
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
|
|
|
|
self.layout.addWidget(buttonBox, 7, 0, 1, 2)
|
|
|
|
self.connect(buttonBox, SIGNAL("accepted()"), self, SLOT("accept()"))
|
|
self.connect(buttonBox, SIGNAL("rejected()"), self, SLOT("reject()"))
|
|
|
|
self.setWindowTitle(self.trUtf8("Add new assignment"))
|
|
|
|
|
|
class EditAssignmentDlg(AssignmentDlg):
|
|
|
|
def __init__(self, parent=None):
|
|
super(EditAssignmentDlg, self).__init__(parent)
|
|
self.setAttribute(Qt.WA_DeleteOnClose)
|
|
|
|
buttonBox = QDialogButtonBox(QDialogButtonBox.Apply|QDialogButtonBox.Close)
|
|
|
|
self.layout.addWidget(buttonBox, 7, 0, 1, 2)
|
|
|
|
self.connect(buttonBox.button(QDialogButtonBox.Apply), SIGNAL("clicked()"), self.apply)
|
|
self.connect(buttonBox, SIGNAL("rejected()"), self, SLOT("reject()"))
|
|
|
|
self.setWindowTitle(self.trUtf8("Edit assignment"))
|
|
|
|
def apply(self):
|
|
pass
|
|
|
|
|
|
class AssignmentModel():
|
|
|
|
date = ""
|
|
course = ""
|
|
description = ""
|
|
available = False
|
|
begun = False
|
|
finished = False
|
|
delivered = False
|
|
|
|
def setDate(self, date):
|
|
self.date = date
|
|
|
|
def getDate(self):
|
|
return self.date
|
|
|
|
def setCourse(self, course):
|
|
self.course = course
|
|
|
|
def getCourse(self):
|
|
return self.course
|
|
|
|
def setDescription(self, description):
|
|
self.description = description
|
|
|
|
def getDescription(self):
|
|
return self.description
|
|
|
|
def setAvailable(self, available):
|
|
self.available = available
|
|
|
|
def getAvailable(self):
|
|
return self.available
|
|
|
|
def setBegun(self, begun):
|
|
self.begun = begun
|
|
|
|
def getBegun(self):
|
|
return self.begun
|
|
|
|
def setFinished(self, finished):
|
|
self.finished = finished
|
|
|
|
def getFinished(self):
|
|
return self.finished
|
|
|
|
def setDelivered(self, delivered):
|
|
self.delivered = delivered
|
|
|
|
def getDelivered(self):
|
|
return self.delivered
|
|
|