コード例 #1
0
    def __init__(self):
        QWidget.__init__(self)

        self.model = CustomTableModel()

        self.table_view = QTableView()
        self.table_view.setModel(self.model)
        self.table_view.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)
        self.table_view.verticalHeader().setSectionResizeMode(
            QHeaderView.Stretch)

        self.chart = QtCharts.QChart()
        self.chart.setAnimationOptions(QtCharts.QChart.AllAnimations)

        self.series = QtCharts.QLineSeries()
        self.series.setName("Line 1")
        self.mapper = QtCharts.QVXYModelMapper(self)
        self.mapper.setXColumn(0)
        self.mapper.setYColumn(1)
        self.mapper.setSeries(self.series)
        self.mapper.setModel(self.model)
        self.chart.addSeries(self.series)

        # for storing color hex from the series
        seriesColorHex = "#000000"

        # get the color of the series and use it for showing the mapped area
        seriesColorHex = "{}".format(self.series.pen().color().name())
        self.model.add_mapping(seriesColorHex,
                               QRect(0, 0, 2, self.model.rowCount()))

        # series 2
        self.series = QtCharts.QLineSeries()
        self.series.setName("Line 2")

        self.mapper = QtCharts.QVXYModelMapper(self)
        self.mapper.setXColumn(2)
        self.mapper.setYColumn(3)
        self.mapper.setSeries(self.series)
        self.mapper.setModel(self.model)
        self.chart.addSeries(self.series)

        # get the color of the series and use it for showing the mapped area
        seriesColorHex = "{}".format(self.series.pen().color().name())
        self.model.add_mapping(seriesColorHex,
                               QRect(2, 0, 2, self.model.rowCount()))

        self.chart.createDefaultAxes()
        self.chart_view = QtCharts.QChartView(self.chart)
        self.chart_view.setRenderHint(QPainter.Antialiasing)
        self.chart_view.setMinimumSize(640, 480)

        # create main layout
        self.main_layout = QGridLayout()
        self.main_layout.addWidget(self.table_view, 1, 0)
        self.main_layout.addWidget(self.chart_view, 1, 1)
        self.main_layout.setColumnStretch(1, 1)
        self.main_layout.setColumnStretch(0, 0)
        self.setLayout(self.main_layout)
コード例 #2
0
ファイル: sidemenu.py プロジェクト: dryerem/SideMenu
    def paint(self, painter, option, index):
        super(Delegate, self).paint(painter, option, index)

        # HOVER
        if option.state & QStyle.State_MouseOver:
            painter.fillRect(option.rect, QColor("#F1F1F1"))
        else:
            painter.fillRect(option.rect, Qt.transparent)

        # SELECTED
        if option.state & QStyle.State_Selected:
            painter.fillRect(option.rect, QColor("#F1F1F1"))

        # DRAW ICON
        icon = QPixmap()
        icon.load(index.data()[1])
        icon = icon.scaled(24, 24, Qt.IgnoreAspectRatio,
                           Qt.SmoothTransformation)

        left = 24  # margin left
        icon_pos = QRect(left, ((self._height - icon.height()) / 2) +
                         option.rect.y(), icon.width(), icon.height())
        painter.setRenderHint(QPainter.Antialiasing)
        painter.setRenderHint(QPainter.SmoothPixmapTransform)
        painter.drawPixmap(icon_pos, icon)

        # DRAW TEXT
        font = QFont("Roboto Black", 12)
        text_pos = QRect((left * 2) + icon.width(), option.rect.y(),
                         option.rect.width(), option.rect.height())
        painter.setFont(font)
        painter.setPen(Qt.black)
        painter.drawText(text_pos, Qt.AlignVCenter, index.data()[0])
