473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

app with standalone gui and web interface

What would the simplest way to make an application that has both a web
interface and runs from behind a web server but also can be used as a
standalone app with a gui? More precisely is it possible to avoid
creating an html/xml/whatever based web interface for the web version
and separately creating a gui (wxpython for example) for the
standalone version and instead create a graphical frontend at once
that can be used for both?
Oct 3 '06 #1
3 1914
Hi Daniel.
What would the simplest way to make an application that has both a web
interface and runs from behind a web server but also can be used as a
standalone app with a gui? More precisely is it possible to avoid
creating an html/xml/whatever based web interface for the web version
and separately creating a gui (wxpython for example) for the
standalone version and instead create a graphical frontend at once
that can be used for both?
I was experimenting with something roughly similar a couple of years
ago. You might find it interesting. What I did may or may not work in
your case. It depends on what you want to be able to do in the
application.

I built an application that consisted of some server side Java/JSPs
that gave out XML. I used two stylesheets to transform the data into
either HTML (for the web version) or another XML-format called wxWML
(for the wxPython version). Desktop users accessed the application via
a custom "webbrowser" that translates the wxWML to wxPython code which
is executed to generate the GUI. This way, anyone with the wxBrowser
installed could access the application as if it was a desktop app.

But you should know that this was an experiment. We ended up not using
it because it felt weird and because there was not much extra gain to
be had from the desktop part. You should also know that the wxBrowser
is a HUGE security hole which is a good reason not to use it.

You can still download the code I wrote and a "tutorial" PDF from
http://www.pulp.se/wx/ but I haven't touched it since last summer so
I'm not sure it works with the latest version of wxPython. Also, I just
noted that the example URL that I point to on that page doesn't work
because I've moved my hosting since then, but that can be fixed.

Good luck
Johan Lindberg
jo***@pulp.se

Oct 3 '06 #2
What would the simplest way to make an application that has both a web
interface and runs from behind a web server but also can be used as a
standalone app with a gui? More precisely is it possible to avoid
creating an html/xml/whatever based web interface for the web version
and separately creating a gui (wxpython for example) for the
standalone version and instead create a graphical frontend at once
that can be used for both?

I was experimenting with something roughly similar a couple of years
ago. You might find it interesting. What I did may or may not work in
your case. It depends on what you want to be able to do in the
application.

I built an application that consisted of some server side Java/JSPs
that gave out XML. I used two stylesheets to transform the data into
either HTML (for the web version) or another XML-format called wxWML
(for the wxPython version). Desktop users accessed the application via
a custom "webbrowser" that translates the wxWML to wxPython code which
is executed to generate the GUI. This way, anyone with the wxBrowser
installed could access the application as if it was a desktop app.

But you should know that this was an experiment. We ended up not using
it because it felt weird and because there was not much extra gain to
be had from the desktop part. You should also know that the wxBrowser
is a HUGE security hole which is a good reason not to use it.

You can still download the code I wrote and a "tutorial" PDF from
http://www.pulp.se/wx/ but I haven't touched it since last summer so
I'm not sure it works with the latest version of wxPython. Also, I just
noted that the example URL that I point to on that page doesn't work
because I've moved my hosting since then, but that can be fixed.

Thanks for the suggestions, I'll look into both methods. Having a
local webserver seems pretty easy and convenient.

Johan, your way of doing it resembles XUL somewhat, although I can't
say I fully understand XUL I just took a look some days ago. Let me
see if I understand your approach:

If you want to have something very dynamical you do it the way you
described with the wxwml source getting parsed, converted to wxpython
and then run by python all at once. At the same time the webserver can
fetch the same wxwml source, convert it into html/xml and send that to
the web client. Now if one wants to bypass wxbrowser and the real time
conversion to wxpython, then, sacrificing some level of dynamicness,
why not convert the wxwml source 'statically' into wxpython, bundle
that as an app and at the same time convert it also to xml/html
'statically' and have that served by a webserver. In this way any time
the gui changes one needs to go through both convertions once, bundle
the desktop app again, update the webserver but there won't be any
security whole or any magic that is not pure python or not pure
html/xml. Does this sound reasonable or am I misunderstanding
something?

