Re: [pygtk] Improving pygtk appearance, or moving to wxPython?

2006-05-04 Thread Johan Dahlin

Greg Ewing skrev:

Thomas Mills Hinkle wrote:

1. If you need a widget that does not exist in other applications, 
you need to draw it yourself and can control the look of it.


Even then, you should probably use the facilities of
the theme mechanism wherever possible to make your
widget follow the current theme somewhat. The Style
object attached to a widget has methods for drawing
lines, boxes, etc. in a way that matches the current
style.

That depends on the widget. In some cases you don't need to do any drawing.
You can create widgets which are composed by other widgets.
In kiwi[1] there are quite a few of them:

* KiwiEntry: a Entry subclass with icon and mask support
* ComboEntry:
  KiwiEntry with entry completion + ToggleButton with a Arrow inside and
  a popup with results
* IconEntry: A mixin which adds an icon to the left or the right on an 
entry.

* HyperLink: EventBox with a label, that is clickable
* ObjectList: ScrolledWindow with a TreeView (and TreeViewColumn + 
TreeModel)

* SelectableBox: HBox/VBox which has a border around one child

The only one of them which does additional drawing is IconEntry, which 
resizes the

two windows in an entry, adds a new one where a pixbuf can be drawn.

Johan

___
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] Treeview Tooltips

2006-05-04 Thread Frederic Back
Hello,

is there a simple way to add tooltips to cells in a treeview? 

If not, I guess that catching button events on the treeview and popping
up menues are the way to go.

Cheers,
Fred

___
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] Toggle menu item and toggle button syncronized

2006-05-04 Thread Adolfo González Blázquez
Hello,

I'm trying to syncronize a toggle menu item, and a toggle button, so
when one of them is activated, the other one gets activated as well.

The problem comes when cliking the menu item, i try to activate the
button, and this catch the 'clicked' signal, so it tries to activate the
menu, and that si a kind of infinite loop. 
Maybe i'm not explaining myself clearly...

The code is like this:

def on_menu_play_clicked(self, widget):
self.playing = not self.playing
self.button_play.set_activated(self.playing)
self.play()

def on_button_play_clicked(self, widget):
self.playing = not self.playing
self.play()


Which changes should i made to the code?
Maybe this is a stupid question, but now i can't find myself the
answer...

Thank you very much in advance!

-- adolfo


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] Treeview Tooltips

2006-05-04 Thread Stephen Langer


On May 4, 2006, at 8:02 AM, Frederic Back wrote:


Hello,

is there a simple way to add tooltips to cells in a treeview?

If not, I guess that catching button events on the treeview and  
popping

up menues are the way to go.

Cheers,
Fred


