Ejemplo n.º 1
0
    def __init__(self, data, parent=None):
        QWidget.__init__(self, parent)
        self.data = data

        vbox = QVBoxLayout()
        self.setLayout(vbox)
        title = QLabel('Indexed Strings')
        vbox.addWidget(title)

        self.frame = QFrame()
        vbox.addWidget(self.frame)
        self.vbox = QVBoxLayout()
        self.frame.setLayout(self.vbox)
        self.frame.setFrameShape(QFrame.Panel)
        self.frame.setFrameShadow(QFrame.Sunken)

        self.table = QTableWidget()
        self.table.horizontalHeader().hide()
        self.vbox.addWidget(self.table)
        self.table.hide()

        self.noStringsLabel = QLabel('<i>No indexed strings</i>')
        self.vbox.addWidget(self.noStringsLabel)

        self.widgets = []
        self.populate()

        self.data.attributeAdded.connect(self.attributeAddedSlot)
        self.data.dataReset.connect(self.dataResetSlot)
        self.data.dirtied.connect(self.dataDirtiedSlot)
Ejemplo n.º 2
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.m_icon = QLabel()
        self.m_title = QLabel()
        self.m_message = QLabel()

        self.notification = None

        self.setWindowFlags(Qt.ToolTip)
        rootLayout = QHBoxLayout(self)

        rootLayout.addWidget(self.m_icon)

        bodyLayout = QVBoxLayout()
        rootLayout.addLayout(bodyLayout)

        titleLayout = QHBoxLayout()
        bodyLayout.addLayout(titleLayout)

        titleLayout.addWidget(self.m_title)
        titleLayout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding))

        close = QPushButton(self.tr("Close"))
        titleLayout.addWidget(close)
        close.clicked.connect(self.onClosed)

        bodyLayout.addWidget(self.m_message)
        self.adjustSize()
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.hue = QSlider()
        self.hue.setMaximum(100)
        self.hue.setOrientation(Qt.Horizontal)
        self.hue.valueChanged.connect(self._changed)

        self.saturation = QSlider()
        self.saturation.setMaximum(100)
        self.saturation.setOrientation(Qt.Horizontal)
        self.saturation.valueChanged.connect(self._changed)

        self.value = QSlider()
        self.value.setMaximum(100)
        self.value.setOrientation(Qt.Horizontal)
        self.value.valueChanged.connect(self._changed)

        layout = QGridLayout(self)
        layout.addWidget(QLabel("H"))
        layout.addWidget(QLabel("S"))
        layout.addWidget(QLabel("V"))
        layout.addWidget(self.hue, 0, 1)
        layout.addWidget(self.saturation, 1, 1)
        layout.addWidget(self.value, 2, 1)
Ejemplo n.º 4
0
    def __init__(self, dock_widget, renamable=False):
        super(DockTitleBar, self).__init__(dock_widget)

        self._renamable = renamable

        main_layout = layouts.HorizontalLayout(margins=(0, 0, 0, 1))
        self.setLayout(main_layout)

        self._buttons_box = QGroupBox('')
        self._buttons_box.setObjectName('Docked')
        self._buttons_layout = layouts.HorizontalLayout(spacing=1, margins=(2, 2, 2, 2))
        self._buttons_box.setLayout(self._buttons_layout)
        main_layout.addWidget(self._buttons_box)

        self._icon_label = QLabel(self)
        self._title_label = QLabel(self)
        self._title_label.setStyleSheet('background: transparent')
        self._title_edit = QLineEdit(self)
        self._title_edit.setVisible(False)

        self._button_size = QSize(14, 14)

        self._dock_btn = QToolButton(self)
        self._dock_btn.setIcon(resources.icon('restore_window', theme='color'))
        self._dock_btn.setMaximumSize(self._button_size)
        self._dock_btn.setAutoRaise(True)
        self._close_btn = QToolButton(self)
        self._close_btn.setIcon(resources.icon('close_window', theme='color'))
        self._close_btn.setMaximumSize(self._button_size)
        self._close_btn.setAutoRaise(True)

        self._buttons_layout.addSpacing(2)
        self._buttons_layout.addWidget(self._icon_label)
        self._buttons_layout.addWidget(self._title_label)
        self._buttons_layout.addWidget(self._title_edit)
        self._buttons_layout.addStretch()
        self._buttons_layout.addSpacing(5)
        self._buttons_layout.addWidget(self._dock_btn)
        self._buttons_layout.addWidget(self._close_btn)

        self._buttons_box.mouseDoubleClickEvent = self.mouseDoubleClickEvent
        self._buttons_box.mousePressEvent = self.mousePressEvent
        self._buttons_box.mouseMoveEvent = self.mouseMoveEvent
        self._buttons_box.mouseReleaseEvent = self.mouseReleaseEvent

        dock_widget.featuresChanged.connect(self._on_dock_features_changed)
        self._title_edit.editingFinished.connect(self._on_finish_edit)
        self._dock_btn.clicked.connect(self._on_dock_btn_clicked)
        self._close_btn.clicked.connect(self._on_close_btn_clicked)

        self._on_dock_features_changed(dock_widget.features())
        self.set_title(dock_widget.windowTitle())
        dock_widget.installEventFilter(self)
        dock_widget.topLevelChanged.connect(self._on_change_floating_style)

        if hasattr(dock_widget, 'icon') and callable(dock_widget.icon):
            self._icon_label.setPixmap(dock_widget.icon().pixmap(QSize(16, 16)))
