Re: [pygtk] (no subject)

2011-09-25 Thread Timo

On 24-09-11 19:34, Kristen Eisenberg wrote:

[pygtk] pygtk Digest, Vol 99, Issue 1

Hello,
>>
>> I'm fairly new to PyGTK. Just getting started. I've worked with 
wxPython
>> in the past. I'm trying to create a grid of clickable images. Like 
this one:

>> http://getmoviemonkey.com/img/screen1.jpg
>>
>> I managed to get the image grid using IconView. But, i need to do a 
little

>> more:
>> 1) I don't want the blue high-light
>>
> Looking at the reference manual [1], this could be possible with style
> property "selection-box-color".

I checked that property earlier. It said read-only. How do i change its
value ?
This message should help: 
http://www.daa.com.au/pipermail/pygtk/2011-March/019562.html


Maybe you could manage some things using custom rc styles if the above 
doesn't work.


Cheers,
Timo




Kristen Eisenberg
Billige Flüge
Marketing GmbH
Emanuelstr. 3,
10317 Berlin
Deutschland
Telefon: +49 (33)
5310967
Email:
utebachmeier at
gmail.com
Site:
http://flug.airego.de- Billige Flüge vergleichen


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] (no subject)

2010-03-03 Thread Neil Muller
On 3 March 2010 14:28, PEYMAN ASKARI  wrote:
> Hello
>
> Does anyone know how to limit the number of tabs in a notebook, much like
> gedit does?

I think you want to look at gtk.Notebook's set_scrollable method. I
also suggest looking at enable_popup.

-- 
Neil Muller
drnlmul...@gmail.com

I've got a gmail account. Why haven't I become cool?
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] (no subject)

2008-12-03 Thread John Ehresman
[EMAIL PROTECTED] wrote:
> Hi all--
> 
> I am getting an usual crash with my pyGtk application.  This gets printed to 
> the stdout:
> 
> **
> ** Gdk:ERROR:(gdkregion-generic.c:1082):miUnionNonO: assertion failed: (y1 < 
> y2)

This is deep in gdk code and should be reported in bugzilla, preferably 
with a test case that triggers the bug.  gdk is a component of the gtk C 
library.

Cheers,

John
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] (no subject)

2008-06-27 Thread John Stowers
On Thu, 2008-06-26 at 20:58 -0700, dan blum wrote:
> How do you add an gtk.Editable interface to gtk.Entry created in
> Glade?

gtk.Entry already implements gtk.Editable. What do you want to do?

John

> 
> Thanks for your help.
> 
> Dan Blum
> 
> 
> ___
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

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


RE: [pygtk] (no subject)

2007-11-16 Thread McBride, Nathan
For some reason presendt() didn't work for me.  It didn't give me an error or 
anything, just nothing happened.

What I ended up getting to work is:

To hide the window:
   self.window.set_skip_taskbar_hint(True)
   self.window.iconify()

And to unhide:
   self.window.deiconify()
   self.window.set_skip_taskbar_hint(False) 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Julio Carlos 
Menéndez
Sent: Thursday, November 15, 2007 6:10 PM
To: pygtk@daa.com.au
Subject: Re: [pygtk] (no subject)

This code is working propertly, i use present to bring back the window because 
according to the documentation of pygtk:

"The present() method presents a window to the user. This may mean raising the 
window in the stacking order, deiconifying it, moving it to the current 
desktop, and/or giving it the keyboard focus, possibly dependent on the user's 
platform, window manager, and preferences. If the window is hidden, this method 
calls the the gtk.Widget.show() method as well. This method should be used when 
the user tries to open a window that's already open. Say for example the 
preferences dialog is currently open, and the user chooses Preferences from the 
menu a second time; use the present() method to move the already-open dialog 
where the user can see it."

So, here is the code for what I guess you want:

import pygtk
pygtk.require('2.0')
import gtk

class Application(object):
def __init__(self):
self.statusicon = gtk.status_icon_new_from_stock('gtk-about')
self.statusicon.set_visible(True)
self.statusicon.connect('activate', self.on_activate)
self.window = gtk.Window()
self.window.connect('delete-event', self.on_delete_event)
self.window.show_all()

def on_activate(self, widget, data=None):
if self.window.get_property('visible'):
self.window.hide()
else:
self.window.present()

def on_delete_event(self, widget, data=None):
self.statusicon.set_visible(False)
gtk.main_quit()

if __name__ == '__main__':
app = Application()
gtk.main()

Greetings.

On Thu, 15 Nov 2007 17:21:41 -0500
"McBride, Nathan" <[EMAIL PROTECTED]> wrote:

