GUI definition for web and desktop

  • Thread starter Daniel Fetchinson
  • Start date

D

Daniel Fetchinson

Hi pythoneans,

I'm looking for a simple text based GUI definition format and
associated python modules to work with it that is capable of defining
simple GUI's for *both* the web and the desktop. I have an application
that is accessible through the web and also through desktop
applications and both clients should be presented a simple dialog GUI.
This dialog will only include text fields, radio buttons and a file
upload field. The exact list of fields might change from time to time
which implies that both clients should immediately know about it.

My idea is that if there was a lightweight GUI definition format then
I would define the current list of fields and other GUI elements in
this format, expose this file on the web, and both the web client and
the desktop client would first fetch this file and generate the
appropriate GUI from that dynamically. If the GUI changes I would only
need to modify my definition file and both type of clients would
immediately know about it since before they do anything else they grab
this definition.

I haven't yet decided on the desktop client GUI library, it depends on
which library has such a dynamically generatable interface from a text
file. But it should be cross platform between linux and windows.

What would be the best way to do this?

Cheers,
Daniel
 
Ad

Advertisements

D

Diez B. Roggisch

Daniel said:
Hi pythoneans,

I'm looking for a simple text based GUI definition format and
associated python modules to work with it that is capable of defining
simple GUI's for *both* the web and the desktop. I have an application
that is accessible through the web and also through desktop
applications and both clients should be presented a simple dialog GUI.
This dialog will only include text fields, radio buttons and a file
upload field. The exact list of fields might change from time to time
which implies that both clients should immediately know about it.

My idea is that if there was a lightweight GUI definition format then
I would define the current list of fields and other GUI elements in
this format, expose this file on the web, and both the web client and
the desktop client would first fetch this file and generate the
appropriate GUI from that dynamically. If the GUI changes I would only
need to modify my definition file and both type of clients would
immediately know about it since before they do anything else they grab
this definition.

I haven't yet decided on the desktop client GUI library, it depends on
which library has such a dynamically generatable interface from a text
file. But it should be cross platform between linux and windows.

What would be the best way to do this?

Not doing it. Seriously, the problem lies not so much in rendering a
simple GUI - but the event-system, including things like value-binding
or whatever the principles behind the actual toolkit of choice are called.

Creating an abstraction that takes into account the
differences of both the toolkit and javascript/HTML/DOM is tedious.

That doesn't mean that you won't be able to produce a quick prototype.
But the very moment you start getting serious, problems will crop up
fast. And you'll end up with either something not working the same on
both platforms, or with a very limited subset.

If you really want browser-delivered GUI, the old java applets might be
a better choice - there at least the whole GUI + even-stuff is unified
for stand-alone as well as embedded applets.

Diez
 
K

Kay Schluehr

Hi pythoneans,

I'm looking for a simple text based GUI definition format and
associated python modules to work with it that is capable of defining
simple GUI's for *both* the web and the desktop. I have an application
that is accessible through the web and also through desktop
applications and both clients should be presented a simple dialog GUI.

I'm not sure if this counts as simple but Adobe has specified MXML for
this purpose and there are competing technologies like XUL or XAML.
For the case of MXML Bruce Eckel wrote an article about combining Flex
and Python via XMLRPC a while ago on Artima. There are also new
directions like Adobe AIR and MS Silverlight ( or Mono Moonlight )
whereas the latter supports Python also as a scripting language on the
client side. I'd recommend to type "RIA" in your preferred search
engine.
 
D

Dikkie Dik

.... I have an application
that is accessible through the web and also through desktop
applications and both clients should be presented a simple dialog GUI.
This dialog will only include text fields, radio buttons and a file
upload field.

My idea is that if there was a lightweight GUI definition format then
I would define the current list of fields and other GUI elements in
this format, expose this file on the web, and both the web client and
the desktop client would first fetch this file and generate the
appropriate GUI from that dynamically.

I am very new to Python, and my first python application has a
"cascading" user interface: if enough is given on the command-line, it
sticks to being a command-line app, and if more data is needed, it
presents a GUI. I never did this before, and it taught me a good lesson.

The main thing I learned from it is that the GUI tends to control not
only the input of the application, but also its flow and modularity
structure. I was really glad that I did not include a web interface
(which would not have made any sense in my case). The web applications
are usually totally different because of:
- the stateless nature of HTTP
- the use of HTTP headers (session handlers, redirects, authentication)

So designing a "local" GUI format that can also be used in a web
environment is not really impossible, but hardly practical. For
instance, a "local" GUI can hold information, do some validation and
store the whole input as a batch, or better said, as a transaction.

Web applications do not work this way. Sure, if you rely on javascript
(not a good idea if you want your app to be portable), you can do some
basic validation and even make server calls. But still, a well-designed
web app is more fault tolerant due to the browser variations: In a web
environment, you would store "half" inputs that can be finished later,
where in local applications you would not. Local GUIs do not suffer from
expiring sessions, for example.

So a GUI format is not the main problem. The main problem is the
"nature" of the whole application.

By the way: my User Interface classes did not share a definition file or
something. So a simple user interface like yours could easily be
generated in two varieties, by two different classes or modules. And a
more complex UI would suffer from the difference in nature, so it would
even call for two different client applications.


Best regards
 
S

Stefan Behnel

Daniel said:
I'm looking for a simple text based GUI definition format and
associated python modules to work with it that is capable of defining
simple GUI's for *both* the web and the desktop. I have an application
that is accessible through the web and also through desktop
applications and both clients should be presented a simple dialog GUI. [...]
I haven't yet decided on the desktop client GUI library, it depends on
which library has such a dynamically generatable interface from a text
file. But it should be cross platform between linux and windows.

That sounds a lot like XUL to me. That's the language that Mozilla browsers
use for their GUI. AFAIR, it had Python bindings through XPCOM the last time I
looked into it.

http://www.mozilla.org/why/framework.html

On the other hand, if you want pure HTML for your web app, maybe you should
consider making the desktop app HTML-based, too?

Stefan
 
D

Daniel Fetchinson

I'm looking for a simple text based GUI definition format and
associated python modules to work with it that is capable of defining
simple GUI's for *both* the web and the desktop. I have an application
that is accessible through the web and also through desktop
applications and both clients should be presented a simple dialog GUI. [...]
I haven't yet decided on the desktop client GUI library, it depends on
which library has such a dynamically generatable interface from a text
file. But it should be cross platform between linux and windows.

That sounds a lot like XUL to me. That's the language that Mozilla browsers
use for their GUI. AFAIR, it had Python bindings through XPCOM the last time
I looked into it.

http://www.mozilla.org/why/framework.html

Thanks, I've looked into XUL but it looks too heavyweight to me.
On the other hand, if you want pure HTML for your web app, maybe you should
consider making the desktop app HTML-based, too?

Jorge Godoy brought that up too, sounds pretty good, but how would
that work? The desktop app would launch a mini webserver and the user
would use his/her browser that connnects to the local web server? Or
is there a GUI toolkit library for python which can render html?
 
Ad

Advertisements

S

Stefan Behnel

Hi,

Daniel said:
Jorge Godoy brought that up too, sounds pretty good, but how would
that work? The desktop app would launch a mini webserver and the user
would use his/her browser that connnects to the local web server?

That's a common solution. There's the webbrowser module, which allows you to
start a webbrowser in a platform independent way. The rest would be server driven.

http://docs.python.org/lib/module-webbrowser.html

is there a GUI toolkit library for python which can render html?

At least GTK comes with libgtkhtml, but I bet there are others, too.

http://www.fcoutant.freesurf.fr/python-gtkhtml.html

Stefan
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top