[Iup-users] [iup-users] Announcing lglicua: Lua, GNU/Linux and Tecgraf IM/CD/IUP Assistant

2021-05-27 Thread sur-behoffski
G'day,

I'm happy to announce the initial (-alpha2) release, on
SourceForge, of the project "lglicua".  This is an
"Assistant" for users that wish to pursue private
scientific/technical Lua projects on more than one GNU/Linux
distribution.  The entire Assistant is available as a Git
repository.

This announcement is being made on iup-users and on lua-l.

--

I owe a deep and heartfelt thanks to Antonio Scuri of Tecgraf,
the Project Manager in charge of IM/CD/IUP (as well as working
on other stuff in the Tecgraf group within PUC-Rio).  Scuri
provided significant help as I was gradually put things
together, and has kindly tolerated me during times when I've
made some mistakes.

--

The main summary and download tarball page is at:

https://sourceforge.net/projects/lglicua/

Note the last part of the summary:

The "hello, world" dialog box Bash/Lua script is two lines:

#!/bin/bash ../support/play-lua-tec
iup=require("iuplua"); iup.Message("MyApp", "hello, world")

--

There are shortcomings in the range of Distributions
supported, and also, sadly, the Assistant currently is
limited to using OS-installed Lua 5.1.  While I've tried to
leave pathways open to address these limitations, I've had
to cut my losses, because otherwise feature creep would
mean that I'd never finish a release.  A client may choose
to use a virtual machine in order to partially cope with
these restrictions.

--

The link above gives a short summary.  A longer summary is
given in README.md, e.g.:

https://sourceforge.net/projects/lglicua/files/
https://sourceforge.net/p/lglicua/code/ci/master/tree/

This breaks down the "lglicua" name...:


lglicua:

l   -- Lua:
   https://www.lua.org/

 gl -- GNU/Linux

   icu  -- PUC-RIO (Pontifical Catholic University of Rio de Janeiro)
   Tecgraf Institute of Technical-Scientific Software:

   https://www.tecgraf.puc-rio.br/

   i-- IM (Image Manipulation) 
https://sourceforge.net/projects/imtoolkit/
c   -- CD (Canvas Draw) https://sourceforge.net/projects/canvasdraw/
 u  -- IUP (Toolkit for GUIs) https://sourceforge.net/projects/iup/

  a -- Assistant

--

... and gives a longer description of what the Assistant is
about:

Table of Contents:

1. About IM, CD and IUP;
2. Why write the Assistant?
3. System Requirements and Recommendations (as at May 2021);
4. Brief summary of Assistant components;
5. Initial Installer PROJECT/install/i (./i) script help:
6. Initial Build "quirky" PROJECT/build/q (./q) script help:



cheers,

sur-behoffski (Brenton Hoff)
programmer, Grouse Software


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IupPopup never returning

2021-05-27 Thread Antonio Scuri
 Easier will be to disable the IupFlush on the close of that dialog. Set
NOFLUSH=Yes.

 But it seems to me that your timer is doing something that prevents the
popup loop to end.

Best,
Scuri


Em qui., 27 de mai. de 2021 às 18:11, Isaac Raway  escreveu:

> Scuri,
>
> Ah great, this was enough for me to figure out what was going on, well...
> sort of.
>
> I did have 3 timers, one of which had a very small interval of 1 (TIME=1).
>
> If I change this to TIME=100 the problem seemed to go away, but would
> impact performance of the module that it was calling (a web server's
> polling function).
>
> So instead I implemented my own message loop:
>
> However there are two issues:
>
> 1. I'm not sure how to know when to exit the loop
> 2. The documentation for IupLoopStep says:
>
> "Note that this function does not replace IupMainLoop."
>
> So, are there things that IupLoopStep doesn't do that are needed for IUP
> to be healthy? Is there an example on completely replacing IupMainLoop with
> a custom event loop?
>
>
>
> On Wed, May 26, 2021, at 10:19 PM, Antonio Scuri wrote:
>
>   Hi,
>
>   IupPopup starts a new message loop that will return only when one of the
> following occurs: "a callback returns IUP_CLOSE, IupExitLoop is called, or
> when the popup dialog is hidden, for example using IupHide".
>
>   It looks that you are doing it right, but this: "IupHide never returns
> and all following events are handled inside IupHide." Is quite weird. There
> is no message processing in IupHide, but IupFlush is called. So pending
> messages are processed. I noticed you have a timer, it may process the
> timer and call the timer callback.
>
>   If this does not help you find the problem, then to be able to reproduce
> the problem here I'll need a small example code. For instance, you can
> change one of the pre-defined samples.
>
>   Sorry for taking so long.
>
> Best,
> Scuri
>
>
>
> Em qua., 26 de mai. de 2021 às 14:14, Antonio Scuri <
> antonio.sc...@gmail.com> escreveu:
>
>  Later today, I'll see this.
>
> Best,
> Scuri
>
> Em qua., 26 de mai. de 2021 às 14:12, Isaac Raway  escreveu:
>
>
> Could really use some help with this. This bug is bad enough and hard
> enough to track down I'm being forced to consider using a different
> toolkit, which would be a ton of work and isn't really something I want to
> do. Is there any way to figure out why these functions aren't returning as
> documented?
>
> IJR
>
> On Thu, May 13, 2021, at 10:27 AM, Isaac Raway wrote:
>
> I should clarify that the callback below is on CLOSE_CB as well as ACTION
> of the OK button on the form. When I close the dialog box with the windows
> close button, it works correctly (callback is fired, and IupPopup returns,
> where the data is saved). But it does *not* work when clicking the OK
> button -- IupHide never returns and all following events are handled inside
> IupHide.
>
> I tried removing the event callback from CLOSE_CB but the result is the
> same when clicking the OK button:
>
> > stonenotes_nt.exe!win_dialog_ok_cb(Ihandle_ * self) Line 125 C
> [External Code]
> stonenotes_nt.exe!win_dialog_show(const char * id, const char *
> ledFilename, int(*)(Ihandle_ *) callback, int(*)(WIN_DIALOG *, void *)
> value_callback, void * data) Line 120 C
> stonenotes_nt.exe!win_options_categories(Ihandle_ * self) Line 2748 C
> [External Code]
> stonenotes_nt.exe!win_dialog_ok_cb(Ihandle_ * self) Line 133 C
> [External Code]
> stonenotes_nt.exe!win_dialog_show(const char * id, const char *
> ledFilename, int(*)(Ihandle_ *) callback, int(*)(WIN_DIALOG *, void *)
> value_callback, void * data) Line 120 C
> stonenotes_nt.exe!win_options_categories(Ihandle_ * self) Line 2748 C
> [External Code]
> stonenotes_nt.exe!main(int argc, char * * argv) Line 136 C++
> [External Code]
>
>
> Also here is the dialog setup code in case that helps:
>
>
> tWIN_DIALOG *win_dialog_show(const char *id, const char *ledFilename,
> Icallback callback, dialog_value_callback value_callback, void *data)
> {
> tWIN_DIALOG *result = calloc(1, sizeof(tWIN_DIALOG));
> Ihandle *config = get_config();
> sds attr;
> int immediate_show = 0;
> int x = 0, y = 0;
>
>char *error = sys_load_led(ledFilename); // this function calls IupLoad
> and returns the result after locating the file
> if (NULL == error) {
> sds key = NULL;
>
> // get handles from loaded LED file
> result->ok = IupGetHandle(key = sdscatfmt(sdsempty(), "IDC_%s_OK",
> id));
> sdsfree(key);
>
> result->cancel = IupGetHandle(key = sdscatfmt(sdsempty(),
> "IDC_%s_CANCEL", id));
> sdsfree(key);
>
> result->dlg = IupGetHandle(key = sdscatfmt(sdsempty(), "IDD_%s",
> id));
> sdsfree(key);
> } else {
> result->dlg = IupSetAttributes(IupDialog(IupLabel(error)),
> "TITLE=\"StoneNotes Dialog Load - ERROR\", SIZE=400x200,
> EXPANDCHILDREN=YES, RESIZE=YES");
> }
>
> IupSetAttribute(result->dlg, "MINBOX", "NO");
>
> 

Re: [Iup-users] IupPopup never returning

2021-05-27 Thread Isaac Raway
Scuri,

Ah great, this was enough for me to figure out what was going on, well... sort 
of.

I did have 3 timers, one of which had a very small interval of 1 (TIME=1).

If I change this to TIME=100 the problem seemed to go away, but would impact 
performance of the module that it was calling (a web server's polling function).

So instead I implemented my own message loop:

However there are two issues:

1. I'm not sure how to know when to exit the loop
2. The documentation for IupLoopStep says:

"Note that this function does not replace IupMainLoop."

So, are there things that IupLoopStep doesn't do that are needed for IUP to be 
healthy? Is there an example on completely replacing IupMainLoop with a custom 
event loop?



On Wed, May 26, 2021, at 10:19 PM, Antonio Scuri wrote:
>   Hi,
> 
>   IupPopup starts a new message loop that will return only when one of the 
> following occurs: "a callback returns IUP_CLOSE, IupExitLoop is called, or 
> when the popup dialog is hidden, for example using IupHide".
> 
>   It looks that you are doing it right, but this: "IupHide never returns and 
> all following events are handled inside IupHide." Is quite weird. There is no 
> message processing in IupHide, but IupFlush is called. So pending messages 
> are processed. I noticed you have a timer, it may process the timer and call 
> the timer callback.
> 
>   If this does not help you find the problem, then to be able to reproduce 
> the problem here I'll need a small example code. For instance, you can change 
> one of the pre-defined samples. 
> 
>   Sorry for taking so long.
> 
> Best,
> Scuri
> 
> 
> 
> Em qua., 26 de mai. de 2021 às 14:14, Antonio Scuri  
> escreveu:
>>  Later today, I'll see this.
>> 
>> Best,
>> Scuri
>> 
>> Em qua., 26 de mai. de 2021 às 14:12, Isaac Raway  escreveu:
>>> __
>>> Could really use some help with this. This bug is bad enough and hard 
>>> enough to track down I'm being forced to consider using a different 
>>> toolkit, which would be a ton of work and isn't really something I want to 
>>> do. Is there any way to figure out why these functions aren't returning as 
>>> documented?
>>> 
>>> IJR
>>> 
>>> On Thu, May 13, 2021, at 10:27 AM, Isaac Raway wrote:
 I should clarify that the callback below is on CLOSE_CB as well as ACTION 
 of the OK button on the form. When I close the dialog box with the windows 
 close button, it works correctly (callback is fired, and IupPopup returns, 
 where the data is saved). But it does *not* work when clicking the OK 
 button -- IupHide never returns and all following events are handled 
 inside IupHide.
 
 I tried removing the event callback from CLOSE_CB but the result is the 
 same when clicking the OK button:
 
 > stonenotes_nt.exe!win_dialog_ok_cb(Ihandle_ * self) Line 125 C 
 [External Code]
 stonenotes_nt.exe!win_dialog_show(const char * id, const char * 
 ledFilename, int(*)(Ihandle_ *) callback, int(*)(WIN_DIALOG *, void *) 
 value_callback, void * data) Line 120 C
 stonenotes_nt.exe!win_options_categories(Ihandle_ * self) Line 2748 C
 [External Code]
 stonenotes_nt.exe!win_dialog_ok_cb(Ihandle_ * self) Line 133 C
 [External Code]
 stonenotes_nt.exe!win_dialog_show(const char * id, const char * 
 ledFilename, int(*)(Ihandle_ *) callback, int(*)(WIN_DIALOG *, void *) 
 value_callback, void * data) Line 120 C
 stonenotes_nt.exe!win_options_categories(Ihandle_ * self) Line 2748 C
 [External Code]
 stonenotes_nt.exe!main(int argc, char * * argv) Line 136 C++
 [External Code]
 
 
 Also here is the dialog setup code in case that helps:
 
 
 tWIN_DIALOG *win_dialog_show(const char *id, const char *ledFilename, 
 Icallback callback, dialog_value_callback value_callback, void *data) 
 {
 tWIN_DIALOG *result = calloc(1, sizeof(tWIN_DIALOG));
 Ihandle *config = get_config();
 sds attr;
 int immediate_show = 0;
 int x = 0, y = 0;
 
char *error = sys_load_led(ledFilename); // this function calls IupLoad 
 and returns the result after locating the file
 if (NULL == error) {
 sds key = NULL;
 
 // get handles from loaded LED file
 result->ok = IupGetHandle(key = sdscatfmt(sdsempty(), "IDC_%s_OK", 
 id));
 sdsfree(key);
 
 result->cancel = IupGetHandle(key = sdscatfmt(sdsempty(), 
 "IDC_%s_CANCEL", id));
 sdsfree(key);
 
 result->dlg = IupGetHandle(key = sdscatfmt(sdsempty(), "IDD_%s", 
 id));
 sdsfree(key);
 } else {
 result->dlg = IupSetAttributes(IupDialog(IupLabel(error)), 
 "TITLE=\"StoneNotes Dialog Load - ERROR\", SIZE=400x200, 
 EXPANDCHILDREN=YES, RESIZE=YES");
 }
 
 IupSetAttribute(result->dlg, "MINBOX", "NO");
 
 //IupSetCallback(result->dlg, "CLOSE_CB",