> Actually, it doesn't seem to be re-creating the window after all.
> However, I can't seem to figure out how to bring the window back.
> 
> I have tried:
> 
> self.window.show()
> self.window.deiconify()
> self.window.ahow_all()
> 
> What is the correct way to do this?
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf Of Julio Carlos Menéndez Sent: Thursday, November 15, 2007
> 4:08 PM To: pygtk@daa.com.au
> Subject: Re: [pygtk] (no subject)
> 
> If you put all this code:
>   
> statusIcon = gtk.StatusIcon()
> 
> menu = gtk.Menu()
> menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
> menuItem.connect('activate', icon_show_about)
> menu.append(menuItem)
> menuItem = gtk.SeparatorMenuItem()
> menu.append(menuItem)
> menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
> menuItem.connect('activate', quit_cb, statusIcon)
> menu.append(menuItem)
> 
> # statusIcon.set_from_stock(gtk.STOCK_HOME)
> statusIcon.set_from_file("pixmaps/dmcal.png")
> statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite")
> statusIcon.connect('activate', activate_icon_cb)
> statusIcon.connect('popup-menu', popup_menu_cb, menu)
> statusIcon.set_visible(True)
> 
> inside the __init__ method and every method you create should have the 
> syntax '(self,)' to make it an instance 
> method. Doing all that you should be able to use any 
> self.
> 
> The method should be like this:
> def activate_icon_cb(self, widget):
> if self.window.visible():
>   self.window.hide()
> else:
> self..window.show()
> 
> Hope this works for you.
> 
> On Thu, 15 Nov 2007 13:15:35 -0500
> "McBride, Nathan" <[EMAIL PROTECTED]> wrote:
> 
> > run the program and the main window comes up with the status icon.
> > When I minimize the window, instead of minimizing it, it hides it.
> > So the window is gone but the icon is still in the tasktray.
> > (minimizing to tasktray) What I am trying to accomplish is that when 
> > you click the tasktray icon then the window unhides and comes back.
> > 
> > everything works flawlessly except i can't get:
> > 
> > def activate_icon_cb(widget, data = None):
> > pass
> > 
> > to have access to self.window from the __init__ to run the 
> > self.window.show(). I'have tried s

RE: [pygtk] (no subject)

2007-11-15 Thread McBride, Nathan
I originally had tried that.  However what it did was, when ever I clicked 
anywhere in the icon or any menu link, it aparently re-ran __init__ which in 
turn created another main window.  Any thoughts?


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Julio Carlos 
Menéndez
Sent: Thursday, November 15, 2007 4:08 PM
To: pygtk@daa.com.au
Subject: Re: [pygtk] (no subject)

If you put all this code:
  
statusIcon = gtk.StatusIcon()

menu = gtk.Menu()
menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
menuItem.connect('activate', icon_show_about)
menu.append(menuItem)
menuItem = gtk.SeparatorMenuItem()
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
menuItem.connect('activate', quit_cb, statusIcon)
menu.append(menuItem)

# statusIcon.set_from_stock(gtk.STOCK_HOME)
statusIcon.set_from_file("pixmaps/dmcal.png")
statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite")
statusIcon.connect('activate', activate_icon_cb)
statusIcon.connect('popup-menu', popup_menu_cb, menu)
statusIcon.set_visible(True)

inside the __init__ method and every method you create should have the syntax 
'(self,)' to make it an instance method. Doing all 
that you should be able to use any self.

The method should be like this:
def activate_icon_cb(self, widget):
if self.window.visible():
self.window.hide()
else:
self..window.show()

Hope this works for you.

On Thu, 15 Nov 2007 13:15:35 -0500
"McBride, Nathan" <[EMAIL PROTECTED]> wrote:

