| 
      
      
      From:  <jer...@gm...> - 2006-12-24 20:13:33
       | 
| SGkgbGlzdCwKCkkganVzdCBkb3dubG9hZGVkIHRoZSBuZXcgbW9kdWxlIHJlbGVhc2Ugd3hsdWEt Mi44LjAuMC1kbGxzLnppcC4gU2luY2UKdGhlcmUgYXJlIG5vIHNhbXBsZXMgd2l0aCBpdCBJIGRv d25sb2FkZWQgdGhvc2UgZnJvbSB0aGUgd3hMdWEgc291cmNlCnBhY2thZ2VzLiBJIHRoZW4gdHJp ZWQgdG8gcnVuIHRoZW0gd2l0aCB0aGF0IGNvbW1hbmQgbGluZSA6CiQgbHVhIC1sd3ggbWluaW1h bC53eC5sdWEKCkJ1dCB0aGUgYXBwbGljYXRpb24gYXJlIG5vdCBydW5uaW5nIHByb3Blcmx5LiBD b25zaXN0ZW50bHkgd2l0aCBhbGwKc2FtcGxlcywgdGhlIGFwcGxpY2F0aW9uIHdpbmRvdyBwb3Bz IGZvciBhIGZyYWN0aW9uIG9mIGEgc2Vjb25kIGFuZAp0aGVuIGRlcG9wcy4gSSB0cmllZCBhZGRp bmcgYW4gaW5maW5pdGUgbG9vcCBhdCB0aGUgZW5kIG9mIHRoZSBzYW1wbGUKb3IgYSBibG9ja2lu ZyByZWFkIG9uIHN0ZGluLCBidXQgdGhlbiB0aGUgd2luZG93IGRvbid0IHJlY2VpdmUgYW55CmV2 ZW50LgoKSSBsb29rZWQgYXQgdGhlIGxpc3QgYXJjaGl2ZSBidXQgZGlkbid0IGZvdW5kIGFueXRo aW5nLiBJcyB0aGVyZSBhCmtub3duIHByb2JsZW0gd2l0aCB0aGlzIHJlbGVhc2Ugb2YgdGhlIG1v ZHVsZSB2ZXJzaW9uIG9yIGRvZXMgSSBoYXZlCnRvIGFkYXB0IHRoZSBzYW1wbGVzIHRvIGEgZGlm ZmVyZW50IHBhcmFkaWdtL2FwaSA/CgpKw6lyw7RtZS4K | 
| 
      
      
      From: Hakki D. <dog...@tr...> - 2006-12-24 20:59:33
       | 
| Hi,
Jérôme VUARAND wrote:
> Hi list,
> 
> I just downloaded the new module release wxlua-2.8.0.0-dlls.zip. Since
> there are no samples with it I downloaded those from the wxLua source
> packages. I then tried to run them with that command line :
> $ lua -lwx minimal.wx.lua
> 
> But the application are not running properly. Consistently with all
> samples, the application window pops for a fraction of a second and
> then depops. I tried adding an infinite loop at the end of the sample
> or a blocking read on stdin, but then the window don't receive any
> event.
> 
> I looked at the list archive but didn't found anything. Is there a
> known problem with this release of the module version or does I have
> to adapt the samples to a different paradigm/api ?
> 
> Jérôme.
Most of the samples designed for wxLua.exe.
You may write a simple bootstrap file, ie:
wx = require("wx")
dofile("wxluasudoku.wx.lua")
wx.wxGetApp():MainLoop()
--
Regards,
Hakki Dogusan
 | 
| 
      
      
      From: Francesco M. <f18...@ya...> - 2006-12-24 21:05:39
       | 
| Hi Jérôme,
Jérôme VUARAND ha scritto:
> I just downloaded the new module release wxlua-2.8.0.0-dlls.zip. Since
> there are no samples with it
yes, it's supposed to be a very very minimal download, with just all DLLs
required by wxLua. If you're interested in using wxLua you should get either the
installer or the source archives and then build them.
> I downloaded those from the wxLua source
> packages. I then tried to run them with that command line :
> $ lua -lwx minimal.wx.lua
> 
> But the application are not running properly. Consistently with all
> samples,
the luamodule.wx.lua sample works fine with me....
> the application window pops for a fraction of a second and
> then depops. I tried adding an infinite loop at the end of the sample
> or a blocking read on stdin, but then the window don't receive any
> event.
yes, I do see it (except in the luamodule.wx.lua sample). It's because they miss 
the
  require("wx")
call...
HTH,
Francesco
 | 
| 
      
      
      From:  <jer...@gm...> - 2006-12-24 22:40:37
       | 
| 2006/12/24, Hakki Dogusan <dog...@tr...>:
> Most of the samples designed for wxLua.exe.
>
> You may write a simple bootstrap file, ie:
>
>
> wx = require("wx")
> dofile("wxluasudoku.wx.lua")
> wx.wxGetApp():MainLoop()
Is there an equivalent of wx.wxGetApp():MainLoop() that is not
blocking ? It would process all pending messages, and then give back
control to application. I would then call it from my own frame-based
main loop.
 | 
| 
      
      
      From: John L. <jla...@gm...> - 2006-12-25 00:16:36
       | 
| On 12/24/06, J=E9r=F4me VUARAND <jer...@gm...> wrote:
> 2006/12/24, Hakki Dogusan <dog...@tr...>:
> > Most of the samples designed for wxLua.exe.
> >
> > You may write a simple bootstrap file, ie:
> >
> >
> > wx =3D require("wx")
> > dofile("wxluasudoku.wx.lua")
> > wx.wxGetApp():MainLoop()
>
> Is there an equivalent of wx.wxGetApp():MainLoop() that is not
> blocking ? It would process all pending messages, and then give back
> control to application. I would then call it from my own frame-based
> main loop.
You have to do all initialization or whatever you need to do before
running the GUI main loop which is always blocking since thats what
the underlying framework does. You can use the wxEVT_IDLE events to do
things continuously by calling event.RequestMore(true), but note that
continuously doing this will use 100% of your processor.
What you're suggesting is not normal, it's better to have the system's
native mainloop control program flow rather than implementing your own
which will most likely be far less efficient. In any case you should
be able to do it using wxApp::Pending and wxApp::Dispatch.
Hope this helps,
    John Labenski
 | 
| 
      
      
      From:  <jer...@gm...> - 2006-12-25 01:27:28
       | 
| 2006/12/24, John Labenski <jla...@gm...>:
> What you're suggesting is not normal, it's better to have the system's
> native mainloop control program flow rather than implementing your own
> which will most likely be far less efficient. In any case you should
> be able to do it using wxApp::Pending and wxApp::Dispatch.
wxApp::Pending+wxApp::Dispatch seems to be exactly what I need.
I don't know what your definition of normal is, but my question seems
perfectly normal to me. What I want to achieve is to have several Lua
frameworks working together in a single thread (because Lua is not
thread safe). Each of my frameworks need to be updated several times a
second, but I can't give application main loop control to any of
these, so I need to make them cooperate.
Example :
void F1::MainLoop()
{
    bool quit;
    Message message;
    while (message = F1::GetMessage_Blocking())
    {
        F1::ProcessMessage(message);
    }
}
void F2::MainLoop()
{
    bool quit;
    do
    {
        F2::Render();
        quit = F2::ProcessInput();
    } while (!quit);
}
void F3::MainLoop()
{
    bool quit;
    do
    {
        F3::Update();
        if (F3::LastError())
            quit = true;
    } while (!quit);
}
void InterleavedMainLoop()
{
    bool quit = false;
    Message message;
    while (true)
    {
        // Update framework F1
        while (F1::IsMessagePresent())
        {
            message = F1::GetMessage_NonBlocking();
            if (message)
                F1::ProcessMessage();
            else
                quit = true;
        }
        if (quit) break;
        // Update framework F2
        F2::Render();
        quit = F2::ProcessInput();
        if (quit) break;
        // Update framework F3
        F3::Update();
        if (F3::LastError())
            quit = true;
        if (quit) break;
        // Main application control refresh rate
        usleep(10000);
    }
}
Replace F1 with wxLua, F2 with my OpenGL renderer and F3 with john
doe's network framework if that makes things clearer. The basic idea
is that an extension module should not take control of the
application. There are a lot of multi-threaded solution to this kind
of problem, but in some context a full thread control is a big
requirement for an extension module.
 | 
| 
      
      
      From: John L. <jla...@gm...> - 2006-12-25 02:08:03
       | 
| On 12/24/06, J=E9r=F4me VUARAND <jer...@gm...> wrote:
> 2006/12/24, John Labenski <jla...@gm...>:
> > What you're suggesting is not normal, it's better to have the system's
> > native mainloop control program flow rather than implementing your own
> > which will most likely be far less efficient. In any case you should
> > be able to do it using wxApp::Pending and wxApp::Dispatch.
>
> wxApp::Pending+wxApp::Dispatch seems to be exactly what I need.
>
> I don't know what your definition of normal is, but my question seems
> perfectly normal to me. What I want to achieve is to have several Lua
> frameworks working together in a single thread (because Lua is not
> thread safe). Each of my frameworks need to be updated several times a
> second, but I can't give application main loop control to any of
> these, so I need to make them cooperate.
Sounds good, I was just using "normal" in the sense that having lua
run the mainloop is a little like having the tail wag the dog. It
sounds like you're doing something a little more advanced though, good
luck.
You may still want to consider using wxEVT_IDLE though since I think
that's what is typically suggested on the C++ wxusers mailing list for
doing pseudo-threading like this.
Regards,
    John Labenski
 | 