In fact something like that is the thing I'm looking for, some
language that can specify a gui and can be used to generate
'statically' both wxpython source (or some other widget set) or
html/xml source.
Oct 3 '06 #3
Johan, your way of doing it resembles XUL somewhat, although I can't
say I fully understand XUL I just took a look some days ago. Let me
see if I understand your approach:
Yes it's a lot like XUL, but there are some major differences. The most
important one is that, at least back then, you had to use JavaScript.
Also, XUL had (has) a much more limited set of widgets and you can't
escape the surrounding Browser.
If you want to have something very dynamical you do it the way you
described with the wxwml source getting parsed, converted to wxpython
and then run by python all at once. At the same time the webserver can
fetch the same wxwml source, convert it into html/xml and send that to
the web client. Now if one wants to bypass wxbrowser and the real time
conversion to wxpython, then, sacrificing some level of dynamicness,
why not convert the wxwml source 'statically' into wxpython, bundle
that as an app and at the same time convert it also to xml/html
'statically' and have that served by a webserver. In this way any time
the gui changes one needs to go through both convertions once, bundle
the desktop app again, update the webserver but there won't be any
security whole or any magic that is not pure python or not pure
html/xml. Does this sound reasonable or am I misunderstanding
something?

In fact something like that is the thing I'm looking for, some
language that can specify a gui and can be used to generate
'statically' both wxpython source (or some other widget set) or
html/xml source.
Ok, there are ways to do that... sort of.

You could modify or extend the wxBrowser to do this but you should
really have a look at extending XRC (have a look at XRCed which comes
with wxPython if you don't know what it is). Even though it doesn't do
*everything* you want it's a good place to start.

An XRC-file is an XML-specification of a wx GUI which can be loaded by
a wxApp to generate a "static" GUI. However, if you want any sort of
functionality to go with your program you're going to have to find a
way to also include the equivalent of HTML script-tags that you can
hook into wx event-handlers. I don't think XRC has that.

Also, last time I looked, XRC is very sensitive so if you do change the
format here and there to include other stuff, make sure to remove it
before you try to parse it in the wxApp (it complains otherwise, or at
least it used to).

The wxBrowser does all of this for you, but at run time, there's
currently no way of packaging it all up in one big XML file that could
be saved as wxPython source. But it's sure doable. I don't know which
is easier but either way, I'm guessing that you're going to have to
write some code of your own.

If you decide to extend/modify the wxBrowser, let me know, I might be
able to help you out.

BR
Johan Lindberg
jo***@pulp.se

PS
You should also ask around at the wxPython-users list
(http://aspn.activestate.com/ASPN/Mai...xPython-users).

Oct 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: commanderblop | last post by:
Hi there, I am in the process of translating an WIndows/ASP/MsSQL Content Managment System (CMS) to Linux/PHP/???. Is there a popular database I can use that will allow standalone files like...
2
by: Lonnie, SRC employee | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** I can figure out how to set the standalone attribute in the <? xml version="1.0 ?> tag eg <?xml version="1.0" standalone="yes" ?> ...
5
by: Robin Johnson | last post by:
Hi, I've written an engine in Javascript for running text adventure games on a web page: http://www.robinjohnson.f9.co.uk/adventure/hamlet.html (That's the only game I've written with it so...
3
by: Marco | last post by:
Hello there, We're new to C# and have noticed a strange behaviour which we don't yet understand. We wrote a COM DLL (in VC++ 6.0) which performs some calculation based on some double arrays...
2
by: rsupansic | last post by:
Please forgive my ignorance in posting the following question. But I have been unable to find a clear answer. I have written a word processor for writing programs in two versions, one which...
1
by: VK | last post by:
It is possibly more suitable to address this question to W3C mailing list, but I'm trying here first. Could anyone comment on <http://www.w3.org/TR/REC-xml/#sec-rmd> The first statement says:...
7
by: tah | last post by:
Hey, Can someone please clarify, confirm, or set me straight on my understanding of a standalone="yes" attribute in the xml version element? I assume it means that the xml document containing it...
2
by: trullock | last post by:
Hi, Here's my problem, hopefully someone can suggest a suitable solution :) I've got a large web application project, in which i want to create a sort of plugin architecture. I'm going to...
4
by: Gabriel Rossetti | last post by:
Hello everyone, I like to create a cross-platform standalone python application, like Mac OS *.app dirs. The idea is to distribute a zip file containing everything (the python interpreter and...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.