> run the program and the main window comes up with the status icon.
> When I minimize the window, instead of minimizing it, it hides it. So 
> the window is gone but the icon is still in the tasktray. (minimizing 
> to tasktray) What I am trying to accomplish is that when you click the 
> tasktray icon then the window unhides and comes back.
> 
> everything works flawlessly except i can't get:
> 
> def activate_icon_cb(widget, data = None):
> pass
> 
> to have access to self.window from the __init__ to run the 
> self.window.show(). I'have tried setting it up like:
> 
> def activate_icon_cb(self, widget, data = None):
> pass
> 
> # statusIcon.set_from_stock(gtk.STOCK_HOME)
> statusIcon.set_from_file("pixmaps/dmcal.png")
> statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite") 
> statusIcon.connect('activate', activate_icon_cb(self)) 
> statusIcon.connect('popup-menu', popup_menu_cb, menu)
> statusIcon.set_visible(True)
> 
> but it says self isn't defined. When I tried recalling the widget from 
> the glade file and showing it that way instead of showing it it just 
> made another. But I have to bring the first on back up not make a new 
> one.
> 
> Thanks for helping me with this.
> 
> Nate
> 
> Here is the majority of the code:
> 
> class dmcalGTK:
> """The DMCal Application"""
> 
> def __init__(self):
> 
>   #Set the glade file
>   self.gladefile = "dmcal.glade"
>   self.wTree = gtk.glade.XML(self.gladefile, "dmcalMain")
> 
>   self.window = self.wTree.get_widget("dmcalMain")
>   self.window.connect('window-state-event',
> self.window_event)
> 
>   #Create our dictionary and connect it
>   dic = {"on_create_container_activate" :
> self.create_container_activate,
>  "on_dmcalMain_destroy" : self.dmcalMain_destroy,
>  "on_aboutMenuItem_activate" : self.showAbout,
>"on_quitButton_clicked" : self.dmcalMain_destroy,
>"on_newButton_clicked" :
> self.create_container_activate,
>"on_addButton_clicked" : self.showFileSelection,
>"on_quitmenuitem_activate" :
> self.dmcalMain_destroy, "on_removeButton_clicked" :
> self.removecontainer, "on_saveMenuItem_activate" : self.savelist}
>   self.wTree.signal_autoconnect(dic)
> 
>   preferencesMI =
> self.wTree.get_widget("preferencesMenuItem")
> preferencesMI.set_sensitive(0)
> 
>   #Setup the treeview
>   self.treeview = self.wTree.get_widget('treeview2')
>   
>   #Create the liststore model to use with the treeview
>   #Pattern: ICON, NAME TEXT, PATH TEXT
>   self.treelist = gtk.ListStore(gtk.gdk.Pixbuf, str, str,
> str) 
>   #Attatch the liststore model to the treeview
>   self.treeview.set_model(self.treelist

RE: [pygtk] (no subject)

2007-11-15 Thread McBride, Nathan
Actually, it doesn't seem to be re-creating the window after all.  However, I 
can't seem to figure out how to bring the window back.

I have tried:

self.window.show()
self.window.deiconify()
self.window.ahow_all()

What is the correct way to do this?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Julio Carlos 
Menéndez
Sent: Thursday, November 15, 2007 4:08 PM
To: pygtk@daa.com.au
Subject: Re: [pygtk] (no subject)

If you put all this code:
  
statusIcon = gtk.StatusIcon()

menu = gtk.Menu()
menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
menuItem.connect('activate', icon_show_about)
menu.append(menuItem)
menuItem = gtk.SeparatorMenuItem()
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
menuItem.connect('activate', quit_cb, statusIcon)
menu.append(menuItem)

# statusIcon.set_from_stock(gtk.STOCK_HOME)
statusIcon.set_from_file("pixmaps/dmcal.png")
statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite")
statusIcon.connect('activate', activate_icon_cb)
statusIcon.connect('popup-menu', popup_menu_cb, menu)
statusIcon.set_visible(True)

inside the __init__ method and every method you create should have the syntax 
'(self,)' to make it an instance method. Doing all 
that you should be able to use any self.

The method should be like this:
def activate_icon_cb(self, widget):
if self.window.visible():
self.window.hide()
else:
self..window.show()

Hope this works for you.

On Thu, 15 Nov 2007 13:15:35 -0500
"McBride, Nathan" <[EMAIL PROTECTED]> wrote:

> run the program and the main window comes up with the status icon.
> When I minimize the window, instead of minimizing it, it hides it. So 
> the window is gone but the icon is still in the tasktray. (minimizing 
> to tasktray) What I am trying to accomplish is that when you click the 
> tasktray icon then the window unhides and comes back.
> 
> everything works flawlessly except i can't get:
> 
> def activate_icon_cb(widget, data = None):
> pass
> 
> to have access to self.window from the __init__ to run the 
> self.window.show(). I'have tried setting it up like:
> 
> def activate_icon_cb(self, widget, data = None):
> pass
> 
> # statusIcon.set_from_stock(gtk.STOCK_HOME)
> statusIcon.set_from_file("pixmaps/dmcal.png")
> statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite") 
> statusIcon.connect('activate', activate_icon_cb(self)) 
> statusIcon.connect('popup-menu', popup_menu_cb, menu)
> statusIcon.set_visible(True)
> 
> but it says self isn't defined. When I tried recalling the widget from 
> the glade file and showing it that way instead of showing it it just 
> made another. But I have to bring the first on back up not make a new 
> one.
> 
> Thanks for helping me with this.
> 
> Nate
> 
> Here is the majority of the code:
> 
> class dmcalGTK:
> """The DMCal Application"""
> 
> def __init__(self):
> 
>   #Set the glade file
>   self.gladefile = "dmcal.glade"
>   self.wTree = gtk.glade.XML(self.gladefile, "dmcalMain")
> 
>   self.window = self.wTree.get_widget("dmcalMain")
>   self.window.connect('window-state-event',
> self.window_event)
> 
>   #Create our dictionary and connect it
>   dic = {"on_create_container_activate" :
> self.create_container_activate,
>  "on_dmcalMain_destroy" : self.dmcalMain_destroy,
>  "on_aboutMenuItem_activate" : self.showAbout,
>"on_quitButton_clicked" : self.dmcalMain_destroy,
>"on_newButton_clicked" :
> self.create_container_activate,
>"on_addButton_clicked" : self.showFileSelection,
>"on_quitmenuitem_activate" :
> self.dmcalMain_destroy, "on_removeButton_clicked" :
> self.removecontainer, "on_saveMenuItem_activate" : self.savelist}
>   self.wTree.signal_autoconnect(dic)
> 
>   preferencesMI =
> self.wTree.get_widget("preferencesMenuItem")
> preferencesMI.set_sensitive(0)
> 
>   #Setup the treeview
>   self.treeview = self.wTree.get_widget('treeview2')
>   
>   #Create the liststore model to use with the treeview
>   #Pattern: ICON, NAME TEXT, PATH TEXT
>   self.treelist = gtk.ListStore(gtk.gdk.Pixbuf, str, str,
> str) 
>   #Attatch the liststore model to the tre

Re: [pygtk] (no subject)

2007-11-15 Thread Julio Carlos Menéndez
This code is working propertly, i use present to bring back the window
because according to the documentation of pygtk:

"The present() method presents a window to the user. This may mean
raising the window in the stacking order, deiconifying it, moving it to
the current desktop, and/or giving it the keyboard focus, possibly
dependent on the user's platform, window manager, and preferences. If
the window is hidden, this method calls the the gtk.Widget.show()
method as well. This method should be used when the user tries to open
a window that's already open. Say for example the preferences dialog is
currently open, and the user chooses Preferences from the menu a second
time; use the present() method to move the already-open dialog where
the user can see it."

So, here is the code for what I guess you want:

import pygtk
pygtk.require('2.0')
import gtk

class Application(object):
def __init__(self):
self.statusicon = gtk.status_icon_new_from_stock('gtk-about')
self.statusicon.set_visible(True)
self.statusicon.connect('activate', self.on_activate)
self.window = gtk.Window()
self.window.connect('delete-event', self.on_delete_event)
self.window.show_all()

def on_activate(self, widget, data=None):
if self.window.get_property('visible'):
self.window.hide()
else:
self.window.present()

def on_delete_event(self, widget, data=None):
self.statusicon.set_visible(False)
gtk.main_quit()

if __name__ == '__main__':
app = Application()
gtk.main()

Greetings.

On Thu, 15 Nov 2007 17:21:41 -0500
"McBride, Nathan" <[EMAIL PROTECTED]> wrote:

> Actually, it doesn't seem to be re-creating the window after all.
> However, I can't seem to figure out how to bring the window back.
> 
> I have tried:
> 
> self.window.show()
> self.window.deiconify()
> self.window.ahow_all()
> 
> What is the correct way to do this?
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Julio Carlos Menéndez Sent: Thursday, November 15, 2007
> 4:08 PM To: pygtk@daa.com.au
> Subject: Re: [pygtk] (no subject)
> 
> If you put all this code:
>   
> statusIcon = gtk.StatusIcon()
> 
> menu = gtk.Menu()
> menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
> menuItem.connect('activate', icon_show_about)
> menu.append(menuItem)
> menuItem = gtk.SeparatorMenuItem()
> menu.append(menuItem)
> menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
> menuItem.connect('activate', quit_cb, statusIcon)
> menu.append(menuItem)
> 
> # statusIcon.set_from_stock(gtk.STOCK_HOME)
> statusIcon.set_from_file("pixmaps/dmcal.png")
> statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite")
> statusIcon.connect('activate', activate_icon_cb)
> statusIcon.connect('popup-menu', popup_menu_cb, menu)
> statusIcon.set_visible(True)
> 
> inside the __init__ method and every method you create should have
> the syntax '(self,)' to make it an instance
> method. Doing all that you should be able to use any
> self.
> 
> The method should be like this:
> def activate_icon_cb(self, widget):
> if self.window.visible():
>   self.window.hide()
> else:
> self..window.show()
> 
> Hope this works for you.
> 
> On Thu, 15 Nov 2007 13:15:35 -0500
> "McBride, Nathan" <[EMAIL PROTECTED]> wrote:
> 
> > run the program and the main window comes up with the status icon.
> > When I minimize the window, instead of minimizing it, it hides it.
> > So the window is gone but the icon is still in the tasktray.
> > (minimizing to tasktray) What I am trying to accomplish is that
> > when you click the tasktray icon then the window unhides and comes
> > back.
> > 
> > everything works flawlessly except i can't get:
> > 
> > def activate_icon_cb(widget, data = None):
> > pass
> > 
> > to have access to self.window from the __init__ to run the 
> > self.window.show(). I'have tried setting it up like:
> > 
> > def activate_icon_cb(self, widget, data = None):
> > pass
> > 
> > # statusIcon.set_from_stock(gtk.STOCK_HOME)
> > statusIcon.set_from_file("pixmaps/dmcal.png")
> > statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite") 
> > statusIcon.connect('activate', activate_icon_cb(self)) 
> > statusIcon.connect('popup-menu', popup_menu_cb, menu)
> > statusIcon.set_visible(True)
> > 
>

Re: [pygtk] (no subject)

2007-11-15 Thread Julio Carlos Menéndez
If you put all this code:
  
statusIcon = gtk.StatusIcon()

menu = gtk.Menu()
menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
menuItem.connect('activate', icon_show_about)
menu.append(menuItem)
menuItem = gtk.SeparatorMenuItem()
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
menuItem.connect('activate', quit_cb, statusIcon)
menu.append(menuItem)

# statusIcon.set_from_stock(gtk.STOCK_HOME)
statusIcon.set_from_file("pixmaps/dmcal.png")
statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite")
statusIcon.connect('activate', activate_icon_cb)
statusIcon.connect('popup-menu', popup_menu_cb, menu)
statusIcon.set_visible(True)

inside the __init__ method and every method you create should have the
syntax '(self,)' to make it an instance
method. Doing all that you should be able to use any
self.

The method should be like this:
def activate_icon_cb(self, widget):
if self.window.visible():
self.window.hide()
else:
self..window.show()

Hope this works for you.

On Thu, 15 Nov 2007 13:15:35 -0500
"McBride, Nathan" <[EMAIL PROTECTED]> wrote:

> run the program and the main window comes up with the status icon.
> When I minimize the window, instead of minimizing it, it hides it. So
> the window is gone but the icon is still in the tasktray. (minimizing
> to tasktray) What I am trying to accomplish is that when you click the
> tasktray icon then the window unhides and comes back.
> 
> everything works flawlessly except i can't get:
> 
> def activate_icon_cb(widget, data = None):
> pass
> 
> to have access to self.window from the __init__ to run the
> self.window.show(). I'have tried setting it up like:
> 
> def activate_icon_cb(self, widget, data = None):
> pass
> 
> # statusIcon.set_from_stock(gtk.STOCK_HOME)
> statusIcon.set_from_file("pixmaps/dmcal.png")
> statusIcon.set_tooltip("DM-Crypt & LUKS Encryption Suite")
> statusIcon.connect('activate', activate_icon_cb(self))
> statusIcon.connect('popup-menu', popup_menu_cb, menu)
> statusIcon.set_visible(True)
> 
> but it says self isn't defined. When I tried recalling the widget from
> the glade file and showing it that way instead of showing it it just
> made another. But I have to bring the first on back up not make a new
> one.
> 
> Thanks for helping me with this.
> 
> Nate
> 
> Here is the majority of the code:
> 
> class dmcalGTK:
> """The DMCal Application"""
> 
> def __init__(self):
> 
>   #Set the glade file
>   self.gladefile = "dmcal.glade"
>   self.wTree = gtk.glade.XML(self.gladefile, "dmcalMain")
> 
>   self.window = self.wTree.get_widget("dmcalMain")
>   self.window.connect('window-state-event',
> self.window_event)
> 
>   #Create our dictionary and connect it
>   dic = {"on_create_container_activate" :
> self.create_container_activate,
>  "on_dmcalMain_destroy" : self.dmcalMain_destroy,
>  "on_aboutMenuItem_activate" : self.showAbout,
>"on_quitButton_clicked" : self.dmcalMain_destroy,
>"on_newButton_clicked" :
> self.create_container_activate,
>"on_addButton_clicked" : self.showFileSelection,
>"on_quitmenuitem_activate" :
> self.dmcalMain_destroy, "on_removeButton_clicked" :
> self.removecontainer, "on_saveMenuItem_activate" : self.savelist}
>   self.wTree.signal_autoconnect(dic)
> 
>   preferencesMI =
> self.wTree.get_widget("preferencesMenuItem")
> preferencesMI.set_sensitive(0)
> 
>   #Setup the treeview
>   self.treeview = self.wTree.get_widget('treeview2')
>   
>   #Create the liststore model to use with the treeview
>   #Pattern: ICON, NAME TEXT, PATH TEXT
>   self.treelist = gtk.ListStore(gtk.gdk.Pixbuf, str, str,
> str) 
>   #Attatch the liststore model to the treeview
>   self.treeview.set_model(self.treelist)
>   
>   #Get the icons
>   self.yes = self.treeview.render_icon('gtk-yes',
> gtk.ICON_SIZE_SMALL_TOOLBAR)
>   self.no = self.treeview.render_icon('gtk-no',
> gtk.ICON_SIZE_SMALL_TOOLBAR)
>   
>   #Setup the columns on the listview
>   
>   column = gtk.TreeViewColumn('', gtk.CellRendererPixbuf(),
> pixbuf=0)
>   self.treeview.append_column(column)
>   column = gtk.TreeViewColumn('Name',
> gtk.CellRendererText(), text=1)
>   self.treeview.append_column(column)
>   column = gtk.TreeViewColumn('Location',
> gtk.CellRendererText(), text=2)
>   self.treeview.append_column(column)
>   column = gtk.TreeViewColumn('Mount Point',
> gtk.CellRendererText(), text=3)
>   self.treeview.append_column(column)
> 
>   self.treelist.append([self.yes, 'container.enc',
> '/home/nomb/container.enc', '/media/enc'])
> 
>   self.treeselection = self.treeview

Re: [pygtk] (no subject)

2007-10-25 Thread Marco Antonio Islas Cruz
For some reason, your self.message_entry is already packet into another
container and gtk cries about it  

`child->parent == NULL' failed`
self.message_hbox.pack_end(self.message_entry)

Wicht tells you that self.message_entry already have a parent.


El jue, 25-10-2007 a las 18:55 -0400, Alec Hussey escribió:
> Hello all,
> 
> I've been having a ton of trouble with this custom gtk dialog I am
> trying to create. The code "runs" however I receive a GtkWarning message
> saying:
> 
> /home/maddog39/Projects/mmoalert/actiondialog.py:42: GtkWarning: 
> gtk_box_pack_end: assertion `child->parent == NULL' failed
>   self.message_hbox.pack_end(self.message_entry)
> 
> For the life of me, I can't seem to figure out what going on and why
> this is happening. As usual, its probably something very simple that
> keeps passing by me. Here's the code for the dialog.
> 
> 
> import gtk, utils
> 
> ACTIONDIALOG_TYPE_ADD  = 0
> ACTIONDIALOG_TYPE_EDIT = 1
> 
> class ActionDialog(gtk.Dialog):
>   def __init__(self, type, app, title=None, content=None):
>   gtk.Dialog.__init__(self, None, None, gtk.DIALOG_MODAL)
>   
>   if type == ACTIONDIALOG_TYPE_ADD:
>   self.set_title("Add New Article")
>   else:
>   self.set_title("Edit Article")
>   
>   # Setup dialog widgets
>   self.title_label = gtk.Label("Title")
>   self.title_entry = gtk.Entry(max=180)
>   self.message_label= gtk.Label("Message")
>   self.message_entry = utils.TextField()
>   self.message_entry.set_wrap_mode(gtk.WRAP_WORD)
>   
>   # Fill fields with data if in edit mode
>   if title != None and content != None:
>   self.title_entry.set_text(title)
>   self.message_entry.set_text(content)
>   
>   # Create boxes to hold widgets
>   self.title_hbox = gtk.HBox()
>   self.title_hbox.pack_start(self.title_label)
>   self.title_hbox.pack_end(self.title_entry)
>   self.message_hbox = gtk.HBox()
>   self.message_hbox.pack_start(self.message_label)
>   self.message_hbox.pack_end(self.message_entry)
>   # DEBUG: not working properly
>   # Pack Widgets into vertical box
>   self.vbox.pack_start(self.title_hbox)
>   self.vbox.pack_start(self.message_hbox)
>   
>   # Add the buttons to the dialog
>   self.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)
>   self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
> 
> 
> Help much appreciated.
> 
> Thanks!
-- 
<--Linux... Because I'm Free-->
Marco Antonio Islas Cruz
"Markuz"
Linux User #280229
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.islascruz.org
http://sourceforge.net/projects/gpkg/
http://www.linuxpozarica.com


signature.asc
Description: Esta parte del mensaje está firmada	digitalmente
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] (no subject)

2007-10-25 Thread John Ehresman

Alec Hussey wrote:

I've been having a ton of trouble with this custom gtk dialog I am
trying to create. The code "runs" however I receive a GtkWarning message
saying:

/home/maddog39/Projects/mmoalert/actiondialog.py:42: GtkWarning: gtk_box_pack_end: 
assertion `child->parent == NULL' failed
  self.message_hbox.pack_end(self.message_entry)


Don't see the cause immediately, but I think the warning means 
self.message_entry has already been added to a container.  A widget may 
only be in one container at a time.


Cheers,

John
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] (no subject)

