change: Removed some settings that are no longer needed from our global settings dialog.

This commit is contained in:
Manuel Cortez 2024-05-22 17:42:23 -06:00
parent 14a956d207
commit 503bf72b11
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
3 changed files with 4 additions and 62 deletions

View File

@ -6,7 +6,6 @@ import config
import languageHandler import languageHandler
import application import application
from pubsub import pub from pubsub import pub
from mysc import autostart as autostart_windows
from wxUI.dialogs import configuration from wxUI.dialogs import configuration
from wxUI import commonMessageDialogs from wxUI import commonMessageDialogs
@ -48,21 +47,16 @@ class globalSettingsController(object):
self.dialog.create_general(langs,self.kmfriendlies) self.dialog.create_general(langs,self.kmfriendlies)
self.dialog.general.language.SetSelection(id) self.dialog.general.language.SetSelection(id)
self.dialog.general.km.SetSelection(self.kmid) self.dialog.general.km.SetSelection(self.kmid)
if paths.mode == "installed":
self.dialog.set_value("general", "autostart", config.app["app-settings"]["autostart"])
else:
self.dialog.general.autostart.Enable(False)
self.dialog.set_value("general", "ask_at_exit", config.app["app-settings"]["ask_at_exit"]) self.dialog.set_value("general", "ask_at_exit", config.app["app-settings"]["ask_at_exit"])
self.dialog.set_value("general", "no_streaming", config.app["app-settings"]["no_streaming"]) self.dialog.set_value("general", "no_streaming", config.app["app-settings"]["no_streaming"])
self.dialog.set_value("general", "play_ready_sound", config.app["app-settings"]["play_ready_sound"]) self.dialog.set_value("general", "play_ready_sound", config.app["app-settings"]["play_ready_sound"])
self.dialog.set_value("general", "speak_ready_msg", config.app["app-settings"]["speak_ready_msg"]) self.dialog.set_value("general", "speak_ready_msg", config.app["app-settings"]["speak_ready_msg"])
self.dialog.set_value("general", "handle_longtweets", config.app["app-settings"]["handle_longtweets"]) self.dialog.set_value("general", "read_long_posts_in_gui", config.app["app-settings"]["read_long_posts_in_gui"])
self.dialog.set_value("general", "use_invisible_shorcuts", config.app["app-settings"]["use_invisible_keyboard_shorcuts"]) self.dialog.set_value("general", "use_invisible_shorcuts", config.app["app-settings"]["use_invisible_keyboard_shorcuts"])
self.dialog.set_value("general", "disable_sapi5", config.app["app-settings"]["voice_enabled"]) self.dialog.set_value("general", "disable_sapi5", config.app["app-settings"]["voice_enabled"])
self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"]) self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"])
self.dialog.set_value("general", "update_period", config.app["app-settings"]["update_period"]) self.dialog.set_value("general", "update_period", config.app["app-settings"]["update_period"])
self.dialog.set_value("general", "check_for_updates", config.app["app-settings"]["check_for_updates"]) self.dialog.set_value("general", "check_for_updates", config.app["app-settings"]["check_for_updates"])
self.dialog.set_value("general", "remember_mention_and_longtweet", config.app["app-settings"]["remember_mention_and_longtweet"])
proxyTypes = [_("System default"), _("HTTP"), _("SOCKS v4"), _("SOCKS v4 with DNS support"), _("SOCKS v5"), _("SOCKS v5 with DNS support")] proxyTypes = [_("System default"), _("HTTP"), _("SOCKS v4"), _("SOCKS v4 with DNS support"), _("SOCKS v5"), _("SOCKS v5 with DNS support")]
self.dialog.create_proxy(proxyTypes) self.dialog.create_proxy(proxyTypes)
try: try:
@ -92,9 +86,6 @@ class globalSettingsController(object):
kmFile.close() kmFile.close()
log.debug("Triggered app restart due to a keymap change.") log.debug("Triggered app restart due to a keymap change.")
self.needs_restart = True self.needs_restart = True
if config.app["app-settings"]["autostart"] != self.dialog.get_value("general", "autostart") and paths.mode == "installed":
config.app["app-settings"]["autostart"] = self.dialog.get_value("general", "autostart")
autostart_windows.setAutoStart(application.name, enable=self.dialog.get_value("general", "autostart"))
if config.app["app-settings"]["use_invisible_keyboard_shorcuts"] != self.dialog.get_value("general", "use_invisible_shorcuts"): if config.app["app-settings"]["use_invisible_keyboard_shorcuts"] != self.dialog.get_value("general", "use_invisible_shorcuts"):
config.app["app-settings"]["use_invisible_keyboard_shorcuts"] = self.dialog.get_value("general", "use_invisible_shorcuts") config.app["app-settings"]["use_invisible_keyboard_shorcuts"] = self.dialog.get_value("general", "use_invisible_shorcuts")
pub.sendMessage("invisible-shorcuts-changed", registered=self.dialog.get_value("general", "use_invisible_shorcuts")) pub.sendMessage("invisible-shorcuts-changed", registered=self.dialog.get_value("general", "use_invisible_shorcuts"))
@ -109,11 +100,10 @@ class globalSettingsController(object):
config.app["app-settings"]["voice_enabled"] = self.dialog.get_value("general", "disable_sapi5") config.app["app-settings"]["voice_enabled"] = self.dialog.get_value("general", "disable_sapi5")
config.app["app-settings"]["hide_gui"] = self.dialog.get_value("general", "hide_gui") config.app["app-settings"]["hide_gui"] = self.dialog.get_value("general", "hide_gui")
config.app["app-settings"]["ask_at_exit"] = self.dialog.get_value("general", "ask_at_exit") config.app["app-settings"]["ask_at_exit"] = self.dialog.get_value("general", "ask_at_exit")
config.app["app-settings"]["handle_longtweets"] = self.dialog.get_value("general", "handle_longtweets") config.app["app-settings"]["read_long_posts_in_gui"] = self.dialog.get_value("general", "read_long_posts_in_gui")
config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value("general", "play_ready_sound") config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value("general", "play_ready_sound")
config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value("general", "speak_ready_msg") config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value("general", "speak_ready_msg")
config.app["app-settings"]["check_for_updates"] = self.dialog.get_value("general", "check_for_updates") config.app["app-settings"]["check_for_updates"] = self.dialog.get_value("general", "check_for_updates")
config.app["app-settings"]["remember_mention_and_longtweet"] = self.dialog.get_value("general", "remember_mention_and_longtweet")
if config.app["proxy"]["type"]!=self.dialog.get_value("proxy", "type") or config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"): if config.app["proxy"]["type"]!=self.dialog.get_value("proxy", "type") or config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"):
if self.is_started == True: if self.is_started == True:
self.needs_restart = True self.needs_restart = True

