Untitled

 avatar
unknown
plain_text
5 months ago
5.0 kB
3
Indexable
def create_menu_content(self):
    root = self.winfo_toplevel()
    current_language = root.LANGUAGE
    
    # Title
    title = ctk.CTkLabel(
        self.scrollable_frame,
        text=TRANSLATIONS[current_language]['settings'],
        font=("Dongle", 24, "bold"),
        text_color='white' if self.dark_mode else 'black'
    )
    title.pack(pady=(20, 20), padx=20, anchor='w')
    
    self.create_separator(self.scrollable_frame)
    
    # Appearance section
    self.create_section_title(
        self.scrollable_frame,
        TRANSLATIONS[current_language]['appearance']
    )
    
    # Dark mode switch
    self.dark_mode_switch = ctk.CTkSwitch(
        self.scrollable_frame,
        text=TRANSLATIONS[current_language]['dark_mode'],
        command=self.toggle_dark_mode,
        font=("Dongle", 16),
        fg_color='#34c759',
        progress_color='#34c759',
        text_color='white' if self.dark_mode else 'black'  # Added text color
    )
    self.dark_mode_switch.pack(pady=(10, 0), padx=20, anchor='w')
    self.dark_mode_switch.select() if self.dark_mode else self.dark_mode_switch.deselect()
    
    self.create_separator(self.scrollable_frame)
    
    # Language section
    self.create_section_title(
        self.scrollable_frame,
        TRANSLATIONS[current_language]['language']
    )
    
    self.language_var = ctk.StringVar(value=current_language)
    self.language_menu = ctk.CTkOptionMenu(
        self.scrollable_frame,
        values=['EN', 'DE'],
        command=self.change_language,
        variable=self.language_var,
        font=("Dongle", 16),
        fg_color='#2c2c2e' if self.dark_mode else '#e5e5e7',
        button_color='#3a3a3c' if self.dark_mode else '#d1d1d6',
        button_hover_color='#3a3a3c' if self.dark_mode else '#d1d1d6',
        text_color='white' if self.dark_mode else 'black'
    )
    self.language_menu.pack(pady=(10, 0), padx=20, anchor='w')
    
    self.create_separator(self.scrollable_frame)
    
    # System section
    self.create_section_title(
        self.scrollable_frame,
        TRANSLATIONS[current_language]['system']
    )
    
    # Restart system button
    restart_button = ctk.CTkButton(
        self.scrollable_frame,
        text=TRANSLATIONS[current_language]['restart_system'],
        command=self.restart_system,
        font=("Dongle", 16),
        fg_color='#ff3b30',
        hover_color='#ff453a',
        text_color='white'  # Always white due to red background
    )
    restart_button.pack(pady=(10, 0), padx=20, anchor='w')
    
    # Turntable calibration button
    calibration_button = ctk.CTkButton(
        self.scrollable_frame,
        text=TRANSLATIONS[current_language]['turntable_calibration'],
        command=self.calibrate_turntable,
        font=("Dongle", 16),
        fg_color='#2c2c2e' if self.dark_mode else '#e5e5e7',
        hover_color='#3a3a3c' if self.dark_mode else '#d1d1d6',
        text_color='white' if self.dark_mode else 'black'  # Added text color
    )
    calibration_button.pack(pady=(10, 0), padx=20, anchor='w')
    
    self.create_separator(self.scrollable_frame)
    
    # Network section
    self.create_section_title(
        self.scrollable_frame,
        TRANSLATIONS[current_language]['network']
    )
    
    # WiFi status
    self.wifi_status = ctk.CTkLabel(
        self.scrollable_frame,
        text=f"{TRANSLATIONS[current_language]['current_network']}: -",
        font=("Dongle", 16),
        text_color='white' if self.dark_mode else 'black'
    )
    self.wifi_status.pack(pady=(10, 0), padx=20, anchor='w')
    
    # WiFi diagnostics button
    wifi_button = ctk.CTkButton(
        self.scrollable_frame,
        text=TRANSLATIONS[current_language]['wifi_diagnostics'],
        command=self.run_wifi_diagnostics,
        font=("Dongle", 16),
        fg_color='#2c2c2e' if self.dark_mode else '#e5e5e7',
        hover_color='#3a3a3c' if self.dark_mode else '#d1d1d6',
        text_color='white' if self.dark_mode else 'black'  # Added text color
    )
    wifi_button.pack(pady=(10, 0), padx=20, anchor='w')
    
    self.create_separator(self.scrollable_frame)
    
    # Help section
    self.create_section_title(
        self.scrollable_frame,
        TRANSLATIONS[current_language]['help']
    )
    
    # Help button with QR code
    help_button = ctk.CTkButton(
        self.scrollable_frame,
        text=TRANSLATIONS[current_language]['help_description'],
        command=self.show_help_qr,
        font=("Dongle", 16),
        fg_color='#2c2c2e' if self.dark_mode else '#e5e5e7',
        hover_color='#3a3a3c' if self.dark_mode else '#d1d1d6',
        text_color='white' if self.dark_mode else 'black'  # Added text color
    )
    help_button.pack(pady=(10, 0), padx=20, anchor='w')
    
    # Add final separator
    self.create_separator(self.scrollable_frame)
Editor is loading...
Leave a Comment