-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey folks,
I've been having a real bear of a time in implementing a sane and functional TreeView in Develop to represent the source tree of an activity. I opted to use a so-called GenericTreeModel to bind the GTK TreeView to the "activity/directory/file" object graph Develop maintains in memory to describe the activity. However, I've hung up on an issue. The TreeModel interface specifies that it (and, by extension, the TreeView) need to be informed when the data they represent changes. Thus, I've implemented an observer pattern in which whenever the directory/file object graph changes it calls a list of callbacks of interested Develop components. These callbacks are given a single argument, the directory that changed. If a file or directory is removed, moved, or added the changed handler is invoked on the parent of that object. This is intuitive because creating a new file involves writing to the directory that will contain it. However, dragging and dropping confounds (after Develop has changed the object graph, of course) the TreeView and displays the message "There is a disparity between the internal view of the GtkTreeVew and the GtkTreeModel." on stdout. I'm not sure why this can be happening. Perhaps I made a mistake in assuming that row-changed will cause the TreeView to rescan the children of the specified row. The PyGTK and GTK documentation alike are very light on information. :( The Code in question: TreeModel: http://dev.laptop.org/git.do?p=projects/develop-activity;a=blob;h=52cff8687f03e0485bec7d6535aa16e5e84d53c6;hb=4472bb428afef58bc4efcf74b9bb2b0044e1ed27;f=develop/activity_treemodel.py TreeView: http://dev.laptop.org/git.do?p=projects/develop-activity;a=blob;h=07ab77f4f1875916ca96891d2cd8cfc98224beab;hb=4472bb428afef58bc4efcf74b9bb2b0044e1ed27;f=develop/activity_tree.py Any suggestions? Thanks! - -- Regards, Andrew Clunis -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQFF3pcCALkUMXSNow8RAmmgAJ41aQNFy/kA4e3Hnmw6qGNdQx9cugCeJuTF tIZIFcoi0CfYlFpr71X8rDA= =UoJB -----END PGP SIGNATURE----- _______________________________________________ Sugar mailing list [email protected] http://mailman.laptop.org/mailman/listinfo/sugar
