Python PyQt5.QtWidgets.QScrollArea() Examples

The following are 28 code examples of PyQt5.QtWidgets.QScrollArea(). 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 also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .
Example #1
Source File: first.py    From FIRST-plugin-ida with GNU General Public License v2.0 7 votes vote down vote up
def __init__(self, parent=None, frame=QtWidgets.QFrame.Box):
            super(FIRSTUI.ScrollWidget, self).__init__()

            #   Container Widget
            widget = QtWidgets.QWidget()
            #   Layout of Container Widget
            self.layout = QtWidgets.QVBoxLayout(self)
            self.layout.setContentsMargins(0, 0, 0, 0)
            widget.setLayout(self.layout)

            #   Scroll Area Properties
            scroll = QtWidgets.QScrollArea()
            scroll.setFrameShape(frame)
            scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
            scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
            scroll.setWidgetResizable(True)
            scroll.setWidget(widget)

            #   Scroll Area Layer add
            scroll_layout = QtWidgets.QVBoxLayout(self)
            scroll_layout.addWidget(scroll)
            scroll_layout.setContentsMargins(0, 0, 0, 0)
            self.setLayout(scroll_layout) 
Example #2
Source File: universal_tool_template_1112.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickMsg(self, msg, block=1):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            layout.addWidget(QtWidgets.QLabel(msg))
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        if block:
            tmpMsg.exec_()
        else:
            tmpMsg.show() 
Example #3
Source File: universal_tool_template_1115.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickMsg(self, msg, block=1):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            tmpLabel = QtWidgets.QLabel(msg)
            tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
            layout.addWidget(tmpLabel)
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        if block:
            tmpMsg.exec_()
        else:
            tmpMsg.show() 
Example #4
Source File: newsWindow.py    From GROOT with Mozilla Public License 2.0 6 votes vote down vote up
def __init__(self,passedKeywords):
        super(TabLayout,self).__init__()
        self.keywords = passedKeywords
        self.customTab = QTabWidget()
        self.news = QScrollArea()
        self.scroll_widget = QWidget()
        self.scroll_layout = QVBoxLayout(self.scroll_widget)
        self.scroll_layout.setSpacing(20.0)
        articles = news_func(self.keywords)

        for article in articles:
            self.myLabel = Tiles(parent="None",description = article['description'][0:100],title=article['title'],url=article['url'],urlImage=article['urlToImage'])
            self.scroll_layout.addLayout(self.myLabel.tileLayout)

        self.news.setWidget(self.scroll_widget)
        
        self.customTab.addTab(self.news,"News") 
Example #5
Source File: notesWindow.py    From GROOT with Mozilla Public License 2.0 6 votes vote down vote up
def initUI(self):
        self.mainLayout = QVBoxLayout()
        self.setWindowTitle(self.title)
        self.setGeometry(150,150,800,400)

        self.notes = QScrollArea()
        self.scroll_widget = QWidget()
        self.scroll_layout = QVBoxLayout(self.scroll_widget)
        self.scroll_layout.setSpacing(20.0)

        #List Generation of all the notes
        for key,value in self.noteContents.items():
            self.notetile = noteTile(key,value)
            self.scroll_layout.addLayout(self.notetile.noteTileLayout)

        self.notes.setWidget(self.scroll_widget)
        self.mainLayout.addWidget(self.notes)
        self.setLayout(self.mainLayout)
        self.show() 
Example #6
Source File: steps.py    From visma with GNU General Public License v3.0 6 votes vote down vote up
def stepsFigure(workspace):
    """GUI layout for step-by-step solution

    Arguments:
        workspace {QtWidgets.QWidget} -- main layout

    Returns:
        stepslayout {QtWidgets.QVBoxLayout} -- step-by-step solution layout
    """
    workspace.stepsfigure = Figure()
    workspace.stepscanvas = FigureCanvas(workspace.stepsfigure)
    workspace.stepsfigure.clear()
    workspace.scroll = QScrollArea()
    workspace.scroll.setWidget(workspace.stepscanvas)
    stepslayout = QVBoxLayout()
    stepslayout.addWidget(workspace.scroll)
    return stepslayout 
