Introducing Inform, was Re: zenity sub

2017-01-11 Thread Richard Hainsworth
This request actually was something I wanted a lot, but since 
experimenting with GTK::Simple, something seemed possible.


Hence the Inform (actually Informative) module.

It's in the modules ecosystem and installs with Panda. (Panda install 
Inform)


To get a popup dialog box inside a Perl 6 program:

use Informative;

...

inform( "You have mails waiting");


Other options include adding buttons and entry widgets (which will also 
handle passwords).


Not as complex as zenity. But directly answering the question posed by 
ToddAndMargo


inform( $InfoText, :title($ExtraTitle));

Richard Hainsworth

On Thursday, December 01, 2016 08:00 PM, ToddAndMargo wrote:

Hi All,

In Perl 6 running on Linux, what would be the best way
to get rid of the following system informational pop up
(this from a bash script)?  I other words, how do I
do a window pop up in Perl6 for Linux?

zenity --info --title="$0 $ExtraTitle" --text "$InfoText"

Many thanks,
-T



Re: zenity sub

2016-12-01 Thread ToddAndMargo

On 12/01/2016 12:19 PM, Timo Paulssen wrote:

But I suggest using qx for calling the zenity binary from
your system.


Actually, I though it would be good training.  Sometimes
doing things the hard way teaches you something.

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~




Re: zenity sub

2016-12-01 Thread ToddAndMargo

On 12/01/2016 12:19 PM, Timo Paulssen wrote:

Surely you could already build a decent zenity-like in Perl 6 using
GTK::Simple. But I suggest using qx for calling the zenity binary from
your system.
   - Timo


And examples too!  :-)

https://github.com/perl6/gtk-simple/tree/master/examples

Thank you!


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~




Re: zenity sub

2016-12-01 Thread Timo Paulssen
Surely you could already build a decent zenity-like in Perl 6 using
GTK::Simple. But I suggest using qx for calling the zenity binary from
your system.
  - Timo


Re: zenity sub

2016-12-01 Thread Brandon Allbery
On Thu, Dec 1, 2016 at 2:45 PM, Brandon Allbery  wrote:

> Largely because making it work in native perl 6 is not all that trivial;
> that oh so "simple" popup has a full featured, mature widget toolkit and
> graphics interface behind it, and uses, or at least makes available, quite
> a few complex parts from it.
>

Also: the obvious answer is "use NativeCall!". Unfortunately, NativeCall
has been demonstrating why nobody else does FFI that way: it works fine for
simple types, but as soon as you are working with structs or struct
pointers you need to translate C headers to Perl 6 `is repr('CStruct')`,
including dealing with alignment rules that are so hairy that everyone else
pushes that part to the C compiler to deal with (including h2xs in the perl
5 world) because only the C compiler can consistently get it right. gtk3 is
complex enough that I would expect very few parts of it to NativeCall very
well; anything else would require a *lot* of work (and $DEITY help you with
the TreeView and TreeModel stuff...).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: zenity sub

2016-12-01 Thread Brandon Allbery
On Thu, Dec 1, 2016 at 2:38 PM, ToddAndMargo  wrote:

> Quoting constructs as a perl 6replacement for zenity pop up windows?


They're suggesting that, given an existing program specifically intended
for providing pop-ups fo rother programs, why not use it?
Largely because making it work in native perl 6 is not all that trivial;
that oh so "simple" popup has a full featured, mature widget toolkit and
graphics interface behind it, and uses, or at least makes available, quite
a few complex parts from it.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: zenity sub

2016-12-01 Thread ToddAndMargo

On 12/01/2016 05:22 AM, Timo Paulssen wrote:

Zenity is already meant to be run by other programs (like shell scripts).

Please see these documentation pages for info about how to invoke
existing programs:

 https://docs.perl6.org/syntax/qqx

https://docs.perl6.org/language/quoting#Shell_quoting_with_interpolation:_qqx


Hope that helps!
   - Timo



Quoting constructs as a perl 6replacement for zenity pop up windows?
I don't get it.

This is zenity:
http://linux.byexamples.com/archives/265/a-complete-zenity-dialog-examples-2/


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~




Re: zenity sub

2016-12-01 Thread ToddAndMargo




Richard
On Thursday, December 01, 2016 08:00 PM, ToddAndMargo wrote:

Hi All,

In Perl 6 running on Linux, what would be the best way
to get rid of the following system informational pop up
(this from a bash script)?  I other words, how do I
do a window pop up in Perl6 for Linux?

zenity --info --title="$0 $ExtraTitle" --text "$InfoText"

Many thanks,
-T





On 12/01/2016 04:18 AM, Richard Hainsworth wrote:

How about:

$perl6

> my $c = prompt("can I have some\n"); say "you told me: $c";
can I have some
indeed you are welcome
you told me: indeed you are welcome
>

explanation: perl6 runs REPL to try something out
prompt takes a string and prints it, waiting for a response, which it 
returns.

say outputs it.

Is that what you want? 


I was looking for a pop up window.  I was looking  perl 6
for a replacement zenity.

This is zenity:
http://linux.byexamples.com/archives/265/a-complete-zenity-dialog-examples-2/


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~




Re: zenity sub

2016-12-01 Thread Timo Paulssen
Zenity is already meant to be run by other programs (like shell scripts).

Please see these documentation pages for info about how to invoke
existing programs:

https://docs.perl6.org/syntax/qqx
   
https://docs.perl6.org/language/quoting#Shell_quoting_with_interpolation:_qqx

Hope that helps!
  - Timo


Re: zenity sub

2016-12-01 Thread Richard Hainsworth

How about:

$perl6

> my $c = prompt("can I have some\n"); say "you told me: $c";
can I have some
indeed you are welcome
you told me: indeed you are welcome
>

explanation: perl6 runs REPL to try something out
prompt takes a string and prints it, waiting for a response, which it 
returns.

say outputs it.

Is that what you want?

Richard
On Thursday, December 01, 2016 08:00 PM, ToddAndMargo wrote:

Hi All,

In Perl 6 running on Linux, what would be the best way
to get rid of the following system informational pop up
(this from a bash script)?  I other words, how do I
do a window pop up in Perl6 for Linux?

zenity --info --title="$0 $ExtraTitle" --text "$InfoText"

Many thanks,
-T





zenity sub

2016-12-01 Thread ToddAndMargo

Hi All,

In Perl 6 running on Linux, what would be the best way
to get rid of the following system informational pop up
(this from a bash script)?  I other words, how do I
do a window pop up in Perl6 for Linux?

zenity --info --title="$0 $ExtraTitle" --text "$InfoText"

Many thanks,
-T

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~