コード例 #1
0
    def __init__(self, callback):
        super().__init__()

        self.callback = callback

        #Toolbar
        toolbar = QToolBar(self)
        self.button_test = toolbar.addAction("Test script")
        self.button_burn = toolbar.addAction("Write script to ROM")
        #self.button_reload = toolbar.addAction("Refresh")
        self.button_pokescriptdoc = toolbar.addAction("PokeScript doc")
        self.button_pokescriptdoc.setToolTip(
            "Opens your webbrowser, pointing at a page where some elemnets of PokeScript are explained."
        )
        self.button_scriptdoc = toolbar.addAction("List of commands.")
        self.button_scriptdoc.setToolTip(
            "Opens a list of available commands in your default browser.")
        toolbar.actionTriggered.connect(self.toolbarAction)

        #Code editor
        sourceeditor = LNTextEdit(self)
        font = QFont("Monospace")
        font.setStyleHint(QFont.TypeWriter)
        sourceeditor.setFont(font)
        sourceeditor.setLineWrapMode(0)
        sourceeditor.setHighlighterClass(PokeScriptHighlighter)

        #Wrap it up
        layout = QVBoxLayout(self)
        layout.addWidget(toolbar)
        layout.addWidget(sourceeditor)
        layout.setContentsMargins(0, 0, 0, 0)

        #Store elements that we need later
        self.sourceeditor = sourceeditor
コード例 #2
0
 def __init__(self, callback):
     super().__init__()
     
     self.callback = callback
     
     #Toolbar
     toolbar = QToolBar(self)
     self.button_test = toolbar.addAction("Test script")
     self.button_burn = toolbar.addAction("Write script to ROM")
     #self.button_reload = toolbar.addAction("Refresh")
     self.button_pokescriptdoc = toolbar.addAction("PokeScript doc")
     self.button_pokescriptdoc.setToolTip("Opens your webbrowser, pointing at a page where some elemnets of PokeScript are explained.")
     self.button_scriptdoc = toolbar.addAction("List of commands.")
     self.button_scriptdoc.setToolTip("Opens a list of available commands in your default browser.")
     toolbar.actionTriggered.connect(self.toolbarAction)
     
     #Code editor
     sourceeditor = LNTextEdit(self)
     font = QFont("Monospace")
     font.setStyleHint(QFont.TypeWriter)
     sourceeditor.setFont(font)
     sourceeditor.setLineWrapMode(0)
     sourceeditor.setHighlighterClass(PokeScriptHighlighter)
     
     #Wrap it up
     layout = QVBoxLayout(self)
     layout.addWidget(toolbar)
     layout.addWidget(sourceeditor)
     layout.setContentsMargins(0, 0, 0, 0)
     
     #Store elements that we need later
     self.sourceeditor = sourceeditor
コード例 #3
0
    def __init__(self, callback):
        super().__init__()
        self.callback = callback
        
        self.offset = 0         # Offset of currently oaded script
        self.pointerscount = 0  # Number of pointers to the offset
        self.oldsize = 0        # Old size of currently loaded bytestring.
        self.freespace = 0      # Free space available after currently loaded bytestring.
                
        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)

        formlayout = QFormLayout()
        label_charscount = QLabel()
        label_offset = QLabel()
        label_pointersToOffset = QLabel()
        formlayout.addRow("Used / Maximum number of chars:", label_charscount)
        formlayout.addRow("String offset:", label_offset)
        formlayout.addRow("Pointers to offset:", label_pointersToOffset)
        
        find_startpoint = QPushButton("Try to find start of string.", self)
        find_startpoint.hide()
        editor_save = QPushButton("Save", self)
        editor_save_repoint = QPushButton("Save and update pointers.", self)
        editor_save_repoint.hide()
        
        stringeditor = LNTextEdit(self)
        font = QFont("Monospace");
        font.setStyleHint(QFont.TypeWriter);
        stringeditor.setFont(font)
        
        layout.addWidget(stringeditor)
        layout.addLayout(formlayout)
        layout.addWidget(find_startpoint)
        layout.addWidget(editor_save)
        layout.addWidget(editor_save_repoint)

        #self.label_totalchars = label_totalchars
        self.stringeditor = stringeditor
        self.label_charscount = label_charscount
        self.label_offset = label_offset
        self.label_pointersToOffset = label_pointersToOffset
        self.editor_save = editor_save
        self.find_startpoint = find_startpoint
        self.editor_save_repoint = editor_save_repoint
        
        stringeditor.edit.textChanged.connect(self.updateUI)
        find_startpoint.clicked.connect(self.findStartpoint)
        editor_save.clicked.connect(self.save)
        editor_save_repoint.clicked.connect(self.saveandrepoint)
        
        self.updateUI()
コード例 #4
0
    def __init__(self, callback):
        super().__init__()
        self.callback = callback

        self.offset = 0  # Offset of currently oaded script
        self.pointerscount = 0  # Number of pointers to the offset
        self.oldsize = 0  # Old size of currently loaded bytestring.
        self.freespace = 0  # Free space available after currently loaded bytestring.

        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)

        formlayout = QFormLayout()
        label_charscount = QLabel()
        label_offset = QLabel()
        label_pointersToOffset = QLabel()
        formlayout.addRow("Used / Maximum number of chars:", label_charscount)
        formlayout.addRow("String offset:", label_offset)
        formlayout.addRow("Pointers to offset:", label_pointersToOffset)

        find_startpoint = QPushButton("Try to find start of string.", self)
        find_startpoint.hide()
        editor_save = QPushButton("Save", self)
        editor_save_repoint = QPushButton("Save and update pointers.", self)
        editor_save_repoint.hide()

        stringeditor = LNTextEdit(self)
        font = QFont("Monospace")
        font.setStyleHint(QFont.TypeWriter)
        stringeditor.setFont(font)

        layout.addWidget(stringeditor)
        layout.addLayout(formlayout)
        layout.addWidget(find_startpoint)
        layout.addWidget(editor_save)
        layout.addWidget(editor_save_repoint)

        #self.label_totalchars = label_totalchars
        self.stringeditor = stringeditor
        self.label_charscount = label_charscount
        self.label_offset = label_offset
        self.label_pointersToOffset = label_pointersToOffset
        self.editor_save = editor_save
        self.find_startpoint = find_startpoint
        self.editor_save_repoint = editor_save_repoint

        stringeditor.edit.textChanged.connect(self.updateUI)
        find_startpoint.clicked.connect(self.findStartpoint)
        editor_save.clicked.connect(self.save)
        editor_save_repoint.clicked.connect(self.saveandrepoint)

        self.updateUI()