def __determineUrlAndDownload(self, stackoverflow, action, refresh_main_view): stackoverflow.stats = 'getting download link' action() downloadLink = self.__getDownloadLink(stackoverflow.onlineid, stackoverflow.type) downloadThread = LogThread.LogThread(target=self.downloadFile, args=(downloadLink,stackoverflow,refresh_main_view,)) self.downloadThreads.append(downloadThread) downloadThread.start() updateThread = LogThread.LogThread(target=self.updateUi, args=(action,downloadThread,)) self.uiUpdateThreads.append(updateThread) updateThread.start()
def downloadStackOverflow(self, stackoverflow, action, refresh_main_view): if not stackoverflow in self.downloading: stackoverflow.status = 'downloading' self.downloading.append(stackoverflow) action() workThread = LogThread.LogThread(target=self.__determineUrlAndDownload, args=(stackoverflow,action,refresh_main_view,)) self.workThreads.append(workThread) workThread.start()
def __determineUrlAndDownload(self, cheatsheet, action, refresh_main_view): cheatsheet.stats = 'getting download link' action() downloadLink = self.__getDownloadLink(cheatsheet.onlineid) downloadThread = LogThread.LogThread(target=self.downloadFile, args=( downloadLink, cheatsheet, refresh_main_view, )) self.downloadThreads.append(downloadThread) downloadThread.start() updateThread = LogThread.LogThread(target=self.updateUi, args=( action, downloadThread, )) self.uiUpdateThreads.append(updateThread) updateThread.start()
def __determineUrlAndDownload(self, docset, action, refresh_main_view): docset['stats'] = 'getting download link' action() downloadLink = self.__getDownloadLink(docset['feed']) downloadThread = LogThread.LogThread(target=self.downloadFile, args=( downloadLink, docset, refresh_main_view, )) self.downloadThreads.append(downloadThread) downloadThread.start() updateThread = LogThread.LogThread(target=self.updateUi, args=( action, downloadThread, )) self.uiUpdateThreads.append(updateThread) updateThread.start()
def installDocset(self, docset, action, refresh_main_view): self.__installingDocsets.append(docset) docset.status = 'Installing' action() installThread = LogThread.LogThread(target=self.__installDocset, args=( docset, refresh_main_view, )) self.installThreads.append(installThread) installThread.start()
def __determineUrlAndDownload(self, usercontributed, action, refresh_main_view): usercontributed.stats = 'getting download link' action() downloadLink = self.__getDownloadLink(usercontributed.onlineid, usercontributed.archive) downloadThread = LogThread.LogThread(target=self.downloadFile, args=( downloadLink, usercontributed, refresh_main_view, )) self.downloadThreads.append(downloadThread) downloadThread.start() updateThread = LogThread.LogThread(target=self.updateUi, args=( action, downloadThread, )) self.uiUpdateThreads.append(updateThread) updateThread.start()
def downloadCheatsheet(self, cheatsheet, action, refresh_main_view): if not cheatsheet in self.downloading: cheatsheet.status = 'downloading' self.downloading.append(cheatsheet) action() workThread = LogThread.LogThread( target=self.__determineUrlAndDownload, args=( cheatsheet, action, refresh_main_view, )) self.workThreads.append(workThread) workThread.start()
def __determineUrlAndDownload(self, docset, action, refresh_main_view): docset['stats'] = 'getting download link' action() if not 'downloadUrl' in docset.keys(): data = self.__getDownloadLink(docset['feed']) docset['version'] = data['version'] downloadLink = data['url'] else: downloadLink = docset['downloadUrl'] downloadThread = LogThread.LogThread(target=self.downloadFile, args=( downloadLink, docset, refresh_main_view, )) self.downloadThreads.append(downloadThread) downloadThread.start() updateThread = LogThread.LogThread(target=self.updateUi, args=( action, downloadThread, )) self.uiUpdateThreads.append(updateThread) updateThread.start()
def downloadUserContributed(self, usercontributed, action, refresh_main_view): if not usercontributed in self.downloading: usercontributed.status = 'downloading' self.downloading.append(usercontributed) action() workThread = LogThread.LogThread( target=self.__determineUrlAndDownload, args=( usercontributed, action, refresh_main_view, )) self.workThreads.append(workThread) workThread.start()
def downloadDocset(self, docset, action, refresh_main_view): cont = self.__checkDocsetCanDownload(docset) if cont and not docset in self.downloading: docset['status'] = 'downloading' self.downloading.append(docset) action() workThread = LogThread.LogThread( target=self.__determineUrlAndDownload, args=( docset, action, refresh_main_view, )) self.workThreads.append(workThread) workThread.start()
def downloadStackOverflow(self, stackoverflow, action, refresh_main_view): if not stackoverflow in self.downloading: removeSoon = [] for d in self.updateAvailable: if d.name + d.type == stackoverflow.name + stackoverflow.type: removeSoon.append(d) for d in removeSoon: self.updateAvailable.remove(d) stackoverflow.status = 'downloading' self.downloading.append(stackoverflow) action() workThread = LogThread.LogThread( target=self.__determineUrlAndDownload, args=( stackoverflow, action, refresh_main_view, )) self.workThreads.append(workThread) workThread.start()
def downloadDocset(self, docset, action, refresh_main_view): cont = self.__checkDocsetCanDownload(docset) if cont and not docset in self.downloading: self.downloading.append(docset) removeSoon = [] for d in self.updateAvailable: if d['name'] == docset['name']: removeSoon.append(d) for d in removeSoon: self.updateAvailable.remove(d) docset['status'] = 'downloading' action() workThread = LogThread.LogThread( target=self.__determineUrlAndDownload, args=( docset, action, refresh_main_view, )) self.workThreads.append(workThread) workThread.start()
def downloadCheatsheet(self, cheatsheet, action, refresh_main_view): if not cheatsheet in self.downloading: cheatsheet.status = 'downloading' self.downloading.append(cheatsheet) removeSoon = [] for d in self.updateAvailable: if d.name == cheatsheet.name: removeSoon.append(d) for d in removeSoon: self.updateAvailable.remove(d) cheatsheet.status = 'downloading' action() workThread = LogThread.LogThread( target=self.__determineUrlAndDownload, args=( cheatsheet, action, refresh_main_view, )) self.workThreads.append(workThread) workThread.start()
def downloadUserContributed(self, usercontributed, action, refresh_main_view): if not usercontributed in self.downloading: removeSoon = [] for d in self.updateAvailable: if d.name == usercontributed.name: removeSoon.append(d) for d in removeSoon: self.updateAvailable.remove(d) usercontributed.status = 'downloading' self.downloading.append(usercontributed) action() workThread = LogThread.LogThread( target=self.__determineUrlAndDownload, args=( usercontributed, action, refresh_main_view, )) self.workThreads.append(workThread) workThread.start()