def update_win_loss(): day = core.get_value("Day##WinLoss") week = core.get_value("Week##WinLoss") data = (day, week) print('update') print(data) sqlite3db.TExecSql( DBNAME, """ UPDATE CFG_WIN_LOSS SET Day = ? , Week = ? """, data)
def save_font(): logging.info("Start save_font") font_family = core.get_value("Font Family##Web") font_size = core.get_value("##BrowserTextSize") bg_image = core.get_value("##BgImage") upd = font_size, font_family, bg_image iRv = config_functions.check_if_config_entry_exists(""" SELECT COUNT(*) FROM WEB_PARAMETERS """) if iRv > 0: sqlite3db.TExecSql(DBNAME, """ UPDATE WEB_PARAMETERS SET FONT_SIZE = ?, FONT_FAMILY = ?, BG_IMAGE = ? """, upd) else: sqlite3db.TExecSql(DBNAME, """ INSERT INTO WEB_PARAMETERS VALUES (?,?,?)""", upd)
def save_web(): """ """ web_only = core.get_value("Open in Browser Only##Browser") web_app = core.get_value("Open in Browser and App##Browser") web_update = web_only, web_app sqlite3db.TExecSql(DBNAME, """ UPDATE CFG_WEB SET WEB_ONLY = ?, WEB_APP = ? """, web_update)
def save_scale(): """ Saving the COL_List into the Database if there is already a entry into the database the entry will be updated """ iRv = config_functions.check_if_config_entry_exists(""" SELECT COUNT(*) FROM CFG_SCALE """) scale = core.get_global_font_scale() if iRv > 0: sqlite3db.TExecSql( DBNAME, """ UPDATE CFG_SCALE SET Scale = ? """, scale) else: sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_SCALE VALUES (?) """, scale) animation_config_color()
def save_refresh_time(): """ Saving the COL_List into the Database if there is already a entry into the database the entry will be updated """ refresh = core.get_value("##RefreshTime") if int(refresh) < 5: animation_config_color() set_error("Refresh time can not be ") sqlite3db.TExecSql(DBNAME, """ UPDATE CFG_REFRESH SET REFRESH = ? """, refresh) animation_config_color()
def refresh_symbol(): sign = core.get_value("Refresh Symbol##RefreshTime") sqlite3db.TExecSql(DBNAME, """ UPDATE CFG_REFRESH_SIGN SET REFRESH_SIGN = ? """, str(sign))
def startup(): """ Get all data from the Database. If no Database entry exists, set everything on default. """ logging.info("Get startup values") acEloGoal = config_functions.get_elo_goal_from_db() iRv = config_functions.check_if_dbfile_exists() FACEIT_List = [] MATCH_List = [] nameFACEIT = "" if iRv > 0: iRv = config_functions.check_if_config_entry_exists(""" SELECT COUNT(*) FROM CFG_REFRESH """) if iRv <= 0: sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_REFRESH VALUES (?) """, 60) iRv = config_functions.check_if_config_entry_exists(""" SELECT COUNT(*) FROM CFG_REFRESH_SIGN """) if iRv <= 0: sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_REFRESH_SIGN VALUES (?) """, "True") iRv = config_functions.check_if_config_entry_exists(""" SELECT COUNT(*) FROM CFG_WEB """) if iRv <= 0: ins = 'False', 'False' sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_WEB VALUES (?,?) """, ins) iRv = config_functions.check_if_config_entry_exists(""" SELECT COUNT(*) FROM CFG_WIN_LOSS """) if iRv <= 0: Initial_Load = (False, False) sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_WIN_LOSS VALUES (?, ?) """, Initial_Load) iRv = config_functions.check_if_config_entry_exists(""" SELECT COUNT(*) FROM CFG_STATS_FACEIT """) if iRv > 0: list_faceit = sqlite3db.TExecSqlReadMany( DBNAME, """ SELECT * FROM CFG_STATS_FACEIT """) list_matches = sqlite3db.TExecSqlReadMany( DBNAME, """ SELECT * FROM CFG_STATS_MATCH """) nameFACEIT = config_functions.get_faceit_name_from_db() for i in list_faceit[0]: if i == str(0): FACEIT_List.append(False) else: FACEIT_List.append(True) for i in list_matches[0]: if i == str(0): MATCH_List.append(False) else: MATCH_List.append(True) return FACEIT_List, MATCH_List, nameFACEIT, acEloGoal else: for x in range(0, 6): FACEIT_List.append(True) for x in range(0, 7): MATCH_List.append(True) return FACEIT_List, MATCH_List, nameFACEIT, acEloGoal else: for x in range(0, 6): FACEIT_List.append(True) for x in range(0, 7): MATCH_List.append(True) return FACEIT_List, MATCH_List, nameFACEIT, acEloGoal
def save_data(): """ Save all configuration into the database. if a database already exists update the current one. get and set the FACEIT name. if the Name isn't correct set error """ global iChanges iRv = config_functions.check_if_config_entry_exists(""" SELECT COUNT(*) FROM CFG_STATS_FACEIT """) FACEIT_List, MATCH_List, acName = get_values_to_safe_faceit() name = config_functions.get_faceit_name_from_db() acEloGoal = core.get_value("##EloGoal") if not acName: set_error("Faceit Name must be set!") return if name: name = functions.listToStringWithoutBracketsAndAT(name[0]) if name != acName and acName: sqlite3db.TExecSql( DBNAME, """ DELETE FROM CFG_FACEIT_NAME""") sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_FACEIT_NAME VALUES (? )""", acName) if iRv == 1: sqlite3db.TExecSql( DBNAME, """ UPDATE CFG_STATS_FACEIT SET CurrentElo = ?, Rank = ?, EloToday = ?, WinStreak = ?, TotalMatches = ?, MatchesWon = ? """, FACEIT_List) sqlite3db.TExecSql( DBNAME, """ UPDATE CFG_STATS_MATCH SET Score = ?, Result = ?, Map = ?, KD = ?, EloDiff = ?, Kills = ?, Death = ? """, MATCH_List) sqlite3db.TExecSql( DBNAME, """ UPDATE CFG_FACEIT_NAME SET Name = ? """, acName) else: sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_STATS_FACEIT VALUES (?, ?, ?, ?, ?, ?)""", FACEIT_List) sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_STATS_MATCH VALUES (?, ?, ?, ?, ?, ?, ?)""", MATCH_List) if acName: sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_FACEIT_NAME VALUES (? )""", acName) if acEloGoal: iRv = sqlite3db.TExecSqlReadCount( DBNAME, """ SELECT COUNT(*) FROM CFG_FACEIT_TARGET_ELO """) if iRv > 0: sqlite3db.TExecSql( DBNAME, """ UPDATE CFG_FACEIT_TARGET_ELO SET TARGET = ? """, int(acEloGoal)) else: sqlite3db.TExecSql( DBNAME, """ INSERT INTO CFG_FACEIT_TARGET_ELO VALUES (? )""", acEloGoal) else: sqlite3db.TExecSql( DBNAME, """ DELETE FROM CFG_FACEIT_TARGET_ELO""") delete_error() COL_List = config_functions.get_color() core.set_item_color("Apply Configuration", mvGuiCol_Text, (COL_List[1][1], COL_List[1][2], COL_List[1][3], 255)) iRv = faceit_api.get_api_user(acName) if iRv is None: set_error("Error: Wrong FACEIT Name") iChanges = 0