From ddbac25e192823e7f5101115535aadcd9b77dce8 Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Sat, 4 May 2013 18:27:32 +0400 Subject: [PATCH] PluginSystem. xhtml in available tab --- data/gui/plugins_window.ui | 31 +++++++++++++++++++------------ src/plugins/gui.py | 31 +++++++++++++++++++------------ 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/data/gui/plugins_window.ui b/data/gui/plugins_window.ui index 3a6ccc29d..3c416be67 100644 --- a/data/gui/plugins_window.ui +++ b/data/gui/plugins_window.ui @@ -1,9 +1,6 @@ - - Plug-in decription should be displayed here. This text will be erased during PluginsWindow initialization. - 650 500 @@ -299,17 +296,24 @@ - + True - False True - 6 - False - word - 6 - 6 - 1 - textbuffer1 + in + + + True + False + True + 6 + False + word + 6 + 6 + 1 + textbuffer1 + + True @@ -493,4 +497,7 @@ + + Plug-in decription should be displayed here. This text will be erased during PluginsWindow initialization. + diff --git a/src/plugins/gui.py b/src/plugins/gui.py index 0d3a3d94b..b97711d9b 100644 --- a/src/plugins/gui.py +++ b/src/plugins/gui.py @@ -36,6 +36,7 @@ import gtkgui_helpers from dialogs import WarningDialog, YesNoDialog, ArchiveChooserDialog from common import gajim from plugins.helpers import log_calls, log +from conversation_textview import ConversationTextview from plugins.helpers import GajimPluginActivateException from common.exceptions import PluginsystemError @@ -99,7 +100,7 @@ class PluginsWindow(object): self.installed_plugins_treeview_selection_changed) selection.set_mode(Gtk.SelectionMode.SINGLE) - self._clear_installed_plugin_info() + #self._clear_installed_plugin_info() self.fill_installed_plugins_model() root_iter = self.installed_plugins_model.get_iter_first() @@ -121,6 +122,11 @@ class PluginsWindow(object): @log_calls('PluginsWindow') def installed_plugins_treeview_selection_changed(self, treeview_selection): model, iter = treeview_selection.get_selected() + self.xml.get_object('scrolledwindow').get_children()[0].destroy() + self.plugin_description_textview = ConversationTextview(None) + sw = self.xml.get_object('scrolledwindow') + sw.add(self.plugin_description_textview.tv) + sw.show_all() if iter: plugin = model.get_value(iter, PLUGIN) plugin_name = model.get_value(iter, NAME) @@ -131,6 +137,7 @@ class PluginsWindow(object): self._clear_installed_plugin_info() def _display_installed_plugin_info(self, plugin): + from plugins.plugins_i18n import _ self.plugin_name_label.set_text(plugin.name) self.plugin_version_label.set_text(plugin.version) self.plugin_authors_label.set_text(plugin.authors) @@ -140,19 +147,21 @@ class PluginsWindow(object): label.set_ellipsize(Pango.EllipsizeMode.END) self.plugin_homepage_linkbutton.set_property('sensitive', True) - desc_textbuffer = self.plugin_description_textview.get_buffer() - from plugins.plugins_i18n import _ txt = plugin.description if plugin.available_text: txt += '\n\n' + _('Warning: %s') % plugin.available_text - desc_textbuffer.set_text(txt) - self.plugin_description_textview.set_property('sensitive', True) + if not txt.startswith('' + \ + txt + ' ' + txt = txt.replace('\n', '
') + self.plugin_description_textview.tv.display_html( + txt, self.plugin_description_textview) + + self.plugin_description_textview.tv.set_property('sensitive', True) self.uninstall_plugin_button.set_property('sensitive', gajim.PLUGINS_DIRS[1] in plugin.__path__) - if plugin.config_dialog is None: - self.configure_plugin_button.set_property('sensitive', False) - else: - self.configure_plugin_button.set_property('sensitive', True) + self.configure_plugin_button.set_property( + 'sensitive', not plugin.config_dialog is None) def _clear_installed_plugin_info(self): self.plugin_name_label.set_text('') @@ -162,9 +171,7 @@ class PluginsWindow(object): self.plugin_homepage_linkbutton.set_label('') self.plugin_homepage_linkbutton.set_property('sensitive', False) - desc_textbuffer = self.plugin_description_textview.get_buffer() - desc_textbuffer.set_text('') - self.plugin_description_textview.set_property('sensitive', False) + self.plugin_description_textview.tv.set_property('sensitive', False) self.uninstall_plugin_button.set_property('sensitive', False) self.configure_plugin_button.set_property('sensitive', False)