Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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:

  1. Create a custom widget inheriting everything from textbuffer with an added get_text_string method requiring no arguments
  2. 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?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.