CTKFileDialog-plus 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ """
2
+ This module is part of the CTkFileDialog library.
3
+
4
+ It defines system path constants that point to useful directories such as the
5
+ user's home, config, cache, and data folders, as well as the system PATH and temp directory.
6
+
7
+ These constants follow the XDG Base Directory Specification where possible,
8
+ and serve as a utility for file dialogs and other filesystem operations within the library.
9
+
10
+ Available constants:
11
+
12
+ - PWD: Current working directory where the program was launched.
13
+ - HOME: User's home directory.
14
+ - TEMP: Temporary directory, resolved from common environment variables or defaulting to /tmp.
15
+ - CONFIG_DIR: XDG-compliant user configuration directory (e.g., ~/.config).
16
+ - CACHE_DIR: XDG-compliant user cache directory (e.g., ~/.cache).
17
+ - DATA_DIR: XDG-compliant user data directory (e.g., ~/.local/share).
18
+ - PATH: List of directories in the system PATH environment variable.
19
+ - VENV: Path to the active Python virtual environment (VIRTUAL_ENV or CONDA_PREFIX).
20
+
21
+ Author: Flick
22
+ Repository: https://github.com/FlickGMD/CTkFileDialog
23
+ """
24
+
25
+ from .constants import PWD, HOME, PATH, TEMP, CONFIG_DIR, CACHE_DIR, DATA_DIR, VENV, PATHS
26
+
27
+ __all__ = [
28
+ 'PWD',
29
+ 'HOME',
30
+ 'PATH',
31
+ 'TEMP',
32
+ 'CACHE_DIR',
33
+ 'CONFIG_DIR',
34
+ 'DATA_DIR',
35
+ 'VENV',
36
+ 'PATHS',
37
+ ]
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env python
2
+ from pathlib import Path
3
+ import os
4
+
5
+ # Current working directory (e.g., where the program was launched)
6
+ PWD = str(Path.cwd())
7
+
8
+ # User's home directory (e.g., /home/user or C:\Users\user)
9
+ HOME = str(Path.home())
10
+
11
+ # System PATH split into a list of directories
12
+ PATH = os.getenv('PATH').split(os.pathsep)
13
+
14
+ # Temporary directory (fallback to /tmp if no env vars are set)
15
+ TEMP = os.getenv('TMPDIR') or os.getenv('TEMP') or os.getenv('TMP')
16
+
17
+ # XDG-compliant user configuration directory (default: ~/.config)
18
+ CONFIG_DIR = os.getenv('XDG_CONFIG_HOME', str(Path(HOME) / '.config'))
19
+
20
+ # XDG-compliant user cache directory (default: ~/.cache)
21
+ CACHE_DIR = os.getenv('XDG_CACHE_HOME', str(Path(HOME) / '.cache'))
22
+
23
+ # XDG-compliant user data directory (default: ~/.local/share)
24
+ DATA_DIR = os.getenv('XDG_DATA_HOME', str(Path(HOME) / '.local' / 'share'))
25
+
26
+ # Active Python virtual environment (venv or conda), fallback to PWD
27
+ VENV = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") or PWD
28
+
29
+ # All paths in a single dictionary for easy access
30
+ PATHS = {
31
+ "HOME": HOME,
32
+ "PWD": PWD,
33
+ "TEMP": TEMP,
34
+ "CONFIG_DIR": CONFIG_DIR,
35
+ "DATA_DIR": DATA_DIR,
36
+ "CACHE_DIR": CACHE_DIR,
37
+ "PATH": PATH,
38
+ 'VENV': VENV
39
+ }