parent
0cd820a1c6
commit
d0a6da441b
2 changed files with 102 additions and 4 deletions
|
|
@ -1404,7 +1404,18 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Reset Voice Settings</property>
|
||||
<property name="name">voice_reset_all</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<signal name="pressed" handler="voice_reset_all" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
|
|
@ -1458,7 +1469,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=13 -->
|
||||
<!-- n-columns=2 n-rows=14 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="name">text_grid</property>
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1789,6 +1800,23 @@
|
|||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Reset Text Settings</property>
|
||||
<property name="name">text_reset_all</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<signal name="pressed" handler="text_reset_all" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">13</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
|
@ -1813,7 +1841,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=17 -->
|
||||
<!-- n-columns=2 n-rows=18 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="name">notification_grid</property>
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -2266,6 +2294,23 @@
|
|||
<property name="top-attach">11</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Reset Notification Settings</property>
|
||||
<property name="name">notification_reset_all</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<signal name="pressed" handler="notification_reset_all" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">17</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
|
|
@ -2284,7 +2329,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=6 -->
|
||||
<!-- n-columns=2 n-rows=7 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="name">core_grid</property>
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -2456,6 +2501,23 @@
|
|||
<property name="top-attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Reset Core Settings</property>
|
||||
<property name="name">core_reset_all</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<signal name="pressed" handler="core_reset_all" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ class MainSettingsWindow():
|
|||
self.rpc_file = rpc_file
|
||||
self.channel_file = channel_file
|
||||
|
||||
self.loading_config = False
|
||||
|
||||
builder = Gtk.Builder.new_from_file(pkg_resources.resource_filename(
|
||||
'discover_overlay', 'glade/settings.glade'))
|
||||
window = builder.get_object("settings_window")
|
||||
|
|
@ -251,6 +253,7 @@ class MainSettingsWindow():
|
|||
m2.set_value(i2, 0, _("Bottom"))
|
||||
|
||||
def read_config(self):
|
||||
self.loading_config = True
|
||||
self.widget['voice_advanced_grid'].hide()
|
||||
|
||||
# Read config and put into gui
|
||||
|
|
@ -528,6 +531,9 @@ class MainSettingsWindow():
|
|||
|
||||
self.widget['core_settings_min'].set_sensitive(self.show_sys_tray_icon)
|
||||
|
||||
self.loading_config = False
|
||||
|
||||
|
||||
def make_colour(self, col):
|
||||
col = json.loads(col)
|
||||
return Gdk.RGBA(col[0], col[1], col[2], col[3])
|
||||
|
|
@ -753,6 +759,8 @@ class MainSettingsWindow():
|
|||
f.write('--rpc --refresh-guilds')
|
||||
|
||||
def config_set(self, context, key, value):
|
||||
if self.loading_config:
|
||||
return
|
||||
config = ConfigParser(interpolation=None)
|
||||
config.read(self.config_file)
|
||||
if not context in config.sections():
|
||||
|
|
@ -761,6 +769,18 @@ class MainSettingsWindow():
|
|||
with open(self.config_file, 'w') as file:
|
||||
config.write(file)
|
||||
|
||||
def config_remove_section(self, context):
|
||||
if self.loading_config:
|
||||
return
|
||||
config = ConfigParser(interpolation=None)
|
||||
config.read(self.config_file)
|
||||
if context in config.sections():
|
||||
config.remove_section(context)
|
||||
else:
|
||||
log.error("Unable to remove section %s" % (context))
|
||||
with open(self.config_file, 'w') as file:
|
||||
config.write(file)
|
||||
|
||||
def voice_anchor_to_edge_changed(self, button):
|
||||
self.config_set("main", "floating", "False")
|
||||
|
||||
|
|
@ -1085,3 +1105,19 @@ class MainSettingsWindow():
|
|||
|
||||
def core_settings_min_changed(self, button):
|
||||
self.config_set("general", "start_min", "%s" % (button.get_active()))
|
||||
|
||||
def core_reset_all(self, button):
|
||||
self.config_remove_section("general")
|
||||
self.read_config()
|
||||
|
||||
def voice_reset_all(self, button):
|
||||
self.config_remove_section("main")
|
||||
self.read_config()
|
||||
|
||||
def text_reset_all(self, button):
|
||||
self.config_remove_section("text")
|
||||
self.read_config()
|
||||
|
||||
def notification_reset_all(self, button):
|
||||
self.config_remove_section("notification")
|
||||
self.read_config()
|
||||
Loading…
Add table
Add a link
Reference in a new issue