I have an app written in python that presents some of its data in a tree view. By default, the tree view is a floaty white affair with little floaty triangles to expand the nodes.
Is it possible to change this style to be more like a Windows explorer tree view? Specifically, I'd like to have vertical lines indicating parentage of the nodes.
If this is possible, how would it be done?
For lines linking the arrows there is a method in gtk.TreeView for that, see http://library.gnome.org/devel/pygtk/stable/class-gtktreeview.html#method-gtktreeview--set-enable-tree-lines
you need to create a custom CellRenderers for this. the below links might help.
http://www.pygtk.org/pygtk2tutorial/ch-TreeViewWidget.html
http://www.pygtk.org/pygtk2tutorial/sec-CellRenderers.html
Related
I've been using Bokeh's datatable, but there are a few things I'd like to do that I don't know how to accomplish using the DataTable class. For example, I don't think it's possible add icons (or any images) to different rows, or setting the table to single selection only. So, I've been thinking about implementing just a HTML table, and writing it with the DIV widget.
However, I'd still like to add interactive features to the table, like buttons, or the icons mentioned above. Then, when an event is generated (e.g. onClick), that event is captured by the Bokeh server, and I can write the handlers in Python to do things such as modifying the data in ColumnDataSource, for example.
Is this possible? Or is there a better way to accomplish this?
Thanks!
I think the approprate way to achieve what you want is to create a custom widget:
Extending Bokeh Documentation
Custom Widget Example
I do not paste here the complete example because it is too long.
I'm trying to set up predefined render setting in maya using python. In the Render Settings window there are tabs, the first one called "Common" which includes things like "Color Management" and "File Output".
In the mental ray specific tabs, such as "Quality" I can easily change the setting with things like this
cmds.setAttr('miDefaultOptions.maxRefractionRays', 3)
cmds.setAttr('miDefaultOptions.maxShadowRayDepth', 2)
cmds.setAttr('miDefaultOptions.miSamplesMax', 2)
However, I can't do that for the "Common" tab.
Does anyone know if there's a way to set this up in Python? Specifically for Common>"Color Management".
Thanks!
You need to use defaultRenderGlobals, defaultResolution and use listAttr to see the attributes. You need to set defaultRenderGlobals.outputColorProfle or inputColorProfile depending on your color profile.
I'm writing a simple webpage generator based on restructuredtext and I'd like to put tags into the document, like this.
=====
Title
=====
:author: Me
:tags: foo, bar
Here we go ...
What I want now:
get in possession of some kind of document tree
find the tags entry, read it, process it (like print the tags on the command line), remove it and render the remaining tree.
So I'd like to write compatible restructuredtext in case it's being compiled with something different than my program.
Can someone give me a hint? I found this one here http://svn.python.org/projects/external/docutils-0.6/docutils/examples.py showing in the internals method how to obtain the document (and therefore the dom tree), but is this the best way to go or would a regex based approach (find lines, remove them) be a lot easier? Working with the tree would also involve the conversion tree → document and so on.
There are tools that can do this for you. See http://docutils.sourceforge.net/docs/user/links.html
I think I have a nice solution for both problems. First, the core.py file in the docutils distribution shows how to obtain the doctree and how to write it (using a html writer for instance), see publish_from_doctree and publish_doctree. Then, there is docutils.nodes.SparseNodeVisitor which one can subclass and overwrite methods like visit_field to manipulate the document tree in various ways.
I'm trying to make colored boxes using Sphinx for Python.
For example, this website has a lot of gray div or boxes (not the Note ones): http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
I'm wondering how they manage to create thoses boxes since this website is also created using sphinx.
One thing I found, is that Sphinx has built in colored boxes as shown here: http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html#colored-boxes-note-seealso-todo-and-warnings. Those boxes would work perfectly for me if they didn't have the words "Note:", "SeeAlso" or "Warning" in the beginning.
Any help is greatly appreciated.
Things like notes, warnings, and such are called admonitions. Unfortunately, you can't create ones that don't have a title, as it's required by reStructuredText.
The other boxes on that page are from code blocks. Code blocks are run through the Pygments color syntax highlighter.
There are a couple of other ways to get what you want. You could embed raw HTML, but that's frowned upon. The other choice might be to write an extension to create a directive that gives you the functionality you need.
This is a simple source code block.
I'm looking to create a window with two panels, with a collapsible folder browser in the left panel and a list of files in the right panel that are contained in the selected folder on the left (similar to nautilus or an older windows explorer). Both the folders on the left and files on the right need a check box beside them so users can make a selection of a mix of folders and files across their whole file system.
I've had a look around and found similar-ish built-in bits in wx like GenericDirCtrl but before I get started I wanted to ask if anyone had come across something like this before that's available or if there was a better starting point that GenericDirCtrl?
I've got it all working now. I used CustomTreeCtrl for the tree and a list control that has multi inheritance from ListCtrl and CheckListCtrlMixin for the report like list with check boxes.
I can share the code if anyone's interested
There isn't a built-in file explorer. The GenericDirCtrl or one of the other tree controls is a good place to start for the tree. Then use a ListCtrl (or ObjectListView) for the other panel. Something like that should give you the functionality you need.