コード例 #3
0
    def paintEvent(self, event):
        rect = QRect(10, 20, 80, 60)

        path = QPainterPath()
        path.moveTo(20, 80)
        path.lineTo(20, 30)
        path.cubicTo(80, 0, 50, 50, 80, 80)

        startAngle = 30 * 16
        arcLength = 120 * 16

        painter = QPainter(self)
        painter.setPen(self.pen)
        painter.setBrush(self.brush)
        if self.antialiased:
            painter.setRenderHint(QPainter.Antialiasing)

        for x in range(0, self.width(), 100):
            for y in range(0, self.height(), 100):
                painter.save()
                painter.translate(x, y)
                if self.transformed:
                    painter.translate(50, 50)
                    painter.rotate(60.0)
                    painter.scale(0.6, 0.9)
                    painter.translate(-50, -50)

                if self.shape == RenderArea.Line:
                    painter.drawLine(rect.bottomLeft(), rect.topRight())
                elif self.shape == RenderArea.Points:
                    painter.drawPoints(RenderArea.points)
                elif self.shape == RenderArea.Polyline:
                    painter.drawPolyline(RenderArea.points)
                elif self.shape == RenderArea.Polygon:
                    painter.drawPolygon(RenderArea.points)
                elif self.shape == RenderArea.Rect:
                    painter.drawRect(rect)
                elif self.shape == RenderArea.RoundedRect:
                    painter.drawRoundedRect(rect, 25, 25, Qt.RelativeSize)
                elif self.shape == RenderArea.Ellipse:
                    painter.drawEllipse(rect)
                elif self.shape == RenderArea.Arc:
                    painter.drawArc(rect, startAngle, arcLength)
                elif self.shape == RenderArea.Chord:
                    painter.drawChord(rect, startAngle, arcLength)
                elif self.shape == RenderArea.Pie:
                    painter.drawPie(rect, startAngle, arcLength)
                elif self.shape == RenderArea.Path:
                    painter.drawPath(path)
                elif self.shape == RenderArea.Text:
                    painter.drawText(rect, Qt.AlignCenter,
                                     "PySide 2\nQt %s" % qVersion())
                elif self.shape == RenderArea.Pixmap:
                    painter.drawPixmap(10, 10, self.pixmap)

                painter.restore()

        painter.setPen(self.palette().dark().color())
        painter.setBrush(Qt.NoBrush)
        painter.drawRect(QRect(0, 0, self.width() - 1, self.height() - 1))
コード例 #4
0
ファイル: addinidialog.py プロジェクト: bleck9999/frii-config
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(480, 150)
        self.buttonBox = QDialogButtonBox(Dialog)
        self.buttonBox.setObjectName(u"buttonBox")
        self.buttonBox.setGeometry(QRect(0, 100, 461, 32))
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Apply|QDialogButtonBox.Cancel)
        self.label = QLabel(Dialog)
        self.label.setObjectName(u"label")
        self.label.setGeometry(QRect(10, 20, 81, 16))
        self.label_2 = QLabel(Dialog)
        self.label_2.setObjectName(u"label_2")
        self.label_2.setGeometry(QRect(240, 20, 57, 14))
        self.key = QLineEdit(Dialog)
        self.key.setObjectName(u"key")
        self.key.setGeometry(QRect(10, 40, 211, 22))
        font = QFont()
        font.setFamilies([u"Monospace"])
        self.key.setFont(font)
        self.val = QLineEdit(Dialog)
        self.val.setObjectName(u"val")
        self.val.setGeometry(QRect(240, 40, 211, 22))
        font1 = QFont()
        self.val.setFont(font1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)

        QMetaObject.connectSlotsByName(Dialog)
コード例 #5
0
    def __init__(self, parent, persepolis_setting):
        super().__init__(parent)

        self.persepolis_setting = persepolis_setting

        # set ui direction
        ui_direction = self.persepolis_setting.value('ui_direction')

        if ui_direction == 'rtl':
            self.setLayoutDirection(Qt.RightToLeft)

        elif ui_direction in 'ltr':
            self.setLayoutDirection(Qt.LeftToRight)

        # set size
        self.resize(QSize(400, 80))
        self.setFixedWidth(400)

        # show this widget as ToolTip widget
        self.setWindowFlags(Qt.ToolTip)

        # find bottom right position
        bottom_right_screen = QDesktopWidget().availableGeometry().bottomRight(
        )

        bottom_right_notification = QRect(QPoint(0, 0), QSize(410, 120))
        bottom_right_notification.moveBottomRight(bottom_right_screen)
        self.move(bottom_right_notification.topLeft())

        # get persepolis icon path
        icons = ':/' + \
            str(self.persepolis_setting.value('settings/icons')) + '/'

        notification_horizontalLayout = QHBoxLayout(self)

        # persepolis icon
        svgWidget = QtSvg.QSvgWidget(':/persepolis.svg')
        svgWidget.setFixedSize(QSize(64, 64))

        notification_horizontalLayout.addWidget(svgWidget)

        notification_verticalLayout = QVBoxLayout()

        # 2 labels for notification messages
        self.label1 = QLabel(self)
        self.label1.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label1.setStyleSheet("font-weight: bold")
        self.label1.setWordWrap(True)

        self.label2 = QLabel(self)
        self.label2.setWordWrap(True)
        self.label2.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)

        notification_verticalLayout.addWidget(self.label1)
        notification_verticalLayout.addWidget(self.label2)
        notification_horizontalLayout.addLayout(notification_verticalLayout)
