diff --git a/gameview.py b/gameview.py index 019addc..6ad5f9e 100644 --- a/gameview.py +++ b/gameview.py @@ -155,6 +155,66 @@ def download_thread(link, savepath): DOWNLOAD_BLACKLIST.append(link) print "couldn't download '%s'" % link + + +class music_download_thread(QtCore.QThread): + # Part of the evil HTTPS music download hack for XP systems + finished_signal = QtCore.pyqtSignal(int) + + def __init__(self, caller, url): + super(music_download_thread, self).__init__() + self.caller = caller + self.url = url + self.exiting = False + + def run(self): + self.exiting = False + self.download(self.url) + + def download(self, url): + if self.exiting: + return + + headers = { + 'User-Agent': "AO2XP %s" % (GAME_VERSION), + 'Accept': '*/*', + 'Accept-Encoding': 'gzip, deflate', + 'Accept-Language': 'en-US,en;q=0.9', + 'Connection': 'keep-alive', + 'Upgrade-Insecure-Requests': '1' + } + + request = Request(url, headers=headers) + request.get_method = lambda: 'HEAD' + response = urlopen(request) + file_length = int(response.headers.get('Content-Length', 0)) + + if file_length > 0: + request = Request(url, headers=headers) + response = urlopen(request) + stream = "" + + bytes_downloaded = 0 + buffer_size = 8192 + + while bytes_downloaded < file_length: + if self.exiting: + self.quit() + break + + chunk = response.read(buffer_size) + if not chunk: + break + + stream += chunk + bytes_downloaded += len(chunk) + + if not self.exiting: + self.caller.stream = create_string_buffer(stream) + self.finished_signal.emit(file_length) + + def stop(self): + self.exiting = True def mockStr(text): upper = random.choice([True, False]) @@ -2071,9 +2131,11 @@ class gui(QtGui.QWidget): msg = "MS#" - # Visible desk modifier: respect char.ini if emotion has deskmod - if "deskmod" in self.features: - if emote[7]: + # Visible desk modifier + if "deskmod" in self.features: + if emote[3] == '5': # Zoom forcibly hides the desk + msg += "0#" + elif emote[7]: # Respect deskmod if found msg += "%s#" % emote[7] else: msg += "%d#" % self.deskbtn.isChecked() @@ -3743,61 +3805,3 @@ class TCP_Thread(QtCore.QThread): self.parent.areaitems.item(i).setIcon(QtGui.QIcon(AO2XPpath + "icons/" + "house.png")) except: pass - -class music_download_thread(QtCore.QThread): - # Part of the evil HTTPS music download hack for XP systems - finished_signal = QtCore.pyqtSignal(int) - - def __init__(self, caller, url): - super(music_download_thread, self).__init__() - self.caller = caller - self.url = url - self.exiting = False - - def run(self): - self.exiting = False - self.download(self.url) - - def download(self, url): - if self.exiting: - return - - headers = { - 'User-Agent': "AO2XP %s" % (GAME_VERSION), - 'Accept': '*/*', - 'Accept-Encoding': 'gzip, deflate', - 'Accept-Language': 'en-US,en;q=0.9', - 'Connection': 'keep-alive', - 'Upgrade-Insecure-Requests': '1' - } - - request = Request(url, headers=headers) - request.get_method = lambda: 'HEAD' - response = urlopen(request) - file_length = int(response.headers.get('Content-Length', 0)) - - if file_length > 0: - request = Request(url, headers=headers) - response = urlopen(request) - stream = "" - - bytes_downloaded = 0 - buffer_size = 8192 - - while bytes_downloaded < file_length: - if self.exiting: - self.quit() - break - - chunk = response.read(buffer_size) - if not chunk: - break - - stream += chunk - bytes_downloaded += len(chunk) - - self.caller.stream = create_string_buffer(stream) - self.finished_signal.emit(file_length) - - def stop(self): - self.exiting = True \ No newline at end of file