2007-03-13 Thread Adolfo González Blázquez
Hi!

I've wrote a simple directory tree widget (and maybe not very gtk
standard widget) which is used in a little app called pyRenamer.

You can check the widget here:
http://www.infinicode.org/code/pyrenamer/src/treefilebrowser.py

En example on how to use it:
http://www.infinicode.org/code/pyrenamer/src/treefilebrowser_example.py

And pyrenamer, application using it:
http://www.infinicode.org/code/pyrenamer/


Hope it's useful...

-- adolfo

El mar, 13-03-2007 a las 19:51 +0100, [EMAIL PROTECTED] escribió:
> Hello all! Unfortunately, there is not a high level widget to construct a 
> directory tree. I think the only solution is to use a gtk.TreeStore, but what 
> trick to make tree columns dinamically? I agree examples or tutorial's link. 
> Thanks!
> 
> 
> --
> Leggi GRATIS le tue mail con il telefonino i-mode™ di Wind
> http://i-mode.wind.it
> 
> 
> ___
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


signature.asc
Description: Esta parte del mensaje está firmada	digitalmente
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


RE: [pygtk] (no subject)

2007-03-01 Thread Xi Chen
def response(widget, response_id):
if response_id != gtk.RESPONSE_APPLY:
#   gtk.main_quit()
pass
else:
#   i=0
#   n=1000
progress =
dialog.get_data("progress")
progress.set_text("Calculating")
progress.grab_add()
while not os.path.exists(temp_file):
#my task will generate a file after finished

