fixed ProfileSettings

This commit is contained in:
Martin Wagner 2020-07-04 12:23:12 +02:00
parent 89bc3ab688
commit 8f7edf2714

View File

@ -2086,6 +2086,7 @@ class ProfileSettings(Gtk.Grid):
#adding vars #adding vars
self.settings=settings self.settings=settings
self.gui_modification=False #indicates whether the settings where changed from the settings dialog
#widgets #widgets
self.profiles_combo=Gtk.ComboBoxText() self.profiles_combo=Gtk.ComboBoxText()
@ -2163,6 +2164,9 @@ class ProfileSettings(Gtk.Grid):
self.settings.disconnect(handler) self.settings.disconnect(handler)
def on_settings_changed(self, *args): def on_settings_changed(self, *args):
if self.gui_modification:
self.gui_modification=False
else:
self.profiles_combo_reload() self.profiles_combo_reload()
self.profiles_combo.set_active(0) self.profiles_combo.set_active(0)
@ -2207,21 +2211,26 @@ class ProfileSettings(Gtk.Grid):
self.profiles_combo.set_active(0) self.profiles_combo.set_active(0)
def on_profile_entry_changed(self, *args): def on_profile_entry_changed(self, *args):
self.gui_modification=True
pos=self.profiles_combo.get_active() pos=self.profiles_combo.get_active()
self.settings.array_modify('as', "profiles", pos, self.profile_entry.get_text()) self.settings.array_modify('as', "profiles", pos, self.profile_entry.get_text())
self.profiles_combo_reload() self.profiles_combo_reload()
self.profiles_combo.set_active(pos) self.profiles_combo.set_active(pos)
def on_host_entry_changed(self, *args): def on_host_entry_changed(self, *args):
self.gui_modification=True
self.settings.array_modify('as', "hosts", self.profiles_combo.get_active(), self.host_entry.get_text()) self.settings.array_modify('as', "hosts", self.profiles_combo.get_active(), self.host_entry.get_text())
def on_port_entry_changed(self, *args): def on_port_entry_changed(self, *args):
self.gui_modification=True
self.settings.array_modify('ai', "ports", self.profiles_combo.get_active(), self.port_entry.get_int()) self.settings.array_modify('ai', "ports", self.profiles_combo.get_active(), self.port_entry.get_int())
def on_password_entry_changed(self, *args): def on_password_entry_changed(self, *args):
self.gui_modification=True
self.settings.array_modify('as', "passwords", self.profiles_combo.get_active(), self.password_entry.get_text()) self.settings.array_modify('as', "passwords", self.profiles_combo.get_active(), self.password_entry.get_text())
def on_path_entry_changed(self, *args): def on_path_entry_changed(self, *args):
self.gui_modification=True
self.settings.array_modify('as', "paths", self.profiles_combo.get_active(), self.path_entry.get_text()) self.settings.array_modify('as', "paths", self.profiles_combo.get_active(), self.path_entry.get_text())
def on_path_select_button_clicked(self, widget, parent): def on_path_select_button_clicked(self, widget, parent):
@ -2232,6 +2241,7 @@ class ProfileSettings(Gtk.Grid):
dialog.set_current_folder(self.settings.get_value("paths")[self.profiles_combo.get_active()]) dialog.set_current_folder(self.settings.get_value("paths")[self.profiles_combo.get_active()])
response=dialog.run() response=dialog.run()
if response == Gtk.ResponseType.OK: if response == Gtk.ResponseType.OK:
self.gui_modification=True
self.settings.array_modify('as', "paths", self.profiles_combo.get_active(), dialog.get_filename()) self.settings.array_modify('as', "paths", self.profiles_combo.get_active(), dialog.get_filename())
self.path_entry.set_text(dialog.get_filename()) self.path_entry.set_text(dialog.get_filename())
dialog.destroy() dialog.destroy()