Python PyQt5.QtCore.QRect() Examples

The following are code examples for showing how to use PyQt5.QtCore.QRect(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: MusicBox   Author: HuberTRoy   File: player.py    MIT License 8 votes vote down vote up
def getDetailInfo(self):
        """点击后进行动画效果的: 显示某歌曲的详细信息。"""
        self.shortInfo.hide()
        self.detailInfo.show()

        self.showDetail = QPropertyAnimation(self, b"geometry")

        x = self.pos().x()
        y = self.pos().y()

        self.showDetail.setStartValue(QRect(x, y, self.width(), self.height()))
        # 获取顶层父窗口的长度。
        self.showDetail.setEndValue(QRect(0, self.grandparent.header.height()+3, self.grandparent.width(), self.grandparent.mainContent.height()))
        self.showDetail.setDuration(300)
        self.showDetail.setEasingCurve(QEasingCurve.InBack)

        self.showDetail.start(QAbstractAnimation.DeleteWhenStopped)
        # 将该组件显示在最前,默认会嵌入到父组件里面。
        self.raise_()

        self.setDetailInfo() 
Example 2
Project: pyqimageview   Author: nevion   File: widget.py    MIT License 6 votes vote down vote up
def mousePressEvent(self, event):
        QGraphicsView.mousePressEvent(self, event)
        button = event.button()
        modifier = event.modifiers()

        #pan
        if modifier == Qt.ControlModifier and button == Qt.LeftButton:
            self.start_drag = event.pos()
            self.panning = True

        #initiate/show ROI selection
        if modifier == Qt.ShiftModifier and button == Qt.LeftButton:
            self.start_drag = event.pos()
            if self.rubberBand is None:
                self.rubberBand = QRubberBand(QRubberBand.Rectangle, self.viewport())
            self.rubberBand.setGeometry(QRect(self.start_drag, QSize()))
            self.rubberBand.show() 
Example 3
Project: kucher   Author: Zubax   File: model.py    GNU General Public License v3.0 6 votes vote down vote up
def _draw_flags_icon(mutable: bool, persistent: bool, icon_size: int) -> QPixmap:
    """
    Combines icons into a single large icon and renders it into a pixmap of specified size.
    This operation is quite resource-consuming (we're drawing pictures after all, ask Picasso),
    so we cache the results in a LRU cache.
    """
    icon_name = 'edit' if mutable else 'lock'
    mutability = get_icon_pixmap(icon_name, icon_size)

    # https://youtu.be/AX2uz2XYkbo?t=21s
    icon_name = 'save' if persistent else 'random-access-memory'
    persistence = get_icon_pixmap(icon_name, icon_size)

    icon_size_rect = QRect(0, 0, icon_size, icon_size)

    pixmap = QPixmap(icon_size * 2, icon_size)
    mask = QBitmap(pixmap.width(), pixmap.height())
    mask.clear()
    pixmap.setMask(mask)

    painter = QPainter(pixmap)
    painter.drawPixmap(icon_size_rect, mutability, icon_size_rect)
    painter.drawPixmap(QRect(icon_size, 0, icon_size, icon_size),
                       persistence, icon_size_rect)
    return pixmap 
Example 4
Project: Python-GUI   Author: arpitj07   File: scorewidnow.py    MIT License 6 votes vote down vote up
def setupUi(self, ScoreWindow):
        ScoreWindow.setObjectName("ScoreWindow")
        ScoreWindow.resize(471, 386)
        self.centralwidget = QtWidgets.QWidget(ScoreWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.Score = QtWidgets.QLineEdit(self.centralwidget)
        self.Score.setGeometry(QtCore.QRect(180, 180, 113, 22))
        self.Score.setObjectName("Score")
        self.teamscore = QtWidgets.QLabel(self.centralwidget)
        self.teamscore.setGeometry(QtCore.QRect(180, 130, 151, 20))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.teamscore.setFont(font)
        self.teamscore.setObjectName("teamscore")
        ScoreWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(ScoreWindow)
        self.statusbar.setObjectName("statusbar")
        ScoreWindow.setStatusBar(self.statusbar)

        self.retranslateUi(ScoreWindow)
        QtCore.QMetaObject.connectSlotsByName(ScoreWindow) 
Example 5
Project: musaic   Author: al165   File: sliders.py    GNU General Public License v3.0 6 votes vote down vote up
def paintEvent(self, e):
        painter = QtGui.QPainter(self)

        brush = QtGui.QBrush()
        brush.setColor(self._forground_color)
        brush.setStyle(Qt.SolidPattern)

        width = painter.device().width()
        height = painter.device().height()

        percent = (self.value - self.minimum) / (self.maximum - self.minimum)

        rect = QtCore.QRect(0, 0, width*percent, height)
        painter.fillRect(rect, brush)

        if self._text_color:
            painter.setPen(self._text_color)

        if self._show_text:
            rect = QtCore.QRect(0, 0, width, height)
            painter.drawText(rect, Qt.AlignVCenter | Qt.AlignHCenter, str(f'{self.value}'))

        painter.end() 
Example 6
Project: musaic   Author: al165   File: sliders.py    GNU General Public License v3.0 6 votes vote down vote up
def paintEvent(self, e):
        painter = QtGui.QPainter(self)

        brush = QtGui.QBrush()
        brush.setColor(self._forground_color)
        brush.setStyle(Qt.SolidPattern)

        width = painter.device().width()
        height = painter.device().height()

        left_percent = (self.left - self.minimum) / (self.maximum - self.minimum)
        right_percent = (self.right - self.minimum) / (self.maximum - self.minimum)

        rect = QtCore.QRect(width*left_percent, 0, width*(right_percent - left_percent), height)
        painter.fillRect(rect, brush)

        if self._text_color:
            painter.setPen(self._text_color)

        if self._show_text:
            rect = QtCore.QRect(0, 0, width, height)
            painter.drawText(rect, Qt.AlignVCenter | Qt.AlignHCenter, str(f'{self.left}, {self.right}'))

        painter.end() 
Example 7
Project: mega.syno   Author: john-shine   File: tray.py    GNU General Public License v3.0 6 votes vote down vote up
def initUI(self): 
        width = QDesktopWidget().screenGeometry(-1).width()

        self.setWindowTitle('system tray')
        self.setWindowFlags(Qt.CustomizeWindowHint)
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setWindowFlag(Qt.WindowCloseButtonHint, False)
        self.setWindowFlag(Qt.WindowMinimizeButtonHint, False)     
        
        self.button = QPushButton('', self)
        self.button.setGeometry(QRect(width - self.icon_size - 1, 0, self.icon_size, self.icon_size))
        ico = QtGui.QPixmap(':/mega.ico')
        self.button.setIcon(QtGui.QIcon(ico))
        self.button.clicked.connect(self.launch_mega)
        
        self.setGeometry(0, 0, width, self.icon_size)
        self.setFixedSize(self.width(), self.height())

        self.show() 
Example 8
Project: Spyce   Author: imec-myhdl   File: SendPars.py    GNU Lesser General Public License v2.1 6 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(440, 413)
        self.gridLayoutWidget = QtWidgets.QWidget(Dialog)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(20, 60, 391, 271))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setObjectName("gridLayout")
        self.pbSend = QtWidgets.QPushButton(Dialog)
        self.pbSend.setGeometry(QtCore.QRect(160, 350, 83, 24))
        self.pbSend.setObjectName("pbSend")
        self.spVars = QtWidgets.QSpinBox(Dialog)
        self.spVars.setGeometry(QtCore.QRect(220, 11, 121, 31))
        self.spVars.setMinimum(1)
        self.spVars.setMaximum(12)
        self.spVars.setObjectName("spVars")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(100, 20, 91, 16))
        self.label.setObjectName("label")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 9