Example #7
Source File: windows.py    From reaper with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, title, subtitle, layout=QtWidgets.QVBoxLayout, parent=None):
        super().__init__(parent)
        self.setWindowTitle(title)

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

        if subtitle:
            self.mainWidget.layout.addWidget(QtWidgets.QLabel(subtitle))

        self.scrollArea = QtWidgets.QScrollArea(self.mainWidget)
        self.scrollArea.setWidgetResizable(True)

        self.contents = QtWidgets.QWidget(self.scrollArea)
        self.contents.layout = layout()
        self.contents.setLayout(self.contents.layout)
        self.mainWidget.layout.addWidget(self.contents)
        self.mainWidget.layout.addWidget(self.scrollArea)

        self.scrollArea.setWidget(self.contents) 
Example #8
Source File: gui.py    From biometric-attendance-sync-tool with GNU General Public License v3.0 6 votes vote down vote up
def create_message_box(title, text, icon="information", width=150):
    msg = QMessageBox()
    msg.setWindowTitle(title)
    lineCnt = len(text.split('\n'))
    if lineCnt > 15:
        scroll = QtWidgets.QScrollArea()
        scroll.setWidgetResizable(1)
        content = QtWidgets.QWidget()
        scroll.setWidget(content)
        layout = QtWidgets.QVBoxLayout(content)
        tmpLabel = QtWidgets.QLabel(text)
        tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        layout.addWidget(tmpLabel)
        msg.layout().addWidget(scroll, 12, 10, 1, msg.layout().columnCount())
        msg.setStyleSheet("QScrollArea{min-width:550 px; min-height: 400px}")
    else:
        msg.setText(text)
        if icon == "warning":
            msg.setIcon(QtWidgets.QMessageBox.Warning)
            msg.setStyleSheet("QMessageBox Warning{min-width: 50 px;}")
        else:
            msg.setIcon(QtWidgets.QMessageBox.Information)
            msg.setStyleSheet("QMessageBox Information{min-width: 50 px;}")
        msg.setStyleSheet("QmessageBox QLabel{min-width: "+str(width)+"px;}")
    msg.exec_() 
Example #9
Source File: collapsiblebox.py    From asammdf with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, title="", parent=None):
        super(CollapsibleBox, self).__init__(parent)

        self.toggle_button = QtWidgets.QToolButton(
            text=title, checkable=True, checked=False
        )
        self.toggle_button.setStyleSheet("QToolButton { border: none; }")
        self.toggle_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        self.toggle_button.setArrowType(QtCore.Qt.RightArrow)
        self.toggle_button.pressed.connect(self.on_pressed)

        self.toggle_animation = QtCore.QParallelAnimationGroup(self)

        self.content_area = QtWidgets.QScrollArea(maximumHeight=0, minimumHeight=0)
        self.content_area.setSizePolicy(
            QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed
        )
        self.content_area.setFrameShape(QtWidgets.QFrame.NoFrame)

        lay = QtWidgets.QVBoxLayout(self)
        lay.setSpacing(0)
        lay.setContentsMargins(0, 0, 0, 0)
        lay.addWidget(self.toggle_button)
        lay.addWidget(self.content_area)

        self.toggle_animation.addAnimation(
            QtCore.QPropertyAnimation(self, b"minimumHeight")
        )
        self.toggle_animation.addAnimation(
            QtCore.QPropertyAnimation(self, b"maximumHeight")
        )
        self.toggle_animation.addAnimation(
            QtCore.QPropertyAnimation(self.content_area, b"maximumHeight")
        ) 
