Skip to content

Commit 11c249b

Browse files
codewizdaveclaude
andcommitted
feat(gui): add project creation and open dialogs
Add complete project management functionality to the GUI, allowing users to create and open projects without using the CLI. Changes: - Add NewProjectDialog widget for creating new projects - Add OpenProjectDialog widget for opening existing projects - Update HomeView with "+ New" and "Open..." buttons - Replace single "Browse" button with dedicated project buttons - Add validation for project names and directories - Integrate with existing StateManager for project tracking This makes the Warehouse-GUI.exe truly standalone - users can now manage projects entirely through the GUI without needing the CLI or pip installation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent de46b6d commit 11c249b

3 files changed

Lines changed: 459 additions & 17 deletions

File tree

src/wareflow_analysis/gui/views/home_view.py

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,29 @@ def _build_project_info(self) -> None:
104104
)
105105
self.project_path_label.grid(row=0, column=1, sticky="w")
106106

107+
# Buttons frame
108+
button_frame = ctk.CTkFrame(frame, fg_color="transparent")
109+
button_frame.grid(row=0, column=2, padx=(10, 0))
110+
111+
# New project button
112+
new_btn = ctk.CTkButton(
113+
button_frame,
114+
text="+ New",
115+
width=80,
116+
fg_color="green",
117+
hover_color="darkgreen",
118+
command=self._on_new_project
119+
)
120+
new_btn.grid(row=0, column=0, padx=2)
121+
107122
# Browse button
108123
browse_btn = ctk.CTkButton(
109-
frame,
110-
text="Browse...",
111-
width=100,
112-
command=self._on_browse_project
124+
button_frame,
125+
text="Open...",
126+
width=80,
127+
command=self._on_open_project
113128
)
114-
browse_btn.grid(row=0, column=2, padx=(10, 0))
129+
browse_btn.grid(row=0, column=1, padx=2)
115130

116131
def _build_database_stats(self) -> None:
117132
"""Build the database statistics section."""
@@ -189,19 +204,49 @@ def _build_activity_log(self) -> None:
189204
self.activity_text.pack(padx=15, pady=(0, 15), fill="both", expand=True)
190205
self.activity_text.configure(state="disabled")
191206

192-
def _on_browse_project(self) -> None:
193-
"""Handle browse project button click."""
194-
from tkinter import filedialog
207+
def _on_new_project(self) -> None:
208+
"""Handle new project button click."""
209+
from wareflow_analysis.gui.widgets.project_dialog import NewProjectDialog
195210

196-
path = filedialog.askdirectory(title="Select Wareflow Project Directory")
211+
NewProjectDialog(
212+
self,
213+
on_project_created=self._on_project_created
214+
)
197215

198-
if path:
199-
success = self.state_manager.set_project_dir(Path(path))
200-
if success:
201-
self._refresh_display()
202-
self._log("Project loaded successfully")
203-
else:
204-
self._log("Error: Not a valid Wareflow project (config.yaml not found)")
216+
def _on_open_project(self) -> None:
217+
"""Handle open project button click."""
218+
from wareflow_analysis.gui.widgets.project_dialog import OpenProjectDialog
219+
220+
OpenProjectDialog(
221+
self,
222+
on_project_opened=self._on_project_opened
223+
)
224+
225+
def _on_project_created(self, project_path: Path) -> None:
226+
"""Handle project creation callback.
227+
228+
Args:
229+
project_path: Path to the created project
230+
"""
231+
success = self.state_manager.set_project_dir(project_path)
232+
if success:
233+
self._refresh_display()
234+
self._log(f"Project created: {project_path.name}")
235+
else:
236+
self._log("Error: Failed to load newly created project")
237+
238+
def _on_project_opened(self, project_path: Path) -> None:
239+
"""Handle project opened callback.
240+
241+
Args:
242+
project_path: Path to the opened project
243+
"""
244+
success = self.state_manager.set_project_dir(project_path)
245+
if success:
246+
self._refresh_display()
247+
self._log(f"Project opened: {project_path.name}")
248+
else:
249+
self._log("Error: Failed to load project")
205250

206251
def _on_action(self, action: str) -> None:
207252
"""Handle action button click.

src/wareflow_analysis/gui/widgets/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,14 @@
44
ThreadedOperation,
55
run_in_thread,
66
)
7+
from wareflow_analysis.gui.widgets.project_dialog import (
8+
NewProjectDialog,
9+
OpenProjectDialog,
10+
)
711

8-
__all__ = ["ThreadedOperation", "run_in_thread"]
12+
__all__ = [
13+
"ThreadedOperation",
14+
"run_in_thread",
15+
"NewProjectDialog",
16+
"OpenProjectDialog",
17+
]

0 commit comments

Comments
 (0)