Merge pull request #450 from joshbarrass/scrollingmod

parameter to prevent scrollable decorator from fixing the module width
This commit is contained in:
tobi-wan-kenobi 2019-10-02 23:17:31 +02:00 committed by GitHub
commit 0d8d45e879
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,11 +8,14 @@ import uuid
import bumblebee.store import bumblebee.store
_TrueValues = ["true", "t", "yes", "y", "1"]
def scrollable(func): def scrollable(func):
def wrapper(module, widget): def wrapper(module, widget):
text = func(module, widget) text = func(module, widget)
if not text: return text if not text: return text
width = widget.get("theme.width", module.parameter("width", 30)) width = widget.get("theme.width", module.parameter("width", 30))
if module.parameter("scrolling.makewide", "true").lower() in _TrueValues:
widget.set("theme.minwidth", "A"*width) widget.set("theme.minwidth", "A"*width)
if len(text) <= width: if len(text) <= width:
return text return text