コード例 #6
0
 def DrawBottom(self, Painter, Options, items):
     Rect = Options.rect
     Width = round((Rect.width() - 72) / 3)
     # 1
     TempRec = QRect(Rect.x() + 64, Rect.y() + 44, Width, 16)
     Painter.drawText(TempRec, items[0])
     # 2
     TempRec = QRect(Rect.x() + (64 + Width + 4), Rect.y() + 44, Width, 16)
     Painter.drawText(TempRec, items[1])
     # 3
     TempRec = QRect(Rect.x() + (64 + Width + 4 + Width + 4), Rect.y() + 44, Width - 4, 16)
     Painter.drawText(TempRec, items[2])
コード例 #7
0
ファイル: gui_about.py プロジェクト: space9bug/PyDebloatX
    def setupUi(self):
        self.centralwidget = QWidget(self)
        with open(resource_path('style.css'), 'r') as file:
            self.centralwidget.setStyleSheet(file.read())
        self.layout_widget_about = QWidget(self.centralwidget)
        self.layout_widget_about.setGeometry(QRect(10, 10, 221, 81))
        self.layout_about = QVBoxLayout(self.layout_widget_about)
        self.layout_about.setContentsMargins(0, 0, 0, 0)

        self.label_logo = QLabel(self.layout_widget_about)
        self.pixmap = QPixmap(resource_path('icon.ico'))
        self.pixmap = self.pixmap.scaledToWidth(30, Qt.SmoothTransformation)
        self.label_logo.setPixmap(self.pixmap)
        self.layout_about.addWidget(self.label_logo, 0, Qt.AlignHCenter)

        self.title_font = QFont()
        self.title_font.setPointSize(13)
        self.font = QFont()
        self.font.setPointSize(10)

        self.label_title = QLabel(self.layout_widget_about)
        self.title_font.setStyleStrategy(QFont.PreferAntialias)
        self.label_title.setFont(self.title_font)
        self.label_title.setLayoutDirection(Qt.LeftToRight)
        self.layout_about.addWidget(self.label_title, 0, Qt.AlignHCenter)

        self.label_version = QLabel(self.layout_widget_about)
        self.label_version.setFont(self.font)
        self.label_version.setLayoutDirection(Qt.LeftToRight)
        self.layout_about.addWidget(self.label_version, 0, Qt.AlignHCenter)

        self.layout_widget_about_2 = QWidget(self.centralwidget)
        self.layout_widget_about_2.setGeometry(QRect(10, 100, 221, 81))
        self.layout_about_2 = QVBoxLayout(self.layout_widget_about_2)
        self.layout_about_2.setContentsMargins(0, 0, 0, 0)
        self.label_copyright = QLabel(self.layout_widget_about_2)
        self.label_copyright.setFont(self.font)
        self.label_copyright.setLayoutDirection(Qt.LeftToRight)
        self.layout_about_2.addWidget(self.label_copyright, 0, Qt.AlignHCenter)

        self.label_author = QLabel(self.layout_widget_about_2)
        self.label_author.setFont(self.font)
        self.label_author.setLayoutDirection(Qt.LeftToRight)
        self.layout_about_2.addWidget(self.label_author, 0, Qt.AlignHCenter)

        self.button_quit_about = QPushButton(self.layout_widget_about_2)
        self.layout_about_2.addWidget(self.button_quit_about)
        self.button_quit_about.setMinimumSize(100, 30)
        self.button_quit_about.setProperty('class', 'Aqua')

        self.setCentralWidget(self.centralwidget)
        self.retranslateUi()
        QMetaObject.connectSlotsByName(self)