Project: SpriteMator   Author: rafaelvasco   File: widgets.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, min_value, max_value, step=None):

        super(Slider, self).__init__()

        if step is None:
            step = 1

        self._value = 0
        self._minValue = min_value
        self._maxValue = max_value
        self._step = step
        self._thumbWidth = 20
        self._thumbRect = QRect()
        self._slidingAreaRect = QRect()

        self._bgColor = QColor(20, 20, 20)
        self._indicatorColor = QColor(30, 108, 125)
        self._thumbColor = QColor(42, 157, 182)

        self._sliding = False

        self._fontMetrics = QFontMetrics(self.font())

        self._update_thumb() 
Example 10
Project: SpriteMator   Author: rafaelvasco   File: color_picker_widget.py    Apache License 2.0 6 votes vote down vote up
def _update_picker_position(self):

        size = float(self.width()) - self._pickerWidth \
            if self._orientation == self.Orientation.HORIZONTAL \
            else float(self.height()) - self._pickerWidth

        pos = round(max(0, min(size * (float(self._value - self._minValue) /
                                       float(self._maxValue - self._minValue)), size)))

        if self._orientation == self.Orientation.VERTICAL:
            pos = round(size - pos)

        if self._orientation == self.Orientation.HORIZONTAL:

            self._pickRect = QRect(pos, 13, self._pickerWidth, 18)

        else:

            self._pickRect = QRect(13, pos, self._pickerWidth, 18) 
Example 11
Project: SpriteMator   Author: rafaelvasco   File: tools.py    Apache License 2.0 6 votes vote down vote up
def _paste_selection(self):

        if self._selectionImage is None:
            return

        sprite_rect = self._canvas.map_global_rect_to_sprite_local_rect(self._selectionRectangle)

        painter = QPainter()
        painter.begin(self._canvas.sprite_object.active_surface)

        painter.drawImage(sprite_rect, self._selectionImage, QRect(0, 0,
                                                                   self._selectionImage.width(),
                                                                   self._selectionImage.height()))

        painter.end()

        self._canvas.surfaceChanged.emit() 
Example 12
Project: phidl   Author: amccaugh   File: quickplotter.py    MIT License 6 votes vote down vote up
def mousePressEvent(self, event):
        super(QGraphicsView, self).mousePressEvent(event)
        #==============================================================================
        #  Zoom to rectangle, from
        #  https://wiki.python.org/moin/PyQt/Selecting%20a%20region%20of%20a%20widget
        #==============================================================================
        if event.button() == Qt.RightButton:
            self._mousePressed = Qt.RightButton
            self._rb_origin = QPoint(event.pos())
            self.rubberBand.setGeometry(QRect(self._rb_origin, QSize()))
            self.rubberBand.show()
         #==============================================================================
        # Mouse panning, taken from
        # http://stackoverflow.com/a/15043279
        #==============================================================================
        elif event.button() == Qt.MidButton:
            self._mousePressed = Qt.MidButton
            self._mousePressedPos = event.pos()
            self.setCursor(QtCore.Qt.ClosedHandCursor)
            self._dragPos = event.pos() 
Example 13
Project: phidl   Author: amccaugh   File: quickplotter.py    MIT License 6 votes vote down vote up
def mouseMoveEvent(self, event):
        super(QGraphicsView, self).mouseMoveEvent(event)

        # # Useful debug
        # try:
        #     self.debug_label.setText(str(itemsBoundingRect_nogrid().width()))
        # except:
        #     print('Debug statement failed')

        # Update the X,Y label indicating where the mouse is on the geometry
        mouse_position = self.mapToScene(event.pos())
        self.mouse_position = [mouse_position.x(), mouse_position.y()]
        self.update_mouse_position_label()

        if not self._rb_origin.isNull() and self._mousePressed == Qt.RightButton:
            self.rubberBand.setGeometry(QRect(self._rb_origin, event.pos()).normalized())

        # Middle-click-to-pan
        if self._mousePressed == Qt.MidButton:
            newPos = event.pos()
            diff = newPos - self._dragPos
            self._dragPos = newPos
            self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - diff.x())
            self.verticalScrollBar().setValue(self.verticalScrollBar().value() - diff.y())
