PluginSystem. xhtml in available tab
This commit is contained in:
		
							parent
							
								
									123c6e4d53
								
							
						
					
					
						commit
						ddbac25e19
					
				
					 2 changed files with 38 additions and 24 deletions
				
			
		| 
						 | 
				
			
			@ -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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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('<body '):
 | 
			
		||||
            txt = '<body  xmlns=\'http://www.w3.org/1999/xhtml\'>' + \
 | 
			
		||||
                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 @@ 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)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue