Added first version of 'Plugins' window. It's accessible through 'Edit/Plugins' item in roster menu. It seems that you can successfully (de)activate plug-ins through GUI now.
Added 'homepage' attribute to Plugin class. Added (commented out) calls of pycallgraph in src/gajim.py for later use. [xbright] Changed 'python' to 'python2.5' because code uses modules not available in previous versions of Python.
This commit is contained in:
		
							parent
							
								
									654e157eff
								
							
						
					
					
						commit
						e127925948
					
				
					 9 changed files with 844 additions and 17 deletions
				
			
		
							
								
								
									
										602
									
								
								data/glade/plugins_window.glade
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										602
									
								
								data/glade/plugins_window.glade
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,602 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
			
		||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
 | 
			
		||||
<!--Generated with glade3 3.4.5 on Sat Jun  7 19:16:21 2008 -->
 | 
			
		||||
<glade-interface>
 | 
			
		||||
  <widget class="GtkWindow" id="plugins_window">
 | 
			
		||||
    <property name="width_request">650</property>
 | 
			
		||||
    <property name="height_request">500</property>
 | 
			
		||||
    <property name="border_width">6</property>
 | 
			
		||||
    <property name="title" translatable="yes">Plugins</property>
 | 
			
		||||
    <property name="default_width">650</property>
 | 
			
		||||
    <property name="default_height">500</property>
 | 
			
		||||
    <signal name="destroy" handler="on_plugins_window_destroy"/>
 | 
			
		||||
    <child>
 | 
			
		||||
      <widget class="GtkVBox" id="vbox1">
 | 
			
		||||
        <property name="visible">True</property>
 | 
			
		||||
        <property name="spacing">6</property>
 | 
			
		||||
        <child>
 | 
			
		||||
          <widget class="GtkNotebook" id="plugins_notebook">
 | 
			
		||||
            <property name="visible">True</property>
 | 
			
		||||
            <property name="can_focus">True</property>
 | 
			
		||||
            <child>
 | 
			
		||||
              <widget class="GtkHPaned" id="hpaned1">
 | 
			
		||||
                <property name="visible">True</property>
 | 
			
		||||
                <property name="can_focus">True</property>
 | 
			
		||||
                <property name="position">250</property>
 | 
			
		||||
                <property name="position_set">True</property>
 | 
			
		||||
                <child>
 | 
			
		||||
                  <widget class="GtkScrolledWindow" id="scrolledwindow1">
 | 
			
		||||
                    <property name="visible">True</property>
 | 
			
		||||
                    <property name="can_focus">True</property>
 | 
			
		||||
                    <property name="border_width">6</property>
 | 
			
		||||
                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 | 
			
		||||
                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkTreeView" id="installed_plugins_treeview">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <property name="can_focus">True</property>
 | 
			
		||||
                        <property name="headers_clickable">True</property>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                    </child>
 | 
			
		||||
                  </widget>
 | 
			
		||||
                  <packing>
 | 
			
		||||
                    <property name="resize">False</property>
 | 
			
		||||
                    <property name="shrink">True</property>
 | 
			
		||||
                  </packing>
 | 
			
		||||
                </child>
 | 
			
		||||
                <child>
 | 
			
		||||
                  <widget class="GtkVBox" id="vbox2">
 | 
			
		||||
                    <property name="visible">True</property>
 | 
			
		||||
                    <property name="border_width">6</property>
 | 
			
		||||
                    <property name="spacing">6</property>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHBox" id="hbox4">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <property name="spacing">6</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="plugin_name_label">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="xalign">0</property>
 | 
			
		||||
                            <property name="label" translatable="yes"><empty></property>
 | 
			
		||||
                            <property name="use_markup">True</property>
 | 
			
		||||
                            <property name="wrap">True</property>
 | 
			
		||||
                            <property name="selectable">True</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkAlignment" id="alignment1">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <child>
 | 
			
		||||
                              <placeholder/>
 | 
			
		||||
                            </child>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHBox" id="hbox1">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <property name="spacing">6</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="label5">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">Version:</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="plugin_version_label">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="xalign">0</property>
 | 
			
		||||
                            <property name="label" translatable="yes"><empty></property>
 | 
			
		||||
                            <property name="selectable">True</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                        <property name="position">1</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHBox" id="hbox2">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <property name="spacing">6</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="label4">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="yalign">0</property>
 | 
			
		||||
                            <property name="label" translatable="yes">Authors:</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="plugin_authors_label">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="xalign">0</property>
 | 
			
		||||
                            <property name="yalign">0</property>
 | 
			
		||||
                            <property name="label" translatable="yes"><empty></property>
 | 
			
		||||
                            <property name="wrap_mode">PANGO_WRAP_WORD_CHAR</property>
 | 
			
		||||
                            <property name="selectable">True</property>
 | 
			
		||||
                            <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                        <property name="position">2</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHBox" id="hbox3">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="label6">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">Homepage:</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLinkButton" id="plugin_homepage_linkbutton">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="can_focus">True</property>
 | 
			
		||||
                            <property name="receives_default">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">homepage url</property>
 | 
			
		||||
                            <property name="relief">GTK_RELIEF_NONE</property>
 | 
			
		||||
                            <property name="focus_on_click">False</property>
 | 
			
		||||
                            <property name="xalign">0</property>
 | 
			
		||||
                            <property name="response_id">0</property>
 | 
			
		||||
                            <property name="uri"></property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                        <property name="position">3</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkVBox" id="vbox3">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkHBox" id="hbox5">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <child>
 | 
			
		||||
                              <widget class="GtkLabel" id="label7">
 | 
			
		||||
                                <property name="visible">True</property>
 | 
			
		||||
                                <property name="label" translatable="yes">Descrition:</property>
 | 
			
		||||
                              </widget>
 | 
			
		||||
                              <packing>
 | 
			
		||||
                                <property name="expand">False</property>
 | 
			
		||||
                              </packing>
 | 
			
		||||
                            </child>
 | 
			
		||||
                            <child>
 | 
			
		||||
                              <widget class="GtkAlignment" id="alignment2">
 | 
			
		||||
                                <property name="visible">True</property>
 | 
			
		||||
                                <child>
 | 
			
		||||
                                  <placeholder/>
 | 
			
		||||
                                </child>
 | 
			
		||||
                              </widget>
 | 
			
		||||
                              <packing>
 | 
			
		||||
                                <property name="position">1</property>
 | 
			
		||||
                              </packing>
 | 
			
		||||
                            </child>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget 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">GTK_WRAP_WORD</property>
 | 
			
		||||
                            <property name="left_margin">6</property>
 | 
			
		||||
                            <property name="right_margin">6</property>
 | 
			
		||||
                            <property name="indent">1</property>
 | 
			
		||||
                            <property name="text" comments="This text is never displayed. You don't have to translate it.">Plug-in decription should be displayed here. This text will be erased during PluginsWindow initialization.</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="position">4</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHButtonBox" id="hbuttonbox2">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <property name="spacing">5</property>
 | 
			
		||||
                        <property name="layout_style">GTK_BUTTONBOX_END</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkButton" id="uninstall_plugin_button">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="can_focus">True</property>
 | 
			
		||||
                            <property name="receives_default">True</property>
 | 
			
		||||
                            <property name="response_id">0</property>
 | 
			
		||||
                            <child>
 | 
			
		||||
                              <widget class="GtkHBox" id="hbox11">
 | 
			
		||||
                                <property name="visible">True</property>
 | 
			
		||||
                                <child>
 | 
			
		||||
                                  <widget class="GtkImage" id="image1">
 | 
			
		||||
                                    <property name="visible">True</property>
 | 
			
		||||
                                    <property name="stock">gtk-cancel</property>
 | 
			
		||||
                                  </widget>
 | 
			
		||||
                                </child>
 | 
			
		||||
                                <child>
 | 
			
		||||
                                  <widget class="GtkLabel" id="uninstall_plugin_button_label">
 | 
			
		||||
                                    <property name="visible">True</property>
 | 
			
		||||
                                    <property name="label" translatable="yes">Uninstall</property>
 | 
			
		||||
                                  </widget>
 | 
			
		||||
                                  <packing>
 | 
			
		||||
                                    <property name="position">1</property>
 | 
			
		||||
                                  </packing>
 | 
			
		||||
                                </child>
 | 
			
		||||
                              </widget>
 | 
			
		||||
                            </child>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkButton" id="configure_plugin_button">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="can_focus">True</property>
 | 
			
		||||
                            <property name="receives_default">True</property>
 | 
			
		||||
                            <property name="response_id">0</property>
 | 
			
		||||
                            <child>
 | 
			
		||||
                              <widget class="GtkHBox" id="hbox12">
 | 
			
		||||
                                <property name="visible">True</property>
 | 
			
		||||
                                <child>
 | 
			
		||||
                                  <widget class="GtkImage" id="image2">
 | 
			
		||||
                                    <property name="visible">True</property>
 | 
			
		||||
                                    <property name="stock">gtk-preferences</property>
 | 
			
		||||
                                  </widget>
 | 
			
		||||
                                </child>
 | 
			
		||||
                                <child>
 | 
			
		||||
                                  <widget class="GtkLabel" id="configure_plugin_button_label">
 | 
			
		||||
                                    <property name="visible">True</property>
 | 
			
		||||
                                    <property name="label" translatable="yes">Configure</property>
 | 
			
		||||
                                  </widget>
 | 
			
		||||
                                  <packing>
 | 
			
		||||
                                    <property name="position">1</property>
 | 
			
		||||
                                  </packing>
 | 
			
		||||
                                </child>
 | 
			
		||||
                              </widget>
 | 
			
		||||
                            </child>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                        <property name="position">5</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                  </widget>
 | 
			
		||||
                  <packing>
 | 
			
		||||
                    <property name="resize">True</property>
 | 
			
		||||
                    <property name="shrink">True</property>
 | 
			
		||||
                  </packing>
 | 
			
		||||
                </child>
 | 
			
		||||
              </widget>
 | 
			
		||||
            </child>
 | 
			
		||||
            <child>
 | 
			
		||||
              <widget class="GtkLabel" id="label1">
 | 
			
		||||
                <property name="visible">True</property>
 | 
			
		||||
                <property name="label" translatable="yes">Installed</property>
 | 
			
		||||
              </widget>
 | 
			
		||||
              <packing>
 | 
			
		||||
                <property name="type">tab</property>
 | 
			
		||||
                <property name="tab_fill">False</property>
 | 
			
		||||
              </packing>
 | 
			
		||||
            </child>
 | 
			
		||||
            <child>
 | 
			
		||||
              <widget class="GtkHPaned" id="hpaned2">
 | 
			
		||||
                <property name="visible">True</property>
 | 
			
		||||
                <property name="can_focus">True</property>
 | 
			
		||||
                <child>
 | 
			
		||||
                  <widget class="GtkScrolledWindow" id="scrolledwindow2">
 | 
			
		||||
                    <property name="visible">True</property>
 | 
			
		||||
                    <property name="can_focus">True</property>
 | 
			
		||||
                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 | 
			
		||||
                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkTreeView" id="treeview2">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <property name="can_focus">True</property>
 | 
			
		||||
                        <property name="headers_clickable">True</property>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                    </child>
 | 
			
		||||
                  </widget>
 | 
			
		||||
                  <packing>
 | 
			
		||||
                    <property name="resize">False</property>
 | 
			
		||||
                    <property name="shrink">True</property>
 | 
			
		||||
                  </packing>
 | 
			
		||||
                </child>
 | 
			
		||||
                <child>
 | 
			
		||||
                  <widget class="GtkVBox" id="vbox4">
 | 
			
		||||
                    <property name="visible">True</property>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHBox" id="hbox6">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="plugin_name_label1">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes"><empty></property>
 | 
			
		||||
                            <property name="selectable">True</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkAlignment" id="alignment3">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <child>
 | 
			
		||||
                              <placeholder/>
 | 
			
		||||
                            </child>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHBox" id="hbox7">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="label3">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">Version:</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="plugin_version_label1">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes"><empty></property>
 | 
			
		||||
                            <property name="selectable">True</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                        <property name="position">1</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHBox" id="hbox8">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="label8">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">Authors:</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="plugin_authors_label1">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes"><empty></property>
 | 
			
		||||
                            <property name="selectable">True</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                        <property name="position">2</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHBox" id="hbox9">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLabel" id="label9">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">Homepage:</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkLinkButton" id="plugin_homepage_linkbutton1">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="can_focus">True</property>
 | 
			
		||||
                            <property name="receives_default">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">button</property>
 | 
			
		||||
                            <property name="relief">GTK_RELIEF_NONE</property>
 | 
			
		||||
                            <property name="focus_on_click">False</property>
 | 
			
		||||
                            <property name="response_id">0</property>
 | 
			
		||||
                            <property name="uri"></property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                        <property name="position">3</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkVBox" id="vbox5">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkHBox" id="hbox10">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <child>
 | 
			
		||||
                              <widget class="GtkLabel" id="label10">
 | 
			
		||||
                                <property name="visible">True</property>
 | 
			
		||||
                                <property name="label" translatable="yes">Descrition:</property>
 | 
			
		||||
                              </widget>
 | 
			
		||||
                              <packing>
 | 
			
		||||
                                <property name="expand">False</property>
 | 
			
		||||
                              </packing>
 | 
			
		||||
                            </child>
 | 
			
		||||
                            <child>
 | 
			
		||||
                              <widget class="GtkAlignment" id="alignment4">
 | 
			
		||||
                                <property name="visible">True</property>
 | 
			
		||||
                                <child>
 | 
			
		||||
                                  <placeholder/>
 | 
			
		||||
                                </child>
 | 
			
		||||
                              </widget>
 | 
			
		||||
                              <packing>
 | 
			
		||||
                                <property name="position">1</property>
 | 
			
		||||
                              </packing>
 | 
			
		||||
                            </child>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="expand">False</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkTextView" id="plugin_description_textview1">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="can_focus">True</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="position">4</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkHButtonBox" id="hbuttonbox3">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <property name="layout_style">GTK_BUTTONBOX_END</property>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkButton" id="uninstall_plugin_button1">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="can_focus">True</property>
 | 
			
		||||
                            <property name="receives_default">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">button</property>
 | 
			
		||||
                            <property name="response_id">0</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                        </child>
 | 
			
		||||
                        <child>
 | 
			
		||||
                          <widget class="GtkButton" id="configure_plugin_button1">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="can_focus">True</property>
 | 
			
		||||
                            <property name="receives_default">True</property>
 | 
			
		||||
                            <property name="label" translatable="yes">button</property>
 | 
			
		||||
                            <property name="response_id">0</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                          <packing>
 | 
			
		||||
                            <property name="position">1</property>
 | 
			
		||||
                          </packing>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                      <packing>
 | 
			
		||||
                        <property name="expand">False</property>
 | 
			
		||||
                        <property name="position">5</property>
 | 
			
		||||
                      </packing>
 | 
			
		||||
                    </child>
 | 
			
		||||
                  </widget>
 | 
			
		||||
                  <packing>
 | 
			
		||||
                    <property name="resize">True</property>
 | 
			
		||||
                    <property name="shrink">True</property>
 | 
			
		||||
                  </packing>
 | 
			
		||||
                </child>
 | 
			
		||||
              </widget>
 | 
			
		||||
              <packing>
 | 
			
		||||
                <property name="position">1</property>
 | 
			
		||||
              </packing>
 | 
			
		||||
            </child>
 | 
			
		||||
            <child>
 | 
			
		||||
              <widget class="GtkLabel" id="label2">
 | 
			
		||||
                <property name="label" translatable="yes">Available</property>
 | 
			
		||||
              </widget>
 | 
			
		||||
              <packing>
 | 
			
		||||
                <property name="type">tab</property>
 | 
			
		||||
                <property name="position">1</property>
 | 
			
		||||
                <property name="tab_fill">False</property>
 | 
			
		||||
              </packing>
 | 
			
		||||
            </child>
 | 
			
		||||
            <child>
 | 
			
		||||
              <placeholder/>
 | 
			
		||||
            </child>
 | 
			
		||||
            <child>
 | 
			
		||||
              <placeholder/>
 | 
			
		||||
              <packing>
 | 
			
		||||
                <property name="type">tab</property>
 | 
			
		||||
              </packing>
 | 
			
		||||
            </child>
 | 
			
		||||
          </widget>
 | 
			
		||||
        </child>
 | 
			
		||||
        <child>
 | 
			
		||||
          <widget class="GtkHButtonBox" id="hbuttonbox1">
 | 
			
		||||
            <property name="visible">True</property>
 | 
			
		||||
            <property name="spacing">15</property>
 | 
			
		||||
            <property name="layout_style">GTK_BUTTONBOX_END</property>
 | 
			
		||||
            <child>
 | 
			
		||||
              <widget class="GtkButton" id="close_button">
 | 
			
		||||
                <property name="visible">True</property>
 | 
			
		||||
                <property name="can_focus">True</property>
 | 
			
		||||
                <property name="receives_default">True</property>
 | 
			
		||||
                <property name="label" translatable="yes">gtk-close</property>
 | 
			
		||||
                <property name="use_stock">True</property>
 | 
			
		||||
                <property name="response_id">0</property>
 | 
			
		||||
                <signal name="clicked" handler="on_close_button_clicked"/>
 | 
			
		||||
              </widget>
 | 
			
		||||
            </child>
 | 
			
		||||
          </widget>
 | 
			
		||||
          <packing>
 | 
			
		||||
            <property name="expand">False</property>
 | 
			
		||||
            <property name="position">1</property>
 | 
			
		||||
          </packing>
 | 
			
		||||
        </child>
 | 
			
		||||
      </widget>
 | 
			
		||||
    </child>
 | 
			
		||||
  </widget>
 | 
			
		||||
