Embedding KTextEditor in FreeCAD

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Embedding KTextEditor in FreeCAD

Post by jnxd »

My twopenny (or probably wrench in the cogs): any plans for vim bindings? :D

More seriously though, I think I'm more of the opinion that there will be as many editor preferences as users (or probably more, somehow). I am more of the opinion that its best to use an external editor, and make sure freecad is able to keep track of the fact that something has changed.
My latest (or last) project: B-spline Construction Project.
User avatar
kkremitzki
Veteran
Posts: 2515
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Embedding KTextEditor in FreeCAD

Post by kkremitzki »

A vi-style input mode would come for free with KTextEditor integration, another nice benefit, this can be demoed Kate: https://kate-editor.org/
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Embedding KTextEditor in FreeCAD

Post by jnxd »

kkremitzki wrote: Fri Aug 06, 2021 1:57 pm A vi-style input mode would come for free with KTextEditor integration, another nice benefit, this can be demoed Kate: https://kate-editor.org/
Well, doesn't that sound enticing!
My latest (or last) project: B-spline Construction Project.
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: Embedding KTextEditor in FreeCAD

Post by adrianinsaval »

alonso_jamm wrote: Tue Jul 27, 2021 4:19 pm And there are more widgets from KDE that I think could be useful in FreeCAD; for example, KCommandBar could be a good addition to FreeCAD too.
it seems there is demand for a feature like that https://forum.freecadweb.org/viewtopic. ... 10#p524410
User avatar
alonso_jamm
Posts: 77
Joined: Mon Nov 11, 2019 11:32 pm

Re: Embedding KTextEditor in FreeCAD

Post by alonso_jamm »

adrianinsaval wrote: Mon Aug 16, 2021 2:51 am it seems there is demand for a feature like that
A command search would be useful for using hard to find commands. I found CommandManager while trying to embed KTextEditor in FreeCAD which has a method getAllCommands which returns all the commands registered in FreeCAD. And KCommandBar requires a vector of actions. So I think it may be possible to use the actions from the commands given by getAllCommands to setup KCommandBar.

However, right now I am busy trying to embed KTextEditor nicely in FreeCAD. The undo/redo history from KTextEditor doesn't interface nicely with FreeCAD undo/redo commands.
bleber
Posts: 259
Joined: Thu Jun 30, 2016 5:12 pm

Re: Embedding KTextEditor in FreeCAD

Post by bleber »

Hi.
These integration is usable, how I can test?
User avatar
alonso_jamm
Posts: 77
Joined: Mon Nov 11, 2019 11:32 pm

Re: Embedding KTextEditor in FreeCAD

Post by alonso_jamm »

bleber wrote: Fri Sep 10, 2021 3:49 pm Hi.
These integration is usable, how I can test?
I haven't uploaded the code to github yet because I have been busy and I spent a lot of time trying to interface the undo/redo history of KTextEditor with FreeCAD's undo/redo commands. I am now trying to clean up the code and hopefully I will be able to upload the code to github by tomorrow.
bleber
Posts: 259
Joined: Thu Jun 30, 2016 5:12 pm

Re: Embedding KTextEditor in FreeCAD

Post by bleber »

Ok thanks to answer my question, and your work.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Embedding KTextEditor in FreeCAD

Post by Kunda1 »

alonso_jamm wrote: Sat Sep 11, 2021 2:39 pm I haven't uploaded the code to github yet because I have been busy and I spent a lot of time trying to interface the undo/redo history of KTextEditor with FreeCAD's undo/redo commands. I am now trying to clean up the code and hopefully I will be able to upload the code to github by tomorrow.
:o
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
alonso_jamm
Posts: 77
Joined: Mon Nov 11, 2019 11:32 pm

Re: Embedding KTextEditor in FreeCAD

Post by alonso_jamm »

I pushed the KTextEditor branch to github. It should contain all the needed changes to use KTextEditor as a text editor for FreeCAD. The dependencies needed to build this branch are the same than to build FreeCAD plus ktexteditor. ktexteditor should be provided by any major linux distro; for example, in arch linux is called ktexteditor or in ubuntu it is called libkf5texteditor-dev. I made optional to build FreeCAD with KTextEditor. So in order to build FreeCAD with KTextEditor it is needed to turn on the cmake switch "BUILD_KTEXTEDITOR." Then after building FreeCAD it is needed to turn on the preference to use KTextEditor in the preferences dialog:
Screenshot_20210912_173823.png
Screenshot_20210912_173823.png (50.46 KiB) Viewed 2131 times
And that's it!, FreeCAD should then use KTextEditor when opening a macro file or a text file. There is still some polishing to do in order to better integrate KTextEditor with FreeCAD (for example, to be able to execute macro files when editing them with KTextEditor).
Post Reply