Merge pull request #311 from fredj/rm_immediate
Remove immediate param in github and hipchat update function
This commit is contained in:
commit
a11b7c1d92
2 changed files with 4 additions and 9 deletions
|
@ -10,7 +10,6 @@ Parameters:
|
|||
* github.interval: Interval in minutes
|
||||
"""
|
||||
|
||||
import functools
|
||||
import bumblebee.input
|
||||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
|
@ -31,14 +30,12 @@ class Module(bumblebee.engine.Module):
|
|||
self._requests.headers.update({"Authorization":"token {}".format(self.parameter("token", ""))})
|
||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||
cmd="x-www-browser https://github.com/notifications")
|
||||
immediate_update = functools.partial(self.update, immediate=True)
|
||||
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE,
|
||||
cmd=immediate_update)
|
||||
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd=self.update)
|
||||
|
||||
def github(self, _):
|
||||
return str(self._count)
|
||||
|
||||
def update(self, _, immediate=False):
|
||||
def update(self, _):
|
||||
try:
|
||||
self._count = 0
|
||||
url = "https://api.github.com/notifications"
|
||||
|
|
|
@ -8,7 +8,6 @@ Parameters:
|
|||
* hipchat.interval: Refresh interval in minutes (defaults to 5)
|
||||
"""
|
||||
|
||||
import functools
|
||||
import bumblebee.input
|
||||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
|
@ -31,13 +30,12 @@ class Module(bumblebee.engine.Module):
|
|||
self._requests = requests.Session()
|
||||
self._requests.headers.update({"Authorization":"Bearer {}".format(self.parameter("token", ""))})
|
||||
|
||||
immediate_update = functools.partial(self.update, immediate=True)
|
||||
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd=immediate_update)
|
||||
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd=self.update)
|
||||
|
||||
def output(self, _):
|
||||
return str(self._count)
|
||||
|
||||
def update(self, _, immediate=False):
|
||||
def update(self, _):
|
||||
try:
|
||||
self._count = 0
|
||||
items = self._requests.get(HIPCHAT_API_URL).json().get('items')
|
||||
|
|
Loading…
Reference in a new issue