On Sat, Apr 3, 2010 at 2:53 PM, Johan Vromans <jvrom...@squirrel.nl> wrote: > Mattia Barbon <mattia.bar...@libero.it> writes: > >> On the one hand it would be nice if "use Wx" wouldn't require a >> display. On the other hand, creating a Wx::App will always require a >> display, and I'm not sure which wxWidgets classes can be used >> without a Wx::App instance. > > I'm reasonably successful in running Wx apps without DISPLAY. At > least, apart from the message "Unable to initialize gtk, is DISPLAY > set properly?" nothing seems to blow up. > > I provide stubs for widgets that really display things, but the > general Wx::App stuff (like Wx::ConfigBase) works okay. > > Why I'm doing this? I have a big Wx app that has some dialogs that do > heavy work and now I can run this exact dialog code to do the work > automatically from cron jobs.
A a slightly rhetorical question: Wouldn't it be better to have a clear separation in your code between things not using Wx that can be run without any piece of Wx and the GUI part that is Wx based? We have been trying that in Padre and so far failed miserably. Most notably we need to call Wx::gettext() in many of our non-Wx modules but there are many other cases when could not (yet?) move all the display related code to Wx modules. I am not sure how to proceed and if it worth the effort. We even have a unit test that checks if Wx is mentioned in any of the modules that should be Wx free but it has a long list of exceptions. The only case when we need to run it without DISPLAY is when we want to make sure it can be cleanly repackaged by downstream. Fedora and maybe other distributions require that all their packaging process will be done without DISPLAY. So basically in every unit test we have if it requires a DISPLAY we simply skip it when there is no DISPLAY. Apparently the test I mentioned was not skipped but it does not really require a DISPLAY either as it passes even without one just emitting those warnings. regards Gabor