summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Baumann <derflob@derflob.de>2016-07-16 23:28:33 +1200
committerFlorian Baumann <derflob@derflob.de>2016-07-16 23:28:33 +1200
commite4e63630b707f90946b07d324fbb311cf2cdb830 (patch)
tree0004fc396d3df242cea643ce002e64cd83a9de49
parent3502c32228a3223fb3bf67c9b0b526cc094ddfbf (diff)
downloadxmpp-e4e63630b707f90946b07d324fbb311cf2cdb830.tar.gz
xmpp-e4e63630b707f90946b07d324fbb311cf2cdb830.tar.bz2
decorate with usage
-rw-r--r--__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/__init__.py b/__init__.py
index d2c911e..408764a 100644
--- a/__init__.py
+++ b/__init__.py
@@ -9,20 +9,28 @@ import datetime
from octoprint.plugin import EventHandlerPlugin, SettingsPlugin
class xmpp_cmd():
+
def __init__(self, usage, name=None, desc=None, hidden=False):
+ self.usage = usage
self.name = name
self.desc = desc
self.hidden = hidden
+
def __call__(self, fn):
+ fn.usage = self.usage
+
if (self.name):
fn.xmpp_cmd = self.name
else:
fn.xmpp_cmd = fn.__name__[len('_cmd_'):]
+
if (self.desc):
fn.desc = self.desc
else:
fn.desc = fn.__doc__
+
fn.hidden = self.hidden
+
return fn
class OctoXMPP(EventHandlerPlugin, SettingsPlugin):