set the initial directory of executing python scripts to HOME_PATH/scripts

This commit is contained in:
Huy Pham 2020-03-02 14:08:11 -08:00
parent dfc24e107f
commit ea341cbe45
2 changed files with 4 additions and 1 deletions

View file

@ -16,6 +16,7 @@ MOBILITY_PATH = HOME_PATH.joinpath("mobility")
XMLS_PATH = HOME_PATH.joinpath("xmls")
CONFIG_PATH = HOME_PATH.joinpath("gui.yaml")
LOG_PATH = HOME_PATH.joinpath("gui.log")
SCRIPT_PATH = HOME_PATH.joinpath("scripts")
# local paths
DATA_PATH = Path(__file__).parent.joinpath("data")
@ -60,6 +61,7 @@ def check_directory():
ICONS_PATH.mkdir()
MOBILITY_PATH.mkdir()
XMLS_PATH.mkdir()
SCRIPT_PATH.mkdir()
copy_files(LOCAL_ICONS_PATH, ICONS_PATH)
copy_files(LOCAL_BACKGROUND_PATH, BACKGROUNDS_PATH)

View file

@ -2,6 +2,7 @@ import logging
import tkinter as tk
from tkinter import filedialog, ttk
from core.gui.appconfig import SCRIPT_PATH
from core.gui.dialogs.dialog import Dialog
from core.gui.themes import FRAME_PAD, PADX
@ -68,7 +69,7 @@ class ExecutePythonDialog(Dialog):
def select_file(self):
file = filedialog.askopenfilename(
parent=self.top,
initialdir="/",
initialdir=str(SCRIPT_PATH),
title="Open python script",
filetypes=((".py Files", "*.py"), ("All Files", "*")),
)