finanalyst / gtk-simple Goto Github PK
View Code? Open in Web Editor NEWSimplistic GTK bindings for Rakudo
License: Artistic License 2.0
Simplistic GTK bindings for Rakudo
License: Artistic License 2.0
http://irclog.perlgeek.de/perl6-dev/2016-09-06#i_13156471
TLDR: the time taken by "use GTK::Simple" could go down a whole lot if the dependencies were properly included with the precompiled GTK::Simple, rather than appearing at run-time.
Someone could/should see if this still keeps everything working and then commit that change.
Here is a minimal example to show the bug off:
use GTK::Simple::App;
use GTK::Simple::TextView;
my $app = GTK::Simple::App.new(:title("Crash in 2 seconds."));
my $text-view = GTK::Simple::TextView.new;
$text-view.text = "acfd";
start { sleep 2; say $text-view.text; }
$app.set-content($text-view);
$app.show;
$app.run;
When this is ran, it correctly shows a window with a TextView containing "acdf". However, after 2 sec, instead of "acdf" (or whatever the TextView contents are at that moment) being printed into the terminal, the program crashes:
$ crash.p6
malloc(): invalid size (unsorted)
[1] 8571 abort crash.p6
This bug also affects the example 11 (examples/11-file-chooser-button.pl6
) that crashes when the file is chosen from the dialog.
The operating system is Debian bullseye/sid, Perl 6 version 2019.07.1, GTK::Simple version 0.1.11, and libgtk3 version 3.24.10-1 (coming from Debian repositories).
Of course I will be happy to provide more information as needed; I'm just not really sure what to look for. If you would like me to use some gdb on it, or get some core dumps, valgrind logs or anything like that, just ask.
Thanks!
This repo contains the sample to observe the bug:
https://github.com/vendethiel/moarvm-gcerr-gtk
However, if I move the block:
$c-o.supply.schedule-on(GTK::Simple::Scheduler).tap({
# doesn't error without this line
$program-output.text ~= $_;
});
To after the start { }
block, the bug disappears.
Running OS X Yosemite, Rakudo version 2016.05-24-gbe4e439 built on MoarVM version 2016.05.
The GTK 3 .dll's provided through http://gtk-dlls.p6c.org/ seem to be quite outdated.
For example, GtkActionBar was introduced in GTK 3.12 and is used in examples\05-bars.pl6 - this example fails on Windows since the libgtk-3-0.dll
provided is GTK 3.6.4.
Latest GTK 3 binaries for Windows are not easy to get though, one has to jump through quite some hoops.
Hi,
I don't understand how install Cairo on Debian Stretch.
I do
apt install libcairo2-dev (and i ha ve libcairo2-dev is already the newest version )
but I have always 'Cairo' module is not installed - can't run example
Have an idea ?
The problem is with the ScrolledWindow code I added a couple of days ago. At first all seems well, but ...
If I run the example (17-scrolled-window ...) from a terminal there is no error the first time. Press the exit button I have provided in the example, and the app cleans up properly. Run the example again, and there are no warnings.
HOWEVER, exit the app using the GTK window destructor (top left X on my ubuntu desktop), and the next time the app is run, warnings are generated! This should not happen.
(See below for output).
As it happens, the warnings are about a place in the code that I was unsure about.
gtk-scrolled-window-new() should be called with two arguments: x-hadjustment and y-hadjustment, that is two (complicated) C structs that can be used to customise the movement of the scrollbars. In the gtk documentation, the simple examples have these arguments set to NULL. So in the Raw.pm6, I use pointers, and in ScrolledWindow.pm6 I use Nil's. Since this is a 'Simple' model, I thought no need for complexity.
However, I am not sure whether I was using best practice.
As you can see the warnings refer to these arguments.
At the same time, clean up at the end of the program should ensure that behaviour in one run of the program does not affect the behaviour of the program again.
Hence, I am marking this as a BUG.
Sample session:
$ perl6 ../gtk-simple/examples/17-scrolled-window-with-textview.p6
==== comment. No output on stdout or stderr. The app was ended using the Exit button
$ perl6 ../gtk-simple/examples/17-scrolled-window-with-textview.p6
==== comment. ditto
$ perl6 ../gtk-simple/examples/17-scrolled-window-with-textview.p6
==== comment. This time, I exited the app by destroying the window, not exiting the app.
$ perl6 ../gtk-simple/examples/17-scrolled-window-with-textview.p6
(17-scrolled-window-with-textview.p6:8210): Gtk-CRITICAL *: gtk_scrolled_window_new: assertion 'GTK_IS_ADJUSTMENT (hadjustment)' failed
(17-scrolled-window-with-textview.p6:8210): Gtk-CRITICAL *: gtk_scrolled_window_set_policy: assertion 'GTK_IS_SCROLLED_WINDOW (scrolled_window)' failed
(17-scrolled-window-with-textview.p6:8210): Gtk-CRITICAL *: gtk_container_add: assertion 'GTK_IS_CONTAINER (container)' failed
(17-scrolled-window-with-textview.p6:8210): Gtk-CRITICAL *: gtk_box_pack: assertion 'GTK_IS_WIDGET (child)' failed
(17-scrolled-window-with-textview.p6:8210): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed
The TextView in an ScrolledWindow exmaple fails. It would appear that TestViews can't be editted within the code giving an error of "Cannot modify an immutable Str ()"
When I want to organize statements in such a way that the App object is placed later in the program when it is needed instead of instantiating it at the start the program, the program will crash.
E,g,
.....
my $button = GTK::Simple::Button.new(label => "Hello World!");
my $second = GTK::Simple::Button.new(label => "Goodbye!");
$second.sensitive = False;
$button.clicked.tap({ .sensitive = False; $second.sensitive = True });
$second.clicked.tap({ app-exit; });
my GTK::Simple::App $app .= new(title => "Hello GTK!");
$app.set-content( GTK::Simple::VBox.new( $button, $second));
$app.border-width = 20;
$app.run;
sub app-exit( ) { $app.exit; }
I assume there are some side effects which are needed by the other widgets but it isn't clear when it happens.
Shown error messages are
(process:13981): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
(process:13981): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed
Segmentation fault (core dumped)
In this the http://gtk-dlls.p6c.org
domain is down
I just put all official builded GTK+3 dlls under the directory rakudo\bin and replaced some text in Simple.pm6 with Notepad.
'libgtk-3.so.0' -> 'libgtk-3-0.dll'
'libgobject-2.0.so' -> 'libgobject-2.0-0.dll'
One exception is
rakudo should look for sub g_idle_add in 'libglib-2.0-0.dll' under Win32.
I hope you guys can add Win32 support to this module :) .
I am just started learning Perl 6, so my coding skill might not be enough to write patch to this module, so I wouldn't sent pull request. Just for your information.
This would let the snake-case stuff stay in a pre-1.0 version (or something else though 1.0 would follow semantic versioning)
On OSX using GTK 3.16.4_1 I get the following output when using GTK::Simple with the built in examples.
2015-07-02 12:10:34.731 moar[99714:662363] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
When the "Hello World!" button is clicked it becomes inactive and the "Goodbye!" button becomes active. When the "Goodbye!" button is clicked. Exploring a bit deeper it appears that $second.clicked.tap()
code is never executed, instead the $button.clicked.tap()
code is run whenever either button is clicked.
diff --git a/examples/01_hello_world.pm6 b/examples/01_hello_world.pm6
index 8e9493a..548bc54 100644
--- a/examples/01_hello_world.pm6
+++ b/examples/01_hello_world.pm6
@@ -41,7 +41,7 @@ $app.border_width = 20;
=comment
Using the sensitive property we can make a button unclickable.
-$second.sensitive = False;
+#$second.sensitive = False;
=begin comment
@@ -53,13 +53,13 @@ $second.sensitive = False;
just C<.sensitive = 0>. The C<$second> button can then be activated.
=end comment
-$button.clicked.tap({ .sensitive = False; $second.sensitive = True });
+$button.clicked.tap({ .sensitive = False; $second.sensitive = True; say "first button tap"; });
=comment
Clicking the second button shall C<exit> the application's main loop.
-$second.clicked.tap({ $app.exit; });
+$second.clicked.tap({ say "second button tap"; $app.exit; });
=comment
With these changes, the "Goodbye!" button is active, yet when clicked I see 'first button tap' output and "Hello World!" button disabled.
I've tried with JVM/Moar backends on Rakudo Star 2014.04 and Rakudo (not Star) 2014.05 with the same results.
I assume this example worked at some point in the past. Sadly my Perl6 skills are not yet sufficient to dig much further.
method g-timeout
in GTK::Simple::App (line 53) is incomplete. I have a workaround below.
I successfully used g-timeout to end an app. But the supply cannot be turned off, so it cannot be used again. The problem is in the definition of g-timeout at line 68 in G:S:App.pm. It creates a callback function which always returns 1. In the definition of gtk_timeout_add, the function will always be called until it returns 0. Consequently, the thread is never ended.
eg: in the snippet below the first call to show_text works and lasts 5 seconds. But the second one only lasts some period under a second. The reason is that the supply created is never turned off, even though a specific call to gtk_main_quit is called in the App.exit method. That means that the tap function is not reinstantiated, so the state variable i is not reset. (I think)
use GTK::Simple;
show_text("Here",5); show_text("There",10);
sub show_text( Str $str, $time ) {
my $a = GTK::Simple::App.new();
$a.set-content(my $inf = GTK::Simple::Label.new(:text($str)));
my $sup = $a.g-timeout(1000);
$sup.tap( {
state $i = $time-1;
$inf.text = $str ~ $i;
$a.exit if ($i <= 0);
$i--;
} );
$a.run;
}
I have a work around by creating a global $continue and replacing the return value with $continue, that is copying the method into my program and making it a sub.
my $continue;
=comment
code as before to
my $sup = g-timeout(1000);
$sup.tap( {
state $i = $time-1;
$inf.text = $str ~ $i;
if ($i <= 0) { $a.exit ; $continue = 0; }
$i--;
} );
...
}
use nqp;
use NativeCall;
use GTK::Simple::Raw :DEFAULT;
sub g-timeout(Cool $usecs) {
my $s = Supplier.new;
my $starttime = nqp::time_n();
my $lasttime = nqp::time_n();
g_timeout_add($usecs.Int,
sub (*@) {
my $dt = nqp::time_n() - $lasttime;
$lasttime = nqp::time_n();
$s.emit((nqp::time_n() - $starttime, $dt));
return $continue;
}, OpaquePointer);
return $s.Supply;
}
However, I didn't want to hack the GTK::Simple::App code since I thought you might have a better way of doing this. For example, coding it into a done
method on the Supplier. But I don't quite know enough about Suppliers.
Dear gtk-simple:
Request for Enhancement (RFE):
Would you please consider an example of a fill in form: city, state, zip, etc. where you fill in the data or just accept the defaults, then press okay or cancel.
Many thanks,
-T
Most of the examples (both in the examples directory, and the quick start example in the readme docs) fail to run with the latest rakudobrew installation with the error "GTK::Simple::App is not declared." Adding a "use GTK::Simple::App" in the script resolves the error. This is true for examples 01-08 and 17.
On a related note of examples failing:
The Cairo documentation is sparse and there is no example for the use of DrawingArea.
Also the following error is puzzling:
$perl6 test_lib.p6
Could not find symbol '&ConnectionHandler'
in method add-draw-handler at /home/richard/perl6/rakudo-star-2016.07/install/share/perl6/site/sources/A6D434FC7BEE2A422FB2B8F6CF413E78905D1848 (GTK::Simple::DrawingArea) line 33
in block at test_lib.p6 line 20
Actually thrown at:
in method add-draw-handler at /home/richard/perl6/rakudo-star-2016.07/install/share/perl6/site/sources/A6D434FC7BEE2A422FB2B8F6CF413E78905D1848 (GTK::Simple::DrawingArea) line 33
in block at test_lib.p6 line 20
$ cat test_lib.p6
#!/usr/bin/env perl6
use v6.c;
use GTK::Simple;
use Cairo;
use GTK::Simple::DrawingArea;
my $app = GTK::Simple::App.new(:title);
my $da = GTK::Simple::DrawingArea.new;
gtk_simple_use_cairo;
$app.set-content( $da );
$app.border-width = 20;
$da.size-request(300,300);
my $ctx = $da.add-draw-handler( &rect-do );
$app.run;
sub rect-do( $d, $ctx ) {
given $ctx {
.rgb(0, 0.7, 0.9);
.rectangle(10, 10, 50, 50);
.fill :preserve; .rgb(1, 1, 1);
.stroke
};
}
==> GTK::Simple depends on LWP::Simple
URI provides the requested URI::Escape
==> LWP::Simple depends on MIME::Base64
==> Fetching MIME::Base64
==> Building MIME::Base64
==> Testing MIME::Base64
This type does not support elems
in any at gen/moar/m-Metamodel.nqp line 1723
in method decode at /path/to/.panda-work/1457223946_1/lib/MIME/Base64/Perl.pm6 line 103
in method decode-str at /path/to/.panda-work/1457223946_1/lib/MIME/Base64.pm6 line 10
in method decode_base64 at /path/to/.panda-work/1457223946_1/lib/MIME/Base64.pm6 line 19
in block <unit> at t/basic.t line 14
# Looks like you planned 18 tests, but ran 1
t/basic.t .................
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 17/18 subtests
t/binary-and-long-line.t .. ok
t/oneline.t ............... ok
This type does not support elems
in any at gen/moar/m-Metamodel.nqp line 1723
in method decode at /path/to/.panda-work/1457223946_1/lib/MIME/Base64/Perl.pm6 line 103
in method decode-str at /path/to/.panda-work/1457223946_1/lib/MIME/Base64.pm6 line 10
in block <unit> at t/rfc4648-test-vector.t line 23
# Looks like you planned 16 tests, but ran 7
t/rfc4648-test-vector.t ...
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 9/16 subtests
Test Summary Report
-------------------
t/basic.t (Wstat: 65280 Tests: 1 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 18 tests but ran 1.
t/rfc4648-test-vector.t (Wstat: 65280 Tests: 7 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 16 tests but ran 7.
Files=4, Tests=21, 4 wallclock secs ( 0.02 usr 0.00 sys + 3.39 cusr 0.20 csys = 3.61 CPU)
Result: FAIL
The spawned process exited unsuccessfully (exit code: 1)
in sub run-and-gather-output at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/DAD29535955E677E319FDF0ACA9A926766180A75 line 85
in block at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/1DCE07CA986A927E98F9EEDC8B5DF87C995E3619 line 22
in sub indir at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/DAD29535955E677E319FDF0ACA9A926766180A75 line 20
in method test at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/1DCE07CA986A927E98F9EEDC8B5DF87C995E3619 line 5
in method install at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/5538417AF9CC9DF68B79F613F1F4897C2AEC2F05 line 156
in block at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/5538417AF9CC9DF68B79F613F1F4897C2AEC2F05 line 229
in method resolve at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/5538417AF9CC9DF68B79F613F1F4897C2AEC2F05 line 223
in sub MAIN at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/resources/76CD539C815A33F2891D2EF3D6D96B1081567AD1 line 18
in block <unit> at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/resources/76CD539C815A33F2891D2EF3D6D96B1081567AD1 line 150
I tried prove -r -e "perl6 -Ilib" t
and got
t/01_sanity.t .. 1/3
# Failed test at t/01_sanity.t line 6
# Cannot locate native library 'libgtk-3.dylib': dlopen(libgtk-3.dylib, 1): image not found
# Failed test at t/01_sanity.t line 8
# Method 'run' not found for invocant of class 'Any'
# Looks like you failed 2 tests of 3
t/01_sanity.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/3 subtests
Test Summary Report
-------------------
t/01_sanity.t (Wstat: 512 Tests: 3 Failed: 2)
Failed tests: 1, 3
Non-zero exit status: 2
Files=1, Tests=3, 9 wallclock secs ( 0.03 usr 0.00 sys + 8.77 cusr 0.25 csys = 9.05 CPU)
Result: FAIL
If a window title contains one or more forward slashes, only the text after the final one is displayed.
use GTK::Simple;
my GTK::Simple::App $app .= new(title => 'a/s/l/1/2');
$app.run;
has a title of "2".
my GTK::Simple::App $app .= new(title => 'Enable / Disable');
has ' Disable'
see http://rosettacode.org/wiki/GUI_enabling/disabling_of_controls#Perl_6
In Widget.pm6
Line 114:
method hide() {
gtk_widget_show($!gtk_widget);
}
should probably be
method hide() {
gtk_widget_hide($!gtk_widget);
}
I'm seeing this in Build.pm
, which I think will try to copy bundled DLLs on Windows? There are no DLL files in the repo though.
===> Searching for: GTK::Simple
===> Building: GTK::Simple:ver<0.1.9>
Malformed UTF-8
in block at C:\Users\mcsla\.zef\store\gtk-simple.git\4707622d9fd1d828b76a241713d99f0ec982c1ef\Build.pm line 62
in block at C:\Users\mcsla\.zef\store\gtk-simple.git\4707622d9fd1d828b76a241713d99f0ec982c1ef\Build.pm line 102
in method build at C:\Users\mcsla\.zef\store\gtk-simple.git\4707622d9fd1d828b76a241713d99f0ec982c1ef\Build.pm line 49
in block <unit> at -e line 1
===> Building [FAIL]: GTK::Simple:ver<0.1.9>
Aborting due to build failure: GTK::Simple:ver<0.1.9> (use --force-build to override)
in code at C:\rakudo\share\perl6\site\sources\7926F4F3ED4C81AA5DA2A54C8AE1E03D03424CCE (Zef::Client) line 334
in method build at C:\rakudo\share\perl6\site\sources\7926F4F3ED4C81AA5DA2A54C8AE1E03D03424CCE (Zef::Client) line 302
in sub at C:\rakudo\share\perl6\site\sources\7926F4F3ED4C81AA5DA2A54C8AE1E03D03424CCE (Zef::Client) line 523
in method install at C:\rakudo\share\perl6\site\sources\7926F4F3ED4C81AA5DA2A54C8AE1E03D03424CCE (Zef::Client) line 623
in sub MAIN at C:\rakudo\share\perl6\site\sources\E4784A2A0FA00D16808817186E95FE74BEF3FE2D (Zef::CLI) line 152
in block <unit> at C:\rakudo\share\perl6\site\resources\1B245F3871EB7CE9B7F4E3E11FC5912C69500928 line 3
in sub MAIN at C:\rakudo\share\perl6\site\bin\zef line 2
in block <unit> at C:\rakudo\share\perl6\site\bin\zef line 2
The module is not installing correctly. I'm running on Windows 10. I even tried both on command prompt and PowerShell.
Spotted this problem on reddit thread
Install fails on Win8:
C:\rakudo\bin>zef install Gtk::Simple
===> Searching for: Gtk::Simple
===> Building: GTK::Simple:ver<0.1.5>
At line:1 char:192
+ ... )) -replace \"-\",\"\" } get-sha256 C:\Users\bit\.zef\store\gtk-simple.git\df15c ...
+ ~
You must provide a value expression following the '-' operator.
At line:1 char:192
+ "function get-sha256 { param($file);[system.bitconverter]::tostring([System.Secu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '\",\"\" } get-sha256 C:\Users\bit\.zef\store\gtk-simple.git\df15c903afdeb207a7115e8a0ff709f783559d05\resources\blib\lib\GTK\libatk-1.0-0.dll"' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
Effective index out of range. Is: -1, should be in 0..^Inf
in block at C:\Users\bit\.zef\store\gtk-simple.git\df15c903afdeb207a7115e8a0ff709f783559d05\Build.pm line 55
in method build at C:\Users\bit\.zef\store\gtk-simple.git\df15c903afdeb207a7115e8a0ff709f783559d05\Build.pm line 49
in block <unit> at -e line 1
Actually thrown at:
in block at C:\Users\bit\.zef\store\gtk-simple.git\df15c903afdeb207a7115e8a0ff709f783559d05\Build.pm line 92
in method build at C:\Users\bit\.zef\store\gtk-simple.git\df15c903afdeb207a7115e8a0ff709f783559d05\Build.pm line 49
in block <unit> at -e line 1
===> Building [OK] for GTK::Simple:ver<0.1.5>
===> Testing: GTK::Simple:ver<0.1.5>
# Failed test at t\01-sanity.t line 12
# Failed to copy 'C:\Users\bit\.zef\store\gtk-simple.git\df15c903afdeb207a7115e8a0ff709f783559d05\resources\blib\lib\GTK\libgtk-3-0.dll' to 'C:\Users\bit\AppData\Local\Temp\libgtk-3-0.dll': Failed to copy file: no such file or directory
# Failed test at t\01-sanity.t line 13
# Failed to copy 'C:\Users\bit\.zef\store\gtk-simple.git\df15c903afdeb207a7115e8a0ff709f783559d05\resources\blib\lib\GTK\libglib-2.0-0.dll' to 'C:\Users\bit\AppData\Local\Temp\libglib-2.0-0.dll': Failed to copy file: no such file or directo
ry
# Failed test at t\01-sanity.t line 14
# No such method 'run' for invocant of type 'Any'
# Looks like you failed 3 tests of 3
===> Testing [FAIL]: GTK::Simple:ver<0.1.5>
Aborting due to test failure: GTK::Simple:ver<0.1.5> (use --force-test to override)
in code at C:\rakudo\share\perl6\site\sources\9062A39D0256C0BD797016C3FE93D839191AFE2B (Zef::Client) line 385
in method test at C:\rakudo\share\perl6\site\sources\9062A39D0256C0BD797016C3FE93D839191AFE2B (Zef::Client) line 363
in code at C:\rakudo\share\perl6\site\sources\9062A39D0256C0BD797016C3FE93D839191AFE2B (Zef::Client) line 540
in sub at C:\rakudo\share\perl6\site\sources\9062A39D0256C0BD797016C3FE93D839191AFE2B (Zef::Client) line 537
in method install at C:\rakudo\share\perl6\site\sources\9062A39D0256C0BD797016C3FE93D839191AFE2B (Zef::Client) line 643
in sub MAIN at C:\rakudo\share\perl6\site\sources\9E04C517E18C976DC9F459E2CE31A87142034020 (Zef::CLI) line 152
in block <unit> at C:\rakudo\share\perl6\site\resources\3DCC2E58BBBF1E42EA4C8C976F9BE97162B9EFA2 line 3
in sub MAIN at C:\rakudo\share\perl6\site\bin\zef line 2
in block <unit> at C:\rakudo\share\perl6\site\bin\zef line 2
I tried to repro on my own Win10, but it failed even earlier when trying to install OpenSSL
panda install GTK::Simple
==> Fetching GTK::Simple
==> Building GTK::Simple
Found system gtk library.
==> Testing GTK::Simple
t/01_sanity.t ..
Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/3 subtests
t/01_sanity.t (Wstat: 768 Tests: 3 Failed: 3)
Failed tests: 1-3
Non-zero exit status: 3
Files=1, Tests=3, 152 wallclock secs ( 0.04 usr 0.00 sys + 43.26 cusr 1.23 csys = 44.53 CPU)
Result: FAIL
The spawned process exited unsuccessfully (exit code: 1)
in sub run-and-gather-output at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/BC95C1F03FD26FCC92CB72CD826C4739353C6CA6:85
in block at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/FC684EC9B9C25726CC880847EFF9969D1A73521D:22
in sub indir at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/BC95C1F03FD26FCC92CB72CD826C4739353C6CA6:20
in method test at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/FC684EC9B9C25726CC880847EFF9969D1A73521D:5
in method install at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/BA0F30DD085F36D1DDB7AB73A230AF22CC30C87B:141
in method resolve at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/BA0F30DD085F36D1DDB7AB73A230AF22CC30C87B:219
in sub MAIN at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/resources/41715A941E28E09D8BF7F4B447720F8C0E01F976:18
in block at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/resources/41715A941E28E09D8BF7F4B447720F8C0E01F976:150
// so I try to locate the missing library:
locate libgtk-3.so
/usr/lib/i386-linux-gnu/libgtk-3.so
/usr/lib/i386-linux-gnu/libgtk-3.so.0
/usr/lib/i386-linux-gnu/libgtk-3.so.0.1600.7
it's there why doesn't GTK::Simple find it should I symlink it some where??
The design decision to make the gtk widget properties r/w accessors using Proxy is sound, however it results in a lot of very similar boilerplate which at best makes implementing all the properties rather tedious, but is also a maintenance and testing issue.
I'd like to re-implement the properties with a trait such as gtk-property
which provides the implementation of the properties in a very similar way to AccessorFacade does (just adjusted to take into account the structure of the widget classes.)
I'd say this was relatively high priority as it would be better to do before implementing too many more properties and/or widgets.
I was wondering if anyone who's worked on this module has much knowledge of GIR/GObject Introspection and how easy/hard it might be to wire it up to NativeCall in a similar way to GPTrixie?
I'm mostly asking because Apache Arrow is also another project using GObject to define all of the low level memory map of its data structures. I was thinking about making a DataFrame type library for Perl 6 to go in the Stats module, and noticed there is a bit of a push towards dealing with a unified memory model for interop. Could bind the C implementation directly but there is a short cut via GObject Introspection that the Ruby binding uses that might be worth doing instead. Especially if its also useful for creating a more complete GTK+ binding at the same time?
Does anyone have any input on the feasibility of this? Or know anything about GIR/GObject Introspection already?
It would be nice to be able to loop over components in a container and an app, so that we could access their properties and work with them. I think that's possible in the base library, although not totally sure.
https://github.com/raku-community-modules/gtk-simple/blob/master/examples/07-text.pl6
Request for Enhancement (RFE):
Would you please consider showing (say) the returned text in the above example?
Many thanks,
-T
Parts of the public interface are using snake_case
while I have been adding the new stuff with kebab-case
, obviously consistency would be better and I think that the consensus has largely converged on using kebab-case
in new code.
Obviously this would be an in-compatible change so there would need to be a short deprecation cycle (though as it currently stands the module isn't properly versioned so this in itself is somewhat problematic,)
I'll leave this for discussion for a bit before I do anything.
It would be useful to implementing parts of the API and necessary to move GtkBuilder forward if a constructor candidate was available which took the raw GtkWidget object.
It would be nice if this could happen without adding it to each widget class.
The HBox and VBox widgets have been deprecated since Gtk+ 3.2 in favour of using a plain Box with the appropriate orientation property. (It is also hinted that Box itself may be deprecated in the future.)
In order to maintain backward compatibility, the HBox and VBox should probably re-implemented in terms of the box constructor.
I'll implement if no-one else does it first.
I'm trying to run example 18, the Cairo Draw Handler, from the GTK::Simple module on Ubuntu 18.04 using Rakudo Star version 2018.06 built on MoarVM version 2018.06 implementing Perl 6.c.
I get the following error message.
MoarVM panic: Internal error: Unwound entire stack and missed handler
Request for Enhancement:
Over on https://github.com/perl6/gtk-simple/tree/master/examples, would you please consider adding an example of a dismissable text box to include text dynamically added with vertical and horizontal scroll bars as the text grows/gets bigger than the window?
Many thanks,
-T
Trying to build/test GTK::Simple on Windows 7 x64 fails, presumably due to NativeLib.pm6 using @*INC
:
PS C:\Users\jgrabber.INT> zef install GTK::Simpler
===> Searching for: GTK::Simpler
===> Searching for missing dependencies: GTK::Simple
===> Fetching: GTK::Simpler
===> Fetching: GTK::Simple
===> Building: GTK::Simple:ver('0.1.4')
===> Building [OK] for GTK::Simple:ver('0.1.4')
===> Testing: GTK::Simple:ver('0.1.4')
# Failed test at t\01-sanity.t line 10
# Dynamic variable @*INC not found
# Failed test at t\01-sanity.t line 11
# Dynamic variable @*INC not found
# Failed test at t\01-sanity.t line 12
# Method 'run' not found for invocant of class 'Any'
# Looks like you failed 3 tests of 3
===> Testing [FAIL]: GTK::Simple:ver('0.1.4')
Aborting due to test failure: GTK::Simple:ver('0.1.4') (use --force to override)
in code at C:\rakudo\share\perl6\site\sources\1DC0BAA246D0774E7EB4F5119C6168E
0D8266EFA (Zef::Client) line 290
in method test at C:\rakudo\share\perl6\site\sources\1DC0BAA246D0774E7EB4F5119
C6168E0D8266EFA (Zef::Client) line 269
in code at C:\rakudo\share\perl6\site\sources\1DC0BAA246D0774E7EB4F5119C6168E
0D8266EFA (Zef::Client) line 440
in sub at C:\rakudo\share\perl6\site\sources\1DC0BAA246D0774E7EB4F5119C6168E0
D8266EFA (Zef::Client) line 437
in method install at C:\rakudo\share\perl6\site\sources\1DC0BAA246D0774E7EB4F5
119C6168E0D8266EFA (Zef::Client) line 532
in sub MAIN at C:\rakudo\share\perl6\site\sources\A9948E7371E0EB9AFDF1EEEB07B5
2A1B75537C31 (Zef::CLI) line 118
in block <unit> at C:\rakudo\share\perl6\site\resources\1BB781E6A0355D520C9B0E
40400A3186CFE69967 line 1
@*INC
is mentioned and used here .
Also see a similiar problem on stackoverflow here.
I need a scrolled window as too much data is flooding a textview.
gtk documentation puts a textview into a scrolled window.
So we need a scrolled window widget. Which I am working on for myself.
However, it seems to me that rather than creating a scrolled window, and then putting each widget that needs scrolling into it, it would be more natural in perl6 for a role / trait, eg.,
my $label = GTK::Simple::Label.new(text=>'something') :scrolled;
or maybe
$label does GTK::Simple::Scrolled;
However, I'm not confident about how to do this consistently, or if this is the right syntax or approach.
I reinstalled perl6 from scratch, but still panda could not install. See below
Rakudo Star has been built and installed successfully.
Please make sure that the following directories are in PATH:
/home/richard/perl6/rakudo-star-2016.04/install/bin
/home/richard/perl6/rakudo-star-2016.04/install/share/perl6/site/bin
richard@ged:~/perl6/rakudo-star-2016.04$ perl6
To exit type 'exit' or '^D'
richard@ged:~/perl6/rakudo-star-2016.04$ panda install GTK::Simple
==> Fetching GTK::Simple
==> Building GTK::Simple
Found system gtk library.
==> Testing GTK::Simple
t/01-sanity.t .. ok
All tests successful.
Files=1, Tests=3, 45 wallclock secs ( 0.02 usr 0.00 sys + 42.97 cusr 1.36 csys = 44.35 CPU)
Result: PASS
==> Installing GTK::Simple
===SORRY!===
Could not find GTK::Simple::Common at line 9 in:
/home/richard/perl6/rakudo-star-2016.04
/home/richard/.perl6
/home/richard/perl6/rakudo-star-2016.04/install/share/perl6/site
/home/richard/perl6/rakudo-star-2016.04/install/share/perl6/vendor
/home/richard/perl6/rakudo-star-2016.04/install/share/perl6
CompUnit::Repository::AbsolutePath<79615456>
CompUnit::Repository::NQP<70959264>
CompUnit::Repository::Perl5<70959144>
CompUnit::Repository::AbsolutePath<79615312>
CompUnit::Repository::NQP<70959184>
CompUnit::Repository::Perl5<70959224>
in block at sources/85367160D11E565B2D089507C79BC309215430D6 (Panda::Installer) line 61
in sub indir at sources/24811C576EF8F85E7672B26955C802BB2FC94675 (Panda::Common) line 20
in method install at sources/85367160D11E565B2D089507C79BC309215430D6 (Panda::Installer) line 42
in method install at /home/richard/perl6/rakudo-star-2016.04/install/share/perl6/site/sources/582CB7486602954A4601BDCE5A0EAC54B05DA58A (Panda) line 161
in method resolve at /home/richard/perl6/rakudo-star-2016.04/install/share/perl6/site/sources/582CB7486602954A4601BDCE5A0EAC54B05DA58A (Panda) line 234
in sub MAIN at /home/richard/.bin/panda line 18
in block at /home/richard/.bin/panda line 152
panda install GTK::Simple
==> Fetching GTK::Simple
==> Building GTK::Simple
===SORRY!=== Error while compiling /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/364074153E7AD72F9C60425645AC9871DF10C969
Malformed parameter
at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/364074153E7AD72F9C60425645AC9871DF10C969:207
------> RequestType $rt, $host, $port⏏ as Int, $path, %headers, $content?, :$s
expecting any of:
constraint
===SORRY!=== Error while compiling /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/364074153E7AD72F9C60425645AC9871DF10C969
Malformed parameter
at /home/grizzlysmit/.rakudobrew/moar-nom/install/share/perl6/site/sources/364074153E7AD72F9C60425645AC9871DF10C969:207
------> RequestType $rt, $host, $port⏏ as Int, $path, %headers, $content?, :$s
expecting any of:
constraint
panda install GTK::Simple
==> Fetching GTK::Simple
==> Building GTK::Simple
==> Testing GTK::Simple
===SORRY!=== Error while compiling /home/grizzlysmit/.panda-work/1455681681_1/Build.pm
Redeclaration of symbol Build
at /home/grizzlysmit/.panda-work/1455681681_1/Build.pm:10
Add "tags" : ["gui"],
since Github Actions now available to all open source projects, and highly integrated with Github, also offers Windows and self hosted build as options...I think we can start replacing appveyor and travis ci with github actions CI instead of using two
'Nuff said. There's none. We need some.
GTK::Simple
programs take a while to start up:
~ $ time perl6 -e 'use GTK::Simple'
real 0m10.283s
user 0m10.000s
sys 0m0.108s
Any suggestions for making that faster? :-)
The failure seems to have started after my latest additions were committed by Jonathan, but the failure logs point to the TextView widget (I think), and do not seem to be related to my changes.
Also the failure reported on the Perl6 users list is during the Build process on Windows. I run Ubuntu, and I didn't have a problem building the latest version.
I'd like to help resolve this, but I don't actually know where to start.
I am having trouble adding a 'Pane' widget.
I have added all the functions referred to the GTK3 manual page to raw. However, when I run a minimal app, I get a blank window. (The current code of example 18 in my repo is minimal. As you will see I have commented out all of the extra code to show different code). Also, I have simplified the BUILD submethod in Raw.pm6 to try to identify the problem.
GTK gives the initialisation routine as gtk_paned_new( orientation ). 'orientation' is an enumeration with two elements, GTK_ORIENTATION_HORIZONTAL and GTK_ORIENTATION_VERTICAL
I assumed the actual values are 0 and 1, but I can't actually find the .h file that defines them in the gtk sources.
The code is in finanalyst/gtk-simple. I have not done a push request because the example file is not running correctly yet.
I'm willing to keep working at this, but I have run out of ideas as to how to get this to work. I have Googled GTK Paned, but there does not seem to be any link about a problem or any special code needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.