</glade-interface>
 | 
			
		||||
| 
						 | 
				
			
			@ -193,6 +193,21 @@
 | 
			
		|||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                    </child>
 | 
			
		||||
                    <child>
 | 
			
		||||
                      <widget class="GtkImageMenuItem" id="plugins_menuitem">
 | 
			
		||||
                        <property name="visible">True</property>
 | 
			
		||||
                        <property name="label" translatable="yes">P_lugins</property>
 | 
			
		||||
                        <property name="use_underline">True</property>
 | 
			
		||||
                        <signal name="activate" handler="on_plugins_menuitem_activate"/>
 | 
			
		||||
                        <child internal-child="image">
 | 
			
		||||
                          <widget class="GtkImage" id="menu-item-image16">
 | 
			
		||||
                            <property name="visible">True</property>
 | 
			
		||||
                            <property name="stock">gtk-disconnect</property>
 | 
			
		||||
                            <property name="icon_size">1</property>
 | 
			
		||||
                          </widget>
 | 
			
		||||
                        </child>
 | 
			
		||||
                      </widget>
 | 
			
		||||
                    </child>
 | 
			
		||||
                  </widget>
 | 
			
		||||
                </child>
 | 
			
		||||
              </widget>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,4 +15,4 @@ if [ "x${OS}" == "xDarwin" ]; then
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
cd ${BASE}/src
 | 
			
		||||
