After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 346896 - Use GtkSourceView for python code.
Use GtkSourceView for python code.
Status: RESOLVED FIXED
Product: glom
Classification: Other
Component: design
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Murray Cumming
Murray Cumming
Depends on:
Blocks:
 
 
Reported: 2006-07-07 14:21 UTC by Murray Cumming
Modified: 2006-10-19 09:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
glom_sourceview.patch (9.95 KB, patch)
2006-07-07 14:24 UTC, Murray Cumming
none Details | Review
Patch to support syntax highlighting for python (14.39 KB, patch)
2006-09-07 09:49 UTC, Johannes Schmid
none Details | Review
glom_sourceview2.patch (13.17 KB, patch)
2006-09-17 19:00 UTC, Murray Cumming
none Details | Review

Description Murray Cumming 2006-07-07 14:21:26 UTC
In the calculated fields and buttons scripts windows, we should use GtkSourceView to have syntax highlighting.
Comment 1 Murray Cumming 2006-07-07 14:24:49 UTC
Created attachment 68567 [details] [review]
glom_sourceview.patch

This patch does most of it, though the syntax-highlighting doesn't seem to work yet. Maybe I got the mime-type wrong.
Comment 2 Johannes Schmid 2006-09-05 15:03:01 UTC
I adapted the patch to Glom and GtkSourceViewmm HEAD but I encountered the following problem where I am not sure how to solve it:

(:13456): libglademm-CRITICAL **: widget `textview_calculation' (in glade file `/usr/share/glom/glade//glom.glade') is of type `gtkmm__GtkTextView' but `GtkSourceView' was expected

** (:13456): CRITICAL **: Gnome::Glade::Xml::get_widget(): dynamic_cast<> failed.
Segmentation fault

Of course in the glade file textview_calculation has class=GtkSourceView and I also checked gtksourceviewmm::SourceView::get_type() in a sample application with gives gtkmm_GtkSourceView correctly. Maybe libglademm is messing things up here, but I will try to investigate this.
Comment 3 Johannes Schmid 2006-09-06 13:55:57 UTC
Obviously I did not check the glade file carefully enough because I just looked at the wrong place and could fix it easily by replacing class=GtkTextView there.

Anyway, to get hightlighting to work I have to call Sourceview::get_source_buffer() which seems not to work so I first have to fix it in gtksourceviewmm.
Comment 4 Dodji Seketeli 2006-09-06 14:25:18 UTC
Hello,

I have just commited the changeset #14 to gtksourceview trunk  that may fix your problem.
Just let me know.

Cheers,

Dodji.
Comment 5 Johannes Schmid 2006-09-06 15:10:53 UTC
Hi!

Sorry, that did not help, I still end up with this when calling m_text_view->get_source_buffer()!

If you like I can post the updated patch here though it is still incomplete and does not work because of the bug above.

Johannes
Comment 6 Johannes Schmid 2006-09-06 15:11:53 UTC
Forgot to paste the error message:

(:4734): GLib-GObject-WARNING **: invalid cast from `GtkTextBuffer' to `GtkSourceBuffer'
Comment 7 Dodji Seketeli 2006-09-06 15:29:07 UTC
Okay, let me try something else. I will let you know when I have something that works.
Comment 8 Johannes Schmid 2006-09-07 09:49:15 UTC
Created attachment 72368 [details] [review]
Patch to support syntax highlighting for python

It was definitly not a fault of gtksourceviewmm but rather a problem of libglade which does simply not know about gtksourceviewmm. To make it working gtksourceview mm would have to depend on Gnome which is not good so I created a work-around.

Attached is a patch which makes it working in the dialogs I could reach and also in those I did find in the sources but could not reach them in the UI, so it would be nice if someone could test it.

Thanks to Openismus for paying the work on this patch!
Comment 9 Murray Cumming 2006-09-12 06:36:39 UTC
We'll use this when Glom branches for 1.2.
Comment 10 Murray Cumming 2006-09-17 12:33:31 UTC
Firstly, sorry that my patch used API changes that I had not yet committe to gtksourceviewmm. That's done now.

This patch works. The main things were
1. libglade seems to set a TextBuffer in the GtkSourceView, instead of using its default SourceBuffer.
2. We need to call set_highlight().
Comment 11 Murray Cumming 2006-09-17 12:35:00 UTC
I'll upload the working patch later.
Comment 12 Murray Cumming 2006-09-17 19:00:46 UTC
Created attachment 72943 [details] [review]
glom_sourceview2.patch
Comment 13 Murray Cumming 2006-10-19 09:51:42 UTC
Committed to HEAD. Thanks.