Module.move should return self

This commit is contained in:
enkore 2013-03-23 22:02:46 +01:00
parent 39168c9c74
commit c5413c4243
2 changed files with 8 additions and 1 deletions

View File

@ -3,7 +3,7 @@ import time
from .settings import SettingsBase from .settings import SettingsBase
from .threading import Manager from .threading import Manager
from .util import convert_position from .util import convert_position, chain
__all__ = [ __all__ = [
"Module", "AsyncModule", "IntervalModule", "Module", "AsyncModule", "IntervalModule",
@ -36,6 +36,7 @@ class Module(SettingsBase):
elif button == 3: # Right mouse button elif button == 3: # Right mouse button
self.on_rightclick() self.on_rightclick()
@chain
def move(self, position): def move(self, position):
self.position = position self.position = position

View File

@ -5,6 +5,12 @@ import itertools
from .exceptions import * from .exceptions import *
from .imputil import ClassFinder from .imputil import ClassFinder
def chain(fun):
def chained(self, *args, **kwargs):
fun(self, *args, **kwargs)
return self
return chained
def lchop(string, prefix): def lchop(string, prefix):
if string.startswith(prefix): if string.startswith(prefix):
return string[len(prefix):] return string[len(prefix):]