Back to the main page.

Bug 648 - ft_uilayout and layoutgui should perhaps be merged

Status CLOSED FIXED
Reported 2011-05-10 10:23:00 +0200
Modified 2014-03-12 12:21:42 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 enhancement
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on: 1966
Blocks:
See also:

Robert Oostenveld - 2011-05-10 10:23:19 +0200

the layoutgui function is defined as subfunction and used in ft_electroderealign/ft_sensorrealign. It seems to me that both functions serve a similar purpose. If that is the case, they should be consolidated into a single function.


Robert Oostenveld - 2013-02-07 11:55:58 +0100

The following functions make use of uicontrol mac001> grep -l uicontrol *.m */*.m ft_artifact_zvalue.m ft_databrowser.m ft_electroderealign.m ft_interactiverealign.m ft_movieplotTFR.m ft_qualitycheck.m ft_sensorrealign.m ft_sliceinterp.m ft_sourcemovie.m compat/ft_artifact_manual.m compat/ft_componentbrowser_old.m compat/ft_databrowser_old.m plotting/ft_uilayout.m private/artifact_viewer.m private/browse_simpleFFT.m private/moviefunction.m private/prepare_mesh_manual.m private/rejectvisual_channel.m private/rejectvisual_summary.m private/rejectvisual_trial.m private/select_channel_list.m private/uidisplaytext.m private/volumeedit.m private/wizard_base.m the following functions make use of ft_uilayout mac001> grep -l ft_uilayout *.m */*.m ft_artifact_zvalue.m ft_databrowser.m compat/ft_databrowser_old.m plotting/ft_uilayout.m and the following make use of layoutgui mac001> grep -l layoutgui *.m */*.m ft_electroderealign.m ft_interactiverealign.m ft_sensorrealign.m private/prepare_mesh_manual.m


Jörn M. Horschig - 2013-02-07 13:11:50 +0100

I took the liberty to assign this bug to me, hope that's alright with you ;)


Jörn M. Horschig - 2013-07-24 14:59:12 +0200

In order to make this work, we need to implement some new hpos and vpos options. Currently, electroderealign adds ui control elements to the righthand side of the figure. In contrast, ft_uilayout features 4 modes for horizontal positioning: - an 'auto' mode, which spaces elements 0.01 normalized units apart, starting from the most lefthand side of the figure - an 'align' mode, which makes the starting x-position the same for all elements, namely the one from the first element - a 'distribute' mode, which distributes all elements equally from the lefthand to the righthand side - a number, which makes the starting x-position the same for all elements, namely the number passed on as an argument. None of these options allow for an alignment to the righthand side. I could either add an 'halign' option, which could be 'left' or 'right' (or 'centered'). Alternatively, I could add more options for 'hpos', but I'm very much in favour of a separate option. A similar case holds for vertical alignment then ('top' and 'bottom') Furthermore, all these options for 'hpos' and 'vpos' are not documented in ft_uilayout, yet. This needs to be done.


Jörn M. Horschig - 2013-07-24 17:02:40 +0200

just added documentation, but I got some error while being on mentat003 with committing: $ svn ci plotting/ft_uilayout.m -m "documentation #648 - documented key-value pairs" Sending plotting/ft_uilayout.m Transmitting file data .svn: Commit failed (details follow): svn: Can't create directory '/home/svnroot/fieldtrip/db/transactions/8329-1.txn': Read-only file system mentat001 is also down right now - maybe some problem with the fileserver? I'll try again tomorrow


Jörn M. Horschig - 2013-07-25 08:02:44 +0200

svn ci plotting/ft_uilayout.m -m "documentation #648 - documented key-value pairs" Sending plotting/ft_uilayout.m Transmitting file data . Committed revision 8330.


Jörn M. Horschig - 2013-07-25 15:15:21 +0200

I just went ahead and implemented this, because it should not harm: 713 $ svn ci plotting/ft_uilayout.m -m "enhancement #648 - 'halign' and 'valign' options added" Sending plotting/ft_uilayout.m Transmitting file data . Committed revision 8331. jorhor@mentat001:~/FieldTrip/trunk 714 $ svn ci plotting/ft_uilayout.m -m "enhancement #648 - 'halign' and 'valign' options added" Sending plotting/ft_uilayout.m Transmitting file data . Committed revision 8332. (the latter commit just restores default behaviour) I just change ft_eletroderealign (and sensorrealign) to create the UI with uicontrol and ft_uilayout. Hhowever, I found that what I proposed for ft_uilayout and committed does not work in electroderealign, because the tags are necessary to retrieve the values. This is incompatible with the idea of ft_uilayout to retag uicontrol elements in functional groups. Anyway, this one should be solved. 714 $ svn ci ft_electroderealign.m ft_sensorrealign.m -m "#648 - ui created using ft_uilayout" Sending ft_electroderealign.m Sending ft_sensorrealign.m Transmitting file data .. Committed revision 8333. Note that changing the alpha-value does not work, and apparently never did work.


Jörn M. Horschig - 2013-07-25 15:24:19 +0200

svn ci ft_electroderealign.m ft_sensorrealign.m -m "#648 - deleted old code" Sending ft_electroderealign.m Sending ft_sensorrealign.m Transmitting file data .. Committed revision 8334.


Robert Oostenveld - 2013-07-30 12:54:08 +0200

I understand that ft_uilayout now takes over from layoutgui. However, I see that there are still two functions calling layoutgui: mac001> grep -l layoutgui *.m */*.m ft_interactiverealign.m private/prepare_mesh_manual.m mac001> grep -l ft_uilayout *.m */*.m ft_artifact_zvalue.m ft_databrowser.m ft_electroderealign.m ft_sensorrealign.m compat/ft_databrowser_old.m plotting/ft_uilayout.m


Jörn M. Horschig - 2013-07-30 14:07:08 +0200

yup indeed, I just fixed that svn ci ft_interactiverealign.m private/prepare_mesh_manual.m -m "enhancement #648 - replaced layoutgui by ft_uilayout and uicontrol calls" Sending ft_interactiverealign.m Sending private/prepare_mesh_manual.m Transmitting file data .. Committed revision 8350. these *realign functions are super weird, they all look the same, they all do the same, have the same callbacks, etc., but still there are three of those. I don't wanna volunteer for that, but I think they should be merged. generally I think that the few GUIs that there are receive too little attention and are not always too polished and code is rather scattered, sometimes across different functions. that is a pity, because it is so much work to make interactive functions, and often little is missing to make them really useful... svn ci ft_interactiverealign.m private/prepare_mesh_manual.m -m "enhancement #648 - replaced layoutgui by ft_uilayout and uicontrol calls" Sending ft_interactiverealign.m Sending private/prepare_mesh_manual.m Transmitting file data .. Committed revision 8350.


Robert Oostenveld - 2013-07-30 16:13:27 +0200

(In reply to comment #9) thanks! > these *realign functions are super weird, they all look the same, they all do > the same, have the same callbacks, etc., but still there are three of those. I > don't wanna volunteer for that, but I think they should be merged. Agreed. See bug 1830 for that.