37
37
# Default plugin information text
38
PLUGINS_DEFAULT_DESC = _("Click on a plugin to get a description here.")
38
PLUGINS_DEFAULT_DESC = _("Click on a plugin name to view its description here.")
40
40
# columns in PreferencesDialog.plugin_store
150
150
'plugin_depends': 'PluginDepends',
151
151
'plugin_config_dialog': 'PluginConfigDialog',
152
152
'pref_autostart': 'pref_autostart',
153
'pref_show_preview': 'pref_show_preview'
153
'pref_show_preview': 'pref_show_preview',
154
'bg_color_enable': 'bg_color_enable',
155
156
for attr, widget in widgets.iteritems():
156
157
setattr(self, attr, self.builder.get_object(widget))
157
158
# keep a reference to the parent task browser
158
159
self.pengine = PluginEngine()
159
160
#plugin config initiation, if never used
160
if self.config.has_key("plugins"):
161
if self.config["plugins"].has_key("enabled") == False:
161
if "plugins" in self.config:
162
if "enabled" not in self.config["plugins"]:
162
163
self.config["plugins"]["enabled"] = []
164
if self.config["plugins"].has_key("disabled") == False:
165
if "disabled" not in self.config["plugins"]:
165
166
self.config["plugins"]["disabled"] = []
167
if self.pengine.get_plugins():
168
self.config["plugins"] = {}
169
self.config["plugins"]["disabled"] = \
170
[p.module_name for p in self.pengine.get_plugins("disabled")]
171
self.config["plugins"]["enabled"] = \
172
[p.module_name for p in self.pengine.get_plugins("enabled")]
167
elif self.pengine.get_plugins():
168
self.config["plugins"] = {}
169
self.config["plugins"]["disabled"] = \
170
[p.module_name for p in self.pengine.get_plugins("disabled")]
171
self.config["plugins"]["enabled"] = \
172
[p.module_name for p in self.pengine.get_plugins("enabled")]
173
173
# initialize tree models
174
174
self._init_backend_tree()
175
175
# this can't happen yet, due to the order of things in
216
216
autostart_path = os.path.join(self.__AUTOSTART_DIRECTORY, \
217
217
self.__AUTOSTART_FILE)
218
218
self.pref_autostart.set_active(os.path.isfile(autostart_path))
219
#This set_active method doesn't even understand what a boolean is!
221
if self.config_priv.get("contents_preview_enable"):
225
self.pref_show_preview.set_active(toset)
220
show_preview = self.config_priv.get("contents_preview_enable")
221
self.pref_show_preview.set_active(show_preview)
223
bg_color = self.config_priv.get("bg_color_enable")
224
self.bg_color_enable.set_active(bg_color)
227
226
def _init_plugin_tree(self):
228
227
"""Initialize the PluginTree gtk.TreeView.
279
278
# preferences on the Tasks tab
280
279
'on_pref_show_preview_toggled':
281
280
self.toggle_preview,
281
'on_bg_color_toggled':
282
self.on_bg_color_toggled,
282
283
'on_pref_check_spelling_toggled':
283
284
self.toggle_spellcheck,
284
285
# buttons on the Plugins tab
394
395
def toggle_preview(self, widget):
395
396
"""Toggle previews in the task view on or off."""
396
self.config_priv.set("contents_preview_enable", widget.get_active())
397
view = self.req.get_tasks_tree(refresh=False)
397
curstate = self.config_priv.get("contents_preview_enable")
398
if curstate != widget.get_active():
399
self.config_priv.set("contents_preview_enable", not curstate)
400
view = self.req.get_tasks_tree(refresh=False)
403
def on_bg_color_toggled(self, widget):
404
""" Save configuration and refresh nodes to apply the change """
405
curstate = self.config_priv.get("bg_color_enable")
406
if curstate != widget.get_active():
407
self.config_priv.set("bg_color_enable", not curstate)
408
task_tree = self.req.get_tasks_tree(refresh=False).get_basetree()
409
task_tree.refresh_all()
400
411
def toggle_spellcheck(self, widget):
401
412
"""Toggle spell checking on or off."""