Exemplo n.º 1
0
    def __init__(self):
        super(TypedefDialog, self).__init__()

        self.setWindowTitle('Classy Typedefs')

        layout = QtWidgets.QVBoxLayout(self)

        self.list = QtWidgets.QListWidget()
        layout.addWidget(self.list)

        button_layout = QtWidgets.QHBoxLayout(self)
        layout.addLayout(button_layout)

        button_layout.addItem(
            QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Minimum))

        add_btn = QtWidgets.QPushButton('Add')
        add_btn.clicked.connect(self.handle_add)
        button_layout.addWidget(add_btn)

        edit_btn = QtWidgets.QPushButton('Edit')
        edit_btn.clicked.connect(self.handle_edit)
        button_layout.addWidget(edit_btn)

        remove_btn = QtWidgets.QPushButton('Remove')
        remove_btn.clicked.connect(self.handle_remove)
        button_layout.addWidget(remove_btn)

        self.update_list()
Exemplo n.º 2
0
    def __init__(self,
                 inital_new_name='',
                 title='Select a struct',
                 has_none_btn=False):
        super(ChooseStructDialog, self).__init__()

        self.struct_id = idc.BADADDR

        self.setWindowTitle(title)

        layout = QtWidgets.QHBoxLayout(self)

        self.new_name_w = QtWidgets.QLineEdit()
        self.new_name_w.setText(inital_new_name)
        self.new_name_w.setMinimumWidth(200)
        layout.addWidget(self.new_name_w)

        new_btn = QtWidgets.QPushButton('New')
        new_btn.clicked.connect(self.handle_new)
        layout.addWidget(new_btn)

        existing_btn = QtWidgets.QPushButton('Existing')
        existing_btn.clicked.connect(self.handle_existing)
        layout.addWidget(existing_btn)

        if has_none_btn:
            none_btn = QtWidgets.QPushButton('None')
            none_btn.clicked.connect(self.handle_none)
            layout.addWidget(none_btn)

        cancel_btn = QtWidgets.QPushButton('Cancel')
        cancel_btn.clicked.connect(self.reject)
        layout.addWidget(cancel_btn)
Exemplo n.º 3
0
    def _install_idabuddy(self, idaview):
        if idaview in self._installed_views:
            return
        self._installed_views.add(idaview)
        layout = QtWidgets.QHBoxLayout(idaview)
        popup = AutoPopup(idaview)
        layout.addWidget(popup)
        layout.setAlignment(QtCore.Qt.AlignBottom | QtCore.Qt.AlignRight)
        layout.setContentsMargins(0, 0, 0, 0)
        popup.automate(sequences.say_address, *[sequences.say_random_saying]*10)
        popup.start()

        return popup
Exemplo n.º 4
0
Arquivo: gui.py Projeto: clayne/Classy
    def OnCreate(self, form):
        self.parent = self.FormToPyQtWidget(form)

        layout = QtWidgets.QVBoxLayout()

        # Setup left side
        left_widget = QtWidgets.QWidget()
        left_layout = QtWidgets.QVBoxLayout(left_widget)

        splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
        layout.addWidget(splitter)

        self.class_tree = QtWidgets.QTreeWidget()
        self.class_tree.header().hide()
        self.class_tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.class_tree.customContextMenuRequested.connect(
            self.handle_class_tree_context_menu)
        self.class_tree.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)
        self.class_tree.itemSelectionChanged.connect(
            self.handle_class_tree_selection_change)
        left_layout.addWidget(self.class_tree)

        button_layout = QtWidgets.QHBoxLayout()

        add_button = QtWidgets.QPushButton('Add')
        add_button.clicked.connect(self.add_class)
        button_layout.addWidget(add_button)

        remove_button = QtWidgets.QPushButton('Remove')
        remove_button.clicked.connect(self.remove_class)
        button_layout.addWidget(remove_button)

        left_layout.addLayout(button_layout)

        splitter.addWidget(left_widget)

        # Setup right side
        self.class_edit = ClassWidget(self)
        splitter.addWidget(self.class_edit)

        splitter.setSizes([100, 100000])

        self.parent.setLayout(layout)

        self.update_fields()
