Changes between Version 15 and Version 16 of Development/Plugins/WebUi/Examples


Ignore:
Timestamp:
09/21/2008 07:51:49 AM (13 years ago)
Author:
mvoncken
Comment:

--

Legend:

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

    v15 v16  
    5252}}} 
    5353 
    54 === Test the new method. === 
     54=== Test the new core-plugin method. === 
    5555create ~/prj/deluge/plugins/df/Df/test.py ; Contents: 
    5656{{{ 
     
    6262}}} 
    6363 
    64 === Execute test === 
     64Terminal: 
    6565{{{ 
    6666cd ~/prj/deluge/plugins/Df/df 
     
    8080=== Webui plugin === 
    8181Edit ~/prj/deluge/plugins/Df/df/webui.py and add this above ConfigForm 
     82 
     83Note that api.render.df automatically maps to df.html , because of the call to api.render.register_template_path (see http://webpy.org/) 
    8284{{{ 
    8385#!python 
     
    113115killall deluge & deluge -u web & 
    114116}}} 
     117Read the output to the console, there could be some errors there. 
    115118 
    116119visit http://localhost:8112/df 
    117120 
     121Execute test until there are no more errors, and the page displays the desired result. 
     122 
    118123=== Add to top menu === 
     124We added a page, but the user can't navigate to it, let's fix that : 
     125 
    119126Add 2 lines for register/unregister of the menu-items. 
    120127{{{ 
     128#!python 
    121129    def enable(self): 
    122130        api.config_page_manager.register('plugins','df',ConfigForm) 
     
    133141 
    134142=== Pretty template === 
     143We're allmost ready, but the current template doesn't look right. 
     144 
     145Adding a header/footer and menu to the template: 
    135146{{{ 
    136147$def with (df_result) 
     
    145156</div> 
    146157$:render.footer() 
     158 
    147159}}} 
    148160 
     
    150162 * (template_dir/path) is a convention, it will be automagic somewhere in the future. 
    151163 * all webui unregister_* methods will be renamed to deregister_* 
    152  * basic outline of developing a webui plugin is explained, todo: add some words to make the text flow.