Esempio n. 1
0
    def __init__(self):
        wx.Frame.__init__(self, None , -1, "Running...", size=(390, 240))
        
        MenuBar = wx.MenuBar()
        
        FileMenu = wx.Menu()
        self.menu_cancel = FileMenu.Append(wx.ID_EXIT, text = "&Cancel")
        MenuBar.Append(FileMenu, "&File")

        self.SetMenuBar(MenuBar)
        
        panel = wx.Panel(self, -1)

        font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
        font.SetPointSize(9)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.Add((-1, 10))
        
        self.threadlabels = []
        for i in range(db.config('max_threads')):
            label1 = wx.StaticText(panel, -1, 'Thread %d' % i)
            label2 = wx.StaticText(panel, -1, 'Starting Thread...')
            self.threadlabels.append((label1, label2))
            vbox.Add(label1, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
            vbox.Add(label2, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
        
        hbox5 = wx.BoxSizer(wx.HORIZONTAL)
        self.button_cancel = wx.Button(panel, -1, 'Cancel', size=(70, 30))
        hbox5.Add(self.button_cancel, 0, wx.LEFT | wx.BOTTOM , 5)
        vbox.Add(hbox5, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)

        panel.SetSizer(vbox)
Esempio n. 2
0
def get_cursor():
    c = db.config()
    conn = pymysql.connect(host=c['host'],
                           port=c['port'],
                           user=c['user'],
                           password=c['password'],
                           charset=c['charset'],
                           database=c['database'])
    cursor = conn.cursor()
    return cursor, conn
Esempio n. 3
0
def main():
    conn = psycopg2.connect(**db.config())
    read = conn.cursor()
    read.execute('select season, episode, string_agg(text, \' \') from scene_text group by season, episode order by season, episode')
    row = read.fetchone()

    while row is not None:
        text = row[2]
        text_standard = textstat.text_standard(text, True)
        print(row[0], row[1], text_standard)
        row = read.fetchone()
Esempio n. 4
0
def main():
    conn = psycopg2.connect(**db.config())
    read = conn.cursor()
    read.execute('select * from all_lines_by_char where char_name in (select char_name from total_lines_by_char limit 25)')
    row = read.fetchone()

    while row is not None:
        text = row[1]
        text_standard = textstat.text_standard(text, True)
        print(row[0], text_standard)
        row = read.fetchone()
Esempio n. 5
0
def conf():
	c = db.config.query.first()
	if c:
		return c
	else:
		defaults = {
				'start': mkdt('08:00', datetime.today().date()),
				'wfact': 1.3,
				'naith': 1.0,
				'figs' : 6,
				'ver'  : __version__ }
		return db.config(**defaults)
Esempio n. 6
0
def login():
    # recupera os parametro
    param_nome = request.form.get('nome')
    param_senha = request.form.get('senha')

    # configurar o db
    config(faculdade)

    # obtendo a conexao e o cursor
    conn, cursor = connect(mysql)

    # validar o usuario
    usuario_existe, idusuario = usuario.validar_usuario(
        cursor, param_nome, param_senha)

    if usuario_existe:
        return render_template('principal.html',
                               nome=param_nome,
                               idusuario=idusuario)
    else:
        return 'Usuario invalido'
Esempio n. 7
0
def main():
    conn = psycopg2.connect(**db.config())
    read = conn.cursor()
    read.execute(
        'select season, episode, string_agg(text, \' \') from scene_text group by season, episode order by season, episode'
    )
    row = read.fetchone()

    while row is not None:
        text = row[2]
        text_standard = textstat.text_standard(text, True)
        print(row[0], row[1], text_standard)
        row = read.fetchone()
Esempio n. 8
0
def listar_turmas():
    # recuperar os parametros
    id = request.args.get('id')

    # configurar o db
    config(faculdade)

    # obtendo a conexao e o cursor
    conn, cursor = connect(mysql)

    # executar o sql
    cursor.execute(
        f'SELECT d.nomedisciplina, d.cursodisciplina, t.nometurma, t.diaturma from disciplina d, turma t, usuario u where u.idusuario = {id} and t.idusuario = u.idusuario and d.iddisciplina = t.iddisciplina'
    )

    #retorno do select
    turmas = cursor.fetchall()

    #fechar o cursor
    cursor.close()

    return render_template('turmas.html', id=id, turmas=turmas)
Esempio n. 9
0
    def Run(self, cmd):
        """Sets up the Running view and starts threads"""
        self.view_running = view.Running()
        self.view_running.Bind(wx.EVT_CLOSE, self.OnCancel)
        self.view_running.Bind(wx.EVT_MENU, self.OnCancel, self.view_main.menu_exit)
        self.view_running.button_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
        self.view_main.Enable(False)
        self.view_running.Show()

        self.tracklist = getselected()

        for i in range(db.config("max_threads")):
            thread = Worker(i, self, cmd)
            self.threads.append(thread)
            thread.start()
Esempio n. 10
0
def fix(track, callback):
    """Looks up the track and fixes it if possible, calling the callback with status updates"""
    callback("Fixing %(artist)s - $(name)s (%(duration)d):" % track)
    candidates = TrackTrie()
    for permutation in _PermutationGenerator(track.lookupInfo):
        for candidate in itms.search(permutation):
            if abs(candidate["duration"] - track["duration"]) <= db.config('max_song_delta'):
                callback("found candidate: %(artist)s - $(name)s (%(duration)d)" % track)
                candidates.add(candidate)
            else:
                callback("found candidate: %(artist)s - $(name)s (%(duration)d), rejected due to time mismatch" % track)
                pass
        if len(candidates) != 0: break
    if len(candidates) == 0: 
        callback("No suitable candidates found")
        return
    best = candidates.pick(track)
    callback("Picked best: %(artist)s - $(name)s (%(duration)d)" % best)
    db.store(track)
    track.replace(best)
    track.save()
Esempio n. 11
0
import hororscope_pandas as h
import scrapeAstrologyCom_pandas as a
import Dinoalchemy as dino
import pandas as pd
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy import engine_from_config
import db as db
import psycopg2
from configparser import ConfigParser
from psycopg2 import sql

config = db.config()

engine = dino.connect_engine(config)

#testScope.to_sql('testing', engine, if_exists='append', index_label='id')

text = h.pdScopes['scope']

print(text)

todays_scopes = pd.concat([h.horoscopecom, a.astrologyCom], ignore_index=True)

print(todays_scopes)
print(todays_scopes['scope'].dtypes)

todays_scopes.to_sql('staging',
                     engine,
                     if_exists='append',
                     index_label='staging_id')