Re: [pygtk] Arabic text display problem
Tor Lillquist found the issue, it was the GTK runtime I was using (gladewin32.sourceforge.net) that was not built with win32 Uniscribe support. I tried his build and it did not have this problem. Regards, Fredrik On 2/23/07, Fredrik Corneliusson [EMAIL PROTECTED] wrote: Sorry for not making it clear that the problem is not pyGtk specific as both the GTK+ demo and pygtk demo has the same problem as well as Gaim. I based the assumption that it works on screen shots of GTK apps I've seen where it is ok. I've attached a zip with screenshots of the problem and one how it looks when with the same text pasted into firefox. It also contains a python example based on the pygtk demo (textview.py). Regards, Fredrik On 2/23/07, Danni M. [EMAIL PROTECTED] wrote: Hi fredrik, Did you tried to change the font, on ubuntu though the gnome app, or manually hard-coding it? As for RTL, as a hebrew user, most of the widgets works OK, can you give us a code and a screenshot to see what happens? Cheers, dani. On 2/23/07, Fredrik Corneliusson [EMAIL PROTECTED] wrote: Hi all, I got a problem with displaying Arabic text correctly. The problem is the shaping of the characters that should differ depending on the position where the character occurs (beginning,middle,ending). Now they are all displayed as they are separate. I have tested on Win32 and Linux (Ubuntu) and they both have the same problem. The pygtk-demo textview.py have this problem with the right to left-example text as well so it's not just my code. I know gtk/pango should be able to render this correctly, but what do I have to do to get it working? This page has some general information about Arabic font rendering: http://foolab.org/node/533 Thanks for your splendid work! /Fredrik ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Controlling a menu structure from an XML file?
Hello, I'm wondering about defining a menu structure using gtk.UIManager and an XML file. What confuses me a bit is that it seems to be necessary to define which menus and submenus I have in the Python code, even if I can then control their contents from XML. The reason seems to be that everything has to have an action. I define a menu like this: menu action=actionsmenu menuitem action=Select/ menuitem action=Run/ /menu But for this to work I have to write (somewhere in my Python code) menuAction = gtk.Action(actionsmenu, _Actions, None, None) ... just in order to translate the identifier actionsmenu into the label _Actions. I'd like to be able to write something like menu label=_Actions so that I can define the whole menu structure in one format in one place. Is this possible in some way? Regards, Geoff Bache ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] liststore (ComboBoxEntry) alignment (justify)
Hi all, I'm still new to pygtk and I have two question, i hope it's not too stupid questions :) 1. I want to create a ComboBox by using the liststore object. my issue is that I want to set the alignment (justify) of the text in the combobox to right, how can I do that? 2. In addition, I want to to head default value to the liststore to show it as default in the combo box, something like == Choose from List ==. I can add it to liststore but how can I show it by default in the combo box? 3. It is posible to add icons next to the text in the ComboBox? if yes how can I do that? Thanks for any help, Miki ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Controlling a menu structure from an XML file?
On Thu, 2007-03-08 at 11:00 +0100, Geoff Bache wrote: Hello, I'm wondering about defining a menu structure using gtk.UIManager and an XML file. What confuses me a bit is that it seems to be necessary to define which menus and submenus I have in the Python code, even if I can then control their contents from XML. The reason seems to be that everything has to have an action. I define a menu like this: menu action=actionsmenu menuitem action=Select/ menuitem action=Run/ /menu But for this to work I have to write (somewhere in my Python code) menuAction = gtk.Action(actionsmenu, _Actions, None, None) ... just in order to translate the identifier actionsmenu into the label _Actions. I'd like to be able to write something like menu label=_Actions so that I can define the whole menu structure in one format in one place. Is this possible in some way? I don't believe it's possible and for good reason. A major benefit/feature of UIManger is making actions independent of any given widget, e.g. a menu item. When the notion of separated actions and widgets introduced you can then combine them at will without having to keep multiple widgets in sync. One reason I switched to UIManager was the all too common scenario where an icon or label was modified in one part of the UI but other parts of the UI (e.g. the same item in a popup menu or a toolbar button) was forgotten about in the update leading to inconsistencies in the UI. I really like the fact I change the definition in exactly one place and every part of the UI is consistently updated. That flexibility and consistency occurs because actions and widgets are independent. -- John Dennis [EMAIL PROTECTED] Learn. Network. Experience open source. Red Hat Summit San Diego | May 9-11, 2007 Learn more: http://www.redhat.com/promo/summit/2007 ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] liststore (ComboBoxEntry) alignment (justify)
On Thu, 2007-03-08 at 16:10 +0200, Miki wrote: Hi all, I'm still new to pygtk and I have two question, i hope it's not too stupid questions :) 1. I want to create a ComboBox by using the liststore object. my issue is that I want to set the alignment (justify) of the text in the combobox to right, how can I do that? 2. In addition, I want to to head default value to the liststore to show it as default in the combo box, something like == Choose from List ==. I can add it to liststore but how can I show it by default in the combo box? 3. It is posible to add icons next to the text in the ComboBox? if yes how can I do that? Thanks for any help, Miki ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ To use a liststore object with a combobox. You first need to declare what you want the liststore to contain. e.g. To create a liststore which will hold a pixbuf and string liststore = gtk.ListStore(gtk.gdk.Pixbuf, str) Create an image to be added to the liststore. image = gtk.gdk.pixbuf_new_from_file(/home/user/image.png) Append the created image and a string to the liststore. liststore.append((image, Some Text)) The append method requires a tuple or a list which contains the items to be added to the model. We now need the combobox to use the model we created. combobox.set_model(liststore) We now need to render the data we have in the model. We create a gtk.CellRendererPixbuf() for our image and a gtk.CellRendererText() for our string. px = gtk.CellRendererPixbuf() text = gtk.CellRendererText() Pack the cell renderer into the combobox. combobox.pack_start(px, False, False) combobox.pack_start(text, False, False) Use the add_attribute method to specify which column in the model the CellRendererPixbuf() will get values from. combobox.add_attribute(px, pixbuf, 0) Do the same for CellRendererText() combobox.add_attribute(text, text 1) The first parameter for the add_attribute method specifies the cell renderer to use. The second parameter specifies the attribute of the cell to be used to get its value. The last parameter specifies which column in the model the cell renderer will use. To align the string to the left, i would use combobox.pack_end(text, False, False) To set a default choice in the combobox, i would use combobox.set_active() to set the default choice in the combobox. John ___ Does your mail provider give you FREE antivirus protection? Get Yahoo! Mail http://uk.mail.yahoo.com ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Re: mark rows with pattern in treeview
Hi John, John Dennis schrieb am 03/06/2007 08:07 PM: On Tue, 2007-03-06 at 19:38 +, Fabian Braennstroem wrote: Hi Yuri, Yuri Pimenov schrieb am 03/06/2007 09:26 AM: use TreeViewColumn's set_cell_data_func() to set attributes the way you like. I think you misunderstood me; I am writing a small file manager based on the example from the tutorial and try to find a way to select (or mark) e.g. all files with the pdf-extension. One way would be to use a for loop to search in the 'list' for all pdf files and keep the corresponding row number; but I am not sure which function to use for selection!? First get the selection object from the treeview: selection = treeview.get_selection() Then select the each path or iter (depending if you're using paths or iters) selection.select_path(some_path) or selection.select_iter(some_iter) You'll probably end up with something like this: selection.unselect_all() iter = model.get_iter_first() while iter: value = model.get_value(iter, column) if value is what I'm looking for: selection.select_iter(iter) iter = model.iter_next(iter) Thanks! Works really nice with path :-) Greetings! Fabian ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Re: mark rows with pattern in treeview
You'll probably end up with something like this: selection.unselect_all() iter = model.get_iter_first() while iter: value = model.get_value(iter, column) if value is what I'm looking for: selection.select_iter(iter) iter = model.iter_next(iter) Or, the same thing using a slightly more pythonic api; for row in model: if row[column] is what I'm looking for: selection.select_iter(iter) break -- Johan Dahlin [EMAIL PROTECTED] Async Open Source ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Cannot subclass gtk.Widget
I am trying to create a custom widget. Following examples I found from a Google search, I am trying to subclass gtk.Widget. I get the error message: TypeError: cannot create instance of abstract (non-instantiable) type `GtkWidget' A further search suggests that I might have a version problem, but I am running 2.10.3 of PyGTK and 2.10.6 of libgtk, which would seem to be plenty new enough. I also cannot subclass Container or Box, but HBox works. -- Jeffrey Barish ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Cannot subclass gtk.Widget
2007/3/8, Jeffrey Barish [EMAIL PROTECTED]: I am trying to create a custom widget. Look at widget.py in pygtk examples. The classes you have mentioned are abstract classes thus you cannot instantiate them, have a look at pygtk reference manual as well. cheers -- Gian Mario Tagliaretti http://www.parafernalia.org/pygtk/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Cannot subclass gtk.Widget
Jeffrey Barish wrote: I am trying to create a custom widget. Following examples I found from a Google search, I am trying to subclass gtk.Widget. I get the error message: TypeError: cannot create instance of abstract (non-instantiable) type `GtkWidget' You need to call gobject.type_register(YourGtkWidgetSubclass) or set the class variable __gtype_name__ among other things. For a complete example, look at the widget.py: http://svn.gnome.org/viewcvs/pygtk/trunk/examples/gtk/widget.py?view=markup Hope this helps. -- Johan Dahlin [EMAIL PROTECTED] Async Open Source ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Re: Cannot subclass gtk.Widget
Johan Dahlin wrote: You need to call gobject.type_register(YourGtkWidgetSubclass) or set the class variable __gtype_name__ among other things. For a complete example, look at the widget.py: http://svn.gnome.org/viewcvs/pygtk/trunk/examples/gtk/widget.py?view=markup Hope this helps. Yes, it does. Your citation was what I was looking at, but I didn't understand that I needed to replicate so much. Wow, it's really complicated subclassing in GTK. I still don't understand what to do if my widget is composed of other widgets (rather than Cairo drawing and text). A simplification of what I am trying to do is to create a widget with two buttons. I guess that I need to do something different in do_expose_event and do_size_request, but I'm not sure what. To begin with, it isn't clear to me what the do_ methods are. Do they override event handlers in the abstract Widget class? I don't see documentation for them there. I tried calling do_realize and do_expose_event on the button, but those calls fail (although the methods apparently exist). -- Jeffrey Barish ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Re: Cannot subclass gtk.Widget
Jeffrey Barish wrote: I still don't understand what to do if my widget is composed of other widgets (rather than Cairo drawing and text). I think the answer is that in PyGTK we don't subclass except when we need to do some drawing, as in the example. Otherwise, we just create a class to encapsulate the standard widgets. -- Jeffrey Barish ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Re: Cannot subclass gtk.Widget
Jeffrey Barish wrote: I still don't understand what to do if my widget is composed of other widgets (rather than Cairo drawing and text). Normally, you just use boxes or something else to align those widgets. Or subclass e.g. gtk.HBox. However, if you feel adventurous, you can play with this incomplete but working example: import gobject import gtk class CustomContainer (gtk.Container): def __init__(self, child): gtk.Container.__init__(self) self.__child = child self.__child.set_parent (self) self.set_flags (gtk.NO_WINDOW) def do_size_request (self, requisition): requisition.width, requisition.height = self.__child.size_request () def do_size_allocate (self, allocation): self.__child.size_allocate (allocation) def do_forall (self, include_internals, callback, user_data): callback (self.__child, user_data) gobject.type_register (CustomContainer) window = gtk.Window () window.add (CustomContainer (gtk.Label ('test'))) window.show_all () window.present () window.connect ('destroy', lambda window: gtk.main_quit ()) gtk.main () ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Accelerator key bindings
Hi, just trying to bind the signal grab-focus of a gtk.TreeView to key combination (Ctrl-I). Has anybody a idea or better a little bit of source, how this could be done, didn't found anything that I understand (missing examples in tutorial). Thanks in advance, Volker -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/