Exemple #1
0
 def add_gesture(cls, name, gesture, action):
     id_app = gestures._get_id_from_name(name)
     cmd = "DELETE FROM gestures WHERE id_app = ? AND gesture = ?"
     db.q(cmd, (str(id_app), gesture))
     
     cmd = "INSERT INTO gestures  (id_app, gesture, action) VALUES (?,?,?)"
     db.q(cmd, (str(id_app), gesture, action)) 
Exemple #2
0
    def add_gesture(cls, name, gesture, action):
        id_app = gestures._get_id_from_name(name)
        cmd = "DELETE FROM gestures WHERE id_app = ? AND gesture = ?"
        db.q(cmd, (str(id_app), gesture))

        cmd = "INSERT INTO gestures  (id_app, gesture, action) VALUES (?,?,?)"
        db.q(cmd, (str(id_app), gesture, action))
Exemple #3
0
    def remove_app(cls, name):
        app_id = gestures._get_id_from_name(name)
        print name, app_id
        cmd = "DELETE FROM apps WHERE id = ?"
        db.q(cmd, (app_id, ))

        cmd = "DELETE FROM gestures WHERE id_app = ?"
        db.q(cmd, (app_id, ))
Exemple #4
0
 def remove_app(cls, name):
     app_id = gestures._get_id_from_name(name)
     print name, app_id
     cmd = "DELETE FROM apps WHERE id = ?"
     db.q(cmd, (app_id,))
     
     cmd = "DELETE FROM gestures WHERE id_app = ?"
     db.q(cmd, (app_id,))
Exemple #5
0
    def find_gesture(cls, name, gesture):
        cmd = """
                SELECT action FROM apps LEFT JOIN gestures ON apps.id = gestures.id_app 
                WHERE (apps.name = ? OR apps.name = ?) AND gesture = ?
              """

        return db.q(cmd, (str(name[0]), str(name[1]), str(gesture))).fetchall()
Exemple #6
0
    def find_gesture(cls, name, gesture):
        cmd = """
                SELECT action FROM apps LEFT JOIN gestures ON apps.id = gestures.id_app 
                WHERE (apps.name = ? OR apps.name = ?) AND gesture = ?
              """

        return db.q(cmd, (str(name[0]),str(name[1]),str(gesture))).fetchall()
Exemple #7
0
 def get_app_gestures(cls, name):
     id_app = gestures._get_id_from_name(name)
     cmd = "SELECT * FROM gestures WHERE id_app = ?"
     return db.q(
         cmd,
         (str(id_app)),
     ).fetchall()
Exemple #8
0
    def _get_id_from_name(cls, name):
        cmd = "SELECT * FROM apps WHERE name = ?"
        r = db.q(cmd, (name,)).fetchall()

        if r == []:
            return 0
        else:
            return r[0]['id']
Exemple #9
0
    def _get_id_from_name(cls, name):
        cmd = "SELECT * FROM apps WHERE name = ?"
        r = db.q(cmd, (name, )).fetchall()

        if r == []:
            return 0
        else:
            return r[0]['id']
Exemple #10
0
 def get(cls, key):
     
     cmd = "SELECT * FROM settings WHERE key = ?"
     r = db.q(cmd, (key,)).fetchall()
     if len(r) == 0:
         return False
     
     from types import NoneType
     if type(r[0]) is NoneType:
         return ''
     else:
         return r[0]['value']
Exemple #11
0
    def get(cls, key):

        cmd = "SELECT * FROM settings WHERE key = ?"
        r = db.q(cmd, (key, )).fetchall()
        if len(r) == 0:
            return False

        from types import NoneType
        if type(r[0]) is NoneType:
            return ''
        else:
            return r[0]['value']
Exemple #12
0
 def add_app(cls, name):
     cmd = "INSERT INTO apps (name) VALUES(?)"
     db.q(cmd, (name,))
Exemple #13
0
 def get_apps(cls):
     cmd = "SELECT * FROM apps"
     r = db.q(cmd).fetchall()
     return r
Exemple #14
0
 def set(cls, key, value):
     k = cls.get(key)
     if k or k == '':
         db.q("UPDATE settings SET value = ? WHERE key = ?", (value, key))
     else:
         db.q("INSERT INTO settings VALUES(?,?)", (key, value))
Exemple #15
0
 def set(cls, key, value):   
     k = cls.get(key)    
     if k or k == '':
         db.q("UPDATE settings SET value = ? WHERE key = ?", (value, key))
     else:
         db.q("INSERT INTO settings VALUES(?,?)", (key, value))
Exemple #16
0
 def add_app(cls, name):
     cmd = "INSERT INTO apps (name) VALUES(?)"
     db.q(cmd, (name, ))
Exemple #17
0
 def get_app_gestures(cls, name):
     id_app = gestures._get_id_from_name(name)
     cmd = "SELECT * FROM gestures WHERE id_app = ?"
     return db.q(cmd, (str(id_app)),).fetchall()  
Exemple #18
0
 def get_apps(cls):
    cmd = "SELECT * FROM apps"
    r = db.q(cmd).fetchall()
    return r 
Exemple #19
0
 def delete(cls, key):
             
     cmd = "DELETE FROM settings WHERE key = ?"
     db.q(cmd, (key,))
Exemple #20
0
    def delete(cls, key):

        cmd = "DELETE FROM settings WHERE key = ?"
        db.q(cmd, (key, ))