Re: [pygtk] PyGtk and Input Methods
On Fri, Dec 08, 2000 at 05:06:34PM +0900, Glen Malley wrote: > James Henstridge wrote: > > > > You could try using the locale.setlocale() function. Eg: > > import locale > > locale.setlocale(locale.LC_MESSAGES, 'ja_JP.ujis') > > > > (or maybe LC_ALL). If you set the locale to '', it will look up the > > environment. > > Unfortunately this doesn't work. I think I forgot to mention > that my intention is to have the application set the locale > regardless of the user's current locale settings. > So defaulting to the environment the interpreter is running > in is no good. As I mentioned before, setting the environment > beforehand DOES work..but is not a good solution. > > locale.setlocale doesn't do anything, as far as I can see =P How about this? import os os.environ['LC_ALL'] = 'ja_JP.ujis' import gtk ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Setting the Colors in a ZVTerm
Try the attached patch. You can also make workaround in python code like for i in range(len(colors)): colors[i] = (colors[i],) in your commented block. On Mon, Oct 23, 2000 at 12:29:11PM -0500, Eric Gillespie, Jr. wrote: > I'm trying to set the colors of a ZVTerm to white on black. I > copied the color codes from gnome-terminal.c, but i must be doing > something wrong in passing them to set_color_scheme(). I've tried > 2 different methods (one is commented out), and neither worked. > What am i doing wrong? > > The colors list was generated by having Python print the red, > green, and blue lists and then copying them into the file. I > thought that the hex might be throwing it off somehow. > > Thanks in advance. > > from gnome.zvtimport * > from gtk import * > > red = [0x, 0x, 0x, 0x, 0x, 0x, >0x, 0x, 0x, 0x, 0x, 0x, >0x, 0x, 0x, 0x, 0x, 0x0] > > green = [0x, 0x, 0x, 0x, 0x, 0x, > 0x, 0x, 0x, 0x, 0x, 0x, > 0x, 0x, 0x, 0x, 0x, 0x0] > > blue = [0x, 0x, 0x, 0x, 0x, 0x, > 0x, 0x, 0x, 0x, 0x, 0x, > 0x, 0x, 0x, 0x, 0x, 0x0] > > colors = [ (0, 0, 0), >(43690, 0, 0), >(0, 43690, 0), >(43690, 21845, 0), >(0, 0, 43690), >(43690, 0, 43690), >(0, 43690, 43690), >(43690, 43690, 43690), >(21845, 21845, 21845), >(65535, 21845, 21845), >(21845, 65535, 21845), >(65535, 65535, 21845), >(21845, 21845, 65535), >(65535, 21845, 65535), >(21845, 65535, 65535), >(65535, 65535, 65535), >(43690, 43690, 43690), >(0, 0, 0) >] > > #colors = [] > #for i in range(len(red)): > #colors.append((red[i], green[i], blue[i])) > > win = GtkWindow(WINDOW_DIALOG) > term = ZvtTerm(80, 25) > term.set_color_scheme(colors) > term.show() > win.add(term) > > win.show() > > mainloop() > > -- > Eric Gillespie, Jr. <*> [EMAIL PROTECTED] > Software Developer > Progeny Linux Systems - http://progeny.com > > > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk --- gnome-python-1.0.53/pygnome/zvtmodule.c.origTue Oct 24 15:34:21 2000 +++ gnome-python-1.0.53/pygnome/zvtmodule.c Tue Oct 24 15:41:36 2000 @@ -54,7 +54,7 @@ } for (i = 0; i < 18; i++) { item = PyList_GetItem(colours, i); -if (!PyArg_ParseTuple(PyList_GetItem(colours, i), "(hhh)", +if (!PyArg_ParseTuple(item, "hhh", &red[i], &grn[i], &blu[i])) { PyErr_Clear(); PyErr_SetString(PyExc_TypeError,"list items must be like (int,int,int)");
Re: [pygtk] Help with GnomeMDI/GtkPlug, GtkSocket
Here is the simple demo of mdi. from gtk import * from gnome.ui import * from gnome.uiconsts import * mdi = GnomeMDI('mdi-demo', 'PyGnome MDI DEMO') mdi.connect('destroy', mainquit) mdi.set_mode(MDI_NOTEBOOK) def my_create_view(child, label): return GtkButton(label) child = GnomeMDIGenericChild('label1') child.set_view_creator(my_create_view, "Test1") mdi.add_child(child) mdi.add_view(child) child = GnomeMDIGenericChild('label2') child.set_view_creator(my_create_view, "Test2") mdi.add_child(child) mdi.add_view(child) mainloop() To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
Re: [pygtk] Help with GnomeMDI/GtkPlug, GtkSocket
On Tue, Jan 18, 2000 at 04:42:32AM +, Hassan Aurag wrote: > > Notice I have used the self._o in this script but it crashes! > > I don't think the typos below solve the problem. > Your crash was by the missing PyGtk_Get in gnomeuimodule.c. > Have you tried this script with the patched wrapper? Yes. No longer BUS ERRORs. To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
Re: [pygtk] Help with GnomeMDI/GtkPlug, GtkSocket
There are some typos in mdi wrapper of pygnome. With the attached patch, you will get the better chance to succeed to use mdi. I never used mdi, so can't help you no more. On Mon, Jan 17, 2000 at 06:59:02PM +, Hassan Aurag wrote: > > Hi, > > I am working with pygnome 1.0.50 > > Now, for a long time, I have been trying to work with MDI without > success. > > For example, what's wrong with the following: > > > > ###START CODE > from gtk import GtkCurve, mainloop > from gnome.ui import GnomeMDIGenericChild, GnomeMDI > from _gnomeui import gnome_mdi_generic_child_set_view_creator > > > mdi = GnomeMDI('some-app', 'Title') > > def my_create_view(child, whatever=None): > return GtkHBox() # not a toplevel widget > child = GnomeMDIGenericChild('some-name') > > ##Without the child._o it complains that it needs a gtkobject and not > an > ##instance. With the object it segfaults > > gnome_mdi_generic_child_set_view_creator(child._o,my_create_view, 1) > > mdi.add_child(child) > # create a view for the child: > mdi.create_view(child) > > mainloop() > > > ENDCODE > > So can someone out there please write a simple and useless: > > mdi=GnomeMDI(...) > > child=GnomeMDIChild or GenericChild > > with just one empty GtkHBox in it or any other widget that works. > > By working, I mean: > > a MDI.py file that works with python MDI.py --- pygnome/gnome/ui.py.origFri Oct 1 17:05:02 1999 +++ pygnome/gnome/ui.py Tue Jan 18 11:32:38 2000 @@ -1107,13 +1107,13 @@ return _gnomeui.gnome_mdi_remove_child(self._o, child._o,force) def remove_all(self, force): return _gnomeui.gnome_mdi_remove_all(self._o, force) - def open_toplvel(self): + def open_toplevel(self): _gnomeui.gnome_mdi_open_toplevel(self._o) def update_child(self, child): _gnomeui.gnome_mdi_update_child(self._o, child._o) def get_active_window(self): return GnomeApp(_obj= - _gnomeui.gnome_mdi_getactive_window(self._o)) + _gnomeui.gnome_mdi_get_active_window(self._o)) def register(self, wid): _gnomeui.gnome_mdi_register(self._o, wid._o) def unregister(self, wid): @@ -1167,19 +1167,19 @@ return ret def set_view_creator(self, func, *args): mfunc = self.__marshal(func).__call__ - _gnomeui.gnome_mdi_generic_child_set_view_creator(self, mfunc, + _gnomeui.gnome_mdi_generic_child_set_view_creator(self._o, mfunc, args) def set_menu_creator(self, func, *args): mfunc = self.__marshal(func).__call__ - _gnomeui.gnome_mdi_generic_child_set_menu_creator(self, mfunc, + _gnomeui.gnome_mdi_generic_child_set_menu_creator(self._o, mfunc, args) def set_config_func(self, func, *args): mfunc = self.__marshal(func).__call__ - _gnomeui.gnome_mdi_generic_child_set_config_func(self, mfunc, + _gnomeui.gnome_mdi_generic_child_set_config_func(self._o, mfunc, args) def set_label_func(self, func, *args): mfunc = self.__marshal(func).__call__ - _gnomeui.gnome_mdi_generic_child_set_label_func(self, mfunc, + _gnomeui.gnome_mdi_generic_child_set_label_func(self._o, mfunc, args) _gtk._name2cls['GnomeMDIGenericChild'] = GnomeMDIGenericChild --- pygnome/gnomeuimodule.c.origTue Aug 3 22:34:07 1999 +++ pygnome/gnomeuimodule.c Tue Jan 18 10:43:50 2000 @@ -928,7 +928,7 @@ PyTuple_SetItem(tmp, 1, data); func = tmp; } - gnome_mdi_generic_child_set_view_creator_full(GNOME_MDI_GENERIC_CHILD(mdi), + +gnome_mdi_generic_child_set_view_creator_full(GNOME_MDI_GENERIC_CHILD(PyGtk_Get(mdi)), NULL, PyGtk_CallbackMarshal, func,
[pygtk] misc bug fixes
Hi! I found some more bugs in pygtk which are not critical. Patch is made after msw's recent patch is applied. diff.gz
[pygtk] memory leakage related to PySequence_GetItem
Hi! If we use PySequence_GetItem to get element, we need to unref that item explicitly. This is different from PyList_GetItem, PyTuple_GetItem. I attach the example to trigger this leakage and patch made against cvs version. #! /usr/bin/env python from gtk import * win = GtkWindow() list = [0]*5 while 1: for i in range(5): list[i] = `i`*2 clist = GtkCList(5, list) win.add(clist) # sink clist.destroy() diff.gz
Re: [pygtk] GtkCTree in a GtkScrolledWindow strange behaviour
On Mon, Dec 06, 1999 at 05:06:08AM +1000, Rob Hodges wrote: > I was wondering if anybody could explain how a GtkCTree goes about > deciding how wide it is? (Or more to the point, how to make one only > be as wide as it needs to be, to contain its contents -- I'd like to > be able to place one inside a scrolled window and have the horizontal > scrollbar represent the width of the contents -- which of course is > what normally happens automatically with most widgets.) Use GtkCList's columns_autosize method. > > Furthermore, something strange happens if you put one inside a > GtkScrolledWindow with POLICY_AUTOMATIC set on the scrollbars: each > time you expand and collapse the tree, it gets wider! Can anybody > shed light on this oddity? > > (Also, is it a bug that the text argument to GtkCTree.insert_node is > seemingly truncated after the first character?) Instead of text, give him list of texts. > > The following script is sufficient to demonstrate the width-altering > behaviour: > --- ab.py.orig Mon Dec 6 09:27:52 1999 +++ ab.py Mon Dec 6 09:28:13 1999 @@ -5,14 +5,12 @@ tree = GtkCTree() tree.show() -basenode = tree.insert_node(None,None,'base',expanded=TRUE,is_leaf=FALSE) -tree.node_set_text(basenode,0,'base') #otherwise we only get 'b' (???) +basenode = tree.insert_node(None,None,['base'],expanded=TRUE,is_leaf=FALSE) for name in map(str, range(100)): -n = tree.insert_node(basenode, None, " ") -tree.node_set_text(n, 0, name) +n = tree.insert_node(basenode, None, [name]) for node in tree.base_nodes(): tree.sort_recursive(node) - +tree.columns_autosize() treewin = GtkScrolledWindow() treewin.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) win.add(treewin) To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
Re: [pygtk] DND to/from CList
On Tue, Nov 16, 1999 at 04:55:25PM +0100, Jozsa Kristof wrote: > > Is it possible to use drag'n'drop from and to a CList? I tried in a similar > way then in pygtk/examples/simple/dnd.py but failed miserably. Even if I set > the selection mode to SELECTION_SINGLE, if I try to drag from the list, the > list only changes its active row.. nothing else. Same when I try to drop to > the list from elsewhere. Any ideas? Or is it inpossible? Here is the simple example for using dnd in clist. Hope this will help you. #! /usr/bin/env python target = [ ('STRING', 0, 0), ('text/plain', 0, 0), ('text/html', 0, 1)] from GDK import * from gtk import * def dnd_received_cb(w, context, x, y, data, info, time): if data and data.format == 8: w.drag_finish(context, 1, 0, time) if y > clist_title_height: row, col = w.get_selection_info(x,y-clist_title_height) print 'destination: row=%d col=%d' % (row, col) else: print 'destination: title bar' print 'received string is "%s"' % data.data else: w.drag_finish(context, 0, 0, time) def source_get(w, context, selection_data, info, time): data = "I am from %s row" % `w.selection` selection_data.set(selection_data.target, 8, data) def source_del(w, context, data): pass win = GtkWindow() clist = GtkCList(2, ["Title1", "Title2"]) clist.append(["content1", "content2"]) clist.append(["content3", "content4"]) clist.drag_dest_set(DEST_DEFAULT_ALL, target, ACTION_COPY|ACTION_MOVE) clist.connect('drag_data_received', dnd_received_cb) clist.drag_source_set(BUTTON1_MASK|BUTTON3_MASK, target, ACTION_COPY|ACTION_MOVE) clist.connect('drag_data_get', source_get) clist.connect('drag_data_delete', source_del) clist_title_height = 1 while 1: if clist.get_selection_info(0, clist_title_height)[0] == 1: break clist_title_height = clist_title_height + 1 win.add(clist) win.show_all() mainloop() > > Yeah and something else: is it normal or acceptable to get messages like > this at a pygtk program startup? Can I do anything in my code to fix it? (my > stuff seem to work ok, it just dump this) > - > Gtk-CRITICAL **: file gtkwidget.c: line 1584 (gtk_widget_map): assertion > TK_WIDGET_VISIBLE (widget) == TRUE' failed. > > Gtk-CRITICAL **: file gtkwidget.c: line 1584 (gtk_widget_map): assertion > TK_WIDGET_VISIBLE (widget) == TRUE' failed. > - > > Christopher > -- > +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-: .~. :-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ > | Christopher Jozsa /V\Veszprem Linux Users Group | > | [EMAIL PROTECTED] /( )\ student of IT, Hungary | > +-=-=-=-=-=-=-=-=-=-=-=-=-=-=--: ^^-^^ :--=-=-=-=-=-=-=-=-=-=-=-=-=-+ > To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED] To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]