From 74c8c2482795ee534b6b3e3b8874e729e9fef518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Thu, 27 Sep 2018 00:03:50 +0200 Subject: [PATCH] Move AdvancedConfig to gtk module --- .../advanced_config.py} | 14 ++++++++------ gajim/gtk/preferences.py | 5 ++--- 2 files changed, 10 insertions(+), 9 deletions(-) rename gajim/{advanced_configuration_window.py => gtk/advanced_config.py} (97%) diff --git a/gajim/advanced_configuration_window.py b/gajim/gtk/advanced_config.py similarity index 97% rename from gajim/advanced_configuration_window.py rename to gajim/gtk/advanced_config.py index bec6421aa..4711b32bd 100644 --- a/gajim/advanced_configuration_window.py +++ b/gajim/gtk/advanced_config.py @@ -22,15 +22,17 @@ from enum import IntEnum, unique from gi.repository import Gtk -from gajim import gtkgui_helpers from gi.repository import GLib from gi.repository import Pango from gajim.common import app +from gajim.gtk.util import get_builder + + @unique class Column(IntEnum): - PREFERENCE_NAME = 0 + NAME = 0 VALUE = 1 TYPE = 2 @@ -64,9 +66,9 @@ def tree_model_pre_order(model, treeiter): yield it -class AdvancedConfigurationWindow: +class AdvancedConfig: def __init__(self, transient): - self.xml = gtkgui_helpers.get_gtk_builder('advanced_configuration_window.ui') + self.xml = get_builder('advanced_configuration_window.ui') self.window = self.xml.get_object('advanced_configuration_window') self.window.set_transient_for(transient) self.entry = self.xml.get_object('advanced_entry') @@ -132,7 +134,7 @@ class AdvancedConfigurationWindow: 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.PREFERENCE_NAME] + optname = model[iter_][Column.NAME] opttype = model[iter_][Column.TYPE] if opttype == self.types['boolean'] or optname == 'password': cell.set_property('editable', False) @@ -319,7 +321,7 @@ class AdvancedConfigurationWindow: 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.PREFERENCE_NAME] or (desc and \ + if search_string in model[it][Column.NAME] or (desc and \ search_string in desc.lower()): return True return False diff --git a/gajim/gtk/preferences.py b/gajim/gtk/preferences.py index a3912d339..5517174d9 100644 --- a/gajim/gtk/preferences.py +++ b/gajim/gtk/preferences.py @@ -25,7 +25,6 @@ from gajim.common import configpaths from gajim.common import config as c_config from gajim.common import idle -from gajim.advanced_configuration_window import AdvancedConfigurationWindow from gajim.chat_control_base import ChatControlBase from gajim.config import ManageProxiesWindow, ManageSoundsWindow from gajim import message_control @@ -35,6 +34,7 @@ from gajim import gtkgui_helpers from gajim.gtk.util import get_builder from gajim.gtk.dialogs import AspellDictError from gajim.gtk.themes import Themes +from gajim.gtk.advanced_config import AdvancedConfig try: from gajim.common.multimedia_helpers import AudioInputManager, AudioOutputManager @@ -1011,8 +1011,7 @@ class Preferences(Gtk.ApplicationWindow): if 'advanced_config' in app.interface.instances: app.interface.instances['advanced_config'].window.present() else: - app.interface.instances['advanced_config'] = \ - AdvancedConfigurationWindow(self) + app.interface.instances['advanced_config'] = AdvancedConfig(self) def on_enable_logging_toggled(self, widget): app.set_win_debug_mode(widget.get_active())