|
From: <pl...@pi...> - 2014-10-24 15:30:12
|
On 10/24/14 08:18, Philipp K. Janert wrote: > > > I'd like to drum up support for a feature that I > don't have the prerequisites to implement myself, > but that might not be very difficult to do for > somebody with the right background. > > I think it would be wonderful if both current > interactive terminals (Qt and wxt) would allow > the user to "save" the current graph to file in > a range of file formats (basically PNG and PDF). > > The way I imagine this would be similar to the > way most (if not all) current GUI applications > handle this action: when the user selects the > corresponding menu entry or presses the button, > a file selection dialog pops up, in which the > user can select/enter the path- and filename > under which to save the graph, and also the > file format. Hit "Ok", and the file is created. > > The current "copy to clipboard" function goes > a long way in this direction, but is not perfect. > It introduces a dependency on the clipboard and > how it works (under different window managers), > and may require the user to start another application. > (For instance, I can "paste" from the clipboard > into the Gimp, but I have not found a way to save > directly from clipboard to file - which is what > I really need.) > > "Saving a graph" from gnuplot has always been awkward, > and of course there are good and venerable historical > reasons for that. But with the Cairo/wxt/Qt-based > terminals, we are in a position to make this process > so much better - the "copy-to-clipboard" feature > shows what it could be like! All I am suggesting > is an additional dialog that let's the user choose > a filename. I think that would bring gnuplot's behavior > much closer to what users are expecting, given their > experience with other GUI applications. > > (The classic, text-based process would continue > to exist, unchanged, for scripting purposes and > fine-grained control.) > > But: I can't do it myself. I have never programmed > wxt (and Qt most recently almost 10 years ago) and I > am not going to figure out how to enter this functionality > into gnuplot. (I did take a look at wxt_gui.cpp and > realized quickly that this is beyond me.) But for > someone who knows these libraries, this might not be > that difficult a task: both libs provide complete > widgets for file selection dialog (wxFileDialog and > QFileDialog, resp). Would it be very difficult to > hook them up in the right places? > > I think it would make a world of a difference to > people - and do much to dispell the myth that > gnuplot is "hard to learn". > > Best, > > Ph. > In principal I agree that there is a need here. Firing up another program just to use its saveAs dialogue seems suboptimal. This need arises because the current output of , say the png terminal, looks very different from the interactive version of graph. I long since gave up trying to tune the two to be sufficiently similar and use the clipboard function. One quick way to do this, which could be a first step without all the dialogues would be to add a termopt : eg. termopt saveDir="/tmp/gnuplot" saveFormat="png" Default could be `pwd` . I usually save my plots in the same directory that the data I'm working on is in. This could then be done with a single click from the interface, with some default compression parameters for png. This would be most useful to me. I don't want to have to go through a metric tonne of option dialogues like gimp does or do battle with the standard file dialogues that require a lot of clicking if you want to go anywhere other "my documents". The gimp solution is full of options if you want to tune everything and has full saveAs ( sorry that's called 'export' now :? ) capability. What would be nice in gnuplot is a one line configuration command entered from a console that allows a one click save afterwards. A simple text entry for file name is all that is needed. Default to last used name to overwrite or change. I agree that both the wx and qt libs would require a steep learning curve for someone not familiar with them. The simplest way would be to also specify the file name in termopts. This would make getting the nuts and bolts of a mechanism in place relatively simple. If I had to do something like one console command : termopt saveDir="/tmp/gnuplot" saveFormat="png" saveFile="test.png" then a single click interaction on the interactive terminal this would be significant time saver for me and would provide a satisfactory minimalistic solution. Error conditions could be reported directly to the console. Maybe this is something Philipp could achieve without spending weeks in the bowels of library code. I don't see any sense in saving a graphic as PDF. Maybe someone could say why people do this. AFAIK it justs adds a wrapper around the image and bloats it. I can't think what situations would be able to display a PDF that cannot display a png directly. Regards. Peter. |