Re: [pygtk] python-gtk3 on windows, any progress?

2014-01-13 Thread Giuseppe Penone
The feedback from mypaint - pygi experience would be to use 3.6.x, also the
official gtk bundle is 3.6.4
but the all in one installer proposes 3.10.x or older 3.4.x

If I will have some time will try and write feedback.

Giuseppe.


On Fri, Jan 3, 2014 at 3:04 PM, John Stowers
john.stowers.li...@gmail.comwrote:

 Also see this for windows builds

 http://opensourcepack.blogspot.fr/2013/01/mypaint-and-pygi.html

 John


 On Fri, Jan 3, 2014 at 12:16 PM, Timo timomli...@gmail.com wrote:

 op 02-01-14 20:54, Giuseppe Penone schreef:

  Hi, is there any progress for an all-in-one installer of python-gtk3 on
 windows?
 Thanks,
 Giuseppe.

 I don't know about any official installer, but here[1] you can find an
 unofficial package. It contains many (many!) GTK libraries and is updated
 frequently. I have no personal experiences with it though.

 Timo

 [1]  https://sourceforge.net/projects/pygobjectwin32/files



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



 ___
 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] pygtk tree view expanders custom color

2013-12-03 Thread Giuseppe Penone
Hi and thanks for reply, I already control the background and foreground of
the cells,
what I cannot control is the color of the expander arrows (the ones that
when clicked show/hide the children rows)
Giuseppe.


On Tue, Dec 3, 2013 at 8:47 PM, Adam Tauno Williams
awill...@whitemice.orgwrote:

 On Sun, 2013-09-08 at 21:27 +0200, Giuseppe Penone wrote:

  in my application users can control the foreground and background
  color of the treeview
  The problem is that the expanders arrows color does not change and so
  it happens that is not visible.
  Does anybody know if it is possible to override the gtk theme in use
  about this?

 I do not know how to override the theme, but you can set any color you
 want using a custom cell renderer.


 ...def render_task_id(column, cell, model, titer, store):
 if model[titer][0].objectid:
 cell.set_property('text', str(model[titer][0].objectid))
 else:
 cell.set_property('text', '-')
 TaskList.apply_cell_effects(titer, cell, model,
 store.configuration['PRESENTATION'])
 ...

 def apply_cell_effects(titer, cell, model, prefs):

 def get_stroke(value):
 if value == 0: return pango.WEIGHT_ULTRALIGHT
 elif value == 1: return pango.WEIGHT_LIGHT
 elif value == 2: return pango.WEIGHT_NORMAL
 elif value == 3: return pango.WEIGHT_BOLD
 elif value == 4: return pango.WEIGHT_ULTRABOLD
 else: return pango.WEIGHT_HEAVY

 # Line-out completed and rejected tasks

 if model[titer][0]['status'] in ('25_done', '02_rejected'):
 cell.set_property('strikethrough', True)
 else:
 cell.set_property('strikethrough', False)

 # Background color  font [driven by priority]

 if (model[titer][0]['priority'] == 5):
 color = gtk.gdk.color_parse(prefs['VERYLOW']['COLOR'])
 font = prefs['VERYLOW']['FONT']
 elif (model[titer][0]['priority'] == 4):
 color = gtk.gdk.color_parse(prefs['LOW']['COLOR'])
 font = pango.FontDescription(prefs['LOW']['FONT'])
 elif (model[titer][0]['priority'] == 3):
 color = gtk.gdk.color_parse(prefs['AVERAGE']['COLOR'])
 font = pango.FontDescription(prefs['AVERAGE']['FONT'])
 elif (model[titer][0]['priority'] == 2):
 color = gtk.gdk.color_parse(prefs['HIGH']['COLOR'])
 font = pango.FontDescription(prefs['HIGH']['FONT'])
 elif (model[titer][0]['priority'] == 1):
 color = gtk.gdk.color_parse(prefs['VERYHIGH']['COLOR'])
 font = pango.FontDescription(prefs['VERYHIGH']['FONT'])
 cell.set_property('cell-background', color)
 cell.set_property('font', font)

 # Foreground Stroke  Color [driven by curreny]

 if ('OVERDUE' in model[titer][0]['FLAGS']):
 stroke = get_stroke(prefs['OVERDUE']['STROKE'])
 color = gtk.gdk.color_parse(prefs['OVERDUE']['COLOR'])
 elif ('UPCOMING' in model[titer][0]['FLAGS']):
 stroke = get_stroke(prefs['UPCOMING']['STROKE'])
 color = gtk.gdk.color_parse(prefs['UPCOMING']['COLOR'])
 else:
 stroke = get_stroke(prefs['CURRENT']['STROKE'])
 color = gtk.gdk.color_parse(prefs['CURRENT']['COLOR'])
 cell.set_property('weight-set', True)
 cell.set_property('weight', stroke)
 cell.set_property('foreground', color)



 --
 Adam Tauno Williams mailto:awill...@whitemice.org GPG D95ED383
 Systems Administrator, Python Developer, LPI / NCLA

 ___
 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] use gtk.FileChooser to check mime type

2013-09-27 Thread Giuseppe Penone
Hi Niklas, thank you very much for the tip.

What I finally impleemnted is:

if os.path.isfile(full_element):
gio_file = gio.File(full_element)
gio_file_info = gio_file.query_info(*)
if not cons.IS_WIN_OS:
*mime_types = str(gio_file_info.get_icon())
if text- in mime_types:*
self.add_file(full_element)
else:
*mime_type = gio_file_info.get_content_**type()
if mime_type in [.txt, .TXT]:*
self.add_file(full_element)

The best way to understand if it's a text file was this, using
.get_content_type()
had too many mime types associated with text files but when going through
the icon
I found a list of mime types that did fit my needs.

On windows OS instead the mime type just returns the file extension so
unfortunately
the implementation is weak, for example a .ini/.cfg file would not be
considered,
I would have to create a long list with all possible text extensions.

Cheers,
Giuseppe.



On Fri, Sep 27, 2013 at 10:25 AM, Niklas Koep niklas.k...@gmail.com wrote:

 Hey, there are two ways to do this that I can think of off the top of my
 head. One is using 
 gio.content_type_guesshttps://developer.gnome.org/pygobject/2.28/gio-functions.html#function-gio--content-type-guess,
 the other (and likely slower albeit more accurate) way would be to use a
 gio.File instance like so:

 file_ = gio.File(filename)
 info = file_.query_info(standard::content-type) or equivalently info
 = file_.query_info(gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)
 mimetype = info.get_content_type()

 Regards.


 On Wed, Sep 25, 2013 at 12:04 AM, Giuseppe Penone gius...@gmail.comwrote:

 Hi,
 I'm using gtk.FileChooserDialog with a filter to display only
 text/plain files and this works fine:

 filter = gtk.FileFilter()
 filter.add_mime_type(text/plain)
 chooser.add_filter(filter)

 But if I need to check if a file is of this mime type, using python
 module mimetypes is not so good in detecting the proper mime type.

 Is it possible somehow to use gtk.FileChooser engine to retrieve files
 with a mime type in a directory without going through the dialog?

 I tried to do it without running the dialog and just doing:

 ...
 chooser.add_filter(filter)
 chooser.set_current_folder(foldername)
 chooser.select_all()
 print chooser.get_filenames()

 but I always get an empty list, it seems that without chooser.run() it
 doesn't work, unfortunately I cannot instantiate just a gtk.FileChooser()

 Cheers,
 Giuseppe.


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

[pygtk] use gtk.FileChooser to check mime type

2013-09-26 Thread Giuseppe Penone
Hi,
I'm using gtk.FileChooserDialog with a filter to display only text/plain
files and this works fine:

filter = gtk.FileFilter()
filter.add_mime_type(text/plain)
chooser.add_filter(filter)

But if I need to check if a file is of this mime type, using python module
mimetypes is not so good in detecting the proper mime type.

Is it possible somehow to use gtk.FileChooser engine to retrieve files with
a mime type in a directory without going through the dialog?

I tried to do it without running the dialog and just doing:

...
chooser.add_filter(filter)
chooser.set_current_folder(foldername)
chooser.select_all()
print chooser.get_filenames()

but I always get an empty list, it seems that without chooser.run() it
doesn't work, unfortunately I cannot instantiate just a gtk.FileChooser()

Cheers,
Giuseppe.
___
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] pygtk tree view expanders custom color