exec -a gajim python -t gajim.py $@
 | 
			
		||||
exec -a gajim python2.5 -t gajim.py $@
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,12 +32,12 @@ from plugins import GajimPlugin
 | 
			
		|||
from plugins.helpers import log, log_calls
 | 
			
		||||
 | 
			
		||||
class LengthNotifierPlugin(GajimPlugin):
 | 
			
		||||
	name = 'Message Length Notifier'
 | 
			
		||||
	short_name = 'length_notifier'
 | 
			
		||||
	version = '0.1'
 | 
			
		||||
	description = '''Highlights message entry field in chat window when given 
 | 
			
		||||
length of message is exceeded.'''
 | 
			
		||||
	authors = ['Mateusz Biliński <mateusz@bilinski.it>']
 | 
			
		||||
	name = u'Message Length Notifier'
 | 
			
		||||
	short_name = u'length_notifier'
 | 
			
		||||
	version = u'0.1'
 | 
			
		||||
	description = u'''Highlights message entry field in chat window when given length of message is exceeded.'''
 | 
			
		||||
	authors = [u'Mateusz Biliński <mateusz@bilinski.it>']
 | 
			
		||||
	homepage = u'http://blog.bilinski.it'
 | 
			
		||||
 | 
			
		||||
	@log_calls('LengthNotifierPlugin')
 | 
			
		||||
	def __init__(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,8 @@
 | 
			
		|||
##
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import pycallgraph
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if os.name == 'nt':
 | 
			
		||||
	import warnings
 | 
			
		||||
| 
						 | 
				
			
			@ -602,6 +604,8 @@ def on_exit():
 | 
			
		|||
	if sys.platform == 'darwin':
 | 
			
		||||
		import osx
 | 
			
		||||
		osx.shutdown()
 | 
			
		||||
	
 | 
			
		||||
	#pycallgraph.make_dot_graph('common.xmpp-only.dot', format='dot')
 | 
			
		||||
 | 
			
		||||
import atexit
 | 
			
		||||
atexit.register(on_exit)
 | 
			
		||||
| 
						 | 
				
			
			@ -3231,6 +3235,9 @@ class Interface:
 | 
			
		|||
		gajim.ipython_window = window
 | 
			
		||||
 | 
			
		||||
	def __init__(self):
 | 
			
		||||
		#filter_func = pycallgraph.GlobbingFilter(include=['common.xmpp.*'])
 | 
			
		||||
		#pycallgraph.start_trace(filter_func=filter_func)
 | 
			
		||||
		
 | 
			
		||||
		gajim.interface = self
 | 
			
		||||
		# This is the manager and factory of message windows set by the module
 | 
			
		||||
		self.msg_win_mgr = None
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										166
									
								
								src/plugins/gui.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										166
									
								
								src/plugins/gui.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,166 @@
 | 
			
		|||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
## This file is part of Gajim.
 | 
			
		||||
##
 | 
			
		||||
## Gajim is free software; you can redistribute it and/or modify
 | 
			
		||||
## it under the terms of the GNU General Public License as published
 | 
			
		||||
## by the Free Software Foundation; version 3 only.
 | 
			
		||||
##
 | 
			
		||||
## Gajim is distributed in the hope that it will be useful,
 | 
			
		||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
## GNU General Public License for more details.
 | 
			
		||||
##
 | 
			
		||||
## You should have received a copy of the GNU General Public License
 | 
			
		||||
## along with Gajim.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
##
 | 
			
		||||
 | 
			
		||||
'''
 | 
			
		||||
GUI classes related to plug-in management.
 | 
			
		||||
 | 
			
		||||
:author: Mateusz Biliński <mateusz@bilinski.it>
 | 
			
		||||
:since: 06/06/2008
 | 
			
		||||
:copyright: Copyright (2008) Mateusz Biliński <mateusz@bilinski.it>
 | 
			
		||||
:license: GPL
 | 
			
		||||
'''
 | 
			
		||||
 | 
			
		||||
__all__ = ['PluginsWindow']
 | 
			
		||||
 | 
			
		||||
import pango
 | 
			
		||||
import gtk, gobject
 | 
			
		||||
 | 
			
		||||
import gtkgui_helpers
 | 
			
		||||
from common import gajim
 | 
			
		||||
 | 
			
		||||
from plugins.helpers import log_calls, log
 | 
			
		||||
 | 
			
		||||
class PluginsWindow(object):
 | 
			
		||||
	'''Class for Plugins window'''
 | 
			
		||||
 | 
			
		||||
	@log_calls('PluginsWindow')
 | 
			
		||||
	def __init__(self):
 | 
			
		||||
		'''Initialize Plugins window'''
 | 
			
		||||
		self.xml = gtkgui_helpers.get_glade('plugins_window.glade')
 | 
			
		||||
		self.window = self.xml.get_widget('plugins_window')
 | 
			
		||||
		self.window.set_transient_for(gajim.interface.roster.window)
 | 
			
		||||
		
 | 
			
		||||
		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')
 | 
			
		||||
		
 | 
			
		||||
		for widget_name in widgets_to_extract:
 | 
			
		||||
			setattr(self, widget_name, self.xml.get_widget(widget_name))
 | 
			
		||||
 | 
			
		||||
		attr_list = pango.AttrList()
 | 
			
		||||
		attr_list.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1))
 | 
			
		||||
		self.plugin_name_label.set_attributes(attr_list)
 | 
			
		||||
		
 | 
			
		||||
		self.installed_plugins_model = gtk.ListStore(gobject.TYPE_PYOBJECT,
 | 
			
		||||
													 gobject.TYPE_STRING, 
 | 
			
		||||
													 gobject.TYPE_BOOLEAN)
 | 
			
		||||
		self.installed_plugins_treeview.set_model(self.installed_plugins_model)
 | 
			
		||||
		
 | 
			
		||||
		renderer = gtk.CellRendererText()
 | 
			
		||||
		col = gtk.TreeViewColumn(_('Plugin'), renderer, text=1)
 | 
			
		||||
		self.installed_plugins_treeview.append_column(col)
 | 
			
		||||
		
 | 
			
		||||
		renderer = gtk.CellRendererToggle()
 | 
			
		||||
		renderer.set_property('activatable', True)
 | 
			
		||||
		renderer.connect('toggled', self.installed_plugins_toggled_cb)
 | 
			
		||||
		col = gtk.TreeViewColumn(_('Active'), renderer, active=2)
 | 
			
		||||
		self.installed_plugins_treeview.append_column(col)
 | 
			
		||||
		
 | 
			
		||||
		# connect signal for selection change
 | 
			
		||||
		selection = self.installed_plugins_treeview.get_selection()
 | 
			
		||||
		selection.connect('changed',
 | 
			
		||||
						  self.installed_plugins_treeview_selection_changed)
 | 
			
		||||
		selection.set_mode(gtk.SELECTION_SINGLE)
 | 
			
		||||
		
 | 
			
		||||
		self._clear_installed_plugin_info()
 | 
			
		||||
		
 | 
			
		||||
		self.fill_installed_plugins_model()
 | 
			
		||||
		
 | 
			
		||||
		self.xml.signal_autoconnect(self)
 | 
			
		||||
 | 
			
		||||
		self.plugins_notebook.set_current_page(0)
 | 
			
		||||
		
 | 
			
		||||
		self.window.show_all()
 | 
			
		||||
		gtkgui_helpers.possibly_move_window_in_current_desktop(self.window)
 | 
			
		||||
	
 | 
			
		||||
	@log_calls('PluginsWindow')
 | 
			
		||||
	def installed_plugins_treeview_selection_changed(self, treeview_selection):
 | 
			
		||||
		model, iter = treeview_selection.get_selected()
 | 
			
		||||
		if iter:
 | 
			
		||||
			plugin = model.get_value(iter, 0)
 | 
			
		||||
			plugin_name = model.get_value(iter, 1)
 | 
			
		||||
			is_active = model.get_value(iter, 2)
 | 
			
		||||
			
 | 
			
		||||
			self._display_installed_plugin_info(plugin)
 | 
			
		||||
		else:
 | 
			
		||||
			self._clear_installed_plugin_info()
 | 
			
		||||
		
 | 
			
		||||
	def _display_installed_plugin_info(self, plugin):
 | 
			
		||||
		self.plugin_name_label.set_text(plugin.name)
 | 
			
		||||
		self.plugin_version_label.set_text(plugin.version)
 | 
			
		||||
		self.plugin_authors_label.set_text(", ".join(plugin.authors))
 | 
			
		||||
		self.plugin_homepage_linkbutton.set_uri(plugin.homepage)
 | 
			
		||||
		self.plugin_homepage_linkbutton.set_label(plugin.homepage)
 | 
			
		||||
		self.plugin_homepage_linkbutton.set_property('sensitive', True)
 | 
			
		||||
		
 | 
			
		||||
		desc_textbuffer = self.plugin_description_textview.get_buffer()
 | 
			
		||||
		desc_textbuffer.set_text(plugin.description)
 | 
			
		||||
		self.plugin_description_textview.set_property('sensitive', True)
 | 
			
		||||
		self.uninstall_plugin_button.set_property('sensitive', True)
 | 
			
		||||
		self.configure_plugin_button.set_property('sensitive', True)
 | 
			
		||||
		
 | 
			
		||||
	def _clear_installed_plugin_info(self):
 | 
			
		||||
		self.plugin_name_label.set_text('')
 | 
			
		||||
		self.plugin_version_label.set_text('')
 | 
			
		||||
		self.plugin_authors_label.set_text('')
 | 
			
		||||
		self.plugin_homepage_linkbutton.set_uri('')
 | 
			
		||||
		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.uninstall_plugin_button.set_property('sensitive', False)
 | 
			
		||||
		self.configure_plugin_button.set_property('sensitive', False)
 | 
			
		||||
	
 | 
			
		||||
	@log_calls('PluginsWindow')
 | 
			
		||||
	def fill_installed_plugins_model(self):
 | 
			
		||||
		pm = gajim.plugin_manager
 | 
			
		||||
		self.installed_plugins_model.clear()
 | 
			
		||||
		self.installed_plugins_model.set_sort_column_id(0, gtk.SORT_ASCENDING)
 | 
			
		||||
		
 | 
			
		||||
		for plugin_class in pm.plugins:
 | 
			
		||||
			self.installed_plugins_model.append([plugin_class, 
 | 
			
		||||
												 plugin_class.name, 
 | 
			
		||||
												 plugin_class._active])
 | 
			
		||||
		
 | 
			
		||||
	@log_calls('PluginsWindow')
 | 
			
		||||
	def installed_plugins_toggled_cb(self, cell, path):
 | 
			
		||||
		is_active = self.installed_plugins_model[path][2]
 | 
			
		||||
		plugin_class = self.installed_plugins_model[path][0]
 | 
			
		||||
 | 
			
		||||
		if is_active:
 | 
			
		||||
			gajim.plugin_manager.deactivate_plugin(plugin_class._instance)
 | 
			
		||||
		else:
 | 
			
		||||
			gajim.plugin_manager.activate_plugin(plugin_class)
 | 
			
		||||
		
 | 
			
		||||
		self.installed_plugins_model[path][2] = not is_active
 | 
			
		||||
		
 | 
			
		||||
	@log_calls('PluginsWindow')
 | 
			
		||||
	def on_plugins_window_destroy(self, widget):
 | 
			
		||||
		'''Close window'''
 | 
			
		||||
		del gajim.interface.instances['plugins']
 | 
			
		||||
 | 
			
		||||
	@log_calls('PluginsWindow')
 | 
			
		||||
	def on_close_button_clicked(self, widget):
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ class GajimPlugin(object):
 | 
			
		|||
	'''
 | 
			
		||||
	Base class for implementing Gajim plugins.
 | 
			
		||||
	'''
 | 
			
		||||
	name = ''
 | 
			
		||||
	name = u''
 | 
			
		||||
	'''
 | 
			
		||||
	Name of plugin.
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ class GajimPlugin(object):
 | 
			
		|||
	
 | 
			
		||||
	:type: unicode
 | 
			
		||||
	'''
 | 
			
		||||
	short_name = ''
 | 
			
		||||
	short_name = u''
 | 
			
		||||
	'''
 | 
			
		||||
	Short name of plugin.
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ class GajimPlugin(object):
 | 
			
		|||
	:todo: decide whether we really need this one, because class name (with
 | 
			
		||||
		module name) can act as such short name		
 | 
			
		||||
	'''
 | 
			
		||||
	version = ''
 | 
			
		||||
	version = u''
 | 
			
		||||
	'''
 | 
			
		||||
	Version of plugin.
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ class GajimPlugin(object):
 | 
			
		|||
		same plugin class but with different version and we want only the newest
 | 
			
		||||
		one to be active - is such policy good?
 | 
			
		||||
	'''
 | 
			
		||||
	description = ''
 | 
			
		||||
	description = u''
 | 
			
		||||
	'''
 | 
			
		||||
	Plugin description.
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			@ -78,6 +78,15 @@ class GajimPlugin(object):
 | 
			
		|||
	:todo: should we decide on any particular format of author strings?
 | 
			
		||||
		Especially: should we force format of giving author's e-mail?
 | 
			
		||||
	'''
 | 
			
		||||
	homepage = u''
 | 
			
		||||
	'''
 | 
			
		||||
	URL to plug-in's homepage.
 | 
			
		||||
	
 | 
			
		||||
	:type: unicode
 | 
			
		||||
	
 | 
			
		||||
	:todo: should we check whether provided string is valid URI? (Maybe
 | 
			
		||||
	using 'property')
 | 
			
		||||
	'''
 | 
			
		||||
	gui_extension_points = {}
 | 
			
		||||
	'''
 | 
			
		||||
	Extension points that plugin wants to connect with.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,7 +94,7 @@ class PluginManager(object):
 | 
			
		|||
		'''
 | 
			
		||||
 | 
			
		||||
		for path in gajim.PLUGINS_DIRS:
 | 
			
		||||
			self.plugins.extend(PluginManager.scan_dir_for_plugins(path))
 | 
			
		||||
			self._add_plugins(PluginManager.scan_dir_for_plugins(path))
 | 
			
		||||
 | 
			
		||||
		log.debug('plugins: %s'%(self.plugins))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -102,6 +102,22 @@ class PluginManager(object):
 | 
			
		|||
 | 
			
		||||
		log.debug('active: %s'%(self.active_plugins))
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
	@log_calls('PluginManager')
 | 
			
		||||
	def _add_plugin(self, plugin_class):
 | 
			
		||||
		'''
 | 
			
		||||
		:todo: what about adding plug-ins that are already added? Module reload
 | 
			
		||||
		and adding class from reloaded module or ignoring adding plug-in?
 | 
			
		||||
		'''
 | 
			
		||||
		plugin_class._active = False
 | 
			
		||||
		plugin_class._instance = None
 | 
			
		||||
		self.plugins.append(plugin_class)
 | 
			
		||||
	
 | 
			
		||||
	@log_calls('PluginManager')
 | 
			
		||||
	def _add_plugins(self, plugin_classes):
 | 
			
		||||
		for plugin_class in plugin_classes:
 | 
			
		||||
			self._add_plugin(plugin_class)
 | 
			
		||||
		
 | 
			
		||||
	@log_calls('PluginManager')
 | 
			
		||||
	def gui_extension_point(self, gui_extpoint_name, *args):
 | 
			
		||||
		'''
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +140,6 @@ class PluginManager(object):
 | 
			
		|||
			call 'self._deactivate_plugin()' or sth similar.
 | 
			
		||||
			Looking closer - we only rewrite tuples here. Real check should be
 | 
			
		||||
			made in method that invokes gui_extpoints handlers.
 | 
			
		||||
 | 
			
		||||
		'''
 | 
			
		||||
 | 
			
		||||
		self._add_gui_extension_point_call_to_list(gui_extpoint_name, *args)
 | 
			
		||||