コード例 #8
0
ファイル: tagger.py プロジェクト: threadreaper/autodomme
 def __init__(self, scene: QGraphicsScene, parent: QMainWindow):
     QGraphicsView.__init__(self, scene, parent)
     self.crop_rect = QRect(QPoint(0, 0), QSize(0, 0))
     self.g_rect = QGraphicsRectItem(QRectF(self.crop_rect))
     self.setParent(parent)
     self.app = self.parent()
     self.crop_btn = self.parent().crop_button
     self.mouse_down = False
     self.g_rect.setPen(QPen(Qt.red, 1, Qt.SolidLine))
     self.g_rect.setBrush(QBrush(Qt.red, Qt.Dense6Pattern))
     self.mouse_pos = QPoint(0, 0)
     self.adjustment = ''
     self.annotation = False
コード例 #9
0
ファイル: tagger.py プロジェクト: threadreaper/autodomme
 def reset(self):
     self.crop_rect = QRect(QPoint(0, 0), QSize(0, 0))
     self.g_rect = QGraphicsRectItem(QRectF(self.crop_rect))
     self.g_rect.setPen(QPen(Qt.red, 1, Qt.SolidLine))
     self.g_rect.setBrush(QBrush(Qt.red, Qt.Dense6Pattern))
     self.setMouseTracking(False)
     self.unsetCursor()
     self.mouse_pos = QPoint(0, 0)
     self.adjustment = ''
     self.mouse_down = False
     if self.crop_btn.isChecked():
         self.app.reload()
         self.setCursor(Qt.CrossCursor)
     if self.annotation:
         self.setCursor(Qt.CrossCursor)
コード例 #10
0
 def from_string(self, text, original_value):
     if isinstance(original_value, QColor):
         match = self.color_exp.match(text)
         return QColor(min(int(match.captured(1)), 255),
                       min(int(match.captured(2)), 255),
                       min(int(match.captured(3)), 255),
                       min(int(match.captured(4)), 255))
     if isinstance(original_value, QDate):
         value = QDate.fromString(text, Qt.ISODate)
         return value if value.isValid() else None
     if isinstance(original_value, QDateTime):
         value = QDateTime.fromString(text, Qt.ISODate)
         return value if value.isValid() else None
     if isinstance(original_value, QTime):
         value = QTime.fromString(text, Qt.ISODate)
         return value if value.isValid() else None
     if isinstance(original_value, QPoint):
         match = self.point_exp.match(text)
         return QPoint(int(match.captured(1)),
                       int(match.captured(2)))
     if isinstance(original_value, QRect):
         match = self.rect_exp.match(text)
         return QRect(int(match.captured(1)),
                      int(match.captured(2)),
                      int(match.captured(3)),
                      int(match.captured(4)))
     if isinstance(original_value, QSize):
         match = self.size_exp.match(text)
         return QSize(int(match.captured(1)),
                      int(match.captured(2)))
     if isinstance(original_value, list):
         return text.split(',')
     return type(original_value)(text)
コード例 #11
0
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(659, 477)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(50, -1, 50, -1)
        self.pushButton = QPushButton(self.centralwidget)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setMinimumSize(QSize(0, 50))
        font = QFont()
        font.setPointSize(16)
        self.pushButton.setFont(font)

        self.verticalLayout.addWidget(self.pushButton)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 659, 27))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)
コード例 #12
0
    def __init__(self,
                 rows: int,
                 cols: int,
                 target: QPaintDevice,
                 rect: QRect = None,
                 clues: typing.Dict[str, str] = None,
                 row_clues: typing.Iterable[QPixmap] = None,
                 column_clues: typing.Iterable[QPixmap] = None):
        """ Initialize the object.

        :param rows: the number of rows to break the art into
        :param cols: the number of columns to break the art into
        :param target: what to paint the pieces on
        :param rect: where to paint the pieces, or None to use the full target
        :param clues: word clues to display, defaults to just the letters
        :param row_clues: one image to use as a clue for each row
        :param column_clues: one image to use as a clue for each column
        """
        self.rows = rows
        self.cols = cols
        self.target = target
        self.rect = rect or QRect(0, 0, target.width(), target.height())
        self.cells = [(i, j, chr(65 + k)) for k, (i, j) in enumerate(
            (i, j) for i in range(rows) for j in range(cols))]
        self.is_shuffled = False
        self.clues = clues or {}
        self.row_clues = [] if row_clues is None else list(row_clues)
        self.column_clues = [] if column_clues is None else list(column_clues)
        self.row_clue_rects: typing.List[QRect] = []
        self.column_clue_rects: typing.List[QRect] = []
        self.background = QColor('white')
        self.selected_row = self.selected_column = None
