class ClickableQLabel(QtWidgets.QLabel): clicked = QtCore.pyqtSignal() doubleClicked = QtCore.pyqtSignal() def __init__(self, parent=None): QtWidgets.QLabel.__init__(self, parent) def mousePressEvent(self, ev): self.clicked.emit() def mouseDoubleClickEvent(self, ev): self.doubleClicked.emit()
def highlight_item_row(self, item): """ highlight the entire row containing a table item @param item: table item """ try: if not item.index().isValid(): return parent = item.parent() if parent is None: parent = item if not parent.hasChildren(): self.highlight_item(parent) return row = item.row() column_num = parent.columnCount() for column in xrange(0, column_num): if self.functionModel.hasIndex(row, column, parent.index()): cur_index = self.functionModel.index( row, column, parent.index()) self.highlight_item( self.functionModel.itemFromIndex(cur_index)) persistent_index = QtCore.QPersistentModelIndex(cur_index) self.highligthed_items.append(persistent_index) except Exception as ex: idaapi.msg("Error while highlighting item row: %s\n" % ex)
def initialize(self): self.adjustSize() self.setFixedSize(self.size()) self.animations = [] self.animation_group = QtCore.QParallelAnimationGroup() easing_curve = QtCore.QEasingCurve(QtCore.QEasingCurve.InCubic) for child in self.children(): animation = QtCore.QPropertyAnimation(child, 'pos') animation.setDuration(ANIMATION_DURATION) animation.setStartValue(child.pos()) animation.setEndValue(QtCore.QPoint(child.x(), self.height())) animation.setEasingCurve(easing_curve) self.animations.append(animation) self.animation_group.addAnimation(animation) self.animation_group.start() self.animation_group.setCurrentTime(self.animation_group.totalDuration())
def __init__(self, *args, **kwargs): super(AutoPopup, self).__init__(*args, **kwargs) self._auto_timer = QtCore.QTimer() connect_method_to_signal(self._auto_timer, 'timeout()', self._on_timer) self._callbacks = [] self._count = 0
def __init__(self): self._installed_views = set() if idaapi.IDA_SDK_VERSION >= 670: self._hooks = self._create_hooks(self._install_idabuddy) self._install_timer = None else: self._install_timer = QtCore.QTimer() connect_method_to_signal(self._install_timer, 'timeout()', self._on_install_timer) self._hooks = None
def __init__(self): self.data = {} self.is_open = False idb_path = idaapi.get_path(idaapi.PATH_TYPE_IDB) self.path = os.path.splitext(idb_path)[0] + '.cdb' self.autosave_path = os.path.splitext(idb_path)[0] + '.autosave.cdb' self.autosave_timer = QtCore.QTimer() self.autosave_timer.timeout.connect(self.autosave)
class EnterPressQTableWidget(QtWidgets.QTableWidget): cellEnterPressed = QtCore.pyqtSignal(int, int) def __init__(self, parent=None): super(EnterPressQTableWidget, self).__init__(parent) def keyPressEvent(self, event): if event.key() in [QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter]: row = self.currentRow() column = self.currentColumn() if row >= 0 and column >= 0: self.cellEnterPressed.emit(row, column) return super(EnterPressQTableWidget, self).keyPressEvent(event)
def get_extra_size(): extra_width = -min(TALKBUBBLE_X, 0) extra_height = -min(TALKBUBBLE_Y, 0) return QtCore.QSize(extra_width, extra_height)
def size_to_point(size): return QtCore.QPoint(size.width(), size.height())