Skip to content

Instantly share code, notes, and snippets.

@icecr4ck
Created June 12, 2019 19:33
Show Gist options
  • Save icecr4ck/eb5b9e4ecb9326c5f16a24f4809a5832 to your computer and use it in GitHub Desktop.
Save icecr4ck/eb5b9e4ecb9326c5f16a24f4809a5832 to your computer and use it in GitHub Desktop.

Revisions

  1. icecr4ck created this gist Jun 12, 2019.
    37 changes: 37 additions & 0 deletions binja_ui_template.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    import sys
    from PySide2.QtWidgets import (QApplication, QDialog, QPushButton, QLabel, QHBoxLayout)
    from PySide2.QtCore import Qt
    from binaryninjaui import (UIAction, UIActionHandler, Menu)

    class GreatUI(QDialog):

    def __init__(self, parent=None):
    super(GreatUI, self).__init__(parent)
    self.setWindowModality(Qt.NonModal)
    self.title = QLabel(self.tr("Great UI"))
    self.setWindowTitle(self.title.text())
    self.testButton = QPushButton(self.tr("Press Me"))

    buttons = QHBoxLayout()
    buttons.addWidget(self.testButton)

    self.setLayout(buttons)
    self.testButton.clicked.connect(self.test)

    def test(self):
    print("GREAT SUCCESS")


    def launchPlugin(context):
    gui = GreatUI()
    gui.exec_()

    if __name__ == '__main__':
    app = QApplication(sys.argv)
    gui = GreatUI()
    gui.exec_()
    sys.exit(app.exec_())
    else:
    UIAction.registerAction("Great UI")
    UIActionHandler.globalActions().bindAction("Great UI", UIAction(launchPlugin))
    Menu.mainMenu("Tools").addAction("Great UI", "GUI")