Add the option of specifying python-ish negative array indices to the move method
This commit is contained in:
parent
ecb6c54052
commit
60c475d6e6
@ -3,6 +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
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Module", "AsyncModule", "IntervalModule",
|
"Module", "AsyncModule", "IntervalModule",
|
||||||
@ -20,7 +21,7 @@ class Module(SettingsBase):
|
|||||||
if "name" not in self.output:
|
if "name" not in self.output:
|
||||||
self.output["name"] = self.__name__
|
self.output["name"] = self.__name__
|
||||||
self.output["instance"] = str(id(self))
|
self.output["instance"] = str(id(self))
|
||||||
json.insert(self.position, self.output)
|
json.insert(convert_position(self.position, json), self.output)
|
||||||
|
|
||||||
def on_click(self, button):
|
def on_click(self, button):
|
||||||
if button == 1: # Left mouse button
|
if button == 1: # Left mouse button
|
||||||
|
@ -95,3 +95,8 @@ class KeyConstraintDict(collections.UserDict):
|
|||||||
|
|
||||||
def missing(self):
|
def missing(self):
|
||||||
return self.required_keys - (self.seen_keys & self.required_keys)
|
return self.required_keys - (self.seen_keys & self.required_keys)
|
||||||
|
|
||||||
|
def convert_position(pos, json):
|
||||||
|
if pos < 0:
|
||||||
|
pos = len(json) + (pos+1)
|
||||||
|
return pos
|
||||||
|
Loading…
Reference in New Issue
Block a user