changeset 2f25891c2c80 in /home/hg/repos/gajim
branches: gajim_0.16
details:http://hg.gajim.org/gajim?cmd=changeset;node=2f25891c2c80
description: ability to show HTML in plugin descriptions
diffstat:
data/gui/plugins_window.ui | 15 ++++++---------
src/plugins/gui.py | 25 +++++++++++++++++++------
2 files changed, 25 insertions(+), 15 deletions(-)
diffs (83 lines):
diff -r 5ccb7bd9fe55 -r 2f25891c2c80 data/gui/plugins_window.ui
--- a/data/gui/plugins_window.ui Fri Aug 16 14:06:52 2013 +0200
+++ b/data/gui/plugins_window.ui Fri Aug 16 14:53:17 2013 +0200
@@ -248,17 +248,14 @@
</packing>
</child>
<child>
- <object class="GtkTextView"
id="plugin_description_textview">
+ <object class="GtkScrolledWindow"
id="scrolledwindow2">
<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="hscrollbar_policy">automatic</property>
+ <property
name="vscrollbar_policy">automatic</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">1</property>
diff -r 5ccb7bd9fe55 -r 2f25891c2c80 src/plugins/gui.py
--- a/src/plugins/gui.py Fri Aug 16 14:06:52 2013 +0200
+++ b/src/plugins/gui.py Fri Aug 16 14:53:17 2013 +0200
@@ -31,6 +31,7 @@
import gtkgui_helpers
from dialogs import WarningDialog, YesNoDialog, ArchiveChooserDialog
+from htmltextview import HtmlTextView
from common import gajim
from plugins.helpers import log_calls, log
from plugins.helpers import GajimPluginActivateException
@@ -57,13 +58,15 @@
widgets_to_extract = ('plugins_notebook', 'plugin_name_label',
'plugin_version_label', 'plugin_authors_label',
- 'plugin_homepage_linkbutton', 'plugin_description_textview',
- 'uninstall_plugin_button', 'configure_plugin_button',
- 'installed_plugins_treeview')
+ 'plugin_homepage_linkbutton', 'uninstall_plugin_button',
+ 'configure_plugin_button', 'installed_plugins_treeview')
for widget_name in widgets_to_extract:
setattr(self, widget_name, self.xml.get_object(widget_name))
+ self.plugin_description_textview = HtmlTextView()
+ sw = self.xml.get_object('scrolledwindow2')
+ sw.add(self.plugin_description_textview)
attr_list = pango.AttrList()
attr_list.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1))
self.plugin_name_label.set_attributes(attr_list)
@@ -140,12 +143,22 @@
self.plugin_homepage_linkbutton.set_label(plugin.homepage)
self.plugin_homepage_linkbutton.set_property('sensitive', True)
- desc_textbuffer = self.plugin_description_textview.get_buffer()
+ sw = self.xml.get_object('scrolledwindow2')
+ old_tv = sw.get_children()[0]
+ old_tv.destroy()
+ self.plugin_description_textview = HtmlTextView()
+ sw.add(self.plugin_description_textview)
+ sw.show_all()
from plugins.plugins_i18n import _
txt = plugin.description
+ txt.replace('</body>', '')
if plugin.available_text:
- txt += '\n\n' + _('Warning: %s') % plugin.available_text
- desc_textbuffer.set_text(txt)
+ txt += '<br/><br/>' + _('Warning: %s') % plugin.available_text
+ if not txt.startswith('<body '):
+ txt = '<body xmlns=\'http://www.w3.org/1999/xhtml\'>' + txt
+ txt += ' </body>'
+ self.plugin_description_textview.display_html(txt,
+ self.plugin_description_textview, None)
self.plugin_description_textview.set_property('sensitive', True)
self.uninstall_plugin_button.set_property('sensitive',
gajim.PLUGINS_DIRS[1] in plugin.__path__)
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits