Added a donation dialogue in some parts of the program

This commit is contained in:
Manuel Cortez 2015-07-29 14:05:26 -05:00
parent f66b2ccbad
commit 10bc483887
4 changed files with 24 additions and 0 deletions

View File

@ -14,6 +14,7 @@ play_ready_sound = boolean(default=True)
speak_ready_msg = boolean(default=True)
log_level = string(default="error")
load_keymap = string(default="default.keymap")
donation_dialog_displayed = boolean(default=False)
[proxy]
server = string(default="")

View File

@ -25,6 +25,8 @@ from mysc.thread_utils import call_threaded
import fixes
#extra variables to control the temporal stdout and stderr, while the final files are opened. We understand that some errors could happen while all outputs are closed, so let's try to avoid it.
import widgetUtils
import webbrowser
from wxUI import commonMessageDialogs
if system == "Windows":
from logger import logger
from update import updater
@ -63,6 +65,8 @@ def setup():
from sessionmanager import sessionManager
app = widgetUtils.mainLoopObject()
if system == "Windows":
if config.app["app-settings"]["donation_dialog_displayed"] == False:
donation()
updater.do_update()
sm = sessionManager.sessionManagerController()
sm.fill_list()
@ -82,4 +86,10 @@ def setup():
GLib.idle_add(r.start)
app.run()
def donation():
dlg = commonMessageDialogs.donation()
if dlg == widgetUtils.YES:
webbrowser.open_new_tab("http://twblue.es/donate")
config.app["app-settings"]["donation_dialog_displayed"] = True
setup()

View File

@ -7,6 +7,9 @@ import os
import platform
import requests
import tempfile
from wxUI import commonMessageDialogs
import widgetUtils
import webbrowser
try:
import czipfile as zipfile
except ImportError:
@ -27,6 +30,7 @@ def perform_update(endpoint, current_version, app_name='', password=None, update
available_description = available_update.get('description', None)
update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]]
logger.info("A new update is available. Version %s" % available_version)
donation()
if callable(update_available_callback) and not update_available_callback(version=available_version, description=available_description): #update_available_callback should return a falsy value to stop the process
logger.info("User canceled update.")
return
@ -114,3 +118,8 @@ def call_callback(callback, *args, **kwargs):
callback(*args, **kwargs)
# except:
# logger.exception("Failed calling callback %r with args %r and kwargs %r" % (callback, args, kwargs))
def donation():
dlg = commonMessageDialogs.donation()
if dlg == widgetUtils.YES:
webbrowser.open_new_tab("http://twblue.es/donate")

View File

@ -47,3 +47,7 @@ def protected_user():
def no_following():
return wx.MessageDialog(None, _(u"This is a protected user account, you need follow to this user for viewing your tweets or favourites."), _(u"Error"), wx.ICON_ERROR).ShowModal()
def donation():
dlg = wx.MessageDialog(None, _(u"If you like this application, we need your help to keep it operational. Help us donating to the project. This will let us pay the server, the domain on the Internet and some other things to ensure that TWBlue will keep developing. Your donation will let us continue writing features for TWBlue, and these features to be free. Would you like to donate now?"), _(u"We need your help"), wx.ICON_QUESTION|wx.YES_NO)
return dlg.ShowModal()