whereami_win.display_location() #that long time task

fra=progress.get_fraction()+0.01
if fra>1.0:
fra=0.0
progress.set_fraction(fra)
#   while i < n:
#   sleep(0.005)
#   progress.set_fraction(i/(n - 1.0))
#   i += 1
#   
while gtk.events_pending():
gtk.main_iteration_do(False)
progress.set_fraction(0.0)
progress.set_text("")
progress.grab_remove()


dialog = gtk.Dialog("Modal Trick", self, 0,
(gtk.STOCK_EXECUTE,  gtk.RESPONSE_APPLY, gtk.STOCK_CLOSE,
gtk.RESPONSE_CLOSE))
dialog.connect("response", response)
widget = gtk.ProgressBar()
box = dialog.get_child()
box.pack_start(widget, False, False, 0)
dialog.set_data("progress", widget)
dialog.show_all()

hi Gian,
really thanks for help, i hacked that example very ugly, as you see, that my
time consuming task is an atomic operation, it's an encapsulated method,
what I got is that after clicked some button, this model trick dialog
appears with two buttons, then execute button, for god sake, the progress
bar is staying frozen.. sigh I must do sth badly wrong, really have no idea 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Gian Mario Tagliaretti
Sent: 01 March 2007 14:26
To: [EMAIL PROTECTED]
Subject: Re: [pygtk] (no subject)

