Difference between revisions of "Special topic breakout: KWWidgets"

From NAMIC Wiki
Jump to: navigation, search
m (Text replacement - "http://www.slicer.org/slicerWiki/index.php/" to "https://www.slicer.org/wiki/")
 
(6 intermediate revisions by 3 users not shown)
Line 60: Line 60:
 
* Directory selection box fix:
 
* Directory selection box fix:
 
** Add entry box for typing a path to reduce tree-clicking
 
** Add entry box for typing a path to reduce tree-clicking
 +
** Auto-complete (with tab) and/or select entries in tree when typing first characters of name.
 
* Double clicking on linux:
 
* Double clicking on linux:
 
** Figure out why this doesn’t work and fix.
 
** Figure out why this doesn’t work and fix.
* Tree widget with additional columns: determine what C++ api people need (e.g. model hierarchy where different nodes have different kinds of parameters)
+
* Tree widget with additional columns: determine what C++ api people need (e.g. model hierarchy where different nodes have different kinds of parameters) See [https://www.slicer.org/wiki/Slicer3:GUI_Experiments:TkTreeCtrl Slicer3:GUI_Experiments:TkTreeCtrl]
 
* File browser:
 
* File browser:
 
** Investigate this one: http://public.kitware.com/pipermail/kwwidgets/2007-June/000456.html Make sure a user can set a default path.
 
** Investigate this one: http://public.kitware.com/pipermail/kwwidgets/2007-June/000456.html Make sure a user can set a default path.
Line 74: Line 75:
 
* Include good example of observer paradigm in KWWidgets examples
 
* Include good example of observer paradigm in KWWidgets examples
 
* Include example for how to build without CMake?
 
* Include example for how to build without CMake?
* GUI tracing capability
+
* [http://www.kwwidgets.org/Wiki/KWWidgets/GUI_Testing GUI Testing/Tracing] capability
 
* Design a WYSIWYG GUI builder that outputs xml description which is parsed and built at runtime (like CLP?)
 
* Design a WYSIWYG GUI builder that outputs xml description which is parsed and built at runtime (like CLP?)
 
* mechanism for callback to be set at runtime
 
* mechanism for callback to be set at runtime
Line 125: Line 126:
 
==== From Steve:====
 
==== From Steve:====
  
I'd like to have a discussion of [http://www.kwwidgets.org/Wiki/KWWidgets/Tracing GUI Tracing].  In slicer3 we've started to experiment with a MRML-based tracing structure using the scene snapshot infrastructure, but we should consider if this is preferable to a GUI-based solution or not.  See, for example, [http://www.na-mic.org/ViewVC/index.cgi/trunk/Base/GUI/vtkSlicerRecordSnapshotWidget.cxx?annotate=3621 the vtkSlicerRecordSnapshotWidget].
+
I'd like to have a discussion of [http://www.kwwidgets.org/Wiki/KWWidgets/GUI_Testing GUI Testing/Tracing].  In slicer3 we've started to experiment with a MRML-based tracing structure using the scene snapshot infrastructure, but we should consider if this is preferable to a GUI-based solution or not.  See, for example, [http://www.na-mic.org/ViewVC/index.cgi/trunk/Base/GUI/vtkSlicerRecordSnapshotWidget.cxx?annotate=3621 the vtkSlicerRecordSnapshotWidget].
  
 
Performance of the file browser could be improved (request for multi-threaded solution or a helper process that does the glob'ing so the main application does not block).
 
Performance of the file browser could be improved (request for multi-threaded solution or a helper process that does the glob'ing so the main application does not block).
Line 190: Line 191:
  
 
*Steve:
 
*Steve:
**gui tracing
+
**[http://www.kwwidgets.org/Wiki/KWWidgets/GUI_Testing GUI Testing/Tracing]
 
**performance of file browser & multithreading
 
**performance of file browser & multithreading
 
**font size problems on non-windows
 
**font size problems on non-windows

Latest revision as of 18:07, 10 July 2017

Home < Special topic breakout: KWWidgets





KWWidgets Breakout Session

June 26th, 1-2pm

Location: Grier Rooms A & B: 34-401A & 34-401B







Attendees:

  • Yumin Yuan
  • Steve Pieper
  • Alex Yarmarkovich
  • Wendy Plesniak
  • Nicole Aucoin
  • Curt Lisle
  • Csaba Csoma
  • Brad Davis
  • David Gobbi
  • Kiran Shivanna
  • Kevin Teich
  • Jeff Hawley
  • Xiujuan Geng
  • James Harris
  • Gary Christensen
  • Paul Song
  • Alex. Gouaillard
  • Vincent Magnotta
  • Kiran Shivanna
  • Katie Hayes


Agenda

  • Roadmap (to help KWWidgets developers prioritize their work)
  • Widget feature requests / feedback
  • Talk about best approaches to making some widget behavior appear consistent across platforms.
  • Separate Tutorial Session for New Users (to happen possibly on Wednesday).
    Hint: Seb: I just added a tentative Tutorial 1 that tackles creating a very simple composite widget. See Examples/Cxx/Tutorial1. I need to write the corresponding documentation.

KWWidgets-specific To-Do lists distilled from discussion (details below)

What's listed below is not yet prioritized! We'll list these in priority order (highest to lowest) after some discussion.


To-do list for wendy

  • Put discussion of when widgets require Modified() or Update() invoked to refresh their appearance on the ‘how to build a module GUI’ page.
  • Fix fonts –theme them by default, set size according to screen resolution, and save preferences in application settings.
  • Add new version of consistent cross platform check and radio buttons, add downloadable blanks to wiki, and swap into existing code.

To-do list for slicer core developers

To-do list for seb & yumin

  • Directory selection box fix:
    • Add entry box for typing a path to reduce tree-clicking
    • Auto-complete (with tab) and/or select entries in tree when typing first characters of name.
  • Double clicking on linux:
    • Figure out why this doesn’t work and fix.
  • Tree widget with additional columns: determine what C++ api people need (e.g. model hierarchy where different nodes have different kinds of parameters) See Slicer3:GUI_Experiments:TkTreeCtrl
  • File browser:
  • Need composite widget (menu with horizontal (to accommodate multicolumns) and vertical scroll capability)
  • Configure events appear to be intermixed with update
  • Include Cmake example in KWWidgets for developers
  • Include good example of observer paradigm in KWWidgets examples
  • Include example for how to build without CMake?
  • GUI Testing/Tracing capability
  • Design a WYSIWYG GUI builder that outputs xml description which is parsed and built at runtime (like CLP?)
  • mechanism for callback to be set at runtime
  • Need a 2D viewer that’s faster than the volume viewer (lightbox?)
  • Composite widget for context menu, or context message?

Specific Issues

From Nicole Aucoin

Directory selection dialog box on linux:

  • Bug: it pops up with a default width such that the right scroll bar isn't visible (see this screenshot; to reproduce it, start up Slicer3, go to the Models module, click on "Load Directory").
    Hint: Seb: the quickest workaround (Yumin?) at this point would be to make the default width a tad larger so that the right scrollbar button shows up. Yumin: Fixed.
  • Request: an entry box where I can type a path to reduce clicking through the tree (useful before setting up a favourite)
    Hint: Seb: Very doable (Yumin?). Let's put all requests in the TODO list and prioritize.

From Curtis Lisle

  • I have had trouble initializing widgets to specific values in advance of user input. For example, I've created interfaces with sliders and buttons but I have had trouble getting the widgets toinitialize in a state different then the default state. For example, setting a slider to value=26 in the middle of its range without dragging the mouse. The API looks like it is there, but I couldn't get it to work for me. I'm sure I tried setting the state before and after creation, if I remember, but no luck. It may be that I'm not updating the GUI successfully after changing values. Update: see screenshot; by state, I mean the widget-specific state, such as a check button is checked, or a slider is set at a particular value within its range. For example, the "Outline Display" button could be checked ON via API control of the program, not the user clicking on it. Before this picture was taken, I dragged the "element size" slider to 93% via the mouse. I'd like to instantiate the GUI, then set the actual positions and state values of the widgets. I just need clarity on the order of events to invoke through the API or help figuring out what I'm doing wrong. I notice that for KWWidgets, State usually means enabled/disabled to process user events. Instead, I am thinking about setting widget values from the program. I guess for CheckButtons, this would be Get/SetSelectedState(). For a vtkKWScale, this would be SetValue(). I tried setting these but didn't see the effect on the GUI. Maybe I am just not invoking Modified() correctly afterwards.
    Hint: Seb: Not sure on this one. Setting the values programmatically is something that is done in all our apps and it is a pretty important part of how the application works through callbacks. For most widgets, setting a value before calling Create() *should* work, but it never hurts do make sure it is done *after* Create(), to be on the safe side. There is no need to call Modified(), at least on the core widgets like checkbuttons or scales, the UI should be updated right away. You can even do it at runtime through the Tcl interpreter. So I guess we would need to see the code: it is possible that as soon you set a new value, an event is triggered (like ModifiedEvent) and some other part of your app that would listen to this event would set that widget back to its previous value. In term of Model/View/Controller pattern, the UI/view is supposed to reflect the state/values of a model; if you designed your app that way and it is possible that your controller is always resetting the UI to the current model's value.
  • discuss when UI elements need to have Modified() / Update()invoked to refresh their appearance. I used a histogram widget on a project and had to experiment a lot calling the panel and RenderWidowWidget, etc. before I finally got the histogram to update when the input changed.
    Hint: Seb: it's mostly widget dependent, but for the core widgets, you should not have to call Modified(), or Update() (which is not part of the vtkKWWidget superclass anyway). For some composite widgets, they should be smart enough to be always 'up to date', but sometimes being up to date is so costly that a manual call to a method is needed (which might be called Update()). The histogram, to my knowledge, is indeed the trickiest one, sorry :) You do not want to have the histogram updated automatically each time somebody modifies one pixel in an image/vtkDataArray, for example. There is nothing in VTK that really says, asynchronously, "this image has been modified enough that it might be time to refresh your histogram". Granularity issues....

From Brad Davis

  • Bug: Double-clicking does not work with slicer3 and linux.
    Hint: Seb: The KWWidgets demo/examples handle double-clicks fine, so my guess is that Slicer3 is intercepting them. Yumin to investigate this issue.
  • Bug: File->Add Data does not use new file browser.
    Hint: Seb: Sounds like a quick fix (Yumin?). Steve: this has been fixed.
  • Request: Tree with additional columns widget
    Hint: Seb: The TkTreeCtrl library is in KWW and allows that, but one need to wrap it inside a C++ class, and this is a lot of work (Seb?). Let's put all requests in the TODO list and prioritize. Steve: there was discussion about exposing the TkTreeCtrl in the tcl interp so users can access it directly with Script() - is this an easy thing to do now? Seb: yes, that's very easy, but that means we are going to see tons of ugly Tcl code in the middle of C++ code :) Seb: OK, DONE, it's in. I compiled and tested on Win32. I compiled but could not test on Linux. TkTreeCtrl documentation can be found here. Download the TkTreeCtrl distribution, then from Slicer3/KWWidgets interactor, source demos/demo.tcl, then issue: wm deiconify . Steve: Thanks! I'll give it a try. My plan, actually, is to have some very pretty tcl code that uses this feature (no comment on the aesthetic qualities of C++ code!). Seb: I had to disable it until the VS7 build is fixed. To play with it though, edit Utilities\TkTreeCtrl\TkTreeCtrl.cmake and change the code to SET(${supported} 1). This is such a huge (50,000 lines) library that I would suggest you guys start playing with it at the Tcl level and that we use that feedback to create a C++ API that would not have to expose every thing features but the ones you use the most.

From Alex:

  • Request: I would like to address the performance of building GUI in slicer3 Modules. When selecting a module for the first time (Volumes or Models) it takes noticable time before the UI panel is displayed.
    Hint: Seb: Well, you can't have your cake and eat it too :)) We delayed the creation of modules so that Slicer3 starts up faster. But one way or the other, the modules GUI has to be created. I just tried on my laptop on Win32, and I did not notice anything slow when I selected a few modules. Which ones are slow? Maybe one of the slow modules is actually doing more than just creating GUI when it is initialized.
  • Request: Customizable tree widget similar to slicer2 model hierarchy editor: allow to add push-buttons or check boxes for the individual tree leaves.
    Hint: Seb: The TkTreeCtrl library is in KWW and allows that, but one need to wrap it inside a C++ class, and this is a lot of work (Seb?). Unless, as suggested by Steve, you want to expose the TkTreeCtrl library directly and do it from Tcl. Let's put all requests in the TODO list and prioritize.

From Wendy:

Mostly pesky things:

  • Request: Creating special versions of menubutton drop-down menus with scroll capability.
    Hint: Seb: There is no such native widget, so we would have to create a composite widget mixing a button and a scroll list (Seb or Yumin?). A day or two worth probably. Let's put all requests in the TODO list and prioritize.
  • Request: checkbuttons and radiobuttons with consistent "on/off" visual representation across platforms. (either special Slicer widgets or KWWidgets).
    Hint: Seb: Tcl/Tk does not provide an API to modify that visual representation (called the 'indicator'), since it is trying to use the native widgets when possible. However, you can emulate that behavior by setting an image for both unselected and selected state (SetImageToPredefinedIcon, SetSelectImageToPredefinedIcon), then make sure the image does not override the text (SetCompoundModeToLeft), remove the usual indicator (SetIndicatorVisibility), and remove the border of what is now a button (SetBorderWidth). All of those calls can be made into a theme. I've updated the KWThemeExample (check the green theme) to show how it is done. I would recommend against it, as a lot of Slicer3 GUI already uses SetImage and SetSelectImage to provide graphical checkbuttons instead of textual ones. I'm not confident this would play well, but let's try.

It would be good to decide on a strategy for addressing these things.

  • Request: Also, if a radiobutton's indicator visibility is off, the widget gets rendered with a 3D effect (even if we're using an icon to display the button's on/off state). Can we turn that 3D effect off?
    Hint: Seb: Not to my knowledge, it might be a Tk "feature" but try SetBorderWidth 0

From KWW-Users mailing list

From Steve:

I'd like to have a discussion of GUI Testing/Tracing. In slicer3 we've started to experiment with a MRML-based tracing structure using the scene snapshot infrastructure, but we should consider if this is preferable to a GUI-based solution or not. See, for example, the vtkSlicerRecordSnapshotWidget.

Performance of the file browser could be improved (request for multi-threaded solution or a helper process that does the glob'ing so the main application does not block).

Look and feel issues:

  • On windows, the menu bar and scroll bar do not get the appearance.
    Hint: Seb: Nope, that was investigated in the past, menu bar and scroll bar are not themable on Windows, it's a Tk "feature".
  • On linux, font size is sometimes way too small.
    Hint: Seb: Fonts are themable, did you try assigning a bigger one globally?. Steve: see Vince's notes below
  • Maybe just me, but I find the new file browser sometimes ignores doubleclicks -- perhaps it is more picky about any small mouse movement between clicks?
    Hint: Seb: Would the be related to the whole double-click problem mentioned already, i.e. Slicer3 might be capturing double-clicks.
  • Configure event management is still a problem - dragging the split frame or hiding the left panel (with F5) causes a lot of extraneous ConfigureEvents.
    Hint: Seb: pretty much all the widgets are inside those split frames, hence repacked/relayout by Tk, and that may trigger a ton of ConfigureEvents (not actual 'pack' calls but just Tk re-doing its whole layout, which triggers events). There are so many widgets and different packing parameters, some "rubber-band" effect may be going on where the layout is adjusted iteratively until it stabilizes.

From Gary and James:

  • I'd like to have a discussion of how to make a widget that reads one image plane at a time from a volume to make a multi-data set display. We have an implementation in wxWidgets that reads data from multiple files as a slider that changes the slice number without having to read the entire volumes into memory.
    Hint: Seb: I think that is demonstrated by the MedicalImageViewer example. The reading/caching/streaming strategy is not KWW related, but VTK related though.
  • When displaying multiple vtkKWRenderWindows at once, the KWwidgets base class generates an error. Being able to display multiple renderwindows at one time is an essential requirement for our project.
    Hint: Seb: Displaying multiple render windows is done by pretty much all our medical apps at Kitware, so yes, this is doable and we can help. What error message are you referring to?
  • The order of linking the ITK, VTK, TCL, TK and KWwidget libraries so that they do not conflict.
    Hint: Seb: I'm not aware of ordering conflicts. Have a look at the KWW examples and how they are linked: there is *no* explicit mention to VTK and Tcl/Tk, they are pulled automatically by CMake as part of the dependencies.
  • We want to access the KWwidgets' device client/handles for drawing on the controls.
    Hint: Seb: if you draw directly, you would probably lose it the next time the UI is refreshed. However, you can use vtkKWCanvas, which is a canvas on top of which you can draw, insert images, etc., and they would be displayed properly. Or you can even embed a render window inside a UI to do 2D or 3D scenes using VTK actors, etc.

From Vincent

  • There are issues with Slicer3 and fonts under Ubuntu Linux (Fiesty Fawn). The fonts are unreadable under this system. On the same system, Paraview fonts appear just fine. After performing some testing and evaluation, it appears that this is related to the order that fonts are resolved under Linux. We have a little script that will work around this by removing the X11 fonts on this sytem and only using the other system fonts for Slicer3. This is an ugly hack, but was close as we managed to get to track down the issue after approximately 3-4 hours of investigation.
    Hint: Seb: If we are talking ParaView 2 (the old ones), then they may be specifying their own fonts explicitly at startup, and that can be done by Slicer3 as well, fonts are themable. If ParaView3, then it's a different story since it is using Qt.
#!/bin/bash

mv /usr/share/fonts/X11 /usr/share/fonts/X11-Slicer3
/opt/Slicer3/Slicer3
mv /usr/share/fonts/X11-Slicer3 /usr/share/fonts/X11

Session Notes

Thanks to Brad Davis. I (Seb) also update some items above on the fly during the meeting.

  • CMake example included in KWWidgets
  • WYSIWYG gui builder-->xml
  • mechanism for callbacks to be set at runtime
  • Curt:
    • trouble initializing (e.g., start slider at 35)
    • good example of observer paradigm
  • Brad:
    • double-click: yumin
    • multi-column widget tree widget: play with it see what c++ api we want
    • file browser widget and initial values: jim & yumin
  • Alex:
    • performance; building guis; trees with lots of entries
    • trees; model hierarchy; each node has a different entry types:

again, work on api

  • Wendy:
    • menu with scroll capability: composit widget
    • check/radio: Seb did some updating
  • Kevin:
    • directory browser problem with directory permissions & soft links:

yumin working on it: needs more work

    • tcl error on kwwidgets error report
    • python callback issue (reported on wiki page: link to mail list)
  • Steve:
    • GUI Testing/Tracing
    • performance of file browser & multithreading
    • font size problems on non-windows
    • configure events seem to be intermixed with update
  • Gary:
    • want a 2D viewer that is quicker than volume viewer
    • how do you do a context menu?
    • help with medical image viewer
  • James (Gary's Student):
    • linking problems when not using cmake