Re: [pygtk] "gtk.Window.get_size()" returns wrong dimesntions after "resize()"?

2013-01-23 Thread Ajay Garg
On Wed, Jan 23, 2013 at 9:58 PM, Guan Xin  wrote:

> Hi Ajay,
>
> According to
>
>
> http://www.pygtk.org/docs/pygtk/class-gtkwindow.html#method-gtkwindow--get-size
>
> "As a result, if you call the resize() method then immediately call the
> get_size() method, the size won't have taken effect yet. After the window
> manager processes the resize request, PyGTK receives notification that the
> size has changed via a configure event, and the size of the window gets
> updated."
>
> So, perhaps it is expected.
>

Ahh.. Thanks Guan.. !

So, is there a workaround, whereby one get the correct, updated dimensions
(preferably in a synchronous manner), after "resize" is done?


>
> Regards,
> Guan
>
>
> On Wed, Jan 23, 2013 at 5:18 PM, Ajay Garg  wrote:
>
>> Hi all.
>>
>>
>> First I would like to paste the simplistic example, highlighting the
>> issue :
>>
>> #
>> import gtk
>> import gobject
>>
>> win = gtk.Window()
>> win.show()
>>
>> print win.get_size()# prints (200, 200)
>>
>> win.resize(100, 346)
>> print win.get_size()# still prints (200, 200) :-(
>>
>> gobject.MainLoop().run()
>> #
>>
>>
>>
>>
>> As can be seen, the "get_size()" continues printing the older dimensions,
>> even after a  "resize()" has been done?
>>
>>
>> Is it expected? Is there a way I can get "(100, 346)" to be printed in
>> the second call to "print win.get_size()" ?
>> (note that the resizing graphical-effect takes place without any issues)
>>
>>
>>
>>
>> Regards,
>> Ajay
>>
>> ___
>> pygtk mailing list   pygtk@daa.com.au
>> http://www.daa.com.au/mailman/listinfo/pygtk
>> Read the PyGTK FAQ: http://faq.pygtk.org/
>>
>
>


-- 
Regards,
Ajay
___
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.26  .
23/01/2013  22.26  ..
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\TEST>python test.py
C:\Documents and Settings\giu\Documenti\TEST\*ðÜð©ÐÇð©ð╗ð╗ð©Ðåð░.ctd*

C:\Documents and Settings\giu\Documenti\TEST>chcp
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 wrote:

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

2013-01-23 Thread Christian Mallwitz
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  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] 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] "gtk.Window.get_size()" returns wrong dimesntions after "resize()"?

2013-01-23 Thread Guan Xin
Hi Ajay,

According to

http://www.pygtk.org/docs/pygtk/class-gtkwindow.html#method-gtkwindow--get-size

"As a result, if you call the resize() method then immediately call the
get_size() method, the size won't have taken effect yet. After the window
manager processes the resize request, PyGTK receives notification that the
size has changed via a configure event, and the size of the window gets
updated."

So, perhaps it is expected.

Regards,
Guan


On Wed, Jan 23, 2013 at 5:18 PM, Ajay Garg  wrote:

> Hi all.
>
>
> First I would like to paste the simplistic example, highlighting the issue
> :
>
> #
> import gtk
> import gobject
>
> win = gtk.Window()
> win.show()
>
> print win.get_size()# prints (200, 200)
>
> win.resize(100, 346)
> print win.get_size()# still prints (200, 200) :-(
>
> gobject.MainLoop().run()
> #
>
>
>
>
> As can be seen, the "get_size()" continues printing the older dimensions,
> even after a  "resize()" has been done?
>
>
> Is it expected? Is there a way I can get "(100, 346)" to be printed in the
> second call to "print win.get_size()" ?
> (note that the resizing graphical-effect takes place without any issues)
>
>
>
>
> Regards,
> Ajay
>
> ___
> 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] "gtk.Window.get_size()" returns wrong dimesntions after "resize()"?

2013-01-23 Thread Ajay Garg
Hi all.


First I would like to paste the simplistic example, highlighting the issue :

#
import gtk
import gobject

win = gtk.Window()
win.show()

print win.get_size()# prints (200, 200)

win.resize(100, 346)
print win.get_size()# still prints (200, 200) :-(

gobject.MainLoop().run()
#




As can be seen, the "get_size()" continues printing the older dimensions,
even after a  "resize()" has been done?


Is it expected? Is there a way I can get "(100, 346)" to be printed in the
second call to "print win.get_size()" ?
(note that the resizing graphical-effect takes place without any issues)




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