2007/3/1, Xi Chen <[EMAIL PROTECTED]>:
> Hi Gian,
> Yes, i've seen that article, but I'm new to python and gtk, really don't
> know where to put my time consuming task..

In that example in the big process (a simple sleep in this case) you
tell the main loop to go on with redrawing the GUI:

while gtk.events_pending():
 gtk.main_iteration_do(False)

In the main time you don't want your users to interact with the
controls, so you do a grab_add to the progressbar which will became
the only widget on which you can do something.

It's a bit tricky but if you get the philosophy is quite simple, you
can also use a different approach using idle_add() which tells the
main loop to execute some work when it is in idle state.

btw without seeing some code is difficult to help.

cheers
-- 
Gian Mario Tagliaretti
http://www.parafernalia.org/pygtk/

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


Re: [pygtk] (no subject)

2007-03-01 Thread Gian Mario Tagliaretti

2007/3/1, Xi Chen <[EMAIL PROTECTED]>:

[snip]

but it doesn't work for me. It seems the entire application is "dead" once
that big method starts, I couldn't call progress bar update during it's
running.

Any comment is welcome, I'd be very happy if it could help.


have you already seen this FAQ?
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq03.007.htp

cheers
--
Gian Mario Tagliaretti
http://www.parafernalia.org/pygtk/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] (no subject)

