Python PyQt5.QtWidgets.QTextBrowser() Examples

The following are 30 code examples for showing how to use PyQt5.QtWidgets.QTextBrowser(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: Mastering-GUI-Programming-with-Python   Author: PacktPublishing   File: qt_richtext_demo.py    License: MIT License 7 votes vote down vote up
def __init__(self):
        """MainWindow constructor."""
        super().__init__()
        # Main UI code goes here
        main = qtw.QTextBrowser(minimumWidth=800, minimumHeight=600)
        self.setCentralWidget(main)

        # Must come before the HTML is inserted
        main.document().setDefaultStyleSheet(
            'body {color: #333; font-size: 14px;} '
            'h2 {background: #CCF; color: #443;} '
            'h1 {background: #001133; color: white;} '
        )

        # TextBrowser background is a widget style, not a document style
        main.setStyleSheet('background-color: #EEF;')
        with open('fight_fighter2.html', 'r') as fh:
            main.insertHtml(fh.read())

        main.setOpenExternalLinks(True)

        # End main UI code
        self.show() 
Example 2
Project: Lector   Author: BasioMeusPuga   File: contentwidgets.py    License: GNU General Public License v3.0 6 votes vote down vote up
def mouseMoveEvent(self, event):
        # Compare mouse positions
        # This allows to filter out scrolling
        # from a normal mouseEvent

        QtWidgets.QTextBrowser.mouseMoveEvent(self, event)
        if not self.mousePosition:
            self.mousePosition = event.pos()
            return

        current_position = event.pos()
        if current_position == self.mousePosition or self.parent.sideDock.isVisible():
            return
        else:
            self.mousePosition = event.pos()

            self.parent.navBar.show()
            if self.annotation_mode:
                self.viewport().setCursor(QtCore.Qt.IBeamCursor)
            else:
                self.viewport().setCursor(QtCore.Qt.ArrowCursor)
            self.parent.mouseHideTimer.start(2000) 
Example 3
Project: dash-masternode-tool   Author: Bertrand256   File: ui_doc_dlg.py    License: MIT License 6 votes vote down vote up
def setupUi(self, DocDlg):
        DocDlg.setObjectName("DocDlg")
        DocDlg.resize(714, 454)
        self.verticalLayout = QtWidgets.QVBoxLayout(DocDlg)
        self.verticalLayout.setContentsMargins(6, 6, 6, 6)
        self.verticalLayout.setSpacing(6)
        self.verticalLayout.setObjectName("verticalLayout")
        self.textMain = QtWidgets.QTextBrowser(DocDlg)
        self.textMain.setStyleSheet("")
        self.textMain.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
        self.textMain.setOpenExternalLinks(True)
        self.textMain.setObjectName("textMain")
        self.verticalLayout.addWidget(self.textMain)
        self.buttonBox = QtWidgets.QDialogButtonBox(DocDlg)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(DocDlg)
        self.buttonBox.accepted.connect(DocDlg.accept)
        self.buttonBox.rejected.connect(DocDlg.reject)
        QtCore.QMetaObject.connectSlotsByName(DocDlg) 
Example 4
Project: Grabber   Author: Thomasedv   File: download_element.py    License: GNU General Public License v3.0 6 votes vote down vote up
def open_log(self):
        info_log = QTextBrowser()
        info_log.setObjectName('TextFileEdit')
        info_log.setStyleSheet(self.window().styleSheet())
        info_log.setWindowTitle('Raw output')
        # Sets value to None when closed
        info_log.closeEvent = lambda _, inflog=info_log: setattr(self, '_open_window', None)

        # If a window already has been opened
        if self._open_window is not None:
            try:
                self._open_window.close()
            except:
                pass
        self._open_window = info_log

        info_log.setText('\n'.join(self.process.debug_log))
        info_log.show() 
Example 5
Project: binja_dynamics   Author: nccgroup   File: __init__.py    License: Apache License 2.0 6 votes vote down vote up
def __init__(self):
        super(TracebackWindow, self).__init__()
        self.framelist = []
        self.ret_add = 0x0
        self.setWindowTitle("Traceback")
        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        # Creates the rich text viewer that displays the traceback
        self._textBrowser = QtWidgets.QTextBrowser()
        self._textBrowser.setOpenLinks(False)
        self._textBrowser.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
        self._layout.addWidget(self._textBrowser)

        # Creates the button that displays the return address
        self._ret = QtWidgets.QPushButton()
        self._ret.setFlat(True)
        self._layout.addWidget(self._ret)

        self.resize(self.width(), int(self.height() * 0.5))

        self.setObjectName('Traceback_Window') 
Example 6
Project: Lector   Author: BasioMeusPuga   File: contentwidgets.py    License: GNU General Public License v3.0 5 votes vote down vote up
def resizeEvent(self, event=None):
        QtWidgets.QTextBrowser.resizeEvent(self, event)
        self.resizeTimer.start(100) 
Example 7
Project: Lector   Author: BasioMeusPuga   File: contentwidgets.py    License: GNU General Public License v3.0 5 votes vote down vote up
def mouseReleaseEvent(self, event):
        # This takes care of annotation placement
        # and addition to the list that holds all current annotations
        if not self.current_annotation:
            QtWidgets.QTextBrowser.mouseReleaseEvent(self, event)
            return

        self.place_annotation(self.current_annotation)
        self.toggle_annotation_mode() 
Example 8
Project: maltindex   Author: joxeankoret   File: diaphora_ida.py    License: GNU General Public License v2.0 5 votes vote down vote up
def PopulateForm(self):
    self.layout = QtWidgets.QVBoxLayout()
    self.browser = QtWidgets.QTextBrowser()
    self.browser.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
    self.browser.setHtml(self.text)
    self.browser.setReadOnly(True)
    self.browser.setFontWeight(12)
    self.layout.addWidget(self.browser)
    self.parent.setLayout(self.layout) 
Example 9
Project: dash-masternode-tool   Author: Bertrand256   File: ui_cmd_console_dlg.py    License: MIT License 5 votes vote down vote up
def setupUi(self, CmdConsoleDlg):
        CmdConsoleDlg.setObjectName("CmdConsoleDlg")
        CmdConsoleDlg.resize(468, 334)
        self.verticalLayout = QtWidgets.QVBoxLayout(CmdConsoleDlg)
        self.verticalLayout.setObjectName("verticalLayout")
        self.edtCmdLog = QtWidgets.QTextBrowser(CmdConsoleDlg)
        font = QtGui.QFont()
        font.setFamily("Courier New")
        font.setPointSize(12)
        font.setKerning(False)
        self.edtCmdLog.setFont(font)
        self.edtCmdLog.setLineWrapMode(QtWidgets.QTextEdit.WidgetWidth)
        self.edtCmdLog.setObjectName("edtCmdLog")
        self.verticalLayout.addWidget(self.edtCmdLog)
        self.label = QtWidgets.QLabel(CmdConsoleDlg)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.edtCommand = QtWidgets.QLineEdit(CmdConsoleDlg)
        self.edtCommand.setClearButtonEnabled(True)
        self.edtCommand.setObjectName("edtCommand")
        self.verticalLayout.addWidget(self.edtCommand)
        self.buttonBox = QtWidgets.QDialogButtonBox(CmdConsoleDlg)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(CmdConsoleDlg)
        self.buttonBox.accepted.connect(CmdConsoleDlg.accept)
        self.buttonBox.rejected.connect(CmdConsoleDlg.reject)
        QtCore.QMetaObject.connectSlotsByName(CmdConsoleDlg) 
Example 10
Project: reaper   Author: ScriptSmith   File: windows.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, text, details, parent=None):
        super().__init__(parent=parent)
        self.setMinimumHeight(300)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.setLayout(self.layout)

        label = QtWidgets.QLabel(text, self)
        self.layout.addWidget(label)

        browser = QtWidgets.QTextBrowser(self)
        browser.setText(details)
        self.layout.addWidget(browser) 