| 
						 | 
				
			
			@ -141,13 +156,13 @@ class PluginManager(object):
 | 
			
		|||
				handlers[0](*args)
 | 
			
		||||
 | 
			
		||||
	@log_calls('PluginManager')
 | 
			
		||||
	def activate_plugin(self, plugin):
 | 
			
		||||
	def activate_plugin(self, plugin_class):
 | 
			
		||||
		'''
 | 
			
		||||
		:param plugin: plugin to be activated
 | 
			
		||||
		:type plugin: class object of `GajimPlugin` subclass
 | 
			
		||||
		'''
 | 
			
		||||
		
 | 
			
		||||
		plugin_object = plugin()
 | 
			
		||||
		plugin_object = plugin_class()
 | 
			
		||||
 | 
			
		||||
		success = True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -156,6 +171,8 @@ class PluginManager(object):
 | 
			
		|||
 | 
			
		||||
		if success:
 | 
			
		||||
			self.active_plugins.append(plugin_object)
 | 
			
		||||
			plugin_class._instance = plugin_object
 | 
			
		||||
			plugin_class._active = True
 | 
			
		||||
 | 
			
		||||
		return success
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			@ -165,8 +182,9 @@ class PluginManager(object):
 | 
			
		|||
		# for each handled GUI extension point)
 | 
			
		||||
		for gui_extpoint_name, gui_extpoint_handlers in \
 | 
			
		||||
				plugin_object.gui_extension_points.iteritems():
 | 
			
		||||
			for gui_extension_point_args in self.gui_extension_points[gui_extpoint_name]:
 | 
			
		||||
				gui_extpoint_handlers[1](*gui_extension_point_args)
 | 
			
		||||
			if gui_extpoint_name in self.gui_extension_points:
 | 
			
		||||
				for gui_extension_point_args in self.gui_extension_points[gui_extpoint_name]:
 | 
			
		||||
					gui_extpoint_handlers[1](*gui_extension_point_args)
 | 
			
		||||
				
 | 
			
		||||
		# remove GUI extension points handlers (provided by plug-in) from
 | 
			
		||||
		# handlers list
 | 
			
		||||