2013-09-09 Thread Giuseppe Penone
Hello Timo,
thank you very much for the reply,
unfortunately I cannot upgrade to GTK3 because my app (
http://www.giuspen.com/cherrytree/)
has to fully work on microsoft windows and I see that pyGI or whatever is
the name of python-GTK3
still doesn't work on windows.
It's sad to say but if GTK people will not spend time to support
cross-platform rather than just adding functionalities
more and more people will leave it for Qt and python-Qt.
Cheers,
Giuseppe.


On Mon, Sep 9, 2013 at 1:00 PM, Timo timomli...@gmail.com wrote:

 Op 08-09-13 21:27, Giuseppe Penone schreef:

  Hi,
 in my application users can control the foreground and background color
 of the treeview.
 The problem is that the expanders arrows color does not change and so it
 happens that is not visible.
 Does anybody know if it is possible to override the gtk theme in use
 about this?


 You can change it like any other part or widget in GTK3. Just add the
 following to your stylesheet:

 .expander {
 color: rgb(32, 74, 135);
 }


 Or be more precise about which treeview and do:

 GtkTreeView#MyCustomView .expander {
 color: rgb(32, 74, 135);
 }

 And in your code:
 treeview.set_name(**MyCustomView)

 Cheers,
 Timo

  Cheers,
 Giuseppe.


 __**_
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/**listinfo/pygtkhttp://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/pygtkhttp://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] pygtk tree view expanders custom color

2013-09-09 Thread Giuseppe Penone
On Mon, Sep 9, 2013 at 7:30 PM, Timo timomli...@gmail.com wrote:

 For a Linux only project I'm using GTK3 and I really like it (like the CSS
 theming for example), but I would probably think twice again in the future
 when starting a new large project. Which is a real shame if you look at how
 awesome GTK is.


I'm also using GTK (mm) 3 in a linux only project but at my company we're
dropping GTK (that I personally introduced) because we absolutely need to
reuse the code in other cross platform projects.

GTK3 is like a beautiful car that performs great when it's sunny but cannot
travel when it's rainy, only good for people that can afford two cars.

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

[pygtk] pygtk tree view expanders custom color

2013-09-08 Thread Giuseppe Penone
Hi,
in my application users can control the foreground and background color of
the treeview.
The problem is that the expanders arrows color does not change and so it
happens that is not visible.
Does anybody know if it is possible to override the gtk theme in use about
this?
Cheers,
Giuseppe.
___
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] toolbutton desensitize

2013-01-28 Thread Giuseppe Penone
.set_sensitive(True) and .set_sensitive(False)


On Mon, Jan 28, 2013 at 6:39 PM, tugba deniz deniz.tugb...@gmail.comwrote:

 Hi, how can i desensitize a toolButton?
 ___
 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] Microsoft Windows pygtk: gtk.FileChooserDialog returns weird characters when opening cyrillic filepath

2013-01-24 Thread Giuseppe Penone
I modified the rows:

filepath = chooser.get_filename()
chooser.destroy()
return filepath

to:

filepath = chooser.get_filename()
chooser.destroy()
return unicode(filepath) if filepath != None else None

But now I get error when opening E:\SOFTWARE\Кириллица.ctb :

Traceback (most recent call last):
  File test.py, line 35, in module
print filepath
  File C:\Python27\lib\encodings\cp850.py, line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position
12-20: character maps to undefined
Premere un tasto per continuare . . .

I really don't know what to do :(


On Thu, Jan 24, 2013 at 12:38 PM, Timo timomli...@gmail.com wrote:

 Op 23-01-13 18:52, Giuseppe Penone schreef:

 Hi,

 while I have a file named *E:\SOFTWARE\Кириллица.ctb* on my pc, selecting
 it with a gtk.FileChooserDialog
 and printing to terminal returns weird characters
 *E:\SOFTWARE\ÐsиÑ?иллиÑ┼**а.ctb*.

 Ah the joy of encodings on Windows. This is the piece of code I use
 (trimmed):

 class _FileChooser(gtk.FileChooser):
 def get_filename(self):
 filename = gtk.FileChooser.get_filename(**self)
 if filename is not None:
 return unicode(filename)

 def get_current_folder(self):
 return unicode(gtk.FileChooser.get_**current_folder(self))


 And then subclass the above when creating a FileChooserDialog or
 FileChooserButton, like so:

 class MyFileChooserDialog(gtk.**FileChooserDialog, _FileChooser):
 def __init__(self):
 super(MyFileChooserDialog, self).__init__()

 class MyFileChooserButton(gtk.**FileChooserButton, _FileChooser):
 def __init__(self):
 super(MyFileChooserButton, self).__init__()


 You can do fun things this way, but the most important thing is the
 unicode conversion ofcourse.

 Timo


 Does anybody have a clue of the reason?
 PS I have all my files starting with *# -*- coding: UTF-8 -*-*


 Regards,
 Giuseppe.


 __**_
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/**listinfo/pygtkhttp://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/pygtkhttp://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] Microsoft Windows pygtk: gtk.FileChooserDialog returns weird characters when opening cyrillic filepath

2013-01-24 Thread Giuseppe Penone
Many thanks Christian and Timo, now the situation is clear to me and I
fixed the problem.
The code from Timo works for using the filepath inside of the pygtk
application on
windows (more than enough for my application), just is not ok to print to
the terminal like Christian
explained.
Cheers,
Giuseppe.


On Thu, Jan 24, 2013 at 8:20 PM, Christian Mallwitz c.mallw...@gmail.comwrote:

 Giuseppe

 Python is using your console code page (== character encoding) and
 tries to convert your Unicode string into a byte sequence that
 represents the string in that code page. The problem is code page 850
 doesn't contain the Cyrillic characters needed
 (http://en.wikipedia.org/wiki/Code_page_850) and python therefore
 fails.

 You could change your console code page to 65001 (run 'chcp 65001' in
 console window). 65001 is equivalent to UTF8 and therefore contains
 mappings for all (most) Unicode strings you could pick up as file name
 from NTFS

 Please note, just because python can convert your Unicode strings to a
 byte sequence that is accepted by your console window doesn't mean
 your system has a display font containing the data necessary to render
 a character visually to represent the original Unicode code point in
 the string. Looked from another angle: just because you can't render
 something in a console window doesn't mean python doesn't have the
 correct string internally which you could use any way you want as long
 as you don't want to output it to stdout.

 Another comment: (I believe) the 'dir' command will switch encoding
 between bits of strings to display a directory listing made up of a
 combination of non-Western European languages. Feel free to create
 test files and rename them such that they name contains Arabic or
 Asian strings - go to foreign language web site and copypaste a few
 funny looking characters. Windows Explorer can handle that but 'dir'
 may eventually give up. So will python if you don't stick to Unicode.
 Mixing file names like that is a nice test to check if a system is
 handling character encodings and associated font rendering issues
 correctly.

 Cheers
 Christian

 On Thu, Jan 24, 2013 at 6:26 PM, Giuseppe Penone gius...@gmail.com
 wrote:
  I modified the rows:
 
  filepath = chooser.get_filename()
  chooser.destroy()
  return filepath
 
  to:
 
  filepath = chooser.get_filename()
  chooser.destroy()
  return unicode(filepath) if filepath != None else None
 
  But now I get error when opening E:\SOFTWARE\Кириллица.ctb :
 
  Traceback (most recent call last):
File test.py, line 35, in module
  print filepath
File C:\Python27\lib\encodings\cp850.py, line 12, in encode
  return codecs.charmap_encode(input,errors,encoding_map)
  UnicodeEncodeError: 'charmap' codec can't encode characters in position
  12-20: character maps to undefined
  Premere un tasto per continuare . . .
 
  I really don't know what to do :(
 
 
  On Thu, Jan 24, 2013 at 12:38 PM, Timo timomli...@gmail.com wrote:
 
  Op 23-01-13 18:52, Giuseppe Penone schreef:
 
  Hi,
 
  while I have a file named *E:\SOFTWARE\Кириллица.ctb* on my pc,
 selecting
  it with a gtk.FileChooserDialog
  and printing to terminal returns weird characters
  *E:\SOFTWARE\ÐsиÑ?иллиÑ┼а.ctb*.
 
  Ah the joy of encodings on Windows. This is the piece of code I use
  (trimmed):
 
  class _FileChooser(gtk.FileChooser):
  def get_filename(self):
  filename = gtk.FileChooser.get_filename(self)
  if filename is not None:
  return unicode(filename)
 
  def get_current_folder(self):
  return unicode(gtk.FileChooser.get_current_folder(self))
 
 
  And then subclass the above when creating a FileChooserDialog or
  FileChooserButton, like so:
 
  class MyFileChooserDialog(gtk.FileChooserDialog, _FileChooser):
  def __init__(self):
  super(MyFileChooserDialog, self).__init__()
 
  class MyFileChooserButton(gtk.FileChooserButton, _FileChooser):
  def __init__(self):
  super(MyFileChooserButton, self).__init__()
 
 
  You can do fun things this way, but the most important thing is the
  unicode conversion ofcourse.
 
  Timo
 
 
  Does anybody have a clue of the reason?
  PS I have all my files starting with *# -*- coding: UTF-8 -*-*
 
 
  Regards,
  Giuseppe.
 
 
  ___
  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/
 
 
 
  ___
  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

[pygtk] Microsoft Windows pygtk: gtk.FileChooserDialog returns weird characters when opening cyrillic filepath

2013-01-23 Thread Giuseppe Penone
Hi,

while I have a file named *E:\SOFTWARE\Кириллица.ctb* on my pc, selecting
it with a gtk.FileChooserDialog
and printing to terminal returns weird characters *
E:\SOFTWARE\ÐsиÑ?иллиÑ┼а.ctb*.

Does anybody have a clue of the reason?
PS I have all my files starting with *# -*- coding: UTF-8 -*-*

Regards,
Giuseppe.
___
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] Microsoft Windows pygtk: gtk.FileChooserDialog returns weird characters when opening cyrillic filepath

2013-01-23 Thread Giuseppe Penone
From the command line I see:

 Directory di C:\Documents and Settings\giu\Documenti\TEST

23/01/2013  22.26DIR  .
23/01/2013  22.26DIR  ..
23/01/2013  22.22 1.395 test.py
31/10/2012  23.03   335.377 *?.ctd*
   2 File336.772 byte
   2 Directory  80.310.996.992 byte disponibili

C:\Documents and Settings\giu\Documenti\TESTpython test.py
C:\Documents and Settings\giu\Documenti\TEST\*ðÜð©ÐÇð©ð╗ð╗ð©Ðåð░.ctd*

C:\Documents and Settings\giu\Documenti\TESTchcp
Tabella codici attiva: *850*

In the file manager instead I have:

C:\Documents and Settings\giu\Documenti\TEST\test.py
C:\Documents and Settings\giu\Documenti\TEST\*Кириллица.ctd*

the code of *test.py* is:


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

import gtk, os

def dialog_file_select(filter_pattern=None, filter_name=None,
curr_folder=None, parent=None):
The Select file dialog, Returns the retrieved filepath or None
chooser = gtk.FileChooserDialog(title = Select File,
action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons=(gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK) )
if parent != None:
chooser.set_transient_for(parent)
chooser.set_property(modal, True)
chooser.set_property(destroy-with-parent, True)
chooser.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
else: chooser.set_position(gtk.WIN_POS_CENTER)
if curr_folder == None or os.path.isdir(curr_folder) == False:
chooser.set_current_folder(os.path.expanduser('~'))
else:
chooser.set_current_folder(curr_folder)
if filter_pattern != None:
filter = gtk.FileFilter()
filter.set_name(filter_name)
filter.add_pattern(filter_pattern)
chooser.add_filter(filter)
if chooser.run() == gtk.RESPONSE_OK:
filepath = chooser.get_filename()
chooser.destroy()
return filepath
else:
chooser.destroy()
return None

filepath = dialog_file_select()
print filepath
#-

Please help me.
Giuseppe.






On Wed, Jan 23, 2013 at 8:18 PM, Christian Mallwitz c.mallw...@gmail.comwrote:

 Assuming you 'print' the filename to stdout and Python has the
 filename internally as UTF-8 string, Python may not do the right thing
 when converting the string to bytes to be processed by your console
 window. The console windows code page would be of interest too (run
 chcp).

 Christian

 On Wed, Jan 23, 2013 at 5:52 PM, Giuseppe Penone gius...@gmail.com
 wrote:
  Hi,
 
  while I have a file named E:\SOFTWARE\Кириллица.ctb on my pc, selecting
 it
  with a gtk.FileChooserDialog
  and printing to terminal returns weird characters
  E:\SOFTWARE\ÐsиÑ?иллиÑ┼а.ctb.
 
  Does anybody have a clue of the reason?
  PS I have all my files starting with # -*- coding: UTF-8 -*-
 
  Regards,
  Giuseppe.
 
  ___
  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/
___
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] Turning the PyGTK+ brand into something more than it currently is

2012-11-18 Thread Giuseppe Penone
Hi Simon,

On Sat, Nov 17, 2012 at 1:26 PM, Giuseppe Penone gius...@gmail.com wrote:

 I read that there's no need of reference because gtk3 reference is
 enough, well I'm a gtk3 and gtkmm3 developer over a pygtk developer (my
 most used app is www.giuspen.com/cherrytree) but still I miss pygtk
 reference when doing something in PyGobject.


 I'm curious where you read this as I think the idea should be squashed. Or
 perhaps the statement is being misinterpreted? The current gtk3 C
 docs/annotations should be enough, but using them to generate python
 specific docs still needs to happen (more below).


I read it here https://live.gnome.org/PyGObject/IntrospectionPorting

and exactly the section is:

The C API by and large remains valid in Python (and other languages using
the GI bindings), in particular the structure, order, and data types of
arguments. There are a few exceptions which are mostly due to the different
way Python works, and in some cases to make it easier to write code in
Python; see below for details. But this means that you can (and should) use
the normal API documentation for the C API of the library.
devhelphttps://live.gnome.org/devhelpis your friend!

I'm happy anyway that something is moving either in the reference and in
the porting to windows.

Cheers,
Giuseppe.
___
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] Turning the PyGTK+ brand into something more than it currently is

2012-11-17 Thread Giuseppe Penone
I totally agree with Jasper.

New PyGobject is lame because misses its own reference and doesn't work on
windows (well this is mainly a GTK3 issue...)

I read that there's no need of reference because gtk3 reference is enough,
well I'm a gtk3 and gtkmm3 developer over a pygtk developer (my most used
app is www.giuspen.com/cherrytree) but still I miss pygtk reference when
doing something in PyGobject.

I read somewhere that gtkmm generates the reference automatically from gtk,
why can't pygobject do the same?

As for GTK3 on windows I read something is moving in the last times, I hope
the porting will be complete soon.

Cheers,
Giuseppe.



On Thu, Nov 15, 2012 at 10:25 PM, Jasper St. Pierre
jstpie...@mecheye.netwrote:

 I like Python. I help new people out in Python IRC channels, on forums,
 and I recommend Python to friends and family who say they want to learn
 programming.

 At some point, the time comes when they want to start doing fancy
 graphical GUI stuff. And after a little bit of research, they come to a
 dilemma: should I use PyGTK+ or PyQt?

 They don't know that PyGTK+ is dead, or if they somehow found that out,
 they don't realize that there's a better replacement right around the
 corner. http://www.pygtk.org/ is still around, but it looks like it
 hasn't been updated since 1998, given the retro scanline effect on the
 header. It of course also doesn't help that the last notable news event was
 reported on April Fools.

 Sometimes they've heard of this PyGObject, but they conclude it's a
 low-level plumbing layer.

 The PyGTK+ reference docs come up a lot when Googling for them; obviously,
 our better documentation solution actually based on introspection
 information isn't ready yet, but I wonder if there's some minor tweaks we
 can make to make the solution suck less there.

 I think we could do a lot more with the PyGTK+ name and
 http://www.pygtk.org/ to promote gobject-introspection as our new,
 exciting solution. If nothing else, it rolls off the tongue much easier.
 Say it a few times.

 Anybody have any other ideas here?

 --
   Jasper


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

[pygtk] porting from pygtk to pygi - weird problem with pixbufs

2012-07-18 Thread Giuseppe Penone
Hi,
I'm co-author of the app x-tile (graphical windows tiling) which is
currently in pygtk but is already fully ported to pygi (even if not public
yet).

The problem is that the pixbufs (windows icons) are rendered properly in
pygtk but are not in pygi (the icons are sometimes partially rendered,
sometimes not at all, if you click F5 to refresh the list many times you
can see it clearly).

the involved (pygtk) function is:

def get_icon(win):
   this returns a gtk.gdk.pixbuf of the windows icon
  converts argb into rgba in the process   
get_property(_NET_WM_ICON, win, glob.XA_CARDINAL)
if not glob.ret_pointer : return None
w = glob.ret_pointer[0]
h = glob.ret_pointer[1]
s = w*h
buff = 
i = 0
while is:
argb = glob.ret_pointer[i+2]
i += 1
buff = buff + (%c % ((argb  16)  0xff))
buff = buff + (%c % ((argb  8)  0xff))
buff = buff + (%c % (argb  0xff))
buff = buff + (%c % ((argb  24)  0xff))
pxbuf = gtk.gdk.pixbuf_new_from_data(buff, gtk.gdk.COLORSPACE_RGB,
True, 8, w, h, w*4)
return pxbuf

that ported to pygi becomes:

def pixbuf_destroy_fn(pixbuf, data):
Function called when there are no more references of pixbuf
del pixbuf

def get_icon(win):
   this returns a Gdk.pixbuf of the windows icon
  converts argb into rgba in the process   
get_property(_NET_WM_ICON, win, glob.XA_CARDINAL)
if not glob.ret_pointer : return None
w = glob.ret_pointer[0]
h = glob.ret_pointer[1]
s = w*h
buff = 
i = 0
while is:
argb = glob.ret_pointer[i+2]
i += 1
buff = buff + (%c % ((argb  16)  0xff))
buff = buff + (%c % ((argb  8)  0xff))
buff = buff + (%c % (argb  0xff))
buff = buff + (%c % ((argb  24)  0xff))
pxbuf = GdkPixbuf.Pixbuf.new_from_data(buff,
   GdkPixbuf.Colorspace.RGB,
   True,
   8,
   w,
   h,
   w*4,
   pixbuf_destroy_fn, None)
return pxbuf

If anybody has some hints please help us.
Everybody can run the app easily from source cloning:

hg clone https://gius...@code.google.com/p/giuspen-x-tile/ hg_x-tile
cd hg_x-tile
./x-tile

and see the correct functionality

doing

hg update pygi
./x-tile

you run the pygi version, and can switch back to pygtk with

hg update default
./x-tile

Cheers,
Giuseppe.
___
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] pygi - gtk drawingarea doesn't work?

2012-07-16 Thread Giuseppe Penone
on a clean lubuntu 1204 installation (either 32 and 64 bit), ensured that
python-gobject and gir1.2-gtk-3.0 are installed, the attached demo doesn't
work.
the event 'draw' is never called.
no any feedback on the terminal.
at my home I have still lubuntu 1204 but also gnome and unity installed and
there it works fine.
can anybody help me to understand what package I'm missing?



On Sat, Jul 14, 2012 at 7:20 PM, Giuseppe Penone gius...@gmail.com wrote:

 On my home laptop it also works fine (lubuntu 1204 64bit running but also
 gnome-shell installed).
 I did check only for *gir1.2-gtk-3.0* at my work pc (clean lubuntu 1204
 64 bit), so I have to check for *python-gobject* too, many thanks.
 Strange that the demo didn't give any feedback to the terminal anyway
 about the missing package, just never called the draw event.
 Regards,
 Giuseppe.



 On Sat, Jul 14, 2012 at 12:50 AM, David Ripton drip...@ripton.net wrote:

 On 07/13/2012 12:16 PM, Giuseppe Penone wrote:

 Hi, running the demo
 http://git.gnome.org/browse/**pygobject/tree/examples/cairo-**demo.pyhttp://git.gnome.org/browse/pygobject/tree/examples/cairo-demo.py
 about the drawing area produces on my lubuntu 12.04 an empty window.
 the 'draw' event is never called, is this a bug?


 That demo works fine on my Ubuntu 12.04 box, and my Lubuntu 11.10 box.

 'draw' should get called when the window is first exposed, and again any
 time the window is damaged.

 You have python-gobject installed, right?

 --
 David Riptondrip...@ripton.net
 __**_
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/**listinfo/pygtkhttp://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/





drawingarea_test.py
Description: Binary data
___
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] pygi - gtk drawingarea doesn't work?

2012-07-16 Thread Giuseppe Penone
I tried on more that one installation, either 32 and 64 bit versions of
Lubuntu 12.04.
with Ubuntu 12.04 it works for me too, also with Lubuntu where I have other
desktops installed (unity, gnome).
I'm trying to understand what are the missing dependencies because I cannot
ask the users to install gnome to have drawingarea work...



On Mon, Jul 16, 2012 at 11:18 AM, John Stowers john.stowers.li...@gmail.com
 wrote:

 Works for me. Ubuntu 12.04

 I think your install is broken.

 John

 On Mon, Jul 16, 2012 at 10:37 AM, Giuseppe Penone gius...@gmail.com
 wrote:
  on a clean lubuntu 1204 installation (either 32 and 64 bit), ensured that
  python-gobject and gir1.2-gtk-3.0 are installed, the attached demo
 doesn't
  work.
  the event 'draw' is never called.
  no any feedback on the terminal.
  at my home I have still lubuntu 1204 but also gnome and unity installed
 and
  there it works fine.
  can anybody help me to understand what package I'm missing?
 
 
 
 
  On Sat, Jul 14, 2012 at 7:20 PM, Giuseppe Penone gius...@gmail.com
 wrote:
 
  On my home laptop it also works fine (lubuntu 1204 64bit running but
 also
  gnome-shell installed).
  I did check only for gir1.2-gtk-3.0 at my work pc (clean lubuntu 1204 64
  bit), so I have to check for python-gobject too, many thanks.
  Strange that the demo didn't give any feedback to the terminal anyway
  about the missing package, just never called the draw event.
  Regards,
  Giuseppe.
 
 
 
  On Sat, Jul 14, 2012 at 12:50 AM, David Ripton drip...@ripton.net
 wrote:
 
  On 07/13/2012 12:16 PM, Giuseppe Penone wrote:
 
  Hi, running the demo
  http://git.gnome.org/browse/pygobject/tree/examples/cairo-demo.py
  about the drawing area produces on my lubuntu 12.04 an empty window.
  the 'draw' event is never called, is this a bug?
 
 
  That demo works fine on my Ubuntu 12.04 box, and my Lubuntu 11.10 box.
 
  'draw' should get called when the window is first exposed, and again
 any
  time the window is damaged.
 
  You have python-gobject installed, right?
 
  --
  David Riptondrip...@ripton.net
  ___
  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/

___
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] pygi - gtk drawingarea doesn't work?

2012-07-16 Thread Giuseppe Penone
in case it can help, running the py-gi demo
http://git.gnome.org/browse/pygobject/tree/demos/gtk-demo (git clone
http://git.gnome.org/browse/pygobject/)
and double clicking on the Drawing Area element I get:

bazinga@lu1204:~/Templates/git_pygobject/demos/gtk-demo$ ./gtk-demo.py
Traceback (most recent call last):
  File
/home/bazinga/Templates/git_pygobject/demos/gtk-demo/demos/drawingarea.py,
line 162, in scribble_configure_event
allocation.height)
  File /usr/lib/python2.7/dist-packages/gi/types.py, line 43, in function
return info.invoke(*args, **kwargs)
TypeError: Couldn't find conversion for foreign struct 'cairo.Surface'



On Mon, Jul 16, 2012 at 11:57 AM, Giuseppe Penone gius...@gmail.com wrote:

 I tried on more that one installation, either 32 and 64 bit versions of
 Lubuntu 12.04.
 with Ubuntu 12.04 it works for me too, also with Lubuntu where I have
 other desktops installed (unity, gnome).
 I'm trying to understand what are the missing dependencies because I
 cannot ask the users to install gnome to have drawingarea work...




 On Mon, Jul 16, 2012 at 11:18 AM, John Stowers 
 john.stowers.li...@gmail.com wrote:

 Works for me. Ubuntu 12.04

 I think your install is broken.

 John

 On Mon, Jul 16, 2012 at 10:37 AM, Giuseppe Penone gius...@gmail.com
 wrote:
  on a clean lubuntu 1204 installation (either 32 and 64 bit), ensured
 that
  python-gobject and gir1.2-gtk-3.0 are installed, the attached demo
 doesn't
  work.
  the event 'draw' is never called.
  no any feedback on the terminal.
  at my home I have still lubuntu 1204 but also gnome and unity installed
 and
  there it works fine.
  can anybody help me to understand what package I'm missing?
 
 
 
 
  On Sat, Jul 14, 2012 at 7:20 PM, Giuseppe Penone gius...@gmail.com
 wrote:
 
  On my home laptop it also works fine (lubuntu 1204 64bit running but
 also
  gnome-shell installed).
  I did check only for gir1.2-gtk-3.0 at my work pc (clean lubuntu 1204
 64
  bit), so I have to check for python-gobject too, many thanks.
  Strange that the demo didn't give any feedback to the terminal anyway
  about the missing package, just never called the draw event.
  Regards,
  Giuseppe.
 
 
 
  On Sat, Jul 14, 2012 at 12:50 AM, David Ripton drip...@ripton.net
 wrote:
 
  On 07/13/2012 12:16 PM, Giuseppe Penone wrote:
 
  Hi, running the demo
  http://git.gnome.org/browse/pygobject/tree/examples/cairo-demo.py
  about the drawing area produces on my lubuntu 12.04 an empty window.
  the 'draw' event is never called, is this a bug?
 
 
  That demo works fine on my Ubuntu 12.04 box, and my Lubuntu 11.10 box.
 
  'draw' should get called when the window is first exposed, and again
 any
  time the window is damaged.
 
  You have python-gobject installed, right?
 
  --
  David Riptondrip...@ripton.net
  ___
  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/



___
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] pygi - gtk drawingarea doesn't work?

2012-07-14 Thread Giuseppe Penone
On my home laptop it also works fine (lubuntu 1204 64bit running but also
gnome-shell installed).
I did check only for *gir1.2-gtk-3.0* at my work pc (clean lubuntu 1204 64
bit), so I have to check for *python-gobject* too, many thanks.
Strange that the demo didn't give any feedback to the terminal anyway about
the missing package, just never called the draw event.
Regards,
Giuseppe.


On Sat, Jul 14, 2012 at 12:50 AM, David Ripton drip...@ripton.net wrote:

 On 07/13/2012 12:16 PM, Giuseppe Penone wrote:

 Hi, running the demo
 http://git.gnome.org/browse/**pygobject/tree/examples/cairo-**demo.pyhttp://git.gnome.org/browse/pygobject/tree/examples/cairo-demo.py
 about the drawing area produces on my lubuntu 12.04 an empty window.
 the 'draw' event is never called, is this a bug?


 That demo works fine on my Ubuntu 12.04 box, and my Lubuntu 11.10 box.

 'draw' should get called when the window is first exposed, and again any
 time the window is damaged.

 You have python-gobject installed, right?

 --
 David Riptondrip...@ripton.net
 __**_
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/**listinfo/pygtkhttp://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/

[pygtk] pygi - gtk drawingarea doesn't work?

2012-07-13 Thread Giuseppe Penone
Hi, running the demo
http://git.gnome.org/browse/pygobject/tree/examples/cairo-demo.py
about the drawing area produces on my lubuntu 12.04 an empty window.
the 'draw' event is never called, is this a bug?
Regards,
Giuseppe.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] pygtk weird behave in *windows only*

2012-06-11 Thread Giuseppe Penone
Hi,
In my app (www.giuspen.com/cherrytree) I have a textview under a menubar.
In the textbuffer there is a hyperlink to web page on the first row,
nothing else:


menu1 | menu2 | menu3...
-
*hyperlink in textview*


toolbar


On* windows only*, if I click on the hyperlink, the browser displays the
webpage
and then if I go back to the app window and click on a menu item of the
menubar (out of the textview)
the app opens new web link same as the first clicked.
going back again to the app window and clicking on a menu item of the
menubar, still same
result: open another same web page linked from the hyperlink.

the weird is that the link_clicked is called only on from a function
connected to the textview:

self.sourceview.connect(event-after, self.*on_sourceview_event_after*)

note that I'm using sourceview which inherits from textview.

I's weird that a click on the menu bar goes to the textview.

I'm searching for a workaround but don't know what to do... move the focus
away from the
textview just before opening the web page link didn't help.

Cheers,
Giuseppe.
___
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] text buffer - pygtk (or source buffer - pygtksourceview buffer) column selection or block selection or rectangular selection

2012-05-30 Thread Giuseppe Penone
Hi, with the textmarks you can select a region (row oriented selection
comes as consequence) but to select
a column means to have multiple start selection marks and end selection
marks, the problem is that when I
set a start selection mark I automatically remove the previous start
selection mark that was set.
I don't think that I can have multiple separed selections in the same
textbuffer... am I wrong?
Giuseppe.



On Wed, May 30, 2012 at 8:43 AM, Smartboy smartboyath...@gmail.com wrote:

 Well, technically, the selection is just a textmark. All textmarks do is
 record a position. I guess you could do the same by activating a function
 via a gesture that tracks the mouse and simulates this using texttags
 (formatting), but by default I don't think there is a way to do that.

 Smartboy

 On Tue, May 29, 2012 at 3:28 AM, Giuseppe Penone gius...@gmail.comwrote:

 Hi,
 I'm wondering if in pygtk there's a way to obtain the so called column
 selection or block selection or rectangular selection.
 If anybody uses geany, keeping pressed ctrl+alt while performing the
 selection will give the idea of the result.
 Geany is gtk2 but unfortunately uses scintilla to obtain this result (as
 well as syntax highlighting), not gtk textbuffer or sourcebuffer.
 Cheers,
 Giuseppe.


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

[pygtk] text buffer - pygtk (or source buffer - pygtksourceview buffer) column selection or block selection or rectangular selection

2012-05-29 Thread Giuseppe Penone
Hi,
I'm wondering if in pygtk there's a way to obtain the so called column
selection or block selection or rectangular selection.
If anybody uses geany, keeping pressed ctrl+alt while performing the
selection will give the idea of the result.
Geany is gtk2 but unfortunately uses scintilla to obtain this result (as
well as syntax highlighting), not gtk textbuffer or sourcebuffer.
Cheers,
Giuseppe.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] shrink window to minimum size when some child widgets are hidden

2012-05-20 Thread Giuseppe Penone
Hi,
It happens to me many times that after hiding some widgets in the window,
the window keeps the original size
leaving part of the window with just window background (gray) visible.
I'm searching for a solution, but had no luck so far.
Does anybody know how to behave to have the window to shrink to minimum
size given the actual displayed widgets?
___
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] shrink window to minimum size when some child widgets are hidden

2012-05-20 Thread Giuseppe Penone
No, this is already the default behaviour.
I found the best solution (so far) is to call

window.resize(1,1)

after hiding widgets that require the window to shrink.
This way the window will be shrunk to minimum.

Cheers,
Giuseppe.



On Sun, May 20, 2012 at 6:51 PM, Tom Cato Amundsen t...@gnu.org wrote:

 gtk.Window.set_resizable(True) ???

 Tom Cato

 2012/5/20 Giuseppe Penone gius...@gmail.com

 Hi,
 It happens to me many times that after hiding some widgets in the window,
 the window keeps the original size
 leaving part of the window with just window background (gray) visible.
 I'm searching for a solution, but had no luck so far.
 Does anybody know how to behave to have the window to shrink to minimum
 size given the actual displayed widgets?


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




 --
 Tom Cato Amundsen t...@gnu.org http://www.solfege.org/
 GNU Solfege - free ear traininghttp://www.gnu.org/software/solfege/


___
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] gtk.SpinButton - weird behaviour

2012-05-17 Thread Giuseppe Penone
it could be a problem with the update policy.
I bet that you did set to update the value that the spinbutton gets after
any key press.

You can control where the cursor goes after any key press anyway, the entry
is child of editable (http://www.pygtk.org/docs/pygtk/class-gtkeditable.html
)

I have a similar problem with glade 3.12 (for gtk3) and any entry (I can
only copy and paste, not enter characters at the middle of an existing
word), unfortunately that's a glade bug and I cannot do anything.



On Wed, May 16, 2012 at 10:08 AM, Andreas Heinlein aheinl...@gmx.comwrote:

 Hello,

 we have a GTK2 python app which uses a gtk.SpinButton with a precision of
 1, i.e. numbers like 1234.5. This widget behaves oddly when trying to enter
 values directly with the keyboard. It is difficult to describe; when you
 click the field and enter some digits, only the first is accepted, then the
 marker jumps to the end of the field (after the decimal digit) where you
 cannot enter anything. You can move the mark manually again and enter some
 more digits. It just isn't possible to click the field once and enter
 1234.5 like it should.

 Is this a known GTK problem/bug? We're using GTK 2.20. The spinButton is
 configured with digits=1, numeric=True, snap-to-ticks=False, alignment=1,
 increments=0.1,10.

 Thanks,
 Andreas
 __**_
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/**listinfo/pygtkhttp://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] How to use gtk.stock_add()

2012-04-08 Thread Giuseppe Penone
Hi,

ICONPATH = /usr/share/pixmaps/gksu.png
factory = Gtk.IconFactory()
pixbuf = GdkPixbuf.Pixbuf.new_from_file(ICONPATH)
iconset = Gtk.IconSet.new_from_pixbuf(pixbuf)
factory.add(gksu, iconset)
factory.add_default()

Cheers,
G.


2012/4/8 Lion Chen chnlio...@gmail.com

  Hello all,
   i want to add my own stock item, so i try the following:

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

 gtk.stock_add([STOCK_1, 1, 0, 49, gtk20)  # just a test, 49 is the
 value of 1, i don't want to use any GDK Modifier Constants
 .
 .
 .
 # i want to press 1 to quit , but it doesn't work, when i replace
 gtk.STOCK_1  with gtk.STOCK_QUIT  ,  it can work.
 action = gtk.Action('Quit', test test test, None, gtk.STOCK_1)

 action.connect('activate', self.quit_cb)

 quitbutton = gtk.Button()
 .
 .
 .
 action.connect_proxy(quitbutton)
 .
 .
 .


 when i run it, i got the message:

 Traceback (most recent call last):
   File /home/lionchen/workspace/action/simpleaction.py, line 9, in
 module
 gtk.stock_add((STOCK_1, _1, gtk.gdk.SHIFT_MASK, 49, pymserv))
 TypeError: items sequence members must be of form (stock_id, label,
 modifiers, keyval, domain)

 could anybody explain what the domain exactly is? and how do i write  the
 correct gtk.stock_add()?

 thanks.

 Lion

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

[pygtk] key value file parser with pygtk

2012-03-28 Thread Giuseppe Penone
Hi,
I didn' find documentation on how to use key value file parser (
http://www.gtk.org/api/2.6/glib/glib-Key-value-file-parser.html)
with pygtk, can anybody point me to it?
Best regards,
Giuseppe.
___
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] key value file parser with pygtk

2012-03-28 Thread Giuseppe Penone
yeah it seems very similar, I hope it's compatible with the glib version,
anyway good tip thanks.


On Wed, Mar 28, 2012 at 19:48, Timo timomli...@gmail.com wrote:

 Op 28-03-12 12:26, Giuseppe Penone schreef:

  Hi,
 I didn' find documentation on how to use key value file parser (
 http://www.gtk.org/api/2.6/**glib/glib-Key-value-file-**parser.htmlhttp://www.gtk.org/api/2.6/glib/glib-Key-value-file-parser.html
 )
 with pygtk, can anybody point me to it?

 No idea, but Python itself has lots of stuff built-in. Check out the
 ConfigParser [1] module which seems to do the same thing.

 Timo

 [1] http://docs.python.org/**library/configparser.html#**
 module-ConfigParserhttp://docs.python.org/library/configparser.html#module-ConfigParser

  Best regards,
 Giuseppe.


 __**_
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/**listinfo/pygtkhttp://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/pygtkhttp://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] Spanning Multiple Columns in TreeView

2012-03-20 Thread Giuseppe Penone
Hi,
you cannot obtain the result you want with a treeview since AFAIK there's
no way to join cells.
AFAIK there's no widget that fits your need, you have to work with nested
vertical and horizontal boxes containing labels.
Cheers,
Giuseppe.



On Mon, Mar 19, 2012 at 16:15, Andrew Rowland weibull...@gmail.com wrote:

 Dear List:

 I am trying to display some hierarchical data.  My thought would be to
 use the treeview.  However, the problem I run into is that I would need
 to pad the data in each row to fit the underlying treemodel.

 I would like to display the data in a format similar to that in this
 spreadsheet --

 http://s239.photobucket.com/albums/ff56/weibullguy/?action=viewcurrent=layout_example.png

 Such that the Level 0 data is only in the first column,  The Level 1
 data is in the next row, but only in columns 1-3, etc.  For each level,
 there may be multiple child rows.  It would be nice if the unused
 columns in each row could be gray as in the picture above, but this is
 aesthetics and not strictly necessary.

 I've Googled things such as pygtk treeview span multiple columns, but
 nothing came back that I found useful.

 If everything were string data, the padding option might be OK.  But,
 the data being displayed is a mixture of string, integer, and float
 data.  Worse case I could do type conversions to load the data and then
 do the opposite when I saved it back to the database.

 I'd appreciate any pointers anyone might have.

 TIA,

 Andrew

 --
 Andrew Rowland
 darowland AT ieee DOT org
 39A3 A9AD 3874 FEB8 741A  993F F6B9 516F CB55 B365
 http://sourceforge.net/projects/reliafree/

 Please do not send me MS Office files if possible.
 They are a proprietary format and do not conform to
 internationally recognized standards.  They are
 difficult to deal with and problematic to use.
 ___
 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] how do I get a list of windows on my desktop?

2012-03-15 Thread Giuseppe Penone
you can take a look to the source code of http://www.giuspen.com/x-tile/


On Thu, Mar 15, 2012 at 09:27, John Accoun json...@gmail.com wrote:

 None of these work:

 
  gtk.gdk.window_get_toplevels()
 [gtk.gdk.Window object at 0xb74339b4 (GdkWindow at 0x8a4c170)]

  gtk.gdk.window_get_toplevels()[0].get_children()
 []
 


 
  d = gtk.gdk.DisplayManager()
  d.get_default_display().get_screen(0).get_root_window().get_children()
 [gtk.gdk.Window object at 0x89dcc84 (GdkWindow at 0x8a4c170),
 gtk.gdk.Window object at 0x89dccac (GdkWindow at 0x8a4c0c0)]
 

 The second method returns two windows with no children, regardless the
 amount of windows I have on my desktop. Could anyone point me the
 right direction and explain why none of the above does what I want?
 ___
 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] pygtk i18n problem with windows and glade sentences

2012-02-21 Thread Giuseppe Penone
Thank you very much.
what solved my problem on windows os is (from your code):

from ctypes import cdll
libintl = cdll.intl
libintl.bindtextdomain(domain, localedir)

Best regards,
Giuseppe.


On Mon, Feb 20, 2012 at 09:21, Dieter Verfaillie
diet...@optionexplicit.bewrote:

 On Mon, 20 Feb 2012 00:08:13 +0100, Giuseppe Penone wrote:

 does anybody know if there's a way to have glade sentences translated
 on windows?


 Yep, I've pointed out a possible solution here:
 https://bugzilla.gnome.org/**show_bug.cgi?id=574520#c36https://bugzilla.gnome.org/show_bug.cgi?id=574520#c36

 mvg,
 Dieter


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

[pygtk] pygtk i18n problem with windows and glade sentences

2012-02-19 Thread Giuseppe Penone
Hi,
in order to have the i18n working on linux I use (cons is a module where I
have my constants written):

locale.bindtextdomain(cons.APP_NAME, cons.LOCALE_PATH)
gettext.translation(cons.APP_NAME, cons.LOCALE_PATH).install()

this way I have translated either the sentences from the glade file and the
sentences from the python code.

on windows I don't have locale.bindtextdomain available, this causes the
sentences from the glade file to be not translated.

does anybody know if there's a way to have glade sentences translated on
windows?

Thanks and best regards,
Giuseppe.
___
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] pygobject documentation ?

2012-01-11 Thread Giuseppe Penone
I agree with Pietro, taken that there are rules for retrieving the Python
functions from the C functions,
so the documentation for Python should be automagically generated from the
C documentation.

Let me correct Jérôme: it's wrong that glade 3.10 does not supports gtk2,
actually requires gtk 2.20.

Finally I wish that the pygtk all in one installer for windows will be
available soon for PyGobject - GTK3
otherwise porting cross platform apps is not possible.

Giuseppe.



On Wed, Jan 11, 2012 at 00:23, Pietro Battiston m...@pietrobattiston.itwrote:

 Il giorno mar, 10/01/2012 alle 18.54 +0100, Timo ha scritto:
  Op 10-01-12 15:42, Jérôme schreef:
   Hi all.
  
   I started python and pygtk recently (a few weeks).
  
   For that I used
  
   Python 2.7 documentation
   http://docs.python.org/
  
   python GTK2.0 tutorial
   http://pygtk.org/pygtk2tutorial/index.html
  
   Then, I decided to switch to pygobject. Two reasons for that :
  
   * The advice on pygtk.org : New users wishing to develop Python
 applications
  using GTK+ are recommended to use the GObject-Introspection features
  available in PyGObject.
  
   * The fact that glade, that I wanted to use as well, now (from version
 3.10)
  only supports GTK3 (or so I understand).
  
   The resources I use are now referenced here :
 https://live.gnome.org/PyGObject
  
   * The tutorial :
  
 http://readthedocs.org/docs/python-gtk-3-tutorial/en/latest/index.html
  
   * A partial doc I don't really use :
  http://people.gnome.org/~johnp/girdocsalpha/Gtk/
  
   * Examples I just discovered :
  http://developer.gnome.org/gnome-devel-demos/stable/
  
   The most annoying is that I often find myself having to deal with the
 GTK3
   reference manual : http://developer.gnome.org/gtk3/stable/ and guess
 what the
   python code corresponding to the C code can be.
  
   Some adaptations are trivial, like from
  
   voidgtk_window_set_title(GtkWindow
 *window,
 const gchar
 *title);
  
   to
  
   Gtk.Window.window.set_title(string)
  
   But it is sometimes hard to just guess the name of python constants
 from C
   constants.
  
   Like from GTK_WINDOW_POPUP to Gtk.WindowType.POPUP, for instance.
  Constants are actually pretty easy once you understand how they are
  mapped to Python.
  Have a look at the C docs page for all enumerations:
  http://developer.gnome.org/gtk3/stable/gtk3-Standard-Enumerations.html
  Let's start at the top of these for convenience sake:
  GTK_ACCEL_MASK from GtkAccelFlags becomes Gtk.AccelFlags.MASK
  GTK_ARROWS_BOTH from GtkArrowPlacement becomes Gtk.ArrowPlacement.BOTH
  GTK_ARROW_UP from GtkArrowType becomes Gtk.ArrowType.UP
 
  You will notice a pattern: take the enumeration name, split the Gtk part
  and rest with a dot, then leave out GTK_*_ part from the types and
  append them to the previously splitted name.
 
  This approach always worked for me till now.

 I can confirm this holds for me too (though often with some trial and
 error, even after some time), but still I'm curious: is any further
 (possibly automatic?) step in documenting pygobject planned?
 In the end, introspection is about automatically transforming C
 functions/constants into python methods/constants, so automatic
 conversion of API docs should be feasible too. The descriptions could be
 left as they are, with the possibility of manual overriding (in
 particular for examples).

 Crazy? Or just lacking manpower?

 Pietro

 ___
 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] pygobject documentation ?

2012-01-11 Thread Giuseppe Penone
you can download http://www.giuspen.com/cherrytree and have fun, the glade
file is edited with *glade 3.10* and has a minimum requirement of *gtk 2.20*
.
no hacking was done, after opening my already existing glade file I clicked
file--properties and I did set the requirement to 2.20 since it was the
lower version available in the radiobutton.




 Let me correct Jérôme: it's wrong that glade 3.10 does not supports
 gtk2, actually requires gtk 2.20.


 No. Glade 3.8.x is for GTK+ 2.X  Glade 3.10.x is for GTK+ 3.X
 Both versions can be installed in parallel into the same prefix.


  Finally I wish that the pygtk all in one installer for windows will be
 available soon for PyGobject - GTK3
 otherwise porting cross platform apps is not possible.


 The good news:
 - PyGObject win32 port is complete afaik (needs loads of testing)

 The not so good news:
 - GObject-Introspection win32 port is not complete, but
  mostly functional. See https://bugzilla.gnome.org/show_bug.cgi?id=620566
 - GTK+3 on win32 is usable but has serious themeing work
  that still needing to be done (engines are out, css is the
  new way of doing things, but its win32 support is not yet complete).
  The default theme (Raleigh) or some other theme like Adwaita
  can be used instead, but most win32 people hate doing so...
 - Glade 3.10 doesn't build ootb, patches are being prepared, but:
 - GLib's handling of special paths on win32 (g_get_home_dir,
  g_get_tmp_dir, g_get_user_data_dir, ... so most everything in
  glib/gutils.c) has issues that need to be fixed first...

 That last point is blocking Glade 3.10, g-i and in very specific
 cases GTK+3 gsettings schema handling and who knows what else
 and is what I'm currently working on.

 Expecting all this to be fixed soon sounds like wishful
 thinking at best ;)

 For those adventurous enough, there are experimental builds
 coming with PyGObject linked against Python 2.7 (that *do not*
 integrate with Python like you're used to):
 http://optionexplicit.be/projects/gnome-windows/GTK+3/

 0) Do not ask me for builds supporting other Python versions
 1) You'll have to remove the PyGTK All-in-one installer (or
   deactivate it's pygtk.pth file, eg by renaming it to
   pygtk.pth.bak) to be able to use this bundle.
 2) Extract the bundle to C:\GTK+3
 3) Create C:\GTK+3\testpygobject.bat (the name of the file
   doesn't matter, choose something better if you wish) with
   the following contents (adapt paths as needed):

 set PATH=C:\GTK+3\bin;%PATH%
 set PYTHONPATH=C:\GTK+3\lib\site-packages
 set GI_TYPELIB_PATH=C:\GTK+3\lib\girepository-1.0
 c:\python27\python.exe

 4) Run C:\GTK+3\testpygobject.bat and type away at the Python prompt :)

 If you decide to test these binaries:
 - patches welcome
 - note again that all this is *experimental*
 - do *not* use on production systems
 - there is *no* support
 - you are expected to be able to debug your own problems
 - you are on your own
 - there is no warranty
 - insert legalese here

 Have fun!

 mvg,
 Dieter


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

[pygtk] application custom stock icons not visible in ubuntu unity application indicator (visible in old system tray)

2011-12-05 Thread Giuseppe Penone
Hi,
I recently noticed that in ubuntu unity the application indicator (which
replaces the system tray) does not show the custom icons I added to the gtk
stock, but only the basic stock icons.
In place of the correct icons I see gtk-missing-image.
On my apps toolbars and menus those icons are displayed properly, the
problem is only with the top application indicator.
I use gtk ui manager after integrating the stock icons this way:


factory = gtk.IconFactory()
pixbuf = gtk.gdk.pixbuf_new_from_file(
filepath)
iconset = gtk.IconSet(pixbuf)
factory.add(stock_name, iconset)
factory.add_default()
###

then the appindicator code:

##
.
try:
import appindicator
HAS_APPINDICATOR = True
except: HAS_APPINDICATOR = False

if HAS_APPINDICATOR:
self.ind = appindicator.Indicator(x-tile,
indicator-messages, appindicator.CATEGORY_APPLICATION_STATUS)
self.ind.set_status(appindicator.STATUS_ACTIVE)
self.ind.set_attention_icon(indicator-messages-new)
self.ind.set_icon(x-tile)
self.ind.set_menu(self.ui.get_widget(/SysTrayMenu))
else:
self.status_icon = gtk.StatusIcon()
self.status_icon.set_from_stock(Tile Quad)
self.status_icon.connect('button-press-event',
self.on_mouse_button_clicked_systray)
self.status_icon.set_tooltip(_(Tile the Windows Upon your X
Desktop))
###

for full code:
hg clone https://giuspen-x-tile.googlecode.com/hg/ hg_x-tile
cd hg_x-tile
hg up x-tile2

The icons are visible when using system tray, not with application indicator
If anybody solved this problem please help.
Cheers,
Giuseppe.
___
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] application custom stock icons not working in ubuntu unity top panel menu

2011-11-29 Thread Giuseppe Penone
Hi,
I would not force users to remove unity appmenu, I would rather search for
a solution.
Thanks anyway.
Cheers,
Giuseppe.


On Tue, Nov 29, 2011 at 09:47, Paul Malherbe p...@tartan.co.za wrote:

 **
 Hi

 I am sorry, I misunderstood you.

 I got the same as you so I turned off the Unity menu and my app menu now
 works perfectly.

 Regards

 Paul Malherbe


  On 28/11/11 17:03, Giuseppe Penone wrote:

 Hi,
 I already have gnome-tweak-tools installed with Menus Have Icons to ON.
 In fact I can see default stock icons in menus, I cannot see the icons I
 added to stock, and only in ubuntu unity top panel.
 Cheers.


 On Mon, Nov 28, 2011 at 07:12, Paul Malherbe p...@tartan.co.za wrote:

  Hi

 I found that i had to install gnome-tweak-tool and then enable the icons
 and then enable menu icons under themes.

 Regards

  *Paul Malherbe*

   +27 (0) 21 6711866 %2B27%20%280%29%2021%206711866
  +27 (0) 82 9005260

 On 28/11/11 01:58, Giuseppe Penone wrote:

  Hi,
 I recently noticed that in ubuntu unity the top menu of my apps does not
 show the (custom) icons I added to the gtk stock, but only the basic stock
 icons.
 This happens only since the top menu is displayed in the unity top panel
 and not in the application window.
 In place of the correct icons I see gtk-missing-image.
 On my apps toolbars and other menus those icons are displayed properly,
 the problem is only with the top menu.
 This happens either with pygtk2 (e.g. http://www.giuspen.com/cherrytree/)
 and gobject introspection (e.g.
 http://www.giuspen.com/nautilus-pyextensions/).
 I use gtk ui manager after integrating the stock icons this way:

 factory = gtk.IconFactory()
 pixbuf = gtk.gdk.pixbuf_new_from_file(filepath)
 iconset = gtk.IconSet(pixbuf)
 factory.add(stock_name, iconset)
 factory.add_default()

 If anybody solved this problem please help.
 Cheers,
 Giuseppe.

   --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and
 is
 believed to be clean.


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


 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and
 is
 believed to be clean.

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



 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and is
 believed to be clean.


 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and is
 believed to be clean.

133e905a4963a482_graphics1133e905a4963a482_graphics2___
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] application custom stock icons not working in ubuntu unity top panel menu

2011-11-29 Thread Giuseppe Penone
Hi, seems a good workaround to me.
Thanks for the help, regards,
Giuseppe.


On Tue, Nov 29, 2011 at 13:58, Paul Malherbe p...@tartan.co.za wrote:

 **
 Hi

 I don't force the users to disable the Unity menu, I only disable in the
 specific pygtk app. by setting

 os.environ['UBUNTU_MENUPROXY'] = '0'

 Regards

 Paul Malherbe

 On 29/11/11 14:35, Giuseppe Penone wrote:

 Hi,
 I would not force users to remove unity appmenu, I would rather search for
 a solution.
 Thanks anyway.
 Cheers,
 Giuseppe.


 On Tue, Nov 29, 2011 at 09:47, Paul Malherbe p...@tartan.co.za wrote:

  Hi

 I am sorry, I misunderstood you.

 I got the same as you so I turned off the Unity menu and my app menu now
 works perfectly.

 Regards

 Paul Malherbe


   On 28/11/11 17:03, Giuseppe Penone wrote:

 Hi,
 I already have gnome-tweak-tools installed with Menus Have Icons to ON.
 In fact I can see default stock icons in menus, I cannot see the icons I
 added to stock, and only in ubuntu unity top panel.
 Cheers.


 On Mon, Nov 28, 2011 at 07:12, Paul Malherbe p...@tartan.co.za wrote:

  Hi

 I found that i had to install gnome-tweak-tool and then enable the icons
 and then enable menu icons under themes.

 Regards

  *Paul Malherbe*

   +27 (0) 21 6711866 %2B27%20%280%29%2021%206711866
  +27 (0) 82 9005260 %2B27%20%280%29%2082%209005260

 On 28/11/11 01:58, Giuseppe Penone wrote:

  Hi,
 I recently noticed that in ubuntu unity the top menu of my apps does not
 show the (custom) icons I added to the gtk stock, but only the basic stock
 icons.
 This happens only since the top menu is displayed in the unity top panel
 and not in the application window.
 In place of the correct icons I see gtk-missing-image.
 On my apps toolbars and other menus those icons are displayed properly,
 the problem is only with the top menu.
 This happens either with pygtk2 (e.g. http://www.giuspen.com/cherrytree/)
 and gobject introspection (e.g.
 http://www.giuspen.com/nautilus-pyextensions/).
 I use gtk ui manager after integrating the stock icons this way:

 factory = gtk.IconFactory()
 pixbuf = gtk.gdk.pixbuf_new_from_file(filepath)
 iconset = gtk.IconSet(pixbuf)
 factory.add(stock_name, iconset)
 factory.add_default()

 If anybody solved this problem please help.
 Cheers,
 Giuseppe.

   --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and
 is
 believed to be clean.


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


 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and
 is
 believed to be clean.

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



 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and
 is
 believed to be clean.


 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and
 is
 believed to be clean.



 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and is
 believed to be clean.


 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and is
 believed to be clean.

133ee8267cb6dd83_133e905a4963a482_graphics2133ee8267cb6dd83_133e905a4963a482_graphics1___
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] application custom stock icons not working in ubuntu unity top panel menu

2011-11-28 Thread Giuseppe Penone
Hi,
I already have gnome-tweak-tools installed with Menus Have Icons to ON.
In fact I can see default stock icons in menus, I cannot see the icons I
added to stock, and only in ubuntu unity top panel.
Cheers.


On Mon, Nov 28, 2011 at 07:12, Paul Malherbe p...@tartan.co.za wrote:

 **
 Hi

 I found that i had to install gnome-tweak-tool and then enable the icons
 and then enable menu icons under themes.

 Regards

  *Paul Malherbe*

   +27 (0) 21 6711866
  +27 (0) 82 9005260

 On 28/11/11 01:58, Giuseppe Penone wrote:

 Hi,
 I recently noticed that in ubuntu unity the top menu of my apps does not
 show the (custom) icons I added to the gtk stock, but only the basic stock
 icons.
 This happens only since the top menu is displayed in the unity top panel
 and not in the application window.
 In place of the correct icons I see gtk-missing-image.
 On my apps toolbars and other menus those icons are displayed properly,
 the problem is only with the top menu.
 This happens either with pygtk2 (e.g. http://www.giuspen.com/cherrytree/)
 and gobject introspection (e.g.
 http://www.giuspen.com/nautilus-pyextensions/).
 I use gtk ui manager after integrating the stock icons this way:

 factory = gtk.IconFactory()
 pixbuf = gtk.gdk.pixbuf_new_from_file(filepath)
 iconset = gtk.IconSet(pixbuf)
 factory.add(stock_name, iconset)
 factory.add_default()

 If anybody solved this problem please help.
 Cheers,
 Giuseppe.

 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and is
 believed to be clean.


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


 --
 This message has been scanned for viruses and
 dangerous content by *MailScanner* http://www.mailscanner.info/, and is
 believed to be clean.

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

graphics2graphics1___
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] Fwd: PYGTK

2011-09-08 Thread Giuseppe Penone
take a look at this
http://faq.pygtk.org/index.py?req=showfile=faq20.006.htp

Cheers,
Giuseppe.


On Wed, Sep 7, 2011 at 23:38, Ravindra Nagireddy shaw...@gmail.com wrote:

 hello,


 I am developing a GUI using PYGTK. I am really puzzled on how to make my
 GUI update dynamically. I am working on a networking project. I am
 representing each node in the network with an image. My GUI does not update
 when the number of nodes change during run time. Please help me out


 --
 Best Regards,

 Ravindra Nagireddy

 ___
 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] How to print any objects of a window?

2011-08-24 Thread Giuseppe Penone
option 1: you take a screenshot and then draw the pixbuf
option 2 :you have to draw the grid yourself and then the text inside the
cells computing the required space.
you can take a look at:
http://code.google.com/p/giuspen-cherrytree/source/browse/modules/printing.py


On Wed, Aug 24, 2011 at 14:06, Григорий Крамаренко djbal...@gmail.comwrote:

 I have simple report on window. The report consists of heading (gtk.Label)
 and the table (gtk.TreeView). How to print all(any) objects of a window?
 All found examples PrintOperation print either the text, or drawing.

 --
 С уважением, Григорий Крамаренко.

 ___
 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] Notebook Pages Not Populatingfrom Sabrina

2011-08-18 Thread Giuseppe Penone
Hi,
if I would be in you I would not continue to create and destroy the widgets
on the notebook pages.
For simplicity (and processing speed) I would draw in glade all possible
widgets and then from the code just show/hide what
you need according to the selected row, possibly grouping the widgets that
are together to be shown
in containers so that you just hide/show the father of all of them.
HTH, cheers,
Giuseppe.


On Thu, Aug 18, 2011 at 17:53, Sabrina Friedman utebachme...@gmail.comwrote:

 Hello all,

 I am working on an application (ReliaFree) using pyGTK2 to provide the
 GUI.  All of the data associated with this application is stored in
 MySQL databases.  When the database is opened, the data is loaded in a
 treeview.  When the user selects an item (row) in the treeview, various
 combobox and entry widgets are populated.  These widgets are grouped and
 organized on various notebook widget pages.  Since the information can
 change depending on whether the selected item is a component or an
 assembly, the combobox and entry widgets are created on the fly each
 time a new item is selected in the treeview.

 When I first load the database into the treeview, the widgets on the
 first two pages are created, shown, and populated.  However, on the
 third page, the widgets are not shown.  No errors are thrown, so I am
 assuming they are being created and populated.

1. If I cycle through all three pages in the notebook before
 selecting a new item (row) in the treeview, all of the widgets on all
 three pages will be shown thereafter.

2. If I select a new item (row) in the treeview without first
 cycling through the pages, only the widgets on the first page are
 shown.  Cycling through the pages causes the widgets to be shown
 thereafter.

 I've been trying to figure out what I'm doing wrong for quite awhile
 with no success.  Hopefully someone can point me in the right
 direction.  Thanks in advance for your help.

 Here is part of the function that loads the third page of the notebook
 with the treeview row data:

def load_calculation_results_tab(self, _index_):

# Clear any existing widgets from previously selected objects.
if(self.fraRelResults.get_child() is not None):
self.fraRelResults.get_child().destroy()

 SNIP

# Load the calculation results with Hardware or FRACA Tree
 information.
elif(_index_ == 2 or _index_ == 3):

if not self.app.HARDWARE._part:
(quad1,
 quad2,
 quad4) =
 self.app.ASSEMBLY.load_calc_results_tab(x_size=400,

 y_size=300)

 SNIP

self.fraRelResults.add(quad1)
self.fraMaintainResults.add(quad2)
self.fraMiscResults.add(quad4)

# Show the calculation results page.
page = self.notebook.get_nth_page(3)
page.show_all()

return False

 Here is part of the function called by the preceding function:

def load_calc_results_tab(self, x_size, y_size):

layout = gtk.Layout()
layout.set_size(x_size, y_size + 300)
quadrant1 = gtk.Alignment(xalign = 0.50,
  yalign = 0.50,
  xscale = 1.0,
  yscale = 1.0)
scrollwindow = gtk.ScrolledWindow()
scrollwindow.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
quadrant1.add(scrollwindow)
scrollwindow.add(layout)

for i in range(len(self._cr_tab_labels[0])):
label = _widg.make_label(self._cr_tab_labels[0][i],
 150, 25)
layout.put(label, 5, (30 * i + 5))

self.txtActiveHt = _widg.make_entry(editable=False, bold=True)
layout.put(self.txtActiveHt, 155, 5)
self.txtDormantHt = _widg.make_entry(editable=False, bold=True)
layout.put(self.txtDormantHt, 155, 35)
self.txtSoftwareHt = _widg.make_entry(editable=False, bold=True)
layout.put(self.txtSoftwareHt, 155, 65)

 SNIP

quadrant1.show_all()

 SNIP

self.txtActiveHt.set_text(str(self._attribute[28]))
self.txtDormantHt.set_text(str(self._attribute[29]))
self.txtSoftwareHt.set_text(str(self._attribute[32]))

 SNIP

return(quadrant1, quadrant2, quadrant4)


 Sabrina Friedman
 Billige Flüge Marketing GmbH
 Emanuelstr. 3,
 10317 Berlin
 Deutschland
 Telefon: +49 (33) 5310967
 Email: utebachme...@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] ScrolledWindow with TreeView is not behaving as expected

2011-07-04 Thread Giuseppe Penone
Hi Enrico,
in my opinion the scrolledwindow behaves correctly.
The scrolledwindow just takes the size of his parent and can hold child
widgets of any dimension thanks to the scrollbars.
The scrolledwindow is not supposed to change size according to what you
place inside.
Cheers,
Giuseppe.



On Sat, Jul 2, 2011 at 20:45, Enrico Minack enrico-min...@gmx.de wrote:

 Hi pygtk users,

 I am facing an unexpected behavior of a Gtk.Window with a ScrolledWindow
 containing a TreeView. The window always has minimal size. The behavior
 that I desire would be that the Gtk.Window scales as the TreeStore /
 TreeView grows until it reaches the limit of the screen. This happens
 without the ScrolledWindow. With a ScrolledWindow, the scroll bars then
 should appear when the TreeView does not fit the screen.

 I attached demo code. The set_policy method does not lead to the desired
 behavior.

 I'd highly appreciate any hints how the resize behavior of the
 ScrollWindow could be manipulated into the desired direction.

 Kind regards,
 Enrico Minack

 ___
 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] gtk_clipboard_set_with_data: (skip)

2011-07-02 Thread Giuseppe Penone
Hello Hart,
I know ctypes because I use them to wrap some xlib functionalities.
I will try this rpythonic wrapper.
Thank you for the tip,
best regards,
Giuseppe.


On Sat, Jul 2, 2011 at 03:33, Hart's Antler bhart...@yahoo.com wrote:

 Hi Giuseppe,
 Did you already know about the generated ctypes bindings to gtk?  It
 already supports gtk_clipboard_set_with_data.

 gtk_clipboard_set_with_data = _rpythonic_function_( 
 gtk_clipboard_set_with_data,
 ctypes.c_int, [
 (clipboard, ctypes.POINTER(_GtkClipboard)),
 (targets, ctypes.POINTER(_GtkTargetEntry)),
 (n_targets, ctypes.c_uint),
 (get_func, ctypes.CFUNCTYPE(ctypes.c_void_p,
 ctypes.POINTER(_GtkClipboard),ctypes.POINTER(_GtkSelectionData),ctypes.c_uint,ctypes.POINTER(ctypes.c_void_p),)),
 (clear_func, ctypes.CFUNCTYPE(ctypes.c_void_p,
 ctypes.POINTER(_GtkClipboard),ctypes.POINTER(ctypes.c_void_p),)),
 (user_data, ctypes.POINTER(ctypes.c_void_p)),] )


 I know no one is interested in using gtk with a ctypes like API, that's too
 low level.  To make things easy and more like the original pygtk, an object
 oriented API is also generated ontop of the low level ctypes API.  It here's
 a usage example:


 import os,sys, time
 if '..' not in sys.path: sys.path.append( '..' )
 import rpythonic
 gtk = rpythonic.module( 'gtk' )
 assert gtk
 gtk.init()
 win = gtk.window_new( gtk.GTK_WINDOW_TOPLEVEL )
 win.set_title('hello world')
 win.set_default_size( 320, 240 )
 def exit(*args): gtk.main_quit()
 win.connect( 'destroy', exit )
 frame = gtk.frame_new('hello world')
 win.add( frame )
 button = gtk.button_new_with_label(test)
 frame.add( button )
 def callback(*args): print('python callback')
 button.connect( 'clicked', callback )
 win.show_all()
 gtk.main()


 The latest ctypes gtk is precached in
 RPythonic/rpythonic/cache/genctypes/gtk
 http://rpythonic.googlecode.com/files/RPythonic-0.3.7.tar.bz2

 by the way, there is also a precached version for gtk3.
 -hart

 --- On *Fri, 7/1/11, Giuseppe Penone gius...@gmail.com* wrote:


 From: Giuseppe Penone gius...@gmail.com
 Subject: [pygtk] gtk_clipboard_set_with_data: (skip)
 To: phol...@src.gnome.org
 Cc: pygtk pygtk@daa.com.au
 Date: Friday, 1 July, 2011, 1:21 AM


 Hi Pavel,

 I'm a GTK+ developer that used to work in pygtk2 and now ported the code to
 pygobject introspection.
 For my (GPL) application http://giuspen.com/cherrytree I absolutely need
 the function gtk_clipboard_set_with_data
 that I see you marhed as NON introspectable.
 I wanted to ask you that function will ever be binded/what alternative
 should I use instead.

 Thank you and best regards,
 Giuseppe.

 -Inline Attachment Follows-

 ___
 pygtk mailing list   pygtk@daa.com.auhttp://mc/compose?to=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/

[pygtk] gtk_clipboard_set_with_data: (skip)

2011-07-01 Thread Giuseppe Penone
Hi Pavel,

I'm a GTK+ developer that used to work in pygtk2 and now ported the code to
pygobject introspection.
For my (GPL) application http://giuspen.com/cherrytree I absolutely need the
function gtk_clipboard_set_with_data
that I see you marhed as NON introspectable.
I wanted to ask you that function will ever be binded/what alternative
should I use instead.

Thank you and best regards,
Giuseppe.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] pygtk2 to pygobject/introspection

2011-06-30 Thread Giuseppe Penone
Did anybody notice that the function
gtk_clipboard_set_with_data ()is missing from the bindings?

method name=set_with_data
  c:identifier=gtk_clipboard_set_with_data
  introspectable=0

This is not a binding, this is a disaster.
___
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] pygtk2 to pygobject/introspection

2011-06-30 Thread Giuseppe Penone
+1: provide us a tutorial so that we can learn how to add missing binded
functions ourself and then provide the patch.


On Thu, Jun 30, 2011 at 20:19, Timo timomli...@gmail.com wrote:

 On 30-06-11 14:12, Dieter Verfaillie wrote:


 In short, don't be afraid to get your hands dirty :)

 In response to this, I'm actually willing to help out, but...
 What skills are needed? Should I have some specific knowledge?
 And if I can help, where should I start?

 Cheers,
 Timo


 mvg,
 Dieter


 --**--**
 This message was sent using IMP, the Internet Messaging Program.
 __**_
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/**listinfo/pygtkhttp://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/pygtkhttp://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] strange warnings in gtk3

2011-06-28 Thread Giuseppe Penone
Hi,

I tried using Debian before but the packages are way too old.

The reason why I need to use Ubuntu (Lubuntu actually, with lxde desktop) is
because
has great repositories, including the PPAs.

Cheers.



On Tue, Jun 28, 2011 at 05:58, Just Fill Bugs mozbug...@yahoo.com.auwrote:

 On 06/27/2011 02:00 AM, Timo wrote:

 On 26-06-11 14:57, Giuseppe Penone wrote:

 Hi,
 I ported my first application to gtk3 but continue to read the
 followig warning:

 `menu_proxy_module_load': python: undefined symbol:
 menu_proxy_module_load

 anybody knows the reason?

 Don't know the reason, but got the same warnings. I noticed that they
 only appear in a program with menus (a menubar or popup menu), as soon
 as you remove them, the messages disappear too.


 I searched for that message before. Looks like some ubuntu thing. Ubuntu
 forced a system menu over gtk applications.

 It's from appmenu-gtk package and can be removed by deleting
 /etc/X11/Xsession.d/80appmenu.

 Ubuntu is definitely not for developers. It's an end user application.
 Debian or Fedora are much better for developing work.



 __**_
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/**listinfo/pygtkhttp://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] How to run gtk.Builder.connect_signals multiple times?

2011-06-27 Thread Giuseppe Penone
I invite you to take a look to the source code of my simplest application
http://www.giuspen.com/nautilus-pyextensions/
where as you can see gtk.Builder() is called only once and there's no need
for further calls.

the code that you have to look for:

class GladeWidgetsWrapper:
   Handles the retrieval of glade widgets

   def __init__(self, glade_file_path, gui_instance):
  try:
 self.glade_widgets = gtk.Builder()
 self.glade_widgets.set_translation_domain(cons.APP_NAME)
 self.glade_widgets.add_from_file(glade_file_path)
 self.glade_widgets.connect_signals(gui_instance)
  except: print Failed to load the glade file

   def __getitem__(self, key):
  Gives us the ability to do: wrapper['widget_name'].action()
  return self.glade_widgets.get_object(key)

   def __getattr__(self, attr):
  Gives us the ability to do: wrapper.widget_name.action()
  new_widget = self.glade_widgets.get_object(attr)
  if new_widget is None: raise AttributeError, 'Widget %r not found' %
attr
  setattr(self, attr, new_widget)
  return new_widget

.

class NautilusPyExtensions:
   The application's main window

   def __init__(self, store):
  ...
  # instantiate the Glade Widgets Wrapper
  self.glade = GladeWidgetsWrapper(cons.GLADE_PATH +
'nautilus-pyextensions.glade', self)

.

furthermode in the code you access the widgets with self.glade.widgetname,
all signals are connected.

Hope this helps.
Giuseppe.







On Mon, Jun 27, 2011 at 17:02, Mac Ryan quasipe...@gmail.com wrote:

 I posted the same question on Stack Overflow, but so far it only got 3
 views and no answers... :(

 http://stackoverflow.com/questions/6492000

 In the design of my program I would like to pass around the
 gkt.Builder() instance to various modules (each of them has
 some of the handlers for managing the GUI), but I found out
 that once the builder is instantiated one can only call the
 connect_signals() method once: if called more than once, any
 call after the second will return None (which would mean:
 all signals have been connected, which is a blatant lie!).

 I tried to see if I could understand how/where gtk.Builder
 stores the handler names that are assigned within the Glade
 GUI, in order to write my own method to overcome this limitation,
 but after more than an hour of console experiments I still
 haven't understand where this information is stored.

 Is there anybody on the list that is able to advice me? Basically I
 would be happy in any of these scenarios:

 * Find a way to re-use the same builder over and over.
 * Find an alternative method to *AUTO-assign* methods of various modules
  as callbacks to GUI-emitted signals (with the GUI being defined in a
  monolithic Glade Builder XML file).
 * Find a way to extract from the from the gtk.Builder (or in some other
  way) the pairs widget-instance-expected-handler-name as defined in
  the Glade editor.

 As for my previous mail on this list: I solved the problem myself:
 what I misunderstood was the correct use of the method dialogue.run().

 Thanks in advance for your time,
 /mac
 ___
 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] How to run gtk.Builder.connect_signals multiple times?

2011-06-27 Thread Giuseppe Penone
Hi,

I'm looking through your code right now, but it's not evident to me how
 this solves my problem. If I understand your code correctly, you call
 gtk.Builder.connect_signals() only once in the __init__ method of
 the GladeWidgetsWrapper class.


yes, this is enough to connect:

def on_window_delete_event(self, widget, event, data=None):
Before close the application: check the Consistence of the model
with the instanced Nautilus
return self.quit_application()

that is the only one that I specify in glade.
I don't like generally to use glade for signals but you can try to set all
signals you want and just define a function with the same name and it will
work.

1. Single glade file that contains various top-level containers
   (windows, dialogues...)


this is not a problem


 2. The glade file also define the expected callbacks for a few events
   (like on_mybutton_clicked, etc...)


ok


 3. I have various modules (= different files = different classes) each
   of them containing *some* of these callbacks. For example I have a
   mainwindow.py module that have handlers like on_main_destroy_event
   or on_main_resize, but I also have a mainmenu.py one with handlers
   like on_file_open_activated or on_quite_activated.


this is a problem.
I always defined the glade callbacks in the same class,
I'm afraid you can't split them in different modules unless you use
different glade files
for different classes.

Cheers,
Giuseppe.
___
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] porting gtk2 to gtk3

2011-06-27 Thread Giuseppe Penone
I looked there too but what I need has the mark introspectable=0
that, as described in http://live.gnome.org/PyGObject/IntrospectionPorting
means Non-introspectable functions/methods.

The problem is that there's not a solution for this.

There's an example

For example, Gtk.Menu.popup() is not introspectable in GTK, but the GTK
override implements this method in terms of Gtk.Menu.popup_for_device()

but I searched for similar functions printing dir(Gdk), dir(Gdk.Window) and
everything possible but I found nothing.




On Mon, Jun 27, 2011 at 18:44, Tomeu Vizoso to...@sugarlabs.org wrote:

 Hi,

 On Sat, Jun 25, 2011 at 22:45, Giuseppe Penone gius...@gmail.com wrote:
  Hi,
 
  I'm trying to understand what's the pygi code for:
  gdk_x11_window_foreign_new_for_display ()
  and
  gdk_x11_window_lookup_for_display ()
  but cannot find a working solution.

 I would try looking up the C symbol in GdkX11-3.0.gir.

 Regards,

 Tomeu

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

[pygtk] strange warnings in gtk3

2011-06-26 Thread Giuseppe Penone
Hi,
I ported my first application to gtk3 but continue to read the followig
warning:

`menu_proxy_module_load': python: undefined symbol: menu_proxy_module_load

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

[pygtk] gir1.2-nautilus-2.0

2011-06-26 Thread Giuseppe Penone
Hi,
I've always used the good package python-nautilus for the python extensions,
but now it seems that python-nautilus works with pygtk2 only.
As I found out that between the gir1.2-* there's also a binding to nautilus,
can anybody point me to a simple demo to understand how this binding work?
(where to place the extension files and so on...)
Cheers.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] porting gtk2 to gtk3

2011-06-25 Thread Giuseppe Penone
Hi,

I'm trying to understand what's the pygi code for:
gdk_x11_window_foreign_new_for_display ()
and
gdk_x11_window_lookup_for_display ()
but cannot find a working solution.

what I need is to replace:
gtk.gdk.window_foreign_new_for_display(*display*, *anid*)
and
gtk.gdk.window_lookup_for_display(*display*, *anid*)

If anybody knows the solution, please help.

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

[pygtk] gir1.2-gtk-2.0 and gir1.2-gtk-3.0 together

2011-06-16 Thread Giuseppe Penone
Hi all,

I'm trying (like many others) to port code from pygtk2 to gi.

I'm running ubuntu 11.04, I first had only gir1.2-gtk-2.0 and, running the
following lines:

from gi.repository import Gtk
print Gtk

I get gi.module.DynamicModule 'Gtk' from
'/usr/lib/girepository-1.0/Gtk-2.0.typelib'

then I install also gir1.2-gtk-3.0 (together with gtk3), and running the
same lines I get:

gi.module.DynamicModule 'Gtk' from
'/usr/lib/girepository-1.0/Gtk-3.0.typelib'

so my question is, how can I point to a Gtk version when both 2 and 3 are
installed?
Cheers,
Giuseppe.
___
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] Translating tool tip with non ascii characters.

2011-05-02 Thread Giuseppe Penone
it's full of glade files including non ascii characters out there (mainly
the translators names filled in the about dialog) and it works, the encoding
is utf-8.


On Mon, May 2, 2011 at 2:46 AM, Gerald Britton gerald.brit...@gmail.comwrote:

  I have a question:

  Does anyone know if a tooltip string, generated from glade file, is of
  type string or unicode.

  I think that the string must be unicode when calling gettext and the
  string contains non ascii
  characters.

  At least it is so for tooltips generated in python code.


 --
 Gerald Britton
 ___
 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] Method set_wrap_mode of widget TextView

2011-04-29 Thread Giuseppe Penone
As you can read from the reference page (
http://www.pygtk.org/pygtksourceview/class-gtksourceview.html),

class gtksourceview.SourceView(gtk.TextView):
gtksourceview.SourceView
http://www.pygtk.org/pygtksourceview/class-gtksourceview.html#constructor-gtksourceview(*buffer*=None)


gtksourceview.SourceView inherits from gtk.TextView, so the answer is yes.

cheers,
Giuseppe.



On Fri, Apr 29, 2011 at 10:36 PM, craf pyclut...@gmail.com wrote:

 Hi.

 Anyone know if the method of widget gtk.TextView (set_wrap_mode) , can
 be applied also to widget gtksourceview?

 Regards.

 Cristian Abarzúa F.

 ___
 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] Number lines in a textview control

2011-04-28 Thread Giuseppe Penone
you have to use gtksourceview rather than gtktextview:
http://www.pygtk.org/pygtksourceview/class-gtksourceview.html#method-gtksourceview--set-show-line-numbers
cheers,
Giuseppe.
http://www.pygtk.org/pygtksourceview/class-gtksourceview.html#method-gtksourceview--set-show-line-numbers

On Wed, Apr 27, 2011 at 11:02 PM, craf pyclut...@gmail.com wrote:

 Hi.

 I searched Google, but can not find a clear way of how to number lines
 in a TextView control.
 Any information you could give me an idea, thanks in advance!

 Regards.

 Cristian Abarzúa


 ___
 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] how to set the active radiobutton without emitting a toggle or clicked signal?

2011-04-23 Thread Giuseppe Penone
I have a variable in my program named user_active which is by default True

when I want to toggle avoiding the signal I do:

user_active = False
operation that causes the signal
user_active = True

then in the callback

on_button_toggled()
   if not user_active: return
   

Cheers,
Giuseppe.


On Sat, Apr 23, 2011 at 7:50 AM, Ryan Krauss ryanli...@gmail.com wrote:

 I am setting the active radio button in a group using the set_active
 method.  I want to do this without causing the toggled or clicked
 signals being emitted, or I at least want to somehow know the
 difference in the program between the programming setting the active
 radio and the user actually clicking the radio with the mouse (or by
 using a keyboard accelerator that is mapped to click).  Basically, I
 have some code I want to run only when the user really clicked or used
 a keyboard accel.  I don't want the code to run when the program set
 the radio.  How can this be accomplished?

 Thanks,

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

[pygtk] connect to the event selection changed in textbuffer/textview

2011-04-16 Thread Giuseppe Penone
Hi,
I would like to connect to any situation when the selection in the
textbuffer/textview changes:

1) from no selection to selection
2) the selection changed bounds
3) from selection to no selection

but I see no way to do it since there's no a signal for this.
If anybody has a clue about how to obtain it please help.
Best regards,
Giuseppe.
___
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] Putting a link inside a label

2011-04-14 Thread Giuseppe Penone
I think for this you need to add a textview inside of the button, then it's
easy to have a clickable link there as you can see in the pygtk-demo (run
pygtk-demo in a terminal to open it, then search for Text Widget -
Hypertext).

Cheers,
Giuseppe.


On Thu, Apr 14, 2011 at 2:46 AM, Jason Heeris jason.hee...@gmail.comwrote:

 I have a label (actually a WrapLabel[1]) containing some warning text.
 I'd like for a couple of the words of the text to take on the
 appearance of a hyperlink which, when clicked, activate another widget
 in the app (a notebook tab). I can't figure out how to do this — I've
 looked at the LinkButton widget, but it's not something you can just
 insert into the flow of text (is it?).

 Is there some other way to do this?

 Cheers,
 Jason

 [1] From http://git.gnome.org/cgit/meld/tree/meld/ui/wraplabel.py
 ___
 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] Recent changes to the PyGTK Reference Manual

2011-04-11 Thread Giuseppe Penone
I agree, the new graphic of the pygtk reference (as well as the new gtk
reference)
is a finger in the eye, terrible indeed.

Cheers,
Giuseppe.



On Mon, Apr 11, 2011 at 3:30 AM, Jason Heeris jason.hee...@gmail.comwrote:

 I'd like to offer some criticism of the new format of the PyGTK 2.0
 Reference Manual at http://developer.gnome.org/pygtk/stable/

 I use this reference all the time, but the recent changes make it
 extremely difficult to use — primarily the fact that the table of
 contents (which is to me the most important navigational tool for the
 reference) is squashed up on the right hand side. The fact that it is
 next to acres of empty space (below the list of examples) that it
 could otherwise fill is also a little odd.

 I notice that it's only on the front page that the TOC is even
 visible, making it seem even more perverse that it's so hard to use :)

 Would it be possible to move it back into the centre of the page, and
 maybe add more differentiation between the node titles and their
 description — possibly making it not a wall of traffic-cone orange
 text? I'd suggest: keep the orange for the node titles, but render the
 descriptions in the grey used for body text.

 If someone tells me what to submit changes against, I'd be happy to
 look into it myself.

 Cheers,
 Jason
 ___
 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] centralized multiple instances of a pygtk app

2011-04-02 Thread Giuseppe Penone

 Gedit was only an example of how a single process can manage different
 windows, not of how a single process can receive new calls from it being
 executed (because gedit does that through DBus, which is not a solution
 for you).

 But once you switch to the one process, any number of windows
 principle, then _that_ single process can spawn, with multiprocessing,
 its server, stuck listening, and any new process will just tell _that_
 server what to open, and then would die in peace.

 For instance, currently when I ask CherryTree to create a new instance,
 the currently open one is closed. Instead, the app could open it in a
 new window. Being able to do something like that that doesn't solve the
 problem of the communication with new processes independently spawned,
 but seems to me a first step.

 Pietro


I finally succeeded with the principle you adviced one process, any number
of windows, adding
just one thread that acts as the server.

Many thanks you for the help, best regards,
Giuseppe.
___
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] centralized multiple instances of a pygtk app

2011-04-01 Thread Giuseppe Penone
The project is not big and complex, no hard to change, it's just me that
have not clear how to behave yet.

You say in gedit there's always one process, I don't understand how he can
listen to the attempt of the user to open a new file,
a server should always be in a dedicated process... maybe I'll try to search
in gedit code.

Giuseppe.



On Fri, Apr 1, 2011 at 8:26 AM, Pietro Battiston m...@pietrobattiston.itwrote:

 Il giorno gio, 31/03/2011 alle 23.59 +0200, Giuseppe Penone ha scritto:
  The reason to have more instances in my app (giuspen.com/cherrytree)
  is that the user can have more tree notes and copy/paste from one to
  the other.

 Again, instances != processes. Take gedit: as many toplevel windows
 as you want, each one with as many open notebooks as you want, you
 obviously can copy/paste from one to the other... and still, only one
 process running at any time.

 Then, if you're saying that your project is big, complex and now it's
 too hard to change, that's another point. But if that's the point, my
 impression is that _whatever_ communication mechanism you use, it will
 be very hard to coordinate open instances: for instance, even if you
 could use DBus, what of the many open processes would act as a server?!

 Pietro



 
  Cheers,
  Giuseppe.
 
 
 
  On Thu, Mar 31, 2011 at 9:30 PM, Pietro Battiston
  m...@pietrobattiston.it wrote:
  Il giorno gio, 31/03/2011 alle 20.44 +0200, Giuseppe Penone ha
  scritto:
   ok, so you advice that every instance of the app would have
  his own
   server (this is the only way any independent instance can
  listen and
   control the window in shared memory)
  
 
 
 
  Well, frankly speaking I started from the assumption that at
  every
  moment there will be only _one_ instance of the app (with its
  own
  server), handling all the windows. Every time the user calls
  it, a new
  one starts, but dies within moments, and tells the original
  one to open
  the file (or open an empty window if no filename is given,
  that depends
  on the app).
  Is there some particular reason why you must have more
  instances running
  at the same time?
  If there is, then my idea is still extendable, but things
  become indeed
  more complex.
 
  Pietro
 
 
 


 ___
 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] centralized multiple instances of a pygtk app

2011-03-31 Thread Giuseppe Penone

  which must be on a separate thread or separate process.


 I don't understand why this must be.  The controller object (or whatever)
 can run just fine in the same thread as all of the windows. The one example
 I have handy is Reinteract, which has a window associated with each
 notebook and only allows each notebook to be opened once.  An object of
 class Application keeps track of all of these windows.  You may wish to
 consider Application.open_notebook() in
 http://git.fishsoup.net/cgit/reinteract/tree/lib/reinteract/application.py 
 (This may not be the best example, because Reinteract does use threads.
  But the windows and the Application object all live in the main thread.)


In my idea a server is dedicated only to listen, so I don't understand how I
could work in a single thread/process, I will take a look to the example
link that you provided anyway,
thank you and best regards,
Giuseppe.
___
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] centralized multiple instances of a pygtk app

2011-03-31 Thread Giuseppe Penone
On Thu, Mar 31, 2011 at 12:35 AM, Johannes Sasongko sason...@gmail.comwrote:

  so far I've allowed a single instance only for simplicity but now I would
  like to introduce the opportunity to open more instances
  of different documents, but avoid to open twice the same document for
  mistake and instead put the running window to toplevel
  in case there's already an instance of that document opened.

 If I understand the problem correctly, you can easily do this using
 D-Bus. (If you're on GTK+ 3, GtkApplication makes it even easier; see
 its example code [1]. I assume you're on GTK+ 2, which doesn't have
 this.)

 [1] http://library.gnome.org/devel/gtk/unstable/GtkApplication.html

 To do this with D-Bus, in pseudocode:

 On app run:
Try to reserve a service address (bus name, in D-Bus terminology)
If succeeded:
Act as service provider, open windows when requested, etc.
// This is your main app process, the only one that ever lives
// for more than 1 second. Thus, it contains your GUI code as
// well as the D-Bus service.
else:
Send open file message to the existing service through D-Bus
Die

 On receiving open file message: // In main app
If file is already open:
Bring up the window
else:
Open file


The problem with dbus is that as far as I've read on the internet it is not
supported on windows (my app is mainly for linux but should work fine on
windows as well).
Thank you and best regards,
Giuseppe.
___
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] centralized multiple instances of a pygtk app

2011-03-31 Thread Giuseppe Penone
ok, so you advice that every instance of the app would have his own server
(this is the only way any independent instance can listen and control the
window in shared memory)



On Thu, Mar 31, 2011 at 8:42 PM, Pietro Battiston 
m...@pietrobattiston.itwrote:

 Il giorno gio, 31/03/2011 alle 20.27 +0200, Pietro Battiston ha scritto:
  Il giorno gio, 31/03/2011 alle 20.01 +0200, Giuseppe Penone ha scritto:
  
   (Assuming that indeed there's no way of using sockets in a
   non-blocking
   fashion - I'm totally ignorant about that) maybe having a
   little process
   created with multiprocessing would be simpler  more portable,
   for you,
   than using threading? I guess a single one is sufficient, so
   the
   overhead shouldn't be significant, even on Windows. Then, at
   every
   iteration of the main loop, the main process could check, from
   a shared
   Value (or Array), if there's something to open.
  
   (untested, sorry if I wrote something stupid)
  
   Hi Pietro,
   the problem of having a single and independent process dedicated to
   the job of server is that the server would not be able to rise a
   minimized/hidden window as consequence of the situation a new file
   open starts (user double click) unaware that the same file is already
   opened.
 
 
  The server should not, that would be the job of the main process...
 
  User: Hey, program, open that file
  Main process1: starts, spawns the server through the multiprocessing
  module
  Server1: Hey, main process, there is no open instance, have fun
  Main process1: thanks, opens the file in a new window
 
  later...
 
  User: Hey, program, open that file
  Main process2: starts, spawns the server through the multiprocessing
  module
  Server2: hey, Main process2, there is an already open instance!
  Main process2: OK, tell it to open that file!
  Server2: Server1, could you please tell you friend Main process to open
  that file?
  Server1: Sure, Server2!
  (Main process2  Server2 exit)
  Server1: Hey, Main process2,

 Sorry Server1, but that's Main process1.

 Pietro

 ___
 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] centralized multiple instances of a pygtk app

2011-03-31 Thread Giuseppe Penone
The reason to have more instances in my app (giuspen.com/cherrytree) is that
the user can have more tree notes and copy/paste from one to the other.

Cheers,
Giuseppe.



On Thu, Mar 31, 2011 at 9:30 PM, Pietro Battiston 
m...@pietrobattiston.itwrote:

 Il giorno gio, 31/03/2011 alle 20.44 +0200, Giuseppe Penone ha scritto:
  ok, so you advice that every instance of the app would have his own
  server (this is the only way any independent instance can listen and
  control the window in shared memory)
 


 Well, frankly speaking I started from the assumption that at every
 moment there will be only _one_ instance of the app (with its own
 server), handling all the windows. Every time the user calls it, a new
 one starts, but dies within moments, and tells the original one to open
 the file (or open an empty window if no filename is given, that depends
 on the app).
 Is there some particular reason why you must have more instances running
 at the same time?
 If there is, then my idea is still extendable, but things become indeed
 more complex.

 Pietro


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

[pygtk] centralized multiple instances of a pygtk app

2011-03-30 Thread Giuseppe Penone
Hi,

the app I'm working on is let's say a rich text editor (
http://giuspen.com/cherrytree)

so far I've allowed a single instance only for simplicity but now I would
like to introduce the opportunity to open more instances
of different documents, but avoid to open twice the same document for
mistake and instead put the running window to toplevel
in case there's already an instance of that document opened.

it seems to me that the only way to obtain this is to have a server that
controls all the instances, being my app cross platform I
opted for a tcp/ip server in loopback 127.0.0.1.

the problem is that when the server opens a new thread, as soon as the new
thread enters the gtk main loop (gtk.main()) the server stucks.

I thought that a new thread, opened with thread.start_new_thread(..) was not
blocking but instead the main loop blocks all.

I found some tips on threading on pygtk (
http://faq.pygtk.org/index.py?file=faq20.006.htpreq=show) so I tried

gtk.threads_enter()
gtk.main()
gtk.threads_leave()

that works on the first opened instance but then crashes on the second.

If anybody has a clue about treating many instances of the same app being
aware of an already running instance/able to
control the already running instance rather than spawning a new one please
help me.

Best regards,
Giuseppe.
___
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] centralized multiple instances of a pygtk app

2011-03-30 Thread Giuseppe Penone
Hi Robert,

This makes sense, but I don't see why you need threads to do it. Multiple
 windows can be controlled by a single thread.  If a given document needs an
 intensive calculation, that can be split into it's own thread, but that
 seems orthogonal to having multiple documents open.


I cannot do everything in a single thread because, when the user tries to
open the same document again I should be aware that the document is already
opened and put the already opened window on top of the screen rather than
open two instances of the same document.

If you double click on a text file, then just minimize the window and double
click again upon the same file you will understand the (correct) behavior
that apps such as gedit have.

So I need a centralized server or something like that, which must be on a
separate thread or separate process.


 Especially if you're communicating over a socket.  If you're doing this,
 why not run each document in its own process?  You'd get even more
 separation (no GIL) and don't have to worry about how to call GTK functions
 from multiple threads.


I could keep separate processes but this way I'm afraid I would not be able
to control the window of another process unless all processes/windows have
their own server, so the server being not only one but one per instance,
maybe I'll try this solution.

Thank you and best regards,
Giuseppe.
___
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] catch key_press_event on gtk.CellRendererText (or gtk.TreeViewColumn)

2011-03-24 Thread Giuseppe Penone
Thank you Iñigo, I have the callback working now.
Best regards,
Giuseppe.


On Thu, Mar 24, 2011 at 12:16 AM, Iñigo Serna inigose...@gmail.com wrote:

 Hi,

 On 23 March 2011 18:59, Giuseppe Penone gius...@gmail.com wrote:
  Hi,
  I have a table with editable cells implemented with liststore+treeview in
 my
  application http://giuspen.com/cherrytree .
  I'm trying to connect a callback to any char inserted in a editable
  liststore cell but I cannot find a way since
 
 [...]
 
  If anybody has an example to provide or a clue please help me.
  Thanks  best regards,
  Giuseppe.

 Take a look at:

 https://bitbucket.org/inigoserna/bidebarrieta/src/517f2cbc48d8/ui/listview.py

 * definition: method __add_tvcol(), lines 87-95
 * action callbacks: methods on_text_edited_started() and
 on_text_edited(), lines 336-394


 Hope it helps,
 Iñigo Serna

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

[pygtk] catch key_press_event on gtk.CellRendererText (or gtk.TreeViewColumn)

2011-03-23 Thread Giuseppe Penone
Hi,
I have a table with editable cells implemented with liststore+treeview in my
application http://giuspen.com/cherrytree .
I'm trying to connect a callback to any char inserted in a editable
liststore cell but I cannot find a way since

1) when the user is inserting text in an editable liststore text cell the
event is not catched from the treeview
2) neither gtk.CellRendererText nor gtk.TreeViewColumn descend from a widget
(but gtk.object instead).
3) I tried to connect signals to gtk.object how explained in
http://faq.pygtk.org/index.py?req=showfile=faq23.034.htp but no result
connecting either the gtk.CellRendererText and the gtk.TreeViewColumn

If anybody has an example to provide or a clue please help me.
Thanks  best regards,
Giuseppe.
___
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] catch key_press_event on gtk.CellRendererText (or gtk.TreeViewColumn)

2011-03-23 Thread Giuseppe Penone
Great help, I finally connected the callback, thank you very much.
Best regards,
Giuseppe.


On Wed, Mar 23, 2011 at 7:58 PM, Alessandro Dentella san...@e-den.itwrote:

 On Wed, Mar 23, 2011 at 06:59:24PM +0100, Giuseppe Penone wrote:
  Hi,
  I have a table with editable cells implemented with liststore+treeview in
 my
  application http://giuspen.com/cherrytree .
  I'm trying to connect a callback to any char inserted in a editable
 liststore
  cell but I cannot find a way since
 
  1) when the user is inserting text in an editable liststore text cell the
 event
  is not catched from the treeview

 It should not in fact. In that moment it's a gtk.Entry your widget and
 that's the widgets that feels the events.

  2) neither gtk.CellRendererText nor gtk.TreeViewColumn descend from a
 widget
  (but gtk.object instead).

 no problem

  If anybody has an example to provide or a clue please help me.
  Thanks  best regards,

 You can see [1] but it's probably a bit difficult to understand it at a
 glance. The sense it that in the editing_started_cb the 'editable' var
 contains the gtk.Entry, you can connect to that Entry to implement wahtever
 you need.


 sandro
 *:-)




 [1]
 http://hg.argolinux.org/py/sqlkit/file/b27e0a1085ef/sqlkit/widgets/table/columns.py#l457



 --
 Sandro Dentella  *:-)
 http://www.reteisi.org Soluzioni libere per le scuole
 http://sqlkit.argolinux.orgSQLkit home page -
 PyGTK/python/sqlalchemy
 ___
 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] TextBuffer to Markup

2011-02-16 Thread Giuseppe Penone
I implemented a class for my application CherryTree that does exactly what
you asked for,
take a look at:

http://code.google.com/p/giuspen-cherrytree/source/browse/modules/exports.py

hth, cheers,
Giuseppe.


On Wed, Feb 16, 2011 at 6:05 PM, Bradlee Landis bradleelan...@gmail.comwrote:

 Is there an easy way to convert from a TextBuffer to the Pango Markup
 Language? I can't seem to find it, even though it seems like it would
 be a desired feature by at least a few people.

 I need to save the data inside an XML document, with formatting
 intact, and so I was just going to use the Pango Markup Language to
 store it. I would accept other suggestions though.

 --
 Thanks,
 Brad Landis
 ___
 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] Glade 3 MenuItem and Submenu

2011-02-16 Thread Giuseppe Penone
take a look at this tutorial

http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html

cheers.


On Wed, Feb 16, 2011 at 8:55 PM, svabodaf...@libero.it 
svabodaf...@libero.it wrote:

 Where I can find some documentation more detailed on the utilization of
 Glade
 and  Python?  I am a novice of python and if I did not understood badly the
 usage of  Glade  is complementary with the Gtk of Python.  Now I am
 experiencing to do the mine 1° program with these two tools, but am in
 difficulty.  I created some Menuitem in Glade, and then I would like to
 create
 from program (therefore to be able to use more times the same window) the
 Submenu to one or more of these menuitem and then obviously I would like to
 be
 able manage them.  Someone could help me or to give indications to be able
 move
 me the solution of my problem?

 Thanks Giovanni
 ___
 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/

[pygtk] keyboard shortcuts visible only in main menu

2011-02-07 Thread Giuseppe Penone
Hi,
I'm using gtk.uimanager for all menus but the keyboard shorcuts are visible
only in the main menu.
I use the same xml nodes for example for the main menu and for a popup menu
but no keyboard shortuts in the popup menu.
Is there a way to enable the display of the keyboard shortcuts in all menu
items?
Regards.
___
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] Glade 3 / Builder / Combobox

2011-01-26 Thread Giuseppe Penone
I would not use glade for liststores/treestores/comboboxes, it's much
simpler to write the code yourself as you can read from:

http://www.pygtk.org/pygtk2tutorial/sec-ComboBoxAndComboboxEntry.html

then if you want you can add the treeview to a scrolledwindow of the glade
interface but from pygtk code



On Wed, Jan 26, 2011 at 3:56 AM, Adam Tauno Williams awill...@whitemice.org
 wrote:

 Please forgive this question if the answer is obvious but I've searched
 and not had any luck.  Also, having done this frequently in C#/.NET I
 could just be fuzzing over the obvious answer.

 I am building a PyGTK app using Glade-3 / Gtk.Builder.  And I'm stumped
 as to how ListStore models and ComboBoxes can be easily correlated.  In
 Glade-3 I don't seem to be able to pick a column type for a ListStore
 that is compatable with str or GObject.TYPE_STRING - so I can't enter
 data into the model in Glade.

 What I want is to simply create some combo boxes that contain a value 
 descripton, but only display the description, so I can retrieve the
 selected value.

 Does anyone have a current HOWTO / FAQ link addressing this issue?  Any
 tips would be appreciated.

 ___
 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] PyGTK New User

2011-01-22 Thread Giuseppe Penone
Hi Soumyaroop,

yes you have to create a container object that contains a label widget and
the entry widget.

I advice you to read the official pygtk tutorial:
http://www.pygtk.org/pygtk2tutorial/index.html
or this also is not bad: http://zetcode.com/tutorials/pygtktutorial/

Regards,
Giuseppe.


On Sat, Jan 22, 2011 at 8:34 PM, Soumyaroop Roy soumyar...@gmail.comwrote:

 Hi there:

 I am a PyGTK newbie and I want to know if it is possible to attach
 labels to entry widgets. For e.g., if I were to assign a token to an
 argument switch (foo -arg1 value1), I am contemplating that value1
 will be entered through the entry widget (by the user) and -arg1
 will be its label. Does that sound ok? So, do I have to create a
 container object that contains a label widget and the entry widget?

 regards,
 Soumyaroop
 ___
 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/

[pygtk] problem pasting clipboard content from arabic website (target text/html)

2011-01-12 Thread Giuseppe Penone
Hi,
I have a problem with gtk.clipboard() and gtk.selectiondata() in my open
source app http://giuspen.com/cherrytree
when pasting clipboard content from arabic website taking data from the
target text/html.

when printing the selectiondata.data I can see that the content is: (print
to terminal)

��span style=font-size: 130%;span style=color: red;span
style=color: black;'DE4GH1 H'D1'9 AI 'D'5/'1
'D,/J/ *E '5D'- (96 'D9DD H*E
9ED/span/span/span

where the first two chars are 255 and 254.

when I write to the textbuffer I see:
'DE4GH1 H'D1'9 AI 'D'5/'1 'D,/J/ *E '5D'- (96 'D9DD H*E 9ED

instead of:
المشهور والرائع فى الاصدار الجديد تم اصلاح بعض العلل وتم عمل

I checked the source code of the website (http://ubuntu-c.blogspot.com/) and
the encoding is utf-8, so I don't have idea of how to behave.
Please if anybody can give me a clue help me.
Regards,
Giuseppe.
___
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] problem pasting clipboard content from arabic website (target text/html)

2011-01-12 Thread Giuseppe Penone
Yes it's mozilla firefox.
I tried with

input_string.decode(utf-16, ignore)

but what I get is

猼慰瑳汹㵥昢湯⵴楳敺›㌱┰∻㰾灳湡猠祴敬∽潣潬㩲爠摥∻㰾灳湡猠祴敬∽潣潬㩲戠慬正∻䐾㑅䡇‱❈ㅄ☧‹䥁✠❄⼵ㄧ✠ⱄ䨯
䔪✠䐵ⴧ⠠㘹✠㥄䑄䠠䔪㤠䑅⼼灳湡㰾猯慰㹮⼼灳湡

Regards,
Giuseppe.


On Wed, Jan 12, 2011 at 3:17 PM, Tomeu Vizoso to...@sugarlabs.org wrote:

 On Wed, Jan 12, 2011 at 13:34, Giuseppe Penone gius...@gmail.com wrote:
  Hi,
  I have a problem with gtk.clipboard() and gtk.selectiondata() in my open
  source app http://giuspen.com/cherrytree
  when pasting clipboard content from arabic website taking data from the
  target text/html.

 What browser is it? I think Mozilla used to put utf-16 in text/html.

 Regards,

 Tomeu

 
  when printing the selectiondata.data I can see that the content is:
 (print
  to terminal)
 
  ��span style=font-size: 130%;span style=color: red;span
  style=color: black;' D E 4 G H 1 H ' D 1 '  9 A I ' D ' 5 / ' 1 ' D ,
 /
  J / * E ' 5 D ' - ( 9 6 ' D 9 D D H * E 9 E D /span/span/span
 
  where the first two chars are 255 and 254.
 
  when I write to the textbuffer I see:
  'DE4GH1 H'D1'9 AI 'D'5/'1 'D,/J/ *E '5D'- (96 'D9DD H*E 9ED
 
  instead of:
  المشهور والرائع فى الاصدار الجديد تم اصلاح بعض العلل وتم عمل
 
  I checked the source code of the website (http://ubuntu-c.blogspot.com/)
 and
  the encoding is utf-8, so I don't have idea of how to behave.
  Please if anybody can give me a clue help me.
  Regards,
  Giuseppe.
 
  ___
  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] problem pasting clipboard content from arabic website (target text/html)

2011-01-12 Thread Giuseppe Penone
Yes I also was thinking that, being the first two chars not valid (\0xff and
\0xfe), the problem is that I cannot find a reference to understand what is
the encoding according to those chars.
Looking on the html of the webpage it tells utf-8 but probably then firefox
uses another to fill the clipboard.

Regards,
Giuseppe.


On Wed, Jan 12, 2011 at 5:18 PM, Dieter Verfaillie 
diet...@optionexplicit.be wrote:

 On 12/01/2011 16:03, Giuseppe Penone wrote:
  Yes it's mozilla firefox.
  I tried with
 
  input_string.decode(utf-16, ignore)
 
  but what I get is
 
  猼慰瑳汹㵥昢湯⵴楳敺›㌱┰∻㰾灳湡猠祴敬∽潣潬㩲爠摥∻㰾灳湡猠祴敬∽潣潬㩲戠慬正∻䐾㑅䡇‱❈ㅄ☧‹䥁✠❄⼵ㄧ✠ⱄ䨯
  䔪✠䐵ⴧ⠠㘹✠㥄䑄䠠䔪㤠䑅⼼灳湡㰾猯慰㹮⼼灳湡

 Never had a need for it myself, but I've stumbled over this a couple
 of times: the tuple returned by clipboard.wait_for_targets() seems to
 contain a hint to the encoding of the data. At least in the case where
 you copied from a mozilla application (firefox/thunderbird/maybe
 others).

 hth,
 Dieter

___
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] problem pasting clipboard content from arabic website (target text/html)

2011-01-12 Thread Giuseppe Penone
Great help, thank you very much.
Regards,
Giuseppe.


On Wed, Jan 12, 2011 at 8:00 PM, Dieter Verfaillie 
diet...@optionexplicit.be wrote:

 On 12/01/2011 16:24, Giuseppe Penone wrote:
  Yes I also was thinking that, being the first two chars not valid (\0xff
 and
  \0xfe)

 That would be the BOM (Byte Order Mark)...

 , the problem is that I cannot find a reference to understand what is
  the encoding according to those chars.

 ... for UTF-16LE (or UTF-16 for short). You'll also want to be careful
 about NULL characters.

 The attached fragment accepts html pastes from firefox/thinderbird
 and correctly shows the Arabic fragment from your original message
 when copied from thunderbird.

 Hey, it even honors RTL, which is kinda neat :)

 mvg,
 Dieter

___
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] problem pasting clipboard content from arabic website (target text/html)

2011-01-12 Thread Giuseppe Penone
It helped thank you,

the first hexs being 0xfffe or 0xfeff indicate utf-16.

regards,
Giuseppe.


On Wed, Jan 12, 2011 at 6:15 PM, Tomeu Vizoso to...@sugarlabs.org wrote:

 On Wed, Jan 12, 2011 at 16:03, Giuseppe Penone gius...@gmail.com wrote:
  Yes it's mozilla firefox.
  I tried with
 
  input_string.decode(utf-16, ignore)

 Reading this code helped me with fixing interoperability between Sugar
 and Mozilla, but was a long time ago and don't remember the details:


 http://mxr.mozilla.org/mozilla-central/source/widget/src/gtk2/nsClipboard.cpp#707

 HTH,

 Tomeu

  but what I get is
 
  猼慰瑳汹㵥昢湯⵴楳敺›㌱┰∻㰾灳湡猠祴敬∽潣潬㩲爠摥∻㰾灳湡猠祴敬∽潣潬㩲戠慬正∻䐾㑅䡇‱❈ㅄ☧‹䥁✠❄⼵ㄧ✠ⱄ䨯
 䔪✠䐵ⴧ⠠㘹✠㥄䑄䠠䔪㤠䑅⼼灳湡㰾猯慰㹮⼼灳湡
 
  Regards,
  Giuseppe.
 
 
  On Wed, Jan 12, 2011 at 3:17 PM, Tomeu Vizoso to...@sugarlabs.org
 wrote:
 
  On Wed, Jan 12, 2011 at 13:34, Giuseppe Penone gius...@gmail.com
 wrote:
   Hi,
   I have a problem with gtk.clipboard() and gtk.selectiondata() in my
 open
   source app http://giuspen.com/cherrytree
   when pasting clipboard content from arabic website taking data from
 the
   target text/html.
 
  What browser is it? I think Mozilla used to put utf-16 in text/html.
 
  Regards,
 
  Tomeu
 
  
   when printing the selectiondata.data I can see that the content is:
   (print
   to terminal)
  
   ��span style=font-size: 130%;span style=color: red;span
   style=color: black;' D E 4 G H 1 H ' D 1 '  9 A I ' D ' 5 / ' 1 '
 D
   , /
   J / * E ' 5 D ' - ( 9 6 ' D 9 D D H * E 9 E D /span/span/span
  
   where the first two chars are 255 and 254.
  
   when I write to the textbuffer I see:
   'DE4GH1 H'D1'9 AI 'D'5/'1 'D,/J/ *E '5D'- (96 'D9DD H*E 9ED
  
   instead of:
   المشهور والرائع فى الاصدار الجديد تم اصلاح بعض العلل وتم عمل
  
   I checked the source code of the website (
 http://ubuntu-c.blogspot.com/)
   and
   the encoding is utf-8, so I don't have idea of how to behave.
   Please if anybody can give me a clue help me.
   Regards,
   Giuseppe.
  
   ___
   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/

[pygtk] treeview drag n drop doesn't work on windows xp pygtk

2011-01-11 Thread Giuseppe Penone
Hi,

I successfully tested the example
http://www.pygtk.org/pygtk2tutorial/examples/treeviewdnd.py
on my linux distro but then when I tested on windows xp pygtk installation
the internal drag n drop was not working (no errors from the command line).
You can modify treeviewdnd.py adding the following lines at the end of the
__init__():

self.liststore.append([line 1])
self.liststore.append([line 2])
self.liststore.append([line 3])
self.liststore.append([line 4])

to have the list already filled up with no need to add elements so that you
can immediatly try to reorder the rows with drag n drop.

what I found out is that the callbacks drag_data_get_data and
drag_data_received_data are never called.
I tried with pygtk on python 2.6 and 2.7 with the latest versions of the
installers, but no way and never a message from the console.

Regards,
Giuseppe.
___
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] treeview drag n drop doesn't work on windows xp pygtk

2011-01-11 Thread Giuseppe Penone
The tree view drag and drop example that you indicated works fine on either
windows and linux and solved my problem, thanks a lot.
Regards,
Giuseppe.


On Tue, Jan 11, 2011 at 4:18 PM, Dieter Verfaillie 
diet...@optionexplicit.be wrote:

 Hi,

 On 11/01/2011 14:09, Giuseppe Penone wrote:
  I successfully tested the example
  http://www.pygtk.org/pygtk2tutorial/examples/treeviewdnd.py
  on my linux distro but then when I tested on windows xp pygtk
 installation
  the internal drag n drop was not working (no errors from the command
 line).
  You can modify treeviewdnd.py adding the following lines at the end of
 the
  __init__():

 I have no idea why the example from the tutorial does not work on
 windows (and have no time to investigate atm), but I can assure you
 treeview DnD does work fine on windows.

 There's another example script (originally intended as a test for
 bgo637214) that got committed to pygtk and that I'm sure works on
 windows:
 http://git.gnome.org/browse/pygtk/tree/examples/gtk/treeview_dnd.py

 You'll probably want to change line 57
 from:
self.set_drag_dest_row(None, pos)
 to:
self.set_drag_dest_row(path, pos)

 Passing None as the first parameter was for testing that bug report
 but is not all that useful if you want to learn about treeview DnD.

 hth,
 Dieter


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