developer-assistant 0.2.5__tar.gz → 0.3.0__tar.gz

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.
Files changed (28) hide show
  1. {developer_assistant-0.2.5/developer_assistant.egg-info → developer_assistant-0.3.0}/PKG-INFO +28 -18
  2. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/PYPI.md +26 -16
  3. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/README.md +30 -17
  4. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/default/default-memory.ini +1 -0
  5. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/default/test-project.ini +3 -1
  6. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/interface.py +156 -94
  7. developer_assistant-0.3.0/da/intro.md +78 -0
  8. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/modules/config_manager.py +65 -33
  9. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/modules/opener.py +2 -5
  10. developer_assistant-0.3.0/da/modules/projects_manager.py +267 -0
  11. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/modules/version_logic.py +90 -43
  12. {developer_assistant-0.2.5 → developer_assistant-0.3.0/developer_assistant.egg-info}/PKG-INFO +28 -18
  13. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/pyproject.toml +2 -2
  14. developer_assistant-0.2.5/da/intro.md +0 -63
  15. developer_assistant-0.2.5/da/modules/projects_manager.py +0 -114
  16. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/LICENSE +0 -0
  17. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/__init__.py +0 -0
  18. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/default/default-changelog.md +0 -0
  19. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/modules/__init__.py +0 -0
  20. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/templates/changelog_template.txt +0 -0
  21. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/templates/entry_template.txt +0 -0
  22. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/da/templates/header_template.txt +0 -0
  23. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/developer_assistant.egg-info/SOURCES.txt +0 -0
  24. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/developer_assistant.egg-info/dependency_links.txt +0 -0
  25. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/developer_assistant.egg-info/entry_points.txt +0 -0
  26. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/developer_assistant.egg-info/requires.txt +0 -0
  27. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/developer_assistant.egg-info/top_level.txt +0 -0
  28. {developer_assistant-0.2.5 → developer_assistant-0.3.0}/setup.cfg +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: developer-assistant
3
- Version: 0.2.5
4
- Summary: A lightweight TUI designed to simplify formatting of Markdown changelogs.
3
+ Version: 0.3.0
4
+ Summary: A lightweight TUI app for managing and simplifying your Markdown changelogs.
5
5
  License: The MIT License (MIT)
6
6
 
7
7
  Copyright (c) 2026 Ivori Huobolainen
@@ -56,14 +56,14 @@ B. **Using pip:** `python -m pip install -U developer-assistant`
56
56
  ## Introduction
57
57
 
58
58
  ### What does this tool do?
59
- Developer Assistant is a lightweight TUI tool for automating and managing your changelogs. You can customize the templates to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
59
+ Developer Assistant is a lightweight TUI app for simplifying and managing your changelogs. You can customize the templates for each profile to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
60
60
 
61
- You can manage as many projects as you like. Each project gets its own `.ini` file, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
61
+ You can create as many profiles as you need. Each profile gets its own **project specific** `.ini` files, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
62
62
 
63
- Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only applied to the real changelog once you confirm them.
63
+ Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only prepended to & replaced with your real changelog once you confirm them.
64
64
 
65
65
 
66
- ### Using the program.
66
+ ## Using the program.
67
67
  1. **What *not* to do**
68
68
 
69
69
  Don't change the folder structure or modify variable names inside `.ini` files.
@@ -78,30 +78,37 @@ Don't change the folder structure or modify variable names inside `.ini` files.
78
78
 
79
79
  * macOS: `~/Library/Application Support/da-ui/`
80
80
 
81
- The `da-ui/` folder will be created automatically.
81
+ The `da-ui/` folder and subfolders will be created automatically.
82
82
 
83
83
  You can access its content quickly when going to: `Main menu / Settings`
84
84
 
85
- - *Customizable templates*
85
+ **Profiles for seperate projects and templates**
86
+
87
+ The program comes with the "Default" profile, you can choose to either stick with this one or create your own profiles in `Main menu / Profiles`. Each profile has seperate projects and they can't be accessed by other profiles. You can choose to customize the templates seperately too.
88
+
89
+ Migrating a project or template from one profile to another is currently manual, **make sure to also change the "*owner*" value in `.ini` files accordingly**.
90
+
91
+ **Customizable templates**
86
92
 
87
93
  In the **local** `Templates/` folder you can modify the template contents to your liking - **just avoid changing the `{{placeholder}}` names**.
