#!/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"))