hdf-compass
hdf-compass copied to clipboard
Issue26
Preview of tree view. There’s no deep traversal from a node yet so grandparents or grandchildren will not appear.
@hyoklee - I'm getting an import error with your branch. Do you have files not checked in?
pythonw HDFCompass.py
Traceback (most recent call last):
File "HDFCompass.py", line 37, in <module>
from hdf_compass import compass_viewer
File "/Users/jreadey/Compass/hdf-compass/hdf_compass/compass_viewer/__init__.py", line 34, in <module>
from . import container, array, keyvalue, image, frame, text
File "/Users/jreadey/Compass/hdf-compass/hdf_compass/compass_viewer/container/__init__.py", line 33, in <module>
from .tree import ContainerTree
File "/Users/jreadey/Compass/hdf-compass/hdf_compass/compass_viewer/container/tree.py", line 17, in <module>
import compass_model
ImportError: No module named compass_model
The issue could be the missing namespace 'hdf_compass'..
@hyoklee did you rebase before commit?
I ran my branch on Python 2.7 only and can't duplicate the error on Mac and PC. John, do you use Python 3.0?
@hyoklee - I'm running Python 2.7. Any easy way to verify is to do a new git clone (in a temp directory somewhere) and grab your own pull request: $git checkout issue26. As @giumas said, you are probably missing recent changes to the develop branch.
A branch must be rebased before make a PR to the upstream repository. Otherwise your code will be missing all the other changes already applied...
@jreadey I could duplicate missing module error from fresh pull. I fixed it by committing 4439379.
@hyoklee - I'm able to run it now.
No deep traversal & clicking the "more" link doesn't do anything yet.
Rather than a "more" button can you have additional nodes filled as the user scrolls down?
@jreadey, your observation is right. I just want to check how treeview should be implemented further with you.
I can try scroll down event binding to add additional nodes but I haven't tried it before so I can't guarantee that it will work.
For deep traversal, do you want to add all parents and their children or just immediate parents up to root?
By deep traversal I was thinking that the user could expand or collapse any group node that has children. We want to stay away from anything that would involve a potentially arbitrary amount of work (e.g. puling in 1000's of nodes).
@hyoklee Did you notice the conflicts on your branch that stops from merging your PR?
@jreadey I tried to add scrolling down event handler but each platform (Windows, Linux, Mac) behaves differently. Windows works best, Mac is OK, but Linux doesn't work with mouse but works with down arrow key. The consistent behavior can only be achieved by double-clicking "more" tree item.
Can you review issue26 branch and suggest me what issue to work on next?
@hyoklee - I hate to say it, but can you put os checks in the code and too different things per platform? If the platform supports scrolling, just do that. Otherwise provide a "more" button.
I just tested on the Mac. I see the "more" button, but clicking on it doesn't seem to have any effect. But scrolling worked fine.
The code looks like it's recursively walking the container tree. Can you not just go down one level and get children when users click on the parent group node?
Compass is crashing with 'tall.h5' dataset.
Also this one: https://s3.amazonaws.com/hdfgroup/data/hdf5test/countries.h5 causes Compass to hang.
Thanks for testing. Did you (fast) double click the "more" item on Mac?
I will try one level. I will also test the tall.h5/countries.h5 files tomorrow.
I didn't realize it was a double-click (is there a reason not to just have it one-clickable?).
Double clicking expands the tree. One nit - after double click the "more..." is off the screen. I need to scroll up (or cursor down) to have the "more ..." visible.
Also, the navigation (Back, Next, Up, Top) buttons appear to be broken.
@jreadey I limited recursion depth to 1. More will appear on Linux only. countries.h5/tall.h5 can be open-end without error.
@hyoklee - I tried it out and it is working much better now with the tall.h5.
Can we have the the tree go to deep levels when a link is clicked on? E.g. The initial view of tall.h5 should be:
/ g1 g2
Clicking on the g1 icon should make it look like this:
/ g1 g1.1 g1.2 g2
And so on. Currently on selecting g1.1 I can see it has 2 items but there's no expander link. (though I like double clicking puts g1.1 as the new top node).
The countries.h5 file goes crazy - lot's of autonomous updating and beachballs. It it doing stuff in the background? Adding some log output would be useful.
The group1k file works nicely on Mac.
@jreadey OK. I'll work on improving tree view for the case like tall.h5 as you suggested.
For countries.h5, that's the best I could get on Mac. Mac's scroll down event fires rapidly in succession while Window's event fires one at a time. wxPython's behavior is unpredictable per platform.
@jreadey I don't know whether it's wxPython problem or hdf_compass problem but the same code behaves differently on Win7 and Mac. See the attached screen shot. The selection() function in tree.py is called only once on Mac/Linux but the same function is called twice on Windows when I open the same file.
This is looking much better (at least on the mac).
Is recursive_walk dead code now? If so, remove it.
I think the on_bottom handler is not doing quite the right thing... Nodes should only be appended if the scroll exposes nodes that have not been exposed before. With the group1k.h5 file if I wiggle the scroll up and down (but stay in the range of say g0000 to g00030) nodes get added on every scroll down even though I'm not seeing any nodes I haven't seen before.
Can the size of the scroll button be made to be proportional to the percent of nodes visible? E.g. if there are 1000 children, and I see 20 nodes, the scroll button should be very small to reflect there's a limited window on the larger set of nodes. (the ArrayFrame class does this with the grid scroll bars). As it is now, I can't scroll down to the end of the nodes if they are off screen by dragging the scroll button.
I removed recursive part.
I think I addressed your problem by scrolling to the last item added. Please test it again see if it's not what you expected. I also improved tree control for Linux so moving scroll up and down at the end of the tree view can append more items. Thus, "more" is gone for Linux.
Does scroll button appear larger / smaller on your Yosemite mac? I don't see such effect on my Mavericks Mac. You can explain it to me by capturing screenshots.
@hyoklee I am curious about ID_VIEW_MENU_GRAPH
: https://github.com/HDFGroup/hdf-compass/blob/issue26/hdf_compass/compass_viewer/container/frame.py#L60
What will it display? How will it be different from ID_VIEW_MENU_TREE
?
@giumas That's provisional to handle loops among nodes. Tree view is not sufficient for HDF5 in general.
@hyoklee - see the screenshot here:
The scrollbar on the right is taking 80% of the length even though only a small fraction of the links are displayed.
@jready I see what you mean now. I can't control the size of scroll bar. There are only 20 items on the tree view and next 20 will be loaded when you page down the scroll bar. Thus, 80% size is right (17/20).
Please let me know if you want to load all 1000K nodes from the beginning like Icon/List/Grid view does. Then, you'll get a small scroll bar.
@hyoklee - The List view is using wx.LC_VIRTUAL so it can handle an arbitrary number of items without actually loading them in memory. Does the TreeCtl have equivalent functionality?
If not, you can explore expanding the number of nodes you load on activate - say 1000. That way it should load reasonably fast and have a scroll button that is at the minimal size (I think). Next when the user scrolls to the bottom you can load an additional 1000 nodes and so on.
@jreadey No, tree doesn't have LC_VIRTUAL as far as I know. From Oct. 2 email exchange regarding tree control, @mfolk suggested to set the default limit to 20 so I followed his suggestion. If you like 1,000, you can easily change it by modifying the code self.limit=20 to self.limit=1,000 in tree.py.
I think the limiting number should be an user option. What would be the best way to save such preference in Compass?
I don't think it should be a user option - experiment and see which works best. 20 is too small because scrolling to the bottom is not very effective & the scroll button size is too large. A 1000 may take some time to load - see how it goes.
Regardless, we do want to enable the user to see all the links regardless of low many there are. I.e. not the HDFView-style limitation on the number of links.