icons added to all system plugins (preliminary)

This commit is contained in:
lars 2006-10-31 02:50:29 +00:00
parent abacb36dbe
commit 4b6681487e
14 changed files with 64 additions and 4 deletions

View file

@ -20,6 +20,11 @@ class CryptoBoxPlugin:
## default rank (0..100) of the plugin in listings (lower value means higher priority) ## default rank (0..100) of the plugin in listings (lower value means higher priority)
rank = 80 rank = 80
## default icon of this plugin (relative path)
iconFile = "plugin_icon.png"
def __init__(self, cbox, pluginDir): def __init__(self, cbox, pluginDir):
self.cbox = cbox self.cbox = cbox
self.hdf = {} self.hdf = {}
@ -42,6 +47,12 @@ class CryptoBoxPlugin:
return self.__module__ return self.__module__
def getIcon(self):
"""return the image data of the icon of the plugin"""
import cherrypy
return cherrypy.lib.cptools.serveFile(os.path.join(self.pluginDir, self.iconFile))
def getTemplateFileName(self, template_name): def getTemplateFileName(self, template_name):
"""return the filename of the template, if it is part of this plugin """return the filename of the template, if it is part of this plugin

View file

@ -179,6 +179,8 @@ class WebInterfaceSites:
del args["weblang"] del args["weblang"]
except KeyError: except KeyError:
pass pass
if "icon" in args.keys():
return plugin.getIcon()
## check the device argument of volume plugins ## check the device argument of volume plugins
if "volume" in plugin.pluginCapabilities: if "volume" in plugin.pluginCapabilities:
try: try:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -2,6 +2,7 @@ The following directory structure is required:
- python code: plugins/PLUGINNAME/PLUGINNAME.py (all lower case is recommended) - python code: plugins/PLUGINNAME/PLUGINNAME.py (all lower case is recommended)
- language files: plugins/PLUGINNAME/lang/(en|de|??).hdf - language files: plugins/PLUGINNAME/lang/(en|de|??).hdf
- clearsilver templates: plugins/PLUGINNAME/*.cs - clearsilver templates: plugins/PLUGINNAME/*.cs
- icon (128x128px recommended): plugins/PLUGINNAME/plugin_icon.png
Python code interface: Python code interface:

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -8,9 +8,7 @@
<?cs loop: order = #0, #100, #1 <?cs loop: order = #0, #100, #1
?><?cs # plugins ?><?cs each:x = Settings.PluginList ?><?cs # plugins ?><?cs each:x = Settings.PluginList
?><?cs if:x.Enabled && x.Types.system && x.Rank == order ?> ?><?cs if:x.Enabled && x.Types.system && x.Rank == order ?>
<li><a href="<?cs call:link('plugins/' + name(x),'','','','') ?>" title="<?cs <?cs call:show_plugin(name(x)) ?><?cs /if ?><?cs
var:html_escape(x.Link) ?>"><?cs var:html_escape(x.Link) ?></a></li><?cs
/if ?><?cs
/each ?><?cs /each ?><?cs
/loop ?> /loop ?>

View file

@ -79,8 +79,15 @@ def:link(path, attr1, value1, attr2, value2)
?><?cs /if ?><?cs ?><?cs /if ?><?cs
/def ?><?cs /def ?><?cs
def:print_form_header(form_name, action) ?><?cs # def:print_form_header(form_name, action) ?><?cs #
# the header of a form - including Setting.LinkAttrs # the header of a form - including Setting.LinkAttrs
?><form name="<?cs var:html_escape(form_name) ?>" action="<?cs call:link(action,"","","","") ?>" method="post" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"><?cs ?><form name="<?cs var:html_escape(form_name) ?>" action="<?cs call:link(action,"","","","") ?>" method="post" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"><?cs
/def ?><?cs
def:show_plugin(plugin) ?><?cs
# show the icon and the name of this plugin
?><div<?cs each:x=Settings.PluginList[plugin].Types ?> class="plugin_<?cs var:html_escape(name(x)) ?><?cs /each ?>"><img src="<?cs call:link('plugins/' + plugin, 'icon','x','','') ?>" alt="<?cs var:html_escape('icon: ' + plugin) ?>" /><br/><?cs var:html_escape(Settings.PluginList[plugin].Link) ?></div><?cs
/def ?> /def ?>

View file

@ -443,3 +443,44 @@ button:hover {
padding-top: 10px; padding-top: 10px;
} }
/* -------------=-=-=- plugin icons -=-=-=--------------- */
div.plugin_main, div.plugin_system, div.plugin_volume {
text-align: center;
float: left;
padding: 10px;
margin: 5px;
}
div.plugin_main {
width: 80px;
height: 100px;
}
div.plugin_main img {
width: 64px;
height: 64px;
}
div.plugin_system {
width: 64px;
height: 80px;
}
div.plugin_system img {
width: 48px;
height: 48px;
}
div.plugin_volume {
width: 48px;
height: 64px;
}
div.plugin_volume img {
width: 32px;
height: 32px;
}