Ejemplo n.º 1
0
    def __init__(self):
        self.previews = dict()
        self.previous_lock = QtCore.QReadWriteLock()

        self.jobs = dict()
        self.jobs_lock = QtCore.QReadWriteLock()

        self.first = None
        self.first_lock = QtCore.QReadWriteLock()

        self.queue = QtCore.QSemaphore(1)
Ejemplo n.º 2
0
    def __init__(self, sourceTree, parent=None):
        """CueStateBar init
        @type  sourceTree: QTreeWidget
        @param sourceTree: The tree to get the jobs from
        @type  parent: QWidget
        @param parent: The parent widget"""
        QtWidgets.QWidget.__init__(self, parent)

        self.__background = None

        self.setContentsMargins(8, 1, 1, 1)
        self.setFixedWidth(22)

        self.__sourceTree = weakref.proxy(sourceTree)
        self.__colors = []
        # pylint: disable=no-member
        self.__baseColor = QtGui.qApp.palette().color(QtGui.QPalette.Base)
        # pylint: enable=no-member
        self.__colorsLock = QtCore.QReadWriteLock()
        self.__timer = QtCore.QTimer(self)
        self.__lastUpdate = 0

        self.__timer.timeout.connect(self.updateColors)
        self.__sourceTree.verticalScrollBar().valueChanged.connect(self.update)
        self.__sourceTree.verticalScrollBar().rangeChanged.connect(
            self.__updateColors)

        self.__timer.start(10000)
Ejemplo n.º 3
0
    def __init__(self,
                 title,
                 function,
                 work,
                 concurrent,
                 cancelTitle,
                 cancelText,
                 parent=None):
        """Creates, displays and starts the progress bar.
        @type  title: str
        @param title: The title for the progress bar
        @type  function: callable
        @param function: The function that the work units should be passed to
        @type  work: list<sequence>
        @param work: A list of sequences to pass to the function
        @type  concurrent: int
        @param concurrent: The number of units to submit to threadpool at once
        @type  cancelTitle: string
        @param cancelTitle: This is displayed as the title of the confirmation
                            dialog box if the user attempts to cancel
        @type  cancelText: string
        @param cancelText: This is displayed as the text of the confirmation
                           dialog box if the user attempts to cancel
        @type  parent: QObject
        @param parent: The parent for this object"""
        QtWidgets.QDialog.__init__(self, parent)

        self.__work = work
        self.__function = function

        self.__workLock = QtCore.QReadWriteLock()
        self.__count = 0

        self.__bar = QtWidgets.QProgressBar(self)
        self.__bar.setRange(0, len(self.__work))
        self.__bar.setValue(0)
        self.__btn_cancel = QtWidgets.QPushButton("Cancel", self)
        self.__cancelConfirmation = None
        self.__cancelTitle = cancelTitle
        self.__cancelText = cancelText

        vlayout = QtWidgets.QVBoxLayout(self)
        vlayout.addWidget(self.__bar)
        vlayout.addWidget(self.__btn_cancel)
        self.setLayout(vlayout)

        self.setWindowFlags(self.windowFlags()
                            | QtCore.Qt.WindowStaysOnTopHint)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setSizeGripEnabled(True)
        self.setFixedSize(300, 100)
        self.setWindowTitle(title)

        self.__btn_cancel.clicked.connect(self.cancel)

        self.show()

        # Submit a new unit of work to the threadpool for each concurrent thread.
        for _ in range(max(concurrent, 1)):
            self._submitWork()
Ejemplo n.º 4
0
    def __init__(self, parent):
        """Standard method to display a list or tree using QTreeWidget

        columnInfoByType is a dictionary of lists keyed to opencue.Constants.TYPE_*
        Each value is a list of lists that each define a column.
        [<column name>, <width>, <lambda function>, <function name for sorting>,
        <column delegate class>]
        Only supported on the primary column:
        <column name>, <column delegate class>, <width>

        @type  parent: QWidget
        @param parent: The widget to set as the parent"""
        QtWidgets.QTreeWidget.__init__(self, parent)

        self._items = {}
        self._lastUpdate = 0

        self._itemsLock = QtCore.QReadWriteLock()
        self._timer = QtCore.QTimer(self)

        self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)

        self.setUniformRowHeights(True)
        self.setAutoScroll(False)
        self.setFocusPolicy(QtCore.Qt.NoFocus)
        self.setAlternatingRowColors(True)

        self.setSortingEnabled(True)
        self.header().setSectionsMovable(True)
        self.header().setStretchLastSection(True)
        self.sortByColumn(0, QtCore.Qt.AscendingOrder)

        self.setItemDelegate(cuegui.ItemDelegate.ItemDelegate(self))

        self.__setupColumns()

        self.__setupColumnMenu()

        self.itemClicked.connect(self.__itemSingleClickedEmitToApp)
        self.itemDoubleClicked.connect(self.__itemDoubleClickedEmitToApp)
        self._timer.timeout.connect(self.updateRequest)
        # pylint: disable=no-member
        QtGui.qApp.request_update.connect(self.updateRequest)
        # pylint: enable=no-member

        self.updateRequest()
        self.setUpdateInterval(10)
Ejemplo n.º 5
0
 def __init__(self):
     self.cancelled = False
     self.lock = QtCore.QReadWriteLock()