diff --git a/AO2XPbase/ao2xp_themes/default/theme.py b/AO2XPbase/ao2xp_themes/default/theme.py index 108c414..a0dadf5 100644 --- a/AO2XPbase/ao2xp_themes/default/theme.py +++ b/AO2XPbase/ao2xp_themes/default/theme.py @@ -19,8 +19,9 @@ self.flipbutton.move(self.posdropdown.x() + self.posdropdown.width() + 4, self.c self.sfxbutton.move(self.flipbutton.x(), self.flipbutton.y() + 14) self.nointerruptbtn.move(self.flipbutton.x() + 140, self.flipbutton.y()) self.additivebtn.move(self.nointerruptbtn.x(), self.sfxbutton.y()) - self.deskbtn.move(self.flipbutton.x()+70, self.flipbutton.y()) +self.slidebutton.move(self.deskbtn.x(), self.sfxbutton.y()) + self.effectdropdown.setGeometry(self.posdropdown.x(), self.colordropdown.y(), 72, 20) self.callmodbtn.setGeometry(10, 376 + 62, 60, 23) self.settingsbtn.setGeometry(self.callmodbtn.x()+self.callmodbtn.size().width(), 376 + 62, self.callmodbtn.width(), 23) diff --git a/buttons.py b/buttons.py index f9ab3f8..eb92e80 100644 --- a/buttons.py +++ b/buttons.py @@ -28,6 +28,7 @@ class AOToggleButton(QtGui.QLabel): class CustomObjection(QtGui.QLabel): pressed = False + clicked = QtCore.pyqtSignal() def __init__(self, parent, x, y): super(CustomObjection, self).__init__(parent) self.parent = parent @@ -52,6 +53,7 @@ class CustomObjection(QtGui.QLabel): self.parent.objectbtn.setPressed(False) self.parent.holditbtn.setPressed(False) self.parent.takethatbtn.setPressed(False) + self.clicked.emit() class WTCEbuttons(QtGui.QLabel): clicked = QtCore.pyqtSignal(int, int) @@ -78,6 +80,7 @@ class WTCEbuttons(QtGui.QLabel): class Objections(QtGui.QLabel): pressed = False type = 0 + clicked = QtCore.pyqtSignal() def __init__(self, parent, x, y, type): super(Objections, self).__init__(parent) self.parent = parent @@ -117,6 +120,7 @@ class Objections(QtGui.QLabel): elif self.type == 3: self.parent.objectbtn.setPressed(False) self.parent.holditbtn.setPressed(False) + self.clicked.emit() class PixmapButton(QtGui.QAbstractButton): def __init__(self, parent, pixmap): diff --git a/gameview.py b/gameview.py index 6ad5f9e..76ff24d 100644 --- a/gameview.py +++ b/gameview.py @@ -44,6 +44,7 @@ FRAME_SFX = 28 ADDITIVE = 29 EFFECTS = 30 BLIPS = 31 +SLIDE = 32 INLINE_BLUE = 0 INLINE_GREEN = 1 @@ -800,7 +801,7 @@ class gui(QtGui.QWidget): time_mod = 40 blip = "male" blipsnd = None - chatmessage_size = 32 + chatmessage_size = 33 m_chatmessage = [] blank_blip = False chatmessage_is_empty = False @@ -857,6 +858,13 @@ class gui(QtGui.QWidget): self.court = QtGui.QLabel(self.viewport) self.court.resize(VIEWPORT_W, VIEWPORT_H) + + self.slide_available = False + self.slide_bg = QtGui.QLabel(self.viewport) + self.slide_bg_animation = QtCore.QPropertyAnimation(self.slide_bg, "geometry") + self.slide_bg_animation.finished.connect(self.slide_done) + self.slide_bg.hide() + self.zoom = ZoomLines(self.viewport) self.char = AOCharMovie(self.viewport) @@ -864,6 +872,11 @@ class gui(QtGui.QWidget): self.sidechar = AOCharMovie(self.viewport) self.sidechar.hide() + self.slide_has_overlay = False + self.slide_overlay = QtGui.QLabel(self.viewport) + self.slide_overlay_animation = QtCore.QPropertyAnimation(self.slide_overlay, "geometry") + self.slide_overlay.hide() + self.bench = QtGui.QLabel(self.viewport) self.bench.resize(VIEWPORT_W, VIEWPORT_H) bench = QtGui.QPixmap(AOpath + 'background/default/defensedesk.png') @@ -1119,7 +1132,7 @@ class gui(QtGui.QWidget): self.gametabs.addTab(self.gametab_mute, 'Mu&te') self.gametabs.addTab(self.gametab_iniswap, '&INI swap') self.gametabs.addTab(self.gametab_pair, 'Pai&r') - self.gametabs.addTab(self.gametab_misc, 'Mi&sc') + self.gametabs.addTab(self.gametab_misc, 'E&xtras') self.gametabs.addTab(self.gametab_msgqueue, '&Queue') self.musicareatabs.addTab(self.gametab_music, "&Music") @@ -1152,11 +1165,12 @@ class gui(QtGui.QWidget): self.sfxbutton = QtGui.QCheckBox(self) self.sfxbutton.setChecked(True) self.sfxbutton.stateChanged.connect(self.changeSfxCheck) - self.sfxbutton.setText('Play &pre-animation') + self.sfxbutton.setText('&Pre-anim') self.sfxbutton.setToolTip("Play a character-specific animation before the next message") self.nointerruptbtn = QtGui.QCheckBox(self) self.nointerruptbtn.setChecked(False) + self.nointerruptbtn.stateChanged.connect(self.icchat_focus) self.nointerruptbtn.setText('No Interrupt') self.nointerruptbtn.setToolTip("Show the next message immediately, ignoring animations") @@ -1171,8 +1185,15 @@ class gui(QtGui.QWidget): self.deskbtn = QtGui.QCheckBox(self) self.deskbtn.setChecked(True) self.deskbtn.setText('Desk') + self.deskbtn.stateChanged.connect(self.icchat_focus) self.deskbtn.resize(self.nointerruptbtn.sizeHint()) self.deskbtn.setToolTip('Show or hide the desk in front of your character') + + self.slidebutton = QtGui.QCheckBox(self) + self.slidebutton.stateChanged.connect(self.icchat_focus) + self.slidebutton.setText('&Slide') + self.slidebutton.resize(self.slidebutton.sizeHint()) + self.slidebutton.setToolTip("Tell clients to play courtroom slide animations for your message") self.effectdropdown = QtGui.QComboBox(self) self.effectdropdown.setToolTip('Show this effect on your next message') @@ -1185,7 +1206,7 @@ class gui(QtGui.QWidget): self.settingsbtn.clicked.connect(self.gamewindow.showSettings) self.changechar = QtGui.QPushButton(self) - self.changechar.setText('&Switch character') + self.changechar.setText('Switch &character') self.changechar.clicked.connect(self.onClick_changeChar) spacing = 1 @@ -1199,7 +1220,9 @@ class gui(QtGui.QWidget): for i in range(self.max_emotes_on_page): x_pos = (40 + spacing) * x_mod_count y_pos = (40 + spacing) * y_mod_count - self.emotebuttons.append(EmoteButton(self, left + x_pos, top + y_pos, i)) + button = EmoteButton(self, left + x_pos, top + y_pos, i) + button.clicked.connect(self.icchat_focus) + self.emotebuttons.append(button) x_mod_count += 1 if x_mod_count == columns: x_mod_count = 0 @@ -1217,12 +1240,17 @@ class gui(QtGui.QWidget): self.realizationbtn.setToolTip('Show the next message with a realization effect') self.realizationsnd = audio.loadhandle(False, AOpath + 'sounds/general/sfx-realization.wav', 0, 0, 0) self.shakebtn = buttons.AOToggleButton(self, 265+42 + 164, 192 + 304, "screenshake") # AO 2.8 + self.shakebtn.clicked.connect(self.icchat_focus) self.shakebtn.setToolTip('Show the next message with a shaking effect') self.customobject = buttons.CustomObjection(self, 250 + 516 - 30, 312 + 40) self.takethatbtn = buttons.Objections(self, 170+ 516 - 20, 312 + 40, 3) self.objectbtn = buttons.Objections(self, 90+ 516 - 10, 312 + 40, 2) self.holditbtn = buttons.Objections(self, 10+ 516, 312 + 40, 1) + self.takethatbtn.clicked.connect(self.icchat_focus) + self.objectbtn.clicked.connect(self.icchat_focus) + self.holditbtn.clicked.connect(self.icchat_focus) + self.customobject.clicked.connect(self.icchat_focus) self.objectsnd = 0 self.defensebar = buttons.PenaltyBars(self, 1) @@ -1304,7 +1332,6 @@ class gui(QtGui.QWidget): self.evidence_editor = EditEvidenceDialog(self) self.connect(self, QtCore.SIGNAL('showMessage(QString, QString, QString)'), self.showMessage) - self.setBackground('default') self.charselect = charselect.charselect(self) @@ -1357,6 +1384,9 @@ class gui(QtGui.QWidget): self.icchatinput.home(False) self.icchatinput.insert(" ") self.icchatinput.end(False) + self.icchat_focus() + + def icchat_focus(self): self.icchatinput.setFocus() def onRealizationButton(self): @@ -1364,6 +1394,7 @@ class gui(QtGui.QWidget): self.effectdropdown.setCurrentIndex(1) # realization elif self.effectdropdown.currentText() == "realization": self.effectdropdown.setCurrentIndex(0) + self.icchat_focus() def onOOCLoginBtn(self): if not self.oocnameinput.text(): @@ -1534,6 +1565,7 @@ class gui(QtGui.QWidget): netmsg += str(self.prosecutionbar.getHealth() - 1) + '#' netmsg += '%' self.tcp.send(netmsg) + self.icchat_focus() def penaltyBarPlus(self, barType): netmsg = 'HP#' + str(barType) + '#' @@ -1547,6 +1579,7 @@ class gui(QtGui.QWidget): netmsg += str(self.prosecutionbar.getHealth() + 1) + '#' netmsg += '%' self.tcp.send(netmsg) + self.icchat_focus() def setWhiteFlash(self, on, realizationtype=0, msec=0): self.whiteflashlab.setVisible(on) @@ -1564,6 +1597,7 @@ class gui(QtGui.QWidget): self.tcp.send('RT#testimony' + str(type + 1) + '#%') else: self.tcp.send("RT#judgeruling#" +str(variant)+ "#%") + self.icchat_focus() def onPVPacket(self, charname): self.gamewindow.setFixedSize(self.width, self.height) @@ -1867,6 +1901,8 @@ class gui(QtGui.QWidget): self.changeEvidence(0, 0) def onClick_callMod(self): + #self.do_slide() + if "modcall_reason" in self.features: reason, ok = QtGui.QInputDialog.getText(self, "Call a moderator", "Enter your reason.") if ok and reason: @@ -1882,6 +1918,7 @@ class gui(QtGui.QWidget): if on == 2: on = 1 self.myflip = on + self.icchat_focus() def changeSfxCheck(self, on): if on == 2: @@ -1890,6 +1927,7 @@ class gui(QtGui.QWidget): self.nointerruptbtn.setDisabled(not on) if on == 0: self.nointerruptbtn.setChecked(False) + self.icchat_focus() def onClicked_msgqueue(self, item): for i in range(len(self.msgqueueList)): @@ -2214,6 +2252,19 @@ class gui(QtGui.QWidget): p_effect = ini.read_ini(AOpath+"characters/"+self.charname+"/char.ini", "options", "effects") msg += str(fx + "|" + p_effect + "|" + fx_sound + "#").encode('utf-8') self.effectdropdown.setCurrentIndex(0) + + # AO 2.10.2+ + if "custom_blips" in self.features: + blip = ini.read_ini(AOpath+"characters/"+self.charname+"/char.ini", "options", "blips") + if not blip: + blip = ini.read_ini(AOpath+"characters/"+self.charname+"/char.ini", "options", "gender") + if blip: + msg += str(blip) + "#" + else: + msg += "#" + + # Slides + msg += "0#" msg += "%" @@ -2225,7 +2276,7 @@ class gui(QtGui.QWidget): self.realizationbtn.setPressed(False) self.shakebtn.setPressed(False) - def setBackground(self, bg): + def setBackground(self, bg, reset=False): if not exists(AOpath + 'background/' + bg): bg = 'default' @@ -2254,11 +2305,59 @@ class gui(QtGui.QWidget): setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg)) else: setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg)) - self.set_scene(True) - self.set_desk() + + court = AOpath + 'background/' + bg + '/court.png' + self.slide_available = exists(court) + + if self.slide_available: + slide = QtGui.QPixmap(court) + slide_width = slide.width() * 2 + + self.slide_bg.resize(slide_width, VIEWPORT_H) + self.slide_bg.setPixmap(slide.scaled(slide.width() * 2, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) + + court_overlay = AOpath + 'background/' + bg + '/court_overlay.png' + if exists(court_overlay): + slide_overlay = QtGui.QPixmap(court_overlay) + self.slide_overlay.resize(slide_width, VIEWPORT_H) + self.slide_overlay.setPixmap(slide_overlay.scaled(slide.width() * 2, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) + self.slide_has_overlay = True + else: + self.slide_has_overlay = False + + self.bench.show() self.chatbox.hide() self.char.hide() + + if reset: + self.set_scene(True) + + def do_slide(self): + self.setBackground("default") + + slide_time = 1000 + self.bench.hide() + + self.slide_bg.show() + bg_start = QtCore.QRect(0, 0, self.slide_bg.width(), self.slide_bg.height()) + bg_end = QtCore.QRect(-bg_start.size().width() + VIEWPORT_W, bg_start.top(), bg_start.size().width(), VIEWPORT_H) + self.slide_bg_animation.setStartValue(bg_start) + self.slide_bg_animation.setEndValue(bg_end) + self.slide_bg_animation.setDuration(slide_time) + self.slide_bg_animation.setEasingCurve(QtCore.QEasingCurve.InOutQuad) + self.slide_bg_animation.start() + if self.slide_has_overlay: + self.slide_overlay.show() + self.slide_overlay_animation.setStartValue(bg_start) + self.slide_overlay_animation.setEndValue(bg_end) + self.slide_overlay_animation.setDuration(slide_time) + self.slide_overlay_animation.setEasingCurve(QtCore.QEasingCurve.InOutQuad) + self.slide_overlay_animation.start() + + def slide_done(self): + self.slide_bg.hide() + self.slide_overlay.hide() def netmsg_hp(self, type, health): if type == 1: @@ -2282,6 +2381,8 @@ class gui(QtGui.QWidget): m_chatmessage[n_string] = p_contents[n_string] else: m_chatmessage[n_string] = "" + + print m_chatmessage f_char_id = int(m_chatmessage[CHAR_ID]) @@ -3258,7 +3359,6 @@ class gui(QtGui.QWidget): self.setBackground(background.lower()) self.set_scene(True) - self.set_desk() self.chatbox.hide() for msg in oocjoin: @@ -3515,9 +3615,8 @@ class EditEvidenceDialog(QtGui.QDialog): def setTitle(self): self.setWindowTitle('Add evidence' if not self.gamegui.privateinv else "Add evidence to private inventory") - - class EmoteButton(QtGui.QLabel): + clicked = QtCore.pyqtSignal() def __init__(self, gamewindow, x, y, id): super(EmoteButton, self).__init__(gamewindow) @@ -3552,6 +3651,7 @@ class EmoteButton(QtGui.QLabel): def mousePressEvent(self, event): self.gamewindow.changeEmote(False, self.emoteid) + self.clicked.emit() class BackEmoteButton(QtGui.QLabel): @@ -3683,7 +3783,7 @@ class TCP_Thread(QtCore.QThread): self.parent.playMusic(music) elif header == 'BN': - self.newBackground.emit(network[1].lower()) + self.newBackground.emit(network[1].lower(), True) elif header == 'CT': name = decode_ao_str(network[1].decode('utf-8'))