def __init__(self, parent=None): super(BrowserLocals, self).__init__(parent) self.resize(600, 400) self.setWindowTitle('Locais') self.toto = '' masterLayout = QVBoxLayout(self) self.grid = QTableWidget() self.grid.setSelectionBehavior(QTableWidget.SelectRows) self.grid.setSelectionMode(QTableWidget.SingleSelection) self.grid.setEditTriggers(QTableWidget.NoEditTriggers) self.grid.verticalHeader().setDefaultSectionSize(20) self.grid.verticalHeader().setVisible(False) self.grid.itemDoubleClicked.connect(self.valid_click) masterLayout.addWidget(self.grid) self.fromEdt = QLineEdit() self.toEdt = QLineEdit() changeBtn = QPushButton('Altera') changeBtn.clicked.connect(self.change_locals_click) exit_btn = QPushButton('Sair') exit_btn.clicked.connect(self.exit_click) valid_btn = QPushButton('Valida') valid_btn.clicked.connect(self.valid_click) masterLayout.addLayout( qc.addHLayout([ 'Da cota:', self.fromEdt, 'Para a cota:', self.toEdt, changeBtn ])) masterLayout.addLayout(qc.addHLayout([valid_btn, exit_btn])) self.grid_refresh()
def __init__(self, parent=None): super(BrowserTags, self).__init__(parent) # self.setWindowFlags(Qt.FramelessWindowHint) #|Qt.WindowStaysOnTopHint) #|Qt.WindowTitleHint) self.flag = False self.resize(1024, 768) self.setWindowTitle('Etiquetas') masterLayout = QVBoxLayout(self) self.tag_list = [] self.tag_id = -1 deselect_tags_Btn = QPushButton('Des-seleciona') deselect_tags_Btn.clicked.connect(self.deselect_click) clean_tranf_Btn = QPushButton('Limpa Transferidas') clean_tranf_Btn.clicked.connect(self.clean_transfer) add_tag_Btn = QPushButton('Adiciona Tag') add_tag_Btn.clicked.connect(self.add_new_tag) masterLayout.addLayout( qc.addHLayout( [deselect_tags_Btn, clean_tranf_Btn, add_tag_Btn, True])) self.searchEdit = QLineEdit() self.toto = () self.searchEdit.textChanged.connect(self.tag_search_changed) masterLayout.addWidget(self.searchEdit) self.grid = QTableWidget() self.grid.setEditTriggers(QTableWidget.NoEditTriggers) self.grid.verticalHeader().setDefaultSectionSize(20) self.grid.verticalHeader().setVisible(False) self.grid.itemDoubleClicked.connect(self.transfer_click) self.lastTags_grid = QTableWidget() self.lastTags_grid.setEditTriggers(QTableWidget.NoEditTriggers) self.lastTags_grid.verticalHeader().setDefaultSectionSize(20) self.lastTags_grid.verticalHeader().setVisible(False) self.lastTags_grid.itemDoubleClicked.connect(self.transfer_last_click) self.current_tags = QTextBrowser() self.current_tags.setMaximumHeight(60) self.current_tags.setMinimumHeight(60) masterLayout.addLayout(qc.addHLayout([self.grid, self.lastTags_grid])) masterLayout.addWidget(self.current_tags) exit_btn = QPushButton('Sair') exit_btn.clicked.connect(self.exit_click) valid_btn = QPushButton('Substitui') valid_btn.clicked.connect(self.valid_click) add_btn = QPushButton('Adiciona') add_btn.clicked.connect(self.add_click) masterLayout.addLayout(qc.addHLayout([valid_btn, add_btn, exit_btn])) self.tag_refresh() self.last_tag_refresh()
def __init__(self, data_dict, parent=None): super(Properties, self).__init__(parent) self.resize(400, 600) self.setWindowTitle('Properties') self.ctrl_list = [ 'QLineEdit', 'QLabel', 'QPushButton', 'QTableWidget', 'QToolButton', 'QComboBox', 'QDateEdit', 'QCheckBox', 'QSpinBox', 'QPlainTextEdit', 'QDoubleSpinBox', 'QListWidget', 'QCalendarWidget', 'QTimeEdit', 'QDateTimeEdit', 'QCommandLinkButton', 'QTreeWidget', 'QVBoxLayout', 'QHBoxLayout', 'addStretch' ] self.ret = {'responce': False} self.data_dict = data_dict masterLayout = QVBoxLayout(self) self.controlCbx = QComboBox() self.controlCbx.addItems(self.ctrl_list) self.labelEdt = QLineEdit() self.controlNameEdt = QLineEdit() self.addSelf = QCheckBox('Add self.') self.addSelf.setCheckState(gl.ADD_SELF) self.layoutCbx = QComboBox() self.layoutCbx.addItems(gl.layouts_list) self.maxWight = QLineEdit() self.maxHeight = QLineEdit() self.minWight = QLineEdit() self.minHeight = QLineEdit() self.onClickEdt = QLineEdit() masterLayout.addLayout(qc.addHLayout(['Widget', self.controlCbx])) masterLayout.addLayout(qc.addHLayout(['Label', self.labelEdt])) masterLayout.addLayout( qc.addHLayout(['Name', self.controlNameEdt, self.addSelf])) masterLayout.addLayout(qc.addHLayout(['Layout', self.layoutCbx])) masterLayout.addLayout( qc.addHLayout( ['Width', 'max', self.maxWight, 'min', self.minWight])) masterLayout.addLayout( qc.addHLayout( ['Height', 'max', self.maxHeight, 'min', self.minHeight])) masterLayout.addLayout( qc.addHLayout(['on click button', self.onClickEdt])) masterLayout.addStretch() advanceBtn = QPushButton('Advance') advanceBtn.clicked.connect(self.advance_click) masterLayout.addLayout(qc.addHLayout([advanceBtn, True])) okBtn = QPushButton('O.K.') okBtn.clicked.connect(self.ok_click) cancelBtn = QPushButton('Sair') cancelBtn.clicked.connect(self.cancel_btn_click) masterLayout.addLayout(qc.addHLayout([okBtn, cancelBtn])) if not self.data_dict['new']: self.refresh_form() else: self.set_values()
def __init__(self, pub_id, parent=None): super(EditSpecialTags, self).__init__(parent) self.resize(480, 360) self.setWindowTitle('Edita Etiquetas Especiais') self.tags_list = '' # tags_txt.split(',') self.pub_id = pub_id self.tags_level = 1 # self.tags_data = tags_data masterLayout = QVBoxLayout(self) self.tags_string = '' self.flag = False # self.toto = () self.specialTagsGrid = QTableWidget() self.specialTagsGrid.setSelectionBehavior(QTableWidget.SelectRows) self.specialTagsGrid.setSelectionMode(QTableWidget.SingleSelection) self.specialTagsGrid.setEditTriggers(QTableWidget.AllEditTriggers) self.specialTagsGrid.verticalHeader().setDefaultSectionSize(20) self.specialTagsGrid.setAlternatingRowColors(True) self.specialTagsGrid.verticalHeader().setVisible(False) masterLayout.addWidget(self.specialTagsGrid) exit_btn = QPushButton('Sair') exit_btn.clicked.connect(self.exit_click) valid_btn = QPushButton('Valida') valid_btn.clicked.connect(self.valid_click) masterLayout.addLayout(qc.addHLayout([valid_btn, exit_btn])) self.tag_refresh()
def __init__(self, title, html, size=(400, 300), confirm=(False, ''), parent=None): """ mostra uma variavel contendo html num browser """ super(BrowserView, self).__init__(parent) self.setWindowFlags(Qt.Dialog | Qt.WindowTitleHint) self.setStyleSheet("background-color:#fffff0;") self.resize(size[0], size[1]) self.ret = 0 self.setWindowTitle(title) self.browserWebView = QTextEdit(self) layout = QVBoxLayout() layout.addWidget(self.browserWebView) self.closeBtn = QPushButton('Fecha') self.exitBtn = QPushButton('Cancelar') self.confirmChk = QCheckBox(confirm[1]) if confirm[0]: layout.addWidget(self.confirmChk) self.closeBtn.setEnabled(False) self.confirmChk.stateChanged.connect(self.confirm_state_changed) layout.addLayout(qlib.addHLayout([self.closeBtn, self.exitBtn])) self.exitBtn.clicked.connect(self.close_click) else: self.closeBtn.setEnabled(True) self.closeBtn.setFocus() layout.addWidget(self.closeBtn) self.closeBtn.clicked.connect(self.close_click) self.setLayout(layout) self.browserWebView.setHtml(html) self.browserWebView.setReadOnly(True)
def __init__(self, tags_data, parent=None): super(EditRecordTags, self).__init__(parent) # self.setWindowFlags(Qt.FramelessWindowHint) #|Qt.WindowStaysOnTopHint) #|Qt.WindowTitleHint) self.resize(450, 380) self.setWindowTitle('Edita Etiquetas do Registo') self.tags_data = tags_data masterLayout = QVBoxLayout(self) self.tag_list = '' self.flag = False self.toto = () self.grid = QTableWidget() self.grid.setSelectionBehavior(QTableWidget.SelectRows) self.grid.setSelectionMode(QTableWidget.SingleSelection) self.grid.setEditTriggers(QTableWidget.AllEditTriggers) self.grid.verticalHeader().setDefaultSectionSize(20) self.grid.setAlternatingRowColors(True) self.grid.setAlternatingRowColors(True) self.grid.setStyleSheet("alternate-background-color: #effa0f;") self.grid.verticalHeader().setVisible(False) masterLayout.addWidget(self.grid) exit_btn = QPushButton('Sair') exit_btn.clicked.connect(self.exit_click) valid_btn = QPushButton('Valida') valid_btn.clicked.connect(self.valid_click) masterLayout.addLayout(qc.addHLayout([valid_btn, exit_btn])) self.tag_refresh()
def __init__(self, html_report, parent=None): super(DisplayReport, self).__init__(parent) mainLayout = QVBoxLayout(self) self.resize(1024, 768) self.printBtn = QPushButton('Print') self.printBtn.clicked.connect(self.print_page) self.printPreviewBtn = QPushButton('Preview') self.printPreviewBtn.clicked.connect(self.filePrintPreview) self.printToPdfBtn = QPushButton('To PDF') self.printToPdfBtn.clicked.connect(self.print_to_pdf) self.exitBtn = QPushButton('Exit') self.exitBtn.clicked.connect(self.exit_click) mainLayout.addLayout( qlib.addHLayout([ self.printBtn, self.printPreviewBtn, self.printToPdfBtn, True, self.exitBtn ])) self.reportTextEdit = QtWebEngineWidgets.QWebEngineView(self) self.reportTextEdit.setHtml(html_report) self.printer = QPrinter() mainLayout.addWidget(self.reportTextEdit)
def makeTab4(self): self.tab4 = QWidget() mainTab4Layout = QVBoxLayout(self.tab4) tab4Layout = QVBoxLayout() self.tags = QTextBrowser() self.tags.setMaximumHeight(90) self.tags.setReadOnly(False) addTags = QToolButton() addTags.setText('Lista Etiquetas') addTags.clicked.connect(self.add_tags_click) editTags = QToolButton() editTags.setText('Edita Etiquetas') editTags.clicked.connect(self.edit_tags_click) sizesTBtn = QToolButton() sizesTBtn.clicked.connect(self.show_sizes_click) specialTagsBtn = QToolButton() specialTagsBtn.setText('Caracteristicas') specialTagsBtn.clicked.connect(self.edit_special_tags_click) sizesTBtn = QToolButton() sizesTBtn.clicked.connect(self.show_sizes_click) self.pu_sinopse = QTextEdit() tab4Layout.addLayout( addHLayout([addTags, editTags, specialTagsBtn, True, sizesTBtn])) tab4Layout.addWidget(self.tags) tab4Layout.addWidget(self.pu_sinopse) mainTab4Layout.addLayout(tab4Layout)
def __init__(self, parent=None): super(TestClass, self).__init__(parent) masterLayout = QVBoxLayout(self) lay0 = QHBoxLayout() lay1 = QHBoxLayout() lay2 = QHBoxLayout() lay3 = QHBoxLayout() self.headersEdt = QLineEdit() masterLayout.addLayout(qc.addHLayout(['Headers', self.headersEdt])) self.rowsEdt = QLineEdit() self.rowsEdt.setMaximumWidth(30) self.rowsEdt.setMinimumWidth(30) self.colsEdt = QLineEdit() self.colsEdt.setMaximumWidth(30) self.colsEdt.setMinimumWidth(30) self.selectBeaCbx = QComboBox() masterLayout.addLayout( qc.addHLayout(['Rows/Colunms', self.rowsEdt, self.colsEdt, True])) masterLayout.addLayout( qc.addHLayout(['Seelct Beahvori', self.selectBeaCbx])) self.setSelectMode = QComboBox() masterLayout.addLayout( qc.addHLayout(['Select Mode', self.setSelectMode])) self.editTriggers = QComboBox() masterLayout.addLayout( qc.addHLayout(['Edit Triggers', self.editTriggers])) label2 = QLabel('Vertical Header Size') lay2.addWidget(label2) self.vheaderSize = QLineEdit() self.vheaderSize.setMaximumWidth(30) self.vheaderSize.setMinimumWidth(30) lay2.addWidget(self.vheaderSize) self.alterntingRow = QCheckBox('Alternating Row') masterLayout.addWidget(self.alterntingRow) label3 = QLabel('Set Style Sheet') lay3.addWidget(label3) self.styleSheetEdt = QLineEdit() lay3.addWidget(self.styleSheetEdt) self.vHeaderVisibleChk = QCheckBox('Vertical Header Visible') masterLayout.addWidget(self.vHeaderVisibleChk) self.resizeToContentsChk = QCheckBox('Resize To Contents') masterLayout.addWidget(self.resizeToContentsChk) self.onDblClickBtn = QLineEdit() masterLayout.addWidget(self.onDblClickBtn) self.onSingleClickEdt = QLineEdit() masterLayout.addWidget(self.onSingleClickEdt) masterLayout.addLayout(lay0) masterLayout.addLayout(lay1) masterLayout.addLayout(lay2) masterLayout.addLayout(lay3) okBtn = QPushButton('O.K.') cancelBtn = QPushButton('Cancel') masterLayout.addLayout(qc.addHLayout([okBtn, cancelBtn]))
def __init__(self, parent=None): super(OptionsDialog, self).__init__(parent) self.resize(400, 200) self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.WindowTitleHint) self.setWindowTitle('Opções') masterLayout = QVBoxLayout(self) self.yearAsDateCbox = QCheckBox('O Ano é igual á data de edição') self.addIsbnCbox = QCheckBox('Adiciona ISBN') self.addAuthorAsLabelCbox = QCheckBox('Adiciona autor como etiqueta') # self.addAuthorAsLabelCbox.setCheckState(2) self.checkInDatabaseCbox = QCheckBox( 'Verifica se já existe na Base de Dados') # self.checkInDatabaseCbox.setCheckState(2) self.capitalizeTitleCbox = QCheckBox('Capitaliza Titulo') self.smartTitleCbox = QCheckBox( 'Capitalização do Titulo inteligente (+lento)') # self.smartTitleCbox.setCheckState(2) self.titleInUpperCbox = QCheckBox('Titulo em Maiusculas') self.authorSurnameCbox = QCheckBox('Autor como APELIDO, Nome;') self.authorSurnameTitleCbox = QCheckBox('Autor como Apelido, Nome;') masterLayout.addWidget(self.yearAsDateCbox) masterLayout.addWidget(self.addIsbnCbox) masterLayout.addWidget(self.addAuthorAsLabelCbox) masterLayout.addWidget(self.checkInDatabaseCbox) masterLayout.addWidget(self.capitalizeTitleCbox) masterLayout.addWidget(self.smartTitleCbox) masterLayout.addWidget(self.titleInUpperCbox) masterLayout.addWidget(self.authorSurnameCbox) masterLayout.addWidget(self.authorSurnameTitleCbox) self.validateOptionsBtn = QPushButton('Valida') self.validateOptionsBtn.clicked.connect(self.valida_options_click) self.cancelBtn = QPushButton('Sair') self.cancelBtn.clicked.connect(self.exit_click) masterLayout.addLayout( qlib.addHLayout([self.validateOptionsBtn, self.cancelBtn])) self.refresh()
def __init__(self, parent=None): super(BrowserAuthors, self).__init__(parent) self.resize(600, 400) self.setWindowTitle('Autores') masterLayout = QVBoxLayout(self) self.searchEdit = QLineEdit() self.toto = '' self.searchEdit.textChanged.connect(self.grid_search_changed) masterLayout.addWidget(self.searchEdit) self.authorGrid = QTableWidget() self.authorGrid.setSelectionBehavior(QTableWidget.SelectRows) self.authorGrid.setSelectionMode(QTableWidget.SingleSelection) self.authorGrid.setEditTriggers(QTableWidget.NoEditTriggers) self.authorGrid.verticalHeader().setDefaultSectionSize(20) self.authorGrid.verticalHeader().setVisible(False) self.authorGrid.setAlternatingRowColors(True) self.authorGrid.setStyleSheet("alternate-background-color: #99ffcc;") self.authorGrid.itemDoubleClicked.connect(self.valid_click) masterLayout.addWidget(self.authorGrid) exitBtn = QPushButton('Sair') exitBtn.clicked.connect(self.exit_click) valid_btn = QPushButton('Valida') valid_btn.clicked.connect(self.valid_click) edit_btn = QPushButton('Altera') edit_btn.clicked.connect(self.edit_click) masterLayout.addLayout(qc.addHLayout([valid_btn, edit_btn, exitBtn])) if not gl.AUTHOR_SEARCH_MASK == '': self.searchEdit.setText(gl.AUTHOR_SEARCH_MASK) self.grid_search_changed(gl.AUTHOR_SEARCH_MASK) else: self.grid_refresh() self.searchEdit.setFocus()
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) # centra janela no ecran self.centralwidget = QWidget(self) self.setWindowIcon(QIcon('./img/books.png')) self.setCentralWidget(self.centralwidget) self.setWindowTitle('Livros') # vars gl.refresh = False gl.SQLglobal = '' gl.DATAglobal = '' gl.current_path = './' print('loading datasets...') self.status = ['Todos'] self.types = ['Todos'] gl.db_params = stdio.read_config_file('gabo.ini') if not gl.db_params[0]: QMessageBox.critical( None, "Erro Fatal", """O ficheiro de configuração não foi encontrado ou está corrompido!""", QMessageBox.StandardButtons(QMessageBox.Close), QMessageBox.Close) self.close() gl.db_params = gl.db_params[1] gl.conn_string = "host=" + gl.db_params['db_host'] + ' port=' + gl.db_params['db_port'] + ' dbname=' + gl.db_params['db_database'] +\ ' user='******'db_user'] + ' password='******'db_password'] data_access.get_autores() data_access.get_status() data_access.get_types() data_access.get_params() data_access.load_preps() data_access.get_areas() data_access.get_special_tags() data_access.get_locals() print('ending loading datasets!') self.status.extend(gl.dsStatus) self.types.extend(gl.ds_types) self.resize(1200, 768) self.center() gl.DEBUG = True QApplication.setStyle(QStyleFactory.create('Fusion')) mainLayout = QVBoxLayout(self.centralwidget) # barra de pesquisa """ primeira pesquisa""" self.mainSearchCbox = QComboBox() self.mainSearchCbox.setMaximumWidth(90) self.mainSearchCbox.setMinimumWidth(90) self.mainSearchCbox.addItems(['Titulo', 'ISBN', 'Etiqueta']) self.mainSearchCbox.setCurrentIndex(0) self.mainToSearchEdt = QLineEdit() self.mainToSearchEdt.setMaximumWidth(300) self.mainToSearchEdt.setMinimumWidth(300) mainSearchBtn = QToolButton() mainSearchBtn.setToolTip('Pesquisa texto') mainSearchBtn.setIcon(QIcon('./img/search.png')) # self.set_icon_size(firstSearchBtn) mainSearchBtn.clicked.connect(self.main_search_click) mainSearchClearBtn = QToolButton() mainSearchClearBtn.setToolTip('Limpa Pesquisa') mainSearchClearBtn.setIcon(QIcon('./img/clear.png')) # self.set_icon_size(firstSearchBtn) # mainSearchBtn.clicked.connect(self.main_search_clear_click) authorsBtn = QToolButton() authorsBtn.setToolTip('Autores') authorsBtn.setIcon(QIcon('./img/authors.png')) authorsBtn.clicked.connect(self.authors_click) secondClearBtn = QToolButton() secondClearBtn.setToolTip('Limpa Pesquisa') secondClearBtn.setIcon(QIcon('./img/clear.png')) # self.set_icon_size(secondClearBtn) secondClearBtn.clicked.connect(self.second_field_clear_click) cotasBtn = QToolButton() cotasBtn.setToolTip('Cotas Locais') cotasBtn.setIcon(QIcon('./img/locals.png')) cotasBtn.clicked.connect(self.locals_click) search_tags_Btn = QToolButton() search_tags_Btn.setToolTip('Pesquisa tags') search_tags_Btn.setIcon(QIcon('./img/search_tags.png')) # self.set_icon_size(search_tags_Btn) search_tags_Btn.clicked.connect(self.search_tags_mode_click) clear_tags_Btn = QToolButton() clear_tags_Btn.setToolTip('Limpa Tags') clear_tags_Btn.setIcon(QIcon('./img/clear.png')) # self.set_icon_size(clear_tags_Btn) clear_tags_Btn.clicked.connect(self.clear_tags_search) self.tags_browserBtn = QToolButton() self.tags_browserBtn.setToolTip('Gere Etiquetas') self.tags_browserBtn.setIcon(QIcon('./img/tags.png')) # self.set_icon_size(self.tags_browserBtn) self.tags_browserBtn.clicked.connect(self.tags_browser_click) # drop add menu bookAddBtn = QPushButton('Novo') bookAddBtn.setToolTip('Adiciona Livro') bookAddBtn.clicked.connect(self.record_add_click) bookAddIsbnBtn = QPushButton('Wook') bookAddIsbnBtn.setToolTip('Adiciona livro pela WOOK') bookAddIsbnBtn.clicked.connect(self.record_add_wook_click) self.addBookBtn = QPushButton() self.addBookBtn.setToolTip('Adicionar Livro') self.addBookBtn.setIcon(QIcon('./img/addbook.png')) printBtn = QToolButton() printBtn.setIcon(QIcon('./img/print.png')) # self.set_icon_size(printBtn) printBtn.clicked.connect(self.print_click) self.last_fiveBtn = QPushButton() self.last_fiveBtn.setText('Ultimos ' + gl.SHOW_RECORDS) self.last_fiveBtn.clicked.connect(self.last_records_click) double1_Btn = QPushButton() double1_Btn.setText('Duplica') double1_Btn.clicked.connect(self.double1_click) clone_Btn = QPushButton() clone_Btn.setText('&Clona') clone_Btn.clicked.connect(self.clone_click) aboutBtn = QToolButton() aboutBtn.setToolTip('Acerca') aboutBtn.setIcon(QIcon('./img/info.png')) # self.set_icon_size(aboutBtn) aboutBtn.clicked.connect(self.about_click) closeBtn = QToolButton() closeBtn.setToolTip('Sair') closeBtn.setIcon(QIcon('./img/close.png')) # self.set_icon_size(closeBtn) closeBtn.clicked.connect(self.closeBtn_click) self.sortByCbox = QComboBox() self.sortByCbox.setCurrentIndex(0) self.sortByCbox.addItems( ['Nada', 'Autor', 'Titulo', 'Tipos', 'Local', 'Volume', 'Ano']) self.sortByCbox.setCurrentIndex(0) self.sortByCbox.currentIndexChanged.connect(self.sort_by_change) self.recordLimitEdt = QLineEdit() self.recordLimitEdt.setMaximumWidth(40) self.recordLimitEdt.setMaxLength(4) self.recordLimitEdt.setText(gl.SHOW_RECORDS) self.recordLimitEdt.editingFinished.connect(self.limit_change) self.typesCbox = QComboBox() self.typesCbox.addItems(self.types) self.typesCbox.setCurrentIndex(0) self.typesCbox.currentIndexChanged.connect(self.types_change) self.statusCbox = QComboBox() self.statusCbox.setCurrentIndex(0) self.statusCbox.addItems(self.status) self.statusCbox.currentIndexChanged.connect(self.status_change) widthSumBtn = QToolButton() widthSumBtn.setToolTip('Espaço') widthSumBtn.setIcon(QIcon('./img/width_sigma.png')) # self.set_icon_size(widthSumBtn) widthSumBtn.clicked.connect(self.width_sum_click) mainLayout.addLayout( qlib.addHLayout([ bookAddBtn, bookAddIsbnBtn, self.last_fiveBtn, double1_Btn, clone_Btn, printBtn, True, aboutBtn, closeBtn ])) mainLayout.addLayout( qlib.addHLayout([ self.mainSearchCbox, self.mainToSearchEdt, mainSearchBtn, mainSearchClearBtn, self.tags_browserBtn, authorsBtn, cotasBtn, widthSumBtn, True, 'Ordena:', self.sortByCbox, 'Tipos', self.typesCbox, 'Estado', self.statusCbox, True, 'Registos', self.recordLimitEdt ], 60)) mainLayout.addLayout( qlib.addHLayout( ['AUTOR:eça,POR:nenhum,TIPO:todos,ESTADO:todos', True], 400)) # grid self.grid = QTableWidget(self) self.grid.setSelectionBehavior(QTableWidget.SelectRows) self.grid.setSelectionMode(QTableWidget.SingleSelection) self.grid.setEditTriggers(QTableWidget.NoEditTriggers) self.grid.verticalHeader().setDefaultSectionSize(20) self.grid.setAlternatingRowColors(True) self.grid.verticalHeader().setVisible(False) self.grid.setStyleSheet("alternate-background-color: #d2e5ff;") self.grid.doubleClicked.connect(self.grid_double_click) mainLayout.addWidget(self.grid) # sub menus author_pub = QAction("Obras do Autor", self) author_pub.triggered.connect(self.author_pub_click) self.grid.addAction(author_pub) local_pub = QAction("Obras nesta Cota", self) local_pub.triggered.connect(self.local_pub_click) self.grid.addAction(local_pub) self.grid.setContextMenuPolicy(2) self.last_records_click() try: if GetSystemMetrics(1) <= 768: self.showMaximized() except NameError: pass
def make_title(self): self.pu_title = QLineEdit() titleCapitalize = QToolButton() titleCapitalize.setIcon(QIcon('./img/caps.png')) titleCapitalize.setToolTip('Capitaliza Titulo') titleCapitalize.clicked.connect(self.title_caps) searchTitleBtn = QToolButton() searchTitleBtn.setIcon(QIcon('./img/chrome.png')) searchTitleBtn.setToolTip('Pesquisa na internet') searchTitleBtn.clicked.connect(self.title_internet_search) self.pu_volume = QLineEdit() self.pu_volume.setMaximumWidth(40) self.pu_volume.setMaxLength(3) self.pu_ed_year = QLineEdit() self.pu_ed_year.setMaximumWidth(60) self.pu_ed_year.setMaxLength(4) self.titleLayout.addLayout( addHLayout( ['Titulo:', self.pu_title, titleCapitalize, searchTitleBtn])) self.titleLayout.addLayout( addHLayout( ['Volume:', self.pu_volume, 'Ano', self.pu_ed_year, True])) self.pu_sub_title = QLineEdit() self.pu_sub_title.setMaxLength(255) subTitleCapitalize = QToolButton() # setSize(subTitleCapitalize) subTitleCapitalize.setIcon(QIcon('./img/caps.png')) subTitleCapitalize.setToolTip('Capitaliza sub-titulo') subTitleCapitalize.clicked.connect(self.sub_title_caps) self.titleLayout.addLayout( addHLayout(['Sub-titulo:', self.pu_sub_title, subTitleCapitalize])) labelpu_author_id = QLabel('Autor:') labelpu_author_id.setAlignment(Qt.AlignRight) self.pu_author_id = QComboBox(self) self.pu_author_id.setEditable(True) authorToTagBtn = QToolButton() authorToTagBtn.setIcon(QIcon('./img/green.png')) authorToTagBtn.setToolTip('Adiciona autor ás etiquetas') searchAuthorBtn = QToolButton() searchAuthorBtn.setIcon(QIcon('./img/chrome.png')) searchAuthorBtn.setToolTip('Pesquisa na internet') searchAuthorBtn.clicked.connect(self.author_internet_search) authorToTagBtn.clicked.connect(self.add_author_to_tags) self.titleLayout.addLayout( addHLayout( ['Autor:', self.pu_author_id, authorToTagBtn, searchAuthorBtn])) self.pu_type = QComboBox() self.pu_type.setEditable(True) typeToTagBtn = QToolButton() # setSize(typeToTagBtn) typeToTagBtn.setIcon(QIcon('./img/green.png')) typeToTagBtn.setToolTip('Adiciona tipo às etiquetas') typeToTagBtn.clicked.connect(self.add_type_to_tags) self.pu_cota = QLineEdit() self.pu_cota.setObjectName('pu_cota') self.pu_cota.setMaxLength(10) self.pu_status = QComboBox() self.pu_status.setEditable(True) self.titleLayout.addLayout( addHLayout([ 'Tipo:', self.pu_type, typeToTagBtn, 'Estado:', self.pu_status ])) self.pu_isbn = QLineEdit() self.pu_isbn.setMaxLength(20) searchIsbnBtn = QToolButton() searchIsbnBtn.setIcon(QIcon('./img/chrome.png')) searchIsbnBtn.setToolTip('Pesquisa na internet') searchIsbnBtn.clicked.connect(self.isbn_internet_search) # self.pu_isbn10 = QLineEdit() # self.pu_isbn10.setMaxLength(10) # # self.pu_isbn10.setObjectName('pu_isbn10') self.pu_depLegal = QLineEdit() self.pu_depLegal.setMaxLength(20) setLocalBtn = QToolButton() setLocalBtn.setIcon(QIcon('./img/blue.png')) setLocalBtn.setToolTip('Ver locais') setLocalBtn.clicked.connect(self.set_local_click) pasteLocalBtn = QToolButton() pasteLocalBtn.setIcon(QIcon('./img/paste.png')) pasteLocalBtn.setToolTip('Cola o ultimo local') pasteLocalBtn.clicked.connect(self.paste_local_click) self.titleLayout.addLayout( addHLayout([ 'ISBN:', self.pu_isbn, searchIsbnBtn, 'Cota:', self.pu_cota, setLocalBtn, pasteLocalBtn ]))