mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-02-18 07:11:09 -06:00
Refactor.
This commit is contained in:
parent
c7880b505e
commit
2169957627
@ -15,7 +15,7 @@ log_level = string(default="error")
|
||||
use_slow_audio_algo = boolean(default=False)
|
||||
load_keymap = string(default="default.keymap")
|
||||
use_Codeofdusk_audio_handlers=boolean(default=True)
|
||||
view_reverse_geocode_on_secondary = boolean(default=False)
|
||||
prefer_geocodes = boolean(default=False)
|
||||
[proxy]
|
||||
server = string(default="")
|
||||
port = string(default="")
|
||||
|
@ -1016,6 +1016,8 @@ class Controller(object):
|
||||
if hasattr(sound.URLPlayer,'stream'):
|
||||
return sound.URLPlayer.stop_audio(delete=True)
|
||||
tweet = buffer.get_tweet()
|
||||
if utils.is_geocoded(tweet) and config.app['app-settings']['use_Codeofdusk_audio_handlers'] and config.app['app-settings']['prefer_geocodes']:
|
||||
return self.reverse_geocode()
|
||||
url=None
|
||||
urls = utils.find_urls(tweet)
|
||||
if len(urls) == 1:
|
||||
@ -1030,8 +1032,6 @@ class Controller(object):
|
||||
output.speak("Opening media...",True)
|
||||
if sound.URLPlayer.is_playable(url=url,play=True,volume=buffer.session.settings["sound"]["volume"]) == False:
|
||||
return webbrowser.open_new_tab(url)
|
||||
elif utils.is_geocoded(tweet):
|
||||
return self.reverse_geocode()
|
||||
else:
|
||||
output.speak(_(u"Not actionable."), True)
|
||||
buffer.session.sound.play("error.ogg")
|
||||
@ -1043,7 +1043,7 @@ class Controller(object):
|
||||
def secondary_interact(self):
|
||||
buffer = self.get_current_buffer()
|
||||
tweet=buffer.get_tweet()
|
||||
if utils.is_geocoded(tweet) and config.app['app-settings']['use_Codeofdusk_audio_handlers']:
|
||||
if utils.is_geocoded(tweet) and config.app['app-settings']['use_Codeofdusk_audio_handlers'] and config.app['app-settings']['prefer_geocodes']:
|
||||
return self.view_reverse_geocode()
|
||||
elif config.app['app-settings']['use_Codeofdusk_audio_handlers']:
|
||||
return buffer.url()
|
||||
|
@ -62,7 +62,7 @@ class globalSettingsController(object):
|
||||
self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"])
|
||||
self.dialog.set_value("general", "use_slow_audio_algo", config.app["app-settings"]["use_slow_audio_algo"])
|
||||
self.dialog.set_value("general", "use_Codeofdusk_audio_handlers", config.app["app-settings"]["use_Codeofdusk_audio_handlers"])
|
||||
self.dialog.set_value("general", "view_reverse_geocode_on_secondary", config.app["app-settings"]["view_reverse_geocode_on_secondary"])
|
||||
self.dialog.set_value("general", "prefer_geocodes", config.app["app-settings"]["prefer_geocodes"])
|
||||
self.dialog.create_proxy()
|
||||
self.dialog.set_value("proxy", "server", config.app["proxy"]["server"])
|
||||
self.dialog.set_value("proxy", "port", config.app["proxy"]["port"])
|
||||
@ -93,8 +93,8 @@ class globalSettingsController(object):
|
||||
#Todo: clean memmos.
|
||||
if config.app["app-settings"]["use_Codeofdusk_audio_handlers"] != self.dialog.get_value("general", "use_Codeofdusk_audio_handlers"):
|
||||
config.app["app-settings"]["use_Codeofdusk_audio_handlers"] = self.dialog.get_value("general", "use_Codeofdusk_audio_handlers")
|
||||
if config.app["app-settings"]["view_reverse_geocode_on_secondary"] != self.dialog.get_value("general", "view_reverse_geocode_on_secondary"):
|
||||
config.app["app-settings"]["view_reverse_geocode_on_secondary"] = self.dialog.get_value("general", "view_reverse_geocode_on_secondary")
|
||||
if config.app["app-settings"]["prefer_geocodes"] != self.dialog.get_value("general", "prefer_geocodes"):
|
||||
config.app["app-settings"]["prefer_geocodes"] = self.dialog.get_value("general", "prefer_geocodes")
|
||||
if 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:
|
||||
self.needs_restart = True
|
||||
|
@ -38,8 +38,8 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
|
||||
sizer.Add(kmbox, 0, wx.ALL, 5)
|
||||
self.use_slow_audio_algo= wx.CheckBox(self, -1, _(U"Use slow audio tweet detection algorithm (improves audio tweet detection accuracy at the cost of performance)"))
|
||||
sizer.Add(self.use_slow_audio_algo, 0, wx.ALL, 5)
|
||||
self.view_reverse_geocode_on_secondary= wx.CheckBox(self, -1, _(U"Display geolocation information in a text box instead of opening URL as secondary action for geotweets"))
|
||||
sizer.Add(self.view_reverse_geocode_on_secondary, 0, wx.ALL, 5)
|
||||
self.prefer_geocodes= wx.CheckBox(self, -1, _(U"Prefer geolocation information to URLs when interacting with tweets (only applies when Codeofdusk's tweet handlers are enabled)"))
|
||||
sizer.Add(self.prefer_geocodes, 0, wx.ALL, 5)
|
||||
self.use_Codeofdusk_audio_handlers= wx.CheckBox(self, -1, _(U"Use Codeofdusk's tweet interaction handlers (intelegently handle audio tweets, may impact client performance on very slow connections)"))
|
||||
sizer.Add(self.use_Codeofdusk_audio_handlers, 0, wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
|
Loading…
x
Reference in New Issue
Block a user