Ejemplo n.º 1
0
    def __init__(self, parent, iv=False):
        super(KeyDialog, self).__init__(parent)
        self.key = BinaryData.BinaryData("")
        if iv:
            self.iv = BinaryData.BinaryData("")

        self.setWindowTitle("Input Key")
        layout = QVBoxLayout()

        layout.addWidget(QLabel("Key:"))
        self.edit = View.ViewFrame(HexEditor.HexEditor, self.key, "",
                                   [HexEditor.HexEditor])
        if iv:
            self.edit.setMinimumSize(600, 32)
        else:
            self.edit.setMinimumSize(600, 64)
        layout.addWidget(self.edit, 1)

        if iv:
            layout.addWidget(QLabel("Initialization vector:"))
            self.iv_edit = View.ViewFrame(HexEditor.HexEditor, self.iv, "",
                                          [HexEditor.HexEditor])
            self.iv_edit.setMinimumSize(600, 32)
            layout.addWidget(self.iv_edit, 1)

        self.closeButton = QPushButton("Close")
        self.closeButton.clicked.connect(self.close)
        self.closeButton.setAutoDefault(False)

        self.assembleButton = QPushButton("OK")
        self.assembleButton.clicked.connect(self.accept)
        self.assembleButton.setAutoDefault(True)

        buttonLayout = QHBoxLayout()
        buttonLayout.setContentsMargins(0, 0, 0, 0)
        buttonLayout.addStretch(1)
        buttonLayout.addWidget(self.assembleButton)
        buttonLayout.addWidget(self.closeButton)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)
Ejemplo n.º 2
0
 def python_console_api(self):
     if sys.executable.lower().find('python') == -1:
         base_path = os.path.dirname(sys.executable)
     else:
         base_path = os.path.dirname(__file__)
     path = os.path.abspath(os.path.join(base_path, 'docs/python_api.html'))
     data = BinaryData(path)
     frame = ViewFrame(HelpView, data, "Python Console API", [HelpView])
     frame.statusUpdated.connect(self.statusUpdated)
     frame.viewChanged.connect(self.viewChanged)
     frame.closeRequest.connect(self.forceClose)
     index = self.focus_tab.addTab(frame, frame.getTabName())
     self.focus_tab.setCurrentIndex(index)
     frame.view.setFocus(Qt.OtherFocusReason)
Ejemplo n.º 3
0
 def new(self):
     self.create_tab(BinaryData(), "")
Ejemplo n.º 4
0
 def new_text(self, cls):
     self.create_tab(BinaryData(), "",
                     TextEditor).view.set_highlight_type(cls)
Ejemplo n.º 5
0
 def create_tab_from_data(self, data):
     self.create_tab(BinaryData(data), "")