[pygtk] Re: [DiaCanvas] Affine transformations in Python

2003-07-16 Thread Arjan J. Molenaar
On Tue, 2003-07-15 at 17:16, Martin Soto wrote:
 Hi all!
 
 Is there a simple way to create and manipulate affine transformation
 matrices in Python?  Of course, I could write my own algorithms, but
 it'd be nice to have the basic operations there.  I'm I missing
 something?

Hi,

I remember somebody wrote python bindings for libart once, but I don't
know where they are.

Has some on the pygtk-list an idea?

Thanks,

Arjan

 Thanks,
 
 M. S.

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] ANNOUNCE: Gaphor 0.2.0

2003-04-04 Thread Arjan J. Molenaar
Application
===

Gaphor 0.2.0

Description
===
Gaphor is an UML modeling tool written in Python. It is designed to be
extensible and easy to use.

Enhancements


It's been a while ago since 0.1.0 was announced. In the mean time a lot
has changed:
- Gaphor is completely written in Python
- Supports Class and UseCase diagrams
- UML meta-model based datamodel

Requirements


- GNOME2 libraries
- Gnome-Python 1.99.16
- DiaCanvas2 0.9.2

Download


http://sourceforge.net/projects/gaphor

Homepage


http://gaphor.sourceforge.net

Have fun,

Arjan


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] GenericTreeModel problems

2002-12-31 Thread Arjan J. Molenaar
On Sun, 2002-12-29 at 19:18, David M. Cook wrote:
 On Sun, Dec 29, 2002 at 12:25:09PM +0100, Arjan J. Molenaar wrote:
 
  I have no problem with the GenericTreeModel. I use it in Gaphor
  (http://gaphor.sf.net) and even use editable cells (with an icon).
 
 Thanks, that looks interesting.  I'm particularly curious about what the
 leak_references property does.  However, you only seem to have 1 column in
 your tree and some of my problems are related to having multiple columns.

leak_references does what it says ;-): leak references. As you know, the
TreeModel makes heavy use of iterators. One of the not so nice things
about those iterators is that they get destroyed without any
notification. leak_references == 1 will keep a reference on the Python
object that works as the iterator. This might cause reference count
leaks (and therefore memory leaks). when leak_references == 0, the
Python object that works as the iterator is dereferenced (so it becomes
a weak reference). Problem is that your tree model has to keep track of
the iterators, otherwise you get a segmentation fault. I hope this
explains it a little bit (I'm not in a very explainory mood today ;-).

 I'm getting so frustrated with it, I'm actually thinking of rewriting the
 app in Jython/Swing.

Make sure your model and view expect the same things, as I did with the
NamespaceView.

Regards,

Arjan


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] GenericTreeModel problems

2002-12-29 Thread Arjan J. Molenaar
On Sun, 2002-12-29 at 03:49, David M. Cook wrote:
 I've uploaded a tarball, mytreemodel.tgz, of a pygtk program and a README
 describes some of the problems I'm seeing to
 
   http://davidcook.org/pygtk
   
 Dave

I have no problem with the GenericTreeModel. I use it in Gaphor
(http://gaphor.sf.net) and even use editable cells (with an icon).

Take a look at namespace.py (in gaphor/ui:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/gaphor/gaphor/gaphor/ui/namespace.py?rev=1.15content-type=text/vnd.viewcvs-markup)
 and take a look at the NamespaceModel and NamespaceView classes. For editing stuff 
the NamespaceView in interesting.

Regards,

Arjan


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] debian packages

2002-12-25 Thread Arjan J. Molenaar
Hi,

Has anybody created Debian packages for gnome-python on Woody (3.0).

Regards,

Arjan


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] Bonobo reference problem

2002-11-05 Thread Arjan J. Molenaar
On Tue, 2002-11-05 at 15:11, James Henstridge wrote:
 Arjan J. Molenaar wrote:
 
 Thank you for the bug report.  I have updated pyorbit to fix the 
 problem.  The pycorba_object_new() function used to create a wrapper for 
 a CORBA object didn't duplicate the object reference (which all of the 
 other APIs in pyorbit do).  The bonobo bindings were assuming the 
 function did duplicate the objref, which caused the problems.
 
 I have updated pyorbit so that the API is consistent with the rest of 
 the pyorbit API, which stops your example from crashing.