Ejemplo n.º 5
0
def add_ligand(tool):
    rows = tool.ligand_table.rowCount()
    if rows != 0:
        rows -= 1
        ligand_name = QTableWidgetItem()
        name = "<click to choose>"
        is_c2 = Qt.Unchecked
        enabled = True
        if rows > 0:
            name = tool.ligand_table.item(rows - 1, 0).text()
            is_c2 = tool.ligand_table.cellWidget(rows - 1, 1).layout().itemAt(0).widget().checkState()
            enabled = tool.ligand_table.cellWidget(rows - 1, 1).layout().itemAt(0).widget().isEnabled()

        ligand_name.setData(Qt.DisplayRole, name)
        tool.ligand_table.setItem(rows, 0, ligand_name)
        
        widget_that_lets_me_horizontally_align_a_checkbox = QWidget()
        widget_layout = QHBoxLayout(widget_that_lets_me_horizontally_align_a_checkbox)
        c2 = QCheckBox()
        c2.setEnabled(enabled)
        c2.setCheckState(is_c2)
        widget_layout.addWidget(c2, 0, Qt.AlignHCenter)
        widget_layout.setContentsMargins(0, 0, 0, 0)
        tool.ligand_table.setCellWidget(
            rows, 1, widget_that_lets_me_horizontally_align_a_checkbox
        )
        
        widget_that_lets_me_horizontally_align_an_icon = QWidget()
        widget_layout = QHBoxLayout(widget_that_lets_me_horizontally_align_an_icon)
        section_remove = QLabel()
        dim = int(1.5 * section_remove.fontMetrics().boundingRect("Q").height())
        section_remove.setPixmap(
            QIcon(section_remove.style().standardIcon(
                QStyle.SP_DialogDiscardButton)
            ).pixmap(dim, dim)
        )
        widget_layout.addWidget(section_remove, 0, Qt.AlignHCenter)
        widget_layout.setContentsMargins(0, 0, 0, 0)
        tool.ligand_table.setCellWidget(
            rows, 2, widget_that_lets_me_horizontally_align_an_icon
        )
        rows += 1

    tool.ligand_table.insertRow(rows)

    widget_that_lets_me_horizontally_align_an_icon = QWidget()
    widget_layout = QHBoxLayout(widget_that_lets_me_horizontally_align_an_icon)
    ligand_add = QLabel("add ligand")
    widget_layout.addWidget(ligand_add, 0, Qt.AlignHCenter)
    widget_layout.setContentsMargins(0, 0, 0, 0)
    tool.ligand_table.setCellWidget(rows, 1, widget_that_lets_me_horizontally_align_an_icon)
Ejemplo n.º 6
0
    def ui(self):
        super(BaseSaveWidget, self).ui()

        title_layout = layouts.HorizontalLayout()
        title_layout.setContentsMargins(2, 2, 0, 0)
        title_layout.setSpacing(2)
        self._icon_lbl = QLabel()
        self._icon_lbl.setMaximumSize(QSize(14, 14))
        self._icon_lbl.setMinimumSize(QSize(14, 14))
        self._icon_lbl.setScaledContents(True)
        self._title_lbl = QLabel()
        title_layout.addWidget(self._icon_lbl)
        title_layout.addWidget(self._title_lbl)

        self._folder_widget = directory.SelectFolder('Folder',
                                                     use_app_browser=True)

        buttons_layout = layouts.HorizontalLayout()
        buttons_layout.setContentsMargins(4, 4, 4, 4)
        buttons_layout.setSpacing(4)
        buttons_frame = QFrame()
        buttons_frame.setFrameShape(QFrame.NoFrame)
        buttons_frame.setFrameShadow(QFrame.Plain)
        buttons_frame.setLayout(buttons_layout)
        buttons_layout.addStretch()
        self.save_btn = buttons.BaseButton('Save')
        self.cancel_btn = buttons.BaseButton('Cancel')
        buttons_layout.addWidget(self.save_btn, parent=self)
        buttons_layout.addWidget(self.cancel_btn, parent=self)
        buttons_layout.addStretch()

        self._options_layout = layouts.VerticalLayout()
        self._options_layout.setContentsMargins(0, 0, 0, 0)
        self._options_layout.setSpacing(2)
        self._options_frame = QFrame()
        self._options_frame.setFrameShape(QFrame.NoFrame)
        self._options_frame.setFrameShadow(QFrame.Plain)
        self._options_frame.setLineWidth(0)
        self._options_frame.setLayout(self._options_layout)

        self._extra_layout = layouts.VerticalLayout()
        self._extra_layout.setContentsMargins(0, 0, 0, 0)
        self._extra_layout.setSpacing(2)

        self.main_layout.addLayout(title_layout)
        self.main_layout.addWidget(self._folder_widget)
        self._extra_layout.addWidget(self._options_frame)
        self.main_layout.addWidget(dividers.Divider())
        self.main_layout.addLayout(self._extra_layout)
        self.main_layout.addWidget(dividers.Divider())
        self.main_layout.addWidget(buttons_frame)