View File

@ -1,44 +0,0 @@
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import str
import winreg
import os
import sys
from platform_utils import paths
RUN_REGKEY = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
def is_installed(app_subkey):
"""Checks if the currently running copy is installed or portable variant. Requires the name of the application subkey found under the uninstall section in Windows registry."""
try:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s" % app_subkey)
inst_dir = winreg.QueryValueEx(key,"InstallLocation")[0]
except WindowsError:
return False
winreg.CloseKey(key)
try:
return os.stat(inst_dir) == os.stat(paths.app_path())
except WindowsError:
return False
def getAutoStart(app_name):
"""Queries if the automatic startup should be set for the application or not, depending on it's current state."""
try:
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RUN_REGKEY)
val = winreg.QueryValueEx(key, str(app_name))[0]
return os.stat(val) == os.stat(sys.argv[0])
except (WindowsError, OSError):
return False
def setAutoStart(app_name, enable=True):
"""Configures automatic startup for the application, if the enable argument is set to True. If set to False, deletes the application AutoStart value."""
if getAutoStart(app_name) == enable:
return
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RUN_REGKEY, 0, winreg.KEY_WRITE)
if enable:
winreg.SetValueEx(key, str(app_name), None, winreg.REG_SZ, paths.get_executable())
else:
winreg.DeleteValue(key, str(app_name))

View File

@ -19,9 +19,7 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
langBox.Add(language, 0, wx.ALL, 5) langBox.Add(language, 0, wx.ALL, 5)
langBox.Add(self.language, 0, wx.ALL, 5) langBox.Add(self.language, 0, wx.ALL, 5)
sizer.Add(langBox, 0, wx.ALL, 5) sizer.Add(langBox, 0, wx.ALL, 5)
self.autostart = wx.CheckBox(self, -1, _(u"Run {0} at Windows startup").format(application.name,))
self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting {0}").format(application.name,)) self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting {0}").format(application.name,))
sizer.Add(self.autostart, 0, wx.ALL, 5)
sizer.Add(self.ask_at_exit, 0, wx.ALL, 5) sizer.Add(self.ask_at_exit, 0, wx.ALL, 5)
self.no_streaming = wx.CheckBox(self, -1, _(U"Disable Streaming functions")) self.no_streaming = wx.CheckBox(self, -1, _(U"Disable Streaming functions"))
sizer.Add(self.no_streaming, 0, wx.ALL, 5) sizer.Add(self.no_streaming, 0, wx.ALL, 5)
@ -42,10 +40,8 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
sizer.Add(self.disable_sapi5, 0, wx.ALL, 5) sizer.Add(self.disable_sapi5, 0, wx.ALL, 5)
self.hide_gui = wx.CheckBox(self, -1, _(u"Hide GUI on launch")) self.hide_gui = wx.CheckBox(self, -1, _(u"Hide GUI on launch"))
sizer.Add(self.hide_gui, 0, wx.ALL, 5) sizer.Add(self.hide_gui, 0, wx.ALL, 5)
self.handle_longtweets = wx.CheckBox(self, wx.ID_ANY, _(u"Use Codeofdusk's longtweet handlers (may decrease client performance)")) self.read_long_posts_in_gui = wx.CheckBox(self, wx.ID_ANY, _("Read long posts in GUI"))
sizer.Add(self.handle_longtweets, 0, wx.ALL, 5) sizer.Add(self.read_long_posts_in_gui, 0, wx.ALL, 5)
self.remember_mention_and_longtweet = wx.CheckBox(self, -1, _(u"Remember state for mention all and long tweet"))
sizer.Add(self.remember_mention_and_longtweet, 0, wx.ALL, 5)
kmbox = wx.BoxSizer(wx.VERTICAL) kmbox = wx.BoxSizer(wx.VERTICAL)
km_label = wx.StaticText(self, -1, _(u"Keymap")) km_label = wx.StaticText(self, -1, _(u"Keymap"))
self.km = wx.ComboBox(self, -1, choices=keymaps, style=wx.CB_READONLY) self.km = wx.ComboBox(self, -1, choices=keymaps, style=wx.CB_READONLY)