Great! Now Gaphor work (almost) out of the box ;-). May I remind you
that there is still a patch pending that fixes a referencing bug in
Gnome.ui.About dialog. It's in bugzilla... Can't contact
bugzilla.gnome.org for some reason, so I can't provide you the bug id
:-(

Thanks,

Arjan


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] Bonobo reference problem

2002-11-03 Thread Arjan J. Molenaar
Hi,

I'm experiencing problems when I try to close a window by pressing the
upper-right close button on the window title bar.

This small app exposes the bug:

import pygtk
pygtk.require('2.0')
import gtk, bonobo, bonobo.ui

def init():
window = bonobo.ui.Window ('Title', 'test')
window.set_size_request(100, 100)
window.show_all ()
ui_container = window.get_ui_container ()
engine = window.get_ui_engine ()
engine.config_set_path ('/hello-app/UIConfig/kvps')
ui_component = bonobo.ui.Component ('test')
ui_component.set_container (ui_container.corba_objref ())

init()
bonobo.main()


It's basically the same problem I had with orbit-python, but I can't
figure out what the *real* problem is...

Any help would be appreciated.

Regards,

Arjan

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] DND in GtkTreeModel/View

2002-10-19 Thread Arjan J. Molenaar
Hi,

I've been wondering... Lately I have implemented some DND functionallity
in my app (Gaphor) and I noticed that you can handle DND from the
GtkTreeModel by means of the GtkTreeDragSource and DragDest interfaces.
These interfaces are not implemented for the current GtkGenericTreeModel
class. Does it make sense to implement these?

Regards,

Arjan



___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] GCC with -ansi option

2002-01-31 Thread Arjan J. Molenaar

Hi,

I'm having some trouble compiling PyGTK from CVS. I get errors like
these:

/gnome/head/INSTALL/include/glib-2.0/glib/gmessages.h:108:
warning: invalid character in macro parameter name

The remedy seems to be removing the '-ansi' flag from the CFLAGS
attribute. AKAIK the '...' in macro definitions is a GCC specific
feature, therefore setting '-ansi' will error on those statements.
Note that I did not configure GLib with the --enable-ansi option.

I noticed this flag is explicitly set in configure.in (line 129). It
should not be set if GLib is not compiled with ansi-compliance.

Regards,

Arjan

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] Freeing GObjects in Python

2002-01-31 Thread Arjan J. Molenaar

Hi,

I'm using PyGTK (2.0) to do the graphical representation in a UML modeling
tool (http://gaphor.sourceforge.net). I have created a small demo setup in
a test program like this:
+ Model node
  + Package
+ Actor (data element)
+ UseCase (data element)
+ Diagram

The diagram holds a DiaCanvas canvas inside, with two canvas items: one
referencing the actor and one to the use case.

Here comes my problem: If I remove all references to the data structure,
no objects seem to be freed (at least the objects in the canvas are not freed).
is it possible to wrap the canvas is such a way that it can be freed using
the garbage collector? I noticed that the PyGObject has the HAVE_GC flag set.

As it is now, the canvas object will only free itself if an explicit
del diagram.canvas is done. It looks like the wrapper will not free the
object, even if it holds only one reference...

What can I do about this?

Regards,

Arjan

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] Patch: GtkTreeModel and refenecing objects

2002-01-31 Thread Arjan J. Molenaar

Hi,

I've created a patch that adds a 'leak_references' property to the
GenericTreeModel. Turning this feature off (default is on, the old
behaviour) will always decrement the refcount on PyObjects. This will
prevent memory/refcnt leaks from happening. The Model should ensure that
objects which are user as iterator are not destroyed before the iterator
is destroyed.

This sounds a bit silly, but there are no other way, unless we get to
know when a iterator is being removed...

Regards,

Arjan