Ejemplo n.º 7
0
    def __init__(self, parent: QWidget = None):
        super().__init__(parent)

        self._in = QDataStream()
        self.blockSize = 0

        self.currentFortune = ""

        self.hostLineEdit = QLineEdit("fortune")
        self.getFortuneButton = QPushButton(self.tr("Get Fortune"))
        self.statusLabel = QLabel(
            self.tr(
                "This examples requires that you run the Local Fortune Server example as well."
            )
        )
        self.socket = QLocalSocket()

        self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
        hostLabel = QLabel(self.tr("&Server name:"))
        hostLabel.setBuddy(self.hostLineEdit)

        self.statusLabel.setWordWrap(True)

        self.getFortuneButton.setDefault(True)
        quitButton = QPushButton(self.tr("Quit"))

        buttonBox = QDialogButtonBox()
        buttonBox.addButton(self.getFortuneButton, QDialogButtonBox.ActionRole)
        buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole)

        self._in.setDevice(self.socket)
        self._in.setVersion(QDataStream.Qt_5_10)

        self.hostLineEdit.textChanged.connect(self.enableGetFortuneButton)

        self.getFortuneButton.clicked.connect(self.requestNewFortune)
        quitButton.clicked.connect(self.close)
        self.socket.readyRead.connect(self.readFortune)
        self.socket.errorOccurred.connect(self.displayError)

        mainLayout = QGridLayout(self)
        mainLayout.addWidget(hostLabel, 0, 0)
        mainLayout.addWidget(self.hostLineEdit, 0, 1)
        mainLayout.addWidget(self.statusLabel, 2, 0, 1, 2)
        mainLayout.addWidget(buttonBox, 3, 0, 1, 2)

        self.setWindowTitle(QGuiApplication.applicationDisplayName())
        self.hostLineEdit.setFocus()
Ejemplo n.º 8
0
    def update_sum(self):
        """updates the sum of energy and thermo corrections"""
        self.sum_table.setRowCount(0)

        if not self.sp_table.rowCount():
            return

        sp_nrg = float(self.sp_table.cellWidget(0, 1).text())

        for row in range(0, self.thermo_table.rowCount()):
            self.sum_table.insertRow(row)

            label = self.thermo_table.cellWidget(row, 0)
            tooltip = label.toolTip()
            text = label.text().replace("𝛿", "")
            sum_label = QLabel(text)
            if "href=" in text:
                sum_label = QLabel()
                sum_label.setText(text)
                sum_label.setTextFormat(Qt.RichText)
                sum_label.setTextInteractionFlags(Qt.TextBrowserInteraction)
                sum_label.linkActivated.connect(self.open_link)

            sum_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            sum_label.setToolTip(tooltip)

            self.sum_table.setCellWidget(row, 0, sum_label)

            thermo = float(self.thermo_table.cellWidget(row, 1).text())

            total = sp_nrg + thermo
            total_nrg = SmallLineEdit("%.6f" % total)
            total_nrg.setFrame(False)
            total_nrg.setReadOnly(True)
            total_nrg.setToolTip(tooltip)
            self.sum_table.setCellWidget(row, 1, total_nrg)

            unit_label = ReadOnlyTableItem()
            unit_label.setData(Qt.DisplayRole, "E\u2095")
            unit_label.setTextAlignment(Qt.AlignLeft | Qt.AlignVCenter)
            unit_label.setToolTip(tooltip)
            self.sum_table.setItem(row, 2, unit_label)

            self.sum_table.resizeRowToContents(row)

        self.sum_table.resizeColumnToContents(0)
        self.sum_table.resizeColumnToContents(1)
        self.sum_table.resizeColumnToContents(2)
Ejemplo n.º 9
0
    def __init__(self, rawVariable, variablesWidget, parent=None):
        super(UIVariable, self).__init__(parent)
        self._rawVariable = rawVariable
        self.variablesWidget = variablesWidget
        # ui
        self.horizontalLayout = QHBoxLayout(self)
        self.horizontalLayout.setSpacing(1)
        self.horizontalLayout.setContentsMargins(1, 1, 1, 1)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.widget = TypeWidget(findPinClassByType(self._rawVariable.dataType).color(), self)
        self.widget.setObjectName("widget")
        self.horizontalLayout.addWidget(self.widget)
        self.labelName = QLabel(self)
        self.labelName.setStyleSheet("background:transparent")
        self.labelName.setObjectName("labelName")
        self.horizontalLayout.addWidget(self.labelName)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        # find refs
        self.pbFindRefs = QPushButton("")
        self.pbFindRefs.setIcon(QtGui.QIcon(":/searching-magnifying-glass.png"))
        self.pbFindRefs.setObjectName("pbFindRefs")
        self.horizontalLayout.addWidget(self.pbFindRefs)
        self.pbFindRefs.clicked.connect(self.onFindRefsClicked)
        #  kill variable
        self.pbKill = QPushButton("")
        self.pbKill.setIcon(QtGui.QIcon(":/delete_icon.png"))
        self.pbKill.setObjectName("pbKill")
        self.horizontalLayout.addWidget(self.pbKill)
        self.pbKill.clicked.connect(self.onKillClicked)

        QtCore.QMetaObject.connectSlotsByName(self)
        self.setName(self._rawVariable.name)
        self._rawVariable.setWrapper(self)