Exemplo n.º 5
0
Arquivo: gui.py Projeto: clayne/Classy
    def __init__(self, parent_gui):
        QtWidgets.QWidget.__init__(self)

        self.parent_gui = parent_gui

        self.edit_class = None

        layout = QtWidgets.QGridLayout(self)

        self.name = QtWidgets.QLabel()
        layout.addWidget(self.name, 0, 0)

        self.set_name = QtWidgets.QPushButton('Set')
        self.set_name.setMaximumWidth(50)
        self.set_name.clicked.connect(self.handle_set_name)
        layout.addWidget(self.set_name, 0, 1)

        self.base_class = QtWidgets.QLabel()
        layout.addWidget(self.base_class, 1, 0, 1, 2)

        self.derived_classes = QtWidgets.QLabel()
        layout.addWidget(self.derived_classes, 2, 0, 1, 2)

        self.struct = util.ClickableQLabel()
        self.struct.doubleClicked.connect(self.handle_struct_double_clicked)
        layout.addWidget(self.struct, 3, 0)

        self.set_struct = QtWidgets.QPushButton('Set')
        self.set_struct.setMaximumWidth(50)
        self.set_struct.clicked.connect(self.handle_set_struct)
        layout.addWidget(self.set_struct, 3, 1)

        self.vtable_range = QtWidgets.QLabel()
        layout.addWidget(self.vtable_range, 4, 0)

        self.set_vtable_range = QtWidgets.QPushButton('Set')
        self.set_vtable_range.setMaximumWidth(50)
        self.set_vtable_range.clicked.connect(self.handle_set_vtable_range)
        layout.addWidget(self.set_vtable_range, 4, 1)

        self.vtable = util.EnterPressQTableWidget()
        self.vtable.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding)
        self.vtable.setColumnCount(4)
        self.vtable.setHorizontalHeaderLabels(
            ['ID', 'Address', 'Function', 'Type'])
        vtable_header = self.vtable.horizontalHeader()
        vtable_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch)
        self.vtable.verticalHeader().hide()
        self.vtable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.vtable.cellDoubleClicked.connect(self.handle_vtable_interaction)
        self.vtable.cellEnterPressed.connect(self.handle_vtable_interaction)
        layout.addWidget(self.vtable, 5, 0, 1, 2)

        self.methods = util.EnterPressQTableWidget()
        self.methods.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Expanding)
        self.methods.setColumnCount(2)
        self.methods.setHorizontalHeaderLabels(['Address', 'Function'])
        methods_header = self.methods.horizontalHeader()
        methods_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        self.methods.verticalHeader().hide()
        self.methods.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        # self.methods.setSortingEnabled(True) Todo
        self.methods.cellDoubleClicked.connect(self.handle_methods_interaction)
        self.methods.cellEnterPressed.connect(self.handle_methods_interaction)
        layout.addWidget(self.methods, 6, 0, 1, 2)

        method_btn_layout = QtWidgets.QHBoxLayout()

        self.add_method_btn = QtWidgets.QPushButton('Add')
        self.add_method_btn.setMaximumWidth(50)
        self.add_method_btn.clicked.connect(self.handle_add_method)
        method_btn_layout.addWidget(self.add_method_btn)

        self.remove_method_btn = QtWidgets.QPushButton('Remove')
        self.remove_method_btn.setMaximumWidth(50)
        self.remove_method_btn.clicked.connect(self.handle_remove_method)
        method_btn_layout.addWidget(self.remove_method_btn)

        method_btn_layout.addItem(
            QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Minimum))

        layout.addLayout(method_btn_layout, 7, 0, 1, 2)

        self.update_fields()