From e393c1d2f116a50d9d148c440d9a7f83ba93c91d Mon Sep 17 00:00:00 2001 From: cidoku Date: Sat, 1 Mar 2025 00:19:49 -0300 Subject: [PATCH] slides show the witness --- gameview.py | 61 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/gameview.py b/gameview.py index 7e7b8dc..e3edd85 100644 --- a/gameview.py +++ b/gameview.py @@ -187,7 +187,13 @@ class music_download_thread(QtCore.QThread): request = Request(url, headers=headers) request.get_method = lambda: 'HEAD' - response = urlopen(request) + try: + response = urlopen(request, timeout=5) + except: + print "[audio] There's no response, aborting..." + self.quit() + return + file_length = int(response.headers.get('Content-Length', 0)) if file_length > 0: @@ -213,6 +219,10 @@ class music_download_thread(QtCore.QThread): if not self.exiting: self.caller.stream = create_string_buffer(stream) self.finished_signal.emit(file_length) + else: + print "[audio] There's no response, aborting..." + self.quit() + return def stop(self): self.exiting = True @@ -326,6 +336,7 @@ class AOCharMovie(QtGui.QLabel): self.play_once = True self.m_flipped = False self.scaling = SCALING_AUTO + self.show_on_play = True self.m_movie = QtGui.QMovie() @@ -352,7 +363,7 @@ class AOCharMovie(QtGui.QLabel): def set_flipped(self, flip): self.m_flipped = flip - def play(self, p_char, p_emote, emote_prefix, scaling = SCALING_AUTO, single_frame_duration=-1): + def play(self, p_char, p_emote, emote_prefix, scaling = SCALING_AUTO, single_frame_duration = -1): if p_emote[0] == "/" or p_emote[0] == "/": p_emote = p_emote[1:] elif "../../characters" in p_emote: @@ -459,8 +470,9 @@ class AOCharMovie(QtGui.QLabel): self.pillow_timer.start(int(single_frame_duration * self.pillow_speed)) self.set_pillow_frame() - - self.show() + + if self.show_on_play: + self.show() def play_pre(self, p_char, p_emote, duration, scaling = SCALING_AUTO): p_char = p_char.lower() @@ -881,6 +893,14 @@ class gui(QtGui.QWidget): self.sidechar = AOCharMovie(self.viewport) self.sidechar.hide() + self.slide_last_wit = [] + self.slide_witness = AOCharMovie(self.viewport) + self.slide_witness.show_on_play = False + self.slide_witness.hide() + self.slide_lawyer = AOCharMovie(self.viewport) + self.slide_lawyer.hide() + self.slide_lawyer.show_on_play = False + self.slide_overlay = QtGui.QLabel(self.viewport) self.slide_overlay_animation = QtCore.QPropertyAnimation(self.slide_overlay, "geometry") self.slide_overlay.hide() @@ -1903,7 +1923,7 @@ class gui(QtGui.QWidget): self.changeEvidence(0, 0) def onClick_callMod(self): - #self.do_slide() + # self.do_slide() if "modcall_reason" in self.features: reason, ok = QtGui.QInputDialog.getText(self, "Call a moderator", "Enter your reason.") @@ -2340,6 +2360,9 @@ class gui(QtGui.QWidget): self.slide_bg.show() + if self.slide_last_wit: + self.slide_witness.play_idle(self.slide_last_wit[0], self.slide_last_wit[1], self.slide_last_wit[2]) + def_pos = QtCore.QRect(0, 0, self.slide_bg.width(), VIEWPORT_H) pro_pos = QtCore.QRect(-def_pos.size().width() + VIEWPORT_W, def_pos.top(), def_pos.size().width(), VIEWPORT_H) wit_pos = QtCore.QRect(0, 0, self.slide_bg.width(), VIEWPORT_H) @@ -2395,11 +2418,19 @@ class gui(QtGui.QWidget): if x > -VIEWPORT_W: self.char.move_slide(x) else: + self.char.hide() + if self.slide_last_wit: + self.slide_witness.move_slide(x + self.slide_bg.width() / 2 - VIEWPORT_W / 2) + self.slide_witness.show() self.slide_stage = 1 elif self.slide_stage == 1: if x <= -VIEWPORT_W and x >= -self.slide_bg.width() + self.slide_bg.width() / 2: - self.char.move_slide(x + self.slide_bg.width() / 2 - VIEWPORT_W / 2) + if self.slide_last_wit: + self.slide_witness.move_slide(x + self.slide_bg.width() / 2 - VIEWPORT_W / 2) else: + if self.slide_last_wit: + self.slide_witness.hide() + self.char.show() self.slide_stage = 2 pass else: @@ -2409,17 +2440,23 @@ class gui(QtGui.QWidget): if x < -self.slide_bg.width() + self.slide_bg.width() / 2: self.char.move_slide(x + self.slide_bg.width() - VIEWPORT_W) else: + self.char.hide() + if self.slide_last_wit: + self.slide_witness.move_slide(x + self.slide_bg.width() / 2 - VIEWPORT_W / 2) + self.slide_witness.show() self.slide_stage = 1 elif self.slide_stage == 1: if x <= -VIEWPORT_W and x >= -self.slide_bg.width() + self.slide_bg.width() / 2: - self.char.move_slide(x + self.slide_bg.width() / 2 - VIEWPORT_W / 2) + if self.slide_last_wit: + self.slide_witness.move_slide(x + self.slide_bg.width() / 2 - VIEWPORT_W / 2) else: + if self.slide_last_wit: + self.slide_witness.hide() + self.char.show() self.slide_stage = 2 pass else: self.char.move_slide(x) - - def slide_done(self): self.slide_bg.hide() @@ -2503,7 +2540,8 @@ class gui(QtGui.QWidget): self.is_additive = (m_chatmessage[ADDITIVE] == "1") custom_objection = "custom" - try: objection_mod = int(m_chatmessage[SHOUT_MOD]) + try: + objection_mod = int(m_chatmessage[SHOUT_MOD]) except: if "4&" in m_chatmessage[SHOUT_MOD]: # custom objection name objection_mod = 4 @@ -2764,6 +2802,9 @@ class gui(QtGui.QWidget): self.sidechar.move(0, 0) self.scaling[0] = self.get_scaling(ini.read_ini(AOpath + 'characters/' + self.m_chatmessage[CHARNAME] + '/char.ini', "options", "scaling").lower()) + + if side == "wit": + self.slide_last_wit = [self.m_chatmessage[CHARNAME], self.m_chatmessage[ANIM], self.scaling[0]] if (emote_mod == 1 or emote_mod == 2 or emote_mod == 6) and self.m_chatmessage[PREANIM] != "-": # sfx_delay = int(self.m_chatmessage[SFX_DELAY]) * 60