The last before a new shot on the course/books dilemma.
This commit is contained in:
parent
90cec9c695
commit
016cdcfd54
14
egon.py
14
egon.py
@ -1088,12 +1088,13 @@ class CourseDlg(QDialog):
|
||||
self.bookList = QListWidget()
|
||||
self.booksEdit = QPushButton(self.trUtf8("Add new book"))
|
||||
self.bookMenu = QMenu()
|
||||
books = getBooksFromDB()
|
||||
booksDB = getBooksFromDB()
|
||||
actions = []
|
||||
for book in books:
|
||||
for book in booksDB:
|
||||
actions.append(QAction(QString(book.getTitle()), self.bookMenu))
|
||||
for action in actions:
|
||||
self.bookMenu.addAction(action)
|
||||
self.connect(action, SIGNAL("triggered()"), self.addNewBookToCourse)
|
||||
self.booksEdit.setMenu(self.bookMenu)
|
||||
|
||||
self.codeLabel.setBuddy(self.codeEdit)
|
||||
@ -1113,8 +1114,9 @@ class CourseDlg(QDialog):
|
||||
self.layout.addWidget(self.booksEdit, 4, 1)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def addNewBookToCourse(self, book):
|
||||
pass
|
||||
def addNewBookToCourse(self):
|
||||
book = getBookWithTitleFromDB(booktitle)
|
||||
self.books.append(book)
|
||||
|
||||
|
||||
class AddCourseDlg(CourseDlg):
|
||||
@ -1141,7 +1143,7 @@ class AddCourseDlg(CourseDlg):
|
||||
while color in colors:
|
||||
color = getRandomColor()
|
||||
colors.append(color)
|
||||
course = CourseModel(courseCode, courseTitle, courseShort, color, courseBooks)
|
||||
course = CourseModel(courseCode, courseTitle, courseShort, color, courseBooks)
|
||||
self.close()
|
||||
for book in courseBooks:
|
||||
self.addNewBookCourse(book)
|
||||
@ -1165,7 +1167,7 @@ class CourseModel():
|
||||
self.title = title
|
||||
self.short = short
|
||||
self.setFull(code, title)
|
||||
self.color = color
|
||||
self.color = color
|
||||
self.books = books
|
||||
|
||||
def getCode(self):
|
||||
|
Reference in New Issue
Block a user