コード例 #13
0
    def _do_layout(self, rect, test_only):
        x = rect.x()
        y = rect.y()
        line_height = 0
        spacing = self.spacing()

        for item in self._item_list:
            style = item.widget().style()
            layout_spacing_x = style.layoutSpacing(QSizePolicy.PushButton,
                                                   QSizePolicy.PushButton,
                                                   Qt.Horizontal)
            layout_spacing_y = style.layoutSpacing(QSizePolicy.PushButton,
                                                   QSizePolicy.PushButton,
                                                   Qt.Vertical)
            space_x = spacing + layout_spacing_x
            space_y = spacing + layout_spacing_y
            next_x = x + item.sizeHint().width() + space_x
            if next_x - space_x > rect.right() and line_height > 0:
                x = rect.x()
                y = y + line_height + space_y
                next_x = x + item.sizeHint().width() + space_x
                line_height = 0

            if not test_only:
                item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))

            x = next_x
            line_height = max(line_height, item.sizeHint().height())

        return y + line_height - rect.y()
コード例 #14
0
ファイル: app.py プロジェクト: Teraskull/PyDebloatX
 def message_box(self, message: str, buttons: int = 1) -> int:
     '''
     Message box with "Yes/No" or "OK" buttons. Defaults to "OK".\n
         Parameters:\n
             message (str): Message shown inside the message box.
             buttons (int): Amount of buttons, 1 - "OK" button, 2 - "Yes/No" buttons.
         Returns:\n
             choice (int): ID of the clicked button.
     '''
     pixmap = QPixmap(resource_path('icon.ico')).scaledToWidth(
         35, Qt.SmoothTransformation)
     msg_box = QMessageBox()
     msg_box.setFont(ui.font)
     msg_box.setText(message)
     if buttons == 2:
         msg_yes = msg_box.addButton(QMessageBox.Yes)
         msg_no = msg_box.addButton(QMessageBox.No)
         msg_yes.setText(self.dialog_yes)
         msg_no.setText(self.dialog_no)
         msg_yes.setProperty('class', 'button_yes')
         msg_no.setProperty('class', 'button_no')
     msg_box.setWindowFlags(Qt.Dialog | Qt.CustomizeWindowHint)
     msg_box.setIconPixmap(pixmap)
     with open(resource_path('style.css'), 'r') as file:
         msg_box.setStyleSheet(file.read())
     msg_box.move(ui.frameGeometry().center() -
                  QRect(QPoint(), msg_box.sizeHint()).center())
     choice = msg_box.exec_()
     return choice