Here's an e-mail exchange I had about adding tooltips to menus.   
Since menus use treeviews underneath, I imagine the same hack should  
work.  (The original e-mails don't seem to be in the archive...)


Please note that the code here is due to Phil Dumont, not me.   The  
only substantial change I made to get it to work in my context was to  
put a try/except around the line cv_parent = cell_view.get_parent 
().  If you're using arrow keys to navigate a menu, sometimes  
cell_view is a TreeViewColumn and doesn't have a get_parent method.


 --  Steve

On Jul 8, 2005, at 11:28 AM, Phil Dumont wrote:



Steve,

I looked pretty hard for how to do this (because I wanted
to do it too), and pretty well convinced myself that there
is no right way to do it.

But I have discovered a HACK that seems to accomplish it
reasonably well.

That this should work is not at all supported by the
documentation, and was discovered by trial-n-error.
(Who knows; if you are running a sligtly different release
than I, it may not ever work for you.)

See the code at the end.

The 'tipmap' stuff is to avoid some flicker the first time
you hover over an item after a ComboBox popup.  Since the
cell_layout_data_func() gets called every time the cell is
renderered, the same tooltip can get set on the same widget
multiple times, causing choppiness.

Even with that bit of choppiness removed, there's still some
left.  The tooltip disappears every time the entry gets a
motion event, reappearing after brief motionlessness.
Normally (like the top-level tooltip on the ComboBox itself),
the tooltip stays put for motion events, only going away on
a leave event.  Oh well.

If you come across a better way to do this, *please* let me
know.

phil dumont



Steve Langer
Thu, 30 Jun 2005 09:42:53 -0700

Hi --


I hope this isn't a faq -- I couldn't find the answer in the
official faq or in the list...

I'm belatedly porting a large application from
gtk+1.2/pygtk-0.6.x to gtk2.6. With gtk+1.2 I was able to
add tooltips to the individual menu items in the pull-down
menu part of a GtkOptionMenu. Each entry in the menu was a
GtkMenuItem, to which I could assign a tooltip. This was
very useful, because users could see a description of a menu
item before selecting it.

With gtk2, I have to use a ComboBox instead. Is it possible
to assign tooltips to the items?

Many thanks.
-- Steve

--


# The sample code: #
import gtk, gobject

w=gtk.Window()
w.connect_after('delete-event', lambda *args: gtk.main_quit())

tips = gtk.Tooltips()
tipmap = {}

def cell_layout_data_func(cell_view, cell_renderer, model, iter):
idx = model.get_path(iter)[0]
item_text = model.get_value(iter, 0)
cell_renderer.set_property('text', item_text)
tip_text = tooltip for ComboBox Entry '%s'%item_text
cv_parent = cell_view.get_parent()
if isinstance(cv_parent, gtk.MenuItem) and (cv_parent not in  
tipmap

or tipmap[cv_parent] != tip_text):
tipmap[cv_parent] = tip_text
tips.set_tip(cv_parent, tip_text)

cb=gtk.ComboBox()
mod=gtk.ListStore(gobject.TYPE_STRING)
cb.set_model(mod)
cr=gtk.CellRendererText()
cb.pack_start(cr)
for item in ['this','is','a','test']:
cb.append_text(item)
cb.set_active(0)
cb.set_cell_data_func(cr, cell_layout_data_func)

eb = gtk.EventBox()
eb.add(cb)

tips.set_tip(eb, 'tip on ComboBox')

w.add(eb)
w.show_all()

gtk.main()





--
-- EMail: [EMAIL PROTECTED]Phone: (301)  
975-5423 --
-- WWW:  http://math.nist.gov/mcsd/Staff/SLanger/Fax:   (301)  
975-3144 --
-- Mail: NIST; 100 Bureau Drive -- Stop 8910; Gaithersburg, Md   
20899-8910 --


-- I don't think this will work.  That's why it's  
science.   --
--  Naomi Langer,  17 Feb  
2003 --



___
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] Toggle menu item and toggle button syncronized

2006-05-04 Thread Stephen Langer


On May 4, 2006, at 9:47 AM, Adolfo González Blázquez wrote:


The problem comes when cliking the menu item, i try to activate the
button, and this catch the 'clicked' signal, so it tries to  
activate the

menu, and that si a kind of infinite loop.
Maybe i'm not explaining myself clearly...

The code is like this:


signal = button.connect('clicked', on_button_play_clicked)



def on_menu_play_clicked(self, widget):
self.playing = not self.playing

  button.handler_block(signal)

self.button_play.set_activated(self.playing)

  button.handler_unblock(signal)

self.play()

def on_button_play_clicked(self, widget):
self.playing = not self.playing
self.play()


--
-- EMail: [EMAIL PROTECTED]Phone: (301)  
975-5423 --
-- WWW:  http://math.nist.gov/mcsd/Staff/SLanger/Fax:   (301)  
975-3144 --
-- Mail: NIST; 100 Bureau Drive -- Stop 8910; Gaithersburg, Md   
20899-8910 --


-- I don't think this will work.  That's why it's  
science.   --
--  Naomi Langer,  17 Feb  
2003 --



___
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] Improving pygtk appearance, or moving to wxPython?

2006-05-04 Thread JUAN ERNESTO FLORES BELTRAN

Andrew Conkling wrote:

Then you need to install a good theme. :)  Your distro, assuming you're 
using a major one, should come with a good selection already.


I am running Suse 10.0

Thomas Mills wrote:
In general, the theme philosophy is meant to give users control over the 
appearance of applications on their computer and to ensure a consistent 
look across the board. That is, normally, the application writer should 
never have to think about themes at all -- across the board, all GTK 
applications will have the same look for dialogs, text entries, buttons, 
etc.


