matkuki / qscintilla_docs

Documentation for QScintilla editing component of the PyQt framework
http://qscintilla.com/
GNU General Public License v3.0
59 stars 17 forks source link

Add Macros #12

Open JakobDev opened 5 years ago

JakobDev commented 5 years ago

It would be really nice if you add macros to the documentation.

Here a description how they work: First you need to create a macro with the QsciMacro Class. It takes QsciScintilla as argument. macro = QsciMacro(self.editor)

You can start recording macros with startRecording(). It doesn't need to be in a thread or something else. macro.startRecording()

You can stop recording with endRecording(). macro.stopRecording()

You can play a recorded macro with play() macro.play()

If like to save a macro, call macro.save(). If will return a string, that can be saved in a file or something else.

f = open("myMacro.txt","w",encoding="utf-8")
f.write(macro.save())
f.close()

You can load a macro from a string, that you created with macro.save() with macro.load().

macro = QsciMacro(self.editor)
f =open("myMacro.txt","r",encoding="utf-8")
macro.load(f.read())
f.close()

macro.clear() clears a macro.

That was all I found about about macros. I hope it helps you to complete your great documentation.

matkuki commented 5 years ago

@JakobDev Thanks for the example. Yes, I will add it as soon as I can. Need to play with it for a bit to get the hang of it.

Cheers