Ejemplo n.º 1
0
    def text(self, txt):
        """text: The text to display."""
        if type(txt) != str:
            raise TypeError('Error: txt=' + str(txt) + ' must be a string.')

        execute("{0}.{1} = '{2}'".format(self.widget_name, 'text',
                                         to_lua(txt)))
Ejemplo n.º 2
0
    def border_width(self, bw):
        """border_width: The border width to draw around."""
        if type(bw) != int and type(bw) != float:
            raise TypeError('Error: bw=' + str(bw) +
                            ' must be a int or float.')

        execute("{0}.{1} = '{2}'".format(self.widget_name, 'border_width',
                                         to_lua(bw)))
Ejemplo n.º 3
0
    def align(self, a):
        """align: Text alignment, left, center or right."""
        if type(a) != str:
            raise TypeError("Error: a=" + str(a) + " must be a string.")

        if a != "left" and a != "center" and a != "right":
            raise ValueError("Error: align can be either left, center or right.")

        execute("{0}.{1} = '{2}'".format(self.widget_name, "align", to_lua(a)))
Ejemplo n.º 4
0
    def bg(self, bk):
        """bk: Background color.
           Put 'trasparent' for a trasparent color.
        """
        if type(bk) != str:
            raise TypeError('Error: bk=' + str(bk) + ' must be a string.')

        if bk == 'trasparent':
            bk = '#00000000'
        execute("{0}.{1} = '{2}'".format(self.widget_name, 'bg', to_lua(bk)))
Ejemplo n.º 5
0
    def border_color(self, bc):
        """border_color: The border color.
           Put 'trasparent' for a trasparent color.
        """
        if type(bc) != str:
            raise TypeError("Error: bc=" + str(bc) + " must be a string.")

        if bc == "trasparent":
            bc = "#00000000"
        execute("{0}.{1} = '{2}'".format(self.widget_name, "border_color", to_lua(bc)))
Ejemplo n.º 6
0
    def bg(self, bk):
        """bk: Background color.
           Put 'trasparent' for a trasparent color.
        """
        if type(bk) != str:
            raise TypeError("Error: bk=" + str(bk) + " must be a string.")

        if bk == "trasparent":
            bk = "#00000000"
        execute("{0}.{1} = '{2}'".format(self.widget_name, "bg", to_lua(bk)))
Ejemplo n.º 7
0
    def align(self, a):
        """align: Text alignment, left, center or right."""
        if type(a) != str:
            raise TypeError('Error: a=' + str(a) + ' must be a string.')

        if a != 'left' and a != 'center' and a != 'right':
            raise ValueError(
                'Error: align can be either left, center or right.')

        execute("{0}.{1} = '{2}'".format(self.widget_name, 'align', to_lua(a)))
Ejemplo n.º 8
0
    def set_height(self, height):
        """Set the graph height.
            Parameters:
            height: The height to set.
        """
        if type(height) != int and type(height) != float:
            raise TypeError('Error: height=' + str(height) +
                            ' must be a int or float.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_height',
                                      to_lua(height)))
Ejemplo n.º 9
0
    def border_color(self, bc):
        """border_color: The border color.
           Put 'trasparent' for a trasparent color.
        """
        if type(bc) != str:
            raise TypeError('Error: bc=' + str(bc) + ' must be a string.')

        if bc == 'trasparent':
            bc = '#00000000'
        execute("{0}.{1} = '{2}'".format(self.widget_name, 'border_color',
                                         to_lua(bc)))
Ejemplo n.º 10
0
    def set_scale(self, scale):
        """
            Set the graph to automatically scale its values. 
            Default is false.
            Parameters:
            scale: A boolean value
        """
        if type(scale) != bool:
            raise TypeError('Error: scale=' + str(scale) + ' must be a bool.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_scale',
                                      to_lua(scale)))
Ejemplo n.º 11
0
    def set_stack(self, stack):
        """
            Set the graph to draw stacks. 
            Default is false.
            Parameters:
            stack: A boolean value.
        """
        if type(stack) != bool:
            raise TypeError('Error: stack=' + str(stack) + ' must be a bool.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_stack',
                                      to_lua(stack)))
Ejemplo n.º 12
0
    def set_stack_colors(self, stack_colors):
        """
            Set the graph stacking colors. Order matters.
            Parameters:
            stack_colors: A table with stacking colors.
        """
        if type(stack_colors) != dict:
            raise TypeError('Error: stack_colors=' + str(stack_colors) +
                            ' must be a dict.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_stack_colors',
                                      to_lua(stack_colors)))
Ejemplo n.º 13
0
    def set_width(self, width):
        """
            Set the graph width.
            Parameters:
            width: The width to set.
        """
        if type(width) != int and type(width) != float:
            raise TypeError('Error: width=' + str(width) +
                            ' must be a int or float.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_width',
                                      to_lua(width)))