Ejemplo n.º 10
0
    def ui(self):
        super(MetaCard, self).ui()

        self._title_layout = layouts.HorizontalLayout()
        self._cover_label = QLabel()
        self._cover_label.setFixedSize(QSize(200, 200))
        self._avatar = avatar.Avatar()
        self._title_label = label.BaseLabel().h4()
        self._description_label = label.BaseLabel().secondary()
        self._description_label.setWordWrap(True)
        self._description_label.theme_elide_mode = Qt.ElideRight
        self._extra_btn = buttons.BaseToolButton(
            parent=self).image('more').icon_only()
        self._title_layout.addWidget(self._title_label)
        self._title_layout.addStretch()
        self._title_layout.addWidget(self._extra_btn)
        self._extra_btn.setVisible(self._extra)

        content_lyt = layouts.FormLayout(margins=(5, 5, 5, 5))
        content_lyt.addRow(self._avatar, self._title_layout)
        content_lyt.addRow(self._description_label)
        self._btn_lyt = layouts.HorizontalLayout()

        self.main_layout.addWidget(self._cover_label)
        self.main_layout.addLayout(content_lyt)
        self.main_layout.addLayout(self._btn_lyt)
        self.main_layout.addStretch()
Ejemplo n.º 11
0
    def _build_ui(self):
        fields = self._entity.fields()
        fields = [
            x for x in fields if x.name not in ('id', 'timestamp', 'username')
        ]

        lyt_buttons = QHBoxLayout()
        lyt_buttons.addWidget(self._btn_create)
        lyt_buttons.addWidget(self._btn_cancel)

        r = 0
        lyt_grid = QGridLayout()
        for field in fields:
            editor = QLineEdit()
            if field.type == int:
                editor = QSpinBox()
                editor.setRange(-1000000, 1000000)
            self._wdg_map[field] = editor
            lyt_grid.addWidget(QLabel(field.name), r, 0)
            lyt_grid.addWidget(editor, r, 1)
            r += 1

        lyt_main = QVBoxLayout()
        lyt_main.addLayout(lyt_grid)
        lyt_main.addLayout(lyt_buttons)

        self.setLayout(lyt_main)
Ejemplo n.º 12
0
def main():
    import sys

    app = QApplication(sys.argv)

    layout = QVBoxLayout()

    infos = QSerialPortInfo.availablePorts()
    for info in infos:
        s = (
            f"Port: {info.portName()}",
            f"Location: {info.systemLocation()}",
            f"Description: {info.description()}",
            f"Manufacturer: {info.manufacturer()}",
            f"Serial number: {info.serialNumber()}",
            "Vendor Identifier: " + f"{info.vendorIdentifier():x}"
            if info.hasVendorIdentifier()
            else "",
            "Product Identifier: " + f"{info.productIdentifier():x}"
            if info.hasProductIdentifier()
            else "",
        )
        label = QLabel("\n".join(s))
        layout.addWidget(label)

    workPage = QWidget()
    workPage.setLayout(layout)

    area = QScrollArea()
    area.setWindowTitle("Info about all available serial ports.")
    area.setWidget(workPage)
    area.show()

    sys.exit(app.exec_())
Ejemplo n.º 13
0
	def addWidgets(self):
		uiRotationLAY = self.uiTrackedRotationGRP.layout()
		
		for i in xrange(2, self.count("Rail")+1):
			uiLabel = QLabel("Slider {}".format(i))
			
			uiMinRot = self._addQDoubleSpinBox(-180.0, 180.0, 15.0)
			uiMaxRot = self._addQDoubleSpinBox(-180.0, 180.0, 15.0)
			
			uiAxis = QComboBox()
			uiAxis.addItems(["X","Y","Z"])

			uiSelect = QPushButton("Select")
			uiSet = QPushButton("Set")
			
			uiRotationLAY.addWidget(uiLabel, i, 0)
			uiRotationLAY.addWidget(uiMinRot, i, 1)
			uiRotationLAY.addWidget(uiMaxRot, i, 2)
			uiRotationLAY.addWidget(uiAxis, i, 3)
			uiRotationLAY.addWidget(uiSelect, i, 4)
			uiRotationLAY.addWidget(uiSet, i, 5)
			
			self.__dict__["uiMinRot{}".format(i)] = uiMinRot
			self.__dict__["uiMaxRot{}".format(i)] = uiMaxRot
			self.__dict__["uiAxis{}".format(i)] = uiAxis
			self.__dict__["uiSelect{}".format(i)] = uiSelect
			self.__dict__["uiSet{}".format(i)] = uiSet
