Philipp Hörist pushed to branch master at gajim / gajim
Commits: f94f3b06 by Daniel Brötzmann at 2019-07-05T23:07:11Z AdvancedConfig: Layout changes and code cleanup
- - - - -
4 changed files:
- + gajim/data/gui/advanced_configuration.ui - − gajim/data/gui/advanced_configuration_window.ui - gajim/gtk/advanced_config.py - gajim/gtk/preferences.py
Changes:
===================================== gajim/data/gui/advanced_configuration.ui ===================================== @@ -0,0 +1,200 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface> + <requires lib="gtk+" version="3.20"/> + <object class="GtkBox" id="box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">18</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkInfoBar" id="restart_warning"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="message_type">warning</property> + <child internal-child="action_area"> + <object class="GtkButtonBox"> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <property name="layout_style">end</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child internal-child="content_area"> + <object class="GtkBox"> + <property name="can_focus">False</property> + <property name="spacing">16</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">You should restart Gajim for some changes to take effect</property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Filter</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">filter_entry</property> + <style> + <class name="dim-label"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="filter_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="placeholder_text" translatable="yes">Type to search for values...</property> + <signal name="changed" handler="_on_filter_entry_changed" swapped="no"/> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow"> + <property name="width_request">600</property> + <property name="height_request">300</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="advanced_treeview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="rules_hint">True</property> + <signal name="row-activated" handler="_on_treeview_row_activated" swapped="no"/> + <child internal-child="selection"> + <object class="GtkTreeSelection"> + <signal name="changed" handler="_on_treeview_selection_changed" swapped="no"/> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="padding">1</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Description</property> + <property name="use_markup">True</property> + <style> + <class name="bold"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="description"> + <property name="height_request">40</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="wrap">True</property> + <property name="max_width_chars">60</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkButton" id="reset_button"> + <property name="label" translatable="yes">_Reset Value</property> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Resets value to default</property> + <property name="halign">end</property> + <property name="use_underline">True</property> + <signal name="clicked" handler="_on_reset_button_clicked" swapped="no"/> + <style> + <class name="destructive-action"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> +</interface>
===================================== gajim/data/gui/advanced_configuration_window.ui deleted ===================================== @@ -1,240 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> -<interface> - <requires lib="gtk+" version="3.20"/> - <object class="GtkWindow" id="advanced_configuration_window"> - <property name="can_focus">False</property> - <property name="title" translatable="yes">Advanced Configuration Editor (ACE)</property> - <property name="role">ace</property> - <property name="window_position">center-on-parent</property> - <property name="default_width">650</property> - <property name="default_height">540</property> - <property name="type_hint">dialog</property> - <signal name="destroy" handler="on_advanced_configuration_window_destroy" swapped="no"/> - <child> - <placeholder/> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">18</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkInfoBar" id="restart_warning"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="message_type">warning</property> - <child internal-child="action_area"> - <object class="GtkButtonBox"> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <property name="layout_style">end</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child internal-child="content_area"> - <object class="GtkBox"> - <property name="can_focus">False</property> - <property name="spacing">16</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">You should restart Gajim for some changes to take effect</property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">12</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Filter</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">advanced_entry</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="advanced_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <signal name="changed" handler="on_advanced_entry_changed" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow"> - <property name="height_request">200</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">never</property> - <property name="shadow_type">in</property> - <child> - <object class="GtkTreeView" id="advanced_treeview"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="rules_hint">True</property> - <signal name="row-activated" handler="on_advanced_treeview_row_activated" swapped="no"/> - <child internal-child="selection"> - <object class="GtkTreeSelection"/> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="padding">1</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Description</property> - <property name="use_markup">True</property> - <style> - <class name="bold"/> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="description"> - <property name="height_request">30</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="wrap">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkButtonBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">12</property> - <property name="spacing">6</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="reset_button"> - <property name="label" translatable="yes">_Reset to default</property> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="on_reset_button_clicked" swapped="no"/> - <style> - <class name="destructive-action"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="advanced_close_button"> - <property name="label">gtk-close</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_advanced_close_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">5</property> - </packing> - </child> - </object> - </child> - </object> -</interface>
===================================== gajim/gtk/advanced_config.py ===================================== @@ -21,12 +21,14 @@
from enum import IntEnum, unique
-from gi.repository import Gtk +from gi.repository import Gdk from gi.repository import GLib +from gi.repository import Gtk from gi.repository import Pango
from gajim.common import app from gajim.common.i18n import _ +from gajim.common.i18n import Q_
from gajim.gtk.util import get_builder
@@ -37,16 +39,19 @@ class Column(IntEnum): VALUE = 1 TYPE = 2
+ def rate_limit(rate): """ Call func at most *rate* times per second """ def decorator(func): timeout = [None] + def f(*args, **kwargs): if timeout[0] is not None: GLib.source_remove(timeout[0]) timeout[0] = None + def timeout_func(): func(*args, **kwargs) timeout[0] = None @@ -54,12 +59,14 @@ def rate_limit(rate): return f return decorator
+ def tree_model_iter_children(model, treeiter): it = model.iter_children(treeiter) while it: yield it it = model.iter_next(it)
+ def tree_model_pre_order(model, treeiter): yield treeiter for childiter in tree_model_iter_children(model, treeiter): @@ -67,10 +74,17 @@ def tree_model_pre_order(model, treeiter): yield it
-class AdvancedConfig: - def __init__(self, transient): - self._ui = get_builder('advanced_configuration_window.ui') - self._ui.advanced_configuration_window.set_transient_for(transient) +class AdvancedConfig(Gtk.ApplicationWindow): + def __init__(self): + Gtk.ApplicationWindow.__init__(self) + self.set_application(app.app) + self.set_position(Gtk.WindowPosition.CENTER) + self.set_show_menubar(False) + self.set_name('AdvancedConfig') + self.set_title(_('Advanced Configuration Editor (ACE)')) + + self._ui = get_builder('advanced_configuration.ui') + self.add(self._ui.box)
# Format: # key = option name (root/subopt/opt separated by \n then) @@ -80,53 +94,59 @@ class AdvancedConfig: # For i18n self.right_true_dict = {True: _('Activated'), False: _('Deactivated')} self.types = { - 'boolean': _('Boolean'), - 'integer': _('Integer'), - 'string': _('Text'), - 'color': _('Color')} + 'boolean': Q_('?config type:Boolean'), + 'integer': Q_('?config type:Integer'), + 'string': Q_('?config type:Text'), + 'color': Q_('?config type:Color')}
treeview = self._ui.advanced_treeview self.treeview = treeview self.model = Gtk.TreeStore(str, str, str) - self.fill_model() + self._fill_model() self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING) self.modelfilter = self.model.filter_new() - self.modelfilter.set_visible_func(self.visible_func) + self.modelfilter.set_visible_func(self._visible_func)
renderer_text = Gtk.CellRendererText() - col = Gtk.TreeViewColumn(_('Preference Name'), renderer_text, text=0) + renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END) + col = Gtk.TreeViewColumn(Q_('?config:Preference Name'), + renderer_text, text=0) treeview.insert_column(col, -1) + col.props.expand = True + col.props.sizing = Gtk.TreeViewColumnSizing.FIXED col.set_resizable(True)
- renderer_text = Gtk.CellRendererText() - renderer_text.connect('edited', self.on_config_edited) - renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END) - col = Gtk.TreeViewColumn(_('Value'), renderer_text, text=1) + self.renderer_text = Gtk.CellRendererText() + self.renderer_text.connect('edited', self._on_config_edited) + self.renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END) + col = Gtk.TreeViewColumn( + Q_('?config:Value'), self.renderer_text, text=1) treeview.insert_column(col, -1) - col.set_cell_data_func(renderer_text, self.cb_value_column_data) - - col.props.resizable = True + col.set_cell_data_func(self.renderer_text, + self._value_column_data_callback) col.props.expand = True col.props.sizing = Gtk.TreeViewColumnSizing.FIXED + col.set_resizable(True)
renderer_text = Gtk.CellRendererText() - col = Gtk.TreeViewColumn(_('Type'), renderer_text, text=2) + col = Gtk.TreeViewColumn(Q_('?config:Type'), renderer_text, text=2) treeview.insert_column(col, -1) col.props.sizing = Gtk.TreeViewColumnSizing.FIXED
treeview.set_model(self.modelfilter)
- # Connect signal for selection change - treeview.get_selection().connect('changed', - self.on_advanced_treeview_selection_changed) - + self.connect('key-press-event', self._on_key_press) self._ui.connect_signals(self) - self._ui.advanced_configuration_window.show_all() - app.interface.instances['advanced_config'] = self + self.show_all()
- def cb_value_column_data(self, col, cell, model, iter_, data): + def _on_key_press(self, _widget, event): + editing = self.renderer_text.get_property('editing') + if event.keyval == Gdk.KEY_Escape and not editing: + self.destroy() + + def _value_column_data_callback(self, col, cell, model, iter_, data): """ - Check if it's boolean or holds password stuff and if yes make the + Check if it's boolean or holds password stuff and if yes, make the cellrenderertext not editable, else - it's editable """ optname = model[iter_][Column.NAME] @@ -137,7 +157,7 @@ class AdvancedConfig: cell.set_property('editable', True)
@staticmethod - def get_option_path(model, iter_): + def _get_option_path(model, iter_): # It looks like path made from reversed array # path[0] is the true one optname # path[1] is the key name @@ -150,11 +170,11 @@ class AdvancedConfig: parent = model.iter_parent(parent) return path
- def on_advanced_treeview_selection_changed(self, treeselection): + def _on_treeview_selection_changed(self, treeselection): model, iter_ = treeselection.get_selected() # Check for GtkTreeIter if iter_: - opt_path = self.get_option_path(model, iter_) + opt_path = self._get_option_path(model, iter_) # Get text from first column in this row desc = None if len(opt_path) == 3: @@ -164,23 +184,22 @@ class AdvancedConfig: if desc: self._ui.description.set_text(desc) else: - # We talk about option description in advanced configuration editor - self._ui.description.set_text(_('(None)')) - if len(opt_path) == 3 or (len(opt_path) == 1 and not \ - model.iter_has_child(iter_)): + self._ui.description.set_text(Q_('?config description:None')) + if (len(opt_path) == 3 or + (len(opt_path) == 1 and not model.iter_has_child(iter_))): self._ui.reset_button.set_sensitive(True) else: self._ui.reset_button.set_sensitive(False) else: self._ui.reset_button.set_sensitive(False)
- def remember_option(self, option, oldval, newval): + def _remember_option(self, option, oldval, newval): if option in self.changed_opts: self.changed_opts[option] = (self.changed_opts[option][0], newval) else: self.changed_opts[option] = (oldval, newval)
- def on_advanced_treeview_row_activated(self, treeview, path, column): + def _on_treeview_row_activated(self, treeview, path, column): modelpath = self.modelfilter.convert_path_to_child_path(path) modelrow = self.model[modelpath] option = modelrow[0] @@ -195,22 +214,26 @@ class AdvancedConfig: modelpath.up() keyrow = self.model[modelpath] key = keyrow[0] - self.remember_option(option + '\n' + key + '\n' + optname, - modelrow[1], newval) + self._remember_option( + option + '\n' + key + '\n' + optname, + modelrow[1], + newval) app.config.set_per(optname, key, option, newval) else: - self.remember_option(option, modelrow[1], newval) + self._remember_option(option, modelrow[1], newval) app.config.set(option, newval) modelrow[1] = self.right_true_dict[newval] - self.check_for_restart() + self._check_for_restart()
- def check_for_restart(self): + def _check_for_restart(self): self._ui.restart_warning.hide() for opt in self.changed_opts: opt_path = opt.split('\n') if len(opt_path) == 3: - restart = app.config.get_restart_per(opt_path[2], opt_path[1], - opt_path[0]) + restart = app.config.get_restart_per( + opt_path[2], + opt_path[1], + opt_path[0]) else: restart = app.config.get_restart(opt_path[0]) if restart: @@ -219,38 +242,36 @@ class AdvancedConfig: self._ui.restart_warning.show() break
- def on_config_edited(self, cell, path, text): + def _on_config_edited(self, cell, path, text): # Convert modelfilter path to model path path = Gtk.TreePath.new_from_string(path) modelpath = self.modelfilter.convert_path_to_child_path(path) modelrow = self.model[modelpath] option = modelrow[0] if modelpath.get_depth() > 2: - modelpath.up() # Get parent + modelpath.up() # Get parent keyrow = self.model[modelpath] key = keyrow[0] - modelpath.up() # Get parent + modelpath.up() # Get parent optnamerow = self.model[modelpath] optname = optnamerow[0] - self.remember_option(option + '\n' + key + '\n' + optname, modelrow[1], - text) + self._remember_option( + option + '\n' + key + '\n' + optname, + modelrow[1], + text) app.config.set_per(optname, key, option, text) else: - self.remember_option(option, modelrow[1], text) + self._remember_option(option, modelrow[1], text) app.config.set(option, text) modelrow[1] = text - self.check_for_restart() - - @staticmethod - def on_advanced_configuration_window_destroy(widget): - del app.interface.instances['advanced_config'] + self._check_for_restart()
- def on_reset_button_clicked(self, widget): + def _on_reset_button_clicked(self, widget): model, iter_ = self.treeview.get_selection().get_selected() # Check for GtkTreeIter if iter_: path = model.get_path(iter_) - opt_path = self.get_option_path(model, iter_) + opt_path = self._get_option_path(model, iter_) if len(opt_path) == 1: default = app.config.get_default(opt_path[0]) elif len(opt_path) == 3: @@ -267,36 +288,38 @@ class AdvancedConfig: optname = optnamerow[0] keyrow = self.model[modelpath[:2]] key = keyrow[0] - self.remember_option(option + '\n' + key + '\n' + optname, - modelrow[Column.VALUE], default) + self._remember_option( + option + '\n' + key + '\n' + optname, + modelrow[Column.VALUE], + default) app.config.set_per(optname, key, option, default) else: - self.remember_option(option, modelrow[Column.VALUE], default) + self._remember_option( + option, + modelrow[Column.VALUE], + default) app.config.set(option, default) modelrow[Column.VALUE] = self.right_true_dict[default] - self.check_for_restart() + self._check_for_restart() else: if str(default) == model[iter_][Column.VALUE]: return - self.on_config_edited(None, path.to_string(), str(default)) + self._on_config_edited(None, path.to_string(), str(default))
- def on_advanced_close_button_clicked(self, widget): - self._ui.advanced_configuration_window.destroy() - - def fill_model(self, node=None, parent=None): + def _fill_model(self, node=None, parent=None): for item, option in app.config.get_children(node): name = item[-1] - if option is None: # Node + if option is None: # Node newparent = self.model.append(parent, [name, '', '']) - self.fill_model(item, newparent) - else: # Leaf + self._fill_model(item, newparent) + else: if len(item) == 1: type_ = self.types[app.config.get_type(name)] elif len(item) == 3: - type_ = self.types[app.config.get_type_per(item[0], - item[2])] + type_ = self.types[app.config.get_type_per( + item[0], item[2])] if name == 'password': - value = _('Hidden') + value = Q_('?password:Hidden') else: if type_ == self.types['boolean']: value = self.right_true_dict[option] @@ -307,22 +330,22 @@ class AdvancedConfig: value = option self.model.append(parent, [name, value, type_])
- def visible_func(self, model, treeiter, data): - search_string = self._ui.advanced_entry.get_text().lower() + def _visible_func(self, model, treeiter, data): + search_string = self._ui.filter_entry.get_text().lower() for it in tree_model_pre_order(model, treeiter): if model[it][Column.TYPE] != '': - opt_path = self.get_option_path(model, it) + opt_path = self._get_option_path(model, it) if len(opt_path) == 3: desc = app.config.get_desc_per(opt_path[2], opt_path[0]) elif len(opt_path) == 1: desc = app.config.get_desc(opt_path[0]) - if search_string in model[it][Column.NAME] or (desc and \ - search_string in desc.lower()): + if (search_string in model[it][Column.NAME] or + (desc and search_string in desc.lower())): return True return False
@rate_limit(3) - def on_advanced_entry_changed(self, widget): + def _on_filter_entry_changed(self, widget): self.modelfilter.refilter() if not widget.get_text(): # Maybe the expanded rows should be remembered here ...
===================================== gajim/gtk/preferences.py ===================================== @@ -1003,8 +1003,9 @@ class Preferences(Gtk.ApplicationWindow): app.set_win_debug_mode(widget.get_active())
# Advanced Config Editor (ACE) - def on_open_advanced_editor_button_clicked(self, widget, data=None): - if 'advanced_config' in app.interface.instances: - app.interface.instances['advanced_config'].window.present() + def on_open_advanced_editor_button_clicked(self, _widget): + window = app.get_app_window(AdvancedConfig) + if window is None: + AdvancedConfig() else: - app.interface.instances['advanced_config'] = AdvancedConfig(self) + window.present()
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/f94f3b0658f24b3169f735a9cba87a1b5d3...