Example #1
0
def downloadUpdate():
	global fileName, downloadDLG
	updDir=locations.dataFilesLocation(u"updates")
	if not os.path.exists(updDir):
		logging.debug("Creating the update directory %s."%updDir)
		try:
			os.mkdir(updDir)
		except:
			logging.exception("Error creating the update directory.")
			displayUpdateStatusMessage(3)
	output.speak(_("Accessing download URL... Please wait..."), True)
	if config.conf["updates"]["downloadType"]==1:
		downloadLink="http://skypetalking.googlecode.com/files/SkypeTalking_"+latestVersion+"_Portable.exe"
		fileName=os.path.join(locations.dataFilesLocation(), u"updates", u"SkypeTalking_"+latestVersion+"_Portable.exe")
	else:
		downloadLink="http://skypetalking.googlecode.com/files/SkypeTalking_"+latestVersion+"_Setup.exe"
		fileName=os.path.join(locations.dataFilesLocation(), u"updates", u"SkypeTalking_"+latestVersion+"_Setup.exe")
	try:
		updURL=urllib2.urlopen(downloadLink)
	except:
		logging.exception("Update URL could not be accessed.")
		displayUpdateStatusMessage(2)
		return
	try:
		downloadDLG=DownloadDialog(parent=globalVars.Frame, title=_("Downloading update... Please wait..."), url=downloadLink, filename=unicode(fileName), completed_callback=runUpdate)
		globalVars.Frame.DisplayDialog(downloadDLG)
		downloadDLG.perform_threaded()
	except:
		logging.exception("Couldn't download update file.")
		displayUpdateStatusMessage(3)
Example #2
0
def downloadUpdate():
    global fileName, downloadDLG
    updDir = locations.dataFilesLocation(u"updates")
    if not os.path.exists(updDir):
        logging.debug("Creating the update directory %s." % updDir)
        try:
            os.mkdir(updDir)
        except:
            logging.exception("Error creating the update directory.")
            displayUpdateStatusMessage(3)
    output.speak(_("Accessing download URL... Please wait..."), True)
    if config.conf["updates"]["downloadType"] == 1:
        downloadLink = "http://skypetalking.googlecode.com/files/SkypeTalking_" + latestVersion + "_Portable.exe"
        fileName = os.path.join(
            locations.dataFilesLocation(), u"updates",
            u"SkypeTalking_" + latestVersion + "_Portable.exe")
    else:
        downloadLink = "http://skypetalking.googlecode.com/files/SkypeTalking_" + latestVersion + "_Setup.exe"
        fileName = os.path.join(
            locations.dataFilesLocation(), u"updates",
            u"SkypeTalking_" + latestVersion + "_Setup.exe")
    try:
        updURL = urllib2.urlopen(downloadLink)
    except:
        logging.exception("Update URL could not be accessed.")
        displayUpdateStatusMessage(2)
        return
    try:
        downloadDLG = DownloadDialog(
            parent=globalVars.Frame,
            title=_("Downloading update... Please wait..."),
            url=downloadLink,
            filename=unicode(fileName),
            completed_callback=runUpdate)
        globalVars.Frame.DisplayDialog(downloadDLG)
        downloadDLG.perform_threaded()
    except:
        logging.exception("Couldn't download update file.")
        displayUpdateStatusMessage(3)
Example #3
0
import logging
from logging.handlers import RotatingFileHandler
import locations
import versionInfo

APP_LOG_FILE = versionInfo.name+'.log'
ERROR_LOG_FILE = "error.log"
MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s"
DATE_FORMAT = "%a %b %d, %Y %H:%M:%S"

formatter = logging.Formatter(MESSAGE_FORMAT, datefmt=DATE_FORMAT)

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

#handlers
app_handler = RotatingFileHandler(locations.dataFilesLocation(APP_LOG_FILE), maxBytes=1000000)
app_handler.setFormatter(formatter)
app_handler.setLevel(logging.DEBUG)
logger.addHandler(app_handler)
error_handler = logging.FileHandler(locations.dataFilesLocation(ERROR_LOG_FILE))
error_handler.setFormatter(formatter)
error_handler.setLevel(logging.ERROR)
logger.addHandler(error_handler)
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.ERROR)
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
Example #4
0
from log import logger

logging = logger.getChild('core.config')
import confspecs
import locations
import versionInfo
from UserDict import UserDict
from configobj import ConfigObj, ParseError
from validate import Validator, VdtValueError
import os

configFile = locations.dataFilesLocation(versionInfo.name + ".ini")
confspec = ConfigObj(confspecs.defaults, list_values=False, encoding="UTF-8")
confspec.newlines = "\r\n"
conf = None


class ConfigurationResetException(Exception):
    pass


class Configuration(UserDict):
    def __init__(self, file=None, spec=None, *args, **kwargs):
        self.file = file
        self.spec = spec
        self.validator = Validator()
        self.setup_config(file=file, spec=spec)
        self.validated = self.config.validate(self.validator, copy=True)
        if self.validated:
            self.write()
        UserDict.__init__(self, self.config)
Example #5
0
from log import logger
logging=logger.getChild('core.config')
import confspecs
import locations
import versionInfo
from UserDict import UserDict
from configobj import ConfigObj, ParseError
from validate import Validator, VdtValueError
import os

configFile=locations.dataFilesLocation(versionInfo.name+".ini")
confspec=ConfigObj(confspecs.defaults, list_values=False, encoding="UTF-8")
confspec.newlines="\r\n"
conf=None

class ConfigurationResetException(Exception):
	pass

class Configuration(UserDict):

	def __init__(self, file=None, spec=None, *args, **kwargs):
		self.file=file
		self.spec=spec
		self.validator=Validator()
		self.setup_config(file=file, spec=spec)
		self.validated=self.config.validate(self.validator, copy=True)
		if self.validated:
			self.write()
		UserDict.__init__(self, self.config)

	def setup_config(self, file, spec):