So, my pygtk application as well as my Desktop Environment (Open_Office, 
Konqueror, etc) is going to be graphically improved depending on the theme 
installed??  What if y only want to improve my application but not the whole 
environment??  I am really interested on a GTK theme called VistaBut, once 
installed on my computer is going to change the whole environment or only my 
pygtk applications?, what happens if then I decide to create a .exe by using 
py2exe and run the application in a windows system???  Is the theme (and all 
the nice looking) lost as a result of this??


Thomas Mills wrote:

1. If you need a widget that does not exist in other applications, you need
to draw it yourself and can control the look of it.
2. If for some reason the look of your application is very specialized... 
in

that case, you should be able to do everything with a custom theme for your
app as others have suggested.


Do you suggest to learn how to draw widgets and figures with cairo if  a 
special looking is required?


Thomas Mills wrote:

It sounds like you may have an unusual application in mind -- if you
can specify precisely what it is you're trying to customize the look of,
you'll be able to get some more specific, useful help.


I am developing a telecommunications oriented application, it is an 
alternative designed on Open Code to the  Pathloss proprietary tool. After 
that I will designed an application oriented to the oil industry



thanks for your answers

Juan


___
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] Improving pygtk appearance, or moving to wxPython?

2006-05-04 Thread Johan Dahlin
JUAN ERNESTO FLORES BELTRAN wrote:
 Andrew Conkling wrote:
 
 Then you need to install a good theme. :)  Your distro, assuming
 you're using a major one, should come with a good selection already.
 
 I am running Suse 10.0
 
 Thomas Mills wrote:
 In general, the theme philosophy is meant to give users control over
 the appearance of applications on their computer and to ensure a
 consistent look across the board. That is, normally, the application
 writer should never have to think about themes at all -- across the
 board, all GTK applications will have the same look for dialogs, text
 entries, buttons, etc.
 
 So, my pygtk application as well as my Desktop Environment (Open_Office,
 Konqueror, etc) is going to be graphically improved depending on the
 theme installed??  What if y only want to improve my application but not
 the whole environment??  I am really interested on a GTK theme called
 VistaBut, once installed on my computer is going to change the whole
 environment or only my pygtk applications?, what happens if then I
 decide to create a .exe by using py2exe and run the application in a
 windows system???  Is the theme (and all the nice looking) lost as a
 result of this??

WingIDE is doing exactly that, so it is possible.

You can basically do anything with gtk themes or engines.
The windows theme engine for gtk+ is getting pretty good these days, gtk+
applications looks like real native windows applications.
However, that's not what you want, but it's just pointing out what's possible.

-- 
Johan Dahlin [EMAIL PROTECTED]
Async Open Source
___
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] Improving pygtk appearance, or moving to wxPython?

2006-05-04 Thread Steve McClure
On Thu, 2006-05-04 at 16:12 +, JUAN ERNESTO FLORES BELTRAN wrote:
 Andrew Conkling wrote:
 
 Then you need to install a good theme. :)  Your distro, assuming you're 
 using a major one, should come with a good selection already.
 
 I am running Suse 10.0
 
 Thomas Mills wrote:
 In general, the theme philosophy is meant to give users control over the 
 appearance of applications on their computer and to ensure a consistent 
 look across the board. That is, normally, the application writer should 
 never have to think about themes at all -- across the board, all GTK 
  applications will have the same look for dialogs, text entries, buttons, 
 etc.
 
 So, my pygtk application as well as my Desktop Environment (Open_Office, 
 Konqueror, etc) is going to be graphically improved depending on the theme 
 installed??  What if y only want to improve my application but not the whole 
 environment??  I am really interested on a GTK theme called VistaBut, once 
 installed on my computer is going to change the whole environment or only my 
 pygtk applications?, what happens if then I decide to create a .exe by using 

The whole environment.

 py2exe and run the application in a windows system???  Is the theme (and all 
 the nice looking) lost as a result of this??

Yes. The theme is specific to the desktop and varies with each
installation.

 
 Thomas Mills wrote:
 1. If you need a widget that does not exist in other applications, you need
 to draw it yourself and can control the look of it.
 2. If for some reason the look of your application is very specialized... 
 in
 that case, you should be able to do everything with a custom theme for your
 app as others have suggested.
 
 Do you suggest to learn how to draw widgets and figures with cairo if  a 
 special looking is required?