#            event.accept() 
Example 14
Project: phidl   Author: amccaugh   File: quickplotter.py    MIT License 6 votes vote down vote up
def mouseReleaseEvent(self, event):
        if event.button() == Qt.RightButton:
            self.rubberBand.hide()
            rb_rect = QRect(self._rb_origin, event.pos())
            rb_center = rb_rect.center()
            rb_size = rb_rect.size()

            if abs(rb_size.width()) > 3 and abs(rb_size.height()) > 3:
                viewport_size = self.viewport().geometry().size()

                zoom_factor_x = abs(viewport_size.width() / rb_size.width())
                zoom_factor_y = abs(viewport_size.height() / rb_size.height())

                new_center = self.mapToScene(rb_center)

                zoom_factor = min(zoom_factor_x, zoom_factor_y)
                self.zoom_view(zoom_factor)
                self.centerOn(new_center)

            self.update_grid()

        if event.button() == Qt.MidButton:
            self.setCursor(Qt.ArrowCursor)
            self._mousePressed = None
            self.update_grid() 
Example 15
Project: plexdesktop   Author: coryo   File: delegates.py    GNU General Public License v3.0 6 votes vote down vote up
def placeholder_thumb_generator(title, size=150):
    """Returns a QPixmap of size with the first letter of each word in title"""
    initials = ' '.join([x[0] for x in title.split(' ') if len(x) > 2])
    key = 'placeholder' + initials
    img = QtGui.QPixmapCache.find(key)
    if img:
        return img
    qsize = QtCore.QSize(size, size)
    circle_color = QtGui.QColor(50, 50, 50)
    text_color = QtGui.QColor(75, 75, 75)
    rect = QtCore.QRect(QtCore.QPoint(0, 0), QtCore.QPoint(size, size))
    center = QtCore.QPoint(size / 2, size / 2)
    img = QtGui.QPixmap(qsize)
    img.fill(QtCore.Qt.transparent)
    p = QtGui.QPainter(img)
    p.setFont(QtGui.QFont('Open Sans', size / 4, weight=QtGui.QFont.Bold))
    p.setBrush(QtGui.QBrush(circle_color))
    p.setPen(circle_color)
    p.setRenderHint(QtGui.QPainter.Antialiasing, True)
    p.drawEllipse(center, size / 2 - 1, size / 2 - 1)
    p.setPen(text_color)
    p.drawText(rect, QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter, initials)
    QtGui.QPixmapCache.insert(key, img)
    return img 
Example 16
Project: plexdesktop   Author: coryo   File: delegates.py    GNU General Public License v3.0 6 votes vote down vote up
def draw_progress_bar(plex_item, pixmap, height=6):
    """draw a progress indicator on the bottom of pixmap with height pixels"""
    if not hasattr(plex_item, 'in_progress'):
        return
    if not plex_item.in_progress:
        return
    progress_color = QtGui.QColor(204, 123, 25)
    progress = plex_item.view_offset / max(1, plex_item.duration)
    p = QtGui.QPainter(pixmap)
    rect = p.window()
    progress_rect = QtCore.QRect(rect.bottomLeft() - QtCore.QPoint(0, height),
                                 rect.bottomRight())
    progress_fill = QtCore.QRect(progress_rect)
    progress_fill.setWidth(rect.width() * progress)
    p.fillRect(progress_rect, QtGui.QBrush(QtCore.Qt.black))
    p.fillRect(progress_fill, QtGui.QBrush(progress_color)) 
Example 17
Project: openspectra   Author: openspectra   File: imagedisplay.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, image:Image, label:str, qimage_format:QImage.Format,
                screen_geometry:QRect, location_rect:bool=True, pixel_select:bool=False, parent=None):
        super().__init__(parent)
        # TODO do we need to hold the data itself?
        self.__image = image
        self.__image_label = label
        self._image_display = ImageDisplay(self.__image, qimage_format, location_rect, pixel_select, self)
        self.__init_ui()

        self._margin_width = self._image_display.margin_width()
        self._margin_height = self._image_display.margin_height()
        ImageDisplayWindow.__LOG.debug("margin_width: {0}, margin_height {1}", self._margin_width, self._margin_height)

        self._scroll_bar_width = QApplication.style().pixelMetric(QStyle.PM_ScrollBarExtent)
        ImageDisplayWindow.__LOG.debug("scroll_bar_width: {0}", self._scroll_bar_width)

        self._title_bar_height = QApplication.style().pixelMetric(QStyle.PM_TitleBarHeight)
        ImageDisplayWindow.__LOG.debug("title_bar_height: {0}", self._title_bar_height)

        self._frame_width = QApplication.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
        ImageDisplayWindow.__LOG.debug("frame_width: {0}", self._frame_width)

        self._screen_geometry = screen_geometry
        ImageDisplayWindow.__LOG.debug("screen geometry: {0}", self._screen_geometry) 
