Skip to content

Commit

Permalink
Updates binlex cutter plugin
Browse files Browse the repository at this point in the history
Buttons menu with QHboxLayout,
Table fullscreen view and header resize policy updated
  • Loading branch information
jbx81-1337 committed Nov 24, 2021
1 parent a2d9ee7 commit 8405b42
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions plugins/binlex_cutter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cutter

import re
import os
import tempfile
Expand All @@ -8,7 +7,7 @@
from functools import partial
from multiprocessing import Pool
from PySide2.QtCore import QObject, SIGNAL, Qt
from PySide2.QtWidgets import QAction, QVBoxLayout, QLabel, QWidget, QSizePolicy, QPushButton, QComboBox, QLineEdit, QFileDialog, QTableView, QHeaderView, QTableWidget, QAbstractItemView, QLineEdit, QTableWidgetItem, QComboBox
from PySide2.QtWidgets import *
from glob import glob

def load_traits_worker(file_path):
Expand Down Expand Up @@ -69,6 +68,28 @@ def __init__(self, parent, action):
layout.addWidget(label_title)
layout.setAlignment(label_title, Qt.AlignHCenter | Qt.AlignTop)

menu = QWidget(content)
menu_layout = QHBoxLayout(menu)

traits_library_btn = QPushButton(menu)
traits_library_btn.setText('Traits Library')
QObject.connect(traits_library_btn, SIGNAL("clicked()"), self.traits_library)

matches_btn = QPushButton(menu)
matches_btn.setText('Matches')
QObject.connect(matches_btn, SIGNAL("clicked()"), self.matches)

similarities_btn = QPushButton(menu)
similarities_btn.setText('Similarities')
QObject.connect(similarities_btn, SIGNAL("clicked()"), self.similarities)

menu_layout.addWidget(traits_library_btn)
menu_layout.addWidget(matches_btn)
menu_layout.addWidget(similarities_btn)
menu.setLayout(menu_layout)

layout.addWidget(menu)

# Traits Table
self.table_traits = QTableWidget()
self.table_traits.setShowGrid(False)
Expand All @@ -82,6 +103,15 @@ def __init__(self, parent, action):
self.table_traits.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
self.table_traits.setContentsMargins(0,0,0,0)
self.table_traits.setEditTriggers(QAbstractItemView.NoEditTriggers)

header = self.table_traits.horizontalHeader()
header.setSectionResizeMode(1, QHeaderView.ResizeToContents)

self.table_traits.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)
self.table_traits.setAlternatingRowColors(True)
self.table_traits.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)


layout.addWidget(self.table_traits)
layout.setAlignment(self.table_traits, Qt.AlignLeft)

Expand Down Expand Up @@ -145,8 +175,20 @@ def load_traits(self):
for i in range(0, len(traits)):
self.table_traits.setItem(i, 0, QTableWidgetItem(traits[i]['name']))
self.table_traits.setItem(i, 1, QTableWidgetItem(traits[i]['trait']))
self.table_traits.resizeColumnsToContents()
self.table_traits.resizeRowsToContents()
self.show()
cutter.message("[*] binlex finished loading traits")

def traits_library():
pass

def matches():
pass

def similarities():
pass


class BinlexPlugin(cutter.CutterPlugin):

Expand Down

0 comments on commit 8405b42

Please sign in to comment.