slides show the witness

This commit is contained in:
cidoku 2025-03-01 00:19:49 -03:00
parent 4a823abf32
commit e393c1d2f1

View File

@ -187,7 +187,13 @@ class music_download_thread(QtCore.QThread):
request = Request(url, headers=headers) request = Request(url, headers=headers)
request.get_method = lambda: 'HEAD' 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)) file_length = int(response.headers.get('Content-Length', 0))
if file_length > 0: if file_length > 0:
@ -213,6 +219,10 @@ class music_download_thread(QtCore.QThread):
if not self.exiting: if not self.exiting:
self.caller.stream = create_string_buffer(stream) self.caller.stream = create_string_buffer(stream)
self.finished_signal.emit(file_length) self.finished_signal.emit(file_length)
else:
print "[audio] There's no response, aborting..."
self.quit()
return
def stop(self): def stop(self):
self.exiting = True self.exiting = True
@ -326,6 +336,7 @@ class AOCharMovie(QtGui.QLabel):
self.play_once = True self.play_once = True
self.m_flipped = False self.m_flipped = False
self.scaling = SCALING_AUTO self.scaling = SCALING_AUTO
self.show_on_play = True
self.m_movie = QtGui.QMovie() self.m_movie = QtGui.QMovie()
@ -352,7 +363,7 @@ class AOCharMovie(QtGui.QLabel):
def set_flipped(self, flip): def set_flipped(self, flip):
self.m_flipped = 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] == "/": if p_emote[0] == "/" or p_emote[0] == "/":
p_emote = p_emote[1:] p_emote = p_emote[1:]
elif "../../characters" in p_emote: 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.pillow_timer.start(int(single_frame_duration * self.pillow_speed))
self.set_pillow_frame() 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): def play_pre(self, p_char, p_emote, duration, scaling = SCALING_AUTO):
p_char = p_char.lower() p_char = p_char.lower()
@ -881,6 +893,14 @@ class gui(QtGui.QWidget):
self.sidechar = AOCharMovie(self.viewport) self.sidechar = AOCharMovie(self.viewport)
self.sidechar.hide() 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 = QtGui.QLabel(self.viewport)
self.slide_overlay_animation = QtCore.QPropertyAnimation(self.slide_overlay, "geometry") self.slide_overlay_animation = QtCore.QPropertyAnimation(self.slide_overlay, "geometry")
self.slide_overlay.hide() self.slide_overlay.hide()
@ -1903,7 +1923,7 @@ class gui(QtGui.QWidget):
self.changeEvidence(0, 0) self.changeEvidence(0, 0)
def onClick_callMod(self): def onClick_callMod(self):
#self.do_slide() # self.do_slide()
if "modcall_reason" in self.features: if "modcall_reason" in self.features:
reason, ok = QtGui.QInputDialog.getText(self, "Call a moderator", "Enter your reason.") reason, ok = QtGui.QInputDialog.getText(self, "Call a moderator", "Enter your reason.")
@ -2340,6 +2360,9 @@ class gui(QtGui.QWidget):
self.slide_bg.show() 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) 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) 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) wit_pos = QtCore.QRect(0, 0, self.slide_bg.width(), VIEWPORT_H)
@ -2395,11 +2418,19 @@ class gui(QtGui.QWidget):
if x > -VIEWPORT_W: if x > -VIEWPORT_W:
self.char.move_slide(x) self.char.move_slide(x)
else: 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 self.slide_stage = 1
elif self.slide_stage == 1: elif self.slide_stage == 1:
if x <= -VIEWPORT_W and x >= -self.slide_bg.width() + self.slide_bg.width() / 2: 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: else:
if self.slide_last_wit:
self.slide_witness.hide()
self.char.show()
self.slide_stage = 2 self.slide_stage = 2
pass pass
else: else:
@ -2409,17 +2440,23 @@ class gui(QtGui.QWidget):
if x < -self.slide_bg.width() + self.slide_bg.width() / 2: if x < -self.slide_bg.width() + self.slide_bg.width() / 2:
self.char.move_slide(x + self.slide_bg.width() - VIEWPORT_W) self.char.move_slide(x + self.slide_bg.width() - VIEWPORT_W)
else: 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 self.slide_stage = 1
elif self.slide_stage == 1: elif self.slide_stage == 1:
if x <= -VIEWPORT_W and x >= -self.slide_bg.width() + self.slide_bg.width() / 2: 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: else:
if self.slide_last_wit:
self.slide_witness.hide()
self.char.show()
self.slide_stage = 2 self.slide_stage = 2
pass pass
else: else:
self.char.move_slide(x) self.char.move_slide(x)
def slide_done(self): def slide_done(self):
self.slide_bg.hide() self.slide_bg.hide()
@ -2503,7 +2540,8 @@ class gui(QtGui.QWidget):
self.is_additive = (m_chatmessage[ADDITIVE] == "1") self.is_additive = (m_chatmessage[ADDITIVE] == "1")
custom_objection = "custom" custom_objection = "custom"
try: objection_mod = int(m_chatmessage[SHOUT_MOD]) try:
objection_mod = int(m_chatmessage[SHOUT_MOD])
except: except:
if "4&" in m_chatmessage[SHOUT_MOD]: # custom objection name if "4&" in m_chatmessage[SHOUT_MOD]: # custom objection name
objection_mod = 4 objection_mod = 4
@ -2764,6 +2802,9 @@ class gui(QtGui.QWidget):
self.sidechar.move(0, 0) 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()) 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] != "-": 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 # sfx_delay = int(self.m_chatmessage[SFX_DELAY]) * 60