Difference between revisions of "Special topic breakout: KWWidgets"

From NAMIC Wiki
Jump to: navigation, search
Line 52: Line 52:
 
==== From Curtis Lisle====
 
==== 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 [http://www.na-mic.org/Wiki/index.php/Image:KWMeshViewer030607.png 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.
+
* 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 [http://www.na-mic.org/Wiki/index.php/Image:KWMeshViewer030607.png 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.<br>'''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.
+
* 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.<br>'''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 ====
 
==== From Brad Davis ====

Revision as of 22:10, 24 June 2007

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


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)

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.
  • 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 .

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's a Tk "feature".

From KWW-Users mailing list

From Steve:

I'd like to have a discussion of 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, 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: Wow :) Which control?

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