def __init__(self, parent=None): super(XDockToolbar, self).__init__(parent) # defines the position for this widget self._currentAction = -1 self._selectedAction = None self._padding = 8 self._position = XDockToolbar.Position.South self._minimumPixmapSize = QSize(16, 16) self._maximumPixmapSize = QSize(48, 48) self._hoverTimer = QTimer(self) self._hoverTimer.setSingleShot(True) self._hoverTimer.setInterval(1000) self._actionHeld = False self._easingCurve = QEasingCurve(QEasingCurve.InOutQuad) self._duration = 200 self._animating = False # install an event filter to update the location for this toolbar layout = QBoxLayout(QBoxLayout.LeftToRight) layout.setContentsMargins(2, 2, 2, 2) layout.setSpacing(0) layout.addStretch(1) layout.addStretch(1) self.setLayout(layout) self.setContentsMargins(2, 2, 2, 2) self.setMouseTracking(True) parent.window().installEventFilter(self) parent.window().statusBar().installEventFilter(self) self._hoverTimer.timeout.connect(self.emitActionHovered)
def __init__(self, tableType, widget): super(XOrbSearchCompleter, self).__init__(widget) # set default properties self.setModel(QStringListModel(self)) self.setCaseSensitivity(Qt.CaseInsensitive) self.setCompletionMode(QCompleter.UnfilteredPopupCompletion) # define custom properties self._currentRecord = None self._records = [] self._tableType = tableType self._baseQuery = None self._order = None self._lastSearch = '' self._cache = {} self._refreshTimer = QTimer(self) self._limit = 10 # limited number of search results self._pywidget = widget # need to store the widget as the parent # to avoid pyside crashing - # EKH 02/01/13 self._refreshTimer.setInterval(500) self._refreshTimer.setSingleShot(True) self._refreshTimer.timeout.connect(self.refresh)
def __init__(self, parent=None): # needs to be defined before the base class is initialized or the # event filter won't work self._treePopupWidget = None super(XOrbRecordBox, self).__init__( parent ) # define custom properties self._currentRecord = None # only used while loading self._changedRecord = -1 self._tableTypeName = '' self._tableLookupIndex = '' self._baseHints = ('', '') self._batchSize = 100 self._tableType = None self._order = None self._query = None self._iconMapper = None self._labelMapper = nstr self._required = True self._loaded = False self._showTreePopup = False self._autoInitialize = False self._threadEnabled = True self._specifiedColumns = None self._specifiedColumnsOnly = False # define an editing timer self._editedTimer = QTimer(self) self._editedTimer.setSingleShot(True) self._editedTimer.setInterval(500) # create threading options self._worker = None self._workerThread = None # create connections edit = self.lineEdit() if edit: edit.textEntered.connect(self.assignCurrentRecord) edit.editingFinished.connect(self.emitCurrentRecordEdited) edit.returnPressed.connect(self.emitCurrentRecordEdited) self.currentIndexChanged.connect(self.emitCurrentRecordChanged) self.currentIndexChanged.connect(self.startEditTimer) self._editedTimer.timeout.connect(self.emitCurrentRecordEdited) QApplication.instance().aboutToQuit.connect(self._cleanupWorker)
def __init__(self, parent=None): super(XMenu, self).__init__(parent) # define custom parameters self._acceptedAction = None self._showTitle = True self._advancedMap = {} self._customData = {} self._titleHeight = 24 self._toolTipAction = None self._toolTipTimer = QTimer(self) self._toolTipTimer.setInterval(1000) self._toolTipTimer.setSingleShot(True) # set default parameters self.setContentsMargins(0, self._titleHeight, 0, 0) self.setShowTitle(False) # create connections self.hovered.connect(self.startActionToolTip) self.aboutToShow.connect(self.clearAcceptedAction) self._toolTipTimer.timeout.connect(self.showActionToolTip)