Example #1
0
def ankiDeckManagerSetup():
    """
    Configure the Ui_Dialog.

    This function starts with collecting the data
    needed to fill the table in the ui, then
    straps it all together and exec it to present
    it to the user.
    """
    if not mw.col.conf.get('pubSupFirstRun', ""):
        createTables()
        ankiPubSubSettings()
        mw.col.conf['pubSupFirstRun'] = "True"
        mw.col.save()
        mw.col.db.commit()
    # create an cell widget

    f = QDialog()
    f.ui = Ui_AnkiPubSubDeckManager()
    f.ui.setupUi(f)

    f.ui.ankiPubSubSettings.clicked.connect(lambda: ankiPubSubSettings())
    f.ui.publishDeck.clicked.connect(partial(publishDeckGui, f))
    drawTable(f)
    f.ui.ankiPubSubAddDeck.clicked.connect(partial(addRemoteDeckButton, f))
    f.exec_()
Example #2
0
    def createDatabase(self):
        productsList = [
            "Pizza bolognesa", "Calzone", "Pizza hawaiana", "Pasta carbonara",
            "Pizza napolitana", "Pasta alfredo", "Pizza mozzarella",
            "Pizza prosciutto", "Arroz Tres Delicias", "Gyozas", "Kebab",
            "Falafel", "Patatas fritas", "Shushi", "Fideos Fritos",
            "Hamburguesa Queso", "Aros de Cebolla", "Tortilla de Patata",
            "Costillas", "Fingers Pollo", "Durum Cordero", "Noodles Pollo",
            "Gazpacho", "Waygu", "Ramen", "Cocido", "Teppanyaki",
            "American Wings", "Rollito primavera", "Tallarines",
            "Ternera Bambu", "Pollo al limon", "Pollo al Curry",
            "Maki de Aguacate", "Croquetas", "Morcilla", "Paella"
        ]

        restaurantsList = [["Yhu Yughae", "china"],
                           ["La Tagliatella", "italiana"],
                           ["La mafia", "italiana"],
                           ["Doner Valdebebas", "turca"],
                           ["Doner Bernabeu", "turca"],
                           ["Korean Style",
                            "coreana"], ["Nyu Jao", "japonesa"],
                           ["Fosters", "americana"], ["Casa Jose", "espaƱola"],
                           ["Mcdonals", "americana"],
                           ["Grill Texas", "americana"],
                           ["Casa Marisa", "espaƱola"],
                           ["Yahi Moen", "coreana"], ["Udon", "japonesa"],
                           ["Yakimi Nei", "china"]]

        #tuplas de idRestaurante, idProducto
        restaurantProductList = [[1, 9], [1, 10], [2, 2],
                                 [2, 4], [3, 2], [3, 5], [4, 11], [4, 12],
                                 [5, 11], [5, 13], [6, 9], [6, 14], [7, 9],
                                 [7, 15], [8, 16], [8, 17], [9, 18], [9, 19],
                                 [10, 13], [10, 16], [11, 17], [11,
                                                                19], [8, 16],
                                 [8, 17], [9, 18], [9, 19], [10, 13], [10, 16],
                                 [12, 35], [12, 36], [12, 37], [12, 26],
                                 [12, 23], [9, 37], [13, 33], [13,
                                                               32], [13, 31],
                                 [13, 30], [6, 27], [6, 24], [14,
                                                              34], [14, 22],
                                 [14, 24], [14, 10], [7, 31], [7, 34], [2, 30],
                                 [2, 10], [2, 6], [3, 30], [4, 21], [5, 21],
                                 [6, 27], [6, 29], [7, 24], [7, 34], [8, 20],
                                 [8, 28], [9, 37], [9, 36], [10, 20], [10, 28],
                                 [11, 28], [11, 20]]

        database.deleteDatabase()
        database.createTables()
        database.insertProducts(productsList)
        database.insertRestaurants(restaurantsList)
        database.insertRestaurantProducts(restaurantProductList)
Example #3
0
def main():
    database.createTables()
    serverSocket.bind(('', AUTHPORT))

    fd = sys.stdin.fileno()
    #signal.signal(signal.SIGALRM, timerHandler)
    #signal.alarm(5)
    print()
    while True:
        try:
            readable, writable, excep = select.select([serverSocket, fd], [],
                                                      [], TIMER)
        except KeyboardInterrupt:
            print("Terminating Auth Server...")
            serverSocket.close()
            sys.exit(0)
        except:
            print("Unknown Exception occurred:")
            continue
        else:
            if fd in readable:
                inputLine = input()
                inputLine = str(inputLine).split(' ')

            if serverSocket in readable:
                data, addr = serverSocket.recvfrom(BUFFER)
                splitedData = data.split(sep)
                EntityName = splitedData[0].decode()
                EntityNameLength = len(EntityName)
                data = data[EntityNameLength + 1:]
                flag = data[0]
                function_pointer[flag](EntityName=EntityName,
                                       data=data,
                                       ip_addr=addr)

        timerHandler()
    log('Removing friend...')

    if not checkAccessToken():
        sublog('Bad access token.')
        return fail('Invalid access token.')
    if not 'friend' in request.json.keys():
        sublog('No friend specified.')
        return fail('No friend specified.')

    thisUser = accessTokenToUser(request.json['accessToken'])
    sublog('Name: ' + thisUser + '\n\tFriend: ' + request.json['friend'])

    con = database.connect()
    c = con.cursor()

    c.execute("DELETE FROM friends WHERE username=:username and friend=:friend",
              {'username': thisUser, 'friend': request.json['friend']})

    database.close(con)

    sublog('Friend removed.')
    return success('Friend removed!')


print("Creating tables if need be...")
database.createTables()

print("API starting...")
bottle.BaseRequest.MEMFILE_MAX = 15000000  # The base64-encoded images can get pretty big; prevent JSON parse from fail.
run(host='kersten.io', port=8888, quiet=True)
Example #5
0
                        self.s = len(m)
                        for j in range(self.s):
                            self.results[j].append(float(m[j].replace(',','.')))
                        self.results[len(m)].append(round((end-start)*1000, 2))
                    line =''
                else:
                    line +=char

        process.stdout.close()
        process.stderr.close()



con = mdb.connect('morini.emn.fr', 'choco-perf', pwd, 'choco-perf')
#con = mdb.connect('localhost', 'testuser', 'test623', 'testdb')
database.createTables(con)
sid = database.openSession(con)

for line in f:
    if line[0] != '#' and line != '\n':
        line = line.rstrip("\n")
        print line
        command = CMD+' -loop '+ str(loop) +' -args "'+line + ' -log QUIET"'
        args = shlex.split(command)

        current  = runit(command, 0, 0)
        current.start()
        current.join()

        #compute(line, current.results, current.s)
#        computeXLS(line, current.results, current.s)
def create_tables():
    db.createTables()