Example #10
Source File: ui_dialog_view_image.py    From QualCoder with MIT License 5 votes vote down vote up
def setupUi(self, Dialog_view_image):
        Dialog_view_image.setObjectName("Dialog_view_image")
        Dialog_view_image.resize(1021, 715)
        self.gridLayout = QtWidgets.QGridLayout(Dialog_view_image)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalSlider = QtWidgets.QSlider(Dialog_view_image)
        self.horizontalSlider.setMinimum(9)
        self.horizontalSlider.setSingleStep(3)
        self.horizontalSlider.setProperty("value", 99)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setTickPosition(QtWidgets.QSlider.TicksBelow)
        self.horizontalSlider.setTickInterval(10)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.gridLayout.addWidget(self.horizontalSlider, 3, 0, 1, 1)
        self.groupBox = QtWidgets.QGroupBox(Dialog_view_image)
        self.groupBox.setTitle("")
        self.groupBox.setObjectName("groupBox")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setSpacing(0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.splitter = QtWidgets.QSplitter(self.groupBox)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.scrollArea = QtWidgets.QScrollArea(self.splitter)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 993, 562))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 2, 0, 1, 1)
        self.textEdit = QtWidgets.QTextEdit(Dialog_view_image)
        self.textEdit.setMaximumSize(QtCore.QSize(16777215, 80))
        self.textEdit.setObjectName("textEdit")
        self.gridLayout.addWidget(self.textEdit, 4, 0, 1, 1)

        self.retranslateUi(Dialog_view_image)
        QtCore.QMetaObject.connectSlotsByName(Dialog_view_image) 
Example #11
Source File: searchwindow.py    From CodeAtlasSublime with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self, parent = None):
		QtWidgets.QScrollArea.__init__(self)
		Ui_SearchWindow.__init__(self)
		self.setupUi(self) 
		self.searchButton.clicked.connect(self.onSearch)
		self.addToSceneButton.clicked.connect(self.onAddToScene) 
Example #12
Source File: schemewindow.py    From CodeAtlasSublime with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self, parent = None):
		QtWidgets.QScrollArea.__init__(self)
		Ui_SymbolWindow.__init__(self)
		self.setupUi(self)
		self.addSchemeButton.clicked.connect(self.onAddOrModifyScheme)
		self.showSchemeButton.clicked.connect(self.onShowScheme)
		self.deleteSchemeButton.clicked.connect(self.onDeleteScheme)
		self.schemeList.currentItemChanged.connect(self.onSchemeChanged)
		self.filterEdit.textEdited.connect(self.onTextEdited) 
Example #13
Source File: callview.py    From CodeAtlasSublime with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self, parent = None):
		QtWidgets.QScrollArea.__init__(self)
		Ui_CallView.__init__(self)
		self.setupUi(self) 
Example #14
Source File: symbolwindow.py    From CodeAtlasSublime with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self, parent = None):
		QtWidgets.QScrollArea.__init__(self)
		Ui_SymbolWindow.__init__(self)
		self.setupUi(self)
		self.addForbidden.clicked.connect(self.onAddForbidden)
		self.deleteForbidden.clicked.connect(self.onDeleteForbidden)
		self.updateCommentButton.clicked.connect(self.updateComment)
		self.filterEdit.textEdited.connect(self.onTextEdited) 
Example #15
Source File: widgets.py    From corrscope with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self, parent):
        qw.QScrollArea.__init__(self, parent)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.horizontalScrollBar().setEnabled(False)

        # If removed, you will get unused space to the right and bottom.
        self.setWidgetResizable(True)

        # Only allow expanding, not shrinking.
        self.setSizePolicy(qsp(qsp.Minimum, qsp.Minimum)) 
Example #16
Source File: ancillaryDialog.py    From legion with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        self.scaleFactor = 0.0

        self.imageLabel = QtWidgets.QLabel()
        self.imageLabel.setBackgroundRole(QtGui.QPalette.Base)
        self.imageLabel.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
        self.imageLabel.setScaledContents(True)

        self.scrollArea = QtWidgets.QScrollArea()
        self.scrollArea.setBackgroundRole(QtGui.QPalette.Dark)
        self.scrollArea.setWidget(self.imageLabel) 
