[KSS-checkins] r50956 - in kukit/kss.core/branch/improve-demos/kss/core: pluginregistry/browser plugins/core/demo
jone at codespeak.net
jone at codespeak.net
Thu Jan 24 12:03:43 CET 2008
Author: jone
Date: Thu Jan 24 12:03:43 2008
New Revision: 50956
Added:
kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/demoregistry.py
kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/help.kss
kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/typewriter.rst
Modified:
kukit/kss.core/branch/improve-demos/kss/core/pluginregistry/browser/develui.css
kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/configure.zcml
kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/zopeconfig.py
Log:
added description and help functionality to demo
Modified: kukit/kss.core/branch/improve-demos/kss/core/pluginregistry/browser/develui.css
==============================================================================
--- kukit/kss.core/branch/improve-demos/kss/core/pluginregistry/browser/develui.css (original)
+++ kukit/kss.core/branch/improve-demos/kss/core/pluginregistry/browser/develui.css Thu Jan 24 12:03:43 2008
@@ -61,6 +61,10 @@
color: white;
}
+a.hidden {
+ display: none !important;
+}
+
#target {
padding: 1em;
margin: 0.5em 0;
Modified: kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/configure.zcml
==============================================================================
--- kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/configure.zcml (original)
+++ kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/configure.zcml Thu Jan 24 12:03:43 2008
@@ -30,6 +30,35 @@
permission="zope.Public"
/>
</configure>
+
+ <browser:page
+ for="*"
+ name="demoregistry"
+ class=".demoregistry.DemoRegistry"
+ permission="zope.Public"
+ />
+
+ <browser:page
+ for="kss.demo.interfaces.ISimpleContent"
+ class=".demoregistry.DemoRegistry"
+ attribute="displayHelp"
+ name="displayHelp"
+ permission="zope.View"
+ />
+
+ <browser:page
+ for="kss.demo.interfaces.ISimpleContent"
+ class=".demoregistry.DemoRegistry"
+ attribute="hideHelp"
+ name="hideHelp"
+ permission="zope.View"
+ />
+
+ <browser:resource
+ file="help.kss"
+ name="help.kss"
+ />
+
<!-- change tag content -->
<browser:page
Added: kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/demoregistry.py
==============================================================================
--- (empty file)
+++ kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/demoregistry.py Thu Jan 24 12:03:43 2008
@@ -0,0 +1,65 @@
+# Copyright (c) 2005-2007
+# Authors: KSS Project Contributors (see docs/CREDITS.txt)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+from kss.core.plugins.core.demo.zopeconfig import KSSCoreDemos
+from reStructuredText import HTML
+from zope.dottedname.resolve import resolve
+from kss.core import KSSView
+
+class DemoRegistry(KSSView):
+
+ def getDemo(self, viewname):
+ kssdemos = KSSCoreDemos().demos
+ for demo in kssdemos:
+ if demo.page_url==viewname + '.html':
+ return demo
+ return None
+
+ def getHTMLHelp(self, viewname):
+ demo = self.getDemo(viewname)
+ packagePath = self.getPackagePath(viewname)
+ helpfile = demo.helpfile
+ if not packagePath or not helpfile:
+ return ''
+ file = open(packagePath + '/' + helpfile)
+ rtext = file.read()
+ file.close()
+ html = HTML(rtext)
+ return html
+
+ def getPackagePath(self, viewname):
+ demo = self.getDemo(viewname)
+ packageName = demo.packageName
+ if not packageName:
+ return None
+ module = resolve(packageName)
+ packagePath = '/'.join(module.__file__.split('/')[:-1])
+ return packagePath
+
+ def displayHelp(self, viewname):
+ html = '<h1>Description</h1><div>%s</div>' % self.getHTMLHelp(viewname)
+ self.getCommandSet('core').replaceInnerHTML('div#help', html)
+ self.getCommandSet('core').addClass('a#displayHelp', 'hidden')
+ self.getCommandSet('core').removeClass('a#hideHelp', 'hidden')
+ return self.render()
+
+ def hideHelp(self):
+ self.getCommandSet('core').replaceInnerHTML('div#help', '')
+ self.getCommandSet('core').removeClass('a#displayHelp', 'hidden')
+ self.getCommandSet('core').addClass('a#hideHelp', 'hidden')
+ return self.render()
Added: kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/help.kss
==============================================================================
--- (empty file)
+++ kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/help.kss Thu Jan 24 12:03:43 2008
@@ -0,0 +1,9 @@
+
+a#displayHelp:click {
+ action-server: displayHelp;
+ displayHelp-viewname: kssAttr(viewname);
+}
+
+a#hideHelp:click {
+ action-server: hideHelp;
+}
Added: kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/typewriter.rst
==============================================================================
--- (empty file)
+++ kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/typewriter.rst Thu Jan 24 12:03:43 2008
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+Copying Docutils
+
+
+
+
+
+
+ Copying Docutils
+
+
+
+
+Author:
+David Goodger
+Contact:
+goodger@users.sourceforge.net
+Date:
+2002-10-03
+Web site: http://docutils.sourceforge.net/
+
+
+
+ Most of the files included in this project are in the public domain,
+and therefore have no license requirement and no restrictions on
+copying or usage. The exceptions are:
+
+docutils/optik.py, copyright Gregory P. Ward, released under a
+BSD-style license (which can be found in the module's source code).
+docutils/roman.py, copyright by Mark Pilgrim, released under the
+Python 2.1.1 license .
+test/difflib.py, copyright by the Python Software Foundation,
+released under the Python 2.2 license . This file is included for
+compatibility with Python versions less than 2.2; if you have Python
+2.2 or higher, difflib.py is not needed and may be removed. (It's
+only used to report test failures anyhow; it isn't installed
+anywhere. The included file is a pre-generator version of the
+difflib.py module included in Python 2.2.)
+
+ (Disclaimer: I am not a lawyer.) Both the BSD license and the Python
+license are OSI-approved and GPL-compatible . Although complicated
+by multiple owners and lots of legalese, the Python license basically
+lets you copy, use, modify, and redistribute files as long as you keep
+the copyright attribution intact, note any changes you make, and don't
+use the owner's name in vain. The BSD license is similar.
+
+
+
+Generated on: 2003-04-19 15:32 UTC.
+Generated by Docutils from reStructuredText source.
+
+
+
Modified: kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/zopeconfig.py
==============================================================================
--- kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/zopeconfig.py (original)
+++ kukit/kss.core/branch/improve-demos/kss/core/plugins/core/demo/zopeconfig.py Thu Jan 24 12:03:43 2008
@@ -18,32 +18,36 @@
implements(IResource)
demos = (
- KSSDemo('', 'Applications', "addressbook.html", "Addressbook"),
- KSSDemo('', 'Applications', "typewriter.html", "Typewriter"),
+ KSSDemo('', 'Applications', "addressbook.html", "Addressbook",
+ description = 'Small Addressbook application'),
+ KSSDemo('', 'Applications', "typewriter.html", "Typewriter",
+ description = 'Typewriter application for learning typewriting',
+ helpfile = 'typewriter.rst',
+ packageName = 'kss.core.plugins.core.demo'),
KSSDemo('', 'Applications', "snake.html", "KSS-Snake"),
## KSSDemo('', '', "draganddrop.html", "Scriptaculous drag and drop"),
- KSSDemo('', 'Parameter functions', 'pf_forms.html', 'Forms'),
- KSSDemo('', 'Selectors', 'selectors.html', 'Parent node selector'),
- KSSDemo('', 'Core syntax', "kss_selector_param.html", "Kss selector parameters"),
- KSSDemo('', 'Core syntax', "kss_url_param.html", "Kss url parameters"),
- KSSDemo('', 'Core events', "kss_evt_preventbubbling.html", "Prevent bubbling KSS event parameter"),
- KSSDemo('', 'Core events', "kss_keyevents.html", "Key events"),
- KSSDemo('', 'Commands/Actions', "ca_focus.html", "Focus"),
- KSSDemo('', 'Commands/Actions', "actions.html", "Toggle case action"),
- KSSDemo('', 'History', "basic_commands.html", "Change tag content"),
- KSSDemo('', 'History', "two_selects.html", "Two selects"),
- KSSDemo('', 'History', "autoupdate.html", "Auto update"),
- KSSDemo('', 'History', "inline_edit.html", "Inline edit"),
- KSSDemo('', 'History', "cancel_submit.html", "Cancel Submit Click"),
- KSSDemo('', 'History', "tree.html", "Tree"),
- KSSDemo('', 'History', "more_selectors.html", "More complex selectors"),
- KSSDemo('', 'History', "two_select_revisited.html", "Master-slave selects revisited"),
- KSSDemo('', 'History', "form_submit.html", "Form submit"),
- KSSDemo('', 'History', "effects.html", "Effects"),
- KSSDemo('', 'History', "error_handling.html", "Error handling"),
- KSSDemo('', 'History', "preventdefault.html", "Preventdefault (a.k.a. Safari workarounds)"),
- KSSDemo('', 'History', "html_inserts.html", "HTML insertions (Change tag content returns)"),
- KSSDemo('', 'History', "client-server-protocol", "Client server protocol"),
+ KSSDemo('', 'Parameter functions', 'pf_forms.html', 'Forms'),
+ KSSDemo('', 'Selectors', 'selectors.html', 'Parent node selector'),
+ KSSDemo('', 'Core syntax', "kss_selector_param.html", "Kss selector parameters"),
+ KSSDemo('', 'Core syntax', "kss_url_param.html", "Kss url parameters"),
+ KSSDemo('', 'Core events', "kss_evt_preventbubbling.html", "Prevent bubbling KSS event parameter"),
+ KSSDemo('', 'Core events', "kss_keyevents.html", "Key events"),
+ KSSDemo('', 'Commands/Actions', "ca_focus.html", "Focus"),
+ KSSDemo('', 'Commands/Actions', "actions.html", "Toggle case action"),
+ KSSDemo('', 'History', "basic_commands.html", "Change tag content"),
+ KSSDemo('', 'History', "two_selects.html", "Two selects"),
+ KSSDemo('', 'History', "autoupdate.html", "Auto update"),
+ KSSDemo('', 'History', "inline_edit.html", "Inline edit"),
+ KSSDemo('', 'History', "cancel_submit.html", "Cancel Submit Click"),
+ KSSDemo('', 'History', "tree.html", "Tree"),
+ KSSDemo('', 'History', "more_selectors.html", "More complex selectors"),
+ KSSDemo('', 'History', "two_select_revisited.html", "Master-slave selects revisited"),
+ KSSDemo('', 'History', "form_submit.html", "Form submit"),
+ KSSDemo('', 'History', "effects.html", "Effects"),
+ KSSDemo('', 'History', "error_handling.html", "Error handling"),
+ KSSDemo('', 'History', "preventdefault.html", "Preventdefault (a.k.a. Safari workarounds)"),
+ KSSDemo('', 'History', "html_inserts.html", "HTML insertions (Change tag content returns)"),
+ KSSDemo('', 'History', "client-server-protocol", "Client server protocol"),
)
# directories are relative from the location of this .py file
More information about the Kukit-checkins
mailing list