Example 18
Project: openspectra   Author: openspectra   File: windowmanager.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent_window:QMainWindow, band_list:BandList):
        super().__init__()
        screen:QScreen = QGuiApplication.primaryScreen()
        self.__screen_geometry:QRect = screen.geometry()

        WindowManager.__LOG.debug("Screen height: {0}, width: {1}",
            self.__screen_geometry.height(), self.__screen_geometry.width())

        # The available size is the size excluding window manager reserved areas such as task bars and system menus.
        self.__available_geometry:QRect = screen.availableGeometry()
        WindowManager.__LOG.debug("Available height: {0}, width: {1}",
            self.__available_geometry.height(), self.__available_geometry.width())

        self.__parent_window = parent_window
        self.__file_managers:Dict[str, FileManager] = dict()
        self.__band_list = band_list
        self.__band_list.bandSelected.connect(self.__handle_band_select)
        self.__band_list.rgbSelected.connect(self.__handle_rgb_select)

        self.__default_open_dir = QStandardPaths.writableLocation(QStandardPaths.HomeLocation)
        self.__save_manager = SaveManager(QStandardPaths.writableLocation(QStandardPaths.DownloadLocation),
                                "Save Data", "", "") 
Example 19
Project: EGTR-FutureRestore   Author: M4cs   File: PySimpleGUIQt.py    GNU General Public License v3.0 6 votes vote down vote up
def Update(self, filename=None, data=None, data_base64=None, size=(None, None), visible=None):
        if filename is not None:
            qlabel = self.QT_QLabel
            qlabel.setText('')
            w = QtGui.QPixmap(filename).width()
            h = QtGui.QPixmap(filename).height()
            qlabel.setGeometry(QtCore.QRect(0, 0, w, h))
            qlabel.setPixmap(QtGui.QPixmap(filename))
        elif data is not None:
            qlabel = self.QT_QLabel
            qlabel.setText('')
            ba = QtCore.QByteArray.fromRawData(data)
            pixmap = QtGui.QPixmap()
            pixmap.loadFromData(ba)
            qlabel.setPixmap(pixmap)
        elif data_base64 is not None:
            qlabel = self.QT_QLabel
            qlabel.setText('')
            ba = QtCore.QByteArray.fromBase64(data_base64)
            pixmap = QtGui.QPixmap()
            pixmap.loadFromData(ba)
            qlabel.setPixmap(pixmap)
        super().Update(self.QT_QLabel, visible=visible) 
Example 20
Project: pyqt5-face-recognition   Author: Aimledge   File: delete_registry_ui.py    MIT License 6 votes vote down vote up
def setupUi(self, DeleteRegistry):
        DeleteRegistry.setObjectName("DeleteRegistry")
        DeleteRegistry.resize(400, 147)
        icon = QtGui.QIcon.fromTheme("edit-delete")
        DeleteRegistry.setWindowIcon(icon)
        self.deleteButton = QtWidgets.QPushButton(DeleteRegistry)
        self.deleteButton.setGeometry(QtCore.QRect(280, 100, 85, 27))
        self.deleteButton.setObjectName("deleteButton")
        self.label = QtWidgets.QLabel(DeleteRegistry)
        self.label.setGeometry(QtCore.QRect(60, 40, 74, 17))
        self.label.setObjectName("label")
        self.faceRegistryBox = QtWidgets.QComboBox(DeleteRegistry)
        self.faceRegistryBox.setGeometry(QtCore.QRect(170, 40, 201, 27))
        self.faceRegistryBox.setObjectName("faceRegistryBox")

        self.retranslateUi(DeleteRegistry)
        self.deleteButton.clicked.connect(DeleteRegistry.delete_registry)
        QtCore.QMetaObject.connectSlotsByName(DeleteRegistry) 
Example 21
Project: Physics_Project   Author: QuandisS   File: credits_form.py    Apache License 2.0 5 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(400, 300)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(-1, -1, 801, 561))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.textBrowser = QtWidgets.QTextBrowser(self.gridLayoutWidget)
        self.textBrowser.setOpenExternalLinks(True)
        self.textBrowser.setObjectName("textBrowser")
        self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.centralwidget.setLayout(self.gridLayout)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
Example 22
Project: MusicDownloader   Author: wwwpf   File: utils.py    GNU General Public License v3.0 5 votes vote down vote up
def get_center_rect(rect):
    w = min(rect.width(), rect.height())
    center_x = (rect.left() + rect.right()) >> 1
    center_y = (rect.top() + rect.bottom()) >> 1
    return QRect(center_x - (w >> 1), center_y - (w >> 1), w, w) 
Example 23
Project: MusicDownloader   Author: wwwpf   File: table_delegate.py    GNU General Public License v3.0 5 votes vote down vote up
def helpEvent(self, event, view, option, index):
        if self.need_show_tool_tip(event, index):
            QToolTip.showText(event.globalPos(), index.data(
                Qt.DisplayRole), None, QRect(), 1000)
            return True
        return False 
Example 24
Project: pyqimageview   Author: nevion   File: widget.py    MIT License 5 votes vote down vote up
def mouseMoveEvent(self, event):
        QGraphicsView.mouseMoveEvent(self, event)
        #update selection display
        if self.rubberBand is not None:
            self.rubberBand.setGeometry(QRect(self.start_drag, event.pos()).normalized())

        if self.panning:
            scene_end_drag = self.mapToScene(event.pos())
            end_drag = event.pos()
            pan_vector = end_drag - self.start_drag
            scene2view = self.transform()
            #skip shear
            sx = scene2view.m11()
            sy = scene2view.m22()
            dx = scene2view.dx()
            dy = scene2view.dy()
            scene_pan_vector = QPointF(pan_vector.x() / sx, pan_vector.y() / sy)
            roi = self.current_scene_ROI
            top_left = roi.topLeft()
            new_top_left = top_left - scene_pan_vector
            scene_rect = self.sceneRect()
            new_top_left.setX(clamp(new_top_left.x(), scene_rect.left(), scene_rect.right()))
            new_top_left.setY(clamp(new_top_left.y(), scene_rect.top(), scene_rect.bottom()))
            nroi = QRectF(new_top_left, roi.size())
            self.fitInView(nroi, Qt.KeepAspectRatio)
            self.start_drag = end_drag
        self.update() 