2004-04-30 Thread Toon Verstraelen
Steven Howe wrote:
BUT gtk.gdk.Window.set_decorations does not appear to be an ancestor of
gtk.dialog. So how to I 'join' a gtk.dialog class with the
gtk.gdk.Window class, so I can access the lower level
'set_decorations()' function.
I haven't found a way to turn off the close window, so I'll have to
intercept it's event and return gtk.TRUE to turn it off.
Try the gtk.Window.set_decorated(setting) method. When setting is False, I get 
no decorations at all. Since gtk.Window is a subclass gtk.Dialog, there 
shouldn't be any problems with dialogs:

class gtk.Dialog(gtk.Window):
gtk.Dialog(title=None, parent=None, flags=0, buttons=None)
def add_action_widget(child, response_id)
def add_button(button_text, response_id)
def add_buttons(buttons)
def set_response_sensitive(response_id, setting)
def set_default_response(response_id)
def set_has_separator(setting)
def get_has_separator()
def response(response_id)
def run()
(see http://www.moeraki.com/pygtkreference/pygtk2reference/)

regards,

Toon

___
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] (no subject)

2003-09-25 Thread Michal Pasternak
Jose Reina [Thu, Sep 25, 2003 at 06:40:05PM +0200]:
> Estoy utilizando python 2.3 con el módulo pygtk-2.0.0 para python 2.3. Las
> librerías runtime de gtk que estoy utilizando es la versión 2.2.4. El sistema
> operativo que estoy utilizando es win98se y win2k. Cuando ejecuto los ejemplos
> del tutorial que hay en la página http://www.moeraki.com me encuentro con el
> siguiente mensaje de error:

