def __showContextMenu(self, coord): """Shows the frames list context menu""" self.__contextItem = self.__framesList.itemAt(coord) if self.__contextItem is not None: self.__setCurrentMenuItem.setEnabled( not self.__contextItem.isCurrent()) self.__framesMenu.popup(QCursor.pos())
def __getTooltipPos(self): """Calculates the tooltip position - above the row""" pos = QCursor.pos() if pos.x() + self.sizeHint().width() >= self.__screenWidth: pos.setX(self.__screenWidth - self.sizeHint().width() - 2) pos.setY(pos.y() - self.__cellHeight - 1 - self.sizeHint().height()) return pos
def __showContextMenu(self, point): """Context menu""" self.__callersMenu.clear() self.__outsideCallersMenu.clear() self.__calleesMenu.clear() self.__outsideCalleesMenu.clear() # Detect what the item was clicked item = self.__table.itemAt(point) funcName = item.getFunctionName() # Build the context menu if item.callersCount() == 0: self.__callersMenu.setEnabled(False) self.__outsideCallersMenu.setEnabled(False) else: callers = self.__stats.stats[item.getFuncIDs()][4] callersList = list(callers.keys()) callersList.sort() for callerFunc in callersList: menuText = self.__getCallLine(callerFunc, callers[callerFunc]) if self.__isOutsideItem(callerFunc[0]): act = self.__outsideCallersMenu.addAction(menuText) else: act = self.__callersMenu.addAction(menuText) funcFileName, funcLine, funcName = \ self.__getLocationAndName(callerFunc) act.setData(funcFileName + ":" + str(funcLine) + ":" + funcName) self.__callersMenu.setEnabled(not self.__callersMenu.isEmpty()) self.__outsideCallersMenu.setEnabled( not self.__outsideCallersMenu.isEmpty()) if item.calleesCount() == 0: self.__calleesMenu.setEnabled(False) self.__outsideCalleesMenu.setEnabled(False) else: callees = self.__stats.all_callees[item.getFuncIDs()] calleesList = list(callees.keys()) calleesList.sort() for calleeFunc in calleesList: menuText = self.__getCallLine(calleeFunc, callees[calleeFunc]) if self.__isOutsideItem(calleeFunc[0]): act = self.__outsideCalleesMenu.addAction(menuText) else: act = self.__calleesMenu.addAction(menuText) funcFileName, funcLine, funcName = \ self.__getLocationAndName(calleeFunc) act.setData(funcFileName + ":" + str(funcLine) + ":" + funcName) self.__calleesMenu.setEnabled(not self.__calleesMenu.isEmpty()) self.__outsideCalleesMenu.setEnabled( not self.__outsideCalleesMenu.isEmpty()) self.__contextMenu.popup(QCursor.pos())
def __showContextMenu(self, coord): """Shows the frames list context menu""" self.__currentItem = self.exceptionsList.itemAt(coord) self.__addToIgnoreMenuItem.setEnabled( self.__addToIgnoreButton.isEnabled()) self.__jumpToCodeMenuItem.setEnabled( self.__jumpToCodeButton.isEnabled()) if self.__currentItem is not None: self.__excptMenu.popup(QCursor.pos())
def __onTimer(self): """Triggered by the show tooltip timer""" currentPos = QCursor.pos() if abs(currentPos.x() - self.startPosition.x()) <= 2 and \ abs(currentPos.y() - self.startPosition.y()) <= 2: # No movement since last time, show the tooltip self.show() return # There item has not been changed, but the position within it was # So restart the timer, but for shorter self.startPosition = currentPos self.tooltipTimer.start(400)
def __showContextMenu(self, _): """Shows the context menu""" index = self.currentIndex() if not index.isValid(): return sindex = self.toSourceIndex(index) if not sindex.isValid(): return bpoint = self.__model.getBreakPointByIndex(sindex) if not bpoint: return enableCount, disableCount = self.__model.getCounts() self.__editAct.setEnabled(True) self.__enableAct.setEnabled(not bpoint.isEnabled()) self.__disableAct.setEnabled(bpoint.isEnabled()) self.__jumpToCodeAct.setEnabled(True) self.__delAct.setEnabled(True) self.__enableAllAct.setEnabled(disableCount > 0) self.__disableAllAct.setEnabled(enableCount > 0) self.__delAllAct.setEnabled(enableCount + disableCount > 0) self.menu.popup(QCursor.pos())
def __showContextMenu(self, coord): """Shows the frames list context menu""" contextItem = self.exceptionsList.itemAt(coord) if contextItem is not None: self.__currentItem = contextItem self.__excptMenu.popup(QCursor.pos())
def startShowTimer(self): """Memorizes the cursor position and starts the timer""" self.tooltipTimer.stop() self.startPosition = QCursor.pos() self.tooltipTimer.start(500) # 0.5 sec