Ejemplo n.º 14
0
    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)
        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        toolBar = QToolBar()
        toolBar.addAction(backAction)
        toolBar.addAction(homeAction)
        toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()

        layout = QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

        backAction.triggered.connect(self.tbackward)
        homeAction.triggered.connect(self.thome)
        self.textBrowser.sourceChanged.connect(self.updatePageTitle)

        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle("{0} Help".format(QApplication.applicationName()))
Ejemplo n.º 15
0
    def create(self, delete_if_exists=True):
        """
        Creates a new shelf
        """

        if delete_if_exists:
            if gui.shelf_exists(shelf_name=self._name):
                gui.delete_shelf(shelf_name=self._name)
        else:
            assert not gui.shelf_exists(self._name), 'Shelf with name {} already exists!'.format(self._name)

        self._name = gui.create_shelf(name=self._name)

        # ========================================================================================================

        self._category_btn = QPushButton('')
        if self._category_icon:
            self._category_btn.setIcon(self._category_icon)
        self._category_btn.setIconSize(QSize(18, 18))
        self._category_menu = QMenu(self._category_btn)
        self._category_btn.setStyleSheet(
            'QPushButton::menu-indicator {image: url(myindicator.png);'
            'subcontrol-position: right center;subcontrol-origin: padding;left: -2px;}')
        self._category_btn.setMenu(self._category_menu)
        self._category_lbl = QLabel('MAIN')
        self._category_lbl.setAlignment(Qt.AlignCenter)
        font = self._category_lbl.font()
        font.setPointSize(6)
        self._category_lbl.setFont(font)
        menu_ptr = maya.OpenMayaUI.MQtUtil.findControl(self._name)
        menu_widget = qtutils.wrapinstance(menu_ptr, QWidget)
        menu_widget.layout().addWidget(self._category_btn)
        menu_widget.layout().addWidget(self._category_lbl)

        self.add_separator()
Ejemplo n.º 16
0
    def ui(self):

        self.color_buttons = list()

        super(BaseColorDialog, self).ui()

        grid_layout = layouts.GridLayout()
        grid_layout.setAlignment(Qt.AlignTop)
        self.main_layout.addLayout(grid_layout)
        color_index = 0
        for i in range(0, 4):
            for j in range(0, 8):
                color_btn = QPushButton()
                color_btn.setMinimumHeight(35)
                color_btn.setMinimumWidth(35)
                self.color_buttons.append(color_btn)
                color_btn.setStyleSheet(
                    'background-color:rgb(%s,%s,%s);' %
                    (self.maya_colors[color_index][0] * 255,
                     self.maya_colors[color_index][1] * 255,
                     self.maya_colors[color_index][2] * 255))
                grid_layout.addWidget(color_btn, i, j)
                color_index += 1
        selected_color_layout = layouts.HorizontalLayout()
        self.main_layout.addLayout(selected_color_layout)
        self.color_slider = QSlider(Qt.Horizontal)
        self.color_slider.setMinimum(0)
        self.color_slider.setMaximum(31)
        self.color_slider.setValue(2)
        self.color_slider.setStyleSheet(
            "QSlider::groove:horizontal {border: 1px solid #999999;height: 25px; /* the groove expands "
            "to the size of the slider by default. by giving it a height, it has a fixed size */background: "
            "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);margin: 2px 0;}"
            "QSlider::handle:horizontal {background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4,"
            " stop:1 #8f8f8f);border: 1px solid #5c5c5c;width: 10px;margin: -2px 0; /* handle is placed by "
            "default on the contents rect of the groove. Expand outside the groove */border-radius: 1px;}"
        )
        selected_color_layout.addWidget(self.color_slider)

        color_label_layout = layouts.HorizontalLayout(margins=(10, 10, 10, 10))
        self.main_layout.addLayout(color_label_layout)

        self.color_lbl = QLabel()
        self.color_lbl.setStyleSheet(
            "border: 1px solid black; background-color:rgb(0, 0, 0);")
        self.color_lbl.setMinimumWidth(45)
        self.color_lbl.setMaximumWidth(80)
        self.color_lbl.setMinimumHeight(80)
        self.color_lbl.setAlignment(Qt.AlignCenter)
        color_label_layout.addWidget(self.color_lbl)

        bottom_layout = layouts.HorizontalLayout()
        bottom_layout.setAlignment(Qt.AlignRight)
        self.main_layout.addLayout(bottom_layout)

        self.ok_btn = QPushButton('Ok')
        self.cancel_btn = QPushButton('Cancel')
        bottom_layout.addLayout(dividers.DividerLayout())
        bottom_layout.addWidget(self.ok_btn)
        bottom_layout.addWidget(self.cancel_btn)
Ejemplo n.º 17
0
    def add_files(self, filenames):
        """add filenames (list(str)) to the table"""
        for f in filenames:
            row = self.table.rowCount()
            self.table.insertRow(row)

            file_item = QTableWidgetItem()
            file_item.setData(Qt.DisplayRole, f)
            self.table.setItem(row, 0, file_item)

            widget_that_lets_me_horizontally_align_an_icon = QWidget()
            widget_layout = QHBoxLayout(
                widget_that_lets_me_horizontally_align_an_icon)
            section_remove = QLabel()
            dim = int(1.5 *
                      section_remove.fontMetrics().boundingRect("Z").height())
            section_remove.setPixmap(
                QIcon(section_remove.style().standardIcon(
                    QStyle.SP_DialogDiscardButton)).pixmap(dim, dim))
            widget_layout.addWidget(section_remove, 0, Qt.AlignHCenter)
            widget_layout.setContentsMargins(0, 0, 0, 0)
            self.table.setCellWidget(
                row, 1, widget_that_lets_me_horizontally_align_an_icon)

        self.add_last_row()