| 
						 | 
				
			
			@ -176,6 +194,8 @@ class PluginManager(object):
 | 
			
		|||
			
 | 
			
		||||
		# removing plug-in from active plug-ins list
 | 
			
		||||
		self.active_plugins.remove(plugin_object)
 | 
			
		||||
		plugin_object.__class__._active = False
 | 
			
		||||
		del plugin_object
 | 
			
		||||
		
 | 
			
		||||
	def deactivate_all_plugins(self):
 | 
			
		||||
		for plugin_object in self.active_plugins:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,6 +44,8 @@ import message_control
 | 
			
		|||
import adhoc_commands
 | 
			
		||||
import notify
 | 
			
		||||
import features_window
 | 
			
		||||
import plugins
 | 
			
		||||
import plugins.gui
 | 
			
		||||
 | 
			
		||||
from common import gajim
 | 
			
		||||
from common import helpers
 | 
			
		||||
| 
						 | 
				
			
			@ -3129,6 +3131,12 @@ class RosterWindow:
 | 
			
		|||
			gajim.interface.instances['preferences'].window.present()
 | 
			
		||||
		else:
 | 
			
		||||
			gajim.interface.instances['preferences'] = config.PreferencesWindow()
 | 
			
		||||
			
 | 
			
		||||
	def on_plugins_menuitem_activate(self, widget):
 | 
			
		||||
		if gajim.interface.instances.has_key('plugins'):
 | 
			
		||||
			gajim.interface.instances['plugins'].window.present()
 | 
			
		||||
		else:
 | 
			
		||||
			gajim.interface.instances['plugins'] = plugins.gui.PluginsWindow()
 | 
			
		||||
 | 
			
		||||
	def on_publish_tune_checkbutton_toggled(self, widget, account):
 | 
			
		||||
		if widget.get_active():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue