Untitled
unknown
plain_text
a year ago
2.7 kB
6
Indexable
class NetworkSelector(ctk.CTkFrame):
def __init__(self, parent, dark_mode: bool, language: str):
super().__init__(parent)
self.dark_mode = dark_mode
self.language = language
self.wifi = WiFiConnection()
bg_color = '#1c1c1e' if dark_mode else '#f5f5f7'
self.configure(fg_color=bg_color)
# Network selection area - much thinner height
self.networks_frame = ctk.CTkScrollableFrame(
self,
fg_color='#2c2c2e' if dark_mode else '#e5e5e7',
corner_radius=10,
height=60 # Significantly reduced height
)
self.networks_frame.pack(fill='x', pady=(0, 5))
# Password entry and connect button in single row
self.password_frame = ctk.CTkFrame(
self,
fg_color=bg_color,
height=40 # Reduced height
)
self.password_frame.pack(fill='x', pady=(0, 5))
# Password entry - full width minus connect button
self.password_entry = ctk.CTkEntry(
self.password_frame,
placeholder_text="Enter network password",
font=("Dongle", 18),
height=40,
fg_color='#2c2c2e' if dark_mode else '#e5e5e7',
text_color='white' if dark_mode else 'black',
placeholder_text_color='#86868b',
show="*"
)
self.password_entry.pack(side='left', fill='x', expand=True, padx=(0, 5))
# Connect button - fixed width
self.connect_button = ctk.CTkButton(
self.password_frame,
text="Connect",
font=("Dongle", 18),
height=40,
width=100,
fg_color='#34c759',
hover_color='#32b357',
command=self.connect_to_selected
)
self.connect_button.pack(side='right')
# Status label
self.status_label = ctk.CTkLabel(
self,
text="",
font=("Dongle", 16),
text_color='white' if dark_mode else 'black'
)
self.status_label.pack()
# Keyboard frame - full width
self.keyboard_frame = ctk.CTkFrame(
self,
fg_color=bg_color
)
# Create keyboard layout
self.create_keyboard()
# Bind click events
self.password_entry.bind('<Button-1>', self.toggle_keyboard)
# Initial scan and setup
self.selected_network = None
self.scan_networks()
self.keyboard_visible = FalseEditor is loading...
Leave a Comment