tirilane
/
egon
Archived
1
0
Fork 0

The last before a new shot on the course/books dilemma.

This commit is contained in:
Tiril Anette Langfeldt Rødland 2008-06-15 13:28:23 +00:00
parent 90cec9c695
commit 016cdcfd54
1 changed files with 8 additions and 6 deletions

12
egon.py
View File

@ -1088,12 +1088,13 @@ class CourseDlg(QDialog):
self.bookList = QListWidget() self.bookList = QListWidget()
self.booksEdit = QPushButton(self.trUtf8("Add new book")) self.booksEdit = QPushButton(self.trUtf8("Add new book"))
self.bookMenu = QMenu() self.bookMenu = QMenu()
books = getBooksFromDB() booksDB = getBooksFromDB()
actions = [] actions = []
for book in books: for book in booksDB:
actions.append(QAction(QString(book.getTitle()), self.bookMenu)) actions.append(QAction(QString(book.getTitle()), self.bookMenu))
for action in actions: for action in actions:
self.bookMenu.addAction(action) self.bookMenu.addAction(action)
self.connect(action, SIGNAL("triggered()"), self.addNewBookToCourse)
self.booksEdit.setMenu(self.bookMenu) self.booksEdit.setMenu(self.bookMenu)
self.codeLabel.setBuddy(self.codeEdit) self.codeLabel.setBuddy(self.codeEdit)
@ -1113,8 +1114,9 @@ class CourseDlg(QDialog):
self.layout.addWidget(self.booksEdit, 4, 1) self.layout.addWidget(self.booksEdit, 4, 1)
self.setLayout(self.layout) self.setLayout(self.layout)
def addNewBookToCourse(self, book): def addNewBookToCourse(self):
pass book = getBookWithTitleFromDB(booktitle)
self.books.append(book)
class AddCourseDlg(CourseDlg): class AddCourseDlg(CourseDlg):
@ -1141,7 +1143,7 @@ class AddCourseDlg(CourseDlg):
while color in colors: while color in colors:
color = getRandomColor() color = getRandomColor()
colors.append(color) colors.append(color)
course = CourseModel(courseCode, courseTitle, courseShort, color, courseBooks) course = CourseModel(courseCode, courseTitle, courseShort, color, courseBooks)
self.close() self.close()
for book in courseBooks: for book in courseBooks:
self.addNewBookCourse(book) self.addNewBookCourse(book)