This repository has been archived by the owner on Feb 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81f4568
commit 1c767e6
Showing
1 changed file
with
3 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,3 @@ | ||
"""__init__ of the tktermwidget package""" | ||
from json import dump | ||
from pathlib import Path | ||
|
||
from platformdirs import user_cache_dir | ||
|
||
from .style import * # noqa: F401, F403 | ||
from .widgets import Terminal # noqa: F401 | ||
|
||
# Get the package path | ||
PACKAGE_PATH = Path(user_cache_dir("tktermwidget")) | ||
# Get the history file | ||
HISTORY_FILE = PACKAGE_PATH / "history.txt" | ||
# Get the json file (style) | ||
JSON_FILE = PACKAGE_PATH / "styles.json" | ||
|
||
if not PACKAGE_PATH.exists(): # Check the "tktermwidget" is exsit | ||
PACKAGE_PATH.mkdir(parents=True) | ||
# Also create the history file | ||
with open(HISTORY_FILE, "w", encoding="utf-8") as f: | ||
f.close() | ||
# Also create the json file | ||
with open(JSON_FILE, "w", encoding="utf-8") as f: | ||
dump("{}", f) | ||
|
||
# Check that the history file exists | ||
if not (HISTORY_FILE).exists(): | ||
with open(HISTORY_FILE, "w", encoding="utf-8") as f: | ||
f.close() | ||
|
||
# Check that the json file exists | ||
if not (JSON_FILE).exists(): | ||
with open(JSON_FILE, "w", encoding="utf-8") as f: | ||
dump("{}", f) | ||
"""Tktermwidget package""" | ||
from .style import * # noqa: F401 | ||
from .tkterm import Terminal # noqa: F401 |