I understand now. The default value should be passed twice : once when creating the widget in the config page, and once when retrieving it with self.get_option(). It is redundant but I see how it is needed.
Le samedi 2 novembre 2013 02:25:15 UTC+1, Joseph Martinot-Lagarde a écrit : > > I don't undersand, I have the same problem im both of my plugins, but the > code si so close to p_profiler.py that I have no clue where the problem > could be. It seems to me that the code in my > > PluginConfigPage is not run until spyder's Preferences window is opened. > > > Le vendredi 1 novembre 2013 00:42:33 UTC+1, Joseph Martinot-Lagarde a > écrit : >> >> I agree, but I already have it... (line 30 in >> https://github.com/Nodd/spyder_line_profiler/blob/master/p_lineprofiler.py >> ) >> >> I will test it again just to be sure. >> >> Le jeudi 31 octobre 2013 18:05:26 UTC+1, Carlos Córdoba a écrit : >>> >>> Hi Joseph, >>> >>> I think you need to add a default value to your option, which you can do >>> like this: >>> >>> python_box = self.create_checkbox(_("Use colors"), 'use_colors', >>> default=True) >>> >>> Cheers, >>> Carlos >>> >>> El 14/10/13 15:34, Joseph Martinot-Lagarde escribió: >>> >>> I created a plugin to incle line_profiler into spyder's interface : >>> https://github.com/Nodd/spyder_line_profiler >>> >>> I have a small issue and I'm not sure if it is a spyder bug or a bug in >>> my plugin. I have a checkbox settings linked to a 'use_colors' boolean >>> settings. At first launch when I ask for the value of this setting, I get >>> an Exception "ConfigParser.NoOptionError: No option 'use_colors' in >>> section: 'lineprofiler'". If I open and close the preference window, >>> the error disappears. >>> >>> I have almost the same code as the pylint plugin for the configuration, >>> so I don't see where the problem could be. Am I supposed to register >>> the setting somehow ? Or catch the exception and set a default value as I >>> did (but there's already a default value in the config page so it seems >>> strange) ? >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "spyder" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/spyderlib. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> -- You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/spyderlib. For more options, visit https://groups.google.com/groups/opt_out.
