[modules/vault] quotes
This commit is contained in:
parent
de42edc6b7
commit
801eceddd2
1 changed files with 11 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
|||
# pylint: disable=C0111,R0903
|
||||
|
||||
"""Copy passwords from a password store into the clipboard (currently supports only "pass")
|
||||
"""Copy passwords from a password store into the clipboard (currently supports only 'pass')
|
||||
|
||||
Many thanks to [@bbernhard](https://github.com/bbernhard) for the idea!
|
||||
|
||||
|
@ -29,9 +29,9 @@ import bumblebee.engine
|
|||
def build_menu(parent, current_directory, callback):
|
||||
with os.scandir(current_directory) as it:
|
||||
for entry in it:
|
||||
if entry.name.startswith("."): continue
|
||||
if entry.name.startswith('.'): continue
|
||||
if entry.is_file():
|
||||
name = entry.name[:entry.name.rfind(".")]
|
||||
name = entry.name[:entry.name.rfind('.')]
|
||||
parent.add_menuitem(name, callback=lambda : callback(os.path.join(current_directory, name)))
|
||||
|
||||
else:
|
||||
|
@ -44,10 +44,10 @@ class Module(bumblebee.engine.Module):
|
|||
super(Module, self).__init__(engine, config,
|
||||
bumblebee.output.Widget(full_text=self.text)
|
||||
)
|
||||
self._duration = int(self.parameter("duration", 30))
|
||||
self._offx = int(self.parameter("offx", 0))
|
||||
self._offy = int(self.parameter("offy", 0))
|
||||
self._path = os.path.expanduser(self.parameter("location", "~/.password-store/"))
|
||||
self._duration = int(self.parameter('duration', 30))
|
||||
self._offx = int(self.parameter('offx', 0))
|
||||
self._offy = int(self.parameter('offy', 0))
|
||||
self._path = os.path.expanduser(self.parameter('location', '~/.password-store/'))
|
||||
self._reset()
|
||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||
cmd=self.popup)
|
||||
|
@ -60,14 +60,14 @@ class Module(bumblebee.engine.Module):
|
|||
|
||||
def _reset(self):
|
||||
self._timer = None
|
||||
self._text = str(self.parameter("text", "<click-for-password>"))
|
||||
self._text = str(self.parameter('text', '<click-for-password>'))
|
||||
|
||||
def _callback(self, secret_name):
|
||||
secret_name = secret_name.replace(self._path, "") # remove common path
|
||||
secret_name = secret_name.replace(self._path, '') # remove common path
|
||||
if self._timer:
|
||||
self._timer.cancel()
|
||||
# bumblebee.util.execute hangs for some reason
|
||||
os.system("PASSWORD_STORE_CLIP_TIME={} pass -c {} > /dev/null 2>&1".format(self._duration, secret_name))
|
||||
os.system('PASSWORD_STORE_CLIP_TIME={} pass -c {} > /dev/null 2>&1'.format(self._duration, secret_name))
|
||||
self._timer = threading.Timer(self._duration, self._reset)
|
||||
self._timer.start()
|
||||
self._start = int(time.time())
|
||||
|
@ -75,7 +75,7 @@ class Module(bumblebee.engine.Module):
|
|||
|
||||
def text(self, widget):
|
||||
if self._timer:
|
||||
return "{} ({}s)".format(self._text, self._duration - (int(time.time()) - self._start))
|
||||
return '{} ({}s)'.format(self._text, self._duration - (int(time.time()) - self._start))
|
||||
return self._text
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Reference in a new issue