LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.81k stars 1.16k forks source link

Change the gcode editor background when the focus changes. #3142

Closed sfroome closed 4 weeks ago

sfroome commented 1 month ago

This merge request adds event handling for the focusIn and focusOut events of the gcode editor. If the editor is in focus, it sets the editor's background white. Otherwise, the background is set to lightgrey.

andypugh commented 1 month ago

Can you suggest a GUI to use that will show the old and new behaviour? I assume this is a qtvcp-only change?

c-morley commented 1 month ago

It will show in any Qtvcp screen. The colors would need to be selectable. I'll think on this request.

hansu commented 1 month ago

In Gmoccapy we can chose a theme for the G-code editor (Gtk SourceView) which controls the background color e.g.
I wonder if there is something similar for Qt?

c-morley commented 1 month ago

Yes, Qt has stylesheets, which can also manipulate arbitrary properties. We would have to add two color properties to the widget. But I think focus event changes are better set in the screen handler code, rather then in the widget it's self.

c-morley commented 4 weeks ago

Thank you for the merge request. In this case, I think this is best to do it in the handler file of the screen. Al the versions of Qtdragon use a similar technique to color borders when selecting MPG scrolling in master. This is where you could add code to color the background if wanted. Please do not hesitate to comment if you think of problems with using the handler file or would like help in some way to code from the handler file. I look forward to more suggestions/code.