Example #17
Source File: ScrollMessageBox.py    From Zolver with MIT License 5 votes vote down vote up
def __init__(self, l, *args, **kwargs):
        QMessageBox.__init__(self, *args, **kwargs)
        scroll = QScrollArea(self)
        scroll.setWidgetResizable(True)
        self.setWindowTitle("Zolver Logs")
        self.content = QWidget()
        scroll.setWidget(self.content)
        self.lay = QVBoxLayout(self.content)
        for item in l:
            self.lay.addWidget(QLabel(item, self))
        self.layout().addWidget(scroll, 0, 0, 1, self.layout().columnCount())
        self.setStyleSheet("QScrollArea{min-width:800 px; min-height: 600px}") 
Example #18
Source File: settingsDialog.py    From legion with GNU General Public License v3.0 5 votes vote down vote up
def setupAutoAttacksToolTab(self):
        self.toolNameLabel = QtWidgets.QLabel()
        self.toolNameLabel.setText('Tool')
        self.toolNameLabel.setFixedWidth(150)
        self.toolServicesLabel = QtWidgets.QLabel()
        self.toolServicesLabel.setText('Services')
        self.toolServicesLabel.setFixedWidth(300)
        self.enableAllToolsLabel = QtWidgets.QLabel()
        self.enableAllToolsLabel.setText('Run automatically')
        self.enableAllToolsLabel.setFixedWidth(150)

        self.autoToolTabHorLayout = QtWidgets.QHBoxLayout()
        self.autoToolTabHorLayout.addWidget(self.toolNameLabel)
        self.autoToolTabHorLayout.addWidget(self.toolServicesLabel)
        self.autoToolTabHorLayout.addWidget(self.enableAllToolsLabel)

        self.scrollArea = QtWidgets.QScrollArea()
        self.scrollWidget = QtWidgets.QWidget()

        self.globVerAutoToolsLayout = QtWidgets.QVBoxLayout(self.AutoToolsWidget)
        self.globVerAutoToolsLayout.addLayout(self.autoToolTabHorLayout)

        self.scrollVerLayout = QtWidgets.QVBoxLayout(self.scrollWidget)
        self.enabledSpacer = QSpacerItem(60,0)
        
        # by default the automated attacks are not activated and the tab is not enabled
        self.AutoAttacksSettingsTab.setTabEnabled(1,False)

    # for all the browse buttons 
Example #19
Source File: universal_tool_template_2010.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMsg(self, msg, block=1, ask=0):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            tmpLabel = QtWidgets.QLabel(msg)
            tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
            layout.addWidget(tmpLabel)
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        if ask==0:
            tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        else:
            tmpMsg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
        if block:
            value = tmpMsg.exec_()
            if value == QtWidgets.QMessageBox.Ok:
                return 1
            else:
                return 0
        else:
            tmpMsg.show()
            return 0 
Example #20
Source File: ClassName_1010.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMsg(self, msg, block=1, ask=0):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            tmpLabel = QtWidgets.QLabel(msg)
            tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
            layout.addWidget(tmpLabel)
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        if ask==0:
            tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        else:
            tmpMsg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
        if block:
            value = tmpMsg.exec_()
            if value == QtWidgets.QMessageBox.Ok:
                return 1
            else:
                return 0
        else:
            tmpMsg.show()
            return 0 
Example #21
Source File: universal_tool_template_1116.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMsg(self, msg, block=1, ask=0):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            tmpLabel = QtWidgets.QLabel(msg)
            tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
            layout.addWidget(tmpLabel)
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        if ask==0:
            tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        else:
            tmpMsg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
        if block:
            value = tmpMsg.exec_()
            if value == QtWidgets.QMessageBox.Ok:
                return 1
            else:
                return 0
        else:
            tmpMsg.show()
            return 0 