コード例 #15
0
ファイル: hexview.py プロジェクト: sthagen/amoco
 def paintmap(self, surface):
     ww = surface.window().width()
     wh = surface.window().height()
     self.vb.setMaximum(self.qimg.height() - (wh // self.line.height))
     self.line.x_map = ww - 32
     r = QRect(self.line.x_map, 2, 32, wh - 4)
     surface.drawImage(r, self.qimg)
     factor = wh / self.qimg.height()
     pen = surface.pen()
     p = QPen(Qt.white)
     p.setCapStyle(Qt.RoundCap)
     p.setWidth(2)
     surface.setPen(p)
     l0 = self.vb.value() * factor
     l1 = l0 + (wh // self.line.height) * factor
     pad = 4
     p1 = QPointF(self.line.x_map - pad, l0)
     p2 = QPointF(self.line.x_map - pad, l1)
     if l1 - l0 > 4:
         p.setWidth(2)
         surface.drawLine(p1, p2)
         surface.drawLine(p1, QPointF(self.line.x_map, l0))
         surface.drawLine(p2, QPointF(self.line.x_map, l1))
     else:
         p.setWidth(4)
         surface.drawLine(p1, p2)
     surface.setPen(pen)
コード例 #16
0
ファイル: callout.py プロジェクト: desxedada/EmployeeFatigue
 def setText(self, text):
     self._text = text
     metrics = QFontMetrics(self._font)
     self._textRect = QRectF(metrics.boundingRect(
         QRect(0.0, 0.0, 150.0, 150.0),Qt.AlignLeft, self._text))
     self._textRect.translate(5, 5)
     self.prepareGeometryChange()
     self._rect = self._textRect.adjusted(-5, -5, 5, 5)
コード例 #17
0
 def DrawCover(self, Painter, Options):
     self._style.subElementRect(self._style.SE_ItemViewItemDecoration, Options, Options.widget)
     Rect = Options.rect
     TempRec = QRect(Rect.x() + 4, Rect.y() + 4, 56, 56)
     if False:
         pass
     else:
         Painter.drawImage(TempRec, QtGui.QImage(':/icon_pack/png/64/music_icon-02.png'))
コード例 #18
0
    def mousePressEvent(self, event):
        # QMouseEvent

        # 2.size: mouseClickPosition
        self.origin_pos = event.pos()
        self.rubberBand.setGeometry(QRect(self.origin_pos, QSize()))
        # 3.show RubberBand
        self.rubberBand.show()
        pass
コード例 #19
0
def _scaled_size(r: QRect, scale: int) -> QSize:
    """
    Get the scaled size of a QRect.

    :param r: the QRect to scale
    :param scale: the scaling factor to use
    :retval: the resulting QSize of the operation
    """

    s = QRect(r)

    s.setWidth(int(r.width() * scale))
    s.setHeight(int(r.height() * scale))

    return s.size()
コード例 #20
0
ファイル: QCodeEditor.py プロジェクト: galenbwill/snippets
    def resizeEvent(self, *e):
        '''overload resizeEvent handler'''

        if self.DISPLAY_LINE_NUMBERS:  # resize number_bar widget
            cr = self.contentsRect()
            rec = QRect(cr.left(), cr.top(), self.number_bar.getWidth(),
                        cr.height())
            self.number_bar.setGeometry(rec)

        QPlainTextEdit.resizeEvent(self, *e)
コード例 #21
0
 def left(self, Form):
     if not Form.objectName():
         Form.setObjectName(u"Form")
     self.leftgrip = QFrame(Form)
     self.leftgrip.setObjectName(u"left")
     self.leftgrip.setGeometry(QRect(0, 10, 10, 480))
     self.leftgrip.setMinimumSize(QSize(10, 0))
     self.leftgrip.setCursor(QCursor(Qt.SizeHorCursor))
     self.leftgrip.setStyleSheet(u"background-color: rgb(255, 121, 198);")
     self.leftgrip.setFrameShape(QFrame.NoFrame)
     self.leftgrip.setFrameShadow(QFrame.Raised)
コード例 #22
0
 def shape_to_pixelmap(item_type, pen, brush, shape) -> QPixmap:
     pixmap = QPixmap(50, 50)
     pixmap.fill(Qt.transparent)
     painter = QPainter(pixmap)
     painter.setRenderHint(QPainter.Antialiasing)
     painter.setPen(pen)
     painter.setBrush(brush)
     if item_type == QGraphicsRectItem.type(QGraphicsRectItem()):
         painter.drawRect(QRect(10, 15, 30, 20))
     elif item_type == QGraphicsEllipseItem.type(QGraphicsEllipseItem()):
         painter.drawEllipse(QRect(10, 10, 30, 30))
     elif item_type == QGraphicsPolygonItem.type(QGraphicsPolygonItem()):
         if shape.polygon().size() == 3:
             painter.drawPolygon(QPolygon([QPoint(10, 40), QPoint(40, 40), QPoint(25, 10)]))
         else:
             painter.drawPolygon(QPolygon([QPoint(12, 40), QPoint(23, 36),
                                           QPoint(37, 24), QPoint(23, 12), QPoint(7, 16)]))
     elif item_type == QGraphicsLineItem.type(QGraphicsLineItem()):
         painter.drawLine(QLine(10, 40, 40, 10))
     return pixmap
コード例 #23
0
 def right(self, Form):
     if not Form.objectName():
         Form.setObjectName(u"Form")
     Form.resize(500, 500)
     self.rightgrip = QFrame(Form)
     self.rightgrip.setObjectName(u"right")
     self.rightgrip.setGeometry(QRect(0, 0, 10, 500))
     self.rightgrip.setMinimumSize(QSize(10, 0))
     self.rightgrip.setCursor(QCursor(Qt.SizeHorCursor))
     self.rightgrip.setStyleSheet(u"background-color: rgb(255, 0, 127);")
     self.rightgrip.setFrameShape(QFrame.NoFrame)
     self.rightgrip.setFrameShadow(QFrame.Raised)
コード例 #24
0
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(400, 120)
        Dialog.setMinimumSize(QSize(400, 120))
        Dialog.setMaximumSize(QSize(400, 120))
        self.verticalLayout = QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(9, 9, 9, 9)
        self.bg_diag = QFrame(Dialog)
        self.bg_diag.setObjectName(u"bg_diag")
        self.bg_diag.setStyleSheet(u"background-color: rgb(29, 0, 86);\n"
"border-radius: 10px;")
        self.bg_diag.setFrameShape(QFrame.NoFrame)
        self.bg_diag.setFrameShadow(QFrame.Raised)
        self.tittle_bar = QFrame(self.bg_diag)
        self.tittle_bar.setObjectName(u"tittle_bar")
        self.tittle_bar.setGeometry(QRect(10, 10, 361, 31))
        self.tittle_bar.setFrameShape(QFrame.StyledPanel)
        self.tittle_bar.setFrameShadow(QFrame.Raised)
        self.lbl_userLogado = QLabel(self.tittle_bar)
        self.lbl_userLogado.setObjectName(u"lbl_userLogado")
        self.lbl_userLogado.setGeometry(QRect(25, -9, 311, 41))
        self.lbl_userLogado.setStyleSheet(u"color: rgb(255, 255, 255);\n"
"font: 18pt \"Segoe UI\";")
        self.pushButton = QPushButton(self.bg_diag)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setGeometry(QRect(161, 60, 61, 31))
        self.pushButton.setStyleSheet(u"background-color: rgb(53, 159, 159);\n"
"color: rgb(255, 255, 255);\n"
"font: 18pt \"Segoe UI\";\n"
"")

        self.verticalLayout.addWidget(self.bg_diag)


        self.retranslateUi(Dialog)

        QMetaObject.connectSlotsByName(Dialog)
コード例 #25
0
ファイル: about_dialog.py プロジェクト: donkirkby/zero-play
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(500, 400)
        Dialog.setSizeGripEnabled(False)
        self.main_layout = QVBoxLayout(Dialog)
        self.main_layout.setObjectName(u"main_layout")
        self.scrollArea = QScrollArea(Dialog)
        self.scrollArea.setObjectName(u"scrollArea")
        self.scrollArea.setWidgetResizable(True)
        self.credits_list = QWidget()
        self.credits_list.setObjectName(u"credits_list")
        self.credits_list.setGeometry(QRect(0, 0, 480, 349))
        self.credits_layout = QGridLayout(self.credits_list)
        self.credits_layout.setObjectName(u"credits_layout")
        self.version_label = QLabel(self.credits_list)
        self.version_label.setObjectName(u"version_label")
        self.version_label.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                        | Qt.AlignVCenter)

        self.credits_layout.addWidget(self.version_label, 0, 0, 1, 1)

        self.version = QLabel(self.credits_list)
        self.version.setObjectName(u"version")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.version.sizePolicy().hasHeightForWidth())
        self.version.setSizePolicy(sizePolicy)

        self.credits_layout.addWidget(self.version, 0, 1, 1, 1)

        self.scrollArea.setWidget(self.credits_list)

        self.main_layout.addWidget(self.scrollArea)

        self.buttonBox = QDialogButtonBox(Dialog)
        self.buttonBox.setObjectName(u"buttonBox")
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok)

        self.main_layout.addWidget(self.buttonBox)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)

        QMetaObject.connectSlotsByName(Dialog)