88
94
 
89
- - *Linked projects all in one place*
95
+ **Linked projects all in one place**
90
96
 
91
97
  The `Projects/` folder holds the `.ini` files you create when starting a new project with DA.
92
98
 
93
- - *Safe changelog updates*
99
+ **Safe changelog updates**
94
100
 
95
101
  Before applying any changes, your previous `CHANGELOG.md` is automatically backed up into your project folder.
96
- New changes are first written to a temporary file and only applied to the real changelog after you confirm them.
102
+ New changes are first written to a temporary file and only prepended to & replaced with your real changelog once you confirm them.
103
+
97
104
  This ensures your existing changelog is never overwritten or corrupted, and you always have a fallback copy.
98
105
  If the temporary changelog is present on startup you are prompted to remove or keep it.
99
106
 
100
- - *Ease of navigation*
107
+ **Ease of navigation**
101
108
 
102
109
  You can access files/folders and configuration straight from the menus, so you shouldn't find yourself searching through the program's directory or even your local user data very often.
103
110
 
104
- - *Configuration*
111
+ **Configuration**
105
112
 
106
113
  The `memory.ini` file does exactly what you'd expect, it features:
107
114
 
@@ -109,15 +116,18 @@ The `memory.ini` file does exactly what you'd expect, it features:
109
116
 
110
117
  * Pinned projects
111
118
 
119
+ * Active profile
120
+
112
121
  * Custom colour
113
122
 
114
- Last project gets updated automatically, the rest are up to you.
123
+ Last project & active profile get updated automatically, the rest are up to you.
124
+
125
+ **`Ctrl+C` works everywhere to quickly exit DA.**
115
126
 
116
- - *`Ctrl+C` works everywhere to quickly exit DA.*
117
127
 
118
- ### Setting up your first project
119
- For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `4.` to start adjusting this projects paths.
128
+ ### Setting up the test project
129
+ For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `3.` to start adjusting this projects paths. **Before setting up your own profile don't change "*Default*"**
120
130
 
121
- Now make an optional `test-project/` folder with a `CHANGELOG.md` in it anywhere on your system and point the `.ini` file to it.
131
+ The `test-project/` folder is included in the programs root folder **for repo clones** and is safe to experiment with. If you installed from PyPI just make a `CHANGELOG.md` anywhere and point the `.ini` file to it.
122
132
 
123
133
  Once configured, you can create as many changelog entries as you want by picking that project in the menu.
@@ -25,14 +25,14 @@ B. **Using pip:** `python -m pip install -U developer-assistant`
25
25
  ## Introduction
26
26
 
27
27
  ### What does this tool do?
28
- Developer Assistant is a lightweight TUI tool for automating and managing your changelogs. You can customize the templates to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
28
+ Developer Assistant is a lightweight TUI app for simplifying and managing your changelogs. You can customize the templates for each profile to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
29
29
 
30
- You can manage as many projects as you like. Each project gets its own `.ini` file, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
30
+ You can create as many profiles as you need. Each profile gets its own **project specific** `.ini` files, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
31
31
 
32
- Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only applied to the real changelog once you confirm them.
32
+ Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only prepended to & replaced with your real changelog once you confirm them.
33
33
 
34
34
 
35
- ### Using the program.
35
+ ## Using the program.
36
36
  1. **What *not* to do**
37
37
 
38
38
  Don't change the folder structure or modify variable names inside `.ini` files.
@@ -47,30 +47,37 @@ Don't change the folder structure or modify variable names inside `.ini` files.
47
47
 
48
48
  * macOS: `~/Library/Application Support/da-ui/`
49
49
 
50
- The `da-ui/` folder will be created automatically.
50
+ The `da-ui/` folder and subfolders will be created automatically.
51
51
 
52
52
  You can access its content quickly when going to: `Main menu / Settings`
53
53
 
54
- - *Customizable templates*
54
+ **Profiles for seperate projects and templates**
55
+
56
+ The program comes with the "Default" profile, you can choose to either stick with this one or create your own profiles in `Main menu / Profiles`. Each profile has seperate projects and they can't be accessed by other profiles. You can choose to customize the templates seperately too.
57
+
58
+ Migrating a project or template from one profile to another is currently manual, **make sure to also change the "*owner*" value in `.ini` files accordingly**.
59
+
60
+ **Customizable templates**
55
61
 