Example #22
Source File: peakonly.py    From peakonly with MIT License 5 votes vote down vote up
def _init_ui(self):
        # Layouts
        files_layout = QtWidgets.QVBoxLayout()
        files_label = QtWidgets.QLabel(self)
        files_label.setText('Opened files:')
        files_layout.addWidget(files_label)
        files_layout.addWidget(self._list_of_files)

        features_layout = QtWidgets.QVBoxLayout()
        features_label = QtWidgets.QLabel(self)
        features_label.setText('Detected features:')
        features_layout.addWidget(features_label)
        features_layout.addWidget(self._list_of_features)

        canvas_layout = QtWidgets.QVBoxLayout()
        canvas_layout.addWidget(self._toolbar)
        canvas_layout.addWidget(self._canvas)

        canvas_files_features_layout = QtWidgets.QHBoxLayout()
        canvas_files_features_layout.addLayout(files_layout, 15)
        canvas_files_features_layout.addLayout(canvas_layout, 70)
        canvas_files_features_layout.addLayout(features_layout, 15)

        scrollable_pb_list = QtWidgets.QScrollArea()
        scrollable_pb_list.setWidget(self._pb_list)
        scrollable_pb_list.setWidgetResizable(True)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.addLayout(canvas_files_features_layout, 90)
        main_layout.addWidget(scrollable_pb_list, 10)

        widget = QtWidgets.QWidget()
        widget.setLayout(main_layout)

        self.setCentralWidget(widget)

    # Auxiliary methods 
Example #23
Source File: stripper.py    From awesometts-anki-addon with GNU General Public License v3.0 5 votes vote down vote up
def show(self, *args, **kwargs):
        """
        Populate the checkbox list of available fields and initialize
        the introduction message, both based on what is selected.
        """

        self._notes = [
            self._browser.mw.col.getNote(note_id)
            for note_id in self._browser.selectedNotes()
        ]

        self.findChild(Note, 'intro').setText(
            "From the %d note%s selected in the Browser, scan the following "
            "fields:" %
            (len(self._notes), "s" if len(self._notes) != 1 else "")
        )

        layout = QtWidgets.QVBoxLayout()
        for field in sorted({field
                             for note in self._notes
                             for field in note.keys()}):
            checkbox = Checkbox(field)
            checkbox.atts_field_name = field
            layout.addWidget(checkbox)

        panel = QtWidgets.QWidget()
        panel.setLayout(layout)

        self.findChild(QtWidgets.QScrollArea, 'scroll').setWidget(panel)

        (
            self.findChild(
                QtWidgets.QRadioButton,
                self._addon.config['last_strip_mode'],
            )
            or self.findChild(QtWidgets.QRadioButton)  # use first if config bad
        ).setChecked(True)

        super(BrowserStripper, self).show(*args, **kwargs) 
Example #24
Source File: stripper.py    From awesometts-anki-addon with GNU General Public License v3.0 5 votes vote down vote up
def _ui(self):
        """
        Prepares the basic layout structure, including the intro label,
        scroll area, radio buttons, and help/okay/cancel buttons.
        """

        intro = Note()  # see show() for where the text is initialized
        intro.setObjectName('intro')

        scroll = QtWidgets.QScrollArea()
        scroll.setObjectName('scroll')

        layout = super(BrowserStripper, self)._ui()
        layout.addWidget(intro)
        layout.addWidget(scroll)
        layout.addSpacing(self._SPACING)
        layout.addWidget(Label("... and remove the following:"))

        for value, label in [
                (
                    'ours',
                    "only [sound] tags or paths generated by Awesome&TTS",
                ),
                (
                    'theirs',
                    "only [sound] tags &not generated by AwesomeTTS",
                ),
                (
                    'any',
                    "&all [sound] tags, regardless of origin, and paths "
                    "generated by AwesomeTTS",
                ),
        ]:
            radio = QtWidgets.QRadioButton(label)
            radio.setObjectName(value)
            layout.addWidget(radio)

        layout.addWidget(self._ui_buttons())

        return layout 