Example 25
Project: Python-GUI   Author: arpitj07   File: New.py    MIT License 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(100, 40, 201, 81))
        font = QtGui.QFont()
        font.setPointSize(9)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")

        
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(150, 190, 111, 28))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        
        self.lineEdit = QtWidgets.QLineEdit(Form)
        self.lineEdit.setGeometry(QtCore.QRect(100, 140, 201, 22))
        self.lineEdit.setObjectName("lineEdit")

        
        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 26
Project: Python-GUI   Author: arpitj07   File: openWindow.py    MIT License 5 votes vote down vote up
def setupUi(self, OpenWindow):
        OpenWindow.setObjectName("OpenWindow")
        OpenWindow.resize(535, 389)
        self.centralwidget = QtWidgets.QWidget(OpenWindow)
        self.centralwidget.setObjectName("centralwidget")
        
        self.OpenTeam = QtWidgets.QLabel(self.centralwidget)
        self.OpenTeam.setGeometry(QtCore.QRect(150, 120, 231, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.OpenTeam.setFont(font)
        self.OpenTeam.setObjectName("OpenTeam")

        
        self.OpenTheTeam = QtWidgets.QLineEdit(self.centralwidget)
        self.OpenTheTeam.setGeometry(QtCore.QRect(180, 160, 151, 22))
        self.OpenTheTeam.setObjectName("OpenTheTeam")
        
        self.openButton = QtWidgets.QPushButton(self.centralwidget)
        self.openButton.setGeometry(QtCore.QRect(210, 210, 93, 28))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.openButton.setFont(font)
        self.openButton.setObjectName("openButton")
        
        OpenWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(OpenWindow)
        self.statusbar.setObjectName("statusbar")
        OpenWindow.setStatusBar(self.statusbar)

        self.retranslateUi(OpenWindow)
        QtCore.QMetaObject.connectSlotsByName(OpenWindow) 
Example 27
Project: tf-pose   Author: SrikanthVelpuri   File: FlowchartTemplate_pyqt5.py    Apache License 2.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtWidgets.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtWidgets.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 28
Project: SpriteMator   Author: rafaelvasco   File: display_sprite_object.py    Apache License 2.0 5 votes vote down vote up
def bounding_rect_i(self):
        return QRect(self._boundingRect.left(),
                     self._boundingRect.top(),
                     self._boundingRect.width(),
                     self._boundingRect.height()) 
Example 29
Project: SpriteMator   Author: rafaelvasco   File: display_sprite_object.py    Apache License 2.0 5 votes vote down vote up
def area_rect(self):
        return QRect(0, 0, self._boundingRect.width(), self._boundingRect.height()) 
Example 30
Project: SpriteMator   Author: rafaelvasco   File: layer_manager_widget.py    Apache License 2.0 5 votes vote down vote up
def draw_content(self, painter, draw_area):
        painter.setPen(Qt.white)

        painter.drawText(20, self._top + 20, self._label)

        icon = self._layer.image

        # Draw Icon

        icon_draw_area = QRect(draw_area.right() - 55,
                               draw_area.top() + draw_area.height() / 2 - 24, 48, 48)

        border = self._borderColor if not self._selected else self._borderColorSelected

        painter.setPen(border)

        icon_draw_area.adjust(0, 0, -1, -1)

        painter.drawRect(icon_draw_area)

        icon_draw_area.adjust(1, 1, -1, -1)

        painter.setPen(Qt.black)
        painter.drawRect(icon_draw_area)

        icon_draw_area.adjust(1, 1, 0, 0)

        painter.fillRect(icon_draw_area, Qt.white)

        if icon is not None:
            painter.drawImage(icon_draw_area, icon,
                              QRect(0, 0, icon.width(), icon.height())) 
Example 31
Project: SpriteMator   Author: rafaelvasco   File: color_picker_widget.py    Apache License 2.0 5 votes vote down vote up
def _cell_rect(self, index):

        return QRect(((index - 16 * (index // 16)) * (self._cellSize + 1)),
                     (index // 16) * (self._cellSize + 1),
                     self._cellSize, self._cellSize) 
Example 32
Project: SpriteMator   Author: rafaelvasco   File: color_picker_widget.py    Apache License 2.0 5 votes vote down vote up
def __init__(self, min_value, max_value, alpha=None):
        super(ColorSlider, self).__init__()

        self._value = min_value
        self._minValue = min_value
        self._maxValue = max_value
        self._pickerWidth = 8
        self._sliding = False
        self._pickRect = QRect()
        self._slideStep = 10
        self._orientation = self.Orientation.HORIZONTAL
        self._label = ""
        self._gradient = None

        self._pickerPixmap = None
        self._background = None

        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        self._update_gradient()
        self._update_picker_position()
        self._generate_picker()

        if alpha is not None:
            self._background = utils.generate_checkerboard_tile(8,
                                                                QColor(150, 150, 150),
                                                                QColor(175, 175, 175)) 
Example 33
Project: SpriteMator   Author: rafaelvasco   File: canvas_widget.py    Apache License 2.0 5 votes vote down vote up
def map_global_rect_to_sprite_local_rect(self, rect):

        sprite_local_rect = QRect((rect.left() -
                                   self._spriteObject.boundingRect().left()),
                                  (rect.top() -
                                   self._spriteObject.boundingRect().top()),
                                  rect.width(),
                                  rect.height())

        return sprite_local_rect 
Example 34
Project: SpriteMator   Author: rafaelvasco   File: canvas_widget.py    Apache License 2.0 5 votes vote down vote up
def resizeEvent(self, e):

        super(Canvas, self).resizeEvent(e)

        #self._overlay.setGeometry(QRect(0, 0, self.width(), self.height())) 
Example 35
Project: SpriteMator   Author: rafaelvasco   File: tools.py    Apache License 2.0 5 votes vote down vote up
def _clear_selection(self):

        self._selectionRectangle = QRect()
        self._selectionImage = None 
Example 36
Project: eddy   Author: obdasystems   File: splash.py    GNU General Public License v3.0 5 votes vote down vote up
def paintEvent(self, paintEvent):
        """
        Executed when the splashscreen needs to be painted.
        :type paintEvent: QPaintEvent
        """
        painter = QtGui.QPainter(self)
        # APPNAME
        painter.setFont(self.font1)
        painter.setPen(QtGui.QPen(QtGui.QColor(255, 255, 255), 1.0, QtCore.Qt.SolidLine))
        painter.drawText(QtCore.QRect(31 + self.__spaceX, 138 + self.__spaceY, 380, 400), QtCore.Qt.AlignTop|QtCore.Qt.AlignLeft, APPNAME)
        # VERSION
        painter.setFont(self.font2)
        painter.setPen(QtGui.QPen(QtGui.QColor(255, 255, 255), 1.0, QtCore.Qt.SolidLine))
        painter.drawText(QtCore.QRect(34 + self.__spaceX, 185 + self.__spaceY, 380, 400), QtCore.Qt.AlignTop|QtCore.Qt.AlignLeft, 'Version {0}'.format(VERSION))
        # COPYRIGHT
        painter.setFont(self.font3)
        painter.setPen(QtGui.QPen(QtGui.QColor(122, 101, 104), 1.0, QtCore.Qt.SolidLine))
        painter.drawText(QtCore.QRect(0 + self.__spaceX, 220 + self.__spaceY, 360, 40), QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter, COPYRIGHT)
        # CREDITS
        painter.setFont(self.font3)
        painter.setPen(QtGui.QPen(QtGui.QColor(122, 101, 104), 1.0, QtCore.Qt.SolidLine))
        painter.drawText(QtCore.QRect(0 + self.__spaceX, 273 + self.__spaceY, 360, 80), QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter, CREDITS)
        # LICENSE
        painter.setFont(self.font3)
        painter.setPen(QtGui.QPen(QtGui.QColor(122, 101, 104), 1.0, QtCore.Qt.SolidLine))
        painter.drawText(QtCore.QRect(0 + self.__spaceX, 286 + self.__spaceY, 360, 40), QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter, LICENSE) 
Example 37
Project: BBoxEE   Author: persts   File: annotation_graphicsview.py    GNU General Public License v3.0 5 votes vote down vote up
def mouseReleaseEvent(self, event):
        """Overload of the MouseReleaseEvent that will calculate the
        bounding box when four points are available."""
        self.setDragMode(QtWidgets.QGraphicsView.NoDrag)
        if self.mode == Mode.RESIZE:
            rect = self.selected_bbox.rect()
            self.verify_rect(rect)
            self.selected_bbox.setRect(rect)
            self.resized.emit(rect)
            self.mode = Mode.EDIT

        if len(self.points) == 4:
            x_min = 100000000
            y_min = 100000000
            x_max = 0
            y_max = 0
            for point in self.points:
                x_min = min(x_min, point.x())
                x_max = max(x_max, point.x())
                y_min = min(y_min, point.y())
                y_max = max(y_max, point.y())
            for item in self.point_graphics_items:
                self.scene().removeItem(item)
            self.point_graphics_items = []
            rect = QtCore.QRect(x_min, y_min, x_max - x_min, y_max - y_min)
            rect = self.mapToScene(rect).boundingRect()
            self.verify_rect(rect)
            self.created.emit(rect)
            self.points = [] 
Example 38
Project: criminal-face-recognition-tensorflow   Author: elnasdgreat   File: tw.py    MIT License 5 votes vote down vote up
def setupUi(self, TrainWindow):
        TrainWindow.setObjectName("TrainWindow")
        TrainWindow.resize(640, 480)
        self.centralwidget = QtWidgets.QWidget(TrainWindow)
        self.centralwidget.setStyleSheet(".QWidget {\n"
"    background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(211, 16, 39, 255), stop:1 rgba(234, 56, 77, 255));\n"
"}")
        self.centralwidget.setObjectName("centralwidget")
        self.listView = QtWidgets.QListView(self.centralwidget)
        self.listView.setGeometry(QtCore.QRect(140, 80, 256, 192))
        self.listView.setObjectName("listView")
        TrainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(TrainWindow)
        QtCore.QMetaObject.connectSlotsByName(TrainWindow) 
Example 39
Project: plexdesktop   Author: coryo   File: downloadwindow_ui.py    GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, DownloadWindow):
        DownloadWindow.setObjectName("DownloadWindow")
        DownloadWindow.resize(314, 284)
        self.centralwidget = QtWidgets.QWidget(DownloadWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.list = QtWidgets.QScrollArea(self.centralwidget)
        self.list.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.list.setFrameShadow(QtWidgets.QFrame.Plain)
        self.list.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.list.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
        self.list.setWidgetResizable(True)
        self.list.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.list.setObjectName("list")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 314, 284))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.layout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
        self.layout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
        self.layout.setContentsMargins(4, 4, 4, 4)
        self.layout.setSpacing(4)
        self.layout.setObjectName("layout")
        self.list.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout.addWidget(self.list)
        DownloadWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(DownloadWindow)
        QtCore.QMetaObject.connectSlotsByName(DownloadWindow) 
Example 40
Project: pyqt5-widgets   Author: mfitzp   File: power_bar.py    MIT License 5 votes vote down vote up
def paintEvent(self, e):
        painter = QtGui.QPainter(self)

        brush = QtGui.QBrush()
        brush.setColor(self._background_color)
        brush.setStyle(Qt.SolidPattern)
        rect = QtCore.QRect(0, 0, painter.device().width(), painter.device().height())
        painter.fillRect(rect, brush)

        # Get current state.
        parent = self.parent()
        vmin, vmax = parent.minimum(), parent.maximum()
        value = parent.value()

        # Define our canvas.
        d_height = painter.device().height() - (self._padding * 2)
        d_width = painter.device().width() - (self._padding * 2)

        # Draw the bars.
        step_size = d_height / self.n_steps
        bar_height = step_size * self._bar_solid_percent
        bar_spacer = step_size * (1 - self._bar_solid_percent) / 2

        # Calculate the y-stop position, from the value in range.
        pc = (value - vmin) / (vmax - vmin)
        n_steps_to_draw = int(pc * self.n_steps)

        for n in range(n_steps_to_draw):
            brush.setColor(QtGui.QColor(self.steps[n]))
            rect = QtCore.QRect(
                self._padding,
                self._padding + d_height - ((1 + n) * step_size) + bar_spacer,
                d_width,
                bar_height
            )
            painter.fillRect(rect, brush)

        painter.end() 
Example 41
Project: pyqt5-widgets   Author: mfitzp   File: equalizer_bar.py    MIT License 5 votes vote down vote up
def paintEvent(self, e):
        painter = QtGui.QPainter(self)

        brush = QtGui.QBrush()
        brush.setColor(self._background_color)
        brush.setStyle(Qt.SolidPattern)
        rect = QtCore.QRect(0, 0, painter.device().width(), painter.device().height())
        painter.fillRect(rect, brush)

        # Define our canvas.
        d_height = painter.device().height() - (self._padding * 2)
        d_width = painter.device().width() - (self._padding * 2)

        # Draw the bars.
        step_y = d_height / self.n_steps
        bar_height = step_y * self._y_solid_percent
        bar_height_space = step_y * (1 - self._x_solid_percent) / 2

        step_x = d_width / self.n_bars
        bar_width = step_x * self._x_solid_percent
        bar_width_space = step_x * (1 - self._y_solid_percent) / 2

        for b in range(self.n_bars):

            # Calculate the y-stop position for this bar, from the value in range.
            pc = (self._values[b] - self._vmin) / (self._vmax - self._vmin)
            n_steps_to_draw = int(pc * self.n_steps)

            for n in range(n_steps_to_draw):
                brush.setColor(QtGui.QColor(self.steps[n]))
                rect = QtCore.QRect(
                    self._padding + (step_x * b) + bar_width_space,
                    self._padding + d_height - ((1 + n) * step_y) + bar_height_space,
                    bar_width,
                    bar_height
                )
                painter.fillRect(rect, brush)

        painter.end() 
Example 42
Project: pyqt5-widgets   Author: mfitzp   File: gradient.py    MIT License 5 votes vote down vote up
def paintEvent(self, e):
        painter = QtGui.QPainter(self)
        width = painter.device().width()
        height = painter.device().height()

        # Draw the linear horizontal gradient.
        gradient = QtGui.QLinearGradient(0, 0, width, 0)
        for stop, color in self._gradient:
            gradient.setColorAt(stop, QtGui.QColor(color))

        rect = QtCore.QRect(0, 0, width, height)
        painter.fillRect(rect, gradient)

        pen = QtGui.QPen()

        y = painter.device().height() / 2


        # Draw the stop handles.
        for stop, _ in self._gradient:
            pen.setColor(QtGui.QColor('white'))
            painter.setPen(pen)

            painter.drawLine(stop * width, y - self._handle_h, stop * width, y + self._handle_h)

            pen.setColor(QtGui.QColor('red'))
            painter.setPen(pen)

            rect = QtCore.QRect(
                stop * width - self._handle_w/2,
                y - self._handle_h/2,
                self._handle_w,
                self._handle_h
            )
            painter.drawRect(rect)

        painter.end() 
Example 43
Project: XulDebugTool   Author: starcor-company   File: AboutWindow.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def initVersionNumber(self):
        self.versionNumber = QtWidgets.QLabel(self)
        self.versionNumber.setGeometry(QtCore.QRect(50, 230, 300, 21))
        self.versionNumber.setObjectName("label_4")
        self.versionNumber.setText("版本号:Release version v1.2") #版本号应该写到版本配置文件里面去,从哪里读取 
Example 44
Project: XulDebugTool   Author: starcor-company   File: AboutWindow.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def initGitAddress(self):
        self.gitAddress = QtWidgets.QPushButton(self)
        self.gitAddress.setGeometry(QtCore.QRect(50, 160, 300, 50))
        self.gitAddress.setStyleSheet("QPushButton{background: transparent; color: blue; text-align: left}")
        self.gitAddress.setLayoutDirection(Qt.LayoutDirectionAuto)
        self.gitAddress.setObjectName("label_3")
        self.gitAddress.clicked.connect(self.openGitUrl)
        self.gitAddress.setText("https://github.com/starcor-company/XulDebugTool") 
Example 45
Project: XulDebugTool   Author: starcor-company   File: AboutWindow.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def initAboutTitle(self):
        self.aboutTitle = QtWidgets.QLabel(self)
        self.aboutTitle.setGeometry(QtCore.QRect(0, 18, 400, 100))
        self.aboutTitle.setStyleSheet("QLabel{background: black; color: white;}")
        font = QFont()
        font.setPointSize(32)
        self.aboutTitle.setAlignment(Qt.AlignCenter)
        self.aboutTitle.setFont(font)
        self.aboutTitle.setObjectName("label_2")
        self.aboutTitle.setText("XulDebugTool") 
Example 46
Project: knossos_cuber   Author: knossos-project   File: knossos_cuber_widgets_log.py    GNU General Public License v2.0 5 votes vote down vote up
def setupUi(self, dialog_log):
        dialog_log.setObjectName("dialog_log")
        dialog_log.resize(400, 300)
        self.plain_text_edit_log = QtWidgets.QPlainTextEdit(dialog_log)
        self.plain_text_edit_log.setGeometry(QtCore.QRect(3, 7, 391, 281))
        self.plain_text_edit_log.setObjectName("plain_text_edit_log")

        self.retranslateUi(dialog_log)
        QtCore.QMetaObject.connectSlotsByName(dialog_log) 
Example 47
Project: openspectra   Author: openspectra   File: imagedisplay.py    Apache License 2.0 5 votes vote down vote up
def __init__(self, image:Image, label, qimage_format:QImage.Format,
            screen_geometry:QRect, parent=None):
        super().__init__(image, label, qimage_format, screen_geometry, False, True, parent)

        self.__last_display_center:QPoint = None

        self._image_display.image_resized.connect(self.__handle_image_resize)
        self._image_display.viewport_changed.connect(self.__handle_view_changed)
        self._image_display.viewport_scrolled.connect(self.__handle_image_scroll)

        # TODO for testing only, remove if not used otherwise
        self._image_display.right_clicked.connect(self.__handle_right_click)

        self.__zoom_factor = 1.0
        self.__zoom_widget = ZoomWidget(self, self.__zoom_factor)
        self.__zoom_widget.zoom_in.connect(self.__handle_zoom_in)
        self.__zoom_widget.zoom_out.connect(self.__handle_zoom_out)
        self.__zoom_widget.reset_zoom.connect(self.__handle_zoom_reset)

        self.__zoom_dock_widget = QDockWidget("Mouse", self)
        self.__zoom_dock_widget.setTitleBarWidget(QWidget(None))
        self.__zoom_dock_widget.setWidget(self.__zoom_widget)
        self.addDockWidget(Qt.BottomDockWidgetArea, self.__zoom_dock_widget)

        # TODO make it so min size provides a veiwport of 150 x 150
        self.__minimum_size = QSize(150, 150)
        self.setMinimumSize(self.__minimum_size)

        # TODO temporarily initial size setting, figure out a more sensible way to determine initial size
        self.__nom_size = QSize(400, 350)
        self.resize(self.__nom_size)

        self.__zoom_widget.setFixedHeight(17)
        # TODO forcing to above 17 makes it looks better but now viewport is off by 7 but it looks like it 17
        self.__dock_height = self.__zoom_widget.height()
        ZoomImageDisplayWindow.__LOG.debug("zoom widget height: {0}", self.__dock_height) 
Example 48
Project: openspectra   Author: openspectra   File: imagedisplay.py    Apache License 2.0 5 votes vote down vote up
def __init__(self, image:Image, label, qimage_format:QImage.Format,
                screen_geometry:QRect, parent=None):
        super().__init__(image, label, qimage_format, screen_geometry, True, False, parent)
        self._image_display.right_clicked.connect(self.__handle_right_click)
        self._image_display.image_resized.connect(self.__handle_image_resize)
        self._image_display.locator_moved.connect(self.__handle_location_changed)

        # Prevents context menus from showing on right click
        # Only way I could find to prevent the dock widget context menu from
        # appearing on right click event even though it doesn't seem
        # it actually makes up to this window
        self.setContextMenuPolicy(Qt.PreventContextMenu)

        self.__calculate_sizes() 
Example 49
Project: openspectra   Author: openspectra   File: windowmanager.py    Apache License 2.0 5 votes vote down vote up
def available_geometry(self) -> QRect:
        return self.__available_geometry 
Example 50
Project: discord-data-package-viewer-parser   Author: ramzialhaddadtm   File: main.py    MIT License 5 votes vote down vote up
def setupUi(self, MainWindow):
		MainWindow.setObjectName("MainWindow")
		MainWindow.resize(1091, 619)
		self.centralwidget = QtWidgets.QWidget(MainWindow)
		self.centralwidget.setObjectName("centralwidget")
		self.listWidget = QtWidgets.QListWidget(self.centralwidget)
		self.listWidget.setGeometry(QtCore.QRect(10, 50, 180, 520))
		self.listWidget.setObjectName("listWidget")
		self.label = QtWidgets.QLabel(self.centralwidget)
		self.label.setGeometry(QtCore.QRect(10, 10, 71, 16))
		self.label.setObjectName("label")
		self.listWidget_2 = QtWidgets.QListWidget(self.centralwidget)
		self.listWidget_2.setGeometry(QtCore.QRect(200, 50, 880, 520))
		self.listWidget_2.setObjectName("listWidget_2")
		self.label_2 = QtWidgets.QLabel(self.centralwidget)
		self.label_2.setGeometry(QtCore.QRect(210, 10, 47, 13))
		self.label_2.setObjectName("label_2")
		self.pushButton = QtWidgets.QPushButton(self.centralwidget)
		self.pushButton.setGeometry(QtCore.QRect(420, 10, 75, 23))
		self.pushButton.setObjectName("pushButton")
		self.pushButton.clicked.connect(self.findStuff)#---------------------------------------------------#
		MainWindow.setCentralWidget(self.centralwidget)
		self.menubar = QtWidgets.QMenuBar(MainWindow)
		self.menubar.setGeometry(QtCore.QRect(0, 0, 1091, 21))
		self.menubar.setObjectName("menubar")
		MainWindow.setMenuBar(self.menubar)
		self.statusbar = QtWidgets.QStatusBar(MainWindow)
		self.statusbar.setObjectName("statusbar")
		MainWindow.setStatusBar(self.statusbar)

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