def __init__(self, widget_name): """widget_name (str) string of the widget declared in rc.lua""" if widget_name == None: raise ValueError("You must specify the name of a widget declared in rc.lua.") # Checks if the widget already exists in rc.lua otherwise launch Exception out = to_python(execute("return " + widget_name)) if not out: raise WidgetDoesNotExist("Error: The widget: " + widget_name + " doesn't exist in rc.lua.") if out[:6] != "widget": print(out) raise WidgetTypeError("Error: The " + widget_name + " is not a widget.") self.widget_name = widget_name
def __init__(self, widget_name): """widget_name (str) string of the widget declared in rc.lua""" if widget_name == None: raise ValueError( 'You must specify the name of a widget declared in rc.lua.') # Checks if the widget already exists in rc.lua otherwise launch Exception out = to_python(execute('return ' + widget_name)) if not out: raise WidgetDoesNotExist("Error: The widget: " + widget_name + " doesn't exist in rc.lua.") if out[:6] != 'widget': print(out) raise WidgetTypeError("Error: The " + widget_name + " is not a widget.") self.widget_name = widget_name
def width(self): """Define the width of the widget.""" return to_python(execute("return {0}.{1}".format(self.widget_name, "width")))
def text(self): """return The text to display.""" return to_python(execute("return {0}.{1}".format(self.widget_name, "text")))
def visible(self): """Returns whether the widget is visible.""" return to_python(execute("return {0}.{1}".format(self.widget_name, "visible")))
def bg(self): """return The background to display.""" return to_python(execute("return {0}.{1}".format(self.widget_name, "bg")))
def align(self): """Define the tetxt alignment: left, center or right.""" return to_python(execute("return {0}.{1}".format(self.widget_name, "align")))
def border_color(self): """Define the border color of the widget.""" return to_python(execute("return {0}.{1}".format(self.widget_name, "border_color")))
def width(self): """Define the width of the widget.""" return to_python( execute("return {0}.{1}".format(self.widget_name, 'width')))
def text(self): """return The text to display.""" return to_python( execute("return {0}.{1}".format(self.widget_name, 'text')))
def visible(self): """Returns whether the widget is visible.""" return to_python( execute("return {0}.{1}".format(self.widget_name, 'visible')))
def bg(self): """return The background to display.""" return to_python( execute("return {0}.{1}".format(self.widget_name, 'bg')))
def align(self): """Define the tetxt alignment: left, center or right.""" return to_python( execute("return {0}.{1}".format(self.widget_name, 'align')))
def border_color(self): """Define the border color of the widget.""" return to_python( execute("return {0}.{1}".format(self.widget_name, 'border_color')))