Beispiel #1
0
 def __init__(self, *args):
     global _
     _ = i18n.Translator("rql-desklet")
     Sensor.__init__(self)
     # define configuration
     self._set_config_type("appid", datatypes.TYPE_STRING, "")
     self._set_config_type("user", datatypes.TYPE_STRING, "")
     self._set_config_type("passwd", datatypes.TYPE_SECRET_STRING, "")
     self._set_config_type("rql", datatypes.TYPE_STRING, "")
     self._set_config_type("url", datatypes.TYPE_STRING, "")
     self._set_config_type("delay", datatypes.TYPE_STRING, "600")
     # default timer
     self._add_timer(20, self.__update)
Beispiel #2
0
    def __init__(self, cmd, interval = 1000):

        self.__output = ""


        Sensor.__init__(self)
        self._add_timer(100, self.__on_tick, int(interval))
        if (int(interval) > 0):
            self._add_thread(self.__command_thread, cmd,
                             0.001 * float(interval))
        else:
            fail, output = commands.getstatusoutput(cmd)
            if (fail): output = ""
            self.__output = output
Beispiel #3
0
    def __init__(self, fontnumber="1", *fontargs):

        global _
        _ = i18n.Translator("font-selector-sensor")

        # the number of fonts
        self.__fontnumber = int(fontnumber)

        # the font settings
        self.__fonts = []

        # the color settings
        self.__colors = []

        Sensor.__init__(self)
        self._watch_config(self.config_watcher)
        # setup configuration entries
        if len(fontargs) == 1 and fontargs[0].find("  ") != -1:
            fontargs = (fontargs[0].replace("   ", ",").replace("  ", ",")).split(",")
            print "Using spaces to separate font entries is deprecated."
            print "Use commas instead."

        fontargs = list(fontargs)
        for font_n in xrange(self.__fontnumber):
            if fontargs:
                font = fontargs.pop(0)
            else:
                font = "Sans 8"
            if fontargs:
                color = fontargs.pop(0)
            else:
                color = "black"
            self._set_config_type("font%i" % font_n, TYPE_STRING, font)
            self._set_config_type("color%i" % font_n, TYPE_STRING, color)
        # end for

        self._add_timer(500, self.__font_init)