Re: [pygtk] ANNOUNCE: Gaphor 0.5.0

2004-08-26 Thread Arjan Molenaar

Gustavo J. A. M. Carneiro wrote:
A Qua, 2004-08-25 às 07:28, Arjan Molenaar escreveu:
Gaphor 0.5.0
Gaphor is an easy to use UML modeling environment written in Python.
Gaphor has an UML 2.0 compliant data model. It's design is very extensible.

  It would be nice to know the dependencies:
which diacanvas2 version
0.13.0
	which pygtk version
2.0
	which gnome-python version
2.0
	which python version
Should work with 2.2 and 2.3
python setup.py config does some checking.
  Or at least which versions you use for development.
  I tried installing in fedora core 2, and I detected some uncaught
python exceptions.
Can you mail them to me?
  Otherwise, nice work!
Thanks ;-)
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: Re: [pygtk] toggle.set_active( ) will automatically emit the 'toggled' signal. What can I do to stop this?

2004-08-26 Thread Sridhar R
Nikos Kouremenos <[EMAIL PROTECTED]> wrote:
> and just because someone said why I want this..
> I'm writing an GNOME panel applet,  where I make use of this code.
> http://members.hellug.gr/nkour/dcapplet/
> 

OK, just curious to ask.  Is it going to be nice to write applets in
python (or any scripting language).  Normal python apps are fine, but
an applet is supposed to be run throughout the user session and memory
could be wasted for even tiny (applets) apps.


-- 
Sridhar - http://cs.annauniv.edu/~rsridhar
Blog: http://www.livejournal.com/users/sridharinfinity
___
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] toggle.set_active( ) will automatically emit the 'toggled' signal. What can I do to stop this?

2004-08-26 Thread Nikos Kouremenos
Steve McClure wrote:
On Thu, 2004-08-26 at 14:09, Danny Milosavljevic wrote:
 

Hi,
Am Donnerstag, den 26.08.2004, 14:47 +0300 schrieb Nikos Kouremenos:
   

toggle.set_active( False )
toggle.stop_emission('toggled') # doesn't work
 

- Connect the signal only after you called set_active
- Set a flag that you check in your callbacks
   

If you are connecting the signal manually, that is, outside of glade,
such that you have a handle to the signal handler as returned by the
toggle.connect() call, you can:
 

toggle.signal_handler_block(mytogglebuttonhandler)
toggle.set_active(False)
toggle.signal_handler_unblock(mytogglebuttonhander)
 

Yeah I fristly though about having a flag. then I was curious why 
stop_emission doesn't work [and how one should use it and work ok]

the .signal_handler_block/unblock is cool and what I wanted [also 
mentioned in 3.1 {but 3.2 example doesn't make use of it}]
anyways
in gtk2 it's not signal_handler_block/ublock but handler_block/ublock

and I thank you for your help :)
and just because someone said why I want this..
I'm writing an GNOME panel applet,  where I make use of this code.
http://members.hellug.gr/nkour/dcapplet/
___
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] toggle.set_active( ) will automatically emit the 'toggled' signal. What can I do to stop this?

2004-08-26 Thread Steve McClure
On Thu, 2004-08-26 at 14:09, Danny Milosavljevic wrote:
> Hi,
> 
> Am Donnerstag, den 26.08.2004, 14:47 +0300 schrieb Nikos Kouremenos:
> > toggle.set_active( False )
> > toggle.stop_emission('toggled') # doesn't work
> 
> - Connect the signal only after you called set_active
> - Set a flag that you check in your callbacks

If you are connecting the signal manually, that is, outside of glade,
such that you have a handle to the signal handler as returned by the
toggle.connect() call, you can:

toggle.signal_handler_block(mytogglebuttonhandler)
toggle.set_active(False)
toggle.signal_handler_unblock(mytogglebuttonhander)

I have used this technique most often when two widgets are
interdependent and I need to programmatically set them up. I had the
same problems, in those cases, with respect to my inability to get
widget.emit_stop_by_name() to work like I thought it should.

I'm using PyGtk 0.6.9 so I apologize if the API has changed in GTK 2.x

> 
> What are you trying to do, that you need to break signaling
> semantics ? :)
> 
> cheers,
>Danny
> 
> 
> __
> ___
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure   Racemi
email: [EMAIL PROTECTED]75 5th St NE
voice: 404-892-5850 Suite 214
fax: 404-892-7215   Atlanta, GA 30308
http://www.racemi.com

___
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] toggle.set_active( ) will automatically emit the 'toggled' signal. What can I do to stop this?

