From tcornwel@aoc.nrao.edu Tue Jan 14 21:04:31 2003 Date: Mon, 30 Dec 2002 15:00:35 -0700 From: Tim Cornwell To: aips2-naug@cv3.cv.nrao.edu Subject: [Aips2-naug] Simple tool gui Naughty people, I've been doing a little work on a simple GUI in connection with the ALMA tests. The GILDAS software has a simple GUI that walks one through the steps of calibration of PdB data. One of the goals of the test is to make something similar to that GUI. I thought the results might be of some interest to this group, especially in connection with the interface group that Steve is to put together soon. There is a new tool called toolgui (actually it'll be in daily tomorrow) that automatically constructs a GUI for a tool. The interesting parts are: - The GUI is independent of the toolmanager (though it looks quite similar) - A subset of functions to be displayed can be specified. This enables "lite" versions of tools to be put together (see below). - The functions may be run one-by-one or sequentially. - Simple rules can be set so that a given function must be run before another can be run. It replies upon the meta info file used to described the interface so if you write your own function you'll have to write one of those as well (easy but ask one of the developers to help you get started). For tools that already have the meta-info, such as imager, you can do something like: include 'imager.g'; include 'toolgui.g'; myimager := imager('3C273XC1.ms'); mygui := toolgui(myimager, functions="setimage setdata makeimage", sequential=T, rules=[makeimage=[requires="setdata setimage"]]); This is a little bit tedious. It could either be put in a script or in a plugin. To try out the plugin route, save the glish at the end of this file in a file called e.g. imager_timsgui.gp and then run imager as follows: include 'imager.g'; myimager := imager('3C273XC1.ms'); myimager.gui(); I couldn't resist throwing in some value-added stuff - in this version, whenever makeimage is run, the resulting image is shown. Happy holidays, Tim pragma include once include 'imager.g' include 'note.g'; imager_timsgui := [=]; imager_timsgui.init := function() { # Nothing to do here return T; } imager_timsgui.attach := function(ref public) { # # Define my very own gui function # public.gui:=function() { include 'toolgui.g'; note('--------------------------------------------------------------'); note('| Welcome to imager-lite |'); note('--------------------------------------------------------------'); imager_timsgui.gui := toolgui(public, functions="setimage setdata makeimage", sequential=T, rules=[makeimage=[requires="setdata setimage"]]); # # Whenever the toolgui runs a function we get some useful information # whenever imager_timsgui.gui->run do { rec := $value; note('imager function ', rec.function, ' returned ', rec.return); # # When makeimage is run, we automatically show the image # if(rec.function=='makeimage') { include 'catalog.g'; if(rec.data.image!='') dc.view(rec.data.image); } } return T; } return T; } const imager_timsgui := const imager_timsgui; _______________________________________________ Aips2-naug mailing list Aips2-naug@listmgr.cv.nrao.edu http://listmgr.cv.nrao.edu/mailman/listinfo/aips2-naug