コード例 #26
0
ファイル: tabs.py プロジェクト: clpi/isutils
    def setupUi(self, centralTabs):
        if not centralTabs.objectName():
            centralTabs.setObjectName(u"centralTabs")
        centralTabs.setEnabled(True)
        centralTabs.resize(342, 289)
        sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            centralTabs.sizePolicy().hasHeightForWidth())
        centralTabs.setSizePolicy(sizePolicy)
        centralTabs.setAcceptDrops(True)
        centralTabs.setAutoFillBackground(False)
        centralTabs.setDocumentMode(True)
        centralTabs.setTabsClosable(False)
        centralTabs.setMovable(True)
        centralTabs.setTabBarAutoHide(False)
        self.demoPage = QWidget()
        self.demoPage.setObjectName(u"demoPage")
        self.demoPageLayout = QHBoxLayout(self.demoPage)
        self.demoPageLayout.setObjectName(u"demoPageLayout")
        self.stepsLayout = QVBoxLayout()
        self.stepsLayout.setSpacing(10)
        self.stepsLayout.setObjectName(u"stepsLayout")
        self.stepsLayout.setSizeConstraint(QLayout.SetMaximumSize)
        self.stepsLayout.setContentsMargins(0, 0, 0, 0)

        self.demoPageLayout.addLayout(self.stepsLayout)

        centralTabs.addTab(self.demoPage, "")
        self.scriptsPage = QWidget()
        self.scriptsPage.setObjectName(u"scriptsPage")
        self.horizontalLayoutWidget = QWidget(self.scriptsPage)
        self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget")
        self.horizontalLayoutWidget.setGeometry(QRect(210, 120, 74, 26))
        self.scriptsLayout = QHBoxLayout(self.horizontalLayoutWidget)
        self.scriptsLayout.setObjectName(u"scriptsLayout")
        self.scriptsLayout.setContentsMargins(0, 0, 0, 0)
        centralTabs.addTab(self.scriptsPage, "")
        self.productionPage = QWidget()
        self.productionPage.setObjectName(u"productionPage")
        centralTabs.addTab(self.productionPage, "")

        self.retranslateUi(centralTabs)

        centralTabs.setCurrentIndex(0)

        QMetaObject.connectSlotsByName(centralTabs)
