示例#1
0
文件: menu_bar.py 项目: zbx91/Dwarf
 def build_modules_list(self, list, modules):
     list.setMinimumWidth(int(self.app_window.get_app_instance().width() / 3))
     for m in sorted(modules, key=lambda x: x['name']):
         q = NotEditableListWidgetItem('%s (%s)' % (m['name'], str(m['base'])))
         q.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
         q.setCheckState(Qt.Checked)
         q.set_data(m)
         list.addItem(q)
示例#2
0
    def setup_options_view(self):
        self.options.setOrientation(Qt.Horizontal)

        filter_functions_layout = QVBoxLayout()
        filter_functions_layout.addWidget(QLabel("Filter functions"))

        bar = QScrollBar()
        bar.setFixedHeight(0)
        bar.setFixedWidth(0)

        self.filter_functions.setHorizontalScrollBar(bar)
        self.filter_functions.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.filter_functions.setPlainText(self.ftrace.get_current_filters())
        self.filter_functions.setPlaceholderText("*SyS_open*")
        filter_functions_layout.addWidget(self.filter_functions)

        filter_events_layout = QVBoxLayout()
        filter_events_layout.addWidget(QLabel("Filter events"))

        bar = QScrollBar()
        bar.setFixedHeight(0)
        bar.setFixedWidth(0)

        self.filter_events.setHorizontalScrollBar(bar)
        self.filter_events.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.filter_events.setPlainText(self.ftrace.get_current_events())
        self.filter_events.setPlaceholderText(
            'raw_syscalls:sys_exit\nraw_syscalls:sys_enter')
        filter_events_layout.addWidget(self.filter_events)

        filter_functions_widget = QWidget()
        filter_functions_widget.setLayout(filter_functions_layout)
        filter_events_widget = QWidget()
        filter_events_widget.setLayout(filter_events_layout)

        options_list_layout = QVBoxLayout()
        options_list_layout.addWidget(QLabel("Options"))

        for option in self.ftrace.get_options():
            if len(option) < 1:
                continue

            q = NotEditableListWidgetItem()
            q.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)

            if not option.startswith('no'):
                q.setCheckState(Qt.Checked)
                q.setText(option)
            else:
                q.setCheckState(Qt.Unchecked)
                q.setText(option[2:])
            self.options_list.addItem(q)

        options_list_layout.addWidget(self.options_list)

        options_list_widget = QWidget()
        options_list_widget.setLayout(options_list_layout)

        self.options.addWidget(filter_functions_widget)
        self.options.addWidget(filter_events_widget)
        self.options.addWidget(options_list_widget)