From: Stephen W. <st...@ke...> - 2007-03-19 16:55:08
|
It has been 9 months since the release of ROX-Lib 2.0.3 so I think we're due a new release soon. Could people please test the svn snapshot (http://rox.sourceforge.net/snapshots/rox-lib.tgz) and translators ensure the translations are up to date. Changes since 2.0.3: Some unit tests appended the local ROX-Lib's location to PYTHONPATH instead of inserting it. If ROX-Lib was already in PYTHONPATH, this caused them to test the existing version instead! Removed a load of unused imports spotted by PyFlakes (Thomas Leonard). Eliminated a number of deprecation warnings Update Chinese Translations (Babyfai Cheung) ROX base platform is now Python 2.3, so run unit tests against that by default (Thomas Leonard). When there is only one section in the options box, don't show a frame (Thomas Leonard). Bugfix: Must use '..' in interface for backwards compat (Thomas Leonard). Fixed some deprecation warnings (Thomas Leonard). Removed some more deprecation warnings. Do not run testsu as part of testall as it is interactive (Thomas Leonard). Added xattr support including test for user set MIME types (Stephen Watson). Added templates module as an interface to glade (Stephen Watson). Ensure window response codes are treated as int(), required for python 2.5 and pygtk 2.6 (Stephen Watson). Convert other enums to int for Python 2.5 (Stephen Watson). Work around change in Python 2.5 Prefered launcher for a URL scheme now an xsetting named ROX/URI/scheme Settings names actually quite restrictive (Stephen Watson) Rethinking how to store URI handlers (Stephen Watson) Avoid glade.xml_new_from_buffer as it is buggy (Stephen Watson) Linux xattr names more restrictive than assumed (Stephen Watson) Lookup icons from <Choices>/rox.sourceforge.net/MIME-icons before <Choices>/MIME-icos (Stephen Watson) Look up and run programs for handling URIs (Stephen Watson) Script to run pychecker. Added note about size-groups. Moved into a sub-dir, so that a svn checkout has the same structure as ROX-Lib does in the 0install cache. This is a work-around for the fact that I used id='..' in the interface, but we're stuck with it now. Drag-and-drop didn't work if the hostname contained '-', due to an error in a regular expression (Thomas Leonard, reported by Lennon Cook). Added <filechooser> widget to OptionsBox, which lets the user choose a file using a GtkFileChooser or by drag-and-drop (Jim Ramsay). Requires GTK >= 2.6. Bugfix: InputBlocker and OutputBlocker now trigger on IO_HUP too. Added Clear button to filename options (Jim Ramsay and Thomas Leonard). Use '-post' as developer version, not '.0'. Corrected doc comment on get() function Function to fetch an appropriate icon for a file (Lennon Cook). Changed to return a Pixbuf instead of an Image, to use the existing icon theme lookup and to first check for a .DirIcon for directories (Stephen Watson). Could also parse the filer's globicons file. Fix syntax error in getting the widget set (Stephen Watson). Added Task.finished blocker, which is triggered when the task finishes, successfully or by throwing an exception (Thomas Leonard; suggested by Ken Hayber). Added thumbnail module to access thumbnail images of files and also to generate them (Stephen Watson). Exception handler now copes with old-style non-class exceptions and with missing tracebacks (Thomas Leonard). Added ProxyWindow to make sub-classing a window loaded from a template easier (Stephen Watson). -- Stephen Watson http://www.kerofin.demon.co.uk/ I'm really glad that worked. Those would have been terrible last words. |
From: Thomas L. <ta...@gm...> - 2007-03-19 20:54:07
|
On 3/19/07, Stephen Watson <st...@ke...> wrote: > It has been 9 months since the release of ROX-Lib 2.0.3 so I think we're due > a new release soon. Ah, excellent! Some minor questions though... > Added templates module as an interface to glade (Stephen Watson). > Avoid glade.xml_new_from_buffer as it is buggy (Stephen Watson) I'm a bit confused by the caching behaviour here. Surely the simple solution is for the application to load the glade file once, and then create widget sets from that. E.g.: #!/usr/bin/env python myapp_templates = templates.load() class MyWindow: def __init__(self): self.window = myapp_templates.getWidgetSet('main') But the example at the start of templates.py seems to suggest loading the templates again each time a widget is created. What does the Templates class give you that raw glade doesn't? It calls widgets.autoConnect() for you... but only if you called Templates.autoConnect() first! Likewise, WidgetSet doesn't seem to add anything to glade's existing widget set except for getWindow. ProxyWindow says it can be subclassed, yet getWindow always uses the base class. Perhaps getWindow could be written like this, without needing ProxyWindow? def getWindow(self, name): rox.toplevel_ref() win = self.getWidget(name) win.connect('destroy', rox.toplevel_unref) return win Or lose Templates, and have a module-level funtion: def getWindow(widget_set, name): rox.toplevel_ref() win = widget_set.get_widget(name) win.connect('destroy', rox.toplevel_unref) return win (and why the strange non-Python namingSystem, especially when glade uses the python_system?) -- Dr Thomas Leonard http://rox.sourceforge.net GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 |
From: Stephen W. <st...@ke...> - 2007-03-19 22:25:15
|
"Thomas Leonard" <ta...@gm...> wrote: > On 3/19/07, Stephen Watson <st...@ke...> wrote: > > It has been 9 months since the release of ROX-Lib 2.0.3 so I think we're due > > a new release soon. > > Ah, excellent! Some minor questions though... > > > Added templates module as an interface to glade (Stephen Watson). > > Avoid glade.xml_new_from_buffer as it is buggy (Stephen Watson) > > I'm a bit confused by the caching behaviour here. Surely the simple > solution is for the application to load the glade file once, and then > create widget sets from that. E.g.: > > #!/usr/bin/env python > myapp_templates = templates.load() > > class MyWindow: > def __init__(self): > self.window = myapp_templates.getWidgetSet('main') > > But the example at the start of templates.py seems to suggest loading > the templates again each time a widget is created. What does the > Templates class give you that raw glade doesn't? It calls > widgets.autoConnect() for you... but only if you called > Templates.autoConnect() first! I'll admit it made more sense before I found out that xml_new_from_buffer was too buggy to be useful. Orignally Templates held the XML file as a string and used xml_new_from_buffer to generate the widgets. > Likewise, WidgetSet doesn't seem to add anything to glade's existing > widget set except for getWindow. ProxyWindow says it can be > subclassed, yet getWindow always uses the base class. > > Perhaps getWindow could be written like this, without needing ProxyWindow? > > def getWindow(self, name): > rox.toplevel_ref() > win = self.getWidget(name) > win.connect('destroy', rox.toplevel_unref) > return win ProxyWindow works like this class MyWindow(templates.ProxyWindow): def __init__(self): self.widgets=rox.templates.load(None, 'main_window', self) templates.ProxyWindow.__init__(self, self.widgets['main_window']) # ... I was thinking about a more complicated version of getWindow() def getWindow(self, name, klass=ProxyWindow, *args, **kwargs): return klass(self.getWidget(name), *args, **kwargs) but I went with the simpler version initially. > Or lose Templates, and have a module-level funtion: > > def getWindow(widget_set, name): > rox.toplevel_ref() > win = widget_set.get_widget(name) > win.connect('destroy', rox.toplevel_unref) > return win > > (and why the strange non-Python namingSystem, especially when glade > uses the python_system?) Habit. I'm supposed to be helping to re-write the coding standards at work and some of that must have leaked through. -- Stephen Watson http://www.kerofin.demon.co.uk/ If you read this on a mailing list, send any reply back to the list and not to me. Not even CC. My bleeding heart does not extend to charity |
From: Ken H. <ke...@ha...> - 2007-03-20 02:34:55
|
Stephen Watson wrote: > It has been 9 months since the release of ROX-Lib 2.0.3 so I think we're due > a new release soon. Could people please test the svn snapshot > (http://rox.sourceforge.net/snapshots/rox-lib.tgz) and translators ensure > the translations are up to date. > > Changes since 2.0.3: <snip> > Function to fetch an appropriate icon for a file (Lennon Cook). Changed to > return a Pixbuf instead of an Image, to use the existing icon theme lookup > and > to first check for a .DirIcon for directories (Stephen Watson). Could also > parse the filer's globicons file. > > Added thumbnail module to access thumbnail images of files and also to > generate them (Stephen Watson). Shouldn't these functions have explicit (optional?) parameters for the size of the icon returned/generated? |
From: Thomas L. <ta...@gm...> - 2007-03-21 18:01:32
|
On 3/19/07, Stephen Watson <st...@ke...> wrote: [ caching ] > I'll admit it made more sense before I found out that xml_new_from_buffer > was too buggy to be useful. Orignally Templates held the XML file as a > string and used xml_new_from_buffer to generate the widgets. I'm surprised it made any difference, since Linux will be caching the file anyway. I tested it with this code, using the glade file from 0publish-gui: import pygtk; pygtk.require('2.0') import gtk.glade xml = file('0publish-gui.glade').read() xml_len = len(xml) def go(): gtk.glade.XML('0publish-gui.glade', 'add_archive') #gtk.glade.xml_new_from_buffer(xml, xml_len, 'add_archive') Then: $ /usr/lib/python2.4/timeit.py -s 'from speed import go' 'go()' gives these results, depending on which line is uncommented: 10 loops, best of 3: 50.8 msec per loop (xml_new_from_buffer) 10 loops, best of 3: 50.9 msec per loop (reading from the file) -- Dr Thomas Leonard http://rox.sourceforge.net GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 |
From: Stephen W. <st...@ke...> - 2007-03-28 17:00:25
|
"Thomas Leonard" <ta...@gm...> wrote: > On 3/19/07, Stephen Watson <st...@ke...> wrote: > [ caching ] > > I'll admit it made more sense before I found out that xml_new_from_buffer > > was too buggy to be useful. Orignally Templates held the XML file as a > > string and used xml_new_from_buffer to generate the widgets. > > I'm surprised it made any difference, since Linux will be caching the > file anyway. I simplified the module a few days back, and had to make one optional parameter compulsary. Is it better? -- Stephen Watson http://www.kerofin.demon.co.uk/ If you read this on a mailing list, send any reply back to the list and not to me. Not even CC. Strange as I seem I'm getting stranger by the minute |
From: Thomas L. <ta...@gm...> - 2007-03-28 17:40:41
|
On 3/28/07, Stephen Watson <st...@ke...> wrote: > "Thomas Leonard" <ta...@gm...> wrote: > > [ caching ] > > I'm surprised it made any difference, since Linux will be caching the > > file anyway. > > I simplified the module a few days back, and had to make one optional > parameter compulsary. Is it better? I confess I still can't see the point of the Templates class. Code using it would seem to be no shorter or simpler than code not using it? But, if you find it useful then I won't object to keeping it. BTW, join() already handles absolute paths: >>> os.path.join('/a/b', '/c/d') '/c/d' Cheers, -- Dr Thomas Leonard http://rox.sourceforge.net GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 |