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 paskari...@yahoo.ca 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 'method_name(self,parameters)' to make it an instance 
 method. Doing all that you should be able to use any 
 self.whatever_you_want
 
 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

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 'method_name(self,parameters)' to make it an instance
method. Doing all that you should be able to use any
self.whatever_you_want

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.get_selection()
   self.treeselection.select_path(0)
 
 if 

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 'method_name(self,parameters)' to make it an instance
 method. Doing all that you should be able to use any
 self.whatever_you_want
 
 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

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 
'method_name(self,parameters)' to make it an instance method. Doing all 
that you should be able to use any self.whatever_you_want

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

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 
'method_name(self,parameters)' to make it an instance method. Doing all 
that you should be able to use any self.whatever_you_want

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

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-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-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 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=showfile=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)

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 fra1.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)

2003-09-25 Thread Michal Pasternak
Jose Reina [Thu, Sep 25, 2003 at 06:40:05PM +0200]:
 Estoy utilizando python 2.3 con el mdulo pygtk-2.0.0 para python 2.3. Las
 libreras runtime de gtk que estoy utilizando es la versin 2.2.4. El sistema
 operativo que estoy utilizando es win98se y win2k. Cuando ejecuto los ejemplos
 del tutorial que hay en la pgina 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/