예제 #1
0
    def __init__(self, distributedObjects, parent=None):
        QWidget.__init__(self, parent, Qt.Tool | Qt.FramelessWindowHint)
        self.setPalette(QToolTip.palette())

        self.__do = distributedObjects
        self.__allowHide = True
        self.treeItemView = TreeItemView()
        self.treeItemView.setVerticalScrollMode(QAbstractItemView.ScrollPerItem)
        self.treeItemView.verticalScrollBar().rangeChanged.connect(self.resizeViewVertically)

        self.hide()

        self.exp = None

        addToWatchButton = QPushButton(Icons.watch, "")
        addToWatchButton.setMinimumSize(self.ICON_SIZE, self.ICON_SIZE)
        addToWatchButton.setMaximumSize(self.ICON_SIZE, self.ICON_SIZE)
        addToWatchButton.setToolTip("Add to Watch")
        addToWatchButton.clicked.connect(self.__addToWatch)
        addToDatagraphButton = QPushButton(Icons.datagraph, "")
        addToDatagraphButton.setMinimumSize(self.ICON_SIZE, self.ICON_SIZE)
        addToDatagraphButton.setMaximumSize(self.ICON_SIZE, self.ICON_SIZE)
        addToDatagraphButton.setToolTip("Add to Data Graph")
        addToDatagraphButton.clicked.connect(self.__addToDatagraph)
        setWatchpointButton = QPushButton(Icons.wp, "")
        setWatchpointButton.setMinimumSize(self.ICON_SIZE, self.ICON_SIZE)
        setWatchpointButton.setMaximumSize(self.ICON_SIZE, self.ICON_SIZE)
        setWatchpointButton.setToolTip("Set Watchpoint")
        setWatchpointButton.clicked.connect(self.__setWatchpoint)

        self.__layout = QHBoxLayout(self)
        self.__layout.addWidget(self.treeItemView)
        l = QVBoxLayout()
        l.addWidget(addToWatchButton)
        l.addWidget(addToDatagraphButton)
        l.addWidget(setWatchpointButton)
        l.addSpacerItem(QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding))
        # show a size grip in the corner to allow the user to resize the window
        l.addWidget(QSizeGrip(self))
        l.setSpacing(0)
        self.__layout.addLayout(l)
        self.__layout.setContentsMargins(0, 0, 0, 0)
        self.__layout.setSpacing(0)

        self.__hideTimer = QTimer()
        self.__hideTimer.setSingleShot(True)
        self.__hideTimer.timeout.connect(self.hideNow)

        self.treeItemView.contextMenuOpen.connect(self.__setDisallowHide)
        self.treeItemView.setRootIsDecorated(False)
        self.treeItemView.setHeaderHidden(True)
예제 #2
0
    def __init__(self, job, passes, job_id, closesig, source, parent=None):
        name = source.title
        super().__init__(name, parent)
        self.job = job
        self.passes = passes
        self.job_id = job_id
        self.closesig = closesig
        self.source = source

        self.setWindowTitle(name)
        self.setFeatures(QDockWidget.DockWidgetMovable
                         | QDockWidget.DockWidgetFloatable)
        self.setAllowedAreas(Qt.BottomDockWidgetArea)
        self.setFloating(True)

        self.widget = QWidget()
        layout = QVBoxLayout()
        #        layout.setSizeConstraint(QVBoxLayout.SetFixedSize)
        message_layout = QFormLayout()
        self.lblPass = QLabel('Pass ? of {}'.format(passes))
        message_layout.addRow(self.lblPass)
        self.lblFrame = QLabel('?')
        message_layout.addRow('Frame:', self.lblFrame)
        self.lblFps = QLabel('?')
        message_layout.addRow('Frames per Second:', self.lblFps)
        self.lblSize = QLabel('?')
        message_layout.addRow('File Size:', self.lblSize)
        self.lblTime = QLabel('?')
        message_layout.addRow('Video Time:', self.lblTime)
        self.lblBitrate = QLabel('?')
        message_layout.addRow('Bitrate:', self.lblBitrate)
        layout.addLayout(message_layout)

        self.progressbar = QProgressBar()
        self.progressbar.setRange(0, self.source.length.total_seconds())
        layout.addWidget(self.progressbar)

        self.qualitybar = QualityBar()
        layout.addWidget(self.qualitybar)

        btn_layout = QHBoxLayout()
        btn_More = QPushButton('More')
        btn_More.setCheckable(True)
        btn_layout.addWidget(btn_More)
        btn_layout.addStretch()
        self.btnCancel = QPushButton('Close')
        self.btnCancel.setIcon(QIcon(QPixmap(':/icons/application-exit.png')))
        self.btnCancel.clicked.connect(self.on_cancel_clicked)
        btn_layout.addWidget(self.btnCancel)
        layout.addLayout(btn_layout)

        self.terminal = QPlainTextEdit()
        self.terminal.setReadOnly(True)
        self.terminal.setShown(False)
        #        self.terminal.setMinimumWidth(400)
        btn_More.toggled.connect(self.terminal.setVisible)
        layout.addWidget(self.terminal)

        griplayout = QHBoxLayout()
        griplayout.addWidget(QSizeGrip(self.widget))
        griplayout.addStretch()
        griplayout.addWidget(QSizeGrip(self.widget))
        layout.addLayout(griplayout)

        self.widget.setLayout(layout)
        self.setWidget(self.widget)

        self.transcode_data[dict].connect(self.on_avconv_data)
        self.transcode_data[str].connect(self.on_terminal_data)
        self.closesig.connect(parent.on_jobclose)