Example 11
Project: grap   Author: AirbusCyber   File: QtShim.py    License: MIT License 5 votes vote down vote up
def get_QTextBrowser():
    """QTextBrowser getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QTextBrowser
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QTextBrowser 
Example 12
Project: pyMeteo   Author: cwebster2   File: StatWidget.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def initUI(self):
    self.statsBox = QtWidgets.QTextBrowser(self)
    #self.updateBtn = QtGui.QPushButton("Update", self)
    #self.updateBtn.clicked.connect(self.calcStats)

    layout = QtWidgets.QVBoxLayout()
    layout.addWidget(self.statsBox)
    #layout.addWidget(self.updateBtn)
    self.setLayout(layout) 
Example 13
Project: python   Author: Yeah-Kun   File: select.py    License: Apache License 2.0 5 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1279, 677)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
        self.tableWidget.setGeometry(QtCore.QRect(150, 80, 441, 331))
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget) # 生成相对应的对象
        self.pushButton.setGeometry(QtCore.QRect(310, 510, 171, 61))# 确定该对象的位置以及大小
        self.pushButton.setObjectName("pushButton")                 # 设置名字,加载对象
        self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
        self.checkBox.setGeometry(QtCore.QRect(870, 530, 91, 19))
        self.checkBox.setObjectName("checkBox")
        self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget)
        self.textBrowser.setGeometry(QtCore.QRect(750, 90, 421, 321))
        self.textBrowser.setObjectName("textBrowser")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1279, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
Example 14
Project: PyQt   Author: PyQt5   File: IsSignalConnected.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(self)
        self.button1 = QPushButton('已连接', self, clicked=self.doTest)
        self.button2 = QPushButton('未连接', self)
        self.retView = QTextBrowser(self)
        layout.addWidget(self.button1)
        layout.addWidget(self.button2)
        layout.addWidget(self.retView) 
Example 15
Project: liquid-swap   Author: Blockstream   File: dialogpaste.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, PasteDialog):
        PasteDialog.setObjectName("PasteDialog")
        PasteDialog.resize(400, 300)
        self.gridLayout = QtWidgets.QGridLayout(PasteDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.textBrowser = QtWidgets.QTextBrowser(PasteDialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.textBrowser.sizePolicy().hasHeightForWidth())
        self.textBrowser.setSizePolicy(sizePolicy)
        self.textBrowser.setAcceptRichText(False)
        self.textBrowser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextEditable|QtCore.Qt.TextEditorInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
        self.textBrowser.setOpenLinks(False)
        self.textBrowser.setObjectName("textBrowser")
        self.verticalLayout.addWidget(self.textBrowser)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.buttonImport = QtWidgets.QPushButton(PasteDialog)
        self.buttonImport.setObjectName("buttonImport")
        self.horizontalLayout.addWidget(self.buttonImport)
        self.buttonCancel = QtWidgets.QPushButton(PasteDialog)
        self.buttonCancel.setObjectName("buttonCancel")
        self.horizontalLayout.addWidget(self.buttonCancel)
        self.buttonOk = QtWidgets.QPushButton(PasteDialog)
        self.buttonOk.setObjectName("buttonOk")
        self.horizontalLayout.addWidget(self.buttonOk)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(PasteDialog)
        QtCore.QMetaObject.connectSlotsByName(PasteDialog) 
Example 16
Project: liquid-swap   Author: Blockstream   File: dialogcopy.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, CopyDialog):
        CopyDialog.setObjectName("CopyDialog")
        CopyDialog.resize(400, 300)
        self.gridLayout = QtWidgets.QGridLayout(CopyDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.textBrowser = QtWidgets.QTextBrowser(CopyDialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.textBrowser.sizePolicy().hasHeightForWidth())
        self.textBrowser.setSizePolicy(sizePolicy)
        self.textBrowser.setAcceptRichText(False)
        self.textBrowser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
        self.textBrowser.setOpenLinks(False)
        self.textBrowser.setObjectName("textBrowser")
        self.verticalLayout.addWidget(self.textBrowser)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.buttonExport = QtWidgets.QPushButton(CopyDialog)
        self.buttonExport.setObjectName("buttonExport")
        self.horizontalLayout.addWidget(self.buttonExport)
        self.buttonCopy = QtWidgets.QPushButton(CopyDialog)
        self.buttonCopy.setObjectName("buttonCopy")
        self.horizontalLayout.addWidget(self.buttonCopy)
        self.buttonCancel = QtWidgets.QPushButton(CopyDialog)
        self.buttonCancel.setObjectName("buttonCancel")
        self.horizontalLayout.addWidget(self.buttonCancel)
        self.buttonOk = QtWidgets.QPushButton(CopyDialog)
        self.buttonOk.setObjectName("buttonOk")
        self.horizontalLayout.addWidget(self.buttonOk)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(CopyDialog)
        QtCore.QMetaObject.connectSlotsByName(CopyDialog) 
Example 17
Project: deen   Author: takeshixx   File: log.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, parent):
        super(DeenLogger, self).__init__()
        self.field = QTextBrowser(parent)
        self.field.setReadOnly(True)
        self.field.hide()
        fmt = logging.Formatter('%(asctime)s : %(message)s')
        self.setFormatter(fmt) 
Example 18
Project: Load-QSS   Author: All4Gis   File: About.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, About):
        About.setObjectName("About")
        About.resize(678, 633)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/imgQss/images/info.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        About.setWindowIcon(icon)
        self.verticalLayout = QtWidgets.QVBoxLayout(About)
        self.verticalLayout.setObjectName("verticalLayout")
        self.textBrowser = QtWidgets.QTextBrowser(About)
        self.textBrowser.setOpenExternalLinks(True)
        self.textBrowser.setObjectName("textBrowser")
        self.verticalLayout.addWidget(self.textBrowser)

        self.retranslateUi(About)
        QtCore.QMetaObject.connectSlotsByName(About) 
Example 19
Project: code-jam-5   Author: python-discord   File: gui.py    License: MIT License 5 votes vote down vote up
def __init__(self, tb):
        super(CrashPop, self).__init__()
        self.label = QtWidgets.QLabel()
        self.text_browser = QtWidgets.QTextBrowser()
        self.main_layout = QtWidgets.QVBoxLayout(self)
        self.traceback = tb 
Example 20
Project: code-jam-5   Author: python-discord   File: gui.py    License: MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(License, self).__init__(parent)
        self.main_layout = QtWidgets.QVBoxLayout()
        self.text = QtWidgets.QTextBrowser() 
Example 21
Project: pqcom   Author: xiongyihui   File: about_ui.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(432, 224)
        self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.textBrowser = QtWidgets.QTextBrowser(Dialog)
        self.textBrowser.setOpenExternalLinks(True)
        self.textBrowser.setObjectName("textBrowser")
        self.verticalLayout.addWidget(self.textBrowser)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 22
Project: Python-Application   Author: xflywind   File: Ui_Window.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(419, 404)
        self.textBrowser = QtWidgets.QTextBrowser(Form)
        self.textBrowser.setGeometry(QtCore.QRect(5, 11, 411, 371))
        self.textBrowser.setFrameShape(QtWidgets.QFrame.Box)
        self.textBrowser.setObjectName("textBrowser")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 23
Project: diaphora   Author: joxeankoret   File: diaphora_ida.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def PopulateForm(self):
    self.layout = QtWidgets.QVBoxLayout()
    self.browser = QtWidgets.QTextBrowser()
    self.browser.setLineWrapMode(QtWidgets.QTextEdit.FixedColumnWidth)
    self.browser.setLineWrapColumnOrWidth(150)
    self.browser.setHtml(self.text)
    self.browser.setReadOnly(True)
    self.browser.setFontWeight(12)
    self.layout.addWidget(self.browser)
    self.parent.setLayout(self.layout) 
Example 24
Project: Lector   Author: BasioMeusPuga   File: definitions.py    License: GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(729, 318)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.definitionView = QtWidgets.QTextBrowser(Dialog)
        self.definitionView.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.definitionView.setFrameShadow(QtWidgets.QFrame.Plain)
        self.definitionView.setObjectName("definitionView")
        self.verticalLayout.addWidget(self.definitionView)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.okButton = QtWidgets.QPushButton(Dialog)
        self.okButton.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/images/checkmark.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.okButton.setIcon(icon)
        self.okButton.setIconSize(QtCore.QSize(24, 24))
        self.okButton.setFlat(True)
        self.okButton.setObjectName("okButton")
        self.horizontalLayout.addWidget(self.okButton)
        self.pronounceButton = QtWidgets.QPushButton(Dialog)
        self.pronounceButton.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/images/QMPlay2.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pronounceButton.setIcon(icon1)
        self.pronounceButton.setIconSize(QtCore.QSize(24, 24))
        self.pronounceButton.setFlat(True)
        self.pronounceButton.setObjectName("pronounceButton")
        self.horizontalLayout.addWidget(self.pronounceButton)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.dialogBackground = QtWidgets.QPushButton(Dialog)
        self.dialogBackground.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/images/color.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.dialogBackground.setIcon(icon2)
        self.dialogBackground.setIconSize(QtCore.QSize(27, 27))
        self.dialogBackground.setFlat(True)
        self.dialogBackground.setObjectName("dialogBackground")
        self.horizontalLayout.addWidget(self.dialogBackground)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 25
Project: Lector   Author: BasioMeusPuga   File: contentwidgets.py    License: GNU General Public License v3.0 4 votes vote down vote up
def wheelEvent(self, event):
        ignore_events = 20
        if self.are_we_doing_images_only:
            ignore_events = 10

        if self.pw.ignore_wheel_event:
            self.pw.ignore_wheel_event_number += 1
            if self.pw.ignore_wheel_event_number > ignore_events:
                self.pw.ignore_wheel_event = False
                self.pw.ignore_wheel_event_number = 0
            return

        # TODO
        # This can probably be cleaned up
        if self.are_we_doing_images_only:
            QtWidgets.QGraphicsView.wheelEvent(self.pw, event)
        else:
            QtWidgets.QTextBrowser.wheelEvent(self.pw, event)

        # Since this is a delta on a mouse move event, it cannot ever be 0
        vertical_pdelta = event.pixelDelta().y()
        if vertical_pdelta > 0:
            moving_up = True
        elif vertical_pdelta < 0:
            moving_up = False

        if abs(vertical_pdelta) > 80:  # Adjust sensitivity here
            # Implies that no scrollbar movement is possible
            if self.pw.verticalScrollBar().value() == self.pw.verticalScrollBar().maximum() == 0:
                if moving_up:
                    self.change_chapter(-1)
                else:
                    self.change_chapter(1)

            # Implies that the scrollbar is at the bottom
            elif self.pw.verticalScrollBar().value() == self.pw.verticalScrollBar().maximum():
                if not moving_up:
                    self.change_chapter(1)

            # Implies scrollbar is at the top
            elif self.pw.verticalScrollBar().value() == 0:
                if moving_up:
                    self.change_chapter(-1) 
Example 26
Project: reaper   Author: ScriptSmith   File: windows.py    License: GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)

        self.job_error.connect(self.throw_job)
        self.job = None
        self.log = ""

        self.setWindowTitle("Error manager")
        self.setMinimumSize(500, 500)

        self.mainWidget = QtWidgets.QWidget(self)
        self.mainWidget.layout = QtWidgets.QVBoxLayout(self.mainWidget)
        self.mainWidget.setLayout(self.mainWidget.layout)
        self.setCentralWidget(self.mainWidget)

        self.tabs = QtWidgets.QTabWidget(self.mainWidget)

        self.console = QtWidgets.QTextBrowser()
        self.tabs.addTab(self.console, "Error log")

        self.job_browser = QtWidgets.QTextBrowser()
        self.tabs.addTab(self.job_browser, "Job state")

        self.itr_browser = QtWidgets.QTextBrowser()
        self.tabs.addTab(self.itr_browser, "Iterator state")

        self.api_browser = QtWidgets.QTextBrowser()
        self.tabs.addTab(self.api_browser, "API state")

        self.error_browser = QtWidgets.QTextBrowser()
        self.tabs.addTab(self.error_browser, "Error state")

        self.toggle_job_tabs(False)

        self.mainWidget.layout.addWidget(self.tabs)

        self.cancelButton = QtWidgets.QPushButton("Stop retrying", self.mainWidget)
        self.mainWidget.layout.addWidget(self.cancelButton)

        self.options = self.menuBar().addMenu("Options")
        self.clearAction = QtWidgets.QAction("Clear")
        self.clearAction.triggered.connect(self.clear)
        self.options.addAction(self.clearAction) 
Example 27
Project: linux-show-player   Author: FrancescoCeruti   File: layoutselect.py    License: GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)

        self.filepath = ''

        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowTitle(translate('LayoutSelect', 'Layout selection'))
        self.setMaximumSize(675, 300)
        self.setMinimumSize(675, 300)
        self.resize(675, 300)

        self.setLayout(QGridLayout(self))
        self.layout().setContentsMargins(5, 5, 5, 5)

        self.layoutCombo = QComboBox(self)
        self.layoutCombo.currentIndexChanged.connect(self.show_description)
        self.layout().addWidget(self.layoutCombo, 0, 0)

        self.confirmButton = QPushButton(self)
        self.confirmButton.setText(translate('LayoutSelect', 'Select layout'))
        self.layout().addWidget(self.confirmButton, 0, 1)

        self.fileButton = QPushButton(self)
        self.fileButton.setText(translate('LayoutSelect', 'Open file'))
        self.layout().addWidget(self.fileButton, 0, 2)

        self.layout().setColumnStretch(0, 3)
        self.layout().setColumnStretch(1, 2)
        self.layout().setColumnStretch(2, 1)

        line = QFrame(self)
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        self.layout().addWidget(line, 1, 0, 1, 3)

        self.description = QTextBrowser(self)
        self.layout().addWidget(self.description, 2, 0, 1, 3)

        for layout_class in layouts.get_layouts():
            self.layoutCombo.addItem(layout_class.NAME, layout_class)

        if self.layoutCombo.count() == 0:
            raise Exception('No layout installed!')

        self.confirmButton.clicked.connect(self.accept)
        self.fileButton.clicked.connect(self.open_file) 
Example 28
Project: DownloaderForReddit   Author: MalloyDelacroix   File: AboutDialog_auto.py    License: GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, About):
        About.setObjectName("About")
        About.resize(413, 491)
        About.setMinimumSize(QtCore.QSize(365, 230))
        About.setMaximumSize(QtCore.QSize(1000, 1000))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resources/Images/RedditDownloaderIcon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        About.setWindowIcon(icon)
        self.gridLayout_3 = QtWidgets.QGridLayout(About)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.info_label = QtWidgets.QLabel(About)
        self.info_label.setObjectName("info_label")
        self.gridLayout.addWidget(self.info_label, 1, 1, 1, 1)
        self.label = QtWidgets.QLabel(About)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 1, 1, 1)
        self.link_label = QtWidgets.QLabel(About)
        self.link_label.setOpenExternalLinks(True)
        self.link_label.setObjectName("link_label")
        self.gridLayout.addWidget(self.link_label, 2, 1, 1, 1)
        self.logo_label = QtWidgets.QLabel(About)
        self.logo_label.setObjectName("logo_label")
        self.gridLayout.addWidget(self.logo_label, 0, 0, 3, 1)
        self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1)
        self.gridLayout_2 = QtWidgets.QGridLayout()
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.license_box = QtWidgets.QTextBrowser(About)
        self.license_box.setObjectName("license_box")
        self.gridLayout_2.addWidget(self.license_box, 0, 0, 1, 2)
        self.total_downloads_label = QtWidgets.QLabel(About)
        self.total_downloads_label.setObjectName("total_downloads_label")
        self.gridLayout_2.addWidget(self.total_downloads_label, 1, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(About)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout_2.addWidget(self.buttonBox, 1, 1, 1, 1)
        self.gridLayout_3.addLayout(self.gridLayout_2, 1, 0, 1, 1)

        self.retranslateUi(About)
        self.buttonBox.accepted.connect(About.accept)
        self.buttonBox.rejected.connect(About.reject)
        QtCore.QMetaObject.connectSlotsByName(About) 
Example 29
Project: FaceSwapper   Author: QuantumLiu   File: coupleswapper_gui.py    License: Apache License 2.0 4 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(270, 360)
        Form.setAccessibleName("")
        self.verticalLayout = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout.setObjectName("verticalLayout")
        Form.setWindowIcon(QtGui.QIcon('./male_female.ico'))
        self.help_label=QtWidgets.QLabel(Form)
        self.verticalLayout.addWidget(self.help_label)
        with open('./readme.txt','r',encoding='utf8') as f:
            self.readme=f.read()
        #显示运行log
        self.statu_text=QtWidgets.QTextBrowser(Form)
        self.vb=self.statu_text.verticalScrollBar()
        self.verticalLayout.addWidget(self.statu_text)#支持滚轮
        #加载按钮
        self.bt_load = QtWidgets.QPushButton(Form)
        self.bt_load.setDefault(True)
        self.bt_load.setObjectName("bt_load")
        self.bt_load.clicked.connect(self.load_image)
        self.verticalLayout.addWidget(self.bt_load)
        #转换按钮
        self.bt_swap = QtWidgets.QPushButton(Form)
        self.bt_swap.setDefault(True)
        self.bt_swap.setObjectName("bt_swap")
        self.bt_swap.clicked.connect(self.swap)
        self.verticalLayout.addWidget(self.bt_swap)
        #保存结果按钮
        self.bt_save = QtWidgets.QPushButton(Form)
        self.bt_save.setDefault(True)
        self.bt_save.setObjectName("bt_save")
        self.bt_save.clicked.connect(self.save_result)
        self.verticalLayout.addWidget(self.bt_save)
        #保存对比图按钮
        self.bt_save_comp = QtWidgets.QPushButton(Form)
        self.bt_save_comp.setDefault(True)
        self.bt_save_comp.clicked.connect(self.save_compare)
        self.bt_save_comp.setObjectName("bt_save_comp")
        self.verticalLayout.addWidget(self.bt_save_comp)


        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 30
Project: PhyloSuite   Author: dongzhang0725   File: Ui_tRNA_reANNT.py    License: GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, tRNA_ANNT):
        tRNA_ANNT.setObjectName("tRNA_ANNT")
        tRNA_ANNT.resize(615, 587)
        tRNA_ANNT.setFocusPolicy(QtCore.Qt.NoFocus)
        self.gridLayout_3 = QtWidgets.QGridLayout(tRNA_ANNT)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.groupBox = QtWidgets.QGroupBox(tRNA_ANNT)
        self.groupBox.setObjectName("groupBox")
        self.gridLayout = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(self.groupBox)
        self.label.setOpenExternalLinks(True)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.textBrowser = QtWidgets.QTextBrowser(self.groupBox)
        self.textBrowser.setUndoRedoEnabled(True)
        self.textBrowser.setReadOnly(True)
        self.textBrowser.setObjectName("textBrowser")
        self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 1)
        self.pushButton = QtWidgets.QPushButton(self.groupBox)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/picture/resourses/Save-icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton.setIcon(icon)
        self.pushButton.setObjectName("pushButton")
        self.gridLayout.addWidget(self.pushButton, 2, 0, 1, 1)
        self.gridLayout_3.addWidget(self.groupBox, 0, 0, 1, 1)
        self.groupBox_2 = QtWidgets.QGroupBox(tRNA_ANNT)
        self.groupBox_2.setObjectName("groupBox_2")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_2)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.label_2 = QtWidgets.QLabel(self.groupBox_2)
        self.label_2.setObjectName("label_2")
        self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
        self.textBrowser_2 = QtWidgets.QTextBrowser(self.groupBox_2)
        self.textBrowser_2.setUndoRedoEnabled(True)
        self.textBrowser_2.setReadOnly(False)
        self.textBrowser_2.setObjectName("textBrowser_2")
        self.gridLayout_2.addWidget(self.textBrowser_2, 1, 0, 1, 1)
        self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_2)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/picture/resourses/if_start_60207.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_2.setIcon(icon1)
        self.pushButton_2.setObjectName("pushButton_2")
        self.gridLayout_2.addWidget(self.pushButton_2, 2, 0, 1, 1)
        self.gridLayout_3.addWidget(self.groupBox_2, 1, 0, 1, 1)

        self.retranslateUi(tRNA_ANNT)
        QtCore.QMetaObject.connectSlotsByName(tRNA_ANNT)