Ejemplo n.º 18
0
    def set_sp(self):
        """set energy entry for when sp model changes"""
        self.sp_table.setRowCount(0)
        if self.sp_selector.currentIndex() >= 0:
            fr = self.sp_selector.currentData()

            self.check_geometry_rmsd("SP")

            self.sp_table.insertRow(0)

            nrg_label = QLabel("E =")
            nrg_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            self.sp_table.setCellWidget(0, 0, nrg_label)

            unit_label = ReadOnlyTableItem()
            unit_label.setData(Qt.DisplayRole, "E\u2095")
            unit_label.setTextAlignment(Qt.AlignLeft | Qt.AlignVCenter)
            self.sp_table.setItem(0, 2, unit_label)

            sp_nrg = SmallLineEdit("%.6f" % fr.other['energy'])
            sp_nrg.setReadOnly(True)
            sp_nrg.setFrame(False)
            self.sp_table.setCellWidget(0, 1, sp_nrg)

            self.sp_table.resizeRowToContents(0)
            self.sp_table.resizeColumnToContents(0)
            self.sp_table.resizeColumnToContents(1)
            self.sp_table.resizeColumnToContents(2)

        self.update_sum()
Ejemplo n.º 19
0
 def __init__(self, raw_node):
     super(UIStreamPreviewNode, self).__init__(raw_node)
     self.resizable = True
     self.Imagelabel = QLabel("")
     self.pixmap = QtGui.QPixmap(None)
     self.addWidget(self.Imagelabel)
     self.updateSize()
Ejemplo n.º 20
0
 def __init__(self, raw_node):
     super(UIOpenCvBaseNode, self).__init__(raw_node)
     self.imagePin = self._rawNode.getPinByName("img")
     if not self.imagePin:
         for pin in self._rawNode.outputs.values():
             if pin.dataType == "ImagePin":
                 self.imagePin = pin
                 break
     if self.imagePin:
         self.actionViewImage = self._menu.addAction("ViewImage")
         self.actionViewImage.triggered.connect(self.viewImage)
         self.actionViewImage.setData(
             NodeActionButtonInfo(
                 os.path.dirname(__file__) + "/resources/ojo.svg",
                 ViewImageNodeActionButton))
         self.actionRefreshImage = self._menu.addAction(
             "RefreshCurrentNode")
         self.actionRefreshImage.triggered.connect(self.refreshImage)
         self.actionRefreshImage.setData(
             NodeActionButtonInfo(
                 os.path.dirname(__file__) + "/resources/reload.svg",
                 NodeActionButtonBase))
     self.displayImage = False
     self.resizable = True
     self.Imagelabel = QLabel("noImage")
     self.pixmap = QtGui.QPixmap()
     self.addWidget(self.Imagelabel)
     self.Imagelabel.setVisible(False)
     self.updateSize()
     self._rawNode.computed.connect(self.updateImage)
Ejemplo n.º 21
0
    def _build_ui(self):
        self._thumb_size.setRange(100, 400)
        self._thumb_size.setValue(settings.thumb_size)
        self._thumb_size.setOrientation(Qt.Horizontal)
        self._thumb_size.setFixedWidth(300)

        lyt_main = QHBoxLayout()
        lyt_main.setContentsMargins(0, 0, 0, 0)
        lyt_main.setSpacing(0)
        lyt_main.addStretch()
        lyt_main.addWidget(QLabel('%d %%' % self._thumb_size.minimum()))
        lyt_main.addSpacing(5)
        lyt_main.addWidget(self._thumb_size)
        lyt_main.addSpacing(5)
        lyt_main.addWidget(QLabel('%d %%' % self._thumb_size.maximum()))
        self.setLayout(lyt_main)
