Forgot to add trunk.
This commit is contained in:
commit
919b7c8b12
33
AssignmentTab.pyw
Normal file
33
AssignmentTab.pyw
Normal file
@ -0,0 +1,33 @@
|
||||
#!/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)
|
||||
|
||||
assignmentsTable = QTableWidget()
|
||||
|
||||
addAssignmentButton = QPushButton("Add assignment")
|
||||
editAssignmentButton = QPushButton("Edit assignment")
|
||||
assignmentDoneButton = QPushButton("Done")
|
||||
|
||||
vlayout = QVBoxLayout()
|
||||
hlayout = QHBoxLayout()
|
||||
|
||||
hlayout.addWidget(addAssignmentButton)
|
||||
hlayout.addWidget(editAssignmentButton)
|
||||
hlayout.addWidget(assignmentDoneButton)
|
||||
|
||||
vlayout.addWidget(assignmentsTable)
|
||||
vlayout.addLayout(hlayout)
|
||||
|
||||
self.setLayout(vlayout)
|
||||
|
21
CalendarTab.pyw
Normal file
21
CalendarTab.pyw
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
|
||||
class CalendarTab(QWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
||||
super(CalendarTab, self).__init__(parent)
|
||||
|
||||
calendar = QCalendarWidget()
|
||||
|
||||
layout = QVBoxLayout()
|
||||
layout.addWidget(calendar)
|
||||
self.setLayout(layout)
|
||||
|
34
ReadingTab.pyw
Normal file
34
ReadingTab.pyw
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
|
||||
class ReadingTab(QWidget):
|
||||
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
||||
super(ReadingTab, self).__init__(parent)
|
||||
|
||||
readingTable = QTableWidget()
|
||||
|
||||
addReadingButton = QPushButton("Add pages to read")
|
||||
editReadingButton = QPushButton("Edit pages")
|
||||
readingDoneButton = QPushButton("Done")
|
||||
|
||||
vlayout = QVBoxLayout()
|
||||
hlayout = QHBoxLayout()
|
||||
|
||||
hlayout.addWidget(addReadingButton)
|
||||
hlayout.addWidget(editReadingButton)
|
||||
hlayout.addWidget(readingDoneButton)
|
||||
|
||||
vlayout.addWidget(readingTable)
|
||||
vlayout.addLayout(hlayout)
|
||||
|
||||
self.setLayout(vlayout)
|
||||
|
30
ScheduleTab.pyw
Normal file
30
ScheduleTab.pyw
Normal file
@ -0,0 +1,30 @@
|
||||
#!/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)
|
||||
|
||||
scheduleTable = QTableWidget()
|
||||
|
||||
addScheduleButton = QPushButton("Add lesson")
|
||||
editScheduleButton = QPushButton("Edit lesson")
|
||||
|
||||
vlayout = QVBoxLayout()
|
||||
hlayout = QHBoxLayout()
|
||||
|
||||
hlayout.addWidget(addScheduleButton)
|
||||
hlayout.addWidget(editScheduleButton)
|
||||
|
||||
vlayout.addWidget(scheduleTable)
|
||||
vlayout.addLayout(hlayout)
|
||||
|
||||
self.setLayout(vlayout)
|
16
actions.py
Normal file
16
actions.py
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
from assignmentDlg import *
|
||||
from readingDlg import *
|
||||
from scheduleDlg import *
|
||||
|
BIN
actions.pyc
Normal file
BIN
actions.pyc
Normal file
Binary file not shown.
25
addAssignmentDlg.py
Normal file
25
addAssignmentDlg.py
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from assignmentDlg import *
|
||||
|
||||
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"))
|
||||
|
BIN
addAssignmentDlg.pyc
Normal file
BIN
addAssignmentDlg.pyc
Normal file
Binary file not shown.
24
addBookDlg.py
Normal file
24
addBookDlg.py
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from bookDlg import *
|
||||
|
||||
class AddBookDlg(BookDlg):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(AddBookDlg, self).__init__(parent)
|
||||
|
||||
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
|
||||
|
||||
self.layout.addWidget(buttonBox, 5, 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 book"))
|
||||
|
BIN
addBookDlg.pyc
Normal file
BIN
addBookDlg.pyc
Normal file
Binary file not shown.
20
addCourseDlg.py
Normal file
20
addCourseDlg.py
Normal file
@ -0,0 +1,20 @@
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from courseDlg import *
|
||||
|
||||
class AddCourseDlg(CourseDlg):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(AddCourseDlg, self).__init__(parent)
|
||||
|
||||
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
|
||||
|
||||
self.layout.addWidget(buttonBox, 3, 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 course"))
|
||||
|
BIN
addCourseDlg.pyc
Normal file
BIN
addCourseDlg.pyc
Normal file
Binary file not shown.
27
addReadingDlg.py
Normal file
27
addReadingDlg.py
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
from readingDlg import *
|
||||
|
||||
class AddReadingDlg(ReadingDlg):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(AddReadingDlg, 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 reading"))
|
BIN
addReadingDlg.pyc
Normal file
BIN
addReadingDlg.pyc
Normal file
Binary file not shown.
28
addScheduleDlg.py
Normal file
28
addScheduleDlg.py
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
from scheduleDlg import *
|
||||
|
||||
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"))
|
||||
|
BIN
addScheduleDlg.pyc
Normal file
BIN
addScheduleDlg.pyc
Normal file
Binary file not shown.
50
assignment.py
Normal file
50
assignment.py
Normal file
@ -0,0 +1,50 @@
|
||||
#!/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
|
||||
|
||||
|
BIN
assignment.pyc
Normal file
BIN
assignment.pyc
Normal file
Binary file not shown.
61
assignmentDlg.py
Normal file
61
assignmentDlg.py
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
from readingDlg import *
|
||||
from actions import *
|
||||
|
||||
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)
|
||||
|
BIN
assignmentDlg.pyc
Normal file
BIN
assignmentDlg.pyc
Normal file
Binary file not shown.
66
assignmentModel.py
Normal file
66
assignmentModel.py
Normal file
@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
from scheduleDlg import *
|
||||
|
||||
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
|
||||
|
BIN
assignmentModel.pyc
Normal file
BIN
assignmentModel.pyc
Normal file
Binary file not shown.
50
bookDlg.py
Normal file
50
bookDlg.py
Normal file
@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
##from db import *
|
||||
|
||||
class BookDlg(QDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(BookDlg, self).__init__(parent)
|
||||
|
||||
titleLabel = QLabel(self.trUtf8("&Title"))
|
||||
authorLabel = QLabel(self.trUtf8("&Author"))
|
||||
editionLabel = QLabel(self.trUtf8("&Edition"))
|
||||
isbnLabel = QLabel(self.trUtf8("&ISBN"))
|
||||
courseLabel = QLabel(self.trUtf8("&Course"))
|
||||
|
||||
titleEdit = QLineEdit()
|
||||
authorEdit = QLineEdit()
|
||||
editionEdit = QSpinBox()
|
||||
editionEdit.setRange(1, 50)
|
||||
isbnEdit = QLineEdit()
|
||||
courseEdit = QComboBox()
|
||||
|
||||
titleLabel.setBuddy(titleEdit)
|
||||
authorLabel.setBuddy(authorEdit)
|
||||
editionLabel.setBuddy(editionEdit)
|
||||
isbnLabel.setBuddy(isbnEdit)
|
||||
courseLabel.setBuddy(courseEdit)
|
||||
|
||||
self.layout = QGridLayout()
|
||||
self.layout.addWidget(titleLabel, 0, 0)
|
||||
self.layout.addWidget(authorLabel, 1, 0)
|
||||
self.layout.addWidget(editionLabel, 2, 0)
|
||||
self.layout.addWidget(isbnLabel, 3, 0)
|
||||
self.layout.addWidget(courseLabel, 4, 0)
|
||||
self.layout.addWidget(titleEdit, 0, 1)
|
||||
self.layout.addWidget(authorEdit, 1, 1)
|
||||
self.layout.addWidget(editionEdit, 2, 1)
|
||||
self.layout.addWidget(isbnEdit, 3, 1)
|
||||
self.layout.addWidget(courseEdit, 4, 1)
|
||||
self.setLayout(self.layout)
|
BIN
bookDlg.pyc
Normal file
BIN
bookDlg.pyc
Normal file
Binary file not shown.
20
calendar.py
Normal file
20
calendar.py
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
|
||||
class CalendarTab(QWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(CalendarTab, self).__init__(parent)
|
||||
|
||||
calendar = QCalendarWidget()
|
||||
|
||||
layout = QVBoxLayout()
|
||||
layout.addWidget(calendar)
|
||||
self.setLayout(layout)
|
||||
|
BIN
calendar.pyc
Normal file
BIN
calendar.pyc
Normal file
Binary file not shown.
39
courseDlg.py
Normal file
39
courseDlg.py
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
##from db import *
|
||||
|
||||
class CourseDlg(QDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(CourseDlg, self).__init__(parent)
|
||||
|
||||
codeLabel = QLabel(self.trUtf8("&Code"))
|
||||
titleLabel = QLabel(self.trUtf8("&Title"))
|
||||
shortLabel = QLabel(self.trUtf8("&Short form"))
|
||||
|
||||
codeEdit = QLineEdit()
|
||||
titleEdit = QLineEdit()
|
||||
shortEdit = QLineEdit()
|
||||
|
||||
codeLabel.setBuddy(codeEdit)
|
||||
titleLabel.setBuddy(titleEdit)
|
||||
shortLabel.setBuddy(shortEdit)
|
||||
|
||||
self.layout = QGridLayout()
|
||||
self.layout.addWidget(codeLabel, 0, 0)
|
||||
self.layout.addWidget(titleLabel, 1, 0)
|
||||
self.layout.addWidget(shortLabel, 2, 0)
|
||||
self.layout.addWidget(codeEdit, 0, 1)
|
||||
self.layout.addWidget(titleEdit, 1, 1)
|
||||
self.layout.addWidget(shortEdit, 2, 1)
|
||||
self.setLayout(self.layout)
|
BIN
courseDlg.pyc
Normal file
BIN
courseDlg.pyc
Normal file
Binary file not shown.
151
db.py
Normal file
151
db.py
Normal file
@ -0,0 +1,151 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from pysqlite2 import dbapi2 as sqlite
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
##from PyQt4.QtSql import *
|
||||
from main import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
from actions import *
|
||||
|
||||
def initDB(self):
|
||||
conn = sqlite.connect('scheduler.db')
|
||||
curs = conn.cursor()
|
||||
return curs, conn
|
||||
|
||||
def initNewDB(self):
|
||||
cursor, conn = initDB()
|
||||
initAssignmentDB(cursor)
|
||||
initReadingDB(cursor)
|
||||
initScheduleDB(cursor)
|
||||
initBookDB(cursor)
|
||||
initCourseDB(cursor)
|
||||
exitDB(conn)
|
||||
|
||||
def initAssignmentDB(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE Assignment (
|
||||
aid INTEGER PRIMARY KEY,
|
||||
date TEXT,
|
||||
description TEXT,
|
||||
available BOOLEAN,
|
||||
begun BOOLEAN,
|
||||
finished BOOLEAN,
|
||||
delivered BOOLEAN
|
||||
)
|
||||
''')
|
||||
|
||||
def initReadingDB(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE Reading (
|
||||
rid INTEGER PRIMARY KEY,
|
||||
week TEXT,
|
||||
chapter TEXT,
|
||||
pages TEXT
|
||||
)
|
||||
''')
|
||||
|
||||
def initScheduleDB(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE Lesson (
|
||||
lid INTEGER PRIMARY KEY,
|
||||
day TEXT,
|
||||
fromtime TEXT,
|
||||
totime TEXT,
|
||||
type TEXT,
|
||||
room TEXT
|
||||
)
|
||||
''')
|
||||
|
||||
def initBookDB(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE Book (
|
||||
isbn TEXT PRIMARY KEY,
|
||||
title TEXT,
|
||||
author TEXT,
|
||||
edition INTEGER
|
||||
)
|
||||
''')
|
||||
|
||||
def initCourseDB(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE Course (
|
||||
code TEXT PRIMARY KEY,
|
||||
title TEXT,
|
||||
short TEXT
|
||||
)
|
||||
''')
|
||||
|
||||
def initAssignmentInCourse(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE assignmentInCourse (
|
||||
assignment INTEGER,
|
||||
course INTEGER
|
||||
)
|
||||
''')
|
||||
|
||||
def initReadingInCourse(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE readingInCourse (
|
||||
reading INTEGER,
|
||||
course INTEGER
|
||||
)
|
||||
''')
|
||||
|
||||
def initLessonInCourse(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE lessonInCourse (
|
||||
lesson INTEGER,
|
||||
course INTEGER
|
||||
)
|
||||
''')
|
||||
|
||||
def initCourseUsesBook(self, cursor):
|
||||
cursor.execute('''
|
||||
CREATE TABLE courseUsesBook (
|
||||
course INTEGER,
|
||||
book TEXT
|
||||
)
|
||||
''')
|
||||
|
||||
def addNewBook(self, isbn, title, author, edition, course):
|
||||
cursor, conn = initDB()
|
||||
|
||||
bookQuery = '''
|
||||
INSERT INTO Book
|
||||
VALUES (%s, %s, %s, %i)
|
||||
''' % (isbn, title, author, edition)
|
||||
courseUsesBookQuery = '''
|
||||
INSERT INTO courseUsesBook
|
||||
VALUES (%i, %s)
|
||||
''' % (course, isbn)
|
||||
|
||||
cursor.execute(bookQuery)
|
||||
cursor.execute(courseUsesBookQuery)
|
||||
|
||||
exitDB(conn)
|
||||
|
||||
def addNewCourse(self, code, title, short):
|
||||
cursor, conn = initDB()
|
||||
|
||||
courseQuery = '''
|
||||
INSERT INTO Course
|
||||
VALUES (%s, %s, %s)
|
||||
''' % (code, title, short)
|
||||
|
||||
cursor.execute(courseQuery)
|
||||
|
||||
exitDB(conn)
|
||||
|
||||
def exitDB(self, conn):
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
initNewDB()
|
28
editAssignmentDlg.py
Normal file
28
editAssignmentDlg.py
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from assignmentDlg import *
|
||||
|
||||
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
|
BIN
editAssignmentDlg.pyc
Normal file
BIN
editAssignmentDlg.pyc
Normal file
Binary file not shown.
32
editReadingDlg.py
Normal file
32
editReadingDlg.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
from readingDlg import *
|
||||
|
||||
class EditReadingDlg(ReadingDlg):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(EditReadingDlg, self).__init__(parent)
|
||||
self.setAttribute(Qt.WA_DeleteOnClose)
|
||||
|
||||
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 reading"))
|
||||
|
||||
def apply(self):
|
||||
pass
|
||||
|
BIN
editReadingDlg.pyc
Normal file
BIN
editReadingDlg.pyc
Normal file
Binary file not shown.
31
editScheduleDlg.py
Normal file
31
editScheduleDlg.py
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
#coding: utf-8
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from assignment import *
|
||||
from reading import *
|
||||
from schedule import *
|
||||
from calendar import *
|
||||
from scheduleDlg import *
|
||||
|
||||
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
|
||||
|
BIN
editScheduleDlg.pyc
Normal file
BIN
editScheduleDlg.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user