| 
      
      
      From:  <jer...@gm...> - 2006-12-25 02:28:05
       | 
| MjAwNi8xMi8yNCwgSm9obiBMYWJlbnNraSA8amxhYmVuc2tpQGdtYWlsLmNvbT46Cj4gT24gMTIv MjQvMDYsIErDqXLDtG1lIFZVQVJBTkQgPGplcm9tZS52dWFyYW5kQGdtYWlsLmNvbT4gd3JvdGU6 Cj4gPiAyMDA2LzEyLzI0LCBKb2huIExhYmVuc2tpIDx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UgZG8KICAgICAgICBpZiB3eC53eEdldEFwcCgpOlBlbmRpbmco KSB0aGVuCiAgICAgICAgICAgIHd4Lnd4R2V0QXBwKCk6RGlzcGF0Y2goKQogICAgICAgIGVuZAog ICAgZW5kCmVsc2UKICAgIHd4Lnd4R2V0QXBwKCk6TWFpbkxvb3AoKQplbmQKClRoZSBjb21tYW5k IGxpbmUgaXMgOgpsdWEgYm9vdHN0cmFwLmx1YSBtaW5pbWFsLnd4Lmx1YQoKRXZlcnl0aGluZyB3 b3JrcyBvayBpZiBJIHNldCBteSB1c2VfY3VzdG9tX2xvb3AgdG8gZmFsc2UuIEknbGwgaGF2ZSBh Cmxvb2sgYXQgdGhlIGludGVybmFscyBvZiBNYWluTG9vcCB0byBzZWUgd2hhdCBtYXkgYmUgbWlz c2luZy4gQW5kIEkKc3RpbGwgbmVlZCB0byB0cnkgdGhlIGlkbGUgZXZlbnQgbW9kZWwsIHRob3Vn aCBJIGRvbid0IHRoaW5rIHRoYXQgd2lsbAptYXRjaCBteSB0aW1pbmcgcmVxdWlyZW1lbnQuCg== | 
| 
      
      
      From: John L. <jla...@gm...> - 2006-12-25 04:38:27
       | 
| On 12/24/06, J=E9r=F4me VUARAND <jer...@gm...> wrote:
> 2006/12/24, John Labenski <jla...@gm...>:
> > On 12/24/06, J=E9r=F4me VUARAND <jer...@gm...> wrote:
> > > 2006/12/24, John Labenski <jla...@gm...>:
> > > > What you're suggesting is not normal, it's better to have the syste=
m's
> > > > native mainloop control program flow rather than implementing your =
own
> > > > which will most likely be far less efficient. In any case you shoul=
d
> > > > be able to do it using wxApp::Pending and wxApp::Dispatch.
> > >
> > > wxApp::Pending+wxApp::Dispatch seems to be exactly what I need.
> >
> > You may still want to consider using wxEVT_IDLE though since I think
> > that's what is typically suggested on the C++ wxusers mailing list for
> > doing pseudo-threading like this.
>
> I've tried Pending+Dispatch but that don't seems to work.
> wx.wxGetApp():Pending() never returns true.
>
> The code is :
> wx =3D require("wx")
> dofile(...)
> local use_custom_loop =3D true
> if use_custom_loop then
>     while true do
          while wx.wxGetApp():Pending() do
>             wx.wxGetApp():Dispatch()
>         end
           wx.wxMilliSleep(10) -- adjust as necessary
           wx.wxGetApp():ProcessIdle()
>     end
> else
>     wx.wxGetApp():MainLoop()
> end
>
> The command line is :
> lua bootstrap.lua minimal.wx.lua
>
> Everything works ok if I set my use_custom_loop to false. I'll have a
> look at the internals of MainLoop to see what may be missing. And I
> still need to try the idle event model, though I don't think that will
> match my timing requirement.
I can't test the changes above right now, but take a look at
wxPython's samples/mainloop/mainloop.py program and it's wxApp's
MainLoop function. Hopefully the only problem is that you need to
completely flush the events with the "while wx.wxGetApp():Pending()"
loop and give the event handler a little kick with
wx.wxGetApp():ProcessIdle() every once in a while.
see here and the posts before and after it.
http://lists.wxwidgets.org/archive/wxPython-users/msg07355.html
Regards,
    John Labenski
 |