wp-quickstart-installer/step02_5.py
google-labs-jules[bot] 118771021e Implement specific setups feature
- Added a new step (Step02_5) for users to select a WordPress setup type (e.g., Elementor, Blog, All Items).
- Modified Step03 to dynamically display plugins and themes based on the chosen setup.
- Updated APP_CONFIG (defined in step03.py) to store setup configurations, including plugin/theme details (id, name, icon, path).
- Changed selections.json to store a list of dictionaries for selected items, providing richer data (including paths) for the installation process.
- Updated Step05 to correctly parse the new selections.json structure and use item names for downloading.
- Adjusted navigation in SetupApp.py, step02.py, and step03.py to accommodate the new flow.
2025-06-22 17:31:27 +00:00

96 lines
4.5 KiB
Python

import tkinter as tk
from tkinter import ttk
# Placeholder for APP_CONFIG - This should eventually be imported from a central location (e.g., app_data.py or SetupApp.py)
APP_CONFIG = {
"setups": {
"elementor_focus": {
"name": "Elementor Website",
"description": "Ideal for building rich, visual websites with Elementor page builder."
},
"blogging_setup": {
"name": "Just a Blog Setup",
"description": "Perfect for starting a blog with essential SEO and writing tools."
},
"all_items": {
"name": "All Items (Manual Selection)",
"description": "Choose from all available plugins and themes."
}
# Actual plugin/theme lists are omitted here but would be in the full APP_CONFIG
}
}
class Step02_5(tk.Frame):
def __init__(self, parent, controller):
super().__init__(parent)
self.controller = controller
self.configure(bg="#f4f4f4")
# Title
title_label = tk.Label(self, text="Choose Your WordPress Setup", font=("Arial", 18, "bold"), bg="#f4f4f4")
title_label.pack(pady=(20, 10))
# Description
desc_label = tk.Label(self, text="Select a setup type to get a curated list of plugins and themes, or choose 'All Items' for manual selection.",
font=("Arial", 10), bg="#f4f4f4", wraplength=400)
desc_label.pack(pady=(0, 20))
self.selected_setup_key = tk.StringVar(value="all_items") # Default selection
setups_frame = tk.Frame(self, bg="#f4f4f4")
setups_frame.pack(pady=10, padx=20, fill="x")
for key, setup_details in APP_CONFIG["setups"].items():
rb_frame = tk.Frame(setups_frame, bg="#f4f4f4")
rb_frame.pack(fill="x", pady=5)
rb = ttk.Radiobutton(rb_frame, text=setup_details["name"], variable=self.selected_setup_key, value=key,
command=lambda k=key: self.on_setup_selected(k))
rb.pack(side=tk.LEFT, anchor="w")
desc = tk.Label(rb_frame, text=setup_details["description"], font=("Arial", 9), bg="#f4f4f4", fg="gray", justify=tk.LEFT, wraplength=350)
desc.pack(side=tk.LEFT, anchor="w", padx=(5,0))
# Initial selection feedback (optional, could be a dedicated label)
self.feedback_label = tk.Label(self, text="", font=("Arial", 9), bg="#f4f4f4")
self.feedback_label.pack(pady=(5,5))
# self.on_setup_selected(self.selected_setup_key.get()) # To show initial description if needed
# Button frame
button_frame = tk.Frame(self, bg="#f4f4f4")
button_frame.pack(expand=True, pady=20, side=tk.BOTTOM)
prev_button = ttk.Button(button_frame, text="< Prev", command=self.prev_window)
prev_button.grid(row=0, column=0, padx=10)
next_button = ttk.Button(button_frame, text="> Next", command=self.next_window)
next_button.grid(row=0, column=1, padx=10)
def on_setup_selected(self, key):
# Optional: Provide feedback or update a description panel when a radio button is clicked
# For now, the selection is stored in self.selected_setup_key
# self.feedback_label.config(text=f"Selected: {APP_CONFIG['setups'][key]['name']}")
pass
def prev_window(self):
self.controller.show_frame("Step02") # Assuming Step02 is FTP details
def next_window(self):
# Store the selected setup key in the controller or a shared data object
# This allows Step03 to know which setup to load
self.controller.shared_data["selected_setup_key"] = self.selected_setup_key.get()
print(f"Selected setup key: {self.controller.shared_data['selected_setup_key']}") # For debugging
self.controller.show_frame("Step03")
def on_show_frame(self):
# Called when the frame is shown
# If you need to reset or update anything when this frame becomes visible
# For instance, if APP_CONFIG could change dynamically (not the case here)
# Or to set a default selection if not already set
if not self.controller.shared_data.get("selected_setup_key"):
self.selected_setup_key.set("all_items") # Default if nothing was previously selected
else:
# If returning to this page, keep the previous selection
self.selected_setup_key.set(self.controller.shared_data["selected_setup_key"])
# self.on_setup_selected(self.selected_setup_key.get()) # Update feedback if any
pass