Re: liststore issue 1 - iter points to wrong row after sort of column with cellrenderercombo

2019-02-28 Thread Nicolas Soubeiran via gtk-app-devel-list
As you noticed "editing-started" is used at the beginning of editing a cell
as the documentation states and is defined on the base class
GtkCellRenderer:

This signal gets emitted when a cell starts to be edited. The intended use
of this signal is to do special setup on *editable* , e.g. adding a
GtkEntryCompletion
 or
setting up additional columns in a GtkComboBox
.
https://developer.gnome.org/gtk3/stable/GtkCellRenderer.html#GtkCellRenderer-editing-started

While "edited" is only available on  GtkCellRendererText and is mainly to
be used for "simple" edition of text (called when user validates
https://developer.gnome.org/gtk3/stable/GtkCellRendererText.html#GtkCellRendererText-edited
In case you have a GtkCellRendererText the signals will be called like this:
- editing-started
if user validates
   - edited with new_text the string the user entered
else (user cancel edition)
   - editing-canceled
In all cases you only have the path of the edited row, since the
cellrenderer does not "know" the model it is displaying : you have to pass
it through the signal user_data (then you can build the iter and do your
edition code)


Le jeu. 28 févr. 2019 à 18:43, Mike Martin  a écrit :

> Thanks
> Though what I don't quite get is the difference in behaviour between
> editing-started and edited (both using path to get the ITER)
> On my particular scenario I use editing-started to setup some stuff so I
> can use the iter created
>
> On Thu, 28 Feb 2019, 12:30 Nicolas Soubeiran via gtk-app-devel-list, <
> gtk-app-devel-list@gnome.org> wrote:
>
>> Hello,
>> after you sort the model, you shall consider that all iter and path
>> previously stored are wrong :
>> A path is a representation of the position of the row in the current case
>> (which you can read by using gtk_tree_path_to_string).
>>
>> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-to-string
>>
>>  Iter are quite the same (but link to a particular GtkTreeModel), such as
>> list::iterator of C++ STL : they are pointer to row that you can use to
>> access to data or walk through the models.  You can make an iter from a
>> path and a model :
>>
>> GtkTreePath *path;GtkTreeIter iter;
>>
>> GtkTreeModel* model;
>>
>> GtkListStore store = gtk_list_store_new(3, G_TYPE_INT,
>> G_TYPE_STRING,G_TYPE_STRING)
>>
>> model = GTK_TREE_MODEL(store);
>>
>> path = gtk_tree_path_new_from_string
>> <
>> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-new-from-string
>> >
>> ("3"); // third rowgtk_tree_model_get_iter
>> <
>> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-model-get-iter
>> >
>> (model, , path); // may be invalid (check return value)
>>
>>  If you really want to keep track of a particular row, you have to use
>> GtkTreeRowReference
>>
>> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#GtkTreeRowReference
>> But GTK will have to keep the reference up to date, so each time your
>> model change (inserting, deleting, sorting...)
>> GTK will triggered signal to update your GtkTreeRowReference which may
>> cause an overhead in your application
>>
>> Hope this helps you to understand better the GtkTreeModel paradigm
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: liststore issue 1 - iter points to wrong row after sort of column with cellrenderercombo

2019-02-28 Thread Mike Martin via gtk-app-devel-list
Thanks
Though what I don't quite get is the difference in behaviour between
editing-started and edited (both using path to get the ITER)
On my particular scenario I use editing-started to setup some stuff so I
can use the iter created

On Thu, 28 Feb 2019, 12:30 Nicolas Soubeiran via gtk-app-devel-list, <
gtk-app-devel-list@gnome.org> wrote:

> Hello,
> after you sort the model, you shall consider that all iter and path
> previously stored are wrong :
> A path is a representation of the position of the row in the current case
> (which you can read by using gtk_tree_path_to_string).
>
> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-to-string
>
>  Iter are quite the same (but link to a particular GtkTreeModel), such as
> list::iterator of C++ STL : they are pointer to row that you can use to
> access to data or walk through the models.  You can make an iter from a
> path and a model :
>
> GtkTreePath *path;GtkTreeIter iter;
>
> GtkTreeModel* model;
>
> GtkListStore store = gtk_list_store_new(3, G_TYPE_INT,
> G_TYPE_STRING,G_TYPE_STRING)
>
> model = GTK_TREE_MODEL(store);
>
> path = gtk_tree_path_new_from_string
> <
> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-new-from-string
> >
> ("3"); // third rowgtk_tree_model_get_iter
> <
> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-model-get-iter
> >
> (model, , path); // may be invalid (check return value)
>
>  If you really want to keep track of a particular row, you have to use
> GtkTreeRowReference
>
> https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#GtkTreeRowReference
> But GTK will have to keep the reference up to date, so each time your
> model change (inserting, deleting, sorting...)
> GTK will triggered signal to update your GtkTreeRowReference which may
> cause an overhead in your application
>
> Hope this helps you to understand better the GtkTreeModel paradigm
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Changing font of GtkSourceView changes font of GtkSourceMap

2019-02-28 Thread Reuben Rissler

I am not sure if this helps any:


#!/usr/bin/env python

import gi
gi.require_version('GtkSource', '3.0')
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GtkSource, GObject, Pango

class GUI:
    def __init__(self):

        GObject.type_register(GtkSource.View)
        window = Gtk.Window()
        window.connect('destroy', self.on_window_destroy)
        pane = Gtk.Paned(orientation = Gtk.Orientation.HORIZONTAL)
        window.add(pane)
        s_view = GtkSource.View()
        pane.pack1(s_view)
        s_map = GtkSource.Map()
        s_map.set_view(s_view)
        pane.pack2(s_map)
        s_map.set_property('font-desc', 
Pango.font_description_from_string("Sans 3"))

        window.show_all()

    def on_window_destroy(self, window):
        Gtk.main_quit()


if __name__ == "__main__":
    app = GUI()
    Gtk.main()



On 02/27/2019 12:36 PM, Mitko Haralanov via gtk-app-devel-list wrote:

Still looking for some help on this.

Thank you.

On Mon, Feb 11, 2019 at 9:11 AM Mitko Haralanov  wrote:

Any help would be appreciated.

Thank you.

On Tue, Feb 5, 2019 at 2:28 PM Mitko Haralanov  wrote:

Forwarding to gtk-app-devel since there appears to be much more activity 
related to GtkSourceView.

-- Forwarded message -
From: Mitko Haralanov 
Date: Tue, Feb 5, 2019, 13:42
Subject: Changing font of GtkSourceView changes font of GtkSourceMap
To: 


I can't figure out how to change the font of GtkSourceView and
GtkSourceMap in a reasonable way.

According to the documentation, the View and the Map should be using
the same font but with the Map using a font size of 1pt. To me this
implies that when I change the font of the TextBuffer of the View
using tags, I can copy the PangoFontDescription to a new object,
change the font size to 1pt and set the new PangoFontDescription as
the "font-desc" property of the Map.

In practice, however, the Map always has the exact same font size as
the View. No matter what I do, I can't seem to change the font size of
the Map to 1pt, unless I change the font size of the View to 1pt, as
well.

What is the correct processes for changing the font size of both the
View and the Map?

Thank you,
- Mitko

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: liststore issue 1 - iter points to wrong row after sort of column with cellrenderercombo

2019-02-28 Thread Nicolas Soubeiran via gtk-app-devel-list
Hello,
after you sort the model, you shall consider that all iter and path
previously stored are wrong :
A path is a representation of the position of the row in the current case
(which you can read by using gtk_tree_path_to_string).
https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-to-string

 Iter are quite the same (but link to a particular GtkTreeModel), such as
list::iterator of C++ STL : they are pointer to row that you can use to
access to data or walk through the models.  You can make an iter from a
path and a model :

GtkTreePath *path;GtkTreeIter iter;

GtkTreeModel* model;

GtkListStore store = gtk_list_store_new(3, G_TYPE_INT,
G_TYPE_STRING,G_TYPE_STRING)

model = GTK_TREE_MODEL(store);

path = gtk_tree_path_new_from_string

("3"); // third rowgtk_tree_model_get_iter

(model, , path); // may be invalid (check return value)

 If you really want to keep track of a particular row, you have to use
GtkTreeRowReference
https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#GtkTreeRowReference
But GTK will have to keep the reference up to date, so each time your
model change (inserting, deleting, sorting...)
GTK will triggered signal to update your GtkTreeRowReference which may
cause an overhead in your application

Hope this helps you to understand better the GtkTreeModel paradigm
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list