Ejemplo n.º 22
0
    def __init__(self, session, isolde, main_frame, category_grid,
                 region_table, bottom_layout, update_button):
        super().__init__(session, isolde, main_frame, sim_sensitive=True)
        from Qt.QtCore import Qt
        self._data_role = Qt.ItemDataRole.UserRole
        cg = self.category_grid = category_grid
        rt = self.region_table = region_table
        rt.itemClicked.connect(self.item_clicked_cb)
        self.update_button = update_button
        update_button.clicked.connect(self.update)

        from .problems import ProblemAggregator
        pa = self.problem_aggregator = ProblemAggregator(session)
        from Qt.QtWidgets import QCheckBox, QLabel, QSpinBox, QDoubleSpinBox, QLabel
        cg.addWidget(QLabel("Unsatisfied restraints"), 0, 0)
        cg.addWidget(QLabel("Validation issues"), 0, 1)
        ocb = self.outliers_only_checkbox = QCheckBox("Outliers only")
        cg.addWidget(ocb, 0, 2)

        self.restraint_checkboxes = []
        for i, name in enumerate(pa.registered_restraint_problem_types):
            cb = QCheckBox(name)
            cb.setChecked(True)
            self.restraint_checkboxes.append(cb)
            cg.addWidget(cb, i + 1, 0)

        self.validation_checkboxes = []
        for i, name in enumerate(pa.registered_validation_problem_types):
            cb = QCheckBox(name)
            cb.setChecked(True)
            self.validation_checkboxes.append(cb)
            cg.addWidget(cb, i + 1, 1)

        csb = self.cutoff_spinbox = QDoubleSpinBox(main_frame)
        csbl = QLabel("Dist cutoff")
        csb.setRange(1.0, 10.0)
        csb.setSingleStep(1.0)
        csb.setValue(4.0)
        bottom_layout.insertWidget(0, csb)
        bottom_layout.insertWidget(1, csbl)

        clsb = self.cluster_spinbox = QSpinBox(main_frame)
        clsbl = QLabel("Min cluster size")
        clsb.setRange(2, 20)
        clsb.setValue(5)
        bottom_layout.insertWidget(2, clsb)
        bottom_layout.insertWidget(3, clsbl)
Ejemplo n.º 23
0
    def onUpdatePropertyView(self, formLayout):
        # name
        le_name = QLineEdit(self.getName())
        le_name.setReadOnly(True)
        if self.label().IsRenamable():
            le_name.setReadOnly(False)
            le_name.returnPressed.connect(lambda: self.setName(le_name.text()))
        formLayout.addRow("Name", le_name)

        # uid
        leUid = QLineEdit(str(self.uid))
        leUid.setReadOnly(True)
        #formLayout.addRow("Uuid", leUid)

        # type
        leType = QLineEdit(self.__class__.__name__)
        leType.setReadOnly(True)
        formLayout.addRow("Type", leType)

        # pos
        #le_pos = QLineEdit("{0} x {1}".format(self.pos().x(), self.pos().y()))
        #formLayout.addRow("Pos", le_pos)

        # inputs
        if len([i for i in self.inputs.values()]) != 0:
            for inp in self.inputs.values():
                dataSetter = inp.call if inp.dataType == DataTypes.Exec else inp.setData
                if not inp.hasConnections():
                    w = getInputWidget(inp.dataType, dataSetter,
                                       inp.defaultValue(), inp.getUserStruct())
                    if w:
                        w.setWidgetValue(inp.currentData())
                        w.setObjectName(inp.getName())
                        formLayout.addRow(inp.name, w)
                        if inp.hasConnections():
                            w.setEnabled(False)
                            w.hide()
        if self.asGraphSides:
            # outputs

            if len([i for i in self.outputs.values()]) != 0:
                for out in self.outputs.values():
                    dataSetter = out.call if out.dataType == DataTypes.Exec else out.setData
                    w = getInputWidget(out.dataType, dataSetter,
                                       out.defaultValue(), out.getUserStruct())
                    if w:
                        w.setWidgetValue(out.currentData())
                        w.setObjectName(out.getName())
                        formLayout.addRow(out.name, w)
                        if out.hasConnections():
                            w.setEnabled(True)

        doc_lb = QLabel()
        doc_lb.setStyleSheet("background-color: black;")
        doc_lb.setText("Description")
        #formLayout.addRow("", doc_lb)
        doc = QTextBrowser()
        doc.setOpenExternalLinks(True)
        doc.setHtml(self.description())
Ejemplo n.º 24
0
 def __init__(self, raw_node):
     super(UIQimageDisplay, self).__init__(raw_node)
     self.resizable = True
     self.Imagelabel = QLabel("test3")
     self.pixmap = QtGui.QPixmap(RESOURCES_DIR + "/wizard-cat.png")
     self.addWidget(self.Imagelabel)
     self.updateSize()
     self._rawNode.loadImage.connect(self.onLoadImage)
Ejemplo n.º 25
0
def _setup_login_dialog(dialog, account_input, password_input):
    dialog.setWindowTitle('登录CGTeamWork')
    account_input.setPlaceholderText('CGTeamwork账号名')
    password_input.setPlaceholderText('密码')
    password_input.setEchoMode(QLineEdit.Password)

    ok_button = QPushButton('登录')
    ok_button.setDefault(True)
    ok_button.clicked.connect(dialog.accept)

    layout = QVBoxLayout(dialog)
    layout.addWidget(QLabel('帐号'))
    layout.addWidget(account_input)
    layout.addWidget(QLabel('密码'))
    layout.addWidget(password_input)
    layout.addWidget(ok_button)
    dialog.setLayout(layout)
Ejemplo n.º 26
0
    def add_label_from_constructed(self):
        label = QLabel(self._constructed)
        label.setOpenExternalLinks(True)
        label.setWordWrap(True)
        label.setFont(self._font)
        self._constructed = ''

        self._widgets.append(label)
