Skip to content

Commit

Permalink
Added feature to show/hide cmd when running scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulShagri committed Mar 28, 2021
1 parent 63c8fab commit ec9a09d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions DatabaseHandlerAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ def create_table(name: str):
script_path text,
venv text,
venv_path text,
cmd text,
thumbnail_path text)""")

conn.commit()
conn.close()

def add_script(table: str, script_name: str, script_path: str, thumbnail_path="icons/default_thumbnail.jpg", venv=str, venv_path=""):
def add_script(table: str, script_name: str, script_path: str, thumbnail_path="icons/default_thumbnail.jpg", venv=str, venv_path="", cmd=""):
conn = sqlite3.connect("_temp_.db")
c = conn.cursor()

c.execute(f"""INSERT INTO \"{table}\" (script_name, script_path, venv, venv_path, thumbnail_path)
VALUES (?, ?, ?, ?, ?)""", (script_name, script_path, venv, venv_path, thumbnail_path))
c.execute(f"""INSERT INTO \"{table}\" (script_name, script_path, venv, venv_path, thumbnail_path, cmd)
VALUES (?, ?, ?, ?, ?, ?)""", (script_name, script_path, venv, venv_path, thumbnail_path, cmd))

conn.commit()
conn.close()
Expand All @@ -55,7 +56,7 @@ def read_to_run_script(table: str, script_name: str):
conn = sqlite3.connect("_temp_.db")
c = conn.cursor()

c.execute(f"SELECT script_path, venv, venv_path FROM \"{table}\" WHERE script_name=\"{script_name}\"")
c.execute(f"SELECT script_path, venv, venv_path, cmd FROM \"{table}\" WHERE script_name=\"{script_name}\"")
script_info = c.fetchone()

conn.commit()
Expand All @@ -67,7 +68,7 @@ def read_to_run_all_scripts(table: str):
conn = sqlite3.connect("_temp_.db")
c = conn.cursor()

c.execute(f"SELECT script_path, venv, venv_path FROM \"{table}\"")
c.execute(f"SELECT script_path, venv, venv_path, cmd FROM \"{table}\"")
script_info = c.fetchall()

conn.commit()
Expand Down

0 comments on commit ec9a09d

Please sign in to comment.