You need to differentiate between special look and special behavior. It
is usually best to stick with the widgets in the toolkit.  Not only do
you get the benefit of short development time and fully tested widgets
but applications will work in similar manners and the user won't be
learning a special behavior for your individual application.

 
 Thomas Mills wrote:
 It sounds like you may have an unusual application in mind -- if you
 can specify precisely what it is you're trying to customize the look of,
 you'll be able to get some more specific, useful help.
 
 I am developing a telecommunications oriented application, it is an 
 alternative designed on Open Code to the  Pathloss proprietary tool. After 
 that I will designed an application oriented to the oil industry

That really doesn't help too much, that is, the description isn't
precise enough.  e.g. Do you not like the color of your text input
boxes, or do you like rounded buttons versus squarish buttons.  Or do
you need a widget that doesn't function at all like any other out there?

If you are just tweaking the look of your particular application (the
former of the above scenarios), that can be done.  Currently I'm stuck
on a very old platform with Gtk 1.2 and PyGtk 0.6.9 but I'm sure the
generalities still apply. My particular application is a management
system for our DynaCenter product suite. The application is used in
large data centers or NOCs for systems management. When we do demos for
large customers we sometimes will brand the user interface to give the
customer a better impression of how we can customize the application.
To do that I create a resource file that is tied to the application by
using gtk.rc_parse() method.  As an example, part of the RC file for a
demo for IBM might look like this:

===
style IBM_bg
{
bg[NORMAL] = #4169e1
bg[PRELIGHT] = #3A5FCD
bg[ACTIVE] = #3a5fcd
bg[INSENSITIVE] = #4876ff
#bg[SELECTED] = #00659C
}

style IBM_colors = IBM_bg
{
fg[NORMAL] = #FF
base[NORMAL] = #FF
text[NORMAL] = #4169e1
fg[PRELIGHT] = #FF
fg[ACTIVE] = #FF
fg[INSENSITIVE] = #8b
}

# and further down in the file

widget * style IBM_colors
===

Then our application would use a color scheme (the full file requires a
lot more changes as you will find out...) that looks like the customers
other in house enterprise applications.

 
 
 thanks for your answers
 
 Juan
 
 
 ___
 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/
-- 
Steve McClure   Racemi
email: [EMAIL PROTECTED]  380 Interstate North 
Pkwy, SE
voice: 404-892-5850 Suite 250
fax: 404-892-7215   Atlanta, GA 30339
http://www.racemi.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/


Re: [pygtk] Improving pygtk appearance, or moving to wxPython?

2006-05-04 Thread JUAN ERNESTO FLORES BELTRAN

Steve McClure wrote:


The theme is specific to the desktop and varies with each
installation.


then, how can i maintain the nice looking independently of the 
system/installation my code is running on??



Do you not like the color of your text input
boxes, or do you like rounded buttons versus squarish buttons.  Or do
you need a widget that doesn't function at all like any other out there?


i just not like the color/shape/etc of the default pygtk installation i want 
to improve it and keep it consistent independently of the 
system/installation my code is running on...no matter the system i run the 
code on or the theme is installed, i want the nice looking to remain 
intact...how is it possible?


Sorry for being so insistent, but this point is very important for my 
application

i apprettiate any help or suggestion...

Regards
Juan


___
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] 2 Combo Boxes! What was I thinking?

2006-05-04 Thread John CORRY








Hi,



I have set up a GUI which has amongst other widgets two
combo boxes. I am using:



PythonCard version: 0.8.1

wxPython version: 2.6.1.0

Python version: 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]

Platform: win32

Glade 2



I started by setting up comboboxentry2 to accept two
settings in its drop down list.
(open + closed). This worked
fine. Code below:



self.wTree = gtk.glade.XML (phonelog.glade,
window1)


dic={on_window1_destroy : self.quit, }


self.wTree.signal_autoconnect (dic)

 


combo1 = self.wTree.get_widget(comboboxentry2)

 

 


combo1.append_text(Open)


combo1.append_text(Closed)


combo1.set_active(0)


combo1.connect(changed, self.callback2, combo1)

 

My problems started when I went to set up
comboboxentry3. I used the
following code:





