159 lines
4.6 KiB
Python
159 lines
4.6 KiB
Python
|
#!/usr/bin/env python
|
||
|
#coding: utf-8
|
||
|
|
||
|
import os
|
||
|
import platform
|
||
|
import sys
|
||
|
from PyQt4.QtCore import *
|
||
|
from PyQt4.QtGui import *
|
||
|
|
||
|
class ScheduleTab(QWidget):
|
||
|
|
||
|
def __init__(self, parent=None):
|
||
|
super(ScheduleTab, self).__init__(parent)
|
||
|
|
||
|
self.scheduleTable = QTableWidget()
|
||
|
|
||
|
self.addScheduleButton = QPushButton("Add lesson")
|
||
|
self.editScheduleButton = QPushButton("Edit lesson")
|
||
|
|
||
|
vlayout = QVBoxLayout()
|
||
|
hlayout = QHBoxLayout()
|
||
|
|
||
|
hlayout.addWidget(self.addScheduleButton)
|
||
|
hlayout.addWidget(self.editScheduleButton)
|
||
|
|
||
|
vlayout.addWidget(self.scheduleTable)
|
||
|
vlayout.addLayout(hlayout)
|
||
|
|
||
|
self.setLayout(vlayout)
|
||
|
|
||
|
|
||
|
class ScheduleDlg(QDialog):
|
||
|
|
||
|
def __init__(self, parent=None):
|
||
|
super(ScheduleDlg, self).__init__(parent)
|
||
|
|
||
|
dayLabel = QLabel(self.trUtf8("&Day"))
|
||
|
fromLabel = QLabel(self.trUtf8("&From"))
|
||
|
toLabel = QLabel(self.trUtf8("&To"))
|
||
|
courseLabel = QLabel(self.trUtf8("&Course"))
|
||
|
typeLabel = QLabel(self.trUtf8("Ty&pe"))
|
||
|
roomLabel = QLabel(self.trUtf8("&Room"))
|
||
|
|
||
|
dayEdit = QComboBox()
|
||
|
days = [self.trUtf8("Monday"), self.trUtf8("Tuesday"), self.trUtf8("Wednesday"), self.trUtf8("Thursday"), self.trUtf8("Friday")]
|
||
|
dayEdit.addItems(days)
|
||
|
fromEdit = QSpinBox()
|
||
|
fromEdit.setRange(08.15, 18.15)
|
||
|
fromEdit.setSingleStep(01.00)
|
||
|
toEdit = QSpinBox()
|
||
|
toEdit.setRange(09.00, 19.00)
|
||
|
toEdit.setSingleStep(01.00)
|
||
|
courseEdit = QComboBox()
|
||
|
typeEdit = QComboBox()
|
||
|
types = [self.trUtf8("Lecture"), self.trUtf8("Assignment lecture"), self.trUtf8("Assignment help"), self.trUtf8("Assignment"), self.trUtf8("Lab"), self.trUtf8("Seminar"), self.trUtf8("Other")]
|
||
|
typeEdit.addItems(types)
|
||
|
roomEdit = QLineEdit()
|
||
|
|
||
|
dayLabel.setBuddy(dayEdit)
|
||
|
fromLabel.setBuddy(fromEdit)
|
||
|
toLabel.setBuddy(toEdit)
|
||
|
courseLabel.setBuddy(courseEdit)
|
||
|
typeLabel.setBuddy(typeEdit)
|
||
|
roomLabel.setBuddy(roomEdit)
|
||
|
|
||
|
self.layout = QGridLayout()
|
||
|
self.layout.addWidget(dayLabel, 0, 0)
|
||
|
self.layout.addWidget(fromLabel, 1, 0)
|
||
|
self.layout.addWidget(toLabel, 2, 0)
|
||
|
self.layout.addWidget(courseLabel, 3, 0)
|
||
|
self.layout.addWidget(typeLabel, 4, 0)
|
||
|
self.layout.addWidget(roomLabel, 5, 0)
|
||
|
self.layout.addWidget(dayEdit, 0, 1)
|
||
|
self.layout.addWidget(fromEdit, 1, 1)
|
||
|
self.layout.addWidget(toEdit, 2, 1)
|
||
|
self.layout.addWidget(courseEdit, 3, 1)
|
||
|
self.layout.addWidget(typeEdit, 4, 1)
|
||
|
self.layout.addWidget(roomEdit, 5, 1)
|
||
|
self.setLayout(self.layout)
|
||
|
|
||
|
|
||
|
class AddScheduleDlg(ScheduleDlg):
|
||
|
|
||
|
def __init__(self, parent=None):
|
||
|
super(AddScheduleDlg, self).__init__(parent)
|
||
|
|
||
|
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
|
||
|
|
||
|
self.layout.addWidget(buttonBox, 6, 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 lesson"))
|
||
|
|
||
|
|
||
|
class EditScheduleDlg(ScheduleDlg):
|
||
|
|
||
|
def __init__(self, parent=None):
|
||
|
super(EditScheduleDlg, self).__init__(parent)
|
||
|
|
||
|
buttonBox = QDialogButtonBox(QDialogButtonBox.Apply|QDialogButtonBox.Close)
|
||
|
|
||
|
self.layout.addWidget(buttonBox, 6, 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 lesson"))
|
||
|
|
||
|
def apply(self):
|
||
|
pass
|
||
|
|
||
|
|
||
|
class ScheduleModel():
|
||
|
|
||
|
day = ""
|
||
|
fromTime = ""
|
||
|
toTime = ""
|
||
|
course = ""
|
||
|
type = ""
|
||
|
room = ""
|
||
|
|
||
|
def setDay(self, day):
|
||
|
self.day = day
|
||
|
|
||
|
def getDay(self):
|
||
|
return self.day
|
||
|
|
||
|
def setFromTime(self, fromTime):
|
||
|
self.fromTime = fromTime
|
||
|
|
||
|
def getFromTime(self):
|
||
|
return self.fromTime
|
||
|
|
||
|
def setToTime(self, toTime):
|
||
|
self.toTime = toTime
|
||
|
|
||
|
def getToTime(self):
|
||
|
return self.toTime
|
||
|
|
||
|
def setCourse(self, course):
|
||
|
self.course = course
|
||
|
|
||
|
def getCourse(self):
|
||
|
return self.course
|
||
|
|
||
|
def setType(self, type):
|
||
|
self.type = type
|
||
|
|
||
|
def getType(self):
|
||
|
return self.type
|
||
|
|
||
|
def setRoom(self, room):
|
||
|
self.room = room
|
||
|
|
||
|
def getRoom(self):
|
||
|
return self.room
|