gtktreeview

How to set multiple items into a GtkSelection for Treeview drag and drop

淺唱寂寞╮ 提交于 2019-12-21 23:57:14
问题 My current project uses a Gtk.TreeView to display the contents of a ListView with four fields per row, two strings, an int and a boolean . I'm trying to implement drag and drop rearrangement of rows in the TreeView. I don't want simply to use TreeView.set_reorderable(True) for the built-in drag and drop because I want to have some control over the insertion and deletion of data from the model as well as to be able to implement undo/redo of drag and drop operations. I'm using Python 3.2 and

_really_ disable GtkTreeView searching

末鹿安然 提交于 2019-12-19 19:04:52
问题 How do I really disable gtk treeview interactive search? The docs say to set_enable_search(False) , but if I do this, CTRL + F still causes an annoying search pop-up to appear. Connecting to start-interactive-search and returning True doesn't work either. 回答1: The pygtk docs don't state this, but the C docs do: gtk_tree_view_set_search_column (GtkTreeView *tree_view, gint column) column : the column of the model to search in, or -1 to disable searching Passing -1 for the column really

_really_ disable GtkTreeView searching

独自空忆成欢 提交于 2019-12-19 19:04:37
问题 How do I really disable gtk treeview interactive search? The docs say to set_enable_search(False) , but if I do this, CTRL + F still causes an annoying search pop-up to appear. Connecting to start-interactive-search and returning True doesn't work either. 回答1: The pygtk docs don't state this, but the C docs do: gtk_tree_view_set_search_column (GtkTreeView *tree_view, gint column) column : the column of the model to search in, or -1 to disable searching Passing -1 for the column really

_really_ disable GtkTreeView searching

天涯浪子 提交于 2019-12-19 19:04:27
问题 How do I really disable gtk treeview interactive search? The docs say to set_enable_search(False) , but if I do this, CTRL + F still causes an annoying search pop-up to appear. Connecting to start-interactive-search and returning True doesn't work either. 回答1: The pygtk docs don't state this, but the C docs do: gtk_tree_view_set_search_column (GtkTreeView *tree_view, gint column) column : the column of the model to search in, or -1 to disable searching Passing -1 for the column really

How to list directory hierarchy in GtkTreeView widget?

雨燕双飞 提交于 2019-12-18 18:40:10
问题 I am trying to generate a hierarchical directory listing in pyGTK. Currently, I have this following directory tree: /root folderA - subdirA - subA.py - a.py folderB - b.py I have written a function that -almost- seem to work: def go(root, piter=None): for filename in os.listdir(root): isdir = os.path.isdir(os.path.join(root, filename)) piter = self.treestore.append(piter, [filename]) if isdir == True: go(os.path.join(root, filename), piter) This is what i get when i run the app: I also think

GLib-CRITICAL **: Source ID XXX was not found when attempting to remove it

可紊 提交于 2019-12-17 23:32:18
问题 I made a treeview with a treestore as model. The window is shown as expected, but when I click in the "+" to expand the items, I get this message: GLib-CRITICAL **: Source ID 221 was not found when attempting to remove it Here is my code: #include <gtk/gtk.h> /* compile with: */ /* gcc main.c -o boxy `pkg-config --cflags --libs gtk+-2.0` */ typedef struct { GtkWidget *toplevel; GtkWidget *treeview; } Widgets; enum { ITEM_PARENT, ITEM_CHILD }; typedef struct { gint tipo; gint id; gchar *nombre

Adding GtkButton to GtkListStore with text in GTK+

最后都变了- 提交于 2019-12-14 02:27:33
问题 I want a button with text on it for a GtkListStore . I read another answer using an image as a button, but I really need the title to be text. How can I do this? I'd be fine with a solution that renders text onto a GdkPixbuf as well. I've tried this: GType *types; types = g_new0 (GType, num_fields); for(int i=0; i<num_fields; i++) { types[i] = GTK_TYPE_BUTTON; } tree_store = gtk_list_store_newv(num_fields, types); tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(tree_store));

Set cellrenderertext foreground color when a row is highlighted

僤鯓⒐⒋嵵緔 提交于 2019-12-13 14:27:23
问题 When I have a gtk.CellRendererText , I can associate its foreground color with one of the tree store's columns, and set the foreground-set attribute to True, to change the color of the text in that column. However, when the row with the colored column is selected, its color disappears, and is the same as any selected cell's color. How do I change the color when it's selected? 回答1: I've had the same problem and, after trying different alternatives, using the markup property instead of the text

Changing font color on a column in treeview gtk

一笑奈何 提交于 2019-12-13 04:25:12
问题 I've a treeview and I want to change the text color on one column. How could I do this?? thanks 回答1: (Refering to the standard C methods, haven't done much with Vala so far) There are several ways to achieve this. You can change the settings of the text cellrenderer (GtkCellRendererText), an example would be g_object_set (your_text_cell_renderer, "foreground", "red", "foreground-set", TRUE); Another way is using markup: highlighted_txt = g_strconcat ("<span background='yellow' foreground=

How to get the coordinates of a GtkTreeView row

走远了吗. 提交于 2019-12-13 03:08:50
问题 I'm using a GtkTreeView widget. If I have a row's GtkTreeIter, how can I then get that row's current position (vertical pixel coordinate) within the entire GtkTreeView window? My underlying problem is that I need to get a GtkTreeIter for whatever row is currently placed at a given vertical coordinate relative to the entire GtkTreeView window, but I don't know how. Any help would be greatly appreciated!! Thanks in advance :-) 回答1: This function: gtk_tree_view_get_path_at_pos (GtkTreeView *tree