Added update channel settings to general tab

This commit is contained in:
Manuel Cortez 2018-12-27 08:30:51 -06:00
parent 729b410d63
commit fae791ff71
3 changed files with 41 additions and 0 deletions

View File

@ -16,6 +16,22 @@ class configuration(object):
else:
return _(u"Custom")
def get_update_channel_type(self, value):
if value == _(u"Stable"):
return "stable"
elif value == _(u"Weekly"):
return "weekly"
else:
return "alpha"
def get_update_channel_label(self, value):
if value == "stable":
return _(u"Stable")
elif value == "weekly":
return _(u"Weekly")
else:
return _(u"Alpha")
def __init__(self, session):
self.session = session
self.dialog = configurationUI.configurationDialog(_(u"Preferences"))
@ -26,6 +42,7 @@ class configuration(object):
self.dialog.set_value("general", "wall_buffer_count", self.session.settings["buffers"]["count_for_wall_buffers"])
self.dialog.set_value("general", "video_buffers_count", self.session.settings["buffers"]["count_for_video_buffers"])
self.dialog.set_value("general", "load_images", self.session.settings["general"]["load_images"])
self.dialog.set_value("general", "update_channel", self.get_update_channel_label(self.session.settings["general"]["update_channel"]))
self.dialog.create_chat()
self.dialog.set_value("chat", "notify_online", self.session.settings["chat"]["notify_online"])
self.dialog.set_value("chat", "notify_offline", self.session.settings["chat"]["notify_offline"])
@ -38,6 +55,18 @@ class configuration(object):
def save_configuration(self):
self.session.settings["buffers"]["count_for_video_buffers"] = self.dialog.get_value("general", "video_buffers_count")
self.session.settings["general"]["load_images"] = self.dialog.get_value("general", "load_images")
update_channel = self.get_update_channel_type(self.dialog.get_value("general", "update_channel"))
if update_channel != self.session.settings["general"]["update_channel"]:
if update_channel == "stable":
self.session.settings["general"]["update_channel"] = update_channel
elif update_channel == "weekly":
dialog = configurationUI.weekly_channel()
if dialog == widgetUtils.YES:
self.session.settings["general"]["update_channel"] = update_channel
elif update_channel == "alpha":
dialog = configurationUI.alpha_channel()
if dialog == widgetUtils.YES:
self.session.settings["general"]["update_channel"] = update_channel
self.session.settings["chat"]["notify_online"] = self.dialog.get_value("chat", "notify_online")
self.session.settings["chat"]["notify_offline"] = self.dialog.get_value("chat", "notify_offline")
self.session.settings["chat"]["open_unread_conversations"] = self.dialog.get_value("chat", "open_unread_conversations")

View File

@ -7,6 +7,7 @@ use_alternative_tokens = boolean(default=False)
[general]
reverse_timelines = boolean(default=False)
load_images = boolean(default=True)
update_channel = string(default="stable")
[buffers]
count_for_wall_buffers = integer(default=100)

View File

@ -22,6 +22,12 @@ class general(wx.Panel, widgetUtils.BaseDialog):
sizer.Add(box3, 0, wx.ALL, 5)
self.load_images = wx.CheckBox(self, wx.NewId(), _(u"Load images in posts"))
sizer.Add(self.load_images, 0, wx.ALL, 5)
lbl4 = wx.StaticText(self, wx.NewId(), _(u"Update channel"))
self.update_channel = wx.ComboBox(self, wx.NewId(), choices=[_(u"Stable"), _(u"Weekly"), _(u"Alpha")], value=_(u"Native"), style=wx.CB_READONLY)
box4 = wx.BoxSizer(wx.HORIZONTAL)
box4.Add(lbl4, 0, wx.ALL, 5)
box4.Add(self.update_channel, 0, wx.ALL, 5)
sizer.Add(box4, 0, wx.ALL, 5)
self.SetSizer(sizer)
class chat(wx.Panel, widgetUtils.BaseDialog):
@ -84,3 +90,8 @@ class configurationDialog(widgetUtils.BaseDialog):
control = getattr(p, key)
getattr(control, "SetValue")(value)
def alpha_channel():
return wx.MessageDialog(None, _(u"The alpha channel contains bleeding edge changes introduced to Socializer. A new alpha update is generated every time there are new changes in the project. Take into account that updates are generated automatically and may fail at any time due to errors in the build process. Use alpha channels when you are sure you want to try the latest changes and contribute with reports to fix bugs. Never use alpha channel updates for everyday use. Do you want to continue?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def weekly_channel():
return wx.MessageDialog(None, _(u"The weekly channel generates an update automatically every week by building the source code present in the project. This version is used to test features added to the next stable version. Do you want to continue?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()