tirilane
/
egon
Archived
1
0
Fork 0
This commit is contained in:
Tiril Anette Langfeldt Rødland 2008-08-10 20:22:15 +00:00
parent 0136308391
commit 7b3699273c
14 changed files with 0 additions and 432 deletions

View File

@ -1,33 +0,0 @@
#!/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)

View File

@ -1,21 +0,0 @@
#!/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)

67
book.py
View File

@ -1,67 +0,0 @@
#!/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)
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
book.pyc

Binary file not shown.

View File

@ -1,50 +0,0 @@
#!/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)

Binary file not shown.

170
db.py
View File

@ -1,170 +0,0 @@
#!/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 book import *
from course import *
def initDB():
conn = sqlite.connect('egon.db')
curs = conn.cursor()
return curs, conn
def initNewDB():
cursor, conn = initDB()
initAssignmentDB(cursor)
initReadingDB(cursor)
initScheduleDB(cursor)
initBookDB(cursor)
initCourseDB(cursor)
initAssignmentInCourse(cursor)
initReadingInCourse(cursor)
initLessonInCourse(cursor)
initCourseUsesBook(cursor)
exitDB(conn)
def initAssignmentDB(cursor):
cursor.execute('''
CREATE TABLE Assignment (
aid INTEGER PRIMARY KEY,
date TEXT,
description TEXT,
available BOOLEAN,
begun BOOLEAN,
finished BOOLEAN,
delivered BOOLEAN
)
''')
def initReadingDB(cursor):
cursor.execute('''
CREATE TABLE Reading (
rid INTEGER PRIMARY KEY,
week TEXT,
chapter TEXT,
pages TEXT
)
''')
def initScheduleDB(cursor):
cursor.execute('''
CREATE TABLE Lesson (
lid INTEGER PRIMARY KEY,
day TEXT,
fromtime TEXT,
totime TEXT,
type TEXT,
room TEXT
)
''')
def initBookDB(cursor):
cursor.execute('''
CREATE TABLE Book (
isbn TEXT PRIMARY KEY,
title TEXT,
author TEXT,
edition INTEGER
)
''')
def initCourseDB(cursor):
cursor.execute('''
CREATE TABLE Course (
code TEXT PRIMARY KEY,
title TEXT,
short TEXT
)
''')
def initAssignmentInCourse(cursor):
cursor.execute('''
CREATE TABLE assignmentInCourse (
assignment INTEGER,
course INTEGER
)
''')
def initReadingInCourse(cursor):
cursor.execute('''
CREATE TABLE readingInCourse (
reading INTEGER,
course INTEGER
)
''')
def initLessonInCourse(cursor):
cursor.execute('''
CREATE TABLE lessonInCourse (
lesson INTEGER,
course INTEGER
)
''')
def initCourseUsesBook(cursor):
cursor.execute('''
CREATE TABLE courseUsesBook (
course INTEGER,
book TEXT
)
''')
def addNewBook(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(code, title, short):
cursor, conn = initDB()
courseQuery = '''
INSERT INTO Course
VALUES (%s, %s, %s)
''' % (code, title, short)
cursor.execute(courseQuery)
exitDB(conn)
def getCourses():
cursor, conn = initDB()
courseQuery = '''
SELECT *
FROM Course
'''
cursor.execute(courseQuery)
courses = []
for row in cursor.fetchall():
courses.append(CourseModel(row[0], row[1], row[2]))
def exitDB(conn):
conn.commit()
conn.close()
#initNewDB()

BIN
db.pyc

Binary file not shown.

View File

@ -1,28 +0,0 @@
#!/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

Binary file not shown.

View File

@ -1,32 +0,0 @@
#!/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

Binary file not shown.

View File

@ -1,31 +0,0 @@
#!/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

Binary file not shown.