Re: [pygtk] Lost in Gtk3 height-for-width geometry

2013-06-26 Thread Pietro Battiston
OK, last update on this issue: the problem lies in the fact that the X
server doesn't know anything about trading width for height, and so
determining a (minimum) allocation to ask for the toplevel window is not
a trivial thing to do for the layouting engine.

See this reply:
https://mail.gnome.org/archives/gtk-devel-list/2013-June/msg00053.html

and this bug:
https://bugzilla.gnome.org/show_bug.cgi?id=681937#c12

for more info.

Pietro


Il giorno mar, 18/06/2013 alle 17.10 +0200, Pietro Battiston ha scritto:
 I have found an explanation... in the official documentation.
 
 The minimum height for the minimum width is normally used to set the
 minimum size constraint on the toplevel (unless
 gtk_window_set_geometry_hints() is explicitly used instead).
 
 But the real answer to my problem is not in that sentence, but in its
 non-obvious (to me) consequence: Gtk.Widget.do_get_preferred_width()
 should _not_ return the minimal width the widget will ever be able to
 cope with, but rather its width in some reasonable form factor, though
 as compressed as possible.
 
 (still, I don't see the rational for this design choice, since the
 layout algorithm will not be able to know the _real_ minimum width of my
 widget)
 
 Pietro
 
 Il giorno lun, 17/06/2013 alle 20.20 +0200, Pietro Battiston ha scritto:
  Hello,
  
  I'm designing a widget. Its do_get_request_mode(self) returns
  Gtk.SizeRequestMode.HEIGHT_FOR_WIDTH.
  
  
  Now, in a testcase, the widget does the following:
  1) do_get_preferred_width() is called: it returns 53 (minimum), 212
  (natural)
  2) do_get_preferred_height_for_width() is called with width 53: it
  returns 170, 170
  3) do_get_preferred_height_for_width() is called with width 212: it
  returns 51, 51
  
  So far, so good: the widget has received all the calls I expected, and
  returned what I wanted it to. But now, what I would expect (at least in
  a test case in which no other widgets are reclaiming anything) would be
  that the widget is offered (212, 51). Instead, not only it is offered
  (212, 170), but the 170 is considered as minimum - I'm unable to resize
  the widget to something smaller. Now, I did declare 170 as a minimum...
  but only in the case in which the width is 53!
  
  To reproduce, you can do:
  git clone git://pietrobattiston.it/quack
  cd quack
  git checkout wrapbox_error
  cd plugins/tags
  python test_wrapbox.py
  
  to understand what I would like, just replace the if nat: at line 93
  with if True:, and rerun.
  
  Thank you in advance for any enlightenment, or pointer to a good
  discussion of such issues.
  
  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/


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


[pygtk] gobject.timeout_add() won't work after calling gtk.threads_init() on windows xp

2013-06-26 Thread Todong Ma

Hi, everyone

Following simple code will hang forever on windows XP, and the check 
dialog text is never outputted to console. The window created in the 
code showed but is blocked (when I move mouse into the window area, the 
mouse pointer is always a loading icon)


*/|import  gtk
import  gobject

def  checkDialog():
  print  'check dialog'
  return  True

gobject.timeout_add(500,  checkDialog)
gtk.threads_init()
w=  gtk.Window()
w.show()
gtk.main()|/*

While same code works well on Windows 7

Runtime details: Windows XP SP3, python 2.7.5, pytgtk-2.24-allinone


___
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] gobject.timeout_add() won't work after calling gtk.threads_init() on windows xp

2013-06-26 Thread Skip Montanaro
Have you tried calling gtk.threads_init() before gobject.timeout_add(...)?

On Wed, Jun 26, 2013 at 5:56 AM, Todong Ma gbstac...@gmail.com wrote:
 Hi, everyone

 Following simple code will hang forever on windows XP, and the check
 dialog text is never outputted to console. The window created in the code
 showed but is blocked (when I move mouse into the window area, the mouse
 pointer is always a loading icon)

 import gtk
 import gobject

 def checkDialog():
   print 'check dialog'
   return True

 gobject.timeout_add(500, checkDialog)
 gtk.threads_init()
 w = gtk.Window()
 w.show()
 gtk.main()

 While same code works well on Windows 7

 Runtime details: Windows XP SP3, python 2.7.5, pytgtk-2.24-allinone



 ___
 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] gobject.timeout_add() won't work after calling gtk.threads_init() on windows xp

2013-06-26 Thread Todong Ma

On 2013/6/26 18:56, Todong Ma wrote:

Hi, everyone

Following simple code will hang forever on windows XP, and the check 
dialog text is never outputted to console. The window created in the 
code showed but is blocked (when I move mouse into the window area, 
the mouse pointer is always a loading icon)


*/|import  gtk
import  gobject

def  checkDialog():
   print  'check dialog'
   return  True

gobject.timeout_add(500,  checkDialog)
gtk.threads_init()
w=  gtk.Window()
w.show()
gtk.main()|/*

While same code works well on Windows 7

Runtime details: Windows XP SP3, python 2.7.5, pytgtk-2.24-allinone


Just now Juhaz on the IRC channel told me I should try 
gtk.gdk.threads_init() or gobject.threads_init() instead of 
gtk.threads_init().

Then I tried them and found it works by using gobject.threads_init()!

Thank you all!
___
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] Question concerning to detection of locale direction

2013-06-26 Thread Genghis Khan
As far as I understand, this code is for GTK3.

Can you provide inputs that are of GTK2?

Request is: Recognize direction of currently used GUI. (RTL or LTR)

On Mon, 15 Apr 2013 11:10:14 +0200
Timo timomli...@gmail.com wrote:

 Op 15-04-13 10:38, Genghis Khan schreef:
  Hello,
 
  How is it possible to detect alignment of currently in-use gtk20.mo
  without directly probing gtk20.mo with msgunfmt for default:RTL?
 
  I have seen the following but I am not sure if it is applied to
  PyGTK, and I am also not sure it is relevant.
  https://developer.gnome.org/gtk3/3.4/GtkEntry.html#gtk-entry-get-alignment
 
 I'm not really sure what you're asking, but I'm guessing you're 
 searching for the default text direction, right? If not, specify your 
 question.
 
 This should do it:
 
  from gi.repository import Gtk
  Gtk.Widget.get_default_direction() == Gtk.TextDirection.LTR
 True
  Gtk.Widget.set_default_direction(Gtk.TextDirection.RTL)
  button = Gtk.Button(Just for testing)
  button.get_direction() == Gtk.TextDirection.RTL
 True
 
 Timo
 
 
  Regards,
  --GK.
 
 
 ___
 pygtk mailing list pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/


-- 
Proper English www.reddit.com/r/proper
4 teh lulz... http://email.is-not-s.ms
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/