Re: Can you specify the No. of chars before SourceView Completion window is displayed?
On 07/28/2018 08:12 AM, John Coppens wrote: > David, is 'set_minimum_key_length' what you are looking for? Oh, no, no, no, not entry-completion, *word-completion* in a text editor window. (which explains why it was no where to be found in the gtkSourceView code :) -- David C. Rankin, J.D.,P.E. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to scroll to a specific line
On 07/28/2018 08:29 AM, John Coppens wrote: > On Sat, 28 Jul 2018 07:42:16 -0400 > Reuben Rissler wrote: > >>> Thanks for the suggestion. Believe it or not, I had just arrived at >>> that same solution! I first tried to use GLib.timeout_add(), and >>> that worked too, if the time was larger than 300 - 400 ms, which is >>> on the verge of annoying. I then tried idle_add(), and I guess that >>> makes the 300-400ms 'built-in'. >>> >> How many lines of text do you have? With 500 - 700 lines of text, my >> scrolling is instantaneous. The scroll feature itself has a 'soft' >> stop, but that is quite acceptable for me, as it is easier to adjust >> my eyes to the change. > > Reuben, > > The code I'm using to test is short (about 250 lines). I'm using the system > to single step program execution, so I will do many steps. The problem at > the moment is when loading the program, and scrolling to the start of > the program (the 'reset' position), but I see that the slowing down delay > is quite visible even when scrolling just one line with the arrow keys. > > I have some Gtk-2 programs where the delay is not apparent. Maybe this > is configurable? > > John > > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > John, Maybe we can trade help. There are actually two functions you can use to scroll the window to insure a text mark (usually the 'insert' mark) is visible within your view, e.g. (the following is from a find/replace widget I made) https://github.com/drankinatty/gtkwrite/blob/master/gtk_findreplace.c#L920 /* scroll window to mark to insure match is visible */ #ifndef TOMARK gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (app->view), app->last_pos, 0.0, TRUE, 0.95, 0.8); #else gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (app->view), app->last_pos); #endif The gtk_text_view_scroll_to_mark give you finer control over how far from the bottom/top of your view the mark is displayed, the gtk_text_view_scroll_mark_onscreen just makes sure it is visible (but generally does a fine job) I left a #define in the code when I wrote it so I could compare the behavior of each. I use the gtk_text_view_scroll_to_mark by default. Both give instantaneous performance, even in a longer file (for me that is 2000 - 5000 lines) Also note it is called from 'btnreplace_activate' https://github.com/drankinatty/gtkwrite/blob/master/gtk_findreplace.c#L1001 and the scroll is wrapped within begin/end user action to prevent any selection bound changes being momentarily visible during the find/replace operation: gtk_text_buffer_begin_user_action (buffer); (code for gtk_text_view_scroll_to_mark gtk_text_buffer_end_user_action (buffer); You shouldn't notice any delay when implementing the scroll in any reasonable size file. -- David C. Rankin, J.D.,P.E. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Can you specify the No. of chars before SourceView Completion window is displayed?
On 07/28/2018 08:12 AM, John Coppens wrote: > On Sat, 28 Jul 2018 03:35:02 -0500 > "David C. Rankin" wrote: > >> All, >> >> I have implemented word completion with GtkSourceView, but I cannot >> find a simple way to prevent the provider and proposals from popping >> up until 3 (or more) characters are typed? Is there an easier way to >> adjust this rather than counting chars with an iter from every >> begins_word and blocking the display of the completion window until >> the desired number of characters have been typed? >> > > David, is 'set_minimum_key_length' what you are looking for? > > John John, That sounds *exactly* like what I am looking for, but I can't find it. Currently the completion is triggered after 2-characters are type. That is way way too over-inclusive and results in the GList of proposals being way larger than need be. I've been through every property and grepped the source with $ grep -r 'set_minimum_key_length' gtksourceview/* and I can't find any reference to it that would provide an interface to it. Is this new in gtksourceview4? I have grepped the source for versions 2.11 and 3.23 and nothing turns up. Also, (as a bonus question :) how do I hide the priority column in the completion window and nuke the titlebar and statusbar with the "Details/All" links? see: screen shot of completion window: http://paste.opensuse.org/94232695 (link good for 6 days) For example, I don't want to display the 1, 2, 3, 4, 5, etc.., priority column, I just want the words displayed in a small tight window. I don't want to have the titlebar or the footer with the links to the extra "info" for this provider (there never will be any, they are just words from the document). What I'm trying to achieve is a normal completion window, e.g. http://paste.opensuse.org/48387224 Is there any way to achieve something like that other than capturing the "show" signal (which would already have displayed the window) and attempting to hide the titlebar and statusbar of the completion popup? The "CompletionInfo" window has a "before-show" signal, but there is nothing similar for the actual completion window? -- David C. Rankin, J.D.,P.E. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [PyGObject] Drag & Drop in a TreeView
Dear Colomban, thanks for your great hint. > You get inserted/deleted signals for moved rows so you can know > when and how things changed if needed This signals are also emited when I manually insert and delete data in the model. How do I know if a insert/delete signal was caused by a drag and drop "event"? One workaround in my mind would be to do Gtk.TreeView.set_reordable(False) when manipulating the model manualy (without drag and drop). Do you see another more elegant way? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to scroll to a specific line
On Sat, 28 Jul 2018 07:42:16 -0400 Reuben Rissler wrote: > > Thanks for the suggestion. Believe it or not, I had just arrived at > > that same solution! I first tried to use GLib.timeout_add(), and > > that worked too, if the time was larger than 300 - 400 ms, which is > > on the verge of annoying. I then tried idle_add(), and I guess that > > makes the 300-400ms 'built-in'. > > > How many lines of text do you have? With 500 - 700 lines of text, my > scrolling is instantaneous. The scroll feature itself has a 'soft' > stop, but that is quite acceptable for me, as it is easier to adjust > my eyes to the change. Reuben, The code I'm using to test is short (about 250 lines). I'm using the system to single step program execution, so I will do many steps. The problem at the moment is when loading the program, and scrolling to the start of the program (the 'reset' position), but I see that the slowing down delay is quite visible even when scrolling just one line with the arrow keys. I have some Gtk-2 programs where the delay is not apparent. Maybe this is configurable? John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Can you specify the No. of chars before SourceView Completion window is displayed?
On Sat, 28 Jul 2018 03:35:02 -0500 "David C. Rankin" wrote: > All, > > I have implemented word completion with GtkSourceView, but I cannot > find a simple way to prevent the provider and proposals from popping > up until 3 (or more) characters are typed? Is there an easier way to > adjust this rather than counting chars with an iter from every > begins_word and blocking the display of the completion window until > the desired number of characters have been typed? > David, is 'set_minimum_key_length' what you are looking for? John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to scroll to a specific line
Thanks for the suggestion. Believe it or not, I had just arrived at that same solution! I first tried to use GLib.timeout_add(), and that worked too, if the time was larger than 300 - 400 ms, which is on the verge of annoying. I then tried idle_add(), and I guess that makes the 300-400ms 'built-in'. How many lines of text do you have? With 500 - 700 lines of text, my scrolling is instantaneous. The scroll feature itself has a 'soft' stop, but that is quite acceptable for me, as it is easier to adjust my eyes to the change. Reuben ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [PyGObject] Drag & Drop in a TreeView
If it's only for reordering the elements in the tree view, you can use the built-in Gtk.TreeView.set_reorderable() method [1], and you're all set. You get inserted/deleted signals for moved rows so you can know when and how things changed if needed, and the underlying model is also changing accordingly. Of course. Thank you very much, Colomban. It is unbelievable how complicated I can make simple things. Cheers, Reuben ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [PyGObject] Drag & Drop in a TreeView
Le 27/07/2018 à 23:05, c.buhtz--- via gtk-app-devel-list a écrit : > Dear Reuben > > On 2018-07-23 08:03 Reuben Rissler wrote: >> This is how I have done it in the past. Note, I do not proclaim >> spectacular or Pythonic code, and would humbly accept any corrections >> and/or better ways to accomplish this. It seems to me there should be >> a way to let the TreeView do this work itself, but alas, I have not >> found it yet. > > Your code works for me - thank you very much. But I also have the > question if anyone here could improve it or show a more easier and > elegant way. If it's only for reordering the elements in the tree view, you can use the built-in Gtk.TreeView.set_reorderable() method [1], and you're all set. You get inserted/deleted signals for moved rows so you can know when and how things changed if needed, and the underlying model is also changing accordingly. Regards, Colomban [1] https://developer.gnome.org/gtk3/stable/GtkTreeView.html#gtk-tree-view-set-reorderable ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Can you specify the No. of chars before SourceView Completion window is displayed?
All, I have implemented word completion with GtkSourceView, but I cannot find a simple way to prevent the provider and proposals from popping up until 3 (or more) characters are typed? Is there an easier way to adjust this rather than counting chars with an iter from every begins_word and blocking the display of the completion window until the desired number of characters have been typed? -- David C. Rankin, J.D.,P.E. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list