Added settings for update notification suppression.

This commit is contained in:
blitzmann
2014-02-15 21:58:48 -05:00
parent 7ced595cca
commit 024637432c
5 changed files with 136 additions and 25 deletions

View File

@@ -215,4 +215,35 @@ class HTMLExportSettings():
return self.serviceHTMLExportSettings["path"]
def setPath(self, path):
self.serviceHTMLExportSettings["path"] = path
self.serviceHTMLExportSettings["path"] = path
"""
Settings used by update notification
"""
class UpdateSettings():
_instance = None
@classmethod
def getInstance(cls):
if cls._instance == None:
cls._instance = UpdateSettings()
return cls._instance
def __init__(self):
# Settings
# all - If True, suppress all update notifications
# prerelease - If True, suppress only prerelease notifications
# version - Set to release tag that user does not want notifications for
serviceUpdateDefaultSettings = { "all": False, "prerelease": False, 'version': None }
self.serviceUpdateSettings = SettingsProvider.getInstance().getSettings("pyfaServiceUpdateSettings", serviceUpdateDefaultSettings)
def get(self, type):
print "Getting "+type+ ": "
print self.serviceUpdateSettings["suppress" + type]
return self.serviceUpdateSettings["suppress" + type]
def set(self, type, value):
self.serviceUpdateSettings["suppress" + type] = value
print "Setting "+type+ " = "
print self.serviceUpdateSettings["suppress" + type]

View File

@@ -23,15 +23,19 @@ import urllib2
import json
import config
from service.settings import SettingsProvider
from service.settings import SettingsProvider, UpdateSettings
class CheckUpdateThread(threading.Thread):
def __init__(self, callback):
threading.Thread.__init__(self)
self.callback = callback
self.settings = UpdateSettings.getInstance()
def run(self):
print "In the thread"
if (self.settings.get('all')):
return
try:
response = urllib2.urlopen('https://api.github.com/repos/DarkFenX/Pyfa/releases')
jsonResponse = json.loads(response.read());