From c19fbf40a07c2c2c7a1e248d7db7bf60fe08e17e Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Fri, 22 Nov 2019 17:35:55 -0600 Subject: [PATCH] Display information about the next generation of alpha versions --- src/application.py | 8 ++++++++ src/main.py | 4 ++++ src/wxUI/commonMessages.py | 20 +++++++++++++++++++- src/wxUI/menus.py | 6 ++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/application.py b/src/application.py index c52c177..3ab9393 100644 --- a/src/application.py +++ b/src/application.py @@ -1,4 +1,12 @@ # -*- coding: utf-8 -*- +import sys + +### ToDo: Remove this piece of code a month later or something like that, when the migration to the cx_freeze executable will be complete. +def is_pyinstaller(): + if hasattr(sys, 'frozen') and hasattr(sys, '_MEIPASS'): + return True + else: + return False name = "Socializer" version = "0.23" diff --git a/src/main.py b/src/main.py index 82de162..8aba5d3 100644 --- a/src/main.py +++ b/src/main.py @@ -14,6 +14,7 @@ import output import logging import keys import application +from wxUI.commonMessages import alpha_reminder if hasattr(sys, "frozen"): sys.excepthook = lambda x, y, z: logging.critical(''.join(traceback.format_exception(x, y, z))) from mysc.thread_utils import call_threaded @@ -51,6 +52,9 @@ def setup(): from sessionmanager import sessionManager log.debug("Created Application mainloop object") + if application.is_pyinstaller(): + log.debug("Showing reminder about next Socializer alpha... ") + alpha_reminder() sm = sessionManager.sessionManagerController() sm.show() del sm diff --git a/src/wxUI/commonMessages.py b/src/wxUI/commonMessages.py index 0b3326a..47d2a16 100644 --- a/src/wxUI/commonMessages.py +++ b/src/wxUI/commonMessages.py @@ -1,5 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import datetime +import webbrowser +import sys import wx import application @@ -75,4 +78,19 @@ def unblock_person(): return wx.MessageDialog(None, _("Are you sure you want to unblock this user?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() def post_failed(): - return wx.MessageDialog(None, _("Unfortunately, we could not send your last post or message to VK. Would you like to try again?"), _("Post failed"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() \ No newline at end of file + return wx.MessageDialog(None, _("Unfortunately, we could not send your last post or message to VK. Would you like to try again?"), _("Post failed"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() + +### ToDo: same instructions than in application.py +def alpha_reminder(): + deadline = datetime.datetime(2019, 11, 27) + now = datetime.datetime.now() + if now >= deadline: + msg = wx.MessageDialog(None, _("In order to keep receiving updates, you are required to download the alpha version of socializer from scratch from our website. Would you like to download it now? If you press 'yes', you will be redirected automatically to the direct download for the new alpha version, and socializer will be closed automatically. If you do not wish to download the new alpha, take into account that the current version will no longer receive updates"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() + if msg == wx.ID_NO: + return + url = "https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/master/raw/socializer.zip?job=alpha" + webbrowser.open_new_tab(url) + sys.exit() + return + else: + return wx.MessageDialog(None, _("Please remember that from November 27, 2019, you will have to download the alpha version from scratch from the Socializer website. The alpha version you are currently running will no longer receive updates. The new alpha version, which must be downloaded from the project's page, should not be considered suspicious by most antivirus vendors and all automatic updates will be sent to the new generation of socializer alpha. Thank you for your patience."), _("Important notice"), style=wx.OK).ShowModal() \ No newline at end of file diff --git a/src/wxUI/menus.py b/src/wxUI/menus.py index a97136d..2fe492b 100644 --- a/src/wxUI/menus.py +++ b/src/wxUI/menus.py @@ -13,6 +13,8 @@ class postMenu(wx.Menu): self.dislike = self.Append(wx.NewId(), _("Dislike")) self.dislike.Enable(False) self.comment = self.Append(wx.NewId(), _("Add comment")) + self.fav = self.Append(wx.NewId(), _("Add to favorites")) + self.fav.Enable(False) if can_delete: self.delete = self.Append(wx.NewId(), _("Delete")) else: @@ -41,6 +43,8 @@ class peopleMenu(wx.Menu): self.view_profile = self.Append(wx.NewId(), _("View profile")) self.message = self.Append(wx.NewId(), _("Send a message")) self.timeline = self.Append(wx.NewId(), _("Open timeline")) + self.fav = self.Append(wx.NewId(), _("Add to favorites")) + self.fav.Enable(False) if not_friend == False: self.common_friends = self.Append(wx.NewId(), _("View friends in common")) if is_request == False and is_subscriber == False and not_friend == False: @@ -67,6 +71,8 @@ class documentMenu(wx.Menu): else: self.action = self.Append(wx.NewId(), _("Add to my documents")) self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com")) + self.fav = self.Append(wx.NewId(), _("Add to favorites")) + self.fav.Enable(False) class commentMenu(wx.Menu): def __init__(self, *args, **kwargs):