def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) self.__color = QtGui.QColor(55, 200, 55) self.__brush = QtGui.QBrush() self.__brush.setColor(self.__color) self.__brush.setStyle(QtCore.Qt.SolidPattern) self.__show = opencue.api.findShow("clo") self.__history = [0] * 100 self.__line = 575 self.__max = max(self.__line * 1.2, 80) self.__timer = QtCore.QTimer(self) self.__timer.timeout.connect(self.addNumber) self.__timer.start(10000)
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(False) self.header().setStretchLastSection(True) self.sortByColumn(0, QtCore.Qt.AscendingOrder) self.setItemDelegate(ItemDelegate(self)) self.__setupColumns() self.__setupColumnMenu() self.itemClicked.connect(self.__itemSingleClickedEmitToApp) self.itemDoubleClicked.connect(self.__itemDoubleClickedEmitToApp) self._timer.timeout.connect(self.updateRequest) QtGui.qApp.request_update.connect(self.updateRequest) self.updateRequest() self.setUpdateInterval(10)
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.setContentsMargins(8, 1, 1, 1) self.setFixedWidth(22) self.__sourceTree = weakref.proxy(sourceTree) self.__colors = [] self.__baseColor = QtGui.qApp.palette().color(QtGui.QPalette.Base) 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)
def startTicksUpdate(self, updateInterval, updateWhenMinimized=False, maxUpdateInterval=None): """A method of updating the display on a one second timer to avoid multiple update requests and reduce excess cuebot calls. You will need to implement self.tick, You do not need to provide locking or unhandled error logging. You will need to implement tick. self.ticksWithoutUpdate = number of seconds since the last update. self.ticksLock = QMutex""" self.updateInterval = updateInterval self.__updateWhenMinimized = updateWhenMinimized self.__maxUpdateInterval = maxUpdateInterval # Stop the default update method if hasattr(self, "_timer"): self._timer.stop() self.ticksLock = QtCore.QMutex() self.__ticksTimer = QtCore.QTimer(self) self.__ticksTimer.timeout.connect(self.__tick) self.__ticksTimer.start(1000) self.ticksWithoutUpdate = 999