PDLPorters / PDL-Graphics-Prima

A graphing widget using the Prima toolkit
13 stars 6 forks source link

perldl integration #49

Closed dk closed 1 year ago

dk commented 1 year ago

Hi all,

I'm trying to continue David's work on integration of the module with perldl command line, and while it is fine as is on unix/cygwin, on win32 it is all, well.. not ordinarily easy. I've managed to make a decent user interaction with win32 console using the latest Prima API change (latest github code, not released). Also, I made a branch https://github.com/dk/PDL-Graphics-Prima/tree/perldl-win32-term that can make use of the API.

However I don't have an overview of all use cases there could be about the console/command line/piped input/whatever integration. Would you be interested to test the use cases known to you to see if they all work with this approach, both on unix and win32, but especially on win32?

The steps I used to test this:

  1. perldl
  2. use PDL::Graphics::Prima::Simple;
  3. lineplot(sequence(10));

that should show a graph, and both graph and command line should be responsive

mohawk2 commented 1 year ago

I don't have vast insight into this myself, and in any case I'd be happy to accept material improvements rather than aim for immediate perfection. Is that using a different event loop? There's limited support already in perldl for e.g. GLUT event-loop, and I'd love to see that improved/generalised.

Further things to look at would be from @run4flat (albeit I think all Linux-orientated): his https://metacpan.org/pod/App::Prima::REPL, and also his "Intro to PDL" talk (https://www.youtube.com/watch?v=rf1yfZ2yUFo) and "Interactive Data Analysis with Prima and PDL" which as I recall use that REPL.

dk commented 1 year ago

Well not quite this is still Primas own event loop. They don't usually mix together well, and there doesn't seem to be a middle ground - one has to select the loop, be it tk, prima, glut, whatever - and stick with it. AFAIK one does that inside perldl by selecting an ever loop explicitly?

mohawk2 commented 1 year ago

AFAIK one does that inside perldl by selecting an event loop explicitly?

Exactly. There are ways to mix event loops (such as EV or AnyEvent), but I am not suggesting that, simply adding the Prima event loop as an explicit option for perldl.

dk commented 1 year ago

Now I finally got around to checking the App::Prima::REPL, wow thins is surprisingly nice! I wasn't aware that it exists. So yes, I guess with the state of event loops in perl world there isn't much to fish for, either an app should be explicitly choosing prima (like A:P:REPL) or some middle layer API should be provided, like in pdl demo.