コード例 #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
    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))
コード例 #3
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)
コード例 #4
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])
コード例 #5
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)
コード例 #6
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
コード例 #7
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
コード例 #8
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)
コード例 #9
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)
コード例 #10
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'))
コード例 #11
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)
コード例 #12
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
コード例 #13
0
ファイル: hexview.py プロジェクト: sthagen/amoco
 def paintlines(self, surface, first, count, l0):
     "draws the data out of the model onto the qpainter surface"
     self.model.cur = first
     N = self.model.linesize
     h = self.line.height
     ww = surface.window().width()
     y = (first - l0) * h
     c0, c1 = brushes.xv_bg, brushes.xv_bg_alt
     pen = surface.pen()
     for address, data, txt in self.model.iterlines(count):
         # background rect (alternate)
         r = QRect(0, y, ww, h)
         surface.fillRect(r, c0)
         # address column:
         r.setWidth(self.line.x_hex)
         surface.drawText(r, Qt.AlignHCenter | Qt.AlignVCenter,
                          "%08x" % address)
         # hex column:
         w = self.line.xb.width
         r.setWidth(w)
         r.translate(self.line.x_hex + self.line.pxpad, 0)
         C = self.highlight.get(address, [None] * N)
         for i, c in enumerate(C):
             try:
                 s = "%02x" % (data[i])
             except IndexError:
                 break
             flg = Qt.AlignHCenter | Qt.AlignVCenter
             if c:
                 surface.fillRect(r, c)
                 surface.setPen(QPen(Qt.white))
             surface.drawText(r, flg, s)
             surface.setPen(pen)
             r.translate(w, 0)
         # ascii column:
         w = self.line.xb.cw
         r.setX(self.line.x_txt + self.line.pxpad)
         r.setWidth(w)
         for i, c in enumerate(C):
             try:
                 s = txt[i]
             except IndexError:
                 break
             flg = Qt.AlignHCenter | Qt.AlignVCenter
             if c:
                 surface.fillRect(r, c)
                 surface.setPen(QPen(Qt.white))
             surface.drawText(r, flg, s)
             surface.setPen(pen)
             r.translate(w, 0)
         # clear background endline:
         r.setX(self.line.x_end)
         r.setWidth(ww - self.line.x_end)
         surface.fillRect(r, brushes.xv_bg_alt)
         y += h
         c0, c1 = c1, c0
コード例 #14
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)
コード例 #15
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)
コード例 #16
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
コード例 #17
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)
コード例 #18
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)
コード例 #19
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
コード例 #20
0
    def paintEvent(self, event):
        painter = QPainter(self)
        output_size = QSize()

        if self.mode == Mode.PngMode:
            output_size = self.zoomed_image.size()
            output_rect = QRect(QPoint(), output_size)
            output_rect.translate(self.rect().center() - output_rect.center())
            painter.drawImage(output_rect.topLeft(), self.zoomed_image)

        elif self.mode == Mode.SvgMode:
            output_size = self.svgRenderer.defaultSize()
            if self.zoom_scale != ZOOM_ORIGINAL_SCALE:
                zoom = float(self.zoom_scale) / ZOOM_ORIGINAL_SCALE
                output_size.scale(output_size.width() * zoom,
                                  output_size.height() * zoom,
                                  Qt.IgnoreAspectRatio)

            output_rect = QRect(QPoint(), output_size)
            output_rect.translate(self.rect().center() - output_rect.center())
            self.svgRenderer.render(painter, output_rect)

        self.setMinimumSize(output_size)
コード例 #21
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)
コード例 #22
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)
コード例 #23
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()
コード例 #24
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)
コード例 #25
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)
コード例 #26
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)