[pygtk] Re: gnome.ui.AppBar Bug?

2005-08-18 Thread Mystilleef
Hello,

Can anyone please confirm this problem? I have attached a
simple example python file that illustrates the problem. 
Your help is appreciated.

Thanks
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import gtk
import gnome.ui

class Window(object):

	def __init__(self):
		
		window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		window.connect("delete_event", self.close_window_cb)
		window.set_icon_name("text-editor")
		window.set_position(gtk.WIN_POS_CENTER)
		window.set_border_width(1)
		window.set_size_request(640, 480)
		
		
		statusbar = gnome.ui.AppBar(True, True)
		window.add(statusbar)
		statusbar.clear_stack()
		statusbar.set_default("")
		statusbar.pop()
		statusbar.push("It does not work")
		statusbar.push("Testing...testing...testing")
		
		
		window.show_all()
	
	def close_window_cb(self, widget, event, data=None):
	
		gtk.main_quit()
	
		return False
	
def main():
	gtk.main()
	
if __name__ == "__main__":
	Window()
	main()___
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] What have I got wrong? (using glade, gtk.TreeView, and gtk.ListStore)

2005-08-18 Thread Michael R Head
On Thu, 2005-08-18 at 20:54 +0200, Jens Geiregat wrote:
> Hi,
> 
> You should create a 'renderer' for each column. A piece of some code
> that works for me:

> column1 =  gtk.TreeViewColumn("ID  ", renderer1, text=0)
> column2 =  gtk.TreeViewColumn("Feed URL  ", renderer2, text=1)

> so, a text-renderer for each column. (You can choose a
> checkbox-renderer to include a checkbox in each row.)

Cool. I actually had at one point created renderers, but what I missed
was the 'text' parameter (it appears that both are necessary).

> 
> Hope this helps you out,

Thanks, it solved my problem. Now I just have to actually figure out how
I want the GUI for my app to look.

mike

> 
> Jens Geiregat

> 
-- 
Michael R Head <[EMAIL PROTECTED]>
GPG: http://www.suppressingfire.org/~burner/gpg.key.txt (ID 23A02B1F)


signature.asc
Description: This is a digitally signed message part
___
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] What have I got wrong? (using glade, gtk.TreeView, and gtk.ListStore)

2005-08-18 Thread Jens Geiregat
Hi,

You should create a 'renderer' for each column. A piece of some code
that works for me:
"""
self.liststore=gtk.ListStore(int, str)
self.treeview1.set_model(self.liststore)

renderer1 = gtk.CellRendererText()
renderer2 = gtk.CellRendererText()

column1 =  gtk.TreeViewColumn("ID  ", renderer1, text=0)
column1.set_resizable(True)
column2 =  gtk.TreeViewColumn("Feed URL  ", renderer2, text=1)
column2.set_resizable(True)

self.treeview1.append_column(column1)
self.treeview1.append_column(column2)
"""
so, a text-renderer for each column. (You can choose a
checkbox-renderer to include a checkbox in each row.)

Hope this helps you out,


Jens Geiregat

On 8/18/05, Michael R Head <[EMAIL PROTECTED]> wrote:
> I'm just starting out with pygtk, and I'm having some trouble putting
> rows into a table. Despite the fact that I am adding rows (and I can
> tell that rows are being added by the selection bar in the screenshot),
> The text in them doesn't appear. I've changed the default cell renderer
> to  gtk.CellRendererText and have been able to set the background color,
> but the text of the elements in the row simply doesn't show up.
> 
> I must be doing something very simple, but I can't figure out what's so
> different from the various examples of pygtk tables that I've looked at
> and run.
> 
> I am using Ubuntu Hoary's packages of python (2.4.1), gtk (2.6.4) and
> pygtk (2.6.1).
> 
> Here's my python source:
> ===
> #!/usr/bin/env python
> 
> import gtk
> import gtk.glade
> import gobject
> 
> APPNAME="Labelator"
> APPVERSION="0.1"
> 
> class WidgetsWrapper:
> def __init__(self):
> """
> """
> self.widgets = gtk.glade.XML('labelator.glade',
> 'Labelator')
> dic = {'gtk_main_quit': gtk.main_quit,
>'on_quit1_activate': self.on_quit1_activate}
> self.widgets.signal_autoconnect(dic)
> 
> table = self.widgets.get_widget('MainTable')
> 
> liststore =
> gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
> 
> for column in ("Column 1", "Column 2"):
> table_column = gtk.TreeViewColumn(column)
> table.append_column(table_column)
> 
> for row in (("Column 1/Row 1", "Column 2/Row 1"),
> ("Column 1/Row 2", "Column 2/Row 2")):
> liststore.append(row)
> 
> table.set_model(liststore)
> 
> def on_quit1_activate(self, event):
> gtk.main_quit()
> 
> if __name__ == "__main__":
> widgets = WidgetsWrapper()
> gtk.main()
> ===
> 
> 
> The glade file and (small) screenshot of my run are attached.
> 
> thanks,
> mike
> 
> --
> Michael R Head <[EMAIL PROTECTED]>
> burner | suppressingfire | firestorm | phoenix | firefighter
> 
> 
> ___
> 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/


