Re: Provide a python script to dia on the command line
- From: Martin Metzker <martinmetzker gmx net>
- To: discussions about usage and development of dia <dia-list gnome org>
- Subject: Re: Provide a python script to dia on the command line
- Date: Thu, 11 Sep 2014 21:31:21 +0200
Hi Hans,
I'm having "dia_is_interactive = FALSE" if the -i option is provided,
however I already have half a mind to remove this limitation, but
there are
implications to consider first.
Could elaborate a bit more about the implications? Or is it just that
you don't have a use case yet?
There are use cases. For now, I have a python script to create a new
diagram and then I open it right away to edit. So I would actually have
the use case "start dia interactively with a new diagram based on an a
selection from an existing one". I also have "start dia interactively
with a new diagram created from json strings".
On possible implications:
* The python scripts have the full power of the python console
available, including creating of diagrams and sheets. But, at the time
the python script is run, the GUI is not yet initialized. The script
could break some assumptions the GUI makes.
* The same holds for diagrams opened and modified, or even deleted, by
the script, before the GUI tries to open them, presumably for the first
time. Especially Windows and opening a file more than once is fun ...
* I also don't know what the python console does when it initializes.
There may be side effects as well.
These were the first things that came to mind and made me delay the idea.
On big visions: A python script could start a thread or two with sockets
and watchdogs and message queues. If done right, modifying a model
through the view provided by dia could trigger messages sent to agents.
One the one hand, this could perform immediate online synchronisation of
objects across multiple diagrams and even dia instances -> concurrent
collaborative editing. On the other hand, this could make dia a generic
GUI for monitoring and configurations (think network). At the same time,
it could export reports or "simply" images for documentations.
Also, I often get tarballs of source code which I would love to just
extract, cd into, and open a diagram such as
samples/Self/PyDiaObjects.dia. This would make me less dependent on the
documentation and illustrations (!) I am provided.
... have you ever taken the time to appreciate the value of a decent
usable canvas with a sensible API, let alone one as highly evolved,
robust and long lived, i.e. maintained, such as dia's?
not ok. To avoid this please use dia_plugin_get_symbol().
Will do.
ok, though I would prefer another short option, maybe -r and
--run-script instead of --python?
Will do.
IMO the patch is not too big to be discussed (and finally be applied) in
one piece.
That's nice to know. Sometimes it feels like people are downright
insulted by a single patch that modifies more than one file ...
Haven't tried it yet. But with the above mentioned changes I'm fine with
including it with standard Dia, if there are no unforeseen implications.
For non-interactive dia this seems ok, for interactive, see above.
I'll try to get out a new patch tomorrow.
Cheers
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]