56
62
  In the **local** `Templates/` folder you can modify the template contents to your liking - **just avoid changing the `{{placeholder}}` names**.
57
63
 
58
- - *Linked projects all in one place*
64
+ **Linked projects all in one place**
59
65
 
60
66
  The `Projects/` folder holds the `.ini` files you create when starting a new project with DA.
61
67
 
62
- - *Safe changelog updates*
68
+ **Safe changelog updates**
63
69
 
64
70
  Before applying any changes, your previous `CHANGELOG.md` is automatically backed up into your project folder.
65
- New changes are first written to a temporary file and only applied to the real changelog after you confirm them.
71
+ New changes are first written to a temporary file and only prepended to & replaced with your real changelog once you confirm them.
72
+
66
73
  This ensures your existing changelog is never overwritten or corrupted, and you always have a fallback copy.
67
74
  If the temporary changelog is present on startup you are prompted to remove or keep it.
68
75
 
69
- - *Ease of navigation*
76
+ **Ease of navigation**
70
77
 
71
78
  You can access files/folders and configuration straight from the menus, so you shouldn't find yourself searching through the program's directory or even your local user data very often.
72
79
 
73
- - *Configuration*
80
+ **Configuration**
74
81
 
75
82
  The `memory.ini` file does exactly what you'd expect, it features:
76
83
 
@@ -78,15 +85,18 @@ The `memory.ini` file does exactly what you'd expect, it features:
78
85
 
79
86
  * Pinned projects
80
87
 
88
+ * Active profile
89
+
81
90
  * Custom colour
82
91
 
83
- Last project gets updated automatically, the rest are up to you.
92
+ Last project & active profile get updated automatically, the rest are up to you.
93
+
94
+ **`Ctrl+C` works everywhere to quickly exit DA.**
84
95
 
85
- - *`Ctrl+C` works everywhere to quickly exit DA.*
86
96
 
87
- ### Setting up your first project
88
- For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `4.` to start adjusting this projects paths.
97
+ ### Setting up the test project
98
+ For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `3.` to start adjusting this projects paths. **Before setting up your own profile don't change "*Default*"**
89
99
 
90
- Now make an optional `test-project/` folder with a `CHANGELOG.md` in it anywhere on your system and point the `.ini` file to it.
100
+ The `test-project/` folder is included in the programs root folder **for repo clones** and is safe to experiment with. If you installed from PyPI just make a `CHANGELOG.md` anywhere and point the `.ini` file to it.
91
101
 
92
102
  Once configured, you can create as many changelog entries as you want by picking that project in the menu.
@@ -1,7 +1,7 @@
1
1
  # Developer Assistant