? x
Index: ChangeLog
===
RCS file: /cvs/gnome/gnome-python/pygtk/ChangeLog,v
retrieving revision 1.347
diff -u -r1.347 ChangeLog
--- ChangeLog   2002/01/31 08:32:24 1.347
+++ ChangeLog   2002/01/31 15:20:04
@@ -1,3 +1,14 @@
+2002-01-31  Arjan Molenaar  [EMAIL PROTECTED]
+
+   * gtk/pygtktreemodel.h: Added attribute leak_references to
+   PyGtkGenericTreeModel.
+   * gtk/pygtktreemodel.c: Added property `leak_references'. This will
+   toggle the leak_references attribute (default TRUE: old behaviour)
+   Implemented `leak_references': a Python object will always be
+   deferenced if it is set on an iterator. This will prevent memory/refcnt
+   leaks, but the model should always be sure there is a refenence to the
+   iterator object.
+
 2002-01-31  James Henstridge  [EMAIL PROTECTED]
 
* configure.in: increment version number of package and
Index: gtk/pygtktreemodel.c
===
RCS file: /cvs/gnome/gnome-python/pygtk/gtk/pygtktreemodel.c,v
retrieving revision 1.6
diff -u -r1.6 pygtktreemodel.c
--- gtk/pygtktreemodel.c2001/10/09 04:05:33 1.6
+++ gtk/pygtktreemodel.c2002/01/31 15:20:07
@@ -11,10 +11,27 @@
 /* define this to print out debug messages */
 #undef DEBUG_TREE_MODEL
 
+#ifndef _
+# define _(s) (s)
+#endif
+
+enum {
+PROP_LEAK_REFERENCES = 1
+};
+
 static void pygtk_generic_tree_model_class_init(PyGtkGenericTreeModelClass *klass);
 static void pygtk_generic_tree_model_init(PyGtkGenericTreeModel *self);
 static void pygtk_generic_tree_model_iface_init(GtkTreeModelIface *iface);
 
+static void pygtk_generic_tree_model_set_property (GObject *object,
+  guint property_id,
+  const GValue *value,
+  GParamSpec *pspec);
+static void pygtk_generic_tree_model_get_property (GObject *object,
+  guint property_id,
+  GValue *value,
+  GParamSpec *pspec);
+
 GType
 pygtk_generic_tree_model_get_type(void)
 {
@@ -51,6 +68,22 @@
 static void
 pygtk_generic_tree_model_class_init(PyGtkGenericTreeModelClass *klass)
 {
+GObjectClass *object_class = (GObjectClass*) klass;
+
+object_class-get_property = pygtk_generic_tree_model_get_property;
+object_class-set_property = pygtk_generic_tree_model_set_property;
+
+g_object_class_install_property (object_class,
+PROP_LEAK_REFERENCES,
+g_param_spec_boolean (leak_references,
+ _(Leak references),
+ _(Enable referencing iterator 
+   objects (this will cause a memory leak or at least a reference 
+   counting leak). You might need it though, if you return newly 
+   created objects.),
+ TRUE,
+ G_PARAM_READWRITE));
+
 }
 
 static guint pygtk_generic_tree_model_get_flags(GtkTreeModel *tree_model);
@@ -102,8 +135,38 @@
 static void
 pygtk_generic_tree_model_init(PyGtkGenericTreeModel *self)
 {
+self-leak_references = TRUE;
+}
+
+static void
+pygtk_generic_tree_model_set_property (GObject *object, guint property_id,
+  const GValue *value, GParamSpec *pspec)
+{
+switch (property_id) {
+case PROP_LEAK_REFERENCES:
+   PYGTK_GENERIC_TREE_MODEL (object)-leak_references = g_value_get_boolean 
+(value);
+   break;
+default:
+   G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+   break;
+}
 }
 
+static void
+pygtk_generic_tree_model_get_property (GObject *object, guint property_id,
+  GValue *value, GParamSpec *pspec)
+{
+switch (property_id) {
+case PROP_LEAK_REFERENCES:
+   g_value_set_boolean (value,
+   PYGTK_GENERIC_TREE_MODEL (object)-leak_references);
+   break;
+default:
+   G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+   break;
+}
+}
+
 PyGtkGenericTreeModel *
 pygtk_generic_tree_model_new(void)
 {
@@ -224,6 +287,9 @@
 if (py_ret) {
if (py_ret !=