Example #25
Source File: QtShim.py    From grap with MIT License 5 votes vote down vote up
def get_QScrollArea():
    """QScrollArea getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QScrollArea
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QScrollArea 
Example #26
Source File: prefPFD.py    From pychemqt with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, config=None, parent=None):
        super(Widget, self).__init__(parent)

        lyt = QtWidgets.QGridLayout(self)
        lyt.setContentsMargins(0, 0, 0, 0)
        scroll = QtWidgets.QScrollArea()
        scroll.setFrameStyle(QtWidgets.QFrame.NoFrame)
        lyt.addWidget(scroll)
        dlg = QtWidgets.QWidget()
        layout = QtWidgets.QGridLayout(dlg)

        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Input color")), 1, 1)
        self.ColorButtonEntrada = ColorSelector()
        layout.addWidget(self.ColorButtonEntrada, 1, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output color:")), 2, 1)
        self.ColorButtonSalida = ColorSelector()
        layout.addWidget(self.ColorButtonSalida, 2, 2)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Line format"))
        layout.addWidget(group, 3, 1, 1, 3)
        lyt = QtWidgets.QHBoxLayout(group)
        self.lineFormat = ConfLine()
        lyt.addWidget(self.lineFormat)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "PFD resolution"))
        layout.addWidget(group, 4, 1, 1, 3)
        lyt = QtWidgets.QHBoxLayout(group)
        self.resolution = UI_confResolution.UI_confResolution_widget(config)
        lyt.addWidget(self.resolution)

        layout.addItem(QtWidgets.QSpacerItem(
            10, 0, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 14, 1, 1, 4)
        scroll.setWidget(dlg)

        if config and config.has_section("PFD"):
            self.ColorButtonEntrada.setColor(
                config.get("PFD", 'Color_Entrada'))
            self.ColorButtonSalida.setColor(config.get("PFD", 'Color_Salida'))
            self.lineFormat.ColorButtonLine.setColor(
                config.get("PFD", 'Color_Stream'))
            self.lineFormat.groupJoint.button(
                (config.getint("PFD", 'Union')+2)*-1).setChecked(True)
            self.lineFormat.mitterLimit.setValue(
                config.getfloat("PFD", 'Miter_limit'))
            self.lineFormat.groupCap.button(
                (config.getint("PFD", 'Punta')+2)*-1).setChecked(True)
            self.lineFormat.guion.setCurrentIndex(
                config.getint("PFD", 'Guion'))
            self.lineFormat.dashOffset.setValue(
                config.getfloat("PFD", 'Dash_offset'))
            self.lineFormat.width.setValue(config.getfloat("PFD", 'Width')) 
Example #27
Source File: ui_dialog_code_image.py    From QualCoder with MIT License 4 votes vote down vote up
def setupUi(self, Dialog_code_image):
        Dialog_code_image.setObjectName("Dialog_code_image")
        Dialog_code_image.resize(1021, 715)
        self.gridLayout = QtWidgets.QGridLayout(Dialog_code_image)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalSlider = QtWidgets.QSlider(Dialog_code_image)
        self.horizontalSlider.setMinimum(9)
        self.horizontalSlider.setSingleStep(3)
        self.horizontalSlider.setProperty("value", 99)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setTickPosition(QtWidgets.QSlider.TicksBelow)
        self.horizontalSlider.setTickInterval(10)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.gridLayout.addWidget(self.horizontalSlider, 4, 0, 1, 1)
        self.groupBox_2 = QtWidgets.QGroupBox(Dialog_code_image)
        self.groupBox_2.setMinimumSize(QtCore.QSize(0, 80))
        self.groupBox_2.setMaximumSize(QtCore.QSize(16777215, 80))
        self.groupBox_2.setTitle("")
        self.groupBox_2.setObjectName("groupBox_2")
        self.pushButton_memo = QtWidgets.QPushButton(self.groupBox_2)
        self.pushButton_memo.setGeometry(QtCore.QRect(20, 40, 141, 32))
        self.pushButton_memo.setObjectName("pushButton_memo")
        self.pushButton_select = QtWidgets.QPushButton(self.groupBox_2)
        self.pushButton_select.setGeometry(QtCore.QRect(10, 0, 201, 32))
        self.pushButton_select.setObjectName("pushButton_select")
        self.label_coder = QtWidgets.QLabel(self.groupBox_2)
        self.label_coder.setGeometry(QtCore.QRect(360, 10, 301, 21))
        self.label_coder.setObjectName("label_coder")
        self.checkBox_show_coders = QtWidgets.QCheckBox(self.groupBox_2)
        self.checkBox_show_coders.setGeometry(QtCore.QRect(690, 10, 221, 22))
        self.checkBox_show_coders.setObjectName("checkBox_show_coders")
        self.label_code = QtWidgets.QLabel(self.groupBox_2)
        self.label_code.setGeometry(QtCore.QRect(360, 40, 521, 26))
        self.label_code.setObjectName("label_code")
        self.gridLayout.addWidget(self.groupBox_2, 0, 0, 1, 1)
        self.groupBox = QtWidgets.QGroupBox(Dialog_code_image)
        self.groupBox.setTitle("")
        self.groupBox.setObjectName("groupBox")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setSpacing(0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.splitter = QtWidgets.QSplitter(self.groupBox)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.treeWidget = QtWidgets.QTreeWidget(self.splitter)
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(0, "1")
        self.scrollArea = QtWidgets.QScrollArea(self.splitter)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.graphicsView = QtWidgets.QGraphicsView()
        self.graphicsView.setGeometry(QtCore.QRect(0, 0, 330, 582))
        self.graphicsView.setObjectName("graphicsView")
        self.scrollArea.setWidget(self.graphicsView)
        self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 3, 0, 1, 1)

        self.retranslateUi(Dialog_code_image)
        QtCore.QMetaObject.connectSlotsByName(Dialog_code_image) 
Example #28
Source File: ui_TabMapSpecific.py    From MDT with GNU Lesser General Public License v3.0 4 votes vote down vote up
def setupUi(self, TabMapSpecific):
        TabMapSpecific.setObjectName("TabMapSpecific")
        TabMapSpecific.resize(445, 534)
        self.gridLayout = QtWidgets.QGridLayout(TabMapSpecific)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.scrollArea_2 = QtWidgets.QScrollArea(TabMapSpecific)
        self.scrollArea_2.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.scrollArea_2.setWidgetResizable(True)
        self.scrollArea_2.setObjectName("scrollArea_2")
        self.scrollAreaWidgetContents_2 = QtWidgets.QWidget()
        self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 443, 532))
        self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents_2)
        self.verticalLayout.setContentsMargins(6, 6, 6, 6)
        self.verticalLayout.setSpacing(6)
        self.verticalLayout.setObjectName("verticalLayout")
        self.selectedMap = QtWidgets.QComboBox(self.scrollAreaWidgetContents_2)
        self.selectedMap.setObjectName("selectedMap")
        self.verticalLayout.addWidget(self.selectedMap)
        self.frame = QtWidgets.QFrame(self.scrollAreaWidgetContents_2)
        self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame.setObjectName("frame")
        self.gridLayout_4 = QtWidgets.QGridLayout(self.frame)
        self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_4.setSpacing(0)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.mapSpecificOptionsPosition = QtWidgets.QGridLayout()
        self.mapSpecificOptionsPosition.setSpacing(0)
        self.mapSpecificOptionsPosition.setObjectName("mapSpecificOptionsPosition")
        self.gridLayout_4.addLayout(self.mapSpecificOptionsPosition, 0, 0, 1, 1)
        self.verticalLayout.addWidget(self.frame)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2)
        self.gridLayout.addWidget(self.scrollArea_2, 0, 0, 1, 1)

        self.retranslateUi(TabMapSpecific)
        QtCore.QMetaObject.connectSlotsByName(TabMapSpecific)
        TabMapSpecific.setTabOrder(self.scrollArea_2, self.selectedMap)