2
2
  [![PyPI version](https://img.shields.io/pypi/v/developer-assistant?logo=pypi&logoColor=white&color=blue)](https://pypi.org/project/developer-assistant/)
3
3
 
4
- > **A lightweight TUI designed to simplify formatting of Markdown changelogs.**
4
+ > **A lightweight TUI app for managing and simplifying your Markdown changelogs.**
5
5
 
6
6
  * **Setup:** Start with [SETUP](./SETUP.md) to get started.
7
7
 
@@ -9,9 +9,11 @@
9
9
 
10
10
  ---
11
11
 
12
- **Requirements:** Python 3.10 or later.
12
+ * **Requirements:** Python 3.10 or later.
13
13
 
14
- **Cross-platform:** Windows, Linux, macOS(*unverified*)
14
+ * **Cross-platform:** Windows, Linux, macOS(*unverified*)
15
+
16
+ * **Specifics:** [SYSTEM STRUCTURE](./documents/SYSTEM_STRUCTURE.txt)
15
17
 
16
18
 
17
19
  ## Appearance
@@ -28,12 +30,13 @@ Preview your Markdown changelogs directly in the terminal with Rich rendering:
28
30
  ## Introduction
29
31
 
30
32
  ### What does this tool do?
31
- Developer Assistant is a lightweight TUI tool for automating and managing your changelogs. You can customize the templates to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
33
+ Developer Assistant is a lightweight TUI for simplifying and managing your changelogs. You can customize the templates for each profile to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
32
34
 
33
- You can manage as many projects as you like. Each project gets its own `.ini` file, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
35
+ You can create as many profiles as you need. Each profile gets its own **project specific** `.ini` files, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
34
36
 
35
- Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only applied to the real changelog once you confirm them.
37
+ Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only prepended to & replaced with your real changelog once you confirm them.
36
38
 
39
+ ---
37
40
 
38
41
  ### Using the program.
39
42
  1. **What *not* to do**
@@ -50,30 +53,37 @@ Don't change the folder structure or modify variable names inside `.ini` files.
50
53
 
51
54
  * macOS: `~/Library/Application Support/da-ui/`
52
55
 
53
- The `da-ui/` folder will be created automatically.
56
+ The `da-ui/` folder and subfolders will be created automatically.
54
57
 
55
58
  You can access its content quickly when going to: `Main menu / Settings`
56
59
 
57
- - *Customizable templates*
60
+ **Profiles for seperate projects and templates**
61
+
62
+ The program comes with the "Default" profile, you can choose to either stick with this one or create your own profiles in `Main menu / Profiles`. Each profile has seperate projects and they can't be accessed by other profiles. You can choose to customize the templates seperately too.
63
+
64
+ Migrating a project or template from one profile to another is currently manual, **make sure to also change the "*owner*" value in `.ini` files accordingly**.
65
+
66
+ **Customizable templates**
58
67
 
59
68
  In the **local** `Templates/` folder you can modify the template contents to your liking - **just avoid changing the `{{placeholder}}` names**.
60
69
 
61
- - *Linked projects all in one place*
70
+ **Linked projects all in one place**
62
71
 
63
72
  The `Projects/` folder holds the `.ini` files you create when starting a new project with DA.
64
73
 
65
- - *Safe changelog updates*
74
+ **Safe changelog updates**
66
75
 
67
76
  Before applying any changes, your previous `CHANGELOG.md` is automatically backed up into your project folder.
68
- New changes are first written to a temporary file and only applied to the real changelog after you confirm them.
77
+ New changes are first written to a temporary file and only prepended to & replaced with your real changelog once you confirm them.
78
+
69
79
  This ensures your existing changelog is never overwritten or corrupted, and you always have a fallback copy.
70
80
  If the temporary changelog is present on startup you are prompted to remove or keep it.
71
81
 
72
- - *Ease of navigation*
82
+ **Ease of navigation**
73
83
 
74
84
  You can access files/folders and configuration straight from the menus, so you shouldn't find yourself searching through the program's directory or even your local user data very often.
75
85
 
76
- - *Configuration*
86
+ **Configuration**
77
87
 
78
88
  The `memory.ini` file does exactly what you'd expect, it features:
79
89
 
@@ -81,15 +91,18 @@ The `memory.ini` file does exactly what you'd expect, it features:
81
91
 
82
92
  * Pinned projects
83
93
 
94
+ * Active profile
95
+
84
96
  * Custom colour
85
97
 
86
- Last project gets updated automatically, the rest are up to you.
98
+ Last project & active profile get updated automatically, the rest are up to you.
87
99
 
88
- - *`Ctrl+C` works everywhere to quickly exit DA.*
100
+ **`Ctrl+C` works everywhere to quickly exit DA.**
89
101
 
102
+ ---
90
103
 
91
- ### Setting up your first project
92
- For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `4.` to start adjusting this projects paths.
104
+ ### Setting up the test project
105
+ For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `3.` to start adjusting this projects paths. **Before setting up your own profile don't change "*Default*"**
93
106
 
94
107
  The `test-project/` folder is included in the programs root folder **for repo clones** and is safe to experiment with. If you installed from PyPI just make a `CHANGELOG.md` anywhere and point the `.ini` file to it.
95
108
 
@@ -5,5 +5,6 @@ pinned_project1 =
5
5
  pinned_project2 =
6
6
 
7
7
  [CONFIG]
8
+ profile = Default
8
9
  color =
9
10
 
@@ -1,4 +1,6 @@
1
- [SETTINGS]
1
+ [SETTINGS]
2
+ edited =
3
+ owner = Default
2
4
  path = C:\Users\...\Developer-Assistant\test-project
3
5
  changelog = C:\Users\...\Developer-Assistant\test-project\CHANGELOG.md
4
6
  version = 1.0.0
@@ -4,6 +4,7 @@ import platform
4
4
  import subprocess
5
5
  import shutil
6
6
  from pathlib import Path
7
+
7
8
  from termcolor import colored
8
9
  from rich.progress import track
9
10
  from rich.console import Console
@@ -15,8 +16,10 @@ from da.modules.opener import Opener
15
16
  from importlib import resources
16
17
 
17
18
  class Interface:
18
- def __init__(self, color="light_blue"):
19
- self.version = "0.2.5"
19
+ def __init__(self):
20
+ self.version = "0.3.0"
21
+ self.clear = 'cls' if platform.system() == 'Windows' else 'clear'
22
+
20
23
  title = f"DA - {self.version}"
21
24
 
22
25
  if platform.system() == "Windows":
@@ -24,27 +27,36 @@ class Interface:
24
27
  else:
25
28
  print(f'\33]0;{title}\a', end='', flush=True)
26
29
 
27
- self.config = ConfigManager('memory.ini')
30
+ self.config = ConfigManager('memory.ini', profile="Default")
28
31
 
29
- self.first_run = False
30
- if not self.config.memory_ini.exists():
31
- self.local_init()
32
- self.first_run = True
32
+ self.memory = None
33
+ self.color = None
34
+ self.header = None
35
+ self.user_path = None
33
36
 
34
- self.memory = self.config.load_memory()
35
- self.color = self.memory.get('color') or color
36
-
37
- #==Reusables==
38
- self.header = (colored(" Developer Assistant ", f"{self.color}"))
39
- self.clear_screen = 'cls' if platform.system() == 'Windows' else 'clear'
40
- self.user_path = os.environ.get('USERPROFILE') or os.environ.get('HOME', 'User')
37
+ self.first_run = False
41
38
 
42
39
  def run(self):
40
+ steps = [
41
+ ("Initializing runtime...", self.runtime_init),
42
+ ("Checking configuration...", self.config.data_check)
43
+ ]
44
+
45
+ for label, step in track(steps):
46
+ os.system(self.clear)
47
+ print(label.center(65))
48
+ result = step()
49
+ time.sleep(0.30)
50
+ if isinstance(result, list):
51
+ for msg in result:
52
+ print(msg.center(65))
53
+ time.sleep(2)
54
+
43
55
  temp_log = Path(__file__).parent / "CHANGELOG.tmp"
44
56
 
45
57
  if os.path.exists(temp_log):
46
58
  while True:
47
- os.system(self.clear_screen)
59
+ os.system(self.clear)
48
60
  print(colored(f"Temporary changelog detected in:\n{temp_log}\n", "yellow"))
49
61
  print(colored("D", "light_red") + "elete or " + colored("K", "light_red") + "eep?\n")
50
62
  choice = input(f"{self.user_path}> ").lower()
@@ -56,17 +68,6 @@ class Interface:
56
68
  else:
57
69
  print(colored("\nPlease make a valid choice.", "light_red"))
58
70
  time.sleep(1.5)
59
-
60
- os.system(self.clear_screen)
61
- message = (colored("Developer Assistant Ver. ", attrs=["bold"]) + (colored(self.version, f"{self.color}", attrs=["bold"])))
62
- status = (colored("Loading, please wait... ", attrs=["blink"]))
63
-
64
- print(message.center(85))
65
- print("")
66
- print(status.center(73))
67
-
68
- for i in track(range(20)):
69
- time.sleep(0.10)
70
71
 
71
72
  state = "intro" if self.first_run else "menu"
72
73
 
@@ -77,88 +78,57 @@ class Interface:
77
78
 
78
79
  elif state == "menu":
79
80
  result = self.menu()
80
- if result == "exit":
81
+ if result == "profiles":
82
+ self.profiles()
83
+ state = "menu"
84
+
85
+ elif result == "settings":
86
+ self.settings()
87
+ state = "menu"
88
+
89
+ elif result == "exit":
81
90
  state = "exit"
82
91
 
83
92
  def menu(self):
93
+ self.active_profile = self.memory.get('profile')
94
+
95
+ projects_manager = ProjectsManager(
96
+ config=self.config,
97
+ color=self.color,
98
+ header=self.header,
99
+ cls=self.clear,
100
+ user_path=self.user_path
101
+ )
102
+
103
+ last_project = self.memory.get('last_project')
84
104
  while True:
85
- os.system(self.clear_screen)
86
- print("Main menu")
105
+ os.system(self.clear)
106
+ print(colored(f"{self.active_profile}", f"{self.color}") + " / Main menu")
87
107
  print(self.header.center(127, "="))
88
- print("\nE. Exit\n")
89
- print("1. Projects")
90
- print("2. Settings\n")
108
+ print("E. Exit\n")
109
+ print("Last project:")
110
+ print(colored(last_project, f"{self.color}"))
111
+ print("\n1. Projects")
112
+ print("2. Profiles")
113
+ print("3. Settings\n")
91
114
 
92
115
  choice = input(f"{self.user_path}> ").strip()
93
116
 
94
117
  if choice.lower() == "e":
95
- os.system(self.clear_screen)
118
+ os.system(self.clear)
96
119
  print(self.header.center(127, "="))
97
120
  print("Bye!")
98
121
  time.sleep(1)
99
122
  return "exit"
100
123
 
101
124
  elif choice == "1":
102
- self.projects()
103
-
104
- elif choice == "2":
105
- self.settings()
106
- else:
107
- print("")
108
- print(colored("Unknown option...", "light_red", attrs=["blink"]))
109
- time.sleep(1)
110
-
111
- def projects(self):
112
- projects_manager = ProjectsManager(config=self.config)
113
- while True:
114
- self.memory = self.config.load_memory()
115
- os.system(self.clear_screen)
116
- print("Main menu / Projects")
117
- print(self.header.center(127, "="))
118
- print("E. Back\n")
119
- print(colored("1. The last project:", attrs=["underline"]))
120
- print(colored(self.memory.get('last_project'), f"{self.color}"))
121
- print("\n2. Start a new project.\n")
122
- print(colored("Continue a project.", attrs=["underline"]))
123
- print("Pinned:")
124
- print("a. " + colored(self.memory.get('pinned_project'), f"{self.color}"))
125
- print("b. " + colored(self.memory.get('pinned_project1'), f"{self.color}"))
126
- print("c. " + colored(self.memory.get('pinned_project2'), f"{self.color}"))
127
-
128
- print("")
129
- choice = input(f"{self.user_path}> ").strip()
130
-
131
- if choice.lower() == "e":
132
- return
133
-
134
- elif choice == "1":
135
- project = self.memory.get('last_project')
136
- if not project:
137
- print(colored("\nLast project has not been defined...", "light_red", attrs=["blink"]))
138
- time.sleep(2)
139
- else:
140
- projects_manager.load_project(f"{project}")
125
+ projects_manager.projects(self.active_profile)
141
126
 
142
127
  elif choice == "2":
143
- projects_manager.new_project()
144
-
145
- elif choice.lower() in ("a", "b", "c"):
146
- #==If the pinned project is empty, return an error message==
147
- options_map = {
148
- 'a': 'pinned_project',
149
- 'b': 'pinned_project1',
150
- 'c': 'pinned_project2'
151
- }
152
- key = options_map.get(choice.lower())
153
- project_name = self.memory.get(key)
154
- if project_name == "":
155
- print("")
156
- print(colored(f"Project '{choice}' has not been defined...", "light_red", attrs=["blink"]))
157
- time.sleep(2)
158
- else:
159
- project = self.memory.get(key)
160
- projects_manager.load_project(f"{project}")
128
+ return "profiles"
161
129
 
130
+ elif choice == "3":
131
+ return "settings"
162
132
  else:
163
133
  print("")
164
134
  print(colored("Unknown option...", "light_red", attrs=["blink"]))
@@ -166,13 +136,15 @@ class Interface:
166
136
 
167
137
  def settings(self):
168
138
  while True:
169
- os.system(self.clear_screen)
170
- print("Main menu / Settings")
139
+ os.system(self.clear)
140
+ print(colored(f"{self.active_profile}", f"{self.color}") + " / Main menu / Settings")
171
141
  print(self.header.center(127, "="))
172
142
  print("E. Back\n")
143
+
173
144
  print(colored("Configuration options", attrs=["underline"]))
174
145
  print("1. Edit pinned projects [WIP]")
175
146
  print("2. Change program's color [WIP]\n")
147
+
176
148
  print(colored("Other options", attrs=["underline"]))
177
149
  print("3. Open memory.ini manually")
178
150
  print("4. Open the Projects folder")
@@ -197,6 +169,96 @@ class Interface:
197
169
  print(colored("Unknown option...", "light_red", attrs=["blink"]))
198
170
  time.sleep(1)
199
171
 
172
+ def profiles(self):
173
+ while True:
174
+ os.system(self.clear)
175
+ print(colored(f"{self.active_profile}", f"{self.color}") + " / Main menu / Profiles")
176
+ print(self.header.center(127, "="))
177
+ print("E. Back\n")
178
+
179
+ print("1. Create a new profile")
180
+ print("2. Switch profiles\n")
181
+
182
+ choice = input(f"{self.user_path}> ").strip()
183
+
184
+ if choice.lower() == "e":
185
+ return
186
+ elif choice == "1":
187
+ self.new_profile()
188
+ elif choice == "2":
189
+ self.switch_profile()
190
+ else:
191
+ print("")
192
+ print(colored("Unknown option...", "light_red", attrs=["blink"]))
193
+ time.sleep(1)
194
+
195
+ def switch_profile(self):
196
+ while True:
197
+ prof_dir = self.config.profile_dir
198
+ contents = os.listdir(prof_dir)
199
+
200
+ print("\nYour profiles:")
201
+ for item in contents:
202
+ print(colored(f" - {item}", f"{self.color}"))
203
+
204
+ name = input("\nProfile name > ").strip()
205
+
206
+ if name in contents:
207
+ self.config.update_memory("CONFIG", "profile", name)
208
+
209
+ self.memory = self.config.load_memory()
210
+
211
+ profile = self.memory.get('profile')
212
+ self.config = ConfigManager("memory.ini", profile=profile)
213
+
214
+ self.memory = self.config.load_memory()
215
+ self.active_profile = self.memory.get('profile')
216
+ return
217
+ else:
218
+ print(colored("\nInvalid name!", "yellow"))
219
+ time.sleep(1)
220
+ os.system(self.clear)
221
+
222
+ def new_profile(self):
223
+ name = input("\nNew profile name > ").strip()
224
+
225
+ profile_dir = self.config.profile_dir / name
226
+ profile_dir.mkdir(parents=True, exist_ok=True)
227
+
228
+ (profile_dir / "Projects").mkdir(exist_ok=True)
229
+ (profile_dir / "Templates").mkdir(exist_ok=True)
230
+
231
+ default_templates = resources.files("da.templates")
232
+ for item in default_templates.iterdir():
233
+ dest = profile_dir / "Templates"
234
+ shutil.copy(item, dest)
235
+
236
+ self.config.update_memory("CONFIG", "profile", name)
237
+
238
+ self.memory = self.config.load_memory()
239
+
240
+ profile = self.memory.get('profile')
241
+ self.config = ConfigManager("memory.ini", profile=profile)
242
+
243
+ self.memory = self.config.load_memory()
244
+ self.active_profile = self.memory.get('profile')
245
+ return
246
+
247
+ def runtime_init(self):
248
+ if not self.config.memory_ini.exists():
249
+ self.local_init()
250
+ self.first_run = True
251
+
252
+ self.memory = self.config.load_memory()
253
+ active_profile = self.memory.get("profile") or "Default"
254
+
255
+ self.config = ConfigManager("memory.ini", profile=active_profile)
256
+ self.memory = self.config.load_memory()
257
+
258
+ self.color = self.memory.get('color') or "light_blue"
259
+ self.header = (colored(" Developer Assistant ", f"{self.color}"))
260
+ self.user_path = os.environ.get('USERPROFILE') or os.environ.get('HOME', 'User')
261
+
200
262
  def local_init(self):
201
263
  default_files = resources.files("da.default")
202
264
  dest = self.config.memory_ini
@@ -213,7 +275,7 @@ class Interface:
213
275
  shutil.copy(item, dest)
214
276
 
215
277
  def intro(self):
216
- os.system(self.clear_screen)
278
+ os.system(self.clear)
217
279
  print(colored("Welcome to the Developer Assistant\n", f"{self.color}", attrs=["bold"]))
218
280
  print("Here's everything you need to get started...\n")
219
281
 
@@ -233,7 +295,7 @@ def main():
233
295
  app = Interface()
234
296
  app.run()
235
297
  except KeyboardInterrupt:
236
- print("\n\n" + colored("Execution interrupted. Exiting...", "magenta", attrs=["bold"]))
298
+ print("\n\n" + colored("Execution interrupted. Exiting...", "cyan", attrs=["bold"]))
237
299
  time.sleep(1)
238
300
  sys.exit(0)
239
301