Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
f94f3b06
by Daniel Brötzmann at 2019-07-05T23:07:11Z
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:
| 1 |
+<?xml version="1.0" encoding="UTF-8"?>
|
|
| 2 |
+<!-- Generated with glade 3.22.1 -->
|
|
| 3 |
+<interface>
|
|
| 4 |
+ <requires lib="gtk+" version="3.20"/>
|
|
| 5 |
+ <object class="GtkBox" id="box">
|
|
| 6 |
+ <property name="visible">True</property>
|
|
| 7 |
+ <property name="can_focus">False</property>
|
|
| 8 |
+ <property name="border_width">18</property>
|
|
| 9 |
+ <property name="orientation">vertical</property>
|
|
| 10 |
+ <property name="spacing">6</property>
|
|
| 11 |
+ <child>
|
|
| 12 |
+ <object class="GtkInfoBar" id="restart_warning">
|
|
| 13 |
+ <property name="can_focus">False</property>
|
|
| 14 |
+ <property name="no_show_all">True</property>
|
|
| 15 |
+ <property name="message_type">warning</property>
|
|
| 16 |
+ <child internal-child="action_area">
|
|
| 17 |
+ <object class="GtkButtonBox">
|
|
| 18 |
+ <property name="can_focus">False</property>
|
|
| 19 |
+ <property name="spacing">6</property>
|
|
| 20 |
+ <property name="layout_style">end</property>
|
|
| 21 |
+ <child>
|
|
| 22 |
+ <placeholder/>
|
|
| 23 |
+ </child>
|
|
| 24 |
+ </object>
|
|
| 25 |
+ <packing>
|
|
| 26 |
+ <property name="expand">False</property>
|
|
| 27 |
+ <property name="fill">False</property>
|
|
| 28 |
+ <property name="position">0</property>
|
|
| 29 |
+ </packing>
|
|
| 30 |
+ </child>
|
|
| 31 |
+ <child internal-child="content_area">
|
|
| 32 |
+ <object class="GtkBox">
|
|
| 33 |
+ <property name="can_focus">False</property>
|
|
| 34 |
+ <property name="spacing">16</property>
|
|
| 35 |
+ <child>
|
|
| 36 |
+ <object class="GtkLabel">
|
|
| 37 |
+ <property name="visible">True</property>
|
|
| 38 |
+ <property name="can_focus">False</property>
|
|
| 39 |
+ <property name="label" translatable="yes">You should restart Gajim for some changes to take effect</property>
|
|
| 40 |
+ <property name="use_markup">True</property>
|
|
| 41 |
+ </object>
|
|
| 42 |
+ <packing>
|
|
| 43 |
+ <property name="expand">False</property>
|
|
| 44 |
+ <property name="fill">True</property>
|
|
| 45 |
+ <property name="position">0</property>
|
|
| 46 |
+ </packing>
|
|
| 47 |
+ </child>
|
|
| 48 |
+ </object>
|
|
| 49 |
+ <packing>
|
|
| 50 |
+ <property name="expand">False</property>
|
|
| 51 |
+ <property name="fill">False</property>
|
|
| 52 |
+ <property name="position">0</property>
|
|
| 53 |
+ </packing>
|
|
| 54 |
+ </child>
|
|
| 55 |
+ </object>
|
|
| 56 |
+ <packing>
|
|
| 57 |
+ <property name="expand">False</property>
|
|
| 58 |
+ <property name="fill">True</property>
|
|
| 59 |
+ <property name="position">0</property>
|
|
| 60 |
+ </packing>
|
|
| 61 |
+ </child>
|
|
| 62 |
+ <child>
|
|
| 63 |
+ <object class="GtkBox">
|
|
| 64 |
+ <property name="visible">True</property>
|
|
| 65 |
+ <property name="can_focus">False</property>
|
|
| 66 |
+ <property name="spacing">12</property>
|
|
| 67 |
+ <child>
|
|
| 68 |
+ <object class="GtkLabel">
|
|
| 69 |
+ <property name="visible">True</property>
|
|
| 70 |
+ <property name="can_focus">False</property>
|
|
| 71 |
+ <property name="label" translatable="yes">_Filter</property>
|
|
| 72 |
+ <property name="use_underline">True</property>
|
|
| 73 |
+ <property name="mnemonic_widget">filter_entry</property>
|
|
| 74 |
+ <style>
|
|
| 75 |
+ <class name="dim-label"/>
|
|
| 76 |
+ </style>
|
|
| 77 |
+ </object>
|
|
| 78 |
+ <packing>
|
|
| 79 |
+ <property name="expand">False</property>
|
|
| 80 |
+ <property name="fill">True</property>
|
|
| 81 |
+ <property name="position">0</property>
|
|
| 82 |
+ </packing>
|
|
| 83 |
+ </child>
|
|
| 84 |
+ <child>
|
|
| 85 |
+ <object class="GtkEntry" id="filter_entry">
|
|
| 86 |
+ <property name="visible">True</property>
|
|
| 87 |
+ <property name="can_focus">True</property>
|
|
| 88 |
+ <property name="placeholder_text" translatable="yes">Type to search for values...</property>
|
|
| 89 |
+ <signal name="changed" handler="_on_filter_entry_changed" swapped="no"/>
|
|
| 90 |
+ </object>
|
|
| 91 |
+ <packing>
|
|
| 92 |
+ <property name="expand">True</property>
|
|
| 93 |
+ <property name="fill">True</property>
|
|
| 94 |
+ <property name="position">1</property>
|
|
| 95 |
+ </packing>
|
|
| 96 |
+ </child>
|
|
| 97 |
+ </object>
|
|
| 98 |
+ <packing>
|
|
| 99 |
+ <property name="expand">False</property>
|
|
| 100 |
+ <property name="fill">True</property>
|
|
| 101 |
+ <property name="position">1</property>
|
|
| 102 |
+ </packing>
|
|
| 103 |
+ </child>
|
|
| 104 |
+ <child>
|
|
| 105 |
+ <object class="GtkScrolledWindow">
|
|
| 106 |
+ <property name="width_request">600</property>
|
|
| 107 |
+ <property name="height_request">300</property>
|
|
| 108 |
+ <property name="visible">True</property>
|
|
| 109 |
+ <property name="can_focus">True</property>
|
|
| 110 |
+ <property name="hscrollbar_policy">never</property>
|
|
| 111 |
+ <property name="shadow_type">in</property>
|
|
| 112 |
+ <child>
|
|
| 113 |
+ <object class="GtkTreeView" id="advanced_treeview">
|
|
| 114 |
+ <property name="visible">True</property>
|
|
| 115 |
+ <property name="can_focus">True</property>
|
|
| 116 |
+ <property name="rules_hint">True</property>
|
|
| 117 |
+ <signal name="row-activated" handler="_on_treeview_row_activated" swapped="no"/>
|
|
| 118 |
+ <child internal-child="selection">
|
|
| 119 |
+ <object class="GtkTreeSelection">
|
|
| 120 |
+ <signal name="changed" handler="_on_treeview_selection_changed" swapped="no"/>
|
|
| 121 |
+ </object>
|
|
| 122 |
+ </child>
|
|
| 123 |
+ </object>
|
|
| 124 |
+ </child>
|
|
| 125 |
+ </object>
|
|
| 126 |
+ <packing>
|
|
| 127 |
+ <property name="expand">True</property>
|
|
| 128 |
+ <property name="fill">True</property>
|
|
| 129 |
+ <property name="padding">1</property>
|
|
| 130 |
+ <property name="position">2</property>
|
|
| 131 |
+ </packing>
|
|
| 132 |
+ </child>
|
|
| 133 |
+ <child>
|
|
| 134 |
+ <object class="GtkBox">
|
|
| 135 |
+ <property name="visible">True</property>
|
|
| 136 |
+ <property name="can_focus">False</property>
|
|
| 137 |
+ <property name="orientation">vertical</property>
|
|
| 138 |
+ <property name="spacing">6</property>
|
|
| 139 |
+ <child>
|
|
| 140 |
+ <object class="GtkLabel">
|
|
| 141 |
+ <property name="visible">True</property>
|
|
| 142 |
+ <property name="can_focus">False</property>
|
|
| 143 |
+ <property name="label" translatable="yes">Description</property>
|
|
| 144 |
+ <property name="use_markup">True</property>
|
|
| 145 |
+ <style>
|
|
| 146 |
+ <class name="bold"/>
|
|
| 147 |
+ </style>
|
|
| 148 |
+ </object>
|
|
| 149 |
+ <packing>
|
|
| 150 |
+ <property name="expand">False</property>
|
|
| 151 |
+ <property name="fill">True</property>
|
|
| 152 |
+ <property name="position">0</property>
|
|
| 153 |
+ </packing>
|
|
| 154 |
+ </child>
|
|
| 155 |
+ <child>
|
|
| 156 |
+ <object class="GtkLabel" id="description">
|
|
| 157 |
+ <property name="height_request">40</property>
|
|
| 158 |
+ <property name="visible">True</property>
|
|
| 159 |
+ <property name="can_focus">False</property>
|
|
| 160 |
+ <property name="wrap">True</property>
|
|
| 161 |
+ <property name="max_width_chars">60</property>
|
|
| 162 |
+ <property name="xalign">0</property>
|
|
| 163 |
+ <property name="yalign">0</property>
|
|
| 164 |
+ </object>
|
|
| 165 |
+ <packing>
|
|
| 166 |
+ <property name="expand">False</property>
|
|
| 167 |
+ <property name="fill">True</property>
|
|
| 168 |
+ <property name="position">1</property>
|
|
| 169 |
+ </packing>
|
|
| 170 |
+ </child>
|
|
| 171 |
+ </object>
|
|
| 172 |
+ <packing>
|
|
| 173 |
+ <property name="expand">False</property>
|
|
| 174 |
+ <property name="fill">True</property>
|
|
| 175 |
+ <property name="position">4</property>
|
|
| 176 |
+ </packing>
|
|
| 177 |
+ </child>
|
|
| 178 |
+ <child>
|
|
| 179 |
+ <object class="GtkButton" id="reset_button">
|
|
| 180 |
+ <property name="label" translatable="yes">_Reset Value</property>
|
|
| 181 |
+ <property name="visible">True</property>
|
|
| 182 |
+ <property name="sensitive">False</property>
|
|
| 183 |
+ <property name="can_focus">True</property>
|
|
| 184 |
+ <property name="receives_default">False</property>
|
|
| 185 |
+ <property name="tooltip_text" translatable="yes">Resets value to default</property>
|
|
| 186 |
+ <property name="halign">end</property>
|
|
| 187 |
+ <property name="use_underline">True</property>
|
|
| 188 |
+ <signal name="clicked" handler="_on_reset_button_clicked" swapped="no"/>
|
|
| 189 |
+ <style>
|
|
| 190 |
+ <class name="destructive-action"/>
|
|
| 191 |
+ </style>
|
|
| 192 |
+ </object>
|
|
| 193 |
+ <packing>
|
|
| 194 |
+ <property name="expand">False</property>
|
|
| 195 |
+ <property name="fill">True</property>
|
|
| 196 |
+ <property name="position">4</property>
|
|
| 197 |
+ </packing>
|
|
| 198 |
+ </child>
|
|
| 199 |
+ </object>
|
|
| 200 |
+</interface>
|
| 1 |
-<?xml version="1.0" encoding="UTF-8"?>
|
|
| 2 |
-<!-- Generated with glade 3.22.1 -->
|
|
| 3 |
-<interface>
|
|
| 4 |
- <requires lib="gtk+" version="3.20"/>
|
|
| 5 |
- <object class="GtkWindow" id="advanced_configuration_window">
|
|
| 6 |
- <property name="can_focus">False</property>
|
|
| 7 |
- <property name="title" translatable="yes">Advanced Configuration Editor (ACE)</property>
|
|
| 8 |
- <property name="role">ace</property>
|
|
| 9 |
- <property name="window_position">center-on-parent</property>
|
|
| 10 |
- <property name="default_width">650</property>
|
|
| 11 |
- <property name="default_height">540</property>
|
|
| 12 |
- <property name="type_hint">dialog</property>
|
|
| 13 |
- <signal name="destroy" handler="on_advanced_configuration_window_destroy" swapped="no"/>
|
|
| 14 |
- <child>
|
|
| 15 |
- <placeholder/>
|
|
| 16 |
- </child>
|
|
| 17 |
- <child>
|
|
| 18 |
- <object class="GtkBox">
|
|
| 19 |
- <property name="visible">True</property>
|
|
| 20 |
- <property name="can_focus">False</property>
|
|
| 21 |
- <property name="border_width">18</property>
|
|
| 22 |
- <property name="orientation">vertical</property>
|
|
| 23 |
- <property name="spacing">6</property>
|
|
| 24 |
- <child>
|
|
| 25 |
- <object class="GtkInfoBar" id="restart_warning">
|
|
| 26 |
- <property name="can_focus">False</property>
|
|
| 27 |
- <property name="no_show_all">True</property>
|
|
| 28 |
- <property name="message_type">warning</property>
|
|
| 29 |
- <child internal-child="action_area">
|
|
| 30 |
- <object class="GtkButtonBox">
|
|
| 31 |
- <property name="can_focus">False</property>
|
|
| 32 |
- <property name="spacing">6</property>
|
|
| 33 |
- <property name="layout_style">end</property>
|
|
| 34 |
- <child>
|
|
| 35 |
- <placeholder/>
|
|
| 36 |
- </child>
|
|
| 37 |
- </object>
|
|
| 38 |
- <packing>
|
|
| 39 |
- <property name="expand">False</property>
|
|
| 40 |
- <property name="fill">False</property>
|
|
| 41 |
- <property name="position">0</property>
|
|
| 42 |
- </packing>
|
|
| 43 |
- </child>
|
|
| 44 |
- <child internal-child="content_area">
|
|
| 45 |
- <object class="GtkBox">
|
|
| 46 |
- <property name="can_focus">False</property>
|
|
| 47 |
- <property name="spacing">16</property>
|
|
| 48 |
- <child>
|
|
| 49 |
- <object class="GtkLabel">
|
|
| 50 |
- <property name="visible">True</property>
|
|
| 51 |
- <property name="can_focus">False</property>
|
|
| 52 |
- <property name="label" translatable="yes">You should restart Gajim for some changes to take effect</property>
|
|
| 53 |
- <property name="use_markup">True</property>
|
|
| 54 |
- </object>
|
|
| 55 |
- <packing>
|
|
| 56 |
- <property name="expand">False</property>
|
|
| 57 |
- <property name="fill">True</property>
|
|
| 58 |
- <property name="position">0</property>
|
|
| 59 |
- </packing>
|
|
| 60 |
- </child>
|
|
| 61 |
- </object>
|
|
| 62 |
- <packing>
|
|
| 63 |
- <property name="expand">False</property>
|
|
| 64 |
- <property name="fill">False</property>
|
|
| 65 |
- <property name="position">0</property>
|
|
| 66 |
- </packing>
|
|
| 67 |
- </child>
|
|
| 68 |
- </object>
|
|
| 69 |
- <packing>
|
|
| 70 |
- <property name="expand">False</property>
|
|
| 71 |
- <property name="fill">True</property>
|
|
| 72 |
- <property name="position">0</property>
|
|
| 73 |
- </packing>
|
|
| 74 |
- </child>
|
|
| 75 |
- <child>
|
|
| 76 |
- <object class="GtkBox">
|
|
| 77 |
- <property name="visible">True</property>
|
|
| 78 |
- <property name="can_focus">False</property>
|
|
| 79 |
- <property name="spacing">12</property>
|
|
| 80 |
- <child>
|
|
| 81 |
- <object class="GtkLabel">
|
|
| 82 |
- <property name="visible">True</property>
|
|
| 83 |
- <property name="can_focus">False</property>
|
|
| 84 |
- <property name="label" translatable="yes">_Filter</property>
|
|
| 85 |
- <property name="use_underline">True</property>
|
|
| 86 |
- <property name="mnemonic_widget">advanced_entry</property>
|
|
| 87 |
- <style>
|
|
| 88 |
- <class name="dim-label"/>
|
|
| 89 |
- </style>
|
|
| 90 |
- </object>
|
|
| 91 |
- <packing>
|
|
| 92 |
- <property name="expand">False</property>
|
|
| 93 |
- <property name="fill">True</property>
|
|
| 94 |
- <property name="position">0</property>
|
|
| 95 |
- </packing>
|
|
| 96 |
- </child>
|
|
| 97 |
- <child>
|
|
| 98 |
- <object class="GtkEntry" id="advanced_entry">
|
|
| 99 |
- <property name="visible">True</property>
|
|
| 100 |
- <property name="can_focus">True</property>
|
|
| 101 |
- <signal name="changed" handler="on_advanced_entry_changed" swapped="no"/>
|
|
| 102 |
- </object>
|
|
| 103 |
- <packing>
|
|
| 104 |
- <property name="expand">True</property>
|
|
| 105 |
- <property name="fill">True</property>
|
|
| 106 |
- <property name="position">1</property>
|
|
| 107 |
- </packing>
|
|
| 108 |
- </child>
|
|
| 109 |
- </object>
|
|
| 110 |
- <packing>
|
|
| 111 |
- <property name="expand">False</property>
|
|
| 112 |
- <property name="fill">True</property>
|
|
| 113 |
- <property name="position">1</property>
|
|
| 114 |
- </packing>
|
|
| 115 |
- </child>
|
|
| 116 |
- <child>
|
|
| 117 |
- <object class="GtkScrolledWindow">
|
|
| 118 |
- <property name="height_request">200</property>
|
|
| 119 |
- <property name="visible">True</property>
|
|
| 120 |
- <property name="can_focus">True</property>
|
|
| 121 |
- <property name="hscrollbar_policy">never</property>
|
|
| 122 |
- <property name="shadow_type">in</property>
|
|
| 123 |
- <child>
|
|
| 124 |
- <object class="GtkTreeView" id="advanced_treeview">
|
|
| 125 |
- <property name="visible">True</property>
|
|
| 126 |
- <property name="can_focus">True</property>
|
|
| 127 |
- <property name="rules_hint">True</property>
|
|
| 128 |
- <signal name="row-activated" handler="on_advanced_treeview_row_activated" swapped="no"/>
|
|
| 129 |
- <child internal-child="selection">
|
|
| 130 |
- <object class="GtkTreeSelection"/>
|
|
| 131 |
- </child>
|
|
| 132 |
- </object>
|
|
| 133 |
- </child>
|
|
| 134 |
- </object>
|
|
| 135 |
- <packing>
|
|
| 136 |
- <property name="expand">True</property>
|
|
| 137 |
- <property name="fill">True</property>
|
|
| 138 |
- <property name="padding">1</property>
|
|
| 139 |
- <property name="position">2</property>
|
|
| 140 |
- </packing>
|
|
| 141 |
- </child>
|
|
| 142 |
- <child>
|
|
| 143 |
- <object class="GtkBox">
|
|
| 144 |
- <property name="visible">True</property>
|
|
| 145 |
- <property name="can_focus">False</property>
|
|
| 146 |
- <property name="orientation">vertical</property>
|
|
| 147 |
- <property name="spacing">6</property>
|
|
| 148 |
- <child>
|
|
| 149 |
- <object class="GtkLabel">
|
|
| 150 |
- <property name="visible">True</property>
|
|
| 151 |
- <property name="can_focus">False</property>
|
|
| 152 |
- <property name="halign">start</property>
|
|
| 153 |
- <property name="label" translatable="yes">Description</property>
|
|
| 154 |
- <property name="use_markup">True</property>
|
|
| 155 |
- <style>
|
|
| 156 |
- <class name="bold"/>
|
|
| 157 |
- <class name="dim-label"/>
|
|
| 158 |
- </style>
|
|
| 159 |
- </object>
|
|
| 160 |
- <packing>
|
|
| 161 |
- <property name="expand">False</property>
|
|
| 162 |
- <property name="fill">True</property>
|
|
| 163 |
- <property name="position">0</property>
|
|
| 164 |
- </packing>
|
|
| 165 |
- </child>
|
|
| 166 |
- <child>
|
|
| 167 |
- <object class="GtkLabel" id="description">
|
|
| 168 |
- <property name="height_request">30</property>
|
|
| 169 |
- <property name="visible">True</property>
|
|
| 170 |
- <property name="can_focus">False</property>
|
|
| 171 |
- <property name="halign">start</property>
|
|
| 172 |
- <property name="wrap">True</property>
|
|
| 173 |
- <property name="xalign">0</property>
|
|
| 174 |
- </object>
|
|
| 175 |
- <packing>
|
|
| 176 |
- <property name="expand">False</property>
|
|
| 177 |
- <property name="fill">True</property>
|
|
| 178 |
- <property name="position">1</property>
|
|
| 179 |
- </packing>
|
|
| 180 |
- </child>
|
|
| 181 |
- </object>
|
|
| 182 |
- <packing>
|
|
| 183 |
- <property name="expand">False</property>
|
|
| 184 |
- <property name="fill">True</property>
|
|
| 185 |
- <property name="position">4</property>
|
|
| 186 |
- </packing>
|
|
| 187 |
- </child>
|
|
| 188 |
- <child>
|
|
| 189 |
- <object class="GtkButtonBox">
|
|
| 190 |
- <property name="visible">True</property>
|
|
| 191 |
- <property name="can_focus">False</property>
|
|
| 192 |
- <property name="margin_top">12</property>
|
|
| 193 |
- <property name="spacing">6</property>
|
|
| 194 |
- <property name="layout_style">end</property>
|
|
| 195 |
- <child>
|
|
| 196 |
- <object class="GtkButton" id="reset_button">
|
|
| 197 |
- <property name="label" translatable="yes">_Reset to default</property>
|
|
| 198 |
- <property name="visible">True</property>
|
|
| 199 |
- <property name="sensitive">False</property>
|
|
| 200 |
- <property name="can_focus">True</property>
|
|
| 201 |
- <property name="receives_default">False</property>
|
|
| 202 |
- <property name="use_underline">True</property>
|
|
| 203 |
- <signal name="clicked" handler="on_reset_button_clicked" swapped="no"/>
|
|
| 204 |
- <style>
|
|
| 205 |
- <class name="destructive-action"/>
|
|
| 206 |
- </style>
|
|
| 207 |
- </object>
|
|
| 208 |
- <packing>
|
|
| 209 |
- <property name="expand">False</property>
|
|
| 210 |
- <property name="fill">True</property>
|
|
| 211 |
- <property name="position">0</property>
|
|
| 212 |
- </packing>
|
|
| 213 |
- </child>
|
|
| 214 |
- <child>
|
|
| 215 |
- <object class="GtkButton" id="advanced_close_button">
|
|
| 216 |
- <property name="label">gtk-close</property>
|
|
| 217 |
- <property name="visible">True</property>
|
|
| 218 |
- <property name="can_focus">True</property>
|
|
| 219 |
- <property name="can_default">True</property>
|
|
| 220 |
- <property name="receives_default">False</property>
|
|
| 221 |
- <property name="use_stock">True</property>
|
|
| 222 |
- <signal name="clicked" handler="on_advanced_close_button_clicked" swapped="no"/>
|
|
| 223 |
- </object>
|
|
| 224 |
- <packing>
|
|
| 225 |
- <property name="expand">False</property>
|
|
| 226 |
- <property name="fill">False</property>
|
|
| 227 |
- <property name="position">1</property>
|
|
| 228 |
- </packing>
|
|
| 229 |
- </child>
|
|
| 230 |
- </object>
|
|
| 231 |
- <packing>
|
|
| 232 |
- <property name="expand">False</property>
|
|
| 233 |
- <property name="fill">True</property>
|
|
| 234 |
- <property name="position">5</property>
|
|
| 235 |
- </packing>
|
|
| 236 |
- </child>
|
|
| 237 |
- </object>
|
|
| 238 |
- </child>
|
|
| 239 |
- </object>
|
|
| 240 |
-</interface>
|
| ... | ... | @@ -21,12 +21,14 @@ |
| 21 | 21 |
|
| 22 | 22 |
from enum import IntEnum, unique
|
| 23 | 23 |
|
| 24 |
-from gi.repository import Gtk
|
|
| 24 |
+from gi.repository import Gdk
|
|
| 25 | 25 |
from gi.repository import GLib
|
| 26 |
+from gi.repository import Gtk
|
|
| 26 | 27 |
from gi.repository import Pango
|
| 27 | 28 |
|
| 28 | 29 |
from gajim.common import app
|
| 29 | 30 |
from gajim.common.i18n import _
|
| 31 |
+from gajim.common.i18n import Q_
|
|
| 30 | 32 |
|
| 31 | 33 |
from gajim.gtk.util import get_builder
|
| 32 | 34 |
|
| ... | ... | @@ -37,16 +39,19 @@ class Column(IntEnum): |
| 37 | 39 |
VALUE = 1
|
| 38 | 40 |
TYPE = 2
|
| 39 | 41 |
|
| 42 |
+ |
|
| 40 | 43 |
def rate_limit(rate):
|
| 41 | 44 |
"""
|
| 42 | 45 |
Call func at most *rate* times per second
|
| 43 | 46 |
"""
|
| 44 | 47 |
def decorator(func):
|
| 45 | 48 |
timeout = [None]
|
| 49 |
+ |
|
| 46 | 50 |
def f(*args, **kwargs):
|
| 47 | 51 |
if timeout[0] is not None:
|
| 48 | 52 |
GLib.source_remove(timeout[0])
|
| 49 | 53 |
timeout[0] = None
|
| 54 |
+ |
|
| 50 | 55 |
def timeout_func():
|
| 51 | 56 |
func(*args, **kwargs)
|
| 52 | 57 |
timeout[0] = None
|
| ... | ... | @@ -54,12 +59,14 @@ def rate_limit(rate): |
| 54 | 59 |
return f
|
| 55 | 60 |
return decorator
|
| 56 | 61 |
|
| 62 |
+ |
|
| 57 | 63 |
def tree_model_iter_children(model, treeiter):
|
| 58 | 64 |
it = model.iter_children(treeiter)
|
| 59 | 65 |
while it:
|
| 60 | 66 |
yield it
|
| 61 | 67 |
it = model.iter_next(it)
|
| 62 | 68 |
|
| 69 |
+ |
|
| 63 | 70 |
def tree_model_pre_order(model, treeiter):
|
| 64 | 71 |
yield treeiter
|
| 65 | 72 |
for childiter in tree_model_iter_children(model, treeiter):
|
| ... | ... | @@ -67,10 +74,17 @@ def tree_model_pre_order(model, treeiter): |
| 67 | 74 |
yield it
|
| 68 | 75 |
|
| 69 | 76 |
|
| 70 |
-class AdvancedConfig:
|
|
| 71 |
- def __init__(self, transient):
|
|
| 72 |
- self._ui = get_builder('advanced_configuration_window.ui')
|
|
| 73 |
- self._ui.advanced_configuration_window.set_transient_for(transient)
|
|
| 77 |
+class AdvancedConfig(Gtk.ApplicationWindow):
|
|
| 78 |
+ def __init__(self):
|
|
| 79 |
+ Gtk.ApplicationWindow.__init__(self)
|
|
| 80 |
+ self.set_application(app.app)
|
|
| 81 |
+ self.set_position(Gtk.WindowPosition.CENTER)
|
|
| 82 |
+ self.set_show_menubar(False)
|
|
| 83 |
+ self.set_name('AdvancedConfig')
|
|
| 84 |
+ self.set_title(_('Advanced Configuration Editor (ACE)'))
|
|
| 85 |
+ |
|
| 86 |
+ self._ui = get_builder('advanced_configuration.ui')
|
|
| 87 |
+ self.add(self._ui.box)
|
|
| 74 | 88 |
|
| 75 | 89 |
# Format:
|
| 76 | 90 |
# key = option name (root/subopt/opt separated by \n then)
|
| ... | ... | @@ -80,53 +94,59 @@ class AdvancedConfig: |
| 80 | 94 |
# For i18n
|
| 81 | 95 |
self.right_true_dict = {True: _('Activated'), False: _('Deactivated')}
|
| 82 | 96 |
self.types = {
|
| 83 |
- 'boolean': _('Boolean'),
|
|
| 84 |
- 'integer': _('Integer'),
|
|
| 85 |
- 'string': _('Text'),
|
|
| 86 |
- 'color': _('Color')}
|
|
| 97 |
+ 'boolean': Q_('?config type:Boolean'),
|
|
| 98 |
+ 'integer': Q_('?config type:Integer'),
|
|
| 99 |
+ 'string': Q_('?config type:Text'),
|
|
| 100 |
+ 'color': Q_('?config type:Color')}
|
|
| 87 | 101 |
|
| 88 | 102 |
treeview = self._ui.advanced_treeview
|
| 89 | 103 |
self.treeview = treeview
|
| 90 | 104 |
self.model = Gtk.TreeStore(str, str, str)
|
| 91 |
- self.fill_model()
|
|
| 105 |
+ self._fill_model()
|
|
| 92 | 106 |
self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
| 93 | 107 |
self.modelfilter = self.model.filter_new()
|
| 94 |
- self.modelfilter.set_visible_func(self.visible_func)
|
|
| 108 |
+ self.modelfilter.set_visible_func(self._visible_func)
|
|
| 95 | 109 |
|
| 96 | 110 |
renderer_text = Gtk.CellRendererText()
|
| 97 |
- col = Gtk.TreeViewColumn(_('Preference Name'), renderer_text, text=0)
|
|
| 111 |
+ renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END)
|
|
| 112 |
+ col = Gtk.TreeViewColumn(Q_('?config:Preference Name'),
|
|
| 113 |
+ renderer_text, text=0)
|
|
| 98 | 114 |
treeview.insert_column(col, -1)
|
| 115 |
+ col.props.expand = True
|
|
| 116 |
+ col.props.sizing = Gtk.TreeViewColumnSizing.FIXED
|
|
| 99 | 117 |
col.set_resizable(True)
|
| 100 | 118 |
|
| 101 |
- renderer_text = Gtk.CellRendererText()
|
|
| 102 |
- renderer_text.connect('edited', self.on_config_edited)
|
|
| 103 |
- renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END)
|
|
| 104 |
- col = Gtk.TreeViewColumn(_('Value'), renderer_text, text=1)
|
|
| 119 |
+ self.renderer_text = Gtk.CellRendererText()
|
|
| 120 |
+ self.renderer_text.connect('edited', self._on_config_edited)
|
|
| 121 |
+ self.renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END)
|
|
| 122 |
+ col = Gtk.TreeViewColumn(
|
|
| 123 |
+ Q_('?config:Value'), self.renderer_text, text=1)
|
|
| 105 | 124 |
treeview.insert_column(col, -1)
|
| 106 |
- col.set_cell_data_func(renderer_text, self.cb_value_column_data)
|
|
| 107 |
- |
|
| 108 |
- col.props.resizable = True
|
|
| 125 |
+ col.set_cell_data_func(self.renderer_text,
|
|
| 126 |
+ self._value_column_data_callback)
|
|
| 109 | 127 |
col.props.expand = True
|
| 110 | 128 |
col.props.sizing = Gtk.TreeViewColumnSizing.FIXED
|
| 129 |
+ col.set_resizable(True)
|
|
| 111 | 130 |
|
| 112 | 131 |
renderer_text = Gtk.CellRendererText()
|
| 113 |
- col = Gtk.TreeViewColumn(_('Type'), renderer_text, text=2)
|
|
| 132 |
+ col = Gtk.TreeViewColumn(Q_('?config:Type'), renderer_text, text=2)
|
|
| 114 | 133 |
treeview.insert_column(col, -1)
|
| 115 | 134 |
col.props.sizing = Gtk.TreeViewColumnSizing.FIXED
|
| 116 | 135 |
|
| 117 | 136 |
treeview.set_model(self.modelfilter)
|
| 118 | 137 |
|
| 119 |
- # Connect signal for selection change
|
|
| 120 |
- treeview.get_selection().connect('changed',
|
|
| 121 |
- self.on_advanced_treeview_selection_changed)
|
|
| 122 |
- |
|
| 138 |
+ self.connect('key-press-event', self._on_key_press)
|
|
| 123 | 139 |
self._ui.connect_signals(self)
|
| 124 |
- self._ui.advanced_configuration_window.show_all()
|
|
| 125 |
- app.interface.instances['advanced_config'] = self
|
|
| 140 |
+ self.show_all()
|
|
| 126 | 141 |
|
| 127 |
- def cb_value_column_data(self, col, cell, model, iter_, data):
|
|
| 142 |
+ def _on_key_press(self, _widget, event):
|
|
| 143 |
+ editing = self.renderer_text.get_property('editing')
|
|
| 144 |
+ if event.keyval == Gdk.KEY_Escape and not editing:
|
|
| 145 |
+ self.destroy()
|
|
| 146 |
+ |
|
| 147 |
+ def _value_column_data_callback(self, col, cell, model, iter_, data):
|
|
| 128 | 148 |
"""
|
| 129 |
- Check if it's boolean or holds password stuff and if yes make the
|
|
| 149 |
+ Check if it's boolean or holds password stuff and if yes, make the
|
|
| 130 | 150 |
cellrenderertext not editable, else - it's editable
|
| 131 | 151 |
"""
|
| 132 | 152 |
optname = model[iter_][Column.NAME]
|
| ... | ... | @@ -137,7 +157,7 @@ class AdvancedConfig: |
| 137 | 157 |
cell.set_property('editable', True)
|
| 138 | 158 |
|
| 139 | 159 |
@staticmethod
|
| 140 |
- def get_option_path(model, iter_):
|
|
| 160 |
+ def _get_option_path(model, iter_):
|
|
| 141 | 161 |
# It looks like path made from reversed array
|
| 142 | 162 |
# path[0] is the true one optname
|
| 143 | 163 |
# path[1] is the key name
|
| ... | ... | @@ -150,11 +170,11 @@ class AdvancedConfig: |
| 150 | 170 |
parent = model.iter_parent(parent)
|
| 151 | 171 |
return path
|
| 152 | 172 |
|
| 153 |
- def on_advanced_treeview_selection_changed(self, treeselection):
|
|
| 173 |
+ def _on_treeview_selection_changed(self, treeselection):
|
|
| 154 | 174 |
model, iter_ = treeselection.get_selected()
|
| 155 | 175 |
# Check for GtkTreeIter
|
| 156 | 176 |
if iter_:
|
| 157 |
- opt_path = self.get_option_path(model, iter_)
|
|
| 177 |
+ opt_path = self._get_option_path(model, iter_)
|
|
| 158 | 178 |
# Get text from first column in this row
|
| 159 | 179 |
desc = None
|
| 160 | 180 |
if len(opt_path) == 3:
|
| ... | ... | @@ -164,23 +184,22 @@ class AdvancedConfig: |
| 164 | 184 |
if desc:
|
| 165 | 185 |
self._ui.description.set_text(desc)
|
| 166 | 186 |
else:
|
| 167 |
- # We talk about option description in advanced configuration editor
|
|
| 168 |
- self._ui.description.set_text(_('(None)'))
|
|
| 169 |
- if len(opt_path) == 3 or (len(opt_path) == 1 and not \
|
|
| 170 |
- model.iter_has_child(iter_)):
|
|
| 187 |
+ self._ui.description.set_text(Q_('?config description:None'))
|
|
| 188 |
+ if (len(opt_path) == 3 or
|
|
| 189 |
+ (len(opt_path) == 1 and not model.iter_has_child(iter_))):
|
|
| 171 | 190 |
self._ui.reset_button.set_sensitive(True)
|
| 172 | 191 |
else:
|
| 173 | 192 |
self._ui.reset_button.set_sensitive(False)
|
| 174 | 193 |
else:
|
| 175 | 194 |
self._ui.reset_button.set_sensitive(False)
|
| 176 | 195 |
|
| 177 |
- def remember_option(self, option, oldval, newval):
|
|
| 196 |
+ def _remember_option(self, option, oldval, newval):
|
|
| 178 | 197 |
if option in self.changed_opts:
|
| 179 | 198 |
self.changed_opts[option] = (self.changed_opts[option][0], newval)
|
| 180 | 199 |
else:
|
| 181 | 200 |
self.changed_opts[option] = (oldval, newval)
|
| 182 | 201 |
|
| 183 |
- def on_advanced_treeview_row_activated(self, treeview, path, column):
|
|
| 202 |
+ def _on_treeview_row_activated(self, treeview, path, column):
|
|
| 184 | 203 |
modelpath = self.modelfilter.convert_path_to_child_path(path)
|
| 185 | 204 |
modelrow = self.model[modelpath]
|
| 186 | 205 |
option = modelrow[0]
|
| ... | ... | @@ -195,22 +214,26 @@ class AdvancedConfig: |
| 195 | 214 |
modelpath.up()
|
| 196 | 215 |
keyrow = self.model[modelpath]
|
| 197 | 216 |
key = keyrow[0]
|
| 198 |
- self.remember_option(option + '\n' + key + '\n' + optname,
|
|
| 199 |
- modelrow[1], newval)
|
|
| 217 |
+ self._remember_option(
|
|
| 218 |
+ option + '\n' + key + '\n' + optname,
|
|
| 219 |
+ modelrow[1],
|
|
| 220 |
+ newval)
|
|
| 200 | 221 |
app.config.set_per(optname, key, option, newval)
|
| 201 | 222 |
else:
|
| 202 |
- self.remember_option(option, modelrow[1], newval)
|
|
| 223 |
+ self._remember_option(option, modelrow[1], newval)
|
|
| 203 | 224 |
app.config.set(option, newval)
|
| 204 | 225 |
modelrow[1] = self.right_true_dict[newval]
|
| 205 |
- self.check_for_restart()
|
|
| 226 |
+ self._check_for_restart()
|
|
| 206 | 227 |
|
| 207 |
- def check_for_restart(self):
|
|
| 228 |
+ def _check_for_restart(self):
|
|
| 208 | 229 |
self._ui.restart_warning.hide()
|
| 209 | 230 |
for opt in self.changed_opts:
|
| 210 | 231 |
opt_path = opt.split('\n')
|
| 211 | 232 |
if len(opt_path) == 3:
|
| 212 |
- restart = app.config.get_restart_per(opt_path[2], opt_path[1],
|
|
| 213 |
- opt_path[0])
|
|
| 233 |
+ restart = app.config.get_restart_per(
|
|
| 234 |
+ opt_path[2],
|
|
| 235 |
+ opt_path[1],
|
|
| 236 |
+ opt_path[0])
|
|
| 214 | 237 |
else:
|
| 215 | 238 |
restart = app.config.get_restart(opt_path[0])
|
| 216 | 239 |
if restart:
|
| ... | ... | @@ -219,38 +242,36 @@ class AdvancedConfig: |
| 219 | 242 |
self._ui.restart_warning.show()
|
| 220 | 243 |
break
|
| 221 | 244 |
|
| 222 |
- def on_config_edited(self, cell, path, text):
|
|
| 245 |
+ def _on_config_edited(self, cell, path, text):
|
|
| 223 | 246 |
# Convert modelfilter path to model path
|
| 224 | 247 |
path = Gtk.TreePath.new_from_string(path)
|
| 225 | 248 |
modelpath = self.modelfilter.convert_path_to_child_path(path)
|
| 226 | 249 |
modelrow = self.model[modelpath]
|
| 227 | 250 |
option = modelrow[0]
|
| 228 | 251 |
if modelpath.get_depth() > 2:
|
| 229 |
- modelpath.up() # Get parent
|
|
| 252 |
+ modelpath.up() # Get parent
|
|
| 230 | 253 |
keyrow = self.model[modelpath]
|
| 231 | 254 |
key = keyrow[0]
|
| 232 |
- modelpath.up() # Get parent
|
|
| 255 |
+ modelpath.up() # Get parent
|
|
| 233 | 256 |
optnamerow = self.model[modelpath]
|
| 234 | 257 |
optname = optnamerow[0]
|
| 235 |
- self.remember_option(option + '\n' + key + '\n' + optname, modelrow[1],
|
|
| 236 |
- text)
|
|
| 258 |
+ self._remember_option(
|
|
| 259 |
+ option + '\n' + key + '\n' + optname,
|
|
| 260 |
+ modelrow[1],
|
|
| 261 |
+ text)
|
|
| 237 | 262 |
app.config.set_per(optname, key, option, text)
|
| 238 | 263 |
else:
|
| 239 |
- self.remember_option(option, modelrow[1], text)
|
|
| 264 |
+ self._remember_option(option, modelrow[1], text)
|
|
| 240 | 265 |
app.config.set(option, text)
|
| 241 | 266 |
modelrow[1] = text
|
| 242 |
- self.check_for_restart()
|
|
| 243 |
- |
|
| 244 |
- @staticmethod
|
|
| 245 |
- def on_advanced_configuration_window_destroy(widget):
|
|
| 246 |
- del app.interface.instances['advanced_config']
|
|
| 267 |
+ self._check_for_restart()
|
|
| 247 | 268 |
|
| 248 |
- def on_reset_button_clicked(self, widget):
|
|
| 269 |
+ def _on_reset_button_clicked(self, widget):
|
|
| 249 | 270 |
model, iter_ = self.treeview.get_selection().get_selected()
|
| 250 | 271 |
# Check for GtkTreeIter
|
| 251 | 272 |
if iter_:
|
| 252 | 273 |
path = model.get_path(iter_)
|
| 253 |
- opt_path = self.get_option_path(model, iter_)
|
|
| 274 |
+ opt_path = self._get_option_path(model, iter_)
|
|
| 254 | 275 |
if len(opt_path) == 1:
|
| 255 | 276 |
default = app.config.get_default(opt_path[0])
|
| 256 | 277 |
elif len(opt_path) == 3:
|
| ... | ... | @@ -267,36 +288,38 @@ class AdvancedConfig: |
| 267 | 288 |
optname = optnamerow[0]
|
| 268 | 289 |
keyrow = self.model[modelpath[:2]]
|
| 269 | 290 |
key = keyrow[0]
|
| 270 |
- self.remember_option(option + '\n' + key + '\n' + optname,
|
|
| 271 |
- modelrow[Column.VALUE], default)
|
|
| 291 |
+ self._remember_option(
|
|
| 292 |
+ option + '\n' + key + '\n' + optname,
|
|
| 293 |
+ modelrow[Column.VALUE],
|
|
| 294 |
+ default)
|
|
| 272 | 295 |
app.config.set_per(optname, key, option, default)
|
| 273 | 296 |
else:
|
| 274 |
- self.remember_option(option, modelrow[Column.VALUE], default)
|
|
| 297 |
+ self._remember_option(
|
|
| 298 |
+ option,
|
|
| 299 |
+ modelrow[Column.VALUE],
|
|
| 300 |
+ default)
|
|
| 275 | 301 |
app.config.set(option, default)
|
| 276 | 302 |
modelrow[Column.VALUE] = self.right_true_dict[default]
|
| 277 |
- self.check_for_restart()
|
|
| 303 |
+ self._check_for_restart()
|
|
| 278 | 304 |
else:
|
| 279 | 305 |
if str(default) == model[iter_][Column.VALUE]:
|
| 280 | 306 |
return
|
| 281 |
- self.on_config_edited(None, path.to_string(), str(default))
|
|
| 307 |
+ self._on_config_edited(None, path.to_string(), str(default))
|
|
| 282 | 308 |
|
| 283 |
- def on_advanced_close_button_clicked(self, widget):
|
|
| 284 |
- self._ui.advanced_configuration_window.destroy()
|
|
| 285 |
- |
|
| 286 |
- def fill_model(self, node=None, parent=None):
|
|
| 309 |
+ def _fill_model(self, node=None, parent=None):
|
|
| 287 | 310 |
for item, option in app.config.get_children(node):
|
| 288 | 311 |
name = item[-1]
|
| 289 |
- if option is None: # Node
|
|
| 312 |
+ if option is None: # Node
|
|
| 290 | 313 |
newparent = self.model.append(parent, [name, '', ''])
|
| 291 |
- self.fill_model(item, newparent)
|
|
| 292 |
- else: # Leaf
|
|
| 314 |
+ self._fill_model(item, newparent)
|
|
| 315 |
+ else:
|
|
| 293 | 316 |
if len(item) == 1:
|
| 294 | 317 |
type_ = self.types[app.config.get_type(name)]
|
| 295 | 318 |
elif len(item) == 3:
|
| 296 |
- type_ = self.types[app.config.get_type_per(item[0],
|
|
| 297 |
- item[2])]
|
|
| 319 |
+ type_ = self.types[app.config.get_type_per(
|
|
| 320 |
+ item[0], item[2])]
|
|
| 298 | 321 |
if name == 'password':
|
| 299 |
- value = _('Hidden')
|
|
| 322 |
+ value = Q_('?password:Hidden')
|
|
| 300 | 323 |
else:
|
| 301 | 324 |
if type_ == self.types['boolean']:
|
| 302 | 325 |
value = self.right_true_dict[option]
|
| ... | ... | @@ -307,22 +330,22 @@ class AdvancedConfig: |
| 307 | 330 |
value = option
|
| 308 | 331 |
self.model.append(parent, [name, value, type_])
|
| 309 | 332 |
|
| 310 |
- def visible_func(self, model, treeiter, data):
|
|
| 311 |
- search_string = self._ui.advanced_entry.get_text().lower()
|
|
| 333 |
+ def _visible_func(self, model, treeiter, data):
|
|
| 334 |
+ search_string = self._ui.filter_entry.get_text().lower()
|
|
| 312 | 335 |
for it in tree_model_pre_order(model, treeiter):
|
| 313 | 336 |
if model[it][Column.TYPE] != '':
|
| 314 |
- opt_path = self.get_option_path(model, it)
|
|
| 337 |
+ opt_path = self._get_option_path(model, it)
|
|
| 315 | 338 |
if len(opt_path) == 3:
|
| 316 | 339 |
desc = app.config.get_desc_per(opt_path[2], opt_path[0])
|
| 317 | 340 |
elif len(opt_path) == 1:
|
| 318 | 341 |
desc = app.config.get_desc(opt_path[0])
|
| 319 |
- if search_string in model[it][Column.NAME] or (desc and \
|
|
| 320 |
- search_string in desc.lower()):
|
|
| 342 |
+ if (search_string in model[it][Column.NAME] or
|
|
| 343 |
+ (desc and search_string in desc.lower())):
|
|
| 321 | 344 |
return True
|
| 322 | 345 |
return False
|
| 323 | 346 |
|
| 324 | 347 |
@rate_limit(3)
|
| 325 |
- def on_advanced_entry_changed(self, widget):
|
|
| 348 |
+ def _on_filter_entry_changed(self, widget):
|
|
| 326 | 349 |
self.modelfilter.refilter()
|
| 327 | 350 |
if not widget.get_text():
|
| 328 | 351 |
# Maybe the expanded rows should be remembered here ...
|
| ... | ... | @@ -1003,8 +1003,9 @@ class Preferences(Gtk.ApplicationWindow): |
| 1003 | 1003 |
app.set_win_debug_mode(widget.get_active())
|
| 1004 | 1004 |
|
| 1005 | 1005 |
# Advanced Config Editor (ACE)
|
| 1006 |
- def on_open_advanced_editor_button_clicked(self, widget, data=None):
|
|
| 1007 |
- if 'advanced_config' in app.interface.instances:
|
|
| 1008 |
- app.interface.instances['advanced_config'].window.present()
|
|
| 1006 |
+ def on_open_advanced_editor_button_clicked(self, _widget):
|
|
| 1007 |
+ window = app.get_app_window(AdvancedConfig)
|
|
| 1008 |
+ if window is None:
|
|
| 1009 |
+ AdvancedConfig()
|
|
| 1009 | 1010 |
else:
|
| 1010 |
- app.interface.instances['advanced_config'] = AdvancedConfig(self)
|
|
| 1011 |
+ window.present()
|