Changes between Version 2 and Version 3 of Development/Plugins/WebUi/Examples


Ignore:
Timestamp:
09/19/2008 06:50:24 PM (13 years ago)
Author:
mvoncken
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Development/Plugins/WebUi/Examples

    v2 v3  
    2121}}} 
    2222 
    23 == todo: example plugin here== 
     23== Example : a df page in webui == 
     24This example assumes you have deluge svn checked out to "~/src/deluge"  
     25And that your plugin-development-directory is "~/prj/deluge/plugins" 
     26 
     27This plugin will add a page to deluge that display the output of "df -h" to a page in the webui. 
     28 
     29 
     30=== Create a new plugin === 
     31{{{ 
     32cd ~/prj/deluge/plugins 
     33python ~/src/deluge/deluge/scripts/create_plugin.py --name Df --basepath . --author-name "My Name" --author-email "deluge@example.com" 
     34}}} 
     35 
     36=== Restart deluge(d) and enable the plugin in the gtk-ui. === 
     37 
     38 * Add a core method. 
     39Add this method to ~/prj/deluge/plugins/Df/df/core.py 
     40{{{ 
     41#!python 
     42    def export_get_df(self): 
     43        "returns the result of 'df -h' as a string" 
     44        import subprocess 
     45        return subprocess.call(["df","-h"]) 
     46}}} 
     47 
     48=== Test the new method. === 
     49create ~/prj/deluge/plugins/df/Df/test.py ; Contents: 
     50{{{ 
     51#!python 
     52from deluge.ui.client import sclient 
     53sclient.set_core_uri() 
     54 
     55print sclient.df_get_df() #export method is prefixed by plugin-name. 
     56}}} 
     57 
     58=== Execute test === 
     59{{{ 
     60cd ~/prj/deluge/plugins/Df/df 
     61killall deluged & deluged  && python test.py 
     62}}} 
     63Fix any errors until the test outputs the desired result. 
    2464 
    2565 
    2666 
     67== todo, webui part == 
     68 
     69 
     70 
     71