[wiki.pymt] push by - Deleting wiki page HowToMakePlugin. on 2009-11-04 09:40 GMT

1 view
Skip to first unread message

codesite...@google.com

unread,
Nov 4, 2009, 4:51:20 AM11/4/09
to pymt-c...@googlegroups.com
Revision: 13c0a0de27
Author: txprog
Date: Wed Nov 4 01:40:17 2009
Log: Deleting wiki page HowToMakePlugin.
http://code.google.com/p/pymt/source/detail?repo=wiki&r=13c0a0de27

Deleted:
/HowToMakePlugin.wiki

=======================================
--- /HowToMakePlugin.wiki Fri Feb 6 16:36:05 2009
+++ /dev/null
@@ -1,59 +0,0 @@
-#summary How to make PyMT Plugin
-
-= Introduction =
-
-This is a brief tutorial to how make a plugin for PyMT.
-
-= Details =
-
-== Create directory structure ==
-You will need few things to make it work. Go to `pymt/examples/`
directory, and :
- * create a directory with your plugin name
- * add an empty `__init__.py` file in plugin directory
- * put your `plugin.py` in your plugin directory
-
-You will have :
- * `pymt/examples/plugin`
- * `pymt/examples/plugin/__init__.py` (empty file)
- * `pymt/examples/plugin/plugin.py`
-
-== Add plugin informations ==
-You must add some informations at start of plugin.py. Here is an example
from paint/paint.py :
-{{{
- # PYMT Plugin integration
- IS_PYMT_PLUGIN = True
- PLUGIN_TITLE = 'GL Paint'
- PLUGIN_AUTHOR = 'Thomas Hansen'
- PLUGIN_EMAIL = 'thomas...@gmail.com'
- PLUGIN_DESCRIPTION = 'This is a simple paint canvas.'
-}}}
-
-== Add hook for plugin activate/deactivate ==
-2 hooks are needed to create instance of plugin. It's
pymt_plugin_activate() and pymt_plugin_deactivate() functions. These
fonction are offer you 2 variables:
- * root: this is the container widget of your application
- * ctx: a generic object to store your plugin instance
-
-Here is an example from `paint/paint.py`
-{{{
-def pymt_plugin_activate(root, ctx):
- ctx.canvas = Canvas(pos=(40,40),size=(root.width,root.height))
- root.add_widget(ctx.canvas)
- ctx.slider = MTColorPicker(size=(130,290), target=[ctx.canvas])
- root.add_widget(ctx.slider)
-
-def pymt_plugin_deactivate(root, ctx):
- root.remove_widget(ctx.canvas)
- root.remove_widget(ctx.slider)
-}}}
-
-== Make your plugin running as standalone application ==
-Just add the code at the end of your plugin to make it work :
-{{{
-if __name__ == '__main__':
- w = MTWindow()
- w.set_fullscreen()
- ctx = MTContext()
- pymt_plugin_activate(w, ctx)
- runTouchApp()
- pymt_plugin_deactivate(w, ctx)
-}}}

Reply all
Reply to author
Forward
0 new messages