Bridge CheckBox Ergänzt
This commit is contained in:
23
create.py
23
create.py
@@ -14,6 +14,9 @@ class LxcLauncherGUI:
|
||||
self.num_hosts_var = tk.StringVar()
|
||||
self.num_hosts_var.set("1") # Standardwert auf 1 setzen
|
||||
|
||||
# Neue Variable für bridgeprofil Checkbox
|
||||
self.bridgeprofile_checkbox_var = tk.BooleanVar()
|
||||
|
||||
self.create_widgets()
|
||||
|
||||
def create_widgets(self):
|
||||
@@ -51,21 +54,25 @@ class LxcLauncherGUI:
|
||||
protection_checkbox = ttk.Checkbutton(self.root, text="Protection", variable=self.protection_checkbox_var)
|
||||
protection_checkbox.grid(row=3, column=1, padx=10, pady=10, sticky="w")
|
||||
|
||||
# Checkbox für bridgeprofil
|
||||
bridgeprofile_checkbox = ttk.Checkbutton(self.root, text="Bridgeprofil", variable=self.bridgeprofile_checkbox_var)
|
||||
bridgeprofile_checkbox.grid(row=4, column=0, padx=10, pady=10, sticky="w")
|
||||
|
||||
# Button zum Starten
|
||||
launch_button = ttk.Button(self.root, text="Starten", command=self.launch_lxc)
|
||||
launch_button.grid(row=4, column=0, padx=10, pady=10, sticky="w")
|
||||
launch_button.grid(row=5, column=0, padx=10, pady=10, sticky="w")
|
||||
|
||||
# Button für Weitere Hosts
|
||||
hosts_button = ttk.Button(self.root, text="Weitere Hosts", command=self.show_hosts)
|
||||
hosts_button.grid(row=4, column=1, padx=10, pady=10, sticky="w")
|
||||
hosts_button.grid(row=5, column=1, padx=10, pady=10, sticky="w")
|
||||
|
||||
# Button zum Beenden
|
||||
exit_button = ttk.Button(self.root, text="Beenden", command=self.root.destroy)
|
||||
exit_button.grid(row=5, column=0, columnspan=4, padx=10, pady=10, sticky="w")
|
||||
exit_button.grid(row=6, column=0, columnspan=4, padx=10, pady=10, sticky="w")
|
||||
|
||||
# Label für das Ergebnis
|
||||
self.result_label = ttk.Label(self.root, text="")
|
||||
self.result_label.grid(row=6, column=0, columnspan=4, padx=10, pady=10, sticky="w")
|
||||
self.result_label.grid(row=7, column=0, columnspan=4, padx=10, pady=10, sticky="w")
|
||||
|
||||
def show_error_message(self, message):
|
||||
messagebox.showerror("Fehler", message)
|
||||
@@ -98,7 +105,13 @@ class LxcLauncherGUI:
|
||||
|
||||
nesting_option = "true" if self.nesting_checkbox_var.get() else "false"
|
||||
protection_option = "true" if self.protection_checkbox_var.get() else "false"
|
||||
bridgeprofile_option = "true" if self.bridgeprofile_checkbox_var.get() else "false"
|
||||
|
||||
# Anpassung des Befehls für bridgeprofil
|
||||
#launch_command = f"lxc launch images:{selected_image} {host_name} -c security.nesting={nesting_option} -c security.protection.delete={protection_option} -p bridgeprofile={bridgeprofile_option}"
|
||||
launch_command = f"lxc launch images:{selected_image} {host_name} -c security.nesting={nesting_option} -c security.protection.delete={protection_option}"
|
||||
if self.bridgeprofile_checkbox_var.get():
|
||||
launch_command += " -p default -p bridgeprofile"
|
||||
|
||||
process = Popen(launch_command, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
output, error = process.communicate()
|
||||
@@ -118,9 +131,9 @@ class LxcLauncherGUI:
|
||||
# Reset der Auswahl
|
||||
self.selected_image.set("") # Zurücksetzen des Auswahlmenüs
|
||||
self.host_name_var.set("") # Zurücksetzen des Hostnamen-Eingabefelds
|
||||
self.num_hosts_var.set("") # Zurücksetzen des Felds für die Anzahl der Hosts
|
||||
self.nesting_checkbox_var.set(False) # Zurücksetzen der Nesting-Checkbox
|
||||
self.protection_checkbox_var.set(False) # Zurücksetzen der Protection-Checkbox
|
||||
self.bridgeprofile_checkbox_var.set(False) # Zurücksetzen der Bridgeprofil-Checkbox
|
||||
|
||||
if __name__ == "__main__":
|
||||
root = tk.Tk()
|
||||
|
||||
Reference in New Issue
Block a user