I'm using quickly on 11.04 and I'm trying to add a textbuffer object to the preferences dialog so that its contents is updated automatically to the couchdb. So in __init__.py I changed the dictionary like so:
default_preferences = {
'example_entry': 'I remember stuff',
'textbuffer1': 'asdfa',
}
This gets saved in the couchdb as my initial value. In my Preferences%APPNAME%Dialog.ui I added a textview widget and the textbuffer1 buffer it relies on.
In Preferences%APPNAME%Dialog.py I amended the 'widget_methods' map like so:
widget_methods = {
'example_entry': ['get_text', 'set_text', 'changed'],
'textbuffer1': ['get_text', 'set_text', 'changed'],
}
But when opening the preferences dialog I get an exception:
Traceback (most recent call last):
File "%appname%_lib/PreferencesDialog.py", line 123, in set_preference
value=read_method()
TypeError: Required argument 'start' (pos 1) not found
If I add another textentry instead then it works as expected. However I'd really like to use the buffer and the problem as far as I can tell is that the get_text method of the textbuffer widget requires a minimum of two arguments (the start and end iters of the buffer). I have two workarounds which I'm keen to avoid:
- Create a custom widget inheriting everything from textbuffer with an added get_text_string method requiring no arguments
- Update the preferences dialog manually
Does anybody know if there is a way to provide the method map with these arguments in an easy way?