Ejemplo n.º 14
0
    def set_color(self, color):
        """
            Set the graph foreground color.
            Parameters:
            color: The graph color.
        """
        if type(color) != str:
            raise TypeError('Error: color=' + str(color) +
                            ' must be a string.')

        execute("{0}:{1}('{2}')".format(self.widget_name, 'set_color',
                                        to_lua(color)))
Ejemplo n.º 15
0
    def set_gradient_angle(self, gradient_angle):
        """
            Set the graph foreground colors gradient angle.
            Default is 270 degrees (horizontal).
            Parameters:
            gradient_angle: Angle of gradient in degrees.
        """
        if type(gradient_angle) != int and type(gradient_angle) != float:
            raise TypeError('Error: gradient_angle=' + str(gradient_angle) +
                            ' must be a int or float.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_gradient_angle',
                                      to_lua(gradient_angle)))
Ejemplo n.º 16
0
    def set_border_color(self, color):
        """
            Set the graph border color. 
            If the value is nil, no border will be drawn.
            Parameters:
            color: The border color to set.
        """
        if type(color) != str:
            raise TypeError('Error: color=' + str(color) +
                            ' must be a string.')

        execute("{0}:{1}('{2}')".format(self.widget_name, 'set_border_color',
                                        to_lua(color)))
Ejemplo n.º 17
0
    def set_max_value(self, value):
        """
            Set the maximum value the graph should handle. 
            If "scale" is also set, the graph never scales up below this value, 
            but it automatically scales down to make all data fit.
            Parameters:
            value: The value.
        """
        if type(value) != int and type(value) != float:
            raise TypeError('Error: value=' + str(value) +
                            ' must be a int or float.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_max_value',
                                      to_lua(value)))
Ejemplo n.º 18
0
    def set_gradient_colors(self, gradient_colors):
        """
            Set the graph foreground color as a gradient.
            Parameters:
            gradient_colors: A table with gradients colors. 
            The distance between each color can also be specified.
            Example: { "red", "blue" } or { "red", "green", "blue", blue = 10 } 
            to specify blue distance from other colors.
        """
        if type(gradient_colors) != set:
            raise TypeError('Error: gradient_colors=' + str(gradient_colors) +
                            ' must be a dict.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_gradient_colors',
                                      to_lua(gradient_colors)))
Ejemplo n.º 19
0
    def add_value(self, value, group=None):
        """
            Add a value to the graph
            Parameters: 
            value: The value between 0 and 1.
            group: The stack color group index.

        """
        if type(value) != float and type(value) != int:
            raise TypeError('Error: value=' + str(value) +
                            ' must be a float or int.')

        if value < 0 or value > 1:
            raise ValueError('Error: value=' + value +
                             '. It must be between 0 and 1.')

        execute("{0}:{1}({2})".format(self.widget_name, 'add_value',
                                      to_lua(value)))
Ejemplo n.º 20
0
    def visible(self, b):
        if type(b) != bool:
            raise TypeError("Error: b=" + str(b) + " must be a bool.")

        execute("{0}.{1} = {2}".format(self.widget_name, "visible", to_lua(b)))
Ejemplo n.º 21
0
    def border_width(self, bw):
        """border_width: The border width to draw around."""
        if type(bw) != int and type(bw) != float:
            raise TypeError("Error: bw=" + str(bw) + " must be a int or float.")

        execute("{0}.{1} = '{2}'".format(self.widget_name, "border_width", to_lua(bw)))
Ejemplo n.º 22
0
    def width(self, w):
        """width(int or float): The width of the textbox. Set to 0 for auto."""
        if type(w) != int and type(w) != float:
            raise TypeError('Error: w=' + str(w) + ' must be a int or float.')

        execute("{0}.{1} = '{2}'".format(self.widget_name, 'width', to_lua(w)))
Ejemplo n.º 23
0
    def text(self, txt):
        """text: The text to display."""
        if type(txt) != str:
            raise TypeError("Error: txt=" + str(txt) + " must be a string.")

        execute("{0}.{1} = '{2}'".format(self.widget_name, "text", to_lua(txt)))
Ejemplo n.º 24
0
    def width(self, w):
        """width(int or float): The width of the textbox. Set to 0 for auto."""
        if type(w) != int and type(w) != float:
            raise TypeError("Error: w=" + str(w) + " must be a int or float.")

        execute("{0}.{1} = '{2}'".format(self.widget_name, "width", to_lua(w)))
Ejemplo n.º 25
0
    def visible(self, b):
        if type(b) != bool:
            raise TypeError('Error: b=' + str(b) + ' must be a bool.')

        execute("{0}.{1} = {2}".format(self.widget_name, 'visible', to_lua(b)))