Hi, Jose! How did you installed GTK files? Where did you get them from? 
Are there in DLL path? 

-- 
m
___
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] (no subject)

2003-06-25 Thread John Hunter
> "Mark" == Mark C Mason <[EMAIL PROTECTED]> writes:

Mark> In the pygtk docs under gdk.Pixbuf, the method:

Mark> def get_from_drawable(src, cmap, src_x, src_y, dest_x,
Mark> dest_y, width, height)

Mark> appears to be missing an argument.  The documentation itself
Mark> talks about "dest" as a Pixbuf that is supplied, or if it is
Mark> not supplied, one is created.

Mark> When called with the above arguments, an error message
Mark> complains that a Pixbuf argument is expected, presumably
Mark> "dest".

Mark> How can I make this call and have it create and return a new
Mark> Pixbuf?


You need to create the pixbuf first as an instance of gtk.gdk.Pixbuf,
and then call the get_from_drawable method of that instance; eg, 

pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, width, height)
pixbuf.get_from_drawable(pixmap, drawable.get_colormap(),
 0, 0, 0, 0, width, height)


John Hunter 
___
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] (no subject)

2002-03-25 Thread Tom Cato Amundsen

On Thu, 2002-03-14 at 16:21, Han-Wen Nienhuys wrote:
> Subject: pygtk2 and GC? 
> X-Mailer: VM 6.96 under Emacs 20.7.1
> FCC: ~/persoonlijk/Mail/sent
> 
> 
> 
> Hi,
> 
> I installed pygtk2 this morning, and am now trying to sort-of port my
> gtk dribbling to gtk2, but I'm having lots of problems with managing
> GdkGC objects.
> 
> The examples in the distribution are not of much help, since they are
> outdated. FWIW, i've tried to get scribble.py up and running, but
> failed: at some point, I must come up with a GC object, and in pygtk
> for gtk1, you could do
> 
> get_style().white_gc
> 
> but this no longer seems to work. How should I proceed?
> 
> 

I have attached a script that show how much I have figured out. If you
place a file 'image.png' in pwd, then you can load it by pressing mouse
button 3. 

I have no idea if I use the api correctly. Also, I have not figured out
how to draw into a invisible bacup image, draw that image to the screen
on expose events. James.. ?


-- 
Tom Cato Amundsen <[EMAIL PROTECTED]>
GNU Solfege - free eartraining, http://www.gnu.org/software/solfege/


#!/usr/bin/env python2.2


import sys
sys.path.append("/home/tom/pygtk2/lib/python2.2/site-packages")
import gtk
GDK = gtk.gdk

def configure_event(widget, event):
	print "CONFIGURE does nothing!"

def expose_event(widget, event):
	print "EXPOSE does nothing!"

def draw_brush(widget, x, y):
	rect = (x-5, y-5, 10, 10)
	widget.window.draw_rectangle(widget.get_style().black_gc, gtk.TRUE,
		   x-5, y-5, 10, 10)

def button_press_event(widget, event):
	if event.button == 1:
		draw_brush(widget, event.x, event.y)
	elif event.button == 3:
		im = gtk.Image()
		im.set_from_file("image.png")
		im.get_pixbuf().render_to_drawable(widget.window, widget.get_style().black_gc,
		0, 0, event.x, event.y, 30, 30, gtk.gdk.RGB_DITHER_NORMAL, 0, 0)
		print 2
	return gtk.TRUE

def motion_notify_event(widget, event):
	if event.is_hint:
		x, y, state = event.window.get_pointer()
	else:
		x = event.x; y = event.y
		state = event.state
		
	if state & GDK.BUTTON1_MASK:
		draw_brush(widget, x, y)
	return gtk.TRUE

def main():
	win = gtk.Window()
	win.set_name("Test Input")
	win.connect("destroy", gtk.mainquit)
	win.set_border_width(5)

	vbox = gtk.VBox(spacing=3)
	win.add(vbox)
	vbox.show()

	drawing_area = gtk.DrawingArea()
	drawing_area.set_size_request(200, 200)
	vbox.pack_start(drawing_area)
	drawing_area.show()

	drawing_area.connect("expose_event", expose_event)
	drawing_area.connect("configure_event", configure_event)
	drawing_area.connect("motion_notify_event", motion_notify_event)
	drawing_area.connect("button_press_event", button_press_event)

	
	drawing_area.set_events(GDK.EXPOSURE_MASK |
GDK.LEAVE_NOTIFY_MASK |
GDK.BUTTON_PRESS_MASK |
GDK.POINTER_MOTION_MASK |
GDK.POINTER_MOTION_HINT_MASK)

	button = gtk.Button("Quit")
	vbox.pack_start(button, expand=gtk.FALSE, fill=gtk.FALSE)
	button.connect("clicked", lambda widget, win=win: win.destroy())
	button.show()
	win.show()
	gtk.mainloop()

if __name__ == '__main__':
	main()