combobox support

This commit is contained in:
admin 2024-02-11 01:01:03 +01:00
parent 0051b9011b
commit f30f9c8404
2 changed files with 24 additions and 16 deletions

View file

@ -1,2 +1,2 @@
nuitka3 ./src/main.py --linux-onefile-icon=./data/icon.png --onefile --output-dir=./build --run nuitka3 ./src/main.py --onefile --output-dir=./build --run
#--disable-console --linux-icon=./data/icon.png --output-dir=./build --clean-cache=all #--include-plugin-directory=./src/ --run --disable-console --linux-icon=./data/icon.png --output-dir=./build #--clean-cache=all --recompile-c-only #--windows-icon-from-ico=./data/icon.ico --disable-console --linux-icon=./data/icon.png --onefile --output-dir=./build #--disable-console --output-dir=./build --clean-cache=all #--include-plugin-directory=./src/ --run --disable-console --linux-icon=./data/icon.png --output-dir=./build #--clean-cache=all --recompile-c-only

View file

@ -47,18 +47,23 @@ def run_installer(download_folder_tmp, col_isDark):
# Remove currently visible widgets # Remove currently visible widgets
for widget in visible_widgets: for widget in visible_widgets:
widget.pack_forget() widget.pack_forget()
# Create widgets for current tab # Create widgets for the current tab
current_tab = tab_combobox.get() current_tab = tab_combobox.get()
widget_specs = tabs.get(current_tab, []) widget_specs = tabs.get(current_tab, [])
widgets = [] widgets = []
for spec in widget_specs: spacing_top = 10 # Adjust the spacing as needed
for index, spec in enumerate(widget_specs):
widget = create_widget(spec, container) widget = create_widget(spec, container)
if widget: if widget:
widget.pack(pady=20, padx=20) if index == 0: # Add spacing from the top only for the first widget
widget.pack(pady=spacing_top, padx=20)
else:
widget.pack(pady=spacing_top, padx=20)
widgets.append(widget) widgets.append(widget)
return widgets return widgets
@ -71,6 +76,10 @@ def run_installer(download_folder_tmp, col_isDark):
elif widget_class == CTkProgressBar: elif widget_class == CTkProgressBar:
progress_bar = CTkProgressBar(master=master, **widget_args) progress_bar = CTkProgressBar(master=master, **widget_args)
return progress_bar return progress_bar
elif widget_class == CTkComboBox:
# Remove the 'text' argument if it exists
widget_args.pop('text', None)
return CTkComboBox(master=master, **widget_args)
else: else:
return spec(master=master) return spec(master=master)
@ -105,17 +114,16 @@ def run_installer(download_folder_tmp, col_isDark):
tab_combobox.set(list(tabs.keys())[previous_tab_index]) tab_combobox.set(list(tabs.keys())[previous_tab_index])
visible_widgets = create_widgets_for_current_tab() visible_widgets = create_widgets_for_current_tab()
def switch_to_install_tab():
switch_to_tab("Tab3")
tabs = { tabs = {
"Tab1": [ "Tab1": [
(CTkButton, {"text": "Next Tab", "command": switch_to_next_tab}), (CTkComboBox, {"text": "Language", "values": ["London", "Britan", "New York"]}),
(CTkButton, {"text": "Previous Tab", "command": switch_to_previous_tab}),
(CTkButton, {"text": "Get Browser package", "command": get_default_packages}),
(CTkComboBox, {"text": "Theme", "values": ["System", "Light", "Dark"]}), (CTkComboBox, {"text": "Theme", "values": ["System", "Light", "Dark"]}),
CTkEntry, (CTkCheckBox, {"text": f"Force {'Dark' if col_isDark else 'Light'} on every website"}),
CTkProgressBar, (CTkButton, {"text": "Install", "command": switch_to_install_tab}),
CTkRadioButton, (CTkButton, {"text": "Customise", "command": switch_to_next_tab}),
CTkSlider,
CTkSwitch
], ],
"Tab2": [ "Tab2": [
(CTkButton, {"text": "Next Tab", "command": switch_to_next_tab}), (CTkButton, {"text": "Next Tab", "command": switch_to_next_tab}),