changeset 7cf21f16ea95 in /home/hg/repos/gajim
branches: gtk3 details:http://hg.gajim.org/gajim?cmd=changeset;node=7cf21f16ea95 description: PluginSystem. xhtml in available tab
diffstat:
data/gui/plugins_window.ui | 31 +++++++++++++++++++------------ src/plugins/gui.py | 31 +++++++++++++++++++------------ 2 files changed, 38 insertions(+), 24 deletions(-)
diffs (136 lines):
diff -r f554b921996d -r 7cf21f16ea95 data/gui/plugins_window.ui --- a/data/gui/plugins_window.ui Sat Apr 27 14:38:38 2013 +0200 +++ b/data/gui/plugins_window.ui Sat May 04 18:27:32 2013 +0400 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <object class="GtkTextBuffer" id="textbuffer1"> - <property name="text" translatable="yes">Plug-in decription should be displayed here. This text will be erased during PluginsWindow initialization.</property> - </object> <object class="GtkWindow" id="plugins_window"> <property name="width_request">650</property> <property name="height_request">500</property> @@ -299,17 +296,24 @@ </packing> </child> <child> - <object class="GtkTextView" id="plugin_description_textview"> + <object class="GtkScrolledWindow" id="scrolledwindow"> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="can_focus">True</property> - <property name="pixels_above_lines">6</property> - <property name="editable">False</property> - <property name="wrap_mode">word</property> - <property name="left_margin">6</property> - <property name="right_margin">6</property> - <property name="indent">1</property> - <property name="buffer">textbuffer1</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTextView" id="plugin_description_textview"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="pixels_above_lines">6</property> + <property name="editable">False</property> + <property name="wrap_mode">word</property> + <property name="left_margin">6</property> + <property name="right_margin">6</property> + <property name="indent">1</property> + <property name="buffer">textbuffer1</property> + </object> + </child> </object> <packing> <property name="expand">True</property> @@ -493,4 +497,7 @@ </object> </child> </object> + <object class="GtkTextBuffer" id="textbuffer1"> + <property name="text" translatable="yes">Plug-in decription should be displayed here. This text will be erased during PluginsWindow initialization.</property> + </object> </interface> diff -r f554b921996d -r 7cf21f16ea95 src/plugins/gui.py --- a/src/plugins/gui.py Sat Apr 27 14:38:38 2013 +0200 +++ b/src/plugins/gui.py Sat May 04 18:27:32 2013 +0400 @@ -36,6 +36,7 @@ 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 @@ 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 @@ @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 @@ 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 @@ 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('<body '): + txt = '<body xmlns='http://www.w3.org/1999/xhtml%5C%27%3E' + \ + txt + ' </body>' + txt = txt.replace('\n', '<br/>') + 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 @@ 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)