Git Product home page Git Product logo

Comments (3)

matkuki avatar matkuki commented on June 3, 2024

@flutefreak7 Hey,
Ex.Co is a standalone PyQt application that uses a subclassed QMainWindow as it's main GUI component on which it relies heavily. So from that standpoint it is not meant to be embedded into another application.
But I think Ex.Co is great if you want to add your light QsciScintilla based editor you mentioned into Ex.Co, that should not be difficult. I can even help you with that.

As far as using the code from Ex.Co, of course you can and in any way you like. You just have to make sure that if you distribute your application, you have to make the entire source code available, as per GPLv3. You can read the LICENSE.txt for the whole license explanation (github even has the synopsis of the license in bullet points on the top of that file page).

Matic

from exco.

flutefreak7 avatar flutefreak7 commented on June 3, 2024

I'm building a fairly big customized GUI to wrap an analysis code. Much of the GUI is widgets to control analysis input settings and 2D and 3D plots/visualizations to help the user set up the analysis. All the settings are written to an input file for the actual analysis code. Rather than assume my GUI can do everything, I figured I would bake a text editor in as a fallback. So far I am using QsciScintilla as the editor component and enjoying the simliarity of features that it has with Notepad++ which I normally use to edit these files.

Because of my use case, I don't think I'll be able to use Ex.Co directly.

I think Ex.Co will be a great source of inspiration when I go to add things like a find and replace dialog or other similar features that are expected in a simple text editor.

I'm also having issues with Syntax Highlighting bogging it down. My file has multiple contexts unfortunately and so I got the bright idea to parse the entire file in a separate python function that uses tons of regexes and returns a dictionary of styles. Each style key in the dictionary contains a list of every character location that requires that style. The CustomLexer simply calls the python function and then loops through the file 1 character at a time applying the appropriate styles by checking which style the character belongs to. It's so ugly, I'm kinda shocked it runs as fast as it does! I'm not sure I have the experience to do what you've done with Cython lexers and I might need to leverage a faster regex library or something.

Do you know of a way to control how often the editor triggers the lexer? Can I control it with a custom signal?

from exco.

matkuki avatar matkuki commented on June 3, 2024

Hey @flutefreak7 ,
Your project sound awesome, best of luck to you.

As far as syntax highlighting goes, you cannot directly control when the QsciScintilla editor triggers the lexer's styling method. You could change it in the QScintilla C++ source and recompile it, but that is the hard way, since you have to get all the correct Qt and SIP source libraries. The easier thing you could do is to add a condition in the lexers styling method to allow styling only when a certain condition is met, or do it like Visual Studio does it, with a timer that styles the text in the background and only styles when there are no text changes after a certain period of time, like 0.5 seconds. Every time a text change occurs, the style method just resets the timer. That way you get the VS style that paints the text after a small delay after typing something and while typing there are no abrupt stylings that hamper performance. You will have to play a bit with either threading.Thread or QThread to get it working as you wish.

If you want to try a lexer in Cython, me and Kristof Mulier made documentation for QScintilla. Kristof made the website https://qscintilla.com , but it does not have the Cython lexer stuff yet. In the raw documentation we made: https://github.com/matkuki/qscintilla_docs, check out chapter 4. Lexers for the documentation and chapter X.7 Cython Lexer module (Cython) for a example code. It is not that hard to understand the code.

Matic

from exco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.