def _reset_ui(self): window_size_x = 640 window_size_y = 480 vbox = QVBoxLayout() self.fields = dict() self.types = dict() dic = None if self.type == "Book": dic = Book.get_fields_dict() elif self.type == "Journal": dic = JournalArticle.get_fields_dict() elif self.type == "AV": dic = AVMaterial.get_fields_dict() dic.pop("DocumentID") dic.pop("active") dic.pop("requested") for i in dic: line_item = QLineEdit() self.fields[i] = line_item self.types[i] = dic[i] line_label = QLabel(str(i) + ':') line_label.setFixedWidth(60) hbox = QHBoxLayout() hbox.addWidget(line_label) hbox.addWidget(line_item) vbox.addLayout(hbox) if dic[i] == int: validator = QIntValidator() line_item.setValidator(validator) add_button_layout = QHBoxLayout() add_button_layout.addStretch() add_button(add_button_layout, "Add", self.add_document, Document.__name__, "add", 90, 25) vbox.addLayout(add_button_layout) self.setLayout(vbox) self.resize(window_size_x, window_size_y) self.setWindowTitle("Add " + self.type) self.show()
def _set_up_ui(self): window_size_x = 640 window_size_y = 480 name_label = QLabel("name") name_label.setFixedWidth(120) book_ct_label = QLabel("book_ct") book_ct_label.setFixedWidth(120) book_bestseller_ct_label = QLabel("book_bestseller_ct") book_bestseller_ct_label.setFixedWidth(120) journal_ct_label = QLabel("journal_ct") journal_ct_label.setFixedWidth(120) av_ct_label = QLabel("av_ct") av_ct_label.setFixedWidth(120) book_rt_label = QLabel("book_rt") book_rt_label.setFixedWidth(120) book_bestseller_rt_label = QLabel("book_bestseller_rt") book_bestseller_rt_label.setFixedWidth(120) journal_rt_label = QLabel("journal_rt") journal_rt_label.setFixedWidth(120) av_rt_label = QLabel("av_rt") av_rt_label.setFixedWidth(120) priority_label = QLabel("priority") priority_label.setFixedWidth(120) self.name_edit = QLineEdit() self.name_edit.setText(self.group.name) self.book_ct_edit = QLineEdit() self.book_ct_edit.setText(str(self.group.book_ct)) self.book_bestseller_ct_edit = QLineEdit() self.book_bestseller_ct_edit.setText(str( self.group.book_bestseller_ct)) self.journal_ct_edit = QLineEdit() self.journal_ct_edit.setText(str(self.group.journal_ct)) self.av_ct_edit = QLineEdit() self.av_ct_edit.setText(str(self.group.av_ct)) self.book_rt_edit = QLineEdit() self.book_rt_edit.setText(str(self.group.book_rt)) self.book_bestseller_rt_edit = QLineEdit() self.book_bestseller_rt_edit.setText(str( self.group.book_bestseller_rt)) self.journal_rt_edit = QLineEdit() self.journal_rt_edit.setText(str(self.group.journal_rt)) self.av_rt_edit = QLineEdit() self.av_rt_edit.setText(str(self.group.av_rt)) self.priority_edit = QLineEdit() self.priority_edit.setText(str(self.group.priority)) vbox = QVBoxLayout() name_layout = QHBoxLayout() name_layout.addWidget(name_label) name_layout.addWidget(self.name_edit) book_ct_layout = QHBoxLayout() book_ct_layout.addWidget(book_ct_label) book_ct_layout.addWidget(self.book_ct_edit) book_bestseller_ct_layout = QHBoxLayout() book_bestseller_ct_layout.addWidget(book_bestseller_ct_label) book_bestseller_ct_layout.addWidget(self.book_bestseller_ct_edit) journal_ct_layout = QHBoxLayout() journal_ct_layout.addWidget(journal_ct_label) journal_ct_layout.addWidget(self.journal_ct_edit) av_ct_layout = QHBoxLayout() av_ct_layout.addWidget(av_ct_label) av_ct_layout.addWidget(self.av_ct_edit) book_rt_layout = QHBoxLayout() book_rt_layout.addWidget(book_rt_label) book_rt_layout.addWidget(self.book_rt_edit) book_bestseller_rt_layout = QHBoxLayout() book_bestseller_rt_layout.addWidget(book_bestseller_rt_label) book_bestseller_rt_layout.addWidget(self.book_bestseller_rt_edit) journal_rt_layout = QHBoxLayout() journal_rt_layout.addWidget(journal_rt_label) journal_rt_layout.addWidget(self.journal_rt_edit) av_rt_layout = QHBoxLayout() av_rt_layout.addWidget(av_rt_label) av_rt_layout.addWidget(self.av_rt_edit) priority_layout = QHBoxLayout() priority_layout.addWidget(priority_label) priority_layout.addWidget(self.priority_edit) add_button_layout = QHBoxLayout() add_button_layout.addStretch() add_button(add_button_layout, "Edit", self.edit_user, Group.__name__, "edit", 90, 25) vbox.addLayout(name_layout) vbox.addLayout(book_ct_layout) vbox.addLayout(book_bestseller_ct_layout) vbox.addLayout(journal_ct_layout) vbox.addLayout(av_ct_layout) vbox.addLayout(book_rt_layout) vbox.addLayout(book_bestseller_rt_layout) vbox.addLayout(journal_rt_layout) vbox.addLayout(av_rt_layout) vbox.addLayout(priority_layout) vbox.addLayout(add_button_layout) self.setLayout(vbox) self.resize(window_size_x, window_size_y) self.setWindowTitle("Edit group" + self.group.name) self.show()
def _set_up_ui(self): window_size_x = 600 window_size_y = 600 if self.doc.active: self.book_id = QLabel("ID: " + str(self.doc.DocumentID)) else: self.book_id = QLabel("<font color='red'>ID: " + str(self.doc.DocumentID) + "</font>") vbox = QVBoxLayout() top = QHBoxLayout() top.addStretch(1) top.addWidget(self.book_id) vbox.addLayout(top) dic = type(self.doc).get_fields_dict() dic.pop("DocumentID") dic.pop("active") dic.pop("requested") self.fields = dict() for i in dic: line_item = QLabel(str(getattr(self.doc, i))) self.fields[i] = line_item line_label = QLabel(str(i) + ':') line_label.setFixedWidth(60) hbox = QHBoxLayout() hbox.addWidget(line_label) hbox.addWidget(line_item) vbox.addLayout(hbox) self.table = QTableWidget() self._set_up_table(self.table) vbox.addWidget(self.table) edit_button_layout = QHBoxLayout() edit_button_layout.addStretch() rb = add_button(edit_button_layout, "OR", self.make_or, Booking_system.__name__, "outstanding_request", 90, 25) if rb.isEnabled(): rb.setStyleSheet("background-color: red;") self.delete_button = add_button(edit_button_layout, "Delete", self.delete_document, Document.__name__, "remove", 90, 25) if not self.doc.active: self.delete_button.setVisible(False) add_button(edit_button_layout, "Queue", self.show_queue, None, None, 90, 25) add_button(edit_button_layout, "Add copy", self.add_copy, Copy.__name__, "add", 90, 25) add_button(edit_button_layout, "Check out", self.check_out, Booking_system.__name__, "check_out", 90, 25) add_button(edit_button_layout, "Edit", self.edit_document, None, None, 90, 25) vbox.addLayout(edit_button_layout) self.setLayout(vbox) self.resize(window_size_x, window_size_y) # self.setFixedWidth(window_size_x) self.setWindowTitle('Document information: ' + self.doc.title)
def _set_up_ui(self): window_size_x = 640 window_size_y = 480 name_label = QLabel("name") name_label.setFixedWidth(60) surname_label = QLabel("surname") surname_label.setFixedWidth(60) address_label = QLabel("address") address_label.setFixedWidth(60) phone_label = QLabel("phone") phone_label.setFixedWidth(60) group_label = QLabel("group") group_label.setFixedWidth(60) mail_label = QLabel("email") mail_label.setFixedWidth(60) self.name_edit = QLineEdit() self.surname_edit = QLineEdit() self.address_edit = QLineEdit() self.phone_edit = QLineEdit() self.mail_edit = QLineEdit() self.group_combo_box = QComboBox() items = [] for item in Group.get_list(12345, 1): if item.name == "Deleted": continue items.append(item.name) self.group_combo_box.addItems(items) vbox = QVBoxLayout() name_layout = QHBoxLayout() name_layout.addWidget(name_label) name_layout.addWidget(self.name_edit) surname_layout = QHBoxLayout() surname_layout.addWidget(surname_label) surname_layout.addWidget(self.surname_edit) address_layout = QHBoxLayout() address_layout.addWidget(address_label) address_layout.addWidget(self.address_edit) phone_layout = QHBoxLayout() phone_layout.addWidget(phone_label) phone_layout.addWidget(self.phone_edit) mail_layout = QHBoxLayout() mail_layout.addWidget(mail_label) mail_layout.addWidget(self.mail_edit) group_layout = QHBoxLayout() group_layout.addWidget(group_label) group_layout.addWidget(self.group_combo_box) add_button_layout = QHBoxLayout() add_button_layout.addStretch() add_button(add_button_layout, "Add", self.add_user, User.__name__, "add", 90, 25) vbox.addLayout(name_layout) vbox.addLayout(surname_layout) vbox.addLayout(address_layout) vbox.addLayout(phone_layout) vbox.addLayout(mail_layout) vbox.addLayout(group_layout) vbox.addLayout(add_button_layout) self.setLayout(vbox) self.resize(window_size_x, window_size_y) self.setWindowTitle("Add user") self.show()
def _set_up_ui(self): window_size_x = 640 window_size_y = 480 name_label = QLabel("name") name_label.setFixedWidth(60) surname_label = QLabel("surname") surname_label.setFixedWidth(60) address_label = QLabel("address") address_label.setFixedWidth(60) phone_label = QLabel("phone") phone_label.setFixedWidth(60) mail_label = QLabel("email") mail_label.setFixedWidth(60) self.name_edit = QLineEdit() self.name_edit.setText(self.user.name) self.surname_edit = QLineEdit() self.surname_edit.setText(self.user.surname) self.address_edit = QLineEdit() self.address_edit.setText(self.user.address) self.phone_edit = QLineEdit() self.phone_edit.setText(str(self.user.phone)) self.mail_edit = QLineEdit() self.mail_edit.setText(str(self.user.email)) vbox = QVBoxLayout() name_layout = QHBoxLayout() name_layout.addWidget(name_label) name_layout.addWidget(self.name_edit) surname_layout = QHBoxLayout() surname_layout.addWidget(surname_label) surname_layout.addWidget(self.surname_edit) address_layout = QHBoxLayout() address_layout.addWidget(address_label) address_layout.addWidget(self.address_edit) phone_layout = QHBoxLayout() phone_layout.addWidget(phone_label) phone_layout.addWidget(self.phone_edit) mail_layout = QHBoxLayout() mail_layout.addWidget(mail_label) mail_layout.addWidget(self.mail_edit) add_button_layout = QHBoxLayout() add_button_layout.addStretch() add_button(add_button_layout, "Edit", self.edit_user, User.__name__, "edit", 90, 25) vbox.addLayout(name_layout) vbox.addLayout(surname_layout) vbox.addLayout(address_layout) vbox.addLayout(phone_layout) vbox.addLayout(mail_layout) vbox.addLayout(add_button_layout) self.setLayout(vbox) self.resize(window_size_x, window_size_y) self.setWindowTitle("Edit user") self.show()
def _set_up_ui(self): window_size_x = 400 window_size_y = 400 self.group_id = QLabel("ID: " + str(self.group.id)) name_label = QLabel("name : ") name_label.setFixedWidth(100) book_ct_label = QLabel("book_ct : ") book_ct_label.setFixedWidth(100) book_bestseller_ct_label = QLabel("book_bestseller_ct : ") book_bestseller_ct_label.setFixedWidth(100) journal_ct_label = QLabel("journal_ct : ") journal_ct_label.setFixedWidth(100) av_ct_label = QLabel("av_ct : ") av_ct_label.setFixedWidth(100) book_rt_label = QLabel("book_rt : ") book_rt_label.setFixedWidth(100) book_bestseller_rt_label = QLabel("book_bestseller_rt : ") book_bestseller_rt_label.setFixedWidth(100) journal_rt_label = QLabel("journal_rt : ") journal_rt_label.setFixedWidth(100) av_rt_label = QLabel("av_rt : ") av_rt_label.setFixedWidth(100) priority_label = QLabel("priority : ") priority_label.setFixedWidth(100) self.name_label = QLabel() self.name_label.setText(self.group.name) self.book_ct_label = QLabel() self.book_ct_label.setText(str(self.group.book_ct)) self.book_bestseller_ct_label = QLabel() self.book_bestseller_ct_label.setText(str(self.group.book_bestseller_ct)) self.journal_ct_label = QLabel() self.journal_ct_label.setText(str(self.group.journal_ct)) self.av_ct_label = QLabel() self.av_ct_label.setText(str(self.group.av_ct)) self.book_rt_label = QLabel() self.book_rt_label.setText(str(self.group.book_rt)) self.book_bestseller_rt_label = QLabel() self.book_bestseller_rt_label.setText(str(self.group.book_bestseller_rt)) self.journal_rt_label = QLabel() self.journal_rt_label.setText(str(self.group.journal_rt)) self.av_rt_label = QLabel() self.av_rt_label.setText(str(self.group.av_rt)) self.priority_label = QLabel() self.priority_label.setText(str(self.group.priority)) vbox = QVBoxLayout() name_layout = QHBoxLayout() name_layout.addWidget(name_label) name_layout.addWidget(self.name_label) book_ct_layout = QHBoxLayout() book_ct_layout.addWidget(book_ct_label) book_ct_layout.addWidget(self.book_ct_label) book_bestseller_ct_layout = QHBoxLayout() book_bestseller_ct_layout.addWidget(book_bestseller_ct_label) book_bestseller_ct_layout.addWidget(self.book_bestseller_ct_label) journal_ct_layout = QHBoxLayout() journal_ct_layout.addWidget(journal_ct_label) journal_ct_layout.addWidget(self.journal_ct_label) av_ct_layout = QHBoxLayout() av_ct_layout.addWidget(av_ct_label) av_ct_layout.addWidget(self.av_ct_label) book_rt_layout = QHBoxLayout() book_rt_layout.addWidget(book_rt_label) book_rt_layout.addWidget(self.book_rt_label) book_bestseller_rt_layout = QHBoxLayout() book_bestseller_rt_layout.addWidget(book_bestseller_rt_label) book_bestseller_rt_layout.addWidget(self.book_bestseller_rt_label) journal_rt_layout = QHBoxLayout() journal_rt_layout.addWidget(journal_rt_label) journal_rt_layout.addWidget(self.journal_rt_label) av_rt_layout = QHBoxLayout() av_rt_layout.addWidget(av_rt_label) av_rt_layout.addWidget(self.av_rt_label) priority_layout = QHBoxLayout() priority_layout.addWidget(priority_label) priority_layout.addWidget(self.priority_label) buttons_layout = QHBoxLayout() buttons_layout.addStretch() add_button(buttons_layout, "Delete", self.delete_group, Group.__name__, "remove", 90, 25) add_button(buttons_layout, "Edit", self.edit_group, Group.__name__, "edit", 90, 25) vbox.addLayout(name_layout) vbox.addLayout(book_ct_layout) vbox.addLayout(book_bestseller_ct_layout) vbox.addLayout(journal_ct_layout) vbox.addLayout(av_ct_layout) vbox.addLayout(book_rt_layout) vbox.addLayout(book_bestseller_rt_layout) vbox.addLayout(journal_rt_layout) vbox.addLayout(av_rt_layout) vbox.addLayout(priority_layout) vbox.addLayout(buttons_layout) self.setLayout(vbox) self.resize(window_size_x, window_size_y) self.setWindowTitle(self.group.name + " information") self.show()
def _set_up_ui(self): window_size_x = 640 window_size_y = 480 vbox = QVBoxLayout() if self.copy.active: self.book_id = QLabel("ID: " + str(self.copy.CopyID)) else: self.book_id = QLabel("<font color='red'>ID: " + str(self.copy.CopyID) + "</font>") top = QHBoxLayout() top.addStretch(1) top.addWidget(self.book_id) vbox.addLayout(top) self.fields = dict() dic = {'storage': str, 'checked_out': bool} for i in dic: if dic[i] == bool: continue line_item = QLabel(str(getattr(self.copy, i))) self.fields[i] = line_item line_label = QLabel(str(i) + ':') line_label.setFixedWidth(100) hbox = QHBoxLayout() hbox.addWidget(line_label) hbox.addWidget(line_item) vbox.addLayout(hbox) self.table = QTableWidget() self._set_up_table(self.table) vbox.addWidget(self.table) edit_button = QPushButton("Copy edit") edit_button.setFixedWidth(90) edit_button.setFixedHeight(25) edit_button.clicked.connect(self.edit) return_button = QPushButton("Return copy") return_button.setFixedWidth(90) return_button.setFixedHeight(25) return_button.clicked.connect(self.return_book) renew = QPushButton("Renew") renew.setFixedWidth(90) renew.setFixedHeight(25) renew.clicked.connect(self.renew) if self.copy.active: dbtext = "Delete" else: dbtext = "Restore" add_button_layout = QHBoxLayout() add_button_layout.addStretch() self.delete_button = add_button(add_button_layout, dbtext, self.delete_book, Copy.__name__, "remove", 90, 25) add_button_layout.addWidget(edit_button) add_button_layout.addWidget(renew) add_button_layout.addWidget(return_button) vbox.addLayout(add_button_layout) self.setLayout(vbox) self.resize(window_size_x, window_size_y) self.setWindowTitle(self.copy.get_doc().title + "'s copy info") self.show()
def _set_up_ui(self): window_size_x = 700 window_size_y = 650 self.user_id = QLabel("ID: " + str(self.user.card_id)) self.address_label = QLabel("Address: " + str(self.user.address)) self.phone_label = QLabel("Phone: " + str(self.user.phone)) self.mail_label = QLabel("Email: " + str(self.user.email)) fine_button = QPushButton("Pay fine") fine_button.setFixedWidth(90) fine_button.setFixedHeight(25) fine_button.clicked.connect(self.pay_fine) history = self.app.bs.get_user_history(self.user) self.history_table = QTableWidget() self.history_table.setRowCount(len(history)) self.set_up_table(self.history_table) for i in range(0, len(history)): self.history_table.setItem( i, 0, QTableWidgetItem(str(history[i].OperationID))) self.history_table.setItem( i, 1, QTableWidgetItem(str(history[i].user.card_id))) self.history_table.setItem( i, 2, QTableWidgetItem(str(history[i].copy.CopyID))) self.history_table.setItem( i, 3, QTableWidgetItem(str(history[i].date_check_out))) self.history_table.setItem( i, 4, QTableWidgetItem(str(history[i].librarian_co))) self.history_table.setItem( i, 5, QTableWidgetItem(str(history[i].date_return))) self.history_table.setItem( i, 6, QTableWidgetItem(str(history[i].librarian_re))) self.history_table.doubleClicked.connect(self.cell_clicked_event) vbox = QVBoxLayout() id_layout = QHBoxLayout() id_layout.addStretch() id_layout.addWidget(self.user_id) address_layout = QHBoxLayout() address_layout.addWidget(self.address_label) address_layout.addStretch() phone_layout = QHBoxLayout() phone_layout.addWidget(self.phone_label) phone_layout.addStretch() mail_layout = QHBoxLayout() mail_layout.addWidget(self.mail_label) mail_layout.addStretch() last_layout = QHBoxLayout() last_layout.addStretch() self.delete_button = add_button(last_layout, "Delete", self.delete_user, User.__name__, "remove", 90, 25) add_button(last_layout, "Edit", self.edit_user, User.__name__, "edit", 90, 25) last_layout.addWidget(fine_button) history_table_group = QGroupBox() table_layout = QVBoxLayout() table_layout.addWidget(self.history_table) history_table_group.setLayout(table_layout) vbox.addLayout(id_layout) vbox.addLayout(address_layout) vbox.addLayout(phone_layout) vbox.addLayout(mail_layout) vbox.addWidget(history_table_group) vbox.addLayout(last_layout) self.setLayout(vbox) self.resize(window_size_x, window_size_y) self.setWindowTitle(self.user.name + " " + self.user.surname + " information") self.show()