[pygtk] What have I got wrong? (using glade, gtk.TreeView, and gtk.ListStore)

2005-08-18 Thread Michael R Head
I'm just starting out with pygtk, and I'm having some trouble putting
rows into a table. Despite the fact that I am adding rows (and I can
tell that rows are being added by the selection bar in the screenshot),
The text in them doesn't appear. I've changed the default cell renderer
to  gtk.CellRendererText and have been able to set the background color,
but the text of the elements in the row simply doesn't show up. 

I must be doing something very simple, but I can't figure out what's so
different from the various examples of pygtk tables that I've looked at
and run.

I am using Ubuntu Hoary's packages of python (2.4.1), gtk (2.6.4) and
pygtk (2.6.1).

Here's my python source:
===
#!/usr/bin/env python

import gtk
import gtk.glade
import gobject

APPNAME="Labelator"
APPVERSION="0.1"

class WidgetsWrapper:
def __init__(self):
"""
"""
self.widgets = gtk.glade.XML('labelator.glade',
'Labelator')
dic = {'gtk_main_quit': gtk.main_quit,
   'on_quit1_activate': self.on_quit1_activate}
self.widgets.signal_autoconnect(dic)

table = self.widgets.get_widget('MainTable')

liststore =
gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)

for column in ("Column 1", "Column 2"):
table_column = gtk.TreeViewColumn(column)
table.append_column(table_column)

for row in (("Column 1/Row 1", "Column 2/Row 1"),
("Column 1/Row 2", "Column 2/Row 2")):
liststore.append(row)

table.set_model(liststore)

def on_quit1_activate(self, event):
gtk.main_quit()

if __name__ == "__main__":
widgets = WidgetsWrapper()
gtk.main()
===


The glade file and (small) screenshot of my run are attached.

thanks,
mike

-- 
Michael R Head <[EMAIL PROTECTED]>
burner | suppressingfire | firestorm | phoenix | firefighter


Screenshot-Labelator.png
Description: PNG image


labelator.glade
Description: application/glade
___
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] more languages

2005-08-18 Thread Guillaume Proux

The solution I used after trying a couple of different things.

I created a wrapper around a Glade tree object.
When I load the glade tree, I look for all widget ids starting with a 
given prefix like TEXT_.


For each widget (of id TEXT_nameofwidget), I look in a localization file 
 for the text associated to the widget ( nameofwidget="Open File..." 
for example) and I set the text for the corresponding widget. (Sometimes 
this does not work and you need to set the text of the first child 
widget but in general it is ok. Also when using pango syntax you have to 
call ANOTHER different method to set the text but it works well once you 
have covered all bases).


Also wrapping a GLade tree object enables you add a __getattr__ method 
to the wrapper to obtain the widget by name directly doing something like


mywrapper.nameofwidget

Makes life MUCH simpler to drive complex interaction on the UI.

Regards,

Guillaume

___
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] more languages

2005-08-18 Thread Gian Mario Tagliaretti
2005/8/18, Luigi Pantano <[EMAIL PROTECTED]>:
> how I can create a program in more languages (English, German,
> Italian...) using the pygtk?

Hi Luigi, have a look also at PyGTK FAQ 22.2:
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.002.htp

it might help

ciao
-- 
Gian Mario Tagliaretti
PyGTK GUI programming
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] more languages

2005-08-18 Thread Ogz
One possible solution that i did for my program:

use a config file: programname.cfg

inside thisi lets say a line defines the language: $language = eng

and create a language file:

connect:Connect 
open:Open
...

connect: is the global word that you will use for all your languaage
files. At the start of your program, check the config file, define
language and then open the related language file. Then read the
content and set the labels.

Lets say you have a label Connect

You may read all the content of the language file and assign it to an
array and then you may assign the correct language word: somelabel =
array['connect']


On 8/18/05, Luigi Pantano <[EMAIL PROTECTED]> wrote:
> how I can create a program in more languages (English, German,
> Italian...) using the pygtk?
> --
> Luigi Pantano
> ---
> IPUG - Italian Python User Group
> www.italianpug.org
> https://py-tips-tricks.python-hosting.com/
> ---
> ___
> 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] more languages

2005-08-18 Thread Stéphane Brunet

Luigi Pantano wrote:


how I can create a program in more languages (English, German,
Italian...) using the pygtk?
 


You can use the python gettext module

Stéphane

___
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] more languages

2005-08-18 Thread Luigi Pantano
how I can create a program in more languages (English, German,
Italian...) using the pygtk?
-- 
Luigi Pantano
---
IPUG - Italian Python User Group
www.italianpug.org
https://py-tips-tricks.python-hosting.com/
---
___
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/