def __init__(self, parent=None): super(ScriptEdit, self).__init__(parent) self.current_format = 'Human' self.script = Script() self.textChanged.connect(self.on_text_changed) self.setFont(monospace_font) # For tooltips self.context = []
def set_data(self, text, fmt): script = None if fmt == 'Hex' and len(text) % 2 == 0: try: script = Script(text.decode('hex')) except Exception: pass elif fmt == 'Human': txt, self.context = transform_human_script(text, self.gui) script = Script.from_human(txt) self.script = script
def __init__(self, parent=None): super(MyScriptEdit, self).__init__(parent) self.current_format = known_script_formats[0] self.script = Script() self.textChanged.connect(self.on_text_changed) self.setFont(monospace_font)