Ejemplo n.º 27
0
    def __init__(self, id_, items, parent=None):
        super().__init__(parent)

        itemLabel = QLabel(self.tr("Item: "))
        descriptionLabel = QLabel(self.tr("Description: "))
        imageFileLabel = QLabel(self.tr("Image file: "))

        self.createButtons()

        self.itemText = QLabel()
        self.descriptionEditor = QTextEdit()

        self.imageFileEditor = QComboBox()
        self.imageFileEditor.setModel(items.relationModel(1))
        self.imageFileEditor.setModelColumn(
            items.relationModel(1).fieldIndex("file"))

        self.mapper = QDataWidgetMapper(self)
        self.mapper.setModel(items)
        self.mapper.setSubmitPolicy(QDataWidgetMapper.ManualSubmit)
        self.mapper.setItemDelegate(QSqlRelationalDelegate(self.mapper))
        self.mapper.addMapping(self.imageFileEditor, 1)
        self.mapper.addMapping(self.itemText, 2, b"text")
        self.mapper.addMapping(self.descriptionEditor, 3)
        self.mapper.setCurrentIndex(id_)

        self.descriptionEditor.textChanged.connect(self.enableButtons)
        self.imageFileEditor.currentIndexChanged.connect(self.enableButtons)

        formLayout = QFormLayout()
        formLayout.addRow(itemLabel, self.itemText)
        formLayout.addRow(imageFileLabel, self.imageFileEditor)
        formLayout.addRow(descriptionLabel, self.descriptionEditor)

        layout = QVBoxLayout()
        layout.addLayout(formLayout)
        layout.addWidget(self.buttonBox)
        self.setLayout(layout)

        self.itemId = id_
        self.displayedImage = self.imageFileEditor.currentText()

        self.setWindowFlags(Qt.Window)
        self.enableButtons(False)
        self.setWindowTitle(self.itemText.text())
Ejemplo n.º 28
0
Archivo: qt.py Proyecto: WuLiFang/cgtwq
def _setup_login_dialog(dialog, account_input, password_input):
    # type: (Any, Any, Any) -> None
    dialog.setWindowTitle("登录CGTeamWork")
    account_input.setPlaceholderText("CGTeamwork账号名")
    password_input.setPlaceholderText("密码")
    password_input.setEchoMode(QLineEdit.Password)

    ok_button = QPushButton("登录")
    ok_button.setDefault(True)
    ok_button.clicked.connect(dialog.accept)

    layout = QVBoxLayout(dialog)
    layout.addWidget(QLabel("帐号"))
    layout.addWidget(account_input)
    layout.addWidget(QLabel("密码"))
    layout.addWidget(password_input)
    layout.addWidget(ok_button)
    dialog.setLayout(layout)
Ejemplo n.º 29
0
 def __init__(self):
     QWidget.__init__(self)
     self.setWindowTitle('Simple')
     self.verticalLayout = QtWidgets.QVBoxLayout(self)
     self.verticalLayout.setObjectName("verticalLayout")
     self.label = QLabel("Hello World.\nUsing Qt binding %s" %
                         Qt.Qt.__binding__)
     self.verticalLayout.addWidget(self.label)
     self.pushButton = QPushButton('Button', self)
     self.verticalLayout.addWidget(self.pushButton)
Ejemplo n.º 30
0
    def __init__(self, parent=None, singleSelect=False):
        super().__init__(parent)

        layout = QGridLayout(self)

        self.table = QTableWidget()

        self.table.setColumnCount(3)
        self.table.setHorizontalHeaderLabels(
            ['name', 'conformers', 'conf. angle'])

        self.add_subs()

        for i in range(0, 3):
            self.table.resizeColumnToContents(i)

        self.table.horizontalHeader().setStretchLastSection(False)
        self.table.horizontalHeader().setSectionResizeMode(
            0, QHeaderView.Fixed)
        self.table.horizontalHeader().setSectionResizeMode(
            1, QHeaderView.Fixed)
        self.table.horizontalHeader().setSectionResizeMode(
            2, QHeaderView.Stretch)

        self.table.setSortingEnabled(True)
        self.table.setSelectionBehavior(QTableWidget.SelectRows)
        if singleSelect:
            self.table.setSelectionMode(QTableWidget.SingleSelection)
        self.table.setEditTriggers(QTableWidget.NoEditTriggers)

        self.filterEdit = QLineEdit()
        self.filterEdit.textChanged.connect(self.apply_filter)
        self.filterEdit.setClearButtonEnabled(True)

        self.filter_columns = QComboBox()
        self.filter_columns.addItem("name")
        self.filter_columns.addItem("conformers")
        self.filter_columns.addItem("conf. angle")
        self.filter_columns.currentTextChanged.connect(
            self.change_filter_method)

        self.name_regex_option = QComboBox()
        self.name_regex_option.addItem("case-insensitive")
        self.name_regex_option.addItem("case-sensitive")
        self.name_regex_option.currentTextChanged.connect(self.apply_filter)
        self.name_regex_option.setVisible(
            self.filter_columns.currentText() == "name")

        layout.addWidget(self.table, 0, 0, 1, 4)
        layout.addWidget(QLabel("filter based on"), 1, 0)
        layout.addWidget(self.filter_columns, 1, 1)
        layout.addWidget(self.name_regex_option, 1, 2)
        layout.addWidget(self.filterEdit, 1, 3)

        self.change_filter_method("name")