コード例 #27
0
    def setupUi(self, DemoDialog):
        if not DemoDialog.objectName():
            DemoDialog.setObjectName(u"DemoDialog")
        DemoDialog.resize(400, 300)
        self.buttonBox = QDialogButtonBox(DemoDialog)
        self.buttonBox.setObjectName(u"buttonBox")
        self.buttonBox.setGeometry(QRect(30, 240, 341, 32))
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok)

        self.retranslateUi(DemoDialog)
        self.buttonBox.accepted.connect(DemoDialog.accept)
        self.buttonBox.rejected.connect(DemoDialog.reject)

        QMetaObject.connectSlotsByName(DemoDialog)
コード例 #28
0
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(353, 223)
        self.actionsetting = QAction(MainWindow)
        self.actionsetting.setObjectName(u"actionsetting")
        self.actionabout = QAction(MainWindow)
        self.actionabout.setObjectName(u"actionabout")
        self.actionimg_convert = QAction(MainWindow)
        self.actionimg_convert.setObjectName(u"actionimg_convert")
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.gridLayout_4 = QGridLayout(self.centralwidget)
        self.gridLayout_4.setObjectName(u"gridLayout_4")
        self.gridLayout_3 = QGridLayout()
        self.gridLayout_3.setObjectName(u"gridLayout_3")
        self.stackedWidget = QStackedWidget(self.centralwidget)
        self.stackedWidget.setObjectName(u"stackedWidget")
        self.stackedWidget.setMinimumSize(QSize(0, 0))

        self.gridLayout_3.addWidget(self.stackedWidget, 0, 0, 1, 1)


        self.gridLayout_4.addLayout(self.gridLayout_3, 0, 0, 1, 1)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 353, 22))
        self.menuabout = QMenu(self.menubar)
        self.menuabout.setObjectName(u"menuabout")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.menubar.addAction(self.menuabout.menuAction())
        self.menuabout.addAction(self.actionabout)

        self.retranslateUi(MainWindow)

        self.stackedWidget.setCurrentIndex(-1)


        QMetaObject.connectSlotsByName(MainWindow)
コード例 #29
0
    def paint(self, painter, option, index):
        options = option
        self.initStyleOption(options, index)

        painter.save()

        doc = QTextDocument()
        doc.setHtml(options.text)

        options.text = ""
        options.widget.style().drawControl(QStyle.CE_ItemViewItem, option,
                                           painter, option.widget)

        painter.translate(options.rect.left(), options.rect.top())
        clip = QRect(0, 0, options.rect.width(), options.rect.height())
        doc.drawContents(painter, clip)

        painter.restore()
コード例 #30
0
    def paintEvent(self, event):
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing, self.antialiased)
        painter.translate(self.width() / 2, self.height() / 2)

        for diameter in range(0, 256, 9):
            delta = abs((self.frameNo % 128) - diameter / 2)
            alpha = 255 - (delta * delta) / 4 - diameter
            if alpha > 0:
                painter.setPen(QPen(QColor(0, diameter / 2, 127, alpha), 3))

                if self.floatBased:
                    painter.drawEllipse(
                        QRectF(-diameter / 2.0, -diameter / 2.0, diameter,
                               diameter))
                else:
                    painter.drawEllipse(
                        QRect(-diameter / 2, -diameter / 2, diameter,
                              diameter))