self.wTree = gtk.glade.XML (phonelog.glade,
window1)


dic={on_window1_destroy : self.quit, }


self.wTree.signal_autoconnect (dic)

 

 


combo3 = self.wTree.get_widget(comboboxentry3)


combo3.connect(changed, self.callback3,
comboboxentry3)

 


combo3.append_text (Mon)


combo3.append_text (Tue)

 


combo1 = self.wTree.get_widget(comboboxentry2) 


combo1.append_text(Open)


combo1.append_text(Closed)


combo1.set_active(0)


combo1.connect(changed, self.callback2, combo1)






 I got the
following error:




Gtkwarning: gtk_combo_box_append_text: assertion
GTK_IS_LIST_STORE(Combobox-Priv-Model)

Failed

Combo3.append_text(Mon)

Gtkwarning: gtk_combo_box_append_text: assertion
GTK_IS_LIST_STORE(Combobox-Priv-Model)

Failed

Combo3.append_text(Tue)



I then tried the code:



self.wTree = gtk.glade.XML (phonelog.glade,
window1)


dic={on_window1_destroy : self.quit, }


self.wTree.signal_autoconnect (dic)

 

 


combo3 = self.wTree.get_widget(comboboxentry3)

 combo3.connect(changed,
self.callback3, comboboxentry3)

 


combo3.child.append_text (Mon)


combo3.child.append_text (Tue)

 


combo1 = self.wTree.get_widget(comboboxentry2) 


combo1.append_text(Open)


combo1.append_text(Closed)


combo1.set_active(0)


combo1.connect(changed, self.callback2, combo1)



I get the
following error message:



DeprecationWarning: use GtkEditable.insert_text

Combo3.child.append_text(Mon)

DeprecationWarning: use GtkEditable.insert_text

Combo3.child.append_text(Tue)



The combobox3 is populated on the GUI but instead of being a
drop down list it appears as a string on one line and looks like this:

MonTue



I have to confess I am not really sure what I am doing. I just guessed at putting the child
command in. It gets me close but
not close enough. Can anyone tell
me what I am doing wrong or explain what happens when you put two combo boxes
on the one GUI?



Any help greatly appreciated.



Thanks,



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] Improving pygtk appearance, or moving to wxPython?

2006-05-04 Thread Osmo Salomaa
to, 2006-05-04 kello 18:27 +, JUAN ERNESTO FLORES BELTRAN kirjoitti:
 Steve McClure wrote:
 
 The theme is specific to the desktop and varies with each
 installation.
 
 then, how can i maintain the nice looking independently of the 
 system/installation my code is running on??

Sorry for not answering your actual question, but what is the compelling
need that you have for a theme specific to your application? Why should
you as a developer dictate how different widgets look to the user? Why
not let each user decide what looks nice?

The first problem is that you break consistency. People like their
themes and the fact that the same widgets look the same in all apps.
Making your app look different will make it look ugly and most
importantly it will take the user a longer time to get used to. At least
initially different style widgets will just cause confusion.

The second problem is whether you're qualified to design a theme that
will work for all users. Think for example visually impaired users who
might like to use themes with large widgets, great contrasts and
noticeable hover effects. How do you take them into account? Would they
as well be forced to use the same theme?

-- 
Osmo Salomaa

___
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] Volumen button like Totem's using pygtk

2006-05-04 Thread Adolfo González Blázquez
Hello,

I'm writing a little audio player using pygtk, and i would like to know
if someone knows any project that had implemented the bacon-volume
widget from Totem and Rhythmbox in pygtk.

Thank you very much

-- adolfo


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] Improving pygtk appearance, or moving to wxPython?

2006-05-04 Thread Greg Ewing

JUAN ERNESTO FLORES BELTRAN wrote:

i just not like the color/shape/etc of the default pygtk installation i 
want to improve it and keep it consistent independently of the 
system/installation my code is running on...no matter the system i run 
the code on or the theme is installed, i want the nice looking to remain 
intact...how is it possible?


If this is for your own use, and you like a particular style,
why wouldn't you want it applied to your other apps as well?

If this is for others to use, you shouldn't be trying to force
your preferences on them. Provide your custom theme as an
option if you want, but give them the choice of installing
it themselves if they like it.

--
Greg
___
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/