Re: Tutorial perl-Gtk3 and Windows/MSys

2021-07-20 Thread Mike Martin via gtk-perl-list
Well I've now managed to install Gtk3 (I think) after doing a fresh install
of mingw64.
However the only way to do it was to  run cpanm as
cpanm -n -v Gtk3 (ie:no tests)
otherwise Glib fails on test  12 ie:

#   Failed test 'default log handler: install undef, prev default'
#   at t/a.t line 92.
#  got: undef
# expected: 'CODE(0x20a7dea97b0)'


On Mon, 19 Jul 2021 at 14:25, Mike Martin  wrote:

> Further info (gcc wasnt installed)
>
> "C:\msys64\mingw64\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty --
> Glib.bs blib\arch\auto\Glib\Glib.bs 644
> loaded
> loaded
>
> [ CC Glib.c ]
> In file included from
> C:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw.h:283,
>  from
> C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:10,
>  from
> C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
>  from
> C:/msys64/mingw64/x86_64-w64-mingw32/include/sys/types.h:13,
>  from
> C:\msys64\mingw64\lib\perl5\core_perl\CORE/perl.h:822,
>  from gperl.h:26,
>  from Glib.xs:22:
> C:/msys64/mingw64/x86_64-w64-mingw32/include/vadefs.h:14:9: error:
> expected '=', ',', ';', 'asm' or '__attribute__' before '#pragma'
>14 | #pragma pack(push,_CRT_PACKING)
>   | ^~~~
> mingw32-make: *** [Makefile:452: Glib.o] Error 1
>
> On Mon, 19 Jul 2021 at 12:36, Mike Martin  wrote:
>
>> Thanks for this.
>> I am sill getting an issue, it seems to be an oddity with paths
>>
>> from cpanm build.log
>>
>> [ CC Glib.c ]
>> process_begin: CreateProcess(NULL, gcc -c -I. -mms-bitfields
>> -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/glib-2.0
>> -IC:/msys64/mingw64/lib/glib-2.0/include -pthread -DWIN32 -DWIN64
>> -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
>> -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fno-strict-aliasing -mms-bitfields
>> -s -O2 -DVERSION=\"1.3293\" -DXS_VERSION=\"1.3293\" -o Glib.o
>> -IC:\msys64\mingw64\lib\perl5\core_perl\CORE Glib.c, ...) failed.
>> make (e=2): The system cannot find the file specified.
>>
>> mingw32-make: *** [Makefile:452: Glib.o] Error 2
>> -> FAIL Installing Glib failed. See
>> C:\msys64\home\mike\.cpanm\work\1626621339.5476\build.log for details.
>> Retry with --force to force install it.
>>
>> On Sat, 17 Jul 2021 at 19:02, Zakariyya Mughal 
>> wrote:
>>
>>> On 2021-07-17 at 15:19:25 +0100, Mike Martin via gtk-perl-list wrote:
>>> > Hi I am struggling with this, been trying to install on mingw64 for a
>>> week.
>>> >
>>> > Anyone had any joy recently?
>>> > various issues tried compiling one by one and glib fails with symbols
>>> error
>>> > (using cpanm)
>>>
>>> Hi,
>>>
>>> I've been working on a repository that takes all the work needed to
>>> install Gtk3 on different platforms and put it into one repository (I'm
>>> also working on making .dmg and .msi installers --- these work but have
>>> a couple cases I need to address):
>>>
>>> <https://github.com/orbital-transfer-example/perl-gtk3-starter-basic>
>>>
>>> The file you'll want to use for MSYS2/MINGW is
>>> <
>>> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/maint/EUMMnosearch.pm
>>> >.
>>>
>>> and what you want to do is add it to be loaded automatically via the
>>> PERL5OPT environment variable
>>>
>>> export PERL5OPT="-Ipath/to/perl-gtk3-starter-basic/maint
>>> -MEUMMnosearch"
>>> cpanm Gtk3
>>>
>>> What this module file does is detect when it being run under an
>>> ExtUtils::MakeMaker installation and then run some hacks around the
>>> arguments and build so that EU::MM knows where to find libraries and
>>> generates a file that allows one XS module to link with another (the
>>> comments in EUMMnosearch.pm explain what I'm doing).
>>>
>>> Ideally this would be fixed upstream in ExtUtils::MakeMaker, but I have
>>> not had time to see what I can do.
>>>
>>> Hope that helps.
>>>
>>> Cheers,
>>> - Zaki Mughal
>>>
>>> P.S. The helper.pl script in there also handles the same thing in a
>>> self-contained way. See the commands listed under the "run:" keys in
>>> <
>>> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/.github/workflows/msys2-mingw.yml
>>> >
>>> for how t

Re: Tutorial perl-Gtk3 and Windows/MSys

2021-07-19 Thread Mike Martin
Thanks for this.
I am sill getting an issue, it seems to be an oddity with paths

from cpanm build.log

[ CC Glib.c ]
process_begin: CreateProcess(NULL, gcc -c -I. -mms-bitfields
-IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/glib-2.0
-IC:/msys64/mingw64/lib/glib-2.0/include -pthread -DWIN32 -DWIN64
-DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fno-strict-aliasing -mms-bitfields
-s -O2 -DVERSION=\"1.3293\" -DXS_VERSION=\"1.3293\" -o Glib.o
-IC:\msys64\mingw64\lib\perl5\core_perl\CORE Glib.c, ...) failed.
make (e=2): The system cannot find the file specified.

mingw32-make: *** [Makefile:452: Glib.o] Error 2
-> FAIL Installing Glib failed. See
C:\msys64\home\mike\.cpanm\work\1626621339.5476\build.log for details.
Retry with --force to force install it.

On Sat, 17 Jul 2021 at 19:02, Zakariyya Mughal 
wrote:

> On 2021-07-17 at 15:19:25 +0100, Mike Martin via gtk-perl-list wrote:
> > Hi I am struggling with this, been trying to install on mingw64 for a
> week.
> >
> > Anyone had any joy recently?
> > various issues tried compiling one by one and glib fails with symbols
> error
> > (using cpanm)
>
> Hi,
>
> I've been working on a repository that takes all the work needed to
> install Gtk3 on different platforms and put it into one repository (I'm
> also working on making .dmg and .msi installers --- these work but have
> a couple cases I need to address):
>
> <https://github.com/orbital-transfer-example/perl-gtk3-starter-basic>
>
> The file you'll want to use for MSYS2/MINGW is
> <
> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/maint/EUMMnosearch.pm
> >.
>
> and what you want to do is add it to be loaded automatically via the
> PERL5OPT environment variable
>
> export PERL5OPT="-Ipath/to/perl-gtk3-starter-basic/maint
> -MEUMMnosearch"
> cpanm Gtk3
>
> What this module file does is detect when it being run under an
> ExtUtils::MakeMaker installation and then run some hacks around the
> arguments and build so that EU::MM knows where to find libraries and
> generates a file that allows one XS module to link with another (the
> comments in EUMMnosearch.pm explain what I'm doing).
>
> Ideally this would be fixed upstream in ExtUtils::MakeMaker, but I have
> not had time to see what I can do.
>
> Hope that helps.
>
> Cheers,
> - Zaki Mughal
>
> P.S. The helper.pl script in there also handles the same thing in a
> self-contained way. See the commands listed under the "run:" keys in
> <
> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/.github/workflows/msys2-mingw.yml
> >
> for how to use that.
>
> >
> > On Thu, 8 Jun 2017 at 12:31,  wrote:
> >
> > > Hello everybody,
> > >
> > > I have created a little tutorial about perl-Gtk3 and Windows/MSys2.
> > > Especially I show there, how to create an installer for your perl-Gtk3
> > > application. Perhaps this little How-To is helpful for some people.
> > >
> > > You can find the files on
> https://github.com/MaxPerl/perl-Gtk3-Tutorial
> > >
> > > see especially:
> > >
> > >
> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows.pdf
> > >
> > >
> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows-de.pdf
> > > (german version)
> > >
> > > Improvement suggesstions are highly welcome!
> > >
> > > Best wishes,
> > > Max
> > > ___
> > > gtk-perl-list mailing list
> > > gtk-perl-list@gnome.org
> > > https://mail.gnome.org/mailman/listinfo/gtk-perl-list
> > >
>
> > ___
> > gtk-perl-list mailing list
> > gtk-perl-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/gtk-perl-list
>
>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Tutorial perl-Gtk3 and Windows/MSys

2021-07-19 Thread Mike Martin
Further info (gcc wasnt installed)

"C:\msys64\mingw64\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty --
Glib.bs blib\arch\auto\Glib\Glib.bs 644
loaded
loaded

[ CC Glib.c ]
In file included from
C:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw.h:283,
 from
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:10,
 from
C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
 from
C:/msys64/mingw64/x86_64-w64-mingw32/include/sys/types.h:13,
 from C:\msys64\mingw64\lib\perl5\core_perl\CORE/perl.h:822,
 from gperl.h:26,
 from Glib.xs:22:
C:/msys64/mingw64/x86_64-w64-mingw32/include/vadefs.h:14:9: error: expected
'=', ',', ';', 'asm' or '__attribute__' before '#pragma'
   14 | #pragma pack(push,_CRT_PACKING)
  | ^~~~
mingw32-make: *** [Makefile:452: Glib.o] Error 1

On Mon, 19 Jul 2021 at 12:36, Mike Martin  wrote:

> Thanks for this.
> I am sill getting an issue, it seems to be an oddity with paths
>
> from cpanm build.log
>
> [ CC Glib.c ]
> process_begin: CreateProcess(NULL, gcc -c -I. -mms-bitfields
> -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/glib-2.0
> -IC:/msys64/mingw64/lib/glib-2.0/include -pthread -DWIN32 -DWIN64
> -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
> -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fno-strict-aliasing -mms-bitfields
> -s -O2 -DVERSION=\"1.3293\" -DXS_VERSION=\"1.3293\" -o Glib.o
> -IC:\msys64\mingw64\lib\perl5\core_perl\CORE Glib.c, ...) failed.
> make (e=2): The system cannot find the file specified.
>
> mingw32-make: *** [Makefile:452: Glib.o] Error 2
> -> FAIL Installing Glib failed. See
> C:\msys64\home\mike\.cpanm\work\1626621339.5476\build.log for details.
> Retry with --force to force install it.
>
> On Sat, 17 Jul 2021 at 19:02, Zakariyya Mughal 
> wrote:
>
>> On 2021-07-17 at 15:19:25 +0100, Mike Martin via gtk-perl-list wrote:
>> > Hi I am struggling with this, been trying to install on mingw64 for a
>> week.
>> >
>> > Anyone had any joy recently?
>> > various issues tried compiling one by one and glib fails with symbols
>> error
>> > (using cpanm)
>>
>> Hi,
>>
>> I've been working on a repository that takes all the work needed to
>> install Gtk3 on different platforms and put it into one repository (I'm
>> also working on making .dmg and .msi installers --- these work but have
>> a couple cases I need to address):
>>
>> <https://github.com/orbital-transfer-example/perl-gtk3-starter-basic>
>>
>> The file you'll want to use for MSYS2/MINGW is
>> <
>> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/maint/EUMMnosearch.pm
>> >.
>>
>> and what you want to do is add it to be loaded automatically via the
>> PERL5OPT environment variable
>>
>> export PERL5OPT="-Ipath/to/perl-gtk3-starter-basic/maint
>> -MEUMMnosearch"
>> cpanm Gtk3
>>
>> What this module file does is detect when it being run under an
>> ExtUtils::MakeMaker installation and then run some hacks around the
>> arguments and build so that EU::MM knows where to find libraries and
>> generates a file that allows one XS module to link with another (the
>> comments in EUMMnosearch.pm explain what I'm doing).
>>
>> Ideally this would be fixed upstream in ExtUtils::MakeMaker, but I have
>> not had time to see what I can do.
>>
>> Hope that helps.
>>
>> Cheers,
>> - Zaki Mughal
>>
>> P.S. The helper.pl script in there also handles the same thing in a
>> self-contained way. See the commands listed under the "run:" keys in
>> <
>> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/.github/workflows/msys2-mingw.yml
>> >
>> for how to use that.
>>
>> >
>> > On Thu, 8 Jun 2017 at 12:31,  wrote:
>> >
>> > > Hello everybody,
>> > >
>> > > I have created a little tutorial about perl-Gtk3 and Windows/MSys2.
>> > > Especially I show there, how to create an installer for your perl-Gtk3
>> > > application. Perhaps this little How-To is helpful for some people.
>> > >
>> > > You can find the files on
>> https://github.com/MaxPerl/perl-Gtk3-Tutorial
>> > >
>> > > see especially:
>> > >
>> > >
>> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows.pdf
>> > >
>> > >
>> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows-de.pdf
>> > > (german version)
>> > >
>> > > Improvement suggesstions are highly welcome!
>> > >
>> > > Best wishes,
>> > > Max
>> > > ___
>> > > gtk-perl-list mailing list
>> > > gtk-perl-list@gnome.org
>> > > https://mail.gnome.org/mailman/listinfo/gtk-perl-list
>> > >
>>
>> > ___
>> > gtk-perl-list mailing list
>> > gtk-perl-list@gnome.org
>> > https://mail.gnome.org/mailman/listinfo/gtk-perl-list
>>
>>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Tutorial perl-Gtk3 and Windows/MSys

2021-07-19 Thread Mike Martin via gtk-perl-list
Further info (gcc wasnt installed)

"C:\msys64\mingw64\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty --
Glib.bs blib\arch\auto\Glib\Glib.bs 644
loaded
loaded

[ CC Glib.c ]
In file included from
C:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw.h:283,
 from
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:10,
 from
C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
 from
C:/msys64/mingw64/x86_64-w64-mingw32/include/sys/types.h:13,
 from C:\msys64\mingw64\lib\perl5\core_perl\CORE/perl.h:822,
 from gperl.h:26,
 from Glib.xs:22:
C:/msys64/mingw64/x86_64-w64-mingw32/include/vadefs.h:14:9: error: expected
'=', ',', ';', 'asm' or '__attribute__' before '#pragma'
   14 | #pragma pack(push,_CRT_PACKING)
  | ^~~~
mingw32-make: *** [Makefile:452: Glib.o] Error 1

On Mon, 19 Jul 2021 at 12:36, Mike Martin  wrote:

> Thanks for this.
> I am sill getting an issue, it seems to be an oddity with paths
>
> from cpanm build.log
>
> [ CC Glib.c ]
> process_begin: CreateProcess(NULL, gcc -c -I. -mms-bitfields
> -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/glib-2.0
> -IC:/msys64/mingw64/lib/glib-2.0/include -pthread -DWIN32 -DWIN64
> -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
> -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fno-strict-aliasing -mms-bitfields
> -s -O2 -DVERSION=\"1.3293\" -DXS_VERSION=\"1.3293\" -o Glib.o
> -IC:\msys64\mingw64\lib\perl5\core_perl\CORE Glib.c, ...) failed.
> make (e=2): The system cannot find the file specified.
>
> mingw32-make: *** [Makefile:452: Glib.o] Error 2
> -> FAIL Installing Glib failed. See
> C:\msys64\home\mike\.cpanm\work\1626621339.5476\build.log for details.
> Retry with --force to force install it.
>
> On Sat, 17 Jul 2021 at 19:02, Zakariyya Mughal 
> wrote:
>
>> On 2021-07-17 at 15:19:25 +0100, Mike Martin via gtk-perl-list wrote:
>> > Hi I am struggling with this, been trying to install on mingw64 for a
>> week.
>> >
>> > Anyone had any joy recently?
>> > various issues tried compiling one by one and glib fails with symbols
>> error
>> > (using cpanm)
>>
>> Hi,
>>
>> I've been working on a repository that takes all the work needed to
>> install Gtk3 on different platforms and put it into one repository (I'm
>> also working on making .dmg and .msi installers --- these work but have
>> a couple cases I need to address):
>>
>> <https://github.com/orbital-transfer-example/perl-gtk3-starter-basic>
>>
>> The file you'll want to use for MSYS2/MINGW is
>> <
>> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/maint/EUMMnosearch.pm
>> >.
>>
>> and what you want to do is add it to be loaded automatically via the
>> PERL5OPT environment variable
>>
>> export PERL5OPT="-Ipath/to/perl-gtk3-starter-basic/maint
>> -MEUMMnosearch"
>> cpanm Gtk3
>>
>> What this module file does is detect when it being run under an
>> ExtUtils::MakeMaker installation and then run some hacks around the
>> arguments and build so that EU::MM knows where to find libraries and
>> generates a file that allows one XS module to link with another (the
>> comments in EUMMnosearch.pm explain what I'm doing).
>>
>> Ideally this would be fixed upstream in ExtUtils::MakeMaker, but I have
>> not had time to see what I can do.
>>
>> Hope that helps.
>>
>> Cheers,
>> - Zaki Mughal
>>
>> P.S. The helper.pl script in there also handles the same thing in a
>> self-contained way. See the commands listed under the "run:" keys in
>> <
>> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/.github/workflows/msys2-mingw.yml
>> >
>> for how to use that.
>>
>> >
>> > On Thu, 8 Jun 2017 at 12:31,  wrote:
>> >
>> > > Hello everybody,
>> > >
>> > > I have created a little tutorial about perl-Gtk3 and Windows/MSys2.
>> > > Especially I show there, how to create an installer for your perl-Gtk3
>> > > application. Perhaps this little How-To is helpful for some people.
>> > >
>> > > You can find the files on
>> https://github.com/MaxPerl/perl-Gtk3-Tutorial
>> > >
>> > > see especially:
>> > >
>> > >
>> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows.pdf
>> > >
>> > >
>> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows-de.pdf
>> > > (german version)
>> > >
>> > > Improvement suggesstions are highly welcome!
>> > >
>> > > Best wishes,
>> > > Max
>> > > ___
>> > > gtk-perl-list mailing list
>> > > gtk-perl-list@gnome.org
>> > > https://mail.gnome.org/mailman/listinfo/gtk-perl-list
>> > >
>>
>> > ___
>> > gtk-perl-list mailing list
>> > gtk-perl-list@gnome.org
>> > https://mail.gnome.org/mailman/listinfo/gtk-perl-list
>>
>>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Tutorial perl-Gtk3 and Windows/MSys

2021-07-19 Thread Mike Martin via gtk-perl-list
Thanks for this.
I am sill getting an issue, it seems to be an oddity with paths

from cpanm build.log

[ CC Glib.c ]
process_begin: CreateProcess(NULL, gcc -c -I. -mms-bitfields
-IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/glib-2.0
-IC:/msys64/mingw64/lib/glib-2.0/include -pthread -DWIN32 -DWIN64
-DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fno-strict-aliasing -mms-bitfields
-s -O2 -DVERSION=\"1.3293\" -DXS_VERSION=\"1.3293\" -o Glib.o
-IC:\msys64\mingw64\lib\perl5\core_perl\CORE Glib.c, ...) failed.
make (e=2): The system cannot find the file specified.

mingw32-make: *** [Makefile:452: Glib.o] Error 2
-> FAIL Installing Glib failed. See
C:\msys64\home\mike\.cpanm\work\1626621339.5476\build.log for details.
Retry with --force to force install it.

On Sat, 17 Jul 2021 at 19:02, Zakariyya Mughal 
wrote:

> On 2021-07-17 at 15:19:25 +0100, Mike Martin via gtk-perl-list wrote:
> > Hi I am struggling with this, been trying to install on mingw64 for a
> week.
> >
> > Anyone had any joy recently?
> > various issues tried compiling one by one and glib fails with symbols
> error
> > (using cpanm)
>
> Hi,
>
> I've been working on a repository that takes all the work needed to
> install Gtk3 on different platforms and put it into one repository (I'm
> also working on making .dmg and .msi installers --- these work but have
> a couple cases I need to address):
>
> <https://github.com/orbital-transfer-example/perl-gtk3-starter-basic>
>
> The file you'll want to use for MSYS2/MINGW is
> <
> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/maint/EUMMnosearch.pm
> >.
>
> and what you want to do is add it to be loaded automatically via the
> PERL5OPT environment variable
>
> export PERL5OPT="-Ipath/to/perl-gtk3-starter-basic/maint
> -MEUMMnosearch"
> cpanm Gtk3
>
> What this module file does is detect when it being run under an
> ExtUtils::MakeMaker installation and then run some hacks around the
> arguments and build so that EU::MM knows where to find libraries and
> generates a file that allows one XS module to link with another (the
> comments in EUMMnosearch.pm explain what I'm doing).
>
> Ideally this would be fixed upstream in ExtUtils::MakeMaker, but I have
> not had time to see what I can do.
>
> Hope that helps.
>
> Cheers,
> - Zaki Mughal
>
> P.S. The helper.pl script in there also handles the same thing in a
> self-contained way. See the commands listed under the "run:" keys in
> <
> https://github.com/orbital-transfer-example/perl-gtk3-starter-basic/blob/0.002/.github/workflows/msys2-mingw.yml
> >
> for how to use that.
>
> >
> > On Thu, 8 Jun 2017 at 12:31,  wrote:
> >
> > > Hello everybody,
> > >
> > > I have created a little tutorial about perl-Gtk3 and Windows/MSys2.
> > > Especially I show there, how to create an installer for your perl-Gtk3
> > > application. Perhaps this little How-To is helpful for some people.
> > >
> > > You can find the files on
> https://github.com/MaxPerl/perl-Gtk3-Tutorial
> > >
> > > see especially:
> > >
> > >
> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows.pdf
> > >
> > >
> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows-de.pdf
> > > (german version)
> > >
> > > Improvement suggesstions are highly welcome!
> > >
> > > Best wishes,
> > > Max
> > > ___
> > > gtk-perl-list mailing list
> > > gtk-perl-list@gnome.org
> > > https://mail.gnome.org/mailman/listinfo/gtk-perl-list
> > >
>
> > ___
> > gtk-perl-list mailing list
> > gtk-perl-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/gtk-perl-list
>
>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Tutorial perl-Gtk3 and Windows/MSys

2021-07-17 Thread Mike Martin via gtk-perl-list
Hi I am struggling with this, been trying to install on mingw64 for a week.

Anyone had any joy recently?
various issues tried compiling one by one and glib fails with symbols error
(using cpanm)

On Thu, 8 Jun 2017 at 12:31,  wrote:

> Hello everybody,
>
> I have created a little tutorial about perl-Gtk3 and Windows/MSys2.
> Especially I show there, how to create an installer for your perl-Gtk3
> application. Perhaps this little How-To is helpful for some people.
>
> You can find the files on https://github.com/MaxPerl/perl-Gtk3-Tutorial
>
> see especially:
>
> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows.pdf
>
> https://github.com/MaxPerl/perl-Gtk3-Tutorial/blob/master/perl-Gtk3-and-windows-de.pdf
> (german version)
>
> Improvement suggesstions are highly welcome!
>
> Best wishes,
> Max
> ___
> gtk-perl-list mailing list
> gtk-perl-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-perl-list
>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Using Gtk macros

2019-09-06 Thread Mike Martin via gtk-perl-list
How do I use Gtk macros in perl-gtk?
eg in c
GTK_IS_CONTAINER(widget)
What is the corresponding method in perl-gtk
thanks
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Strange issue with cell_data_func and Gtk3::FileSelectionDalog

2019-05-08 Thread Mike Martin via gtk-perl-list
I am getting annoying G_IS_ObJECT warnings when I have a cell_data_function


my $cellfunc1=$widgete{controlview}->get_column(1)->get_cells;
$widgete{controlview}->get_column(1)->set_cell_data_func ($cellfunc1,
sub {
my ($column, $cell, $model, $iter,$cellfunc1) = @_;
my $path=$model->get_path($iter);
my $row= $path->get_indices;
   if ($row==0){
$cell->set_property('has-entry',0);
 }
#return 0
}
);

If I have the line about $cell->set_property('has-entry',0); it the throws
the above warning about gobject

If I change it to 1 it doesnt trigger the warning

(the changed signal opens a file selector dialog and the warning appears
there)

As there appears to be no other way to toggle the 'has-entry' property
(removing it gives an error or is simply ignored anywhere else), is there a
way to mute this

It has no effect on the program, its just annoying
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: G_IS_OBJECT (object)' failed at /usr/share/perl5/vendor_perl/Gtk3.pm line 546 gtk-perl x

2019-04-24 Thread Mike Martin via gtk-perl-list
When I tried running my program from gdb I got an error about program type,
when I attached gdb to a running instance no widgets were responsive

On Wed, 17 Apr 2019 at 14:36, Emmanuele Bassi  wrote:

> On Wed, 17 Apr 2019 at 14:11, Mike Martin via gtk-perl-list <
> gtk-perl-list@gnome.org> wrote:
>
>> I've now got this dreaded message.
>> Is there any way to find out which line is triggering it?
>>
>
> Export `G_DEBUG=fatal-criticals` and then run under GDB to see which part
> of the code is passing an invalid/finalised object around.
>
> Ciao,
>  Emmanuele.
>
> --
> https://www.bassi.io
> [@] ebassi [@gmail.com]
>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


G_IS_OBJECT (object)' failed at /usr/share/perl5/vendor_perl/Gtk3.pm line 546 gtk-perl x

2019-04-17 Thread Mike Martin via gtk-perl-list
 I've now got this dreaded message.
Is there any way to find out which line is triggering it?

thanks

Mike
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Setting background of ToggledButton on pressed

2019-03-13 Thread Mike Martin via gtk-perl-list
After a fairly frustrating day working out how to change the background on
togglebutton when pressed, here is my code, if it helps anyone

my $display = Gtk3::Gdk::Display::get_default ();
my $screen = $d->get_default_screen;
my $provider = Gtk3::CssProvider->new;
$provider->load_from_data ( 'button.toggle#fcopy:checked {color:
blue;background-image: image(yellow);font-weight: bold} entry { color:
blue; background-color: yellow; }');
Gtk3::StyleContext::add_provider_for_screen ($screen, $provider,
Gtk3::STYLE_PROVIDER_PRIORITY_USER);

Notes
button.toggle is the class for for toggledbutton
#fcopy is the name I have given to a button
:checked is the correct action
background-image: image(yellow) is how to set the background,
background-color does not work

Mike
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Treeview sortingis this a bug

2019-03-06 Thread Mike Martin via gtk-perl-list
Apparently , yes this is a bug in gtk upstream
https://gitlab.gnome.org/GNOME/gtk/issues/794

On Tue, 5 Mar 2019 at 23:12, Mike Martin  wrote:

> I am trying to toggle sorting on a liststore, so I am trying to use
>
> $list->get_column(0)->set_sort_column_id(-2)
> where list is a treeview containing a liststore
>
> as per
> GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID
>
> #define GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID (-2)
>
> The GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID can be used to make a
> GtkTreeSortable
> <https://developer.gnome.org/gtk3/stable/GtkTreeSortable.html> use no
> sorting.
>
> referenced on
> https://developer.gnome.org/gtk3/stable/GtkTreeSortable.html#GTK-TREE-SORTABLE-UNSORTED-SORT-COLUMN-ID:CAPS
>
> However I get the error message
>
> gtk_tree_view_column_set_sort_column_id: assertion 'sort_column_id >= -1'
> failed
>
> thanks
>
>
> Mike
>
>
>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Treeview sortingis this a bug

2019-03-05 Thread Mike Martin via gtk-perl-list
I am trying to toggle sorting on a liststore, so I am trying to use

$list->get_column(0)->set_sort_column_id(-2)
where list is a treeview containing a liststore

as per
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID

#define GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID (-2)

The GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID can be used to make a
GtkTreeSortable
 use no
sorting.

referenced on
https://developer.gnome.org/gtk3/stable/GtkTreeSortable.html#GTK-TREE-SORTABLE-UNSORTED-SORT-COLUMN-ID:CAPS

However I get the error message

gtk_tree_view_column_set_sort_column_id: assertion 'sort_column_id >= -1'
failed

thanks


Mike
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Build errors against current Gtk3

2019-02-26 Thread Mike Martin via gtk-perl-list
Trying to build Gtk3-perl and getting the following errors

Test Summary Report
---
t/overrides.t(Wstat: 65280 Tests: 162 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 233 tests but ran 162.
Files=22, Tests=843,  5 wallclock secs ( 0.14 usr  0.04 sys +  4.50 cusr
0.55 csys =  5.23 CPU)
Result: FAIL
Failed 1/22 test programs. 0/843 subtests failed.
make: *** [Makefile:851: test_dynamic] Error 255

ideas
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Issue with iters with cellrenderercombo and sorted columns

2019-02-25 Thread Mike Martin via gtk-perl-list
I have a wierd issue with iters and and a liststore with a combo cellrender
and edited signal.
If I dont sort the column everything is fine the iter points to the right
row.
However if I do sort the iter points to a different row

Code is

setup for column renderers

sub tv_cols {
my ($cols,$list,$liststore)=@_;

foreach my $col (@{$cols}){
my $column;
my $r;
my $id=$col->[0];
if ($col->[1] eq 'text'){
$r=Gtk3::CellRendererText->new;
$r->set( editable => $col->[3] );

$column = Gtk3::TreeViewColumn->new_with_attributes(
$col->[2],$r,'text' => $col->[0]
  );
my $model1=[$liststore,$id];
$r->signal_connect (edited => \_edited, $model1);
}
elsif ($col->[1] eq 'bool') {
$r=Gtk3::CellRendererToggle->new();
$column = Gtk3::TreeViewColumn->new_with_attributes(
$col->[2],$r,'active' => $col->[0]
  );

my @id=($liststore,$col->[0]);
$r->signal_connect('toggled'=>\,\@id);
}
elsif ($col->[1] eq 'combo') {
$r=Gtk3::CellRendererCombo->new();

#$r->set( activatable => 1 );
my $model=Gtk3::ListStore->new('Glib::String');
foreach my $list (@{$col->[4]}){
$model->set($model->append,0,$list);
}
my $model1=[$liststore,$id];
$r->signal_connect (edited => \_edited, $model1);
$r->set(model=>$model,text_column=>0,editable=>$col->[3]);
$column = Gtk3::TreeViewColumn->new_with_attributes(
$col->[2],$r,'text' => $col->[0]
  );
my @id=($liststore,$col->[0]);
}
$list->append_column($column);
}
return 1
}

sub cell_edited {
my ($cell, $path_string, $new_text, $model1) = @_;
my ($model2,$column)=@{$model1};
my $model;
my $path = Gtk3::TreePath->new_from_string ($path_string);
my $iter = $model2->get_iter ($path);
my $iter2;
if ($model2=~/TreeModelFilter/){
$model=$model2->get_model;
$iter2=$model2->convert_iter_to_child_iter($iter);
}
else {
$model=$model2;
 $iter2=$iter
}
my $gvalue = Glib::Object::Introspection::GValueWrapper->new (
'Glib::String', $new_text);
$model->set_value ($iter2, $column, $gvalue);
return 1
}

edited sub-routine

$c->[0]->get_cells->signal_connect('edited'=>sub{
my ($cell, $path_str, $value) = @_;
   my $iter;
$iter=$list->get_model->get_iter_from_string($path_str) ;
my @updfiles;
my @listcols=$list->get_model->get($iter,0,1,5);
@updfiles= ($value,$listcols[1],$listcols[2])
   }
@updfiles contains the wrong rowid (column 5 is a rowid from a database)
The sort is just
$list->get_column(0)->set_sort_column_id (0);
nothing fancy
seems to only affect a cellrenderercombo
I have another column wihich is cellrenderertext which has no issues

Any ideas why this is happening

thanks

Mike
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Strange issue with subroutine being called too late

2019-01-18 Thread Mike Martin via gtk-perl-list
Ignore message, found issue, needed a return value of 0 to the sub-routine

On Fri, 18 Jan 2019 at 10:47, Mike Martin  wrote:

> Hi
> I have a procedure which should be called on error (if a directory doesn't
> exist a window pops up as follows;
>
> foreach my $filesg (keys %{$changes}){
> my
> ($filename,$dirname,$ext)=fileparse($changes->{$filesg}->{newname},qr/\.[^.]*/);
> unless (-d $dirname){
> $err{$dirname}=$errkey if not exists $err{$errkey};
> $errkey++;
> }
> if (-e $changes->{$filesg}->{newname}){
>
> $changes->{$filesg}->{newname}=$dirname.'/'.$filename.'_dup'.$ext;
> }
> }
>
> if (scalar keys %err >0){
> print '3045 ', keys %err,"\n";
> (\%err);;
> }
>
> sub nodir {
> my $err=shift;
> my %error=reverse %{$err};
> my $win =Gtk3::Window->new();
> my $grid=Gtk3::Grid->new;
> my $errtitle=Gtk3::Label->new;
> my %newdirs;
> $errtitle->set_text('The following Directories do
> not exist, please check Details');
> my $rownum=1;
> foreach my $dir (keys %error){
> my $dirlabel=Gtk3::Label->new($error{$dir});
> my
> $diropt=Gtk3::CheckButton->new_with_label('add');
> $grid->attach($dirlabel,0,$rownum,1,1);
> $grid->attach($diropt,1,$rownum,1,1);
> $diropt->signal_connect('toggled'=>sub{
> if ($diropt->get_active==1){
> $newdirs{$dir}=$error{$dir};
> }
> else {
> delete $newdirs{$dir};
> }
> foreach my $keys (keys %newdirs){
> };
> }
> );
> $rownum++;
> }
>
>
>
> my $close=Gtk3::Button->new('Close');
> my $add=Gtk3::Button->new('Add Dir');
> $add->set_halign('start');
> $grid->attach($errtitle,0,0,3,1);
> $grid->attach($close,1,$rownum+1,1,1);
> $grid->attach($add,0,$rownum+1,1,1);
> $add->signal_connect('clicked'=>sub{
> use File::Path;
> foreach my $dirs (keys %newdirs){
> mkpath($newdirs{$dirs});
> }
> $win->close;
> }
> );
> $close->signal_connect('clicked',sub{
> $win->close;
>
> }
> );
> $win->add($grid);
> $win->show;
> $win->show_all;
> return 1
> }
>
> However the subroutine runs too late, so that code that depends on it
> fails.
>
> If I put exactly the same code directly as follows, it runs as expected.
>   if (scalar keys %err >0){
> print '3045 ', keys %err,"\n";
>   
> }
>
> Any ideas appreciated
>
> Mike
>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Strange issue with subroutine being called too late

2019-01-18 Thread Mike Martin via gtk-perl-list
Hi
I have a procedure which should be called on error (if a directory doesn't
exist a window pops up as follows;

foreach my $filesg (keys %{$changes}){
my
($filename,$dirname,$ext)=fileparse($changes->{$filesg}->{newname},qr/\.[^.]*/);
unless (-d $dirname){
$err{$dirname}=$errkey if not exists $err{$errkey};
$errkey++;
}
if (-e $changes->{$filesg}->{newname}){

$changes->{$filesg}->{newname}=$dirname.'/'.$filename.'_dup'.$ext;
}
}

if (scalar keys %err >0){
print '3045 ', keys %err,"\n";
(\%err);;
}

sub nodir {
my $err=shift;
my %error=reverse %{$err};
my $win =Gtk3::Window->new();
my $grid=Gtk3::Grid->new;
my $errtitle=Gtk3::Label->new;
my %newdirs;
$errtitle->set_text('The following Directories do
not exist, please check Details');
my $rownum=1;
foreach my $dir (keys %error){
my $dirlabel=Gtk3::Label->new($error{$dir});
my
$diropt=Gtk3::CheckButton->new_with_label('add');
$grid->attach($dirlabel,0,$rownum,1,1);
$grid->attach($diropt,1,$rownum,1,1);
$diropt->signal_connect('toggled'=>sub{
if ($diropt->get_active==1){
$newdirs{$dir}=$error{$dir};
}
else {
delete $newdirs{$dir};
}
foreach my $keys (keys %newdirs){
};
}
);
$rownum++;
}



my $close=Gtk3::Button->new('Close');
my $add=Gtk3::Button->new('Add Dir');
$add->set_halign('start');
$grid->attach($errtitle,0,0,3,1);
$grid->attach($close,1,$rownum+1,1,1);
$grid->attach($add,0,$rownum+1,1,1);
$add->signal_connect('clicked'=>sub{
use File::Path;
foreach my $dirs (keys %newdirs){
mkpath($newdirs{$dirs});
}
$win->close;
}
);
$close->signal_connect('clicked',sub{
$win->close;

}
);
$win->add($grid);
$win->show;
$win->show_all;
return 1
}

However the subroutine runs too late, so that code that depends on it fails.

If I put exactly the same code directly as follows, it runs as expected.
  if (scalar keys %err >0){
print '3045 ', keys %err,"\n";
  
}

Any ideas appreciated

Mike
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Problems with populating combo box with editing-started signal

2018-11-24 Thread Mike Martin via gtk-perl-list
Hi

$datamwidgetw->{keyfieldc}->get_cells->signal_connect('editing-started'=>sub{
 print 'editing',"\n";
my ($cell,$combo)=@_;
my $model=$combo->get_model;
print $model;
$model->clear;
}
)

This doesnt do anything (at all),

$datamwidgetw->{keyfieldc} is a comboboxtext, but nothing at all happens
and combobox is greyed out

any ideas
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Prolems with liststore insert_with valuesv

2017-08-07 Thread Mike Martin
partial answer to my own question if I replace insert_with_valuesv to
insert_with_values it works

On 7 August 2017 at 17:35, Mike Martin <redt...@gmail.com> wrote:

> Hi
> I am trying to use insert_with_valuesv to populate a liststore as follws
>
> my ($resultmodel,$result)=@_;
> no strict 'refs';
> #print $resultmodel;
> my @cols=0 .. scalar @{$result->[0]} -1;
>
> foreach my $f (@{$result}){
>
> my $iter=$resultmodel->insert_with_valuesv(-1,\@cols,$f);
> }
> $result is an arrayref passed to the sub and resultmodel is the liststore
>
> Unfortunately I am getting 'Cannot convert arbitrary SV to GValue' with I
> assume $f which is an array ref
> As far as I can see this should work
> Any ideeas what I am doing wrong?
>
>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Prolems with liststore insert_with valuesv

2017-08-07 Thread Mike Martin
Hi
I am trying to use insert_with_valuesv to populate a liststore as follws

my ($resultmodel,$result)=@_;
no strict 'refs';
#print $resultmodel;
my @cols=0 .. scalar @{$result->[0]} -1;

foreach my $f (@{$result}){

my $iter=$resultmodel->insert_with_valuesv(-1,\@cols,$f);
}
$result is an arrayref passed to the sub and resultmodel is the liststore

Unfortunately I am getting 'Cannot convert arbitrary SV to GValue' with I
assume $f which is an array ref
As far as I can see this should work
Any ideeas what I am doing wrong?
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


How to stop glib main loop mixing up perl loops

2017-03-16 Thread Mike Martin
*I have a weird issue on an application I am developing*

*The application is fully tabbed and runs loops to transcode video files,
and I would like to be able to run the main transcoding loop fully in
parellel, ie: the process running in one tab is totally separate to that
running in another tab*


*This is a simplified version of the perl loop*






*sub encode_loop {my
($optsi,$prog,$ext,$action_grid,$dvb,$type_g,$files,$video_type)=@_;my
$subname='encode';my
$progrun=_cmd($files->{$file_id},$opts,$prog,$ext,$subname,$action_grid,,0)
;return 1*
*}*




*However this is what happens.*


*I start one loop running, then open another tab and set another loop
running.*


*For the first file every works fine.*


*Then however*




*When the first file finishes encoding, the loop stops until the second
loop is finished. AND*


*The second loop transcodes multiple files at the same time instead of
sequentially. The number is equal to the number of loops running, ie: if
two tabs are running the encode process, then two files are encoded
simultaneously, three tabs than three files*

*I am not sure if it is a thread issue or not*
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Glib threads in gtk-perl?

2017-03-15 Thread Mike Martin
Suspected as much. Looks like it's back to square one.

On 15 Mar 2017 3:08 p.m., "Brian Manning" <c...@xaoc.org> wrote:

> On Tue, Mar 14, 2017 at 4:24 AM, Mike Martin <m...@redtux.org.uk> wrote:
> > Hi
> > It was suggested that I look into using glib threads after posting the
> > problem below to gtk-list
> >
> > I keep getting method not found when I try to create threads using
> > Glib::ThreadPool->new or
> > Glib::Thread->new
> >
> > Are g_threads not implemented?
> >
> > Alternately any other ideas on the issue
>
> GThreads are used in Perl Glib, but only to manage Glib data
> structures, not to manage threads themselves; threads should be
> created/managed using the Perl 'threads' module [1][2].
>
> You should also run 'perl -V | grep ithreads' to check to see if your
> Perl is compiled with thread support, the output of the above command
> should say 'useithreads=define'.
>
> There's also a FAQ question about using threads in Gtk-Perl at [3].
>
> Thanks,
>
> Brian
>
> [1] http://perldoc.perl.org/perlthrtut.html
> [2] https://metacpan.org/pod/threads
> [3] https://wiki.gnome.org/Projects/GTK-Perl/FrequentlyAskedQuestions#Can_
> I_use_threads_with_Gtk2-Perl.3F
> ___
> gtk-perl-list mailing list
> gtk-perl-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-perl-list
>
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Annoyance with treestore (SimpleList) and remove row

2010-10-25 Thread Mike Martin
Hi when I remove a row in a simplelist I get the following warning

 Gtk-CRITICAL **: gtk_list_store_get_value: assertion `VALID_ITER
(iter, list_store)' failed at /usr/lib/perl5/Gtk2/SimpleList.pm line
248.
*** unhandled exception in callback:
***   [gperl_sv_from_value] FIXME: unhandled type - 0 ((null)
fundamental for (null))
***  ignoring at /home/mike/dvd_cat.pl line 467.

Code is

$itemdel-signal_connect('activate'=sub{
my @index= $header_table-get_selected_indices;

warning occurs with  both
splice @{$header_table-{data}},$index[0],1;

and
my $iter=get_iter_from_index($header_table,\...@index);

$header_table-get_model-remove($iter);

}
);

sub get_iter_from_index {
my ($wid,$index)=...@_;
my $path=Gtk2::TreePath-new_from_indices(@{$index});
my $iter=$wid-get_model-get_iter($path);
return $iter;


}

Any ideas on how to remove warning. In both cases the function works fine
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


CellRenderCombo in SimpleList example and question re: go to position

2010-10-08 Thread Mike Martin
Hi
I am working on getting CellRendererCombo working as I want

Code
##Setup combo column type##
Gtk2::SimpleList-add_column_type(
'combo',type='Glib::Scalar',renderer='Gtk2::CellRendererCombo',attr=
sub{
$_[1]-set(text,$_[2]-get($_[3],$_[4]));
$_[1]-set(has_entry,TRUE);
$_[1]-set(editable,TRUE);
$_[1]-set (text_column = 1);
}

##set model##
my $title_rend=$videos_table-get_column(3)-get_cell_renderers;
$title_rend-set(model=$title_list);

##setup row references##
$videos_table-signal_connect (cursor_changed = sub{
($cell, $path_str) = @_;
($path,$focus)= $videos_table-get_cursor or die print 
$!;
$row_ref = $videos_table-get_row_data_from_path 
($path);
}
);


##changed signal for renderer##
$title_rend-signal_connect('changed'=sub{
my $rend_iter=$_[2];
$title_id=$title_rend-get(model)-get_value($rend_iter,0);
$title_val=$title_rend-get(model)-get_value($rend_iter,1);
$row_ref-[2]=$title_id; ##$row_ref is set by a get_cursor call on simplelist
$row_ref-[3]=$title_val;
}
);

My  only question now is whether it is possible to set the position of
the combobox to that of the current value

eg:

values of combobox render is

1,val1
2,val2
3,val3
4,val4

current value is val3

so that when renderer is clicked val3 is selected in the popup

thanks in advance
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Get Iter/Path from CellRendererCombo

2010-10-02 Thread Mike Martin
annoying - just would be nice to be able to get the path direct from the model

On 01/10/2010, Kevin Ryde use...@zip.com.au wrote:
 Mike Martin redt...@gmail.com writes:

  if ( $cell-get(model)-get( $combo_iter, 1 ) eq $val ) {

 If you know what columns are what then that's about it.  There's also
 $model-foreach (per the Gtk2::TreeModel docs) if you want someone else
 to walk the iters for you (good for sub-rows if a tree rather than a
 list).

___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Get Iter/Path from CellRendererCombo

2010-10-02 Thread Mike Martin
On 02/10/2010, Mike Martin redt...@gmail.com wrote:
 I think we may have crossed as that is more or less what I have done


$cat_rend-signal_connect('changed'=sub{
my $rend_iter=$_[2]; # iter of selected item
$valid=$cat_rend-get(model)-get_value($rend_iter,0);
}
);
$cat_rend-signal_connect('edited'=sub{
my $id=$row_ref-[1];
my ($cell, $text_path, $val) = @_;
print $valid,\t,$val,\n;#$valid is column 0, $val is column1
$modeltable-set (

$modeltable-get_iter_from_string ($text_path),
5, $val
);
#   $dbh-do(update titles set category='$val' where 
id='$id');
}
);


 On 02/10/2010, Tadej Borovšak tadeb...@gmail.com wrote:
 Hi.

 There is no such thing as currently active iter when it comes to
 GtkCellRendererCombo. Cell renderers do not retain any permanent state
 as they render more than one cell.

 Another approach would be to connect to GtkCellRendererCombo::changed
 signal and store selected path into main model.

 Tadej

 --
 Tadej Borovšak
 tadeboro.blogspot.com
 tadeb...@gmail.com
 tadej.borov...@gmail.com


___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Adventures in gtk-perl - tables and windows

2010-09-17 Thread Mike Martin
On 17/09/2010, Kevin Ryde use...@zip.com.au wrote:
 Mike Martin redt...@gmail.com writes:

 -{table}-child_get_property($w,'left-attach');

 Yes.

 I cant find any way to get the X11 name from GDK,

 $win-property_get, but it's a little icky :).  I forget what you're
 supposed to pass for the length parameter.  I limit on how huge a chunk
 you want to grab in one go, or something.


 use strict;
 use warnings;
 use Gtk2 '-init';
 my $s=Gtk2::Gdk::Screen-get_default or die print $!;

 my $display = $s-get_display;
 my $atom_string = Gtk2::Gdk::Atom-intern('STRING');
 my $atom_wm_name = Gtk2::Gdk::Atom-intern('WM_NAME');

 foreach my $w ($s-get_window_stack){
   my $xid=$w-get_xid;
   my $win = Gtk2::Gdk::Window-foreign_new_for_display ($display, $xid);

   my ($type_atom, $format, $data)
 = $win-property_get ($atom_wm_name, $atom_string, 0, , 0);
   print $data\n;
 }



Thanks for that - very useful

On a related note have you came across issues with using raise/show
etc on GDKwindows

The only thing that seems to work is maximise/unmaximise

Everything throws up a Resource temporarily unavailable from X with
the task bar icon flashing.
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Adventures in gtk-perl - tables and windows

2010-09-16 Thread Mike Martin
Hi

After a frustrating couple of days googling I have come up with the
follwing bits of code to solve a couple of things which seem to have a
lot of questions on google but no answers. Comments apprieciated

1. getting widgets from a table matching co-ordinates (ie: row/column)

foreach my $w ($table-get_children){
my 
$leftcol=$capture{$media}-{table}-child_get_property($w,'left-attach');

   # can be used for x=left,x=right,y=top,y=bottom as well
with obvious amendments to *attach argument  ie:left/right/top/bottom#

  $capture{$media}-{table}-remove($w) if $leftcol=~/4|5/;  #
op where $leftcol equals criteria - 4 or 5 in this case
 # used to remove widgets here but any op should work I think#
}

2. Getting list of windows from X with xid and name

my $s=Gtk2::Gdk::Screen-get_default or die print $!;

foreach my $w ($s-get_window_stack){
my $xid=$w-get_xid;
my @name=split /=/,`xprop -id $xid WM_NAME`;
print $name[1],\n;
print $name,\t,join \t,$w-get_origin,\t,join \t,$w-get_size,\n;
}

I cant find any way to get the X11 name from GDK, and I dont seem to
be alone, which is why I do a backticks to xprop
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Problem with Gtk2::Combobox-new_with_model

2010-09-02 Thread Mike Martin
Hi - getting confused

I have a liststore
my $dvd_modelx=Gtk2::ListStore-new('Glib::String');
   foreach my $list (keys %cds){
 my $iter=$dvd_modelx-append();
$dvd_modelx-set($iter, 0,$list )
}

my $wid=Gtk2::ComboBox-new_with_model($dvd_modelx);# fails to add to combobox
my $wid=Gtk2::ComboBoxEntry-new_with_model($dvd_modelx);# succeeds in
 add to combobox

What am i missing here
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Question about cancelling sub-routine

2010-08-14 Thread Mike Martin
On 14 August 2010 00:41, muppet sc...@asofyet.org wrote:

 On Aug 12, 2010, at 11:07 PM, Mike Martin wrote:

 This works

 if ($append == 1){

 die (main::encode_loop) if $count == 100; # this is a count as a test
 - the loop goes from 1-150
 }


 but if I try to put it as the action for a cancel sub it fails silently


 $widget{btn_cancel}-signal_connect('clicked', sub {

 die (main::encode_loop)

       );

for info the above lines were consecutive

 any suggestions


 Need more context.  Is the loop you're trying to kill on the main thread, on 
 a background thread, or a chain of idle events?  Does the btn_cancel callback 
 run when clicked or wait to run until after the loop finishes?



very much on the main thread, after some pre-processing it runs

our $tag=  Glib::IO-add_watch ( fileno($file), ['in', 'hup'], sub {
my ($fileno, $condition,$tag) = @_;
if ($condition eq 'hup') {
close $file;
Gtk2-main_quit();
return 0;
}
my $line ;

sysread $file, $line, 256;

if ($feedback_type eq '0'){

$buffer-insert($buffer-get_end_iter,$line) if $subname ne 'gd'
and $subname ne 'gd_m';
$widget{gtkend}-set_text($line)
}

return 1;
}



 As written, die() from a button callback is rather pointless.  That will 
 cause the exception in the event handler, which will be caught and eaten (see 
 old threads from '04 or so for why that is, and the faq [1] for some info on 
 what it does).


I'll have a look

 If the encode_loop you're trying to cancel is on the main thread, then most 
 likely the callback doesn't run until after the encode_loop completes, 
 because that loop is blocking the main thread.  You'd need to do 
 Gtk2-main_iteration while Gtk2-events_pending on each iteration of your 
 encode_loop to handle events and possibly catch the cancel button event.  The 
 event would have to set a flag that the encode_loop checks because of the 
 aforementioned die()-eating behavior.

 If the encode_loop is on another thread, you'll have to poke a thread-shared 
 variable that your other thread reads, or otherwise forcibly kill the other 
 thread.



 [1]: 
 http://live.gnome.org/GTK2-Perl/FrequentlyAskedQuestions#My_app_doesn.27t_die_when_there.27s_a_problem_in_a_signal_callback.2C_I_just_get_some_strange_error_message.2C_what.27s_up_with_that.3F

 --
 Aw, my lemon is empty.
  -- Yvonne, at dinner



This is what I have done to solve the issue

I have a global variable called $sub_stop.

then code is

die (main::encode_loop) if $sub_stop == 1;

then button code is

$widget{btn_cancel}-signal_connect('clicked', sub {
$sub_stop=1; ## sets control variable to 1

if ($pid1 != 1){  ## to cope with when no ext programmes running when
there are no $pids ##
kill (15,$pid1,$pid); ## clears up running external proc ##
if (kill($pid1,$pid) !=0){
kill (9,$pid1,$pid); ## deals with 
process when it does not die cleanly ##
}
}   
#$sub_stop=0;
}
#



);

($sub_stop is set to 0 when encode_loop is run)

This works
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Creating a function to create widgets from a hash - is there a better way?

2010-08-09 Thread Mike Martin
Hi

I have this code
## Master hash to define widgets with options ##
my %widgets=(
1={name='$open_hbox',type='Gtk2::HBox',action='new',opts=[0,0],wname='open_hbox'},
2={name='$encode_open_lab',type='Gtk2::Label',action='new',opts=[$sel_opts_open_lab],wname='open_label'},
3={name='$image',type='Gtk2::Image',action='new_from_stock',opts=['gtk-open','small-toolbar'],wname='file_hbox'},
4={name='$delay',type='Gtk2::Entry',action='new',opts=[],wname='delay'},
5={name='$delay_label',type='Gtk2::Label',action='new',opts=[Delay
action in Minutes],wname='delay_label'},
6={name='$delay_hbox',type='Gtk2::HBox',action='new',opts=[0,0],wname='delbox'},
7={name='$btn_open',type='Gtk2::Button',action='new',opts=[],wname='btn_open'},
8={name='$sel_opts_frame',type='Gtk2::Frame',action='new',opts=[],wname='sel_opts_frame'},
9={name='$sel_opts_mod_lab',type='Gtk2::Label',action='new',opts=[$sel_opts_title_lab],wname='mod_opts_label'},
10={name='$title_frame',type='Gtk2::Frame',action='new',opts=[],wname='title_frame'},
11={name='$sel_opts_hbox',type='Gtk2::HBox',action='new',opts=[0,0],wname='sel_opts_hbox'},
12={name='$sel_opts_vbox',type='Gtk2::VBox',action='new',opts=[0,1],wname='sel_opts_vbox'},
13={name='$enc_hbox',type='Gtk2::HBox',action='new',opts=[0,0],wname='enc_hbox'},
);
## calls function to create widgets and returns a reference to an
array with widgets ##
my $widgets=create_widgets(\%widgets);
## creates variables pointing to widgets in current scope ##
my 
($open_hbox,$encode_open_lab,$image,$delay,$delay_label,$delay_hbox,$btn_open,$sel_opts_frame,$sel_opts_mod_lab,$title_frame,$sel_opts_hbox,$sel_opts_vbox,$enc_hbox)=(@{$widgets});


which calls

sub create_widgets {
my $widgets=shift;
my %widgets=%{$widgets};
my @widgets;
foreach my $keys (sort {$a=$b} keys %widgets){
no strict 'refs';
my $action=$widgets{$keys}-{action};
my $w=eval($widgets{$keys}-{name});
$w=$widgets{$keys}-{type}-$action(@{$widgets{$keys}-{opts}});
$w-set_name($widgets{$keys}-{wname});
push @widgets,$w;

}

return \...@widgets;
}


Obviously there is a major issue with the need to have the list in the
right order. So I am wondering if anyone knows of a better and cleaner
way to do this

thanks
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Test for whether a widget has children

2010-07-23 Thread Mike Martin
Does such a thing exist in Gtk? eg: if I do something like

foreach my $widget ($vbox-get_children){
print $widget
}
It will fail if there are any widgets that dont have children such as
a label or a GTkEntry

I've googled and searched API docs but cant see anything
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Issues with performance of Simple List

2010-03-01 Thread Mike Martin
On 27 February 2010 22:28, Mike Martin redt...@googlemail.com wrote:
 I am having issues with the performance of simple list in a wierd way

 Basicaly I have a simple list object embedded into a window which gets
 data from a sqlite database via user defined criteria

 If I dont access the simplelist at all changes to the data are nearly
 instantaeous however if access the simple list at all there is a delay
 between 20-40 seconds


Solved it finally - it seems there was a strange interaction between
sqlite and simplelist to do with a corrupted index

dropped and restored index and everything is sweet
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Issues with performance of Simple List

2010-02-27 Thread Mike Martin
I am having issues with the performance of simple list in a wierd way

Basicaly I have a simple list object embedded into a window which gets
data from a sqlite database via user defined criteria

If I dont access the simplelist at all changes to the data are nearly
instantaeous however if access the simple list at all there is a delay
between 20-40 seconds

this is the table creation code

any tips appreciated

my $table=Gtk2::SimpleList-new(
'ID'='text',
'Channel'='text',
'Start Time'='text',
'Start Sort'='text',
'Programme'='text',
'End Time'='text',
'End Sort'='text',

'Category'='text'

);

$table-set_headers_clickable(1);
$table-set_headers_visible(1);
$table-set_grid_lines('both');
my $id=$table-get_column(0);
$id-set_visible(0);
my $start=$table-get_column(2);
my $startsort=$table-get_column(3);
my $channel=$table-get_column(1);
my $stop=$table-get_column(5);
my $stopsort=$table-get_column(6);
my $cat=$table-get_column(7);
my $description=$table-get_column(8);
my $programme=$table-get_column(4);

$programme-set_max_width(300);
$startsort-set_visible(0);
$stopsort-set_visible(0);
my $name=$table-get_column(4);
$start-set_sort_column_id(3);
$stop-set_sort_column_id(6);
$channel-set_sort_column_id(1);
$name-set_sort_column_id(4);
$cat-set_sort_column_id(7);

$table-signal_connect (cursor_changed = sub{
show_details;
});

sub show_details {
my ($path,undef)= $table-get_cursor;
my $row_ref = $table-get_row_data_from_path ($path);
$start_record=$$row_ref[3];
$tsid=$dbh-selectcol_arrayref(select distinct tsid from channels
where channel='$$row_ref[1]')-[0];

$end_record=$$row_ref[6];
$rec_channel=$$row_ref[1];
$prog_name=$$row_ref[4];
$rec_id=$$row_ref[0];
my $time=time;
$rec_ids='REC_'.UnixDate(ParseDateString(epoch $time),'%Y_%m_%d_%H_%M_%S');
my $id='%.$$row_ref[0].%';
print $archive_button-get_active;

my @details;
if ($archive_button-get_active == 1){
@details=$dbh-selectrow_array(select start,lang,cat0,stext,name from
guide where id like $id union select start,lang,cat0,stext,name from
archive where id like $id);
}
else
{
@details=$dbh-selectrow_array(select start,lang,cat0,stext,name from
guide where id like $id)
}
my $desc1=wordwrap($details[3],90);
print $desc1;
my $text= join \n, 'time: '.$details[0],'lang:
'.$details[1],'Category: '.$details[2],'Name:
'.$details[4],'Description: '.$desc1;
my $buffer=Gtk2::TextBuffer-new;
use Gtk2::Pango;
$buffer-create_tag('big',size = 15 * PANGO_SCALE);
my $iter = $buffer-get_iter_at_offset (0);
$buffer-insert_with_tags_by_name($iter,$text,'big');
no strict 'refs';
my $reclist=other_channels($$row_ref[1]);
my $text_chan=join \t,@{$reclist};
my $text_show=These Channels can be recorded if you check record
multiplex\n.wordwrap($text_chan,100);
$channel_rec_list-set_markup(span background='yellow'
foreground='red'$text_show/span);
$desc-set_buffer($buffer);
}

my $pid;



$table-signal_connect ('button-press-event' = sub {
but_press

});


sub but_press {
my $record_menu=Gtk2::Menu-new;
my $title=Gtk2::MenuItem-new('Recording');
my $timed=Gtk2::MenuItem-new('Scheduled');
my $manual=Gtk2::MenuItem-new('Manual');
my $sep=Gtk2::SeparatorMenuItem-new;
$sep-set_sensitive(0);
$record_menu-append($title);
$record_menu-append($sep);
$record_menu-append($timed);
$record_menu-append($manual);$title-show;$sep-show;
$timed-show;
$manual-show;
my ($widget,$event)=...@_;
return 0 unless $event-button == 3;

$record_menu-popup(
undef,
undef,
undef,
undef,
$event-button,
$event-time);

#my $path= $widget-get_path_at_pos($event-x, $event-y );
my ($path,undef)= $widget-get_cursor;
$widget-set_cursor($path);

$timed-signal_connect('activate'=sub{
record(timed);
}
);

$manual-signal_connect('activate'=sub{
record(manual);
}
);
}
sub show_details {
my ($path,undef)= $table-get_cursor;
my $row_ref = $table-get_row_data_from_path ($path);
$start_record=$$row_ref[3];
$tsid=$dbh-selectcol_arrayref(select distinct tsid from channels
where channel='$$row_ref[1]')-[0];

$end_record=$$row_ref[6];
$rec_channel=$$row_ref[1];
$prog_name=$$row_ref[4];
$rec_id=$$row_ref[0];
my $time=time;
$rec_ids='REC_'.UnixDate(ParseDateString(epoch $time),'%Y_%m_%d_%H_%M_%S');
my $id='%.$$row_ref[0].%';
print $archive_button-get_active;

my @details;
if ($archive_button-get_active == 1){
@details=$dbh-selectrow_array(select start,lang,cat0,stext,name from
guide where id like $id union select start,lang,cat0,stext,name from
archive where id like $id);
}
else
{
@details=$dbh-selectrow_array(select start,lang,cat0,stext,name from
guide where id like $id)
}
my $desc1=wordwrap($details[3],90);
print $desc1;
my $text= join \n, 'time: '.$details[0],'lang:
'.$details[1],'Category: '.$details[2],'Name:
'.$details[4],'Description: '.$desc1;
my $buffer=Gtk2::TextBuffer-new;
use Gtk2::Pango;
$buffer-create_tag('big',size = 15 * PANGO_SCALE);
my $iter = 

Problem installing gtk-perl on windows (XP)

2009-05-21 Thread Mike Martin
Hi I am trying to install packages from http://lostmind.de/gtk2-perl/

However when I try to install with ppm I

PPD does not support this platform

any ideas (Gtk ,glib runtime, and activestate perl installed fine)
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


accessing liststore of Combobox

2008-11-10 Thread Mike Martin
Hi is there a way of accessing (removing) the contents of the
underlying liststore of a ComboBox constructed using simple text
methods

To Explain I have a combobox which depending on selection adds a
GtkEntry, GtkComboBox or GtkComoboBoxEntry, or directly runs a query.

Everything works fine except that when I choose the same criteria
twice (after selecting a second criteria) the list of values is
duplicated eg:

(This is for a DVB TV Viewer)

Combobox with values Start (ComboBoxEntry), Channel (ComboBox),
Category (ComboBox), Name (Entry)

1. Select Channel - a combobox appears with list of all available channels
2. Select start - a combobox appears with choice of start times
3. Select Channel - a combobox appears with a list of all available
channels listed twice

I am using $widget-remove to clear the control, but underlying
liststore is obviously getting appended. (tried destroy but get a
segfault)

Hope this is clear
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Manipulating popup menus

2008-10-15 Thread Mike Martin
Hi
Is it possible to edit the contents of stock popup menus eg: the edit
menu that is automatically attached to a Gtk::Entry

I have worked out how to add add entries using populate -popup signal,
but I cant find any way to remove entries

thanks
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Signals for combobox entry

2008-10-07 Thread Mike Martin
Hi

I have a drop-down box which adds to the display depending on selection

Combobox
Comboboxentry
Entry

However I am having problems with signals with the combobox entry

the actions are

Combobox = changed
Entry = Keypress event (tab/entry/return)

however for the comboboxentry, changed isnt acceptable as it fires on
every change (runs database query so not good performance)

No keypress events seem to be generated for CBE so are there any other
approaches that will fire only when whole field has been updated?
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Behaviour of lazy-load

2008-09-16 Thread Mike Martin
Hi

Since updating to F9 and so per l5.10 and appropriate gtk-perl
packages I keep getting a message about fail to llazy-load widget
when there is a problem in my code with usually references to glib.pm
or sometimes another module. The message gives go indication of where
in the script the error has occured.

Is there any way to get the previous behaviour ie: printing out where
in the script the error occured

thanks
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Creating re from computed values

2008-07-28 Thread Mike Martin
I am trying to create a regular expression for an if statement from
computed values passed to the sub-routine as follows

sub get_list {
my ($black_list,$table,$crit)[EMAIL PROTECTED];

# $crit is a hash reference containing key to search and search expression
my $listings;

my @crit='$guide{$guides}-{'.'.'del'.'.'}!~1' ; # common criteria
for all calls to function
foreach my $keys (keys %{$crit}){
push @crit,'{'.'.$keys.'.'}=~'.$crit-{$keys};
}
my $crit1=join ' or ',@crit;



foreach my $guides (sort {$guide{$a}-{'start'} =
$guide{$b}-{'start'}} keys %guide){
push 
@{$listings},[$guide{$guides}-{'id'},$guide{$guides}-{'Channel'},substr($guide{$guides}-{'start1'},0,16),$guide{$guides}-{'start'},substr($guide{$guides}-{'stop1'},0,16),$guide{$guides}-{'stop'},$guide{$guides}-{'name'},$guide{$guides}-{'cat0'}]
 if $crit1;

# this is the problem rather than searching on the value of
$guide{$guides}- it prints it out as a literal

}


$table-set_data_array($listings);
return 1
}

Is what I am trying to do possible? - ie: taking a list of fields to
seach and associated criteria and feeding this into a if statement
(the values come from lookups determined via combobox values
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Another question about foreach loops and gtk

2008-06-24 Thread Mike Martin
I have a long-running foreach loop which I want to give feedback through the GUI

ie:

foreach my $keys1 (sort {$a = $b} keys %menu_jpegs){
gd_frame($keys1,$sel_opts_vbox,$menu_file)
}

which runs

sub gd_frame {
my ($keys1,$sel_opts_vbox,$menu_file)[EMAIL PROTECTED];
long function

my $frame_new=$options{'dir'}.'/dvdjpeg'.$keys1.'.jpeg';
open (FRAME,,$frame_new);
print FRAME $frame-jpeg;

my $append;
if ($keys1==1){
$append=0
}
else {
$append=0
}
print $keys1,\n;

run_cmd(undef,undef,$keys1,undef,'gd',$sel_opts_vbox,undef,$append);

return 1
}

relevant part of run_cmd

else {

my $buffer = $textview-get_buffer;
my $line;
if ($cmd{'gd'} == 1 ){
$line=Frames are being created for DVD Menu\n\nFrame $cmd{'gd'} has
been created\n
}
else {
$line=Frame $cmd{'gd'} has been created\n;
}
$buffer-insert($buffer-get_end_iter, $line);
$gtkend-set_text($line);


return 1

}

This all runs fine except:


 nothing appears in the GUI until after the loop finishes, rather than
running at each iteration

I have tried
setting an updating label
append/adding v/hboxes
a continue loop
modifying run_cmd and using echo

so far.

I suspect it is something to do with foreach forking processes so
nothing ggoes to Gtk until all processes have finished - any help
appreciated
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Question about behaviour of foreach and Glib:IO- add_handler

2008-06-10 Thread Mike Martin
Hi

I was always under the impression that a foreach loop iterated over a
list sequentially, which in every other case at least seems to happen.

However I have the following code

sub encode_loop {
my ($opts,$prog,$ext,$sel_opts_vbox)[EMAIL PROTECTED];
my $subname='encode';
foreach my $files1 (keys %files){
no strict 'refs';
if (${$files{$files1}}[0] eq $subname){
{
my 
$prog=run_cmd($files1,$opts,$prog,$ext,$subname,$sel_opts_vbox) ;
}
}
}
}

Which runs the following sub-routine (abrev) for each file ($files above)

sub run_cmd {
$pid=open($file, -|,$cmd{$subname} 21) or die Failed running
perl subprocess\n;

my $end_mark;
my $feedback_type=$options{'feedback'};
if ($feedback_type eq
'1'){$end_mark=$buffer-create_mark('end',$buffer-get_end_iter,0);
$buffer-signal_connect(insert_text=sub{
$textview-scroll_to_mark($end_mark,0.0,1,0.0,1.0);});
};

our $tag=  Glib::IO-add_watch ( fileno($file), ['in', 'hup'], sub {
my ($fileno, $condition,$tag) = @_;

if ($condition eq 'hup') {
close $file;
return 0;
}
my $line ;

sysread $file, $line, 256;

if ($feedback_type eq '0'){
$buffer-insert($buffer-get_end_iter,$line);
$gtkend-set_text($line)
}

else {
$buffer-insert($buffer-get_end_iter, $line);
}
return 1;
}
);

if ($feedback_type eq '1'){
$buffer-signal_connect(insert_text=sub{
$textview-scroll_to_mark($end_mark,0.0,1,0.0,1.0);});
};
}


However the sub is run for each file in parallel. Anyone have any idea
how to force sequential mode? I suspect that it has something to do
with the buffer/add_watch stuff returning immediately after read.

As this program does video transcoding it would be nice to find a
solution as the times are very long

thanks
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Help with using sub to update hash

2007-03-07 Thread Mike Martin
I have the following code

#caller;

my %titles;
my %dvd_titles;
$dvd_act_btn-signal_connect('clicked'=sub{$count++ 
dvd_setup($vbox2,$count,$sel_opts_vbox,\%titles,\%dvd_titles)});

#sub called

sub dvd_setup {
my ($vbox2,$count,$sel_opts_vbox,$titles,$dvd_titles)[EMAIL PROTECTED];
my $subname='dvd_setup';
#my %dvd_titles;
my %dvd_titles=%{$dvd_titles};
my %titles=%{$titles};
foreach my $keys (keys %dvd_titles){
print $keys,=,$dvd_titles{$keys},\n;
}
print scalar %dvd_titles;

foreach my $titles (sort keys %files){

if (${$files{$titles}}[0] eq $subname){
my $key=${$files{$titles}}[5]-get_active_text;
my $file=${$files{$titles}}[2];
unless (exists($dvd_titles{$key})){
$dvd_titles{$key}
};
push (@{$dvd_titles{$key}},${$files{$titles}}[2]);
}
}


foreach my $keys (keys %dvd_titles){
print $keys,=,$dvd_titles{$keys},\n;
}

}

However the hashes defined never get updated by the sub-routine dvd_setup

The hash is added to wuthin the sub (see later print lines), but
original hash is not getting updated.

Any help appreciated.
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Question about getting values from nested GTK::Boxes

2007-02-07 Thread Mike Martin
Hi

I have the following function which gets the values from nested h/vboxes.

sub get_files {
my ($sel_opts_vbox)[EMAIL PROTECTED];
my @files;
my @add_opts;
foreach my $child ($sel_opts_vbox-get_children){
if ($child-get_name eq 'filesel'){
foreach my $child1 ($child-get_children){
foreach my $child2 ($child1-get_children){
foreach my $child3 ($child2-get_children){
foreach my $child4 ($child3-get_children){

if ($child4-get_name eq 'GtkFrame'){
foreach my $child5 ($child4-get_children){
my $media=$child5-get_text;$media=~s/\n//g;
push (@files,$media)}
}

else

{foreach my $child5 ($child4-get_children){
if ($child5-get_name eq 'GtkComboBoxEntry'){
push(@files, $child5-get_active_text);
}

elsif ($child5-get_name eq 'GtkComboBox'){
push (@files,$child5-get_active_text);
}

;
@files;

}

As you can see I am getting the values several levels deep from
dynamically inserted boxes from a container box

The function works well, but seems very clunky, so my question is
whether there is a better way to do this.

thanks
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Simplelist and remove functions

2007-01-31 Thread Mike Martin
I have a Gtk2::Simplelist setup which is working fine except I cant
delete any rows

ie: this works
$add_encode_type_btn-signal_connect('clicked',sub{push
(@{$mod_model-{data}},[undef,undef,undef,undef,undef])});

which adds a record

but this doesnt

$delete_encode_type_btn-signal_connect('clicked',sub{my
@list=$mod_model-get_selected_indices;shift
@{$mod_model-{data}};foreach my $key (@{$mod_model-{data}}){print
\n,@{$key},\n}});

The entry dissapears and the array prints as I would expect. But the
new array doesnt get passed to this function, while the changed array
does in the first case

$amend_encode_type_btn-signal_connect('clicked',sub{%options=update_opts(@{$mod_model-{data}});opts($video_type);$mod_win-destroy
});

called subs are

sub update_opts {
my [EMAIL PROTECTED];
my @update;
no strict 'refs';

foreach my $upd (@{$update}){
my @upd;
foreach my $updhash (@{$upd}){
$updhash=~s/\n//g;
push (@upd,$updhash,\t);
}
[EMAIL PROTECTED];
push(@update,$upd);

}

no strict 'refs';
foreach my $upd (@update){
[EMAIL PROTECTED]@{$upd}[2..8]] ;
}

save_options;

return %options;
}

sub opts {
my ($video_type,$enc)[EMAIL PROTECTED];

if (defined($video_type)){
my $model= $video_type-get_model ;
$model-clear ;

my $title='Select Encoding Type';
$video_type-append_text($title);
foreach my $type (sort keys %options){
no strict 'refs';
if ($type ne  'dir' and $type ne 'feedback'){
$video_type-append_text($options{$type}[6]);

}
}
$video_type-set_active(0);
}

}
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Simplelist and remove functions

2007-01-31 Thread Mike Martin
On 31/01/07, Mike Martin [EMAIL PROTECTED] wrote:
 I have a Gtk2::Simplelist setup which is working fine except I cant
 delete any rows

 ie: this works
 $add_encode_type_btn-signal_connect('clicked',sub{push
 (@{$mod_model-{data}},[undef,undef,undef,undef,undef])});

 which adds a record

 but this doesnt

 $delete_encode_type_btn-signal_connect('clicked',sub{my
 @list=$mod_model-get_selected_indices;shift
 @{$mod_model-{data}};foreach my $key (@{$mod_model-{data}}){print
 \n,@{$key},\n}});

 The entry dissapears and the array prints as I would expect. But the
 new array doesnt get passed to this function, while the changed array
 does in the first case

 $amend_encode_type_btn-signal_connect('clicked',sub{%options=update_opts(@{$mod_model-{data}});opts($video_type);$mod_win-destroy
 });

 called subs are

 sub update_opts {
 my [EMAIL PROTECTED];
 my @update;
 no strict 'refs';

 foreach my $upd (@{$update}){
 my @upd;
 foreach my $updhash (@{$upd}){
 $updhash=~s/\n//g;
 push (@upd,$updhash,\t);
 }
 [EMAIL PROTECTED];
 push(@update,$upd);

 }

 no strict 'refs';
 foreach my $upd (@update){
 [EMAIL PROTECTED]@{$upd}[2..8]] ;
 }

 save_options;

 return %options;
 }

 sub opts {
 my ($video_type,$enc)[EMAIL PROTECTED];

 if (defined($video_type)){
 my $model= $video_type-get_model ;
 $model-clear ;

 my $title='Select Encoding Type';
 $video_type-append_text($title);
 foreach my $type (sort keys %options){
 no strict 'refs';
 if ($type ne  'dir' and $type ne 'feedback'){
 $video_type-append_text($options{$type}[6]);

 }
 }
 $video_type-set_active(0);
 }

 }


Forget this - I was being dense -  I wasn't updating the hash with a delete.
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


CPU load increasing with IO watch

2007-01-24 Thread Mike Martin
I have the following code using IO watch
open($file, -|,$prog $inp1 $opts $newfile  21 );
my $end_mark=$buffer-create_mark('end',$buffer-get_end_iter,0);
our $tag=  Glib::IO-add_watch ( fileno($file), ['in', 'hup'], sub {
  my ($fileno, $condition,$tag) = @_;
  if ($condition eq 'hup') {

  close $file;
  return 0;  # uninstall
  }


  my $line ;
  sysread $file, $line, 256;
my $start=$buffer-get_iter_at_line(25);
my $endline;
if ($buffer-get_line_count() 34){
$endline=$buffer-get_line_count()-10;
}
else {$endline=$buffer-get_line_count()};

my $end=$buffer-get_iter_at_line($endline);

$buffer-signal_connect(insert_text=sub{
$textview-scroll_to_mark($end_mark,0.0,1,0.0,1.0);});
if ($endline 34){
 $buffer-delete($start,$end);
}
  $buffer-insert($buffer-get_end_iter, $line);
#$buffer-set_text($line);
sleep 10;


  return 1;

  }

);

The problem I have is that as the watch progresses CPU load for the
watch increases at the expense of external program being run.

(example cmd line is ffmpeg -async 12 -vd /dev/video -ad /dev/dsp -f
avi -r 25 -s 540x432 -croptop 8 -cropbottom 8 -cropleft 8 -cropright 8
-sameq -aspect 4:3 -acodec mp2 -ac 2 -ab 224k -ar 48000 -t 04:30:30 -y
vcr30.avi)

Which when program starts shows cpu load as
ffmpeg 50-60%
watch prog 3-4%

However as program progresses this changes to
ffmpeg 40-50%
watch prog 30-40%

and idle % decreases accordingly

anyone any ideas how to stop this behaviour
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Optimising tex-buffer/iter?

2007-01-03 Thread Mike Martin
I have the following code
($prog in this case is customisable ffmpeg commands)


else {
$pid=open($file, -|,$prog $inp1 $opts $newfile 21 )
or die Failed running perl subprocess\n;
$pid1=$pid+1; # not relvant
push (@pids,$pid1); # to this issue
}

our $tag=  Glib::IO-add_watch ( fileno($file), ['in', 'hup'], sub {
  my ($fileno, $condition,$tag) = @_;
  if ($condition eq 'hup') {

  close $file;
  return 0;  # uninstall
  }


  my $line ;
  sysread $file, $line, 128;
my $end_mark=$buffer-create_mark('end',$buffer-get_end_iter,0);
$buffer-signal_connect(insert_text=sub{
$textview-scroll_to_mark($end_mark,0.0,1,0.0,1.0);});
  $buffer-insert($buffer-get_end_iter,$line);

  return 1;

  }

);

It seems to be getting bogged down somewher and I am not quite sure
where, although I suspect it is sysread (using read is far worse)

Ths same code used to have negligible overhead, though that could be
because I was doing vcd's not DVD's

Any one any ideas on optimisation or other functions than sysread,
which may be more efficient?

This is tested on FC6 , with gtk-perl
perl-Gtk2-1.140-1.fc6 (RPM)
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Changing background color for a box widget

2006-06-05 Thread Mike Martin

Is it possible to alter the background color for a box widget. I am
not having a lot of luck

To explain I have a dynamically created hbox added to a vbox inside a frame.

In this hbox I have two widgets a label frame (a file name) and a remove button.

I would like the background to be white so there is some contrast.

I have tried with rc files and modify_bg but it doesn't seem to take.

Any ideas?
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Approaches to implementing su in gtk-perl

2006-05-25 Thread Mike Martin

Does anyone have any ideas of how to go about this.

Basically I want to throw up a dialog asking for password and pass
this to the main program.

However everything I have tried so far throws me back to typing
password at shell

Any help appreciated.
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Showing http links in gtk-perl

2006-05-18 Thread Mike Martin

Is it possibe to show a clickable http link using only gtk-perl?

All I have been able to find is something using gnome.
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Foreach and add_watch not working as I would expect

2006-05-18 Thread Mike Martin

On 5/13/06, muppet [EMAIL PROTECTED] wrote:


On May 12, 2006, at 10:14 AM, Mike Martin wrote:

 I am having problems with using IO::Watch Gtk2::Helper etc under a
 foreach loop.

 For some reason it will only run the last element of the array. Here
 is example code.
[...]
 All that seems to happen is that if there are two elements of the
 array then two identical scrooll-windows open running the last $var.

- In watch2(), you're using IN as the file handle.  Remember that
file handles like this are global in perl.  Although you're grabbing
the fileno(IN) when installing the watch, you're still reading from
IN; if watch2() is run more than once, IN will always have the value
of the last file opened.  So, your watch handler will fire for the
old fileno, but you'll read from the new file handle.  That's why you
always want to use lexical file handles, e.g.

 sub watch2 {
 open (my $in, ...) or die ...;
 Glib::IO-add_watch (fileno ($in), ['in', 'hup'], sub {
 # Since $in is a lexical in the enclosing block, this
 # closure will trap the correct $in.
 sysread $in, ...;
 });
 }



thanks that worked


If using the closure to trap $in makes you uncomfortable, you can
pass $in as user data to the watch handler, like this:

 Glib::IO-add_watch (fileno($in), ['in', 'hup'],
\watch_handler, $in);
 ...
 sub watch_handler {
 my ($fileno, $condition, $in) = @_;
 # $in is the user data passed to add_watch(), which in this
case is our file handle.
 }


- The first thing your watch handler does is check for $condition eq
'hup'.  However, $condition is a bitfield, which may contain more
than just 'hup'.  A better way to do this is

 sub watch_handler {
 my ($fileno, $condition) = @_;

 if ($condition = 'in') {
 # handle input data...
 }
 # note: *not* mutually exclusive!
 if ($condition = 'hup') {
 # got a hang up -- clean up and uninstall.
 return FALSE;
 }
 return TRUE;
 }



- In your watch handler, you're connecting to insert-text.  That
means, that you'll connect a new signal handler to the buffer every
time a new chunk of data arrives on IN.  If it takes 50 reads to get
all the data from IN, you'll wind up with 50 signal handlers piled up
on $buffer.  This is not what you want.  Three alternatives:

1.  Install the insert-text handler outside of the watch handler,
e.g., after creating the buffer.  This will leave the handler
installed even after you're finished with the read loop, which is
probably not what you want.
2.  Scroll to mark directly after inserting.  This is the
simplest.  However, if the view actually updates in an idle, then the
scrolling will not quite work right.
3.  Immediately after reading some data in the watch handler,
install a single-shot idle handler to scroll to the mark.  This is
like #2, but gives the view a chance to recalculate itself first.

- The same thing applies to the mark; since you create the mark in
the watch handler, you're piling up marks every time there's a chunk
of data.  With this one, the best solution is just to create the mark
immediately after creating the buffer.


--
Package contains eight 13-inch aliens in assorted colors.
  -- Catalog copy for space invaders wall decals.



___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list