added an ask to exit toggle. Suggestion of masonasons

This commit is contained in:
Manuel Cortez 2014-11-08 04:08:51 -06:00
parent 5964bd6b3d
commit d2c89a1f91
3 changed files with 12 additions and 6 deletions

View File

@ -15,6 +15,7 @@ reverse_timelines = boolean(default=False)
time_to_check_streams = integer(default=30) time_to_check_streams = integer(default=30)
announce_stream_status = boolean(default=True) announce_stream_status = boolean(default=True)
auto_connect_streams = boolean(default=True) auto_connect_streams = boolean(default=True)
ask_at_exit = boolean(default=True)
[sound] [sound]
volume = float(default=1.0) volume = float(default=1.0)

View File

@ -50,6 +50,9 @@ class general(wx.Panel):
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.ask_at_exit = wx.CheckBox(self, -1, _(U"Ask to exit TWBlue"))
self.ask_at_exit.SetValue(config.main["general"]["ask_at_exit"])
sizer.Add(self.ask_at_exit, 0, wx.ALL, 5)
self.relative_time = wx.CheckBox(self, -1, _(U"Relative times")) self.relative_time = wx.CheckBox(self, -1, _(U"Relative times"))
self.relative_time.SetValue(config.main["general"]["relative_times"]) self.relative_time.SetValue(config.main["general"]["relative_times"])
sizer.Add(self.relative_time, 0, wx.ALL, 5) sizer.Add(self.relative_time, 0, wx.ALL, 5)
@ -372,6 +375,7 @@ class configurationDialog(wx.Dialog):
need_restart = True need_restart = True
if platform.system() == "Windows": if platform.system() == "Windows":
config.main["general"]["voice_enabled"] = self.general.disable_sapi5.GetValue() config.main["general"]["voice_enabled"] = self.general.disable_sapi5.GetValue()
config.main["general"]["ask_at_exit"] = self.general.ask_at_exit.GetValue()
config.main["general"]["hide_gui"] = self.general.show_gui.GetValue() config.main["general"]["hide_gui"] = self.general.show_gui.GetValue()
config.main["general"]["max_api_calls"] = self.general.apiCalls.GetValue() config.main["general"]["max_api_calls"] = self.general.apiCalls.GetValue()
config.main["general"]["max_tweets_per_call"] = self.general.itemsPerApiCall.GetValue() config.main["general"]["max_tweets_per_call"] = self.general.itemsPerApiCall.GetValue()

View File

@ -579,13 +579,14 @@ class mainFrame(wx.Frame):
self.nb.AdvanceSelection(forward) self.nb.AdvanceSelection(forward)
def close(self, ev=None): def close(self, ev=None):
# if ev == None or hasattr(ev, "GetLoggingOff") == False: if config.main["general"]["ask_at_exit"] == True:
dlg = wx.MessageDialog(self, _(u"Do you really want to close TW Blue?"), _(u"Exit"), wx.YES_NO|wx.ICON_QUESTION) dlg = wx.MessageDialog(self, _(u"Do you really want to close TW Blue?"), _(u"Exit"), wx.YES_NO|wx.ICON_QUESTION)
if dlg.ShowModal() == wx.ID_YES: if dlg.ShowModal() == wx.ID_YES:
self.exit() self.exit()
dlg.Destroy() dlg.Destroy()
# elif hasattr(ev, "GetLoggingOff") == True: else:
# self.exit() output.speak(_(u"Exiting..."))
self.exit()
def exit(self, event=None): def exit(self, event=None):
config.main.write() config.main.write()