예제 #3
0
    def __init__(self, parent=None, buttons=None):
        super(XPopupWidget, self).__init__(parent)

        # define custom properties
        self._anchor = XPopupWidget.Anchor.TopCenter
        self._autoCalculateAnchor = False
        self._autoCloseOnAccept = True
        self._autoCloseOnReject = True
        self._autoCloseOnFocusOut = False
        self._autoDefault = True
        self._first = True
        self._animated = False
        self._currentMode = None
        self._positionLinkedTo = []

        # define controls
        self._resizable = True
        self._popupPadding = 10
        self._titleBarVisible = True
        self._buttonBoxVisible = True
        self._dialogButton = QToolButton(self)
        self._closeButton = QToolButton(self)
        self._scrollArea = QScrollArea(self)
        self._sizeGrip = QSizeGrip(self)
        self._sizeGrip.setFixedWidth(12)
        self._sizeGrip.setFixedHeight(12)

        self._leftSizeGrip = QSizeGrip(self)
        self._leftSizeGrip.setFixedWidth(12)
        self._leftSizeGrip.setFixedHeight(12)

        if buttons is None:
            buttons = QDialogButtonBox.NoButton

        self._buttonBox = QDialogButtonBox(buttons, Qt.Horizontal, self)
        self._buttonBox.setContentsMargins(3, 0, 3, 9)

        self._scrollArea.setWidgetResizable(True)
        self._scrollArea.setFrameShape(QScrollArea.NoFrame)
        self._scrollArea.setSizePolicy(QSizePolicy.Expanding,
                                       QSizePolicy.Expanding)

        palette = self.palette()
        self._scrollArea.setPalette(palette)

        self._dialogButton.setToolTip('Popout to Dialog')
        self._closeButton.setToolTip('Close Popup')

        for btn in (self._dialogButton, self._closeButton):
            btn.setAutoRaise(True)
            btn.setIconSize(QSize(14, 14))
            btn.setMaximumSize(16, 16)

        # setup the icons
        icon = QIcon(projexui.resources.find('img/dialog.png'))
        self._dialogButton.setIcon(icon)

        icon = QIcon(projexui.resources.find('img/close.png'))
        self._closeButton.setIcon(icon)

        # define the ui
        hlayout = QHBoxLayout()
        hlayout.setSpacing(0)
        hlayout.addStretch(1)
        hlayout.addWidget(self._dialogButton)
        hlayout.addWidget(self._closeButton)
        hlayout.setContentsMargins(0, 0, 0, 0)

        hlayout2 = QHBoxLayout()
        hlayout2.addWidget(self._buttonBox)
        hlayout2.setContentsMargins(0, 0, 3, 0)

        vlayout = QVBoxLayout()
        vlayout.addLayout(hlayout)
        vlayout.addWidget(self._scrollArea)
        vlayout.addLayout(hlayout2)
        vlayout.setContentsMargins(3, 2, 3, 2)
        vlayout.setSpacing(0)

        self.setLayout(vlayout)
        self.setPositionLinkedTo(parent)

        # set default properties
        self.setAutoFillBackground(True)
        self.setBackgroundRole(QPalette.Button)
        self.setWindowTitle('Popup')
        self.setFocusPolicy(Qt.StrongFocus)
        self.setCurrentMode(XPopupWidget.Mode.Popup)

        # create connections
        self._dialogButton.clicked.connect(self.setDialogMode)
        self._closeButton.clicked.connect(self.reject)
        self._buttonBox.accepted.connect(self.accept)
        self._buttonBox.rejected.connect(self.reject)
        self._buttonBox.clicked.connect(self.handleButtonClick)
예제 #4
0
    def mousePressEvent(self, event):
        pass

    def mouseReleaseEvent(self, event):
        pass


if __name__ == "__main__":
    app = QApplication([])

    rect = QRectF(0, 0, 150, 150)

    scene = QGraphicsScene()
    scene.addRect(rect)

    view = QGraphicsView(scene)
    view.setSceneRect(rect)

    w = QWidget()
    w.setLayout(QVBoxLayout())
    w.layout().addWidget(view)
    w.layout().addWidget(QSizeGrip(view))
    # w.layout().addSpacerItem( QSpacerItem(0, 0, QSizePolicy.Expanding) )
    w.show()
    w.raise_()

    box = DraggableBox(None, scene=scene)
    box.setPos(10, 20)
    #box.setRotation(45)

app.exec_()