2004-08-26 Thread Danny Milosavljevic
Hi,

Am Donnerstag, den 26.08.2004, 14:47 +0300 schrieb Nikos Kouremenos:
> toggle.set_active( False )
> toggle.stop_emission('toggled') # doesn't work

- Connect the signal only after you called set_active
- Set a flag that you check in your callbacks

What are you trying to do, that you need to break signaling
semantics ? :)

cheers,
   Danny



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
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] Segfault when resizing TreeViewColumn

2004-08-26 Thread Guilherme Salgado
On Thu, 2004-08-26 at 14:05, Jon Ellis wrote:
> I am having trouble with gtk segfaulting when I resize a TreeViewColumn 
> under certain conditions.  Attached is a sample demonstrating this 
> behavior.
> 
Hi Jon,

this looks like bug #147913
.

cheers, 
Guilherme


-- 
This email has been inspected by Hans Blix, who has reported that no
weapons of mass destruction were used in its construction. 
Read his report here:


___
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] Segfault when resizing TreeViewColumn

2004-08-26 Thread Jon Ellis
I am having trouble with gtk segfaulting when I resize a TreeViewColumn 
under certain conditions.  Attached is a sample demonstrating this 
behavior.

If you launch the sample, and try to resize the TreeViewColumns when 
nothing in the TreeView is selected, it segfaluts.  However, if you 
first select something from the TreeView, and then resize the column, 
everything works perfectly.  I know that something in _onCursorChanged 
is causing this, but I can't quite figure out why.  If you remove 
time.sleep from _onCursorChanged, everything works fine.  Or you can 
remove the while loop, and everything will work also.  For some reason 
when I have a process that takes a good second or so, and then try to 
call gtk.main_iteration(), it segfaults.

I have tested this on pyGTK 2.3.92 as well as 2.0.0.  Any help would be 
greatly appreciated!

--
Jon Ellis <[EMAIL PROTECTED]>
import gtk, gobject
import time
def _onWindowDestroy(*args):
gtk.main_quit()

def _onCursorChanged(tree):
time.sleep(1)
while gtk.events_pending():
gtk.main_iteration()

def BuildGUI():
window = gtk.Window()
window.connect('destroy', _onWindowDestroy)
window.set_default_size(400,300)

tree = gtk.TreeView()
model = gtk.TreeStore(gobject.TYPE_STRING,
  gobject.TYPE_STRING)

tree.set_model(model)
tree.connect('cursor-changed', _onCursorChanged)

column = gtk.TreeViewColumn('Column1', gtk.CellRendererText(), markup=0)
column.set_resizable(True)
tree.append_column(column)

tree.set_model(model)
column = gtk.TreeViewColumn('Column2', gtk.CellRendererText(), markup=1)
column.set_resizable(True)
tree.append_column(column)

window.add(tree)
tree.show()

window.show()
iter = model.append(None)
model.set(iter,
  0, 'Test1',
  1, 'Test2')



BuildGUI()
gtk.main()
___
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] Text handling within PyGTK questions

2004-08-26 Thread Art Haas
On Thu, Aug 26, 2004 at 12:09:58PM +0100, Gustavo J. A. M. Carneiro wrote:
> A Qua, 2004-08-25 ?s 23:09, Art Haas escreveu:
> > Hi.
> > 
> > My PythonCAD work has lately been in dealing with text, and I'm turning
> > to the list in an effort to get some suggestions and help.
> > 
> > The root of my difficulties is the way I'm trying to define and
> > handle text sizes. I want the text size in a drawing to be defined
> > as a floating point value, say 2.5 inches high, instead of defining the
> > text size in points. As you zoom in and zoom out of the drawing,
> > the size of the text should change. If you are zoomed into a region
> > with a text blob, the text lettering should look larger, and as you
> > zoom out the lettering gets smaller.
> > 
> > Part of the problem I'm having is that PyGTK is missing a few Pango
> > methods that allow for a more detailed inspection of the pango.Layout
> > instances. The get_line(), get_lines(), and get_iter() methods are
> > not currently available, and each would be immensely useful when
> > determining the positioning of text. My C skills are lacking in the
> > ability to submit a patch to provide these missing routines, but even if
> > they were to appear in the next release of PyGTK, I'm still stuck in
> > that the routines are not in the prior releases. BTW, these routines
> > are used when the pango.Layout instance contains multiple lines of text.
> 
>   The API for PyGTK 2.4 is frozen, but if you open a bug report we might
> add those methods for PyGTK 2.6.
 
I'll add in a bug report for these missing methods shortly.

>   In the mean time, though, you could try to split text yourself in
> multiple lines, and put each line on a separate pango layout.  Not an
> ideal solution, but at least compatible with current pygtk.  Otherwise
> you'd have to build your own extension module with those functions,
> independent of pygtk, and ship with your application.  Or file a bug
> report and wait 6 months. :-)

Splitting the text up into individual lines is probably the best option
I can see right now. As PythonCAD text handling will still be dealing
with relatively simple ascii text, I can test the text for multiple
lines by splitting on "\n" or "\r" characters.

> > The pango module does currently provied get_line_count(), get_size(),
> > and get_pixel_size() methods for pango.Layout instances, and these
> > methods are indespensible for determining the size of some blob of text.
> > I've found, though, that the ratio of the width and height values of
> > a Layout change as the font size changes. That is, if you call
> > get_size() on a layout defined for a small font size, their ratio will
> > not be the same as if the font size was larger, and this behavior
> > is causing me problems. What I really want to do is to calculate the
> > width of some text given a particular font family, font weight, and
> > font style. What I'd been trying to do is calculate the width and
> > height of some text at a given font size, say 18 pts, and then
> > use those values to calculate the width. I'd calculate the width
> > of the text by assuming the ratio of width/height in pango units
> > is the same as it would be in the units I'm interested in, such
> > as millimeters or inches, and via basic algebra determine the
> > text width. This approach is not working, as the ratio is
> > variable, and I'm a bit stumped on what else to try. Suggestions on 
> > other approaches to calculating text width welcomed.
> 
>   Don't ever[1] try to guess the text width given font description and
> text string.  As you found out, the results are not accurate.  That is
> because of hinting, which adjusts both size and position of text on
> screen.

So I've seen. :-)

> Why can't you just create a pango layout and ask for its size, even
> without rendering it?

That's what my latest attempt at getting the text sizing to work have
done. I build a layout of some text assuming an 18 point font, and get
the size, but I don't draw this layout on the screen. I use the result
to calculate the width, but then when I try to draw on the screen using
the scaled font size, things go haywire. It's probable that a bug or two
in my code is also messing things up, and I'll be bug hunting in the
coming days.

Art
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
___
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] Text handling within PyGTK questions

2004-08-26 Thread Art Haas
On Wed, Aug 25, 2004 at 10:34:12PM -0700, Andrew P. Lentvorski, Jr. wrote:
> 
> On Aug 25, 2004, at 3:09 PM, Art Haas wrote:
> 
> >The pango module does currently provied get_line_count(), get_size(),
> >and get_pixel_size() methods for pango.Layout instances, and these
> >methods are indespensible for determining the size of some blob of 
> >text.
> 
> Actually, you might want to go down to the level of using Freetype
> directly rather than through Pango.  Unfortunately, I don't know
> of any good wrappers for Freetype in Python.

I've got to stick with Python, so interfacing to Freetype is not
possible unless a wrapper exists.

> >I'm certain that text scaling problems like the ones I'm dealing with
> >have occured before, and I'm hoping that some of the list readers can
> >share a little of that knowledge. Thanks in advance.
> 
> These problems have occurred before, but the professional packages
> I have seen dodged the issue by having their own vector fonts and their
> own font renderers.

Another option I can't take. I never liked the stick-figure fonts in
the CAD packages I'd used (ME-10 mostly, AutoCAD long ago).

Art
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
___
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] install a gconf schemas with distutils

2004-08-26 Thread Guillaume Desmottes
Hi!

I would like to use distutils to install a gconf schemas.

The distutils doc is very poor and I don't understand how to make that.

The 'manual' command is: 
GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2
--makefile-install-rule my_file.schemas 

Thanks a lot.

G.


-- 
Guillaume Desmottes <[EMAIL PROTECTED]>
Jabber <[EMAIL PROTECTED]>
GPG 1024D/711E31B1 | 1B5A 1BA8 11AA F0F1 2169  E28A AC55 8671 711E 31B1



signature.asc
Description: Ceci est une partie de message	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e=2E?=
___
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] toggle.set_active( ) will automatically emit the 'toggled' signal. What can I do to stop this?

2004-08-26 Thread Nikos Kouremenos
toggle.set_active( False )
toggle.stop_emission('toggled') # doesn't work
thanks
___
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] Text handling within PyGTK questions

2004-08-26 Thread Gustavo J. A. M. Carneiro
A Qua, 2004-08-25 às 23:09, Art Haas escreveu:
> Hi.
> 
> My PythonCAD work has lately been in dealing with text, and I'm turning
> to the list in an effort to get some suggestions and help.
> 
> The root of my difficulties is the way I'm trying to define and
> handle text sizes. I want the text size in a drawing to be defined
> as a floating point value, say 2.5 inches high, instead of defining the
> text size in points. As you zoom in and zoom out of the drawing,
> the size of the text should change. If you are zoomed into a region
> with a text blob, the text lettering should look larger, and as you
> zoom out the lettering gets smaller.
> 
> Part of the problem I'm having is that PyGTK is missing a few Pango
> methods that allow for a more detailed inspection of the pango.Layout
> instances. The get_line(), get_lines(), and get_iter() methods are
> not currently available, and each would be immensely useful when
> determining the positioning of text. My C skills are lacking in the
> ability to submit a patch to provide these missing routines, but even if
> they were to appear in the next release of PyGTK, I'm still stuck in
> that the routines are not in the prior releases. BTW, these routines
> are used when the pango.Layout instance contains multiple lines of text.

  The API for PyGTK 2.4 is frozen, but if you open a bug report we might
add those methods for PyGTK 2.6.

  In the mean time, though, you could try to split text yourself in
multiple lines, and put each line on a separate pango layout.  Not an
ideal solution, but at least compatible with current pygtk.  Otherwise
you'd have to build your own extension module with those functions,
independent of pygtk, and ship with your application.  Or file a bug
report and wait 6 months. :-)

> 
> The pango module does currently provied get_line_count(), get_size(),
> and get_pixel_size() methods for pango.Layout instances, and these
> methods are indespensible for determining the size of some blob of text.
> I've found, though, that the ratio of the width and height values of
> a Layout change as the font size changes. That is, if you call
> get_size() on a layout defined for a small font size, their ratio will
> not be the same as if the font size was larger, and this behavior
> is causing me problems. What I really want to do is to calculate the
> width of some text given a particular font family, font weight, and
> font style. What I'd been trying to do is calculate the width and
> height of some text at a given font size, say 18 pts, and then
> use those values to calculate the width. I'd calculate the width
> of the text by assuming the ratio of width/height in pango units
> is the same as it would be in the units I'm interested in, such
> as millimeters or inches, and via basic algebra determine the
> text width. This approach is not working, as the ratio is
> variable, and I'm a bit stumped on what else to try. Suggestions on 
> other approaches to calculating text width welcomed.

  Don't ever[1] try to guess the text width given font description and
text string.  As you found out, the results are not accurate.  That is
because of hinting, which adjusts both size and position of text on
screen.
  Why can't you just create a pango layout and ask for its size, even
without rendering it?

  Regards.


[1] except for speed/accuracy tradeoff in complex layout algorithms

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic

___
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] ComboBoxEntry not shown correctly after second call of the thread

2004-08-26 Thread Martin . Zohlhuber
Hello 

I run my (whole) gui in one thread. 
If i start the thread again (after i had it closed), the entry of the 
ComboBoxEntry will not shown (only the button to open the list - but the 
list is not visible). Same problem with the old Combo (nothing visible). 
Combobox (without Entry) works correct. 

I add a example below. Close the first window within 3 seconds and wait 
until second combo get visible. (If you do not close the first window 
within 3 Seconds, the second box does not  become visible  until you close 
the first (but then you will see it without failure)). 

What's wrong ? Is this a bug ? 

Thanks 
martin


I use: 
Win 2k
gtk.2.4
pygtk 2.3.96

---
import gtk
import sys
import threading
import time

class My_App (threading.Thread) :
def __init__ (self) :
threading.Thread.__init__ (self)

def cb (self, widget) :
gtk.main_quit ()

def run (self) :
gtk.threads_enter()
w = gtk.Window ()
w.connect("destroy", self.cb)
liststore = gtk.ListStore(str)
liststore.append (["text_a"])
liststore.append (["text_b"])
combobox = gtk.ComboBoxEntry(liststore, 0)
##  combobox = gtk.ComboBox(liststore) ## works
cell = gtk.CellRendererText()
combobox.pack_start(cell, True)
combobox.add_attribute(cell, 'text', 0)
c = combobox
w.add (c)
w.show_all ()
gtk.main ()
gtk.threads_leave()

def _test () :
thread = My_App ()
thread.start ()

def _duo_test () :
_test ()
time.sleep (3)
_test ()
 
if __name__ == "__main__":
#_test ()
_duo_test ()
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/