From 1b30f79fab4af66a3619103c95bc8feb8fbc0f45 Mon Sep 17 00:00:00 2001 From: cidoku Date: Tue, 7 Oct 2025 05:28:40 -0300 Subject: [PATCH] style --- AO2XP.py | 10 +- AO2XPbase/ao2xp_themes/dark/theme.py | 6 +- AO2XPbase/ao2xp_themes/default/theme.py | 2 +- buttons.py | 52 +- charselect.py | 48 +- constants.py | 10 +- demo.py | 76 +- gameview.py | 2606 +++++++++++------------ mainmenu.py | 58 +- options.py | 14 +- packets.py | 66 +- 11 files changed, 1474 insertions(+), 1474 deletions(-) diff --git a/AO2XP.py b/AO2XP.py index abb5507..a259869 100644 --- a/AO2XP.py +++ b/AO2XP.py @@ -62,7 +62,7 @@ class gamewindow(QtGui.QMainWindow): self.aboutgui = self.aboutBox() if demofile: - self.gamewidget.start_demo(demofile) + self.gamewidget.startDemo(demofile) self.stackwidget.setCurrentWidget(self.gamewidget) def center(self): @@ -71,13 +71,13 @@ class gamewindow(QtGui.QMainWindow): frameGm.moveCenter(centerPoint) self.move(frameGm.topLeft()) - def showGame(self, tcp, playerlist, charlist, musiclist, background, evidence, areas, features=[], oocjoin=[], hplist=[], webAO_bucket=""): - self.gamewidget.disconnectnow = False - self.gamewidget.start_game(tcp, playerlist, charlist, musiclist, background, evidence, areas, features, oocjoin, hplist, webAO_bucket) + def showGame(self, tcp, playerList, charList, musicList, background, evidence, areas, features=[], joinOOC=[], hpList=[], webAO_bucket=""): + self.gamewidget.disconnectNow = False + self.gamewidget.startGame(tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, webAO_bucket) self.stackwidget.setCurrentWidget(self.gamewidget) def returnToMenu(self): - self.gamewidget.disconnectnow = True + self.gamewidget.disconnectNow = True self.setFixedSize(self.widget.lobbyimg.size().width(), self.widget.lobbyimg.size().height()) self.widget.onClicked_cancelconnect() self.stackwidget.setCurrentWidget(self.widget) diff --git a/AO2XPbase/ao2xp_themes/dark/theme.py b/AO2XPbase/ao2xp_themes/dark/theme.py index 3fb344f..6c84feb 100644 --- a/AO2XPbase/ao2xp_themes/dark/theme.py +++ b/AO2XPbase/ao2xp_themes/dark/theme.py @@ -1,4 +1,4 @@ -with open(AO2XPpath+"ao2xp_themes/default/theme.py") as t: +with open(AO2XPpath + "ao2xp_themes/default/theme.py") as t: exec t self.gamewindow.setObjectName("main") @@ -7,7 +7,7 @@ self.sliderlabel2.setObjectName("sfxlabel") self.sliderlabel3.setObjectName("blipslabel") self.notmutedlabel.setObjectName("notmutedlabel") self.mutedlabel.setObjectName("mutedlabel") -self.iniswapinfo.setObjectName("iniswapinfo") +self.iniSwapInfo.setObjectName("iniSwapInfo") self.pairoffset_l.setObjectName("pairoffset_l") self.ypairoffset_l.setObjectName("ypairoffset_l") self.pair_order_l.setObjectName("pair_order_l") @@ -22,7 +22,7 @@ self.gametab_music.setObjectName("gametab_music") self.gametab_players.setObjectName("gametab_player") self.gamewindow.setStyleSheet(""" - QWidget#main, QSlider, QCheckBox, QLabel#musiclabel, QLabel#sfxlabel, QLabel#blipslabel, QLabel#notmutedlabel, QLabel#mutedlabel, QLabel#iniswapinfo, QLabel#pairoffset_l, QLabel#ypairoffset_l, QLabel#pair_order_l, QWidget#gametab_log, QWidget#gametab_evidence, QWidget#gametab_mute, QWidget#gametab_iniswap, QWidget#gametab_pair, QWidget#gametab_misc, QWidget#gametab_msgqueue, QWidget#gametab_music, QWidget#gametab_player + QWidget#main, QSlider, QCheckBox, QLabel#musiclabel, QLabel#sfxlabel, QLabel#blipslabel, QLabel#notmutedlabel, QLabel#mutedlabel, QLabel#iniSwapInfo, QLabel#pairoffset_l, QLabel#ypairoffset_l, QLabel#pair_order_l, QWidget#gametab_log, QWidget#gametab_evidence, QWidget#gametab_mute, QWidget#gametab_iniswap, QWidget#gametab_pair, QWidget#gametab_misc, QWidget#gametab_msgqueue, QWidget#gametab_music, QWidget#gametab_player { color: #eeeeee; background: #111111; diff --git a/AO2XPbase/ao2xp_themes/default/theme.py b/AO2XPbase/ao2xp_themes/default/theme.py index 2038243..b11808f 100644 --- a/AO2XPbase/ao2xp_themes/default/theme.py +++ b/AO2XPbase/ao2xp_themes/default/theme.py @@ -97,7 +97,7 @@ self.iniswapconfirm.resize(self.iniswapconfirm.sizeHint()) self.iniswapconfirm.move(714 - 304 - 22 - self.iniswapconfirm.size().width(), 8) self.iniswapreset.resize(self.iniswapconfirm.size()) self.iniswapreset.move(714 - 304 - 22 - self.iniswapconfirm.size().width(), 16 + self.iniswapconfirm.size().height()) -self.iniswapinfo.setGeometry(8, 32, 192, 24) +self.iniSwapInfo.setGeometry(8, 32, 192, 24) self.iniswaprefresh.move(8, 64) self.iniswaprefresh.resize(self.iniswaprefresh.sizeHint()) diff --git a/buttons.py b/buttons.py index 83db411..96babfd 100644 --- a/buttons.py +++ b/buttons.py @@ -8,8 +8,8 @@ class AOToggleButton(QtGui.QLabel): def __init__(self, parent, btnname): super(AOToggleButton, self).__init__(parent) - self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/%s.png" % btnname) - self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/%s_pressed.png" % btnname) + self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/%s.png" % btnname) + self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/%s_pressed.png" % btnname) self.setPixmap(self.notpressed_pix) self.show() @@ -34,8 +34,8 @@ class CustomObjection(QtGui.QLabel): super(CustomObjection, self).__init__(parent) self.parent = parent self.resize(76, 28) - self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/custom.png") - self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/custom_selected.png") + self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/custom.png") + self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/custom_selected.png") self.setPixmap(self.notpressed_pix) self.show() @@ -64,14 +64,14 @@ class WTCEbuttons(QtGui.QLabel): super(WTCEbuttons, self).__init__(parent) self.resize(85, 42) if type == 0: - self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/witnesstestimony.png")) + self.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/witnesstestimony.png")) elif type == 1: - self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/crossexamination.png")) + self.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/crossexamination.png")) elif type == 2: if variant == 0: - self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/notguilty.png")) + self.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/notguilty.png")) elif variant == 1: - self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/guilty.png")) + self.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/guilty.png")) self.type = type self.variant = variant @@ -88,14 +88,14 @@ class Objections(QtGui.QLabel): self.type = type self.resize(76, 28) if type == 1: - self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/holdit.png") - self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/holdit_selected.png") + self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/holdit.png") + self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/holdit_selected.png") elif type == 2: - self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/objection.png") - self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/objection_selected.png") + self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/objection.png") + self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/objection_selected.png") elif type == 3: - self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/takethat.png") - self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/takethat_selected.png") + self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/takethat.png") + self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/takethat_selected.png") self.setPixmap(self.notpressed_pix) self.show() @@ -165,15 +165,15 @@ class PenaltyBars(QtGui.QLabel): self.resize(84, 14) if type == 1: #defense bar. for i in range(11): - self.penaltybars.append(QtGui.QPixmap(AO2XPpath+"themes/default/defensebar"+str(i)+".png")) + self.penaltybars.append(QtGui.QPixmap(AO2XPpath + "themes/default/defensebar"+str(i)+".png")) side = "def" elif type == 2: #prosecution bar for i in range(11): - self.penaltybars.append(QtGui.QPixmap(AO2XPpath+"themes/default/prosecutionbar"+str(i)+".png")) + self.penaltybars.append(QtGui.QPixmap(AO2XPpath + "themes/default/prosecutionbar"+str(i)+".png")) side = "pro" self.side = side - self.minusbtn = PixmapButton(parent, QtGui.QPixmap(AO2XPpath+"themes/default/"+side+"minus.png")) - self.plusbtn = PixmapButton(parent, QtGui.QPixmap(AO2XPpath+"themes/default/"+side+"plus.png")) + self.minusbtn = PixmapButton(parent, QtGui.QPixmap(AO2XPpath + "themes/default/" + side + "minus.png")) + self.plusbtn = PixmapButton(parent, QtGui.QPixmap(AO2XPpath + "themes/default/" + side + "plus.png")) self.minusbtn.clicked.connect(self.minusClick) self.plusbtn.clicked.connect(self.plusClick) self.setPixmap(self.penaltybars[10]) @@ -193,8 +193,8 @@ class PenaltyBars(QtGui.QLabel): self.minusClicked.emit(self.type) def setHealth(self, health): - self.minusbtn.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/"+self.side+"minus.png")) - self.plusbtn.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/"+self.side+"plus.png")) + self.minusbtn.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/"+self.side+"minus.png")) + self.plusbtn.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/"+self.side+"plus.png")) self.setPixmap(self.penaltybars[health]) self.health = health @@ -216,7 +216,7 @@ class PresentButton(QtGui.QLabel): self.setPixmap(self.button_on) else: self.setPixmap(self.button_off) - self.gamegui.icchat_focus() + self.gamegui.ICChatFocus() class EmoteButton(QtGui.QLabel): clicked = QtCore.pyqtSignal() @@ -229,7 +229,7 @@ class EmoteButton(QtGui.QLabel): self.path = '' def paintEvent(self, event): - if self.gamewindow.mychar == -1: + if self.gamewindow.myChar == -1: return painter = QtGui.QPainter(self) @@ -267,8 +267,8 @@ class BackEmoteButton(QtGui.QLabel): self.show() def mousePressEvent(self, event): - self.gamewindow.current_emote_page -= 1 - self.gamewindow.set_emote_page() + self.gamewindow.currentEmotePage -= 1 + self.gamewindow.setEmotePage() class NextEmoteButton(QtGui.QLabel): @@ -279,5 +279,5 @@ class NextEmoteButton(QtGui.QLabel): self.show() def mousePressEvent(self, event): - self.gamewindow.current_emote_page += 1 - self.gamewindow.set_emote_page() + self.gamewindow.currentEmotePage += 1 + self.gamewindow.setEmotePage() diff --git a/charselect.py b/charselect.py index 82d7ccb..93934bd 100644 --- a/charselect.py +++ b/charselect.py @@ -30,7 +30,7 @@ class charselect(QtGui.QWidget): self.parent = parent self.page = 0 self.image = QtGui.QLabel(self) - self.image.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/charselect_background.png")) + self.image.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/charselect_background.png")) self.image.show() self.charsearch = QtGui.QLineEdit(self) @@ -54,8 +54,8 @@ class charselect(QtGui.QWidget): self.buttons = [] self.chartaken = [] - self.prevpage = PixmapButton(self, QtGui.QPixmap(AO2XPpath+"themes/default/arrow_left.png")) - self.nextpage = PixmapButton(self, QtGui.QPixmap(AO2XPpath+"themes/default/arrow_right.png")) + self.prevpage = PixmapButton(self, QtGui.QPixmap(AO2XPpath + "themes/default/arrow_left.png")) + self.nextpage = PixmapButton(self, QtGui.QPixmap(AO2XPpath + "themes/default/arrow_right.png")) self.setButtons() @@ -75,7 +75,7 @@ class charselect(QtGui.QWidget): for i in range(self.max_chars_on_page): self.buttons.append(CharIcon(self, i)) self.chartaken.append(QtGui.QLabel(self)) - self.chartaken[i].setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/char_taken.png")) + self.chartaken[i].setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/char_taken.png")) self.chartaken[i].hide() x_pos = (btn_width + x_spacing) * x_mod_count y_pos = (btn_height + y_spacing) * y_mod_count @@ -95,16 +95,16 @@ class charselect(QtGui.QWidget): self.nextpage.clicked.connect(self.nextPageButton) self.nextpage.show() - def showCharPage(self, charlist=None): - if not charlist: + def showCharPage(self, charList=None): + if not charList: filtered = False - charlist = self.charlist + charList = self.charList else: filtered = True for ind in range(self.page * self.max_chars_on_page, self.max_chars_on_page * (self.page + 1)): i = ind - (self.page * self.max_chars_on_page) - if ind >= len(charlist): + if ind >= len(charList): self.chartaken[i].hide() self.buttons[i].hide() self.nextpage.hide() @@ -117,37 +117,37 @@ class charselect(QtGui.QWidget): else: self.prevpage.hide() - char = charlist[ind][0].lower() - charid = charlist[ind][2] if filtered else ind + char = charList[ind][0].lower() + charid = charList[ind][2] if filtered else ind - if exists(AOpath+"characters/"+ char +"/char_icon.png"): # AO2 - self.setBtnImage.emit(AOpath+"characters/"+ char +"/char_icon.png", i, charid) - elif exists(AOpath+"misc/demothings/"+ char +"_char_icon.png"): # AO 1.7.5/1.8 - self.setBtnImage.emit(AOpath+"misc/demothings/"+ char +"_char_icon.png", i, charid) + if exists(AOpath + "characters/"+ char +"/char_icon.png"): # AO2 + self.setBtnImage.emit(AOpath + "characters/"+ char +"/char_icon.png", i, charid) + elif exists(AOpath + "misc/demothings/"+ char +"_char_icon.png"): # AO 1.7.5/1.8 + self.setBtnImage.emit(AOpath + "misc/demothings/"+ char +"_char_icon.png", i, charid) else: self.setBtnImage.emit("placeholder.png", i, charid) - if charlist[ind][1] == 0: # free slot + if charList[ind][1] == 0: # free slot self.chartaken[i].hide() else: self.chartaken[i].setAttribute(QtCore.Qt.WA_TransparentForMouseEvents) self.chartaken[i].show() self.buttons[i].show() - self.buttons[i].setToolTip(charlist[ind][0]) + self.buttons[i].setToolTip(charList[ind][0]) def showCharPageFiltered(self, name): - charlist = [] - for i, char in enumerate(self.charlist): + charList = [] + for i, char in enumerate(self.charList): if name.lower() in char[0].lower(): - charlist.append([char[0], char[1], i]) - self.showCharPage(charlist) + charList.append([char[0], char[1], i]) + self.showCharPage(charList) def quitToLobby(self): self.parent.gamewindow.returnToMenu() - def setCharList(self, charlist): - self.charlist = charlist + def setCharList(self, charList): + self.charList = charList self.showCharPage() def nextPageButton(self): @@ -168,8 +168,8 @@ class charselect(QtGui.QWidget): self.buttons[i].setCharIndex(charid) def onCharClicked(self, charid): - char = self.charlist[charid] - if self.parent.charname.lower() == char[0].lower(): + char = self.charList[charid] + if self.parent.charName.lower() == char[0].lower(): self.onCancel() return self.selectChar(charid) diff --git a/constants.py b/constants.py index 32db347..803879d 100644 --- a/constants.py +++ b/constants.py @@ -57,16 +57,16 @@ SCALING_AUTO = 0 SCALING_PIXEL = 1 SCALING_SMOOTH = 2 -def decode_ao_str(text): +def decodeAOString(text): return text.replace("", "%").replace("", "#").replace("", "#").replace("", "&").replace("", "$") -def encode_ao_str(text): +def encodeAOString(text): return text.replace("%", "").replace("#", "").replace("&", "").replace("$", "") -def get_scaling(scaling_str): - if scaling_str == "pixel" or scaling_str == "fast": +def getScaling(scaling): + if scaling == "pixel" or scaling == "fast": return SCALING_PIXEL - elif scaling_str == "smooth": + elif scaling == "smooth": return SCALING_SMOOTH else: return SCALING_AUTO diff --git a/demo.py b/demo.py index 9b57e1f..d167cf3 100644 --- a/demo.py +++ b/demo.py @@ -10,7 +10,7 @@ class DemoPlayer(QtCore.QObject): IC_Log = QtCore.pyqtSignal(str) OOC_Log = QtCore.pyqtSignal(str) charSlots = QtCore.pyqtSignal() - allEvidence = QtCore.pyqtSignal(list) + loadAllEvidence = QtCore.pyqtSignal(list) rainbowColor = QtCore.pyqtSignal(str) updatePlayerList = QtCore.pyqtSignal(str, int, int, str) timerUpdate = QtCore.pyqtSignal(int, int, int) @@ -20,36 +20,36 @@ class DemoPlayer(QtCore.QObject): self.parent = parent self.paused = False self.demo = [] - self.demo_length = len(self.demo) + self.demoLength = len(self.demo) self.time = 0 - self.demo_length_ms = 0 - self.wait_timer = QtCore.QTimer(self) - self.wait_timer.setSingleShot(True) - self.wait_timer.timeout.connect(self.timer_done) + self.demoLengthMs = 0 + self.waitTimer = QtCore.QTimer(self) + self.waitTimer.setSingleShot(True) + self.waitTimer.timeout.connect(self.timer_done) self.mc = [] # Music changes self.bn = [] # Background changes - self.last_music = "" - self.last_bg = "" + self.prevMusic = "" + self.prevBg = "" def start(self, file): self.paused = True - self.wait_timer.stop() + self.waitTimer.stop() self.time = 0 - self.demo_length_ms = 0 + self.demoLengthMs = 0 self.demo = [] self.mc = [] self.bn = [] - self.last_music = "" - self.last_bg = "" + self.prevMusic = "" + self.prevBg = "" self.load_demo(file) - print "[client] Started demo playback (%s commands)" % self.demo_length + print "[client] Started demo playback (%s commands)" % self.demoLength - self.parent.demoslider.setMaximum(self.demo_length - 1) + self.parent.demoslider.setMaximum(self.demoLength - 1) self.OOC_Log.emit("Demo playback started.") - secs = self.demo_length_ms / 1000 + secs = self.demoLengthMs / 1000 mins = secs / 60 hours = mins / 60 self.OOC_Log.emit("Approximate duration: %02d:%02d:%02d." % (hours, mins % 60, secs % 60)) @@ -59,11 +59,11 @@ class DemoPlayer(QtCore.QObject): def playpause(self): self.paused = not self.paused - if not self.paused and self.time < self.demo_length: + if not self.paused and self.time < self.demoLength: self.step() def step(self, skip_wait=False): - if self.time >= self.demo_length: + if self.time >= self.demoLength: self.time = 0 return @@ -78,36 +78,36 @@ class DemoPlayer(QtCore.QObject): if skip_wait: self.time += 1 else: - self.wait_timer.start(int(packet[1])) + self.waitTimer.start(int(packet[1])) return - packets.handle_packets(self, [packet], False) - if self.time < self.demo_length: - self.wait_timer.start(1) + packets.handlePackets(self, [packet], False) + if self.time < self.demoLength: + self.waitTimer.start(1) else: self.OOC_Log.emit("Demo playback finished.") def seek(self, time): - self.parent.inbox_timer.stop() - self.parent.inboxqueue = [] - self.wait_timer.stop() + self.parent.inboxTimer.stop() + self.parent.inboxQueue = [] + self.waitTimer.stop() self.time = time mc_times = [t[0] for t in self.mc] t = bisect_left(mc_times, self.time) - 1 if t >= 0: music = self.mc[t][1][1] - if music != self.last_music: - packets.handle_packets(self, [self.mc[t][1]], False) - self.last_music = music + if music != self.prevMusic: + packets.handlePackets(self, [self.mc[t][1]], False) + self.prevMusic = music bn_times = [t[0] for t in self.bn] t = bisect_left(bn_times, self.time) - 1 if t >= 0: bg = self.bn[t][1][1] - if bg != self.last_bg: - packets.handle_packets(self, [self.bn[t][1]], False) - self.last_bg = bg + if bg != self.prevBg: + packets.handlePackets(self, [self.bn[t][1]], False) + self.prevBg = bg self.step() @@ -125,10 +125,10 @@ class DemoPlayer(QtCore.QObject): elif packet[0] == "BN": self.bn.append((time, packet)) elif packet[0] == "wait": - self.demo_length_ms += int(packet[1]) + self.demoLengthMs += int(packet[1]) last_line = "" time += 1 - self.demo_length = len(self.demo) + self.demoLength = len(self.demo) def timer_done(self): if self.paused: @@ -137,7 +137,7 @@ class DemoPlayer(QtCore.QObject): def stop(self): self.paused = True - self.wait_timer.stop() + self.waitTimer.stop() class DemoRecorder(): def __init__(self): @@ -182,7 +182,7 @@ class DemoPicker(QtGui.QDialog): self.hide() self.treeview = get_demo_treeview() - self.treeview.doubleClicked.connect(self.on_demo_click) + self.treeview.doubleClicked.connect(self.onDemoClicked) self.cancelbtn = QtGui.QPushButton() self.cancelbtn.setText("Cancel") @@ -198,13 +198,13 @@ class DemoPicker(QtGui.QDialog): self.cancelbtn.setFocus() - def on_demo_click(self, item): - fname = get_demo_fname(self.treeview, item) + def onDemoClicked(self, item): + fname = getDemoFilename(self.treeview, item) if not fname: return - self.gamewindow.gamewidget.start_demo(fname) + self.gamewindow.gamewidget.startDemo(fname) self.gamewindow.stackwidget.setCurrentWidget(self.gamewindow.gamewidget) self.hide() @@ -223,7 +223,7 @@ def get_demo_treeview(): return demo_treeview -def get_demo_fname(treeview, item): +def getDemoFilename(treeview, item): model = treeview.model() if model.isDir(item): return None diff --git a/gameview.py b/gameview.py index 435ad8e..faa6f4a 100644 --- a/gameview.py +++ b/gameview.py @@ -69,7 +69,7 @@ def testPath(*args): return path return False -def download_thread(link, savepath): +def downloadThread(link, savepath): global DOWNLOAD_BLACKLIST if link in DOWNLOAD_BLACKLIST: return @@ -192,9 +192,9 @@ class ChatLogs(QtGui.QTextEdit): self.anchor = None self.savelog = False self.combinelog = False - self.set_logfiles(logfile) + self.setLogFiles(logfile) - def set_logfiles(self, logfile=None): + def setLogFiles(self, logfile=None): self.savelog = ini.read_ini_bool("AO2XP.ini", "General", "save logs") self.combinelog = ini.read_ini_bool("AO2XP.ini", "General", "combined logs") @@ -264,10 +264,10 @@ class ChatLogs(QtGui.QTextEdit): class AOCharMovie(QtGui.QLabel): done = QtCore.pyqtSignal() - use_pillow = 0 - pillow_frames = [] - pillow_frame = 0 - pillow_speed = 0 + usePillow = 0 + pillowFrames = [] + pillowFrame = 0 + pillowSpeed = 0 xx = 0 # for restoring from screenshake yy = 0 # for restoring from screenshake @@ -276,24 +276,24 @@ class AOCharMovie(QtGui.QLabel): self.parent = parent self.setAlignment(QtCore.Qt.AlignCenter) - self.time_mod = 60 - self.play_once = True - self.m_flipped = False + self.timeMod = 60 + self.playOnce = True + self.mFlipped = False self.scaling = SCALING_AUTO - self.show_on_play = True + self.showOnPlay = True - self.m_movie = QtGui.QMovie() + self.mMovie = QtGui.QMovie() - self.preanim_timer = QtCore.QTimer(self) - self.preanim_timer.setSingleShot(True) - self.pillow_timer = QtCore.QTimer(self) - self.pillow_timer.setSingleShot(True) + self.preanimTimer = QtCore.QTimer(self) + self.preanimTimer.setSingleShot(True) + self.pillowTimer = QtCore.QTimer(self) + self.pillowTimer.setSingleShot(True) - self.preanim_timer.timeout.connect(self.timer_done) - self.pillow_timer.timeout.connect(self.pillow_frame_change) - self.m_movie.frameChanged.connect(self.frame_change) + self.preanimTimer.timeout.connect(self.timer_done) + self.pillowTimer.timeout.connect(self.pillowFrameChange) + self.mMovie.frameChanged.connect(self.frameChange) - self.prev_gif_path = "" + self.prevGifPath = "" def resize(self): super(AOCharMovie, self).resize(self.parent.size()) @@ -304,250 +304,250 @@ class AOCharMovie(QtGui.QLabel): self.yy = y super(AOCharMovie, self).move(x, y) - def move_slide(self, x): + def moveSlide(self, x): super(AOCharMovie, self).move(x, self.y()) - def set_flipped(self, flip): - self.m_flipped = flip + def setFlipped(self, flip): + self.mFlipped = flip - def play(self, p_char, p_emote, emote_prefix, scaling = SCALING_AUTO, single_frame_duration = -1): - if not len(p_emote): + def play(self, pChar, pEmote, emotePrefix, scaling = SCALING_AUTO, singleFrameDuration = -1): + if not len(pEmote): return - if p_emote[0] == "/" or p_emote[0] == "/": - p_emote = p_emote[1:] - elif "../../characters" in p_emote: - a = p_emote.split("/") - p_char = a[3] + if pEmote[0] == "/" or pEmote[0] == "/": + pEmote = pEmote[1:] + elif "../../characters" in pEmote: + a = pEmote.split("/") + pChar = a[3] emote = a[4] - emote_prefix = "" - p_emote = emote + emotePrefix = "" + pEmote = emote - self.pillow_frames = [] - self.pillow_frame = 0 + self.pillowFrames = [] + self.pillowFrame = 0 self.scaling = scaling - p_char = p_char.lower() - p_emote = p_emote.lower() + pChar = pChar.lower() + pEmote = pEmote.lower() - apng_path = testPath( - AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".apng", - AOpath+"characters/"+p_char+"/"+emote_prefix+"/"+p_emote+".apng", - AOpath+"characters/"+p_char+"/"+p_emote+".apng", - AOpath+"characters/"+p_char+"/(a)"+p_emote+".apng", - AOpath+"characters/"+p_char+"/(b)"+p_emote+".apng", - AOpath+"characters/"+p_char+"/(a)/"+p_emote+".apng", - AOpath+"characters/"+p_char+"/(b)/"+p_emote+".apng" + apngPath = testPath( + AOpath + "characters/" + pChar + "/" + emotePrefix + pEmote + ".apng", + AOpath + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".apng", + AOpath + "characters/" + pChar + "/" + pEmote + ".apng", + AOpath + "characters/" + pChar + "/(a)" + pEmote + ".apng", + AOpath + "characters/" + pChar + "/(b)" + pEmote + ".apng", + AOpath + "characters/" + pChar + "/(a)/" + pEmote + ".apng", + AOpath + "characters/" + pChar + "/(b)/" + pEmote + ".apng" ) - placeholder_path = AO2XPpath+"themes/default/oldplaceholder.gif" + placeholderPath = AO2XPpath + "themes/default/oldplaceholder.gif" - img_path = "" + imgPath = "" - if apng_path: - img_path = apng_path - self.use_pillow = 1 + if apngPath: + imgPath = apngPath + self.usePillow = 1 else: if ini.read_ini_bool("AO2XP.ini", "General", "download characters"): - url = "base/characters/"+p_char.lower()+"/"+emote_prefix+p_emote.lower()+".apng" + url = "base/characters/" + pChar.lower() + "/" + emotePrefix + pEmote.lower() + ".apng" url = url.replace(" ", "%20") - thread.start_new_thread(download_thread, (url, apng_path)) + thread.start_new_thread(downloadThread, (url, apngPath)) - png_path = testPath( - AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".png", - AOpath+"characters/"+p_char+"/"+emote_prefix+"/"+p_emote+".png", - AOpath+"characters/"+p_char+"/"+p_emote+".png", - AOpath+"characters/"+p_char+"/(a)"+p_emote+".png", - AOpath+"characters/"+p_char+"/(b)"+p_emote+".png", - AOpath+"characters/"+p_char+"/(a)/"+p_emote+".png", - AOpath+"characters/"+p_char+"/(b)/"+p_emote+".png" + pngPath = testPath( + AOpath + "characters/" + pChar + "/" + emotePrefix + pEmote + ".png", + AOpath + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".png", + AOpath + "characters/" + pChar + "/" + pEmote + ".png", + AOpath + "characters/" + pChar + "/(a)" + pEmote + ".png", + AOpath + "characters/" + pChar + "/(b)" + pEmote + ".png", + AOpath + "characters/" + pChar + "/(a)/" + pEmote + ".png", + AOpath + "characters/" + pChar + "/(b)/" + pEmote + ".png" ) - if png_path: - img_path = png_path - self.use_pillow = 0 + if pngPath: + imgPath = pngPath + self.usePillow = 0 else: if ini.read_ini_bool("AO2XP.ini", "General", "download characters"): - url = "base/characters/"+p_char.lower()+"/"+emote_prefix+p_emote.lower()+".png" + url = "base/characters/" + pChar.lower() + "/" + emotePrefix + pEmote.lower() + ".png" url = url.replace(" ", "%20") - thread.start_new_thread(download_thread, (url, png_path)) + thread.start_new_thread(downloadThread, (url, pngPath)) - webp_path = testPath( - AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".webp", - AOpath+"characters/"+p_char+"/"+emote_prefix+"/"+p_emote+".webp", - AOpath+"characters/"+p_char+"/"+p_emote+".webp", - AOpath+"characters/"+p_char+"/(a)"+p_emote+".webp", - AOpath+"characters/"+p_char+"/(b)"+p_emote+".webp", - AOpath+"characters/"+p_char+"/(a)/"+p_emote+".webp", - AOpath+"characters/"+p_char+"/(b)/"+p_emote+".webp" + webpPath = testPath( + AOpath + "characters/" + pChar + "/" + emotePrefix + pEmote + ".webp", + AOpath + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".webp", + AOpath + "characters/" + pChar + "/" + pEmote + ".webp", + AOpath + "characters/" + pChar + "/(a)" + pEmote + ".webp", + AOpath + "characters/" + pChar + "/(b)" + pEmote + ".webp", + AOpath + "characters/" + pChar + "/(a)/" + pEmote + ".webp", + AOpath + "characters/" + pChar + "/(b)/" + pEmote + ".webp" ) - if webp_path: - img_path = webp_path - self.use_pillow = 2 + if webpPath: + imgPath = webpPath + self.usePillow = 2 else: if ini.read_ini_bool("AO2XP.ini", "General", "download characters"): - url = "base/characters/"+p_char.lower()+"/"+p_emote.lower()+".webp" + url = "base/characters/" + pChar.lower() + "/"+pEmote.lower() + ".webp" url = url.replace(" ", "%20") - thread.start_new_thread(download_thread, (url, webp_path)) + thread.start_new_thread(downloadThread, (url, webpPath)) - gif_path = testPath( - AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif", - AOpath+"characters/"+p_char+"/"+emote_prefix+"/"+p_emote+".gif", - AOpath+"characters/"+p_char+"/"+p_emote+".gif", - AOpath+"characters/"+p_char+"/(a)"+p_emote+".gif", - AOpath+"characters/"+p_char+"/(b)"+p_emote+".gif", - AOpath+"characters/"+p_char+"/(a)/"+p_emote+".gif", - AOpath+"characters/"+p_char+"/(b)/"+p_emote+".gif" + gifPath = testPath( + AOpath + "characters/" + pChar + "/" + emotePrefix + pEmote + ".gif", + AOpath + "characters/" + pChar + "/" + emotePrefix + "/" + pEmote + ".gif", + AOpath + "characters/" + pChar + "/" + pEmote + ".gif", + AOpath + "characters/" + pChar + "/(a)" + pEmote + ".gif", + AOpath + "characters/" + pChar + "/(b)" + pEmote + ".gif", + AOpath + "characters/" + pChar + "/(a)/" + pEmote + ".gif", + AOpath + "characters/" + pChar + "/(b)/" + pEmote + ".gif" ) - if gif_path: - img_path = gif_path - self.use_pillow = 0 + if gifPath: + imgPath = gifPath + self.usePillow = 0 else: if ini.read_ini_bool("AO2XP.ini", "General", "download characters"): - url = "base/characters/"+p_char.lower()+"/"+emote_prefix+p_emote.lower()+".gif" + url = "base/characters/" + pChar.lower() + "/" + emotePrefix + pEmote.lower() + ".gif" url = url.replace(" ", "%20") - thread.start_new_thread(download_thread, (url, gif_path)) + thread.start_new_thread(downloadThread, (url, gifPath)) - if exists(placeholder_path): - img_path = placeholder_path - print "[debug] Sprite not found: ", p_char, p_emote, emote_prefix + if exists(placeholderPath): + imgPath = placeholderPath + print "[debug] Sprite not found: ", pChar, pEmote, emotePrefix else: - img_path = "" - self.use_pillow = 0 + imgPath = "" + self.usePillow = 0 - if img_path == "": - img_path = self.prev_gif_path + if imgPath == "": + imgPath = self.prevGifPath # Second check just in case - if img_path == "": - if exists(placeholder_path): - img_path = placeholder_path - print "[debug] Sprite not found: ", p_char, p_emote, emote_prefix + if imgPath == "": + if exists(placeholderPath): + imgPath = placeholderPath + print "[debug] Sprite not found: ", pChar, pEmote, emotePrefix else: - img_path = "placeholder.png" + imgPath = "placeholder.png" else: - self.prev_gif_path = img_path + self.prevGifPath = imgPath - #print "[debug]", p_char, emote_prefix, p_emote, "(!) path is null!" if img_path == "" else img_path + #print "[debug]", pChar, emotePrefix, pEmote, "(!) path is null!" if imgPath == "" else imgPath - if not self.use_pillow: - self.m_movie.setFileName(img_path) - self.m_movie.start() - elif self.use_pillow == 1: # apng - self.pillow_frames = images.load_apng(apng_path) - if len(self.pillow_frames) > 1: - self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed)) + if not self.usePillow: + self.mMovie.setFileName(imgPath) + self.mMovie.start() + elif self.usePillow == 1: # apng + self.pillowFrames = images.load_apng(apngPath) + if len(self.pillowFrames) > 1: + self.pillowTimer.start(int(self.pillowFrames[0][1] * self.pillowSpeed)) else: - self.pillow_timer.start(int(single_frame_duration * self.pillow_speed)) + self.pillowTimer.start(int(singleFrameDuration * self.pillowSpeed)) - self.set_pillow_frame() - elif self.use_pillow == 2: # webp + self.setPillowFrame() + elif self.usePillow == 2: # webp try: - self.pillow_frames = images.load_webp(webp_path) - if len(self.pillow_frames) > 1: - self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed)) + self.pillowFrames = images.load_webp(webpPath) + if len(self.pillowFrames) > 1: + self.pillowTimer.start(int(self.pillowFrames[0][1] * self.pillowSpeed)) else: - self.pillow_timer.start(int(single_frame_duration * self.pillow_speed)) + self.pillowTimer.start(int(singleFrameDuration * self.pillowSpeed)) - self.set_pillow_frame() + self.setPillowFrame() except: - if exists(placeholder_path): - img_path = placeholder_path + if exists(placeholderPath): + imgPath = placeholderPath print "[debug] Couldn't load webp sprite!" else: - img_path = "placeholder.png" - self.m_movie.setFileName(img_path) - self.m_movie.start() + imgPath = "placeholder.png" + self.mMovie.setFileName(imgPath) + self.mMovie.start() - if self.show_on_play: + if self.showOnPlay: self.show() - def play_pre(self, p_char, p_emote, duration, scaling = SCALING_AUTO): - p_char = p_char.lower() + def playPre(self, pChar, pEmote, duration, scaling = SCALING_AUTO): + pChar = pChar.lower() - gif_path = AOpath+"characters/"+p_char+"/"+p_emote+".gif" - apng_path = AOpath+"characters/"+p_char+"/"+p_emote+".apng" - webp_path = AOpath+"characters/"+p_char+"/"+p_emote+".webp" + gifPath = AOpath + "characters/" + pChar + "/" + pEmote + ".gif" + apngPath = AOpath + "characters/" + pChar + "/" + pEmote + ".apng" + webpPath = AOpath + "characters/" + pChar + "/" + pEmote + ".webp" - full_duration = duration * self.time_mod - real_duration = 0 + fullDuration = duration * self.timeMod + realDuration = 0 - self.play_once = False - self.m_movie.stop() + self.playOnce = False + self.mMovie.stop() self.clear() - if exists(apng_path): - real_duration = images.get_apng_duration(apng_path) - elif exists(webp_path): - real_duration = images.get_webp_duration(webp_path) - elif exists(gif_path): - self.m_movie.setFileName(gif_path) - self.m_movie.jumpToFrame(0) - for n_frame in range(self.m_movie.frameCount()): - real_duration += self.m_movie.nextFrameDelay() - self.m_movie.jumpToFrame(n_frame + 1) + if exists(apngPath): + realDuration = images.get_apngDuration(apngPath) + elif exists(webpPath): + realDuration = images.get_webpDuration(webpPath) + elif exists(gifPath): + self.mMovie.setFileName(gifPath) + self.mMovie.jumpToFrame(0) + for nFrame in range(self.mMovie.frameCount()): + realDuration += self.mMovie.nextFrameDelay() + self.mMovie.jumpToFrame(nFrame + 1) - percentage_modifier = 100.0 + percentageModifier = 100.0 - if real_duration != 0 and duration != 0: - modifier = full_duration / float(real_duration) - percentage_modifier = 100 / modifier + if realDuration != 0 and duration != 0: + modifier = fullDuration / float(realDuration) + percentageModifier = 100 / modifier - if percentage_modifier > 100.0 or percentage_modifier < 0.0: - percentage_modifier = 100.0 + if percentageModifier > 100.0 or percentageModifier < 0.0: + percentageModifier = 100.0 - self.pillow_fullduration = full_duration - if full_duration == 0 or full_duration >= real_duration: - self.play_once = True + self.pillow_fullduration = fullDuration + if fullDuration == 0 or fullDuration >= realDuration: + self.playOnce = True else: - self.play_once = False - if full_duration >= 0: - self.preanim_timer.start(full_duration) + self.playOnce = False + if fullDuration >= 0: + self.preanimTimer.start(fullDuration) - self.m_movie.setSpeed(int(percentage_modifier)) + self.mMovie.setSpeed(int(percentageModifier)) - self.pillow_speed = percentage_modifier / 100. - if real_duration > 0: - self.play(p_char, p_emote, "", scaling) + self.pillowSpeed = percentageModifier / 100. + if realDuration > 0: + self.play(pChar, pEmote, "", scaling) else: - self.play(p_char, p_emote, "", scaling, full_duration) + self.play(pChar, pEmote, "", scaling, fullDuration) - def play_talking(self, p_char, p_emote, scaling = SCALING_AUTO): - p_char = p_char.lower() - gif_path = AOpath + 'characters/' + p_char + '/(b)' + p_emote + '.gif' + def playTalking(self, pChar, pEmote, scaling = SCALING_AUTO): + pChar = pChar.lower() + gifPath = AOpath + 'characters/' + pChar + '/(b)' + pEmote + '.gif' - self.m_movie.stop() + self.mMovie.stop() self.clear() - self.m_movie.setFileName(gif_path) - self.m_movie.jumpToFrame(0) + self.mMovie.setFileName(gifPath) + self.mMovie.jumpToFrame(0) - self.play_once = False - self.m_movie.setSpeed(100) - self.pillow_speed = 1 - self.play(p_char, p_emote, '(b)', scaling) + self.playOnce = False + self.mMovie.setSpeed(100) + self.pillowSpeed = 1 + self.play(pChar, pEmote, '(b)', scaling) - def play_idle(self, p_char, p_emote, scaling = SCALING_AUTO): - p_char = p_char.lower() - gif_path = AOpath + 'characters/' + p_char + '/(a)' + p_emote + '.gif' + def playIdle(self, pChar, pEmote, scaling = SCALING_AUTO): + pChar = pChar.lower() + gifPath = AOpath + 'characters/' + pChar + '/(a)' + pEmote + '.gif' - self.m_movie.stop() + self.mMovie.stop() self.clear() - self.m_movie.setFileName(gif_path) - self.m_movie.jumpToFrame(0) + self.mMovie.setFileName(gifPath) + self.mMovie.jumpToFrame(0) - self.play_once = False - self.m_movie.setSpeed(100) - self.pillow_speed = 1 - self.play(p_char, p_emote, '(a)', scaling) + self.playOnce = False + self.mMovie.setSpeed(100) + self.pillowSpeed = 1 + self.play(pChar, pEmote, '(a)', scaling) def stop(self): - self.m_movie.stop() - self.preanim_timer.stop() + self.mMovie.stop() + self.preanimTimer.stop() self.hide() - def get_transform(self, smooth_condition=True): + def getTransform(self, smooth_condition=True): if self.scaling == SCALING_PIXEL: return QtCore.Qt.FastTransformation elif self.scaling == SCALING_SMOOTH: @@ -557,83 +557,83 @@ class AOCharMovie(QtGui.QLabel): else: return QtCore.Qt.FastTransformation - def get_aspect(self, taller): + def getAspect(self, taller): if taller: return QtCore.Qt.KeepAspectRatio else: return QtCore.Qt.KeepAspectRatioByExpanding - def get_scaled_img(self, f_img): + def getScaledImage(self, f_img): if not f_img.isNull(): - transform = self.get_transform(f_img.size().height() > self.size().height()) - aspect = self.get_aspect(f_img.size().height() > f_img.size().width()) + transform = self.getTransform(f_img.size().height() > self.size().height()) + aspect = self.getAspect(f_img.size().height() > f_img.size().width()) return f_img.scaled(self.size(), aspect, transform) return f_img @QtCore.pyqtSlot(int) - def frame_change(self, n_frame): - f_img = self.get_scaled_img(self.m_movie.currentImage().mirrored(self.m_flipped, False)) + def frameChange(self, nFrame): + f_img = self.getScaledImage(self.mMovie.currentImage().mirrored(self.mFlipped, False)) - f_pixmap = QtGui.QPixmap.fromImage(f_img) - self.setPixmap(f_pixmap) + fPixmap = QtGui.QPixmap.fromImage(f_img) + self.setPixmap(fPixmap) - if self.m_movie.frameCount() - 1 == n_frame and self.play_once: - self.preanim_timer.start(self.m_movie.nextFrameDelay()) + if self.mMovie.frameCount() - 1 == nFrame and self.playOnce: + self.preanimTimer.start(self.mMovie.nextFrameDelay()) @QtCore.pyqtSlot() - def pillow_frame_change(self): - if not self.pillow_frames: return + def pillowFrameChange(self): + if not self.pillowFrames: return - if len(self.pillow_frames) - 1 == self.pillow_frame: - if self.play_once: - self.preanim_timer.start(int(self.pillow_frames[self.pillow_frame][1] * self.pillow_speed)) - elif len(self.pillow_frames) > 1: - self.pillow_frame = 0 - self.pillow_timer.start(int(self.pillow_frames[self.pillow_frame][1] * self.pillow_speed)) + if len(self.pillowFrames) - 1 == self.pillowFrame: + if self.playOnce: + self.preanimTimer.start(int(self.pillowFrames[self.pillowFrame][1] * self.pillowSpeed)) + elif len(self.pillowFrames) > 1: + self.pillowFrame = 0 + self.pillowTimer.start(int(self.pillowFrames[self.pillowFrame][1] * self.pillowSpeed)) else: - self.pillow_frame += 1 - self.pillow_timer.start(int(self.pillow_frames[self.pillow_frame][1] * self.pillow_speed)) + self.pillowFrame += 1 + self.pillowTimer.start(int(self.pillowFrames[self.pillowFrame][1] * self.pillowSpeed)) - self.set_pillow_frame() + self.setPillowFrame() - def set_pillow_frame(self): - f_img = self.get_scaled_img(self.pillow_frames[self.pillow_frame][0].mirrored(self.m_flipped, False)) + def setPillowFrame(self): + f_img = self.getScaledImage(self.pillowFrames[self.pillowFrame][0].mirrored(self.mFlipped, False)) - f_pixmap = QtGui.QPixmap.fromImage(f_img) - self.setPixmap(f_pixmap) + fPixmap = QtGui.QPixmap.fromImage(f_img) + self.setPixmap(fPixmap) @QtCore.pyqtSlot() def timer_done(self): self.done.emit() class AOMovie(QtGui.QLabel): - play_once = True + playOnce = True done = QtCore.pyqtSignal() - use_pillow = 0 - pillow_frames = [] - pillow_frame = 0 - pillow_speed = 1 - pillow_loops = 0 + usePillow = 0 + pillowFrames = [] + pillowFrame = 0 + pillowSpeed = 1 + pillowLoops = 0 xx = 0 # for restoring from screenshake yy = 0 # for restoring from screenshake def __init__(self, parent): QtGui.QLabel.__init__(self, parent) self.parent = parent - self.m_movie = QtGui.QMovie() - self.setMovie(self.m_movie) - self.m_movie.frameChanged.connect(self.frame_change) + self.mMovie = QtGui.QMovie() + self.setMovie(self.mMovie) + self.mMovie.frameChanged.connect(self.frameChange) - self.pillow_timer = QtCore.QTimer(self) - self.pillow_timer.setSingleShot(True) - self.pillow_timer.timeout.connect(self.pillow_frame_change) + self.pillowTimer = QtCore.QTimer(self) + self.pillowTimer.setSingleShot(True) + self.pillowTimer.timeout.connect(self.pillowFrameChange) - self.pillow_label = QtGui.QLabel(self) - self.pillow_label.hide() + self.pillowLabel = QtGui.QLabel(self) + self.pillowLabel.hide() def resize(self): super(AOMovie, self).resize(self.parent.size()) - self.pillow_label.setGeometry(0, 0, self.parent.size().width(), self.parent.size().height()) + self.pillowLabel.setGeometry(0, 0, self.parent.size().width(), self.parent.size().height()) def move(self, x, y): self.xx = x @@ -641,96 +641,96 @@ class AOMovie(QtGui.QLabel): super(AOMovie, self).move(x, y) def set_play_once(self, once): - self.play_once = once + self.playOnce = once - def play(self, p_image, p_char=""): - gif_path = p_image - pillow_modes = {".gif": 0, ".apng": 1, ".webp": 2, ".png": 1} + def play(self, pImage, pChar=""): + gifPath = pImage + pillowModes = {".gif": 0, ".apng": 1, ".webp": 2, ".png": 1} - p_image = unicode(p_image) + pImage = unicode(pImage) - if not exists(gif_path): + if not exists(gifPath): pathlist = [ - getImageSuffix(AO2XPpath+"themes/default/"+p_image+"_bubble"), - getImageSuffix(AOpath+"characters/"+p_char+"/"+p_image), - getImageSuffix(AOpath+"misc/default/"+p_image), - getImageSuffix(AO2XPpath+"themes/default/"+p_image) + getImageSuffix(AO2XPpath + "themes/default/" + pImage + "_bubble"), + getImageSuffix(AOpath + "characters/" + pChar + "/" + pImage), + getImageSuffix(AOpath + "misc/default/" + pImage), + getImageSuffix(AO2XPpath + "themes/default/" + pImage) ] for f in pathlist: if exists(f): - gif_path = f + gifPath = f break - if not exists(gif_path): + if not exists(gifPath): self.done.emit() return - self.use_pillow = pillow_modes[os.path.splitext(gif_path)[1]] + self.usePillow = pillowModes[os.path.splitext(gifPath)[1]] - if not self.use_pillow: - self.m_movie.setFileName(gif_path) - self.m_movie.start() - elif self.use_pillow == 1: # apng - self.pillow_label.show() - self.pillow_frames = images.load_apng(gif_path) - #if len(self.pillow_frames) > 1: - self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed)) - self.set_pillow_frame() - elif self.use_pillow == 2: # webp - self.pillow_label.show() - self.pillow_loops = 0 - self.pillow_frames, self.webp_loops = images.load_webp(gif_path) - #if len(self.pillow_frames) > 1: - self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed)) - self.set_pillow_frame() + if not self.usePillow: + self.mMovie.setFileName(gifPath) + self.mMovie.start() + elif self.usePillow == 1: # apng + self.pillowLabel.show() + self.pillowFrames = images.load_apng(gifPath) + #if len(self.pillowFrames) > 1: + self.pillowTimer.start(int(self.pillowFrames[0][1] * self.pillowSpeed)) + self.setPillowFrame() + elif self.usePillow == 2: # webp + self.pillowLabel.show() + self.pillowLoops = 0 + self.pillowFrames, self.webpLoops = images.load_webp(gifPath) + #if len(self.pillowFrames) > 1: + self.pillowTimer.start(int(self.pillowFrames[0][1] * self.pillowSpeed)) + self.setPillowFrame() self.show() def stop(self): - self.pillow_frames = [] - self.pillow_frame = 0 - self.pillow_timer.stop() - self.m_movie.stop() - self.pillow_label.clear() - self.pillow_label.hide() + self.pillowFrames = [] + self.pillowFrame = 0 + self.pillowTimer.stop() + self.mMovie.stop() + self.pillowLabel.clear() + self.pillowLabel.hide() self.hide() @QtCore.pyqtSlot(int) - def frame_change(self, n_frame): - if n_frame == self.m_movie.frameCount() - 1 and self.play_once: - delay(self.m_movie.nextFrameDelay()) + def frameChange(self, nFrame): + if nFrame == self.mMovie.frameCount() - 1 and self.playOnce: + delay(self.mMovie.nextFrameDelay()) self.stop() self.done.emit() @QtCore.pyqtSlot() - def pillow_frame_change(self): - if not self.pillow_frames: return + def pillowFrameChange(self): + if not self.pillowFrames: return - if len(self.pillow_frames)-1 == self.pillow_frame: - if self.play_once or (self.use_pillow == 2 and self.pillow_loops+1 == self.webp_loops): - delay(int(self.pillow_frames[self.pillow_frame][1] * self.pillow_speed)) + if len(self.pillowFrames)-1 == self.pillowFrame: + if self.playOnce or (self.usePillow == 2 and self.pillowLoops+1 == self.webpLoops): + delay(int(self.pillowFrames[self.pillowFrame][1] * self.pillowSpeed)) self.stop() self.done.emit() - elif len(self.pillow_frames) > 1: # loop - self.pillow_loops += 1 - self.pillow_frame = 0 - self.pillow_timer.start(int(self.pillow_frames[self.pillow_frame][1] * self.pillow_speed)) - elif len(self.pillow_frames) > 1: - self.pillow_frame += 1 - self.pillow_timer.start(int(self.pillow_frames[self.pillow_frame][1] * self.pillow_speed)) + elif len(self.pillowFrames) > 1: # loop + self.pillowLoops += 1 + self.pillowFrame = 0 + self.pillowTimer.start(int(self.pillowFrames[self.pillowFrame][1] * self.pillowSpeed)) + elif len(self.pillowFrames) > 1: + self.pillowFrame += 1 + self.pillowTimer.start(int(self.pillowFrames[self.pillowFrame][1] * self.pillowSpeed)) - self.set_pillow_frame() + self.setPillowFrame() - def set_pillow_frame(self): - if not self.pillow_frames: return + def setPillowFrame(self): + if not self.pillowFrames: return - f_img = self.pillow_frames[self.pillow_frame][0] + f_img = self.pillowFrames[self.pillowFrame][0] if not f_img.isNull() and (f_img.size().width() != self.size().width() or f_img.size().height() != self.size().height()): f_img = f_img.scaled(self.size().width(), self.size().height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation) - f_pixmap = QtGui.QPixmap.fromImage(f_img) - self.pillow_label.setPixmap(f_pixmap) + fPixmap = QtGui.QPixmap.fromImage(f_img) + self.pillowLabel.setPixmap(fPixmap) class ZoomLines(QtGui.QLabel): def __init__(self, parent): @@ -738,16 +738,16 @@ class ZoomLines(QtGui.QLabel): self.parent = parent self.setScaledContents(True) self.movie = QtGui.QMovie() - self.movie.frameChanged.connect(self.frame_change) + self.movie.frameChanged.connect(self.frameChange) def resize(self): super(ZoomLines, self).resize(self.parent.size()) - def frame_change(self): + def frameChange(self): img = self.movie.currentImage() self.setPixmap(QtGui.QPixmap.fromImage(img)) - def set_zoom(self, on, dir=0): + def setZoom(self, on, dir=0): self.movie.stop() if not on: self.hide() @@ -764,16 +764,16 @@ class WTCEView(QtGui.QLabel): super(WTCEView, self).__init__(parent) self.parent = parent self.movie = QtGui.QMovie() - self.movie.frameChanged.connect(self.frame_change) - self.finalframe_timer = QtCore.QTimer() - self.finalframe_timer.setSingleShot(False) - self.finalframe_timer.timeout.connect(self.finished) + self.movie.frameChanged.connect(self.frameChange) + self.finalframeTimer = QtCore.QTimer() + self.finalframeTimer.setSingleShot(False) + self.finalframeTimer.timeout.connect(self.finished) def resize(self): super(WTCEView, self).move(self.parent.viewport.x(), self.parent.viewport.y()) super(WTCEView, self).resize(self.parent.viewport.size()) - def frame_change(self, frame): + def frameChange(self, frame): if self.movie.state() != QtGui.QMovie.Running: return img = self.movie.currentImage() @@ -781,14 +781,14 @@ class WTCEView(QtGui.QLabel): if not pixmap.isNull(): self.setPixmap(pixmap.scaled(self.size().width(), self.size().height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) if self.movie.currentFrameNumber() == self.movie.frameCount() - 1: - self.finalframe_timer.start(self.movie.nextFrameDelay()) + self.finalframeTimer.start(self.movie.nextFrameDelay()) def finished(self): - self.finalframe_timer.stop() + self.finalframeTimer.stop() self.movie.stop() self.hide() - def show_WTCE(self, wtce, variant=0): + def showWTCE(self, wtce, variant=0): self.finished() if wtce == 'testimony1': self.movie.setFileName(AO2XPpath + 'themes/default/witnesstestimony.gif') @@ -808,7 +808,7 @@ class EditEvidenceDialog(QtGui.QDialog): def __init__(self, gamegui): super(EditEvidenceDialog, self).__init__() self.gamegui = gamegui - self.set_title() + self.setTitle() self.resize(512, 384) self.setModal(True) @@ -826,18 +826,18 @@ class EditEvidenceDialog(QtGui.QDialog): self.save = QtGui.QPushButton(self) self.save.setText('Save') - self.save.clicked.connect(self.on_save) + self.save.clicked.connect(self.onSaveClicked) self.save.move(256 - self.save.size().width() - 8, 384 - self.save.size().height() - 2) self.cancel = QtGui.QPushButton(self) self.cancel.setText('Cancel') - self.cancel.clicked.connect(self.on_cancel) + self.cancel.clicked.connect(self.onCancelClicked) self.cancel.move(264 + 16, 384 - self.cancel.size().height() - 2) self.choosepic = QtGui.QComboBox(self) self.choosepic.setGeometry(self.eviname.x() + self.eviname.size().width() - 128 - 84, self.eviname.y() + 70 - 32, 128, 24) self.filenames = [] self.browse = QtGui.QPushButton(self) self.browse.setText('Browse') - self.browse.clicked.connect(self.on_browse) + self.browse.clicked.connect(self.onBrowseClicked) self.browse.move(self.choosepic.x() + self.choosepic.width() + 8, self.choosepic.y()) files = os.listdir(AOpath + 'evidence') @@ -858,35 +858,35 @@ class EditEvidenceDialog(QtGui.QDialog): self.emptyfile = i self.editing = False - self.choosepic.currentIndexChanged.connect(self.choose_pic_change) + self.choosepic.currentIndexChanged.connect(self.choosePicChange) self.choosepic.setCurrentIndex(i) - def choose_pic_change(self, ind): + def choosePicChange(self, ind): self.filename = self.filenames[ind] if exists(AOpath + 'evidence/' + self.filename): self.evipicture.setPixmap(QtGui.QPixmap(AOpath + 'evidence/' + self.filename)) else: self.evipicture.setPixmap(QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png')) - def on_save(self): - name = encode_ao_str(self.eviname.text()) - desc = encode_ao_str(self.evidesc.toPlainText()) + def onSaveClicked(self): + name = encodeAOString(self.eviname.text()) + desc = encodeAOString(self.evidesc.toPlainText()) - if not self.gamegui.privateinv: + if not self.gamegui.privateInventorySelected: if self.editing: - self.gamegui.tcp.send('EE#' + str(self.edit_ind) + '#' + name + '#' + desc + '#' + self.filename + '#%') + self.gamegui.tcp.send('EE#' + str(self.editInd) + '#' + name + '#' + desc + '#' + self.filename + '#%') else: self.gamegui.tcp.send('PE#' + name + '#' + desc + '#' + self.filename + '#%') else: if self.editing: - self.gamegui.privateevidence[self.gamegui.selectedevi] = [unicode(name), unicode(desc), unicode(self.filename)] - self.gamegui.privatedropdown.setItemText(self.gamegui.selectedevi, name) + self.gamegui.privateEvidence[self.gamegui.selectedEvidence] = [unicode(name), unicode(desc), unicode(self.filename)] + self.gamegui.privatedropdown.setItemText(self.gamegui.selectedEvidence, name) - evi = self.gamegui.privateevidence[self.gamegui.selectedevi] + evi = self.gamegui.privateEvidence[self.gamegui.selectedEvidence] self.gamegui.evidencedesc.setText(evi[1]) - self.gamegui.setEvidenceImg(self.gamegui.evidenceimage, evi[2]) + self.gamegui.setEvidenceImage(self.gamegui.evidenceimage, evi[2]) else: - self.gamegui.privateevidence.append([name, desc, self.filename]) + self.gamegui.privateEvidence.append([name, desc, self.filename]) self.gamegui.privatedropdown.addItem(name) self.gamegui.onExportEvidence(True) @@ -896,27 +896,27 @@ class EditEvidenceDialog(QtGui.QDialog): self.evipicture.setPixmap(evipic) self.filename = 'empty.png' self.editing = False - self.set_title() + self.setTitle() self.choosepic.setCurrentIndex(self.emptyfile) self.hide() - def on_cancel(self): + def onCancelClicked(self): self.eviname.setText('') self.evidesc.setText('') evipic = QtGui.QPixmap(AOpath + 'evidence/empty.png') self.evipicture.setPixmap(evipic) self.filename = 'empty.png' self.editing = False - self.set_title() + self.setTitle() self.choosepic.setCurrentIndex(self.emptyfile) self.hide() - def on_browse(self): + def onBrowseClicked(self): path = str(QtGui.QFileDialog.getOpenFileName(self, "Select an image", AOpath + 'evidence', "Images (*.png)")) if path: if not "/evidence/" in path.lower(): QtGui.QMessageBox.warning(self, 'Wrong directory', 'Please select a file from the "evidence" directory.') - self.on_browse() + self.onBrowseClicked() return file = basename(path) @@ -925,12 +925,12 @@ class EditEvidenceDialog(QtGui.QDialog): self.choosepic.setCurrentIndex(ind) else: QtGui.QMessageBox.warning(self, 'Not a valid file', 'Please select a PNG image.') - self.on_browse() + self.onBrowseClicked() - def edit_evidence(self, ind): + def editEvidence(self, ind): self.editing = True - self.edit_ind = ind - evidence = self.gamegui.privateevidence if self.gamegui.privateinv else self.gamegui.evidence + self.editInd = ind + evidence = self.gamegui.privateEvidence if self.gamegui.privateInventorySelected else self.gamegui.evidence if evidence[ind][2] not in self.filenames: self.filenames.append(evidence[ind][2]) @@ -938,11 +938,11 @@ class EditEvidenceDialog(QtGui.QDialog): self.choosepic.setCurrentIndex(self.filenames.index(evidence[ind][2])) self.eviname.setText(evidence[ind][0]) self.evidesc.setText(evidence[ind][1]) - self.setWindowTitle("Edit evidence" if not self.gamegui.privateinv else "Edit evidence in private inventory") + self.setWindowTitle("Edit evidence" if not self.gamegui.privateInventorySelected else "Edit evidence in private inventory") self.show() - def set_title(self): - self.setWindowTitle('Add evidence' if not self.gamegui.privateinv else "Add evidence to private inventory") + def setTitle(self): + self.setWindowTitle('Add evidence' if not self.gamegui.privateInventorySelected else "Add evidence to private inventory") class TCPThread(QtCore.QThread): connectionError = QtCore.pyqtSignal(str, str, str) @@ -953,7 +953,7 @@ class TCPThread(QtCore.QThread): OOC_Log = QtCore.pyqtSignal(str) charSlots = QtCore.pyqtSignal() showCharSelect = QtCore.pyqtSignal() - allEvidence = QtCore.pyqtSignal(list) + loadAllEvidence = QtCore.pyqtSignal(list) rainbowColor = QtCore.pyqtSignal(str) updatePlayerList = QtCore.pyqtSignal(str, int, int, str) timerUpdate = QtCore.pyqtSignal(int, int, int) @@ -980,7 +980,7 @@ class TCPThread(QtCore.QThread): self.quit() return - if self.parent.disconnectnow: + if self.parent.disconnectNow: self.parent.disconnectCommon() self.quit() return @@ -991,7 +991,7 @@ class TCPThread(QtCore.QThread): self.parent.tcp.send('CH#%') pingtimer = 150 - if self.parent.m_chatmessage[TEXT_COLOR] == str(C_RAINBOW): + if self.parent.mChatMessage[TEXT_COLOR] == str(C_RAINBOW): color.setHsv(rainbow, 255, 255) rainbow += 5 if rainbow > 255: @@ -1001,8 +1001,8 @@ class TCPThread(QtCore.QThread): if sendtick: sendtick -= 1 - if self.parent.msgqueue and not sendtick: - self.parent.tcp.send(self.parent.msgqueue[0]) + if self.parent.messageQueue and not sendtick: + self.parent.tcp.send(self.parent.messageQueue[0]) sendtick = 4 error, total = self.parent.tcp.recv() @@ -1013,7 +1013,7 @@ class TCPThread(QtCore.QThread): if self.send_attempts >= self.max_attempts: self.send_attempts = 0 #print "[warning] message discarded" - del self.parent.msgqueue[0] + del self.parent.messageQueue[0] self.parent.msgqueue_list.takeItem(0) continue elif error == -1: @@ -1029,7 +1029,7 @@ class TCPThread(QtCore.QThread): else: self.send_attempts = 0 - packets.handle_packets(self, total) + packets.handlePackets(self, total) def stop(self): self.stop_now = True @@ -1038,41 +1038,41 @@ class GUI(QtGui.QWidget): gamewindow = None sound = None music = None - next_character_is_not_special = False - message_is_centered = False - current_display_speed = 3 - message_display_speed = (30, 40, 50, 60, 75, 100, 120) - entire_message_is_blue = False - inline_color_stack = [] - inline_blue_depth = 0 - other_charid = -1 - offset_with_pair = 0 - tick_pos = 0 - blip_pos = 0 - blip_rate = 1 - time_mod = 40 + nextCharacterIsNotSpecial = False + messageIsCentered = False + currentDisplaySpeed = 3 + messageDisplaySpeed = (30, 40, 50, 60, 75, 100, 120) + entireMessageIsBlue = False + inlineColorStack = [] + inlineBlueDepth = 0 + otherCharId = -1 + offsetWithPair = 0 + tickPos = 0 + blipPos = 0 + blipRate = 1 + timeMod = 40 blip = "male" blipsnd = None - chatmessage_size = 33 - m_chatmessage = [] - blank_blip = False - chatmessage_is_empty = False - anim_is_empty = False - is_additive = False - additive_char = -1 - anim_state = 3 - text_state = 2 - objection_state = 0 - text_color = 0 + chatMessageSize = 33 + mChatMessage = [] + blankBlip = False + chatMessageIsEmpty = False + animIsEmpty = False + isAdditive = False + additiveChar = -1 + animState = 3 + textState = 2 + objectionState = 0 + textColor = 0 charini = ConfigParser() chatmsg = '' charid = -1 login = False - privateinv = False + privateInventorySelected = False scaling = [SCALING_AUTO, SCALING_AUTO] - wtcesignal = QtCore.pyqtSignal(str, int) + wtceSignal = QtCore.pyqtSignal(str, int) healthbars = QtCore.pyqtSignal(int, int) gotPing = QtCore.pyqtSignal(int) @@ -1080,57 +1080,57 @@ class GUI(QtGui.QWidget): super(GUI, self).__init__(parent) self.gamewindow = parent - self.gotPing.connect(self.set_ping) + self.gotPing.connect(self.setPing) - for i in range(self.chatmessage_size): - self.m_chatmessage.append("") + for i in range(self.chatMessageSize): + self.mChatMessage.append("") - self.chat_tick_timer = QtCore.QTimer(self) - self.chat_tick_timer.timeout.connect(self.chat_tick) + self.chatTickTimer = QtCore.QTimer(self) + self.chatTickTimer.timeout.connect(self.chatTick) - self.sfx_delay_timer = QtCore.QTimer(self) - self.sfx_delay_timer.setSingleShot(True) - self.sfx_delay_timer.timeout.connect(self.play_sfx) + self.sfxDelayTimer = QtCore.QTimer(self) + self.sfxDelayTimer.setSingleShot(True) + self.sfxDelayTimer.timeout.connect(self.playSfx) - self.inbox_timer = QtCore.QTimer(self) - self.inbox_timer.setSingleShot(True) - self.inbox_timer.timeout.connect(self.inbox_timer_timeout) + self.inboxTimer = QtCore.QTimer(self) + self.inboxTimer.setSingleShot(True) + self.inboxTimer.timeout.connect(self.inboxTimerTimeout) self.modcall = None - self.healthbars.connect(self.netmsg_hp) - self.disconnectnow = False + self.healthbars.connect(self.netmsgHP) + self.disconnectNow = False self.swapping = False - self.iniswapindex = 0 + self.iniSwapIndex = 0 self.background = 'default' self.viewport = QtGui.QWidget(self) self.court = QtGui.QLabel(self.viewport) - 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_animation.valueChanged.connect(self.slide_changed) - self.slide_bg.hide() + self.slideBg = QtGui.QLabel(self.viewport) + self.slideBgAnimation = QtCore.QPropertyAnimation(self.slideBg, "geometry") + self.slideBgAnimation.finished.connect(self.slideDone) + self.slideBgAnimation.valueChanged.connect(self.slideChanged) + self.slideBg.hide() self.zoom = ZoomLines(self.viewport) self.char = AOCharMovie(self.viewport) - self.char.done.connect(self.preanim_done) + self.char.done.connect(self.preanimDone) self.sideChar = AOCharMovie(self.viewport) self.sideChar.hide() - self.slide_last_wit = [] - self.slide_last_pos = None + self.slideLastWit = [] + self.slideLastPos = None self.slideWitness = AOCharMovie(self.viewport) - self.slideWitness.show_on_play = False + self.slideWitness.showOnPlay = False self.slideWitness.hide() self.slideSpeaker = AOCharMovie(self.viewport) self.slideSpeaker.hide() - self.slideSpeaker.show_on_play = False + self.slideSpeaker.showOnPlay = False - self.slide_overlay = QtGui.QLabel(self.viewport) - self.slide_overlay.hide() + self.slideOverlay = QtGui.QLabel(self.viewport) + self.slideOverlay.hide() self.bench = QtGui.QLabel(self.viewport) @@ -1156,37 +1156,37 @@ class GUI(QtGui.QWidget): self.name = QtGui.QLabel(self.chatbox) - self.presentedevi = QtGui.QLabel(self) - self.presentedevi.setScaledContents(True) - self.presentedevi.hide() + self.presentedEvidence = QtGui.QLabel(self) + self.presentedEvidence.setScaledContents(True) + self.presentedEvidence.hide() self.wtceView = WTCEView(self) - self.wtcesignal.connect(self.wtceView.show_WTCE) + self.wtceSignal.connect(self.wtceView.showWTCE) self.objectionView = AOMovie(self.viewport) self.objectionView.setScaledContents(True) - self.objectionView.done.connect(self.objection_done) + self.objectionView.done.connect(self.objectionDone) - self.whiteflashlab = QtGui.QLabel(self.viewport) - self.whiteflashlab.setPixmap(QtGui.QPixmap(AO2XPpath + 'themes/default/realizationflash.png')) - self.whiteflashlab.setScaledContents(True) - self.whiteflashlab.hide() - self.whiteflash = QtCore.QTimer() - self.whiteflash.setSingleShot(False) - self.whiteflash.timeout.connect(partial(self.setWhiteFlash, False)) + self.whiteFlashLabel = QtGui.QLabel(self.viewport) + self.whiteFlashLabel.setPixmap(QtGui.QPixmap(AO2XPpath + 'themes/default/realizationflash.png')) + self.whiteFlashLabel.setScaledContents(True) + self.whiteFlashLabel.hide() + self.whiteFlash = QtCore.QTimer() + self.whiteFlash.setSingleShot(False) + self.whiteFlash.timeout.connect(partial(self.setWhiteFlash, False)) self.screenshake = QtCore.QTimer() self.screenshake.timeout.connect(self.screenShakeTick) self.shakesRemaining = 0 self.onscreenTimerLabels = [] - self.onscreen_timer_times = [0, 0, 0, 0, 0] - self.onscreen_timer_paused = [True, True, True, True, True] - self.onscreen_timer = QtCore.QTimer(self) - self.onscreen_timer.timeout.connect(self.update_timers) - self.timer_tick = 1000 + self.onscreenTimerTimes = [0, 0, 0, 0, 0] + self.onscreenTimerPaused = [True, True, True, True, True] + self.onscreenTimer = QtCore.QTimer(self) + self.onscreenTimer.timeout.connect(self.updateOnscreenTimers) + self.onscreenTimerTick = 1000 - for i in range(len(self.onscreen_timer_times)): + for i in range(len(self.onscreenTimerTimes)): label = QtGui.QLabel(self) label.hide() label.setText("00:00:00") @@ -1201,17 +1201,17 @@ class GUI(QtGui.QWidget): self.ooclog = ChatLogs(self, 1) self.ooclog.setReadOnly(True) - self.ooclog.textChanged.connect(self.ooclog_update) + self.ooclog.textChanged.connect(self.onOOCLogChanged) self.oocnameinput = QtGui.QLineEdit(self) self.oocnameinput.setPlaceholderText('Enter a name...') self.oocinput = QtGui.QLineEdit(self) self.oocinput.setPlaceholderText('Server chat/OOC chat...') - self.oocinput.returnPressed.connect(self.onOOCreturn) + self.oocinput.returnPressed.connect(self.onOOCReturn) self.ooclogin = QtGui.QPushButton("Lo&gin", self) - self.ooclogin.clicked.connect(self.on_ooc_login) + self.ooclogin.clicked.connect(self.onOOCLoginClicked) self.gametabs = QtGui.QTabWidget(self) self.gametab_log = QtGui.QWidget() # the IC chat log @@ -1227,7 +1227,7 @@ class GUI(QtGui.QWidget): self.musicareatabs = QtGui.QTabWidget(self) self.musicitems = QtGui.QListWidget(self.gametab_music) - self.musicitems.itemDoubleClicked.connect(self.onMusicClick) + self.musicitems.itemDoubleClicked.connect(self.onMusicListItemClicked) self.musicsearch = QtGui.QLineEdit(self.gametab_music) self.musicsearch.setPlaceholderText("Search...") self.musicsearch.textChanged.connect(self.onMusicSearch) @@ -1235,11 +1235,11 @@ class GUI(QtGui.QWidget): self.found_songitem_color = "background: #80FF80;" self.areaitems = QtGui.QListWidget() - self.areaitems.itemDoubleClicked.connect(self.onAreaClick) + self.areaitems.itemDoubleClicked.connect(self.onAreaListItemClicked) self.backgrounds = [] self.backgrounditems = QtGui.QListWidget(self.gametab_backgrounds) - self.backgrounditems.itemDoubleClicked.connect(self.onBackgroundClick) + self.backgrounditems.itemDoubleClicked.connect(self.onBackgroundListClick) self.backgroundsearch = QtGui.QLineEdit(self.gametab_backgrounds) self.backgroundsearch.setPlaceholderText("Search...") self.backgroundsearch.textChanged.connect(self.onBackgroundSearch) @@ -1249,12 +1249,12 @@ class GUI(QtGui.QWidget): self.loadBackgrounds() - self.demoitems = demo.get_demo_treeview() - self.demoitems.doubleClicked.connect(self.on_demo_click) + self.demoItems = demo.get_demo_treeview() + self.demoItems.doubleClicked.connect(self.onDemoClicked) self.iclog = ChatLogs(self.gametab_log, 0, self.ooclog.logfile) self.iclog.setReadOnly(True) - self.iclog.textChanged.connect(self.icLogChanged) + self.iclog.textChanged.connect(self.onICLogChanged) self.evidencedropdown = QtGui.QComboBox(self.gametab_evidence) self.evidencedropdown.currentIndexChanged.connect(self.changeGlobalEvidence) @@ -1312,26 +1312,26 @@ class GUI(QtGui.QWidget): self.evidenceswitchglobal.hide() self.msgqueue_list = QtGui.QListWidget(self.gametab_msgqueue) - self.msgqueue_list.itemClicked.connect(self.onClicked_msgqueue) + self.msgqueue_list.itemClicked.connect(self.onMessageQueueItemClicked) self.remove_queue = QtGui.QPushButton(self.gametab_msgqueue) self.remove_queue.setText('Delete') - self.remove_queue.clicked.connect(self.onClicked_remove_queue) + self.remove_queue.clicked.connect(self.onRemoveQueueClicked) self.clear_queue = QtGui.QPushButton(self.gametab_msgqueue) self.clear_queue.setText('Clear') - self.clear_queue.clicked.connect(self.onClicked_clear_queue) + self.clear_queue.clicked.connect(self.onClearQueueClicked) self.player_list = QtGui.QListWidget(self.gametab_players) - self.player_list.itemClicked.connect(self.onClicked_playerList) + self.player_list.itemClicked.connect(self.onPlayerListItemClicked) self.player_pair = QtGui.QPushButton(self.gametab_players) self.player_pair.setText('Pair') - self.player_pair.clicked.connect(self.onClicked_playerPair) + self.player_pair.clicked.connect(self.onPlayerPairClicked) self.player_kick = QtGui.QPushButton(self.gametab_players) self.player_kick.setText('Kick') - self.player_kick.clicked.connect(self.onClicked_playerKick) + self.player_kick.clicked.connect(self.onPlayerKickClicked) self.player_kick.setDisabled(True) self.player_ban = QtGui.QPushButton(self.gametab_players) self.player_ban.setText('Ban') - self.player_ban.clicked.connect(self.onClicked_playerBan) + self.player_ban.clicked.connect(self.onPlayerBanClicked) self.player_ban.setDisabled(True) self.unmutedlist = QtGui.QListWidget(self.gametab_mute) @@ -1344,22 +1344,22 @@ class GUI(QtGui.QWidget): self.mutedlabel.setText('Muted') self.mutebtn.setText('>>') self.unmutebtn.setText('<<') - self.mutebtn.clicked.connect(self.onMuteClick) - self.unmutebtn.clicked.connect(self.onUnmuteClick) + self.mutebtn.clicked.connect(self.onMuteClicked) + self.unmutebtn.clicked.connect(self.onUnmuteClicked) self.mutedlist.itemClicked.connect(self.changeMuteIndex) self.unmutedlist.itemClicked.connect(self.changeUnmuteIndex) self.iniSwapList = QtGui.QComboBox(self.gametab_iniswap) - self.iniSwapList.currentIndexChanged.connect(self.iniswap_index_change) + self.iniSwapList.currentIndexChanged.connect(self.iniSwapIndexChange) self.iniSwapList.setEditable(1) self.iniswapconfirm = QtGui.QPushButton(self.gametab_iniswap) self.iniswapconfirm.setText('Swap') - self.iniswapconfirm.clicked.connect(self.iniswap_confirm) + self.iniswapconfirm.clicked.connect(self.onIniSwapConfirmClicked) self.iniswapreset = QtGui.QPushButton(self.gametab_iniswap) self.iniswapreset.setText('Reset') self.iniswapreset.clicked.connect(self.resetIniSwap) - self.iniswapinfo = QtGui.QLabel(self.gametab_iniswap) - self.iniswapinfo.setText('Not swapped') + self.iniSwapInfo = QtGui.QLabel(self.gametab_iniswap) + self.iniSwapInfo.setText('Not swapped') self.iniswaprefresh = QtGui.QPushButton(self.gametab_iniswap) self.iniswaprefresh.setText('Refresh characters') self.iniswaprefresh.clicked.connect(self.loadSwapCharacters) @@ -1409,10 +1409,10 @@ class GUI(QtGui.QWidget): self.musicareatabs.addTab(self.areaitems, "&Areas") self.musicareatabs.addTab(self.gametab_players, 'Pla&yers') self.musicareatabs.addTab(self.gametab_backgrounds, "&Backs") - self.musicareatabs.addTab(self.demoitems, "Demos") + self.musicareatabs.addTab(self.demoItems, "Demos") self.icchatinput = QtGui.QLineEdit(self) - self.icchatinput.returnPressed.connect(self.onICreturn) + self.icchatinput.returnPressed.connect(self.onICReturn) self.icchatinput.setPlaceholderText('Game chat') self.emotedropdown = QtGui.QComboBox(self) @@ -1424,9 +1424,9 @@ class GUI(QtGui.QWidget): self.colordropdown.setToolTip('Change the color of your message') self.posdropdown = QtGui.QComboBox(self) - self.default_positions = ["def", "pro", "wit", "hld", "hlp", "jud", "jur", "sea"] - self.posdropdown.addItems(self.default_positions) - self.posdropdown.currentIndexChanged.connect(self.set_position) + self.defaultPositions = ["def", "pro", "wit", "hld", "hlp", "jud", "jur", "sea"] + self.posdropdown.addItems(self.defaultPositions) + self.posdropdown.currentIndexChanged.connect(self.setPosition) self.posdropdown.setToolTip('Select your position in the courtroom') self.flipbutton = QtGui.QCheckBox(self) @@ -1437,25 +1437,25 @@ class GUI(QtGui.QWidget): self.sfxbutton = QtGui.QCheckBox(self) self.sfxbutton.setChecked(True) - self.sfxbutton.stateChanged.connect(self.changeSfxCheck) + self.sfxbutton.stateChanged.connect(self.changePreanimCheck) self.sfxbutton.setText('&Pre-anim') self.sfxbutton.setToolTip("Play a character-specific animation before the next message") self.deskbtn = QtGui.QCheckBox(self) self.deskbtn.setChecked(True) self.deskbtn.setText('&Desk') - self.deskbtn.stateChanged.connect(self.icchat_focus) + self.deskbtn.stateChanged.connect(self.ICChatFocus) 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.stateChanged.connect(self.ICChatFocus) self.slidebutton.setText('&Slide') self.slidebutton.resize(self.slidebutton.sizeHint()) self.slidebutton.setToolTip("Tell clients to play courtroom slide animations for your message") self.nointerruptbtn = QtGui.QCheckBox(self) self.nointerruptbtn.setChecked(False) - self.nointerruptbtn.stateChanged.connect(self.icchat_focus) + self.nointerruptbtn.stateChanged.connect(self.ICChatFocus) self.nointerruptbtn.setText('&No interrupt') self.deskbtn.resize(self.deskbtn.sizeHint()) self.nointerruptbtn.setToolTip("Show the next message immediately, ignoring animations") @@ -1464,65 +1464,65 @@ class GUI(QtGui.QWidget): self.additivebtn.setChecked(False) self.additivebtn.setText('Additi&ve') self.additivebtn.resize(self.additivebtn.sizeHint()) - self.additivebtn.clicked.connect(self.icchat_focus) + self.additivebtn.clicked.connect(self.ICChatFocus) self.additivebtn.setToolTip('Append the next message to the previous one, without a new textbox') self.effectdropdown = QtGui.QComboBox(self) - self.effectdropdown.currentIndexChanged.connect(self.icchat_focus) + self.effectdropdown.currentIndexChanged.connect(self.ICChatFocus) self.effectdropdown.setToolTip('Show this effect on your next message') self.callmodbtn = QtGui.QPushButton(self) self.callmodbtn.setText('Call mod') - self.callmodbtn.clicked.connect(self.onClick_callMod) + self.callmodbtn.clicked.connect(self.onCallModClicked) self.settingsbtn = QtGui.QPushButton("Settings", self) self.settingsbtn.clicked.connect(self.gamewindow.showSettings) self.changechar = QtGui.QPushButton(self) - self.changechar.clicked.connect(self.onClick_changeChar) + self.changechar.clicked.connect(self.onChangeCharClicked) - self.current_emote_page = 0 - self.max_emotes_on_page = 0 - self.emotebuttons = [] + self.currentEmotePage = 0 + self.maxEmotesOnPage = 0 + self.emoteButtons = [] self.prevemotepage = buttons.BackEmoteButton(self) self.prevemotepage.hide() self.nextemotepage = buttons.NextEmoteButton(self) self.nextemotepage.show() self.realizationbtn = buttons.AOToggleButton(self, "realization") - self.realizationbtn.clicked.connect(self.on_realization_button) + self.realizationbtn.clicked.connect(self.onRealizationClicked) 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, "screenshake") # AO 2.8 - self.shakebtn.clicked.connect(self.on_shake_button) + self.shakebtn.clicked.connect(self.onShakeClicked) self.shakebtn.setToolTip('Show the next message with a shaking effect') self.customobject = buttons.CustomObjection(self) self.takethatbtn = buttons.Objections(self, 3) self.objectbtn = buttons.Objections(self, 2) self.holditbtn = buttons.Objections(self, 1) - self.holditbtn.clicked.connect(self.icchat_focus) - self.objectbtn.clicked.connect(self.icchat_focus) - self.takethatbtn.clicked.connect(self.icchat_focus) - self.customobject.clicked.connect(self.icchat_focus) - self.objectsnd = 0 + self.holditbtn.clicked.connect(self.ICChatFocus) + self.objectbtn.clicked.connect(self.ICChatFocus) + self.takethatbtn.clicked.connect(self.ICChatFocus) + self.customobject.clicked.connect(self.ICChatFocus) + self.objectSound = 0 self.defensebar = buttons.PenaltyBars(self, 1) self.prosecutionbar = buttons.PenaltyBars(self, 2) - self.defensebar.minusClicked.connect(self.penaltyBarMinus) - self.defensebar.plusClicked.connect(self.penaltyBarPlus) - self.prosecutionbar.minusClicked.connect(self.penaltyBarMinus) - self.prosecutionbar.plusClicked.connect(self.penaltyBarPlus) + self.defensebar.minusClicked.connect(self.onPenaltyBarMinusClicked) + self.defensebar.plusClicked.connect(self.onPenaltyBarPlusClicked) + self.prosecutionbar.minusClicked.connect(self.onPenaltyBarMinusClicked) + self.prosecutionbar.plusClicked.connect(self.onPenaltyBarPlusClicked) self.wtcebtn_1 = buttons.WTCEbuttons(self, 0) self.wtcebtn_2 = buttons.WTCEbuttons(self, 1) self.notguiltybtn = buttons.WTCEbuttons(self, 2, 0) self.guiltybtn = buttons.WTCEbuttons(self, 2, 1) - self.wtcebtn_1.clicked.connect(self.WTCEbuttonPressed) - self.wtcebtn_2.clicked.connect(self.WTCEbuttonPressed) - self.notguiltybtn.clicked.connect(self.WTCEbuttonPressed) - self.guiltybtn.clicked.connect(self.WTCEbuttonPressed) + self.wtcebtn_1.clicked.connect(self.OnWTCEButtonClicked) + self.wtcebtn_2.clicked.connect(self.OnWTCEButtonClicked) + self.notguiltybtn.clicked.connect(self.OnWTCEButtonClicked) + self.guiltybtn.clicked.connect(self.OnWTCEButtonClicked) self.wtcebtn_1.show() self.wtcebtn_2.show() self.notguiltybtn.show() @@ -1531,7 +1531,7 @@ class GUI(QtGui.QWidget): self.showname = "" self.shownameedit = QtGui.QLineEdit(self) - self.shownameedit.textChanged.connect(self.onChangeShowname) + self.shownameedit.textChanged.connect(self.onShownameChanged) self.shownameedit.setPlaceholderText("Showname") self.shownameedit.setToolTip('Set a custom name for your character') @@ -1541,9 +1541,9 @@ class GUI(QtGui.QWidget): self.musicslider.setRange(0, 100) self.soundslider.setRange(0, 100) self.blipslider.setRange(0, 100) - self.musicslider.valueChanged.connect(self.change_music_volume) - self.soundslider.valueChanged.connect(self.change_sound_volume) - self.blipslider.valueChanged.connect(self.change_blip_volume) + self.musicslider.valueChanged.connect(self.changeMusicVolume) + self.soundslider.valueChanged.connect(self.changeSoundVolume) + self.blipslider.valueChanged.connect(self.changeBlipVolume) self.sliderlabel1 = QtGui.QLabel("Music", self) self.sliderlabel2 = QtGui.QLabel("SFX", self) self.sliderlabel3 = QtGui.QLabel("Blips", self) @@ -1551,7 +1551,7 @@ class GUI(QtGui.QWidget): self.pinglabel = QtGui.QLabel(self) self.demoslider = QtGui.QSlider(QtCore.Qt.Horizontal, self) - self.demoslider.valueChanged.connect(self.demo_seek) + self.demoslider.valueChanged.connect(self.demoSeek) self.demoslider.setVisible(False) self.demoslider.setMinimum(0) @@ -1562,34 +1562,34 @@ class GUI(QtGui.QWidget): self.chatbox.show() self.areas = [] - self.areas_len = 0 - self.no_arup = False - self.muteselected = -1 - self.unmuteselected = -1 + self.areasLen = 0 + self.noARUP = False + self.muteSelected = -1 + self.unmuteSelected = -1 self.muted = [] - self.mychar = -1 - self.mychatcolor = 0 - self.charemotes = [] - self.selectedemote = 0 - self.charname = '' - self.charshowname = '' - self.charside = 'def' - self.lastmsg = '' - self.inboxqueue = [] + self.myChar = -1 + self.myChatColor = 0 + self.charEmotes = [] + self.selectedEmote = 0 + self.charName = '' + self.charShowname = '' + self.charSide = 'def' + self.lastMessage = '' + self.inboxQueue = [] self.textWaitTime = int(getOption("General", "text stay time", 200)) - self.msgqueue = [] - self.selectedmsg = -1 + self.messageQueue = [] + self.selectedMessage = -1 self.evidence = [] - self.privateevidence = [] - self.selectedevi = -1 + self.privateEvidence = [] + self.selectedEvidence = -1 self.present = False - self.playerlist = {} - self.selectedplayer = -1 - self.myflip = 0 - self.playsfx = 1 + self.playerList = {} + self.selectedPlayer = -1 + self.myFlip = 0 + self.playPreanim = 1 self.demoRecorder = None self.demoPlaying = False - self.musiclist = {} + self.musicList = {} self.slideEnabled = bool(getOption("General", "slide", False)) self.slideAvailable = False @@ -1600,7 +1600,7 @@ class GUI(QtGui.QWidget): # if self.slideEnabled: # self.slidebutton.setChecked(True) - # slideMap[old_pos][new_pos] = [kind, direction] + # slideMap[oldPos][newPos] = [kind, direction] self.slideMap = { "def": { "pro": [0, 0], "wit": [1, 0] }, "wit": { "def": [1, 1], "pro": [2, 0] }, @@ -1613,15 +1613,15 @@ class GUI(QtGui.QWidget): self.connect(self, QtCore.SIGNAL('showMessage(QString, QString, QString)'), self.showMessage) - self.charselect = charselect.charselect(self) + self.charSelect = charselect.charselect(self) - self.wtcesfx = 0 - self.guiltysfx = 0 - self.notguiltysfx = 0 + self.wtceSfx = 0 + self.guiltySfx = 0 + self.notGuiltySfx = 0 self.stream = 0 - self.specialstream = 0 - self.download_thread = None + self.specialStream = 0 + self.downloadThread = None self.tcp = None self.demoPlayer = None @@ -1637,7 +1637,7 @@ class GUI(QtGui.QWidget): def loadTheme(self, switching=False): theme = getOption("General", "theme", "default") try: - with open(AO2XPpath+"ao2xp_themes/"+theme+"/theme.py") as t: + with open(AO2XPpath + "ao2xp_themes/"+theme+"/theme.py") as t: exec t if switching: # This is to reset the colors on the music list. Not necessary on startup @@ -1666,7 +1666,7 @@ class GUI(QtGui.QWidget): self.chatbox.resize(chatboxWidth, self.chatboxHeight) self.chatbox.move(0, self.viewport.height() - self.chatboxHeight) - self.presentedevi.setGeometry(self.viewport.x() + 16, self.viewport.y() + 16, 70 * self.viewportScale, 70 * self.viewportScale) + self.presentedEvidence.setGeometry(self.viewport.x() + 16, self.viewport.y() + 16, 70 * self.viewportScale, 70 * self.viewportScale) fontDb = None nameFont = None @@ -1688,34 +1688,34 @@ class GUI(QtGui.QWidget): label.setFont(nameFont) spacing = 1 - x_mod_count = y_mod_count = 0 + xMod_count = yMod_count = 0 left, top, width, height = self.emotePageGeometry columns = (width - 40) / (spacing + 40) + 1 rows = (height - 40) / (spacing + 40) + 1 - self.max_emotes_on_page = columns * rows + self.maxEmotesOnPage = columns * rows - if len(self.emotebuttons) > 0: - for button in self.emotebuttons: + if len(self.emoteButtons) > 0: + for button in self.emoteButtons: button.setParent(None) button.deleteLater() button = None - self.emotebuttons = [] + self.emoteButtons = [] - for i in range(self.max_emotes_on_page): - x_pos = (40 + spacing) * x_mod_count - y_pos = (40 + spacing) * y_mod_count - x_mod_count += 1 - if x_mod_count == columns: - x_mod_count = 0 - y_mod_count += 1 + for i in range(self.maxEmotesOnPage): + xPos = (40 + spacing) * xMod_count + yPos = (40 + spacing) * yMod_count + xMod_count += 1 + if xMod_count == columns: + xMod_count = 0 + yMod_count += 1 button = buttons.EmoteButton(self, i) - button.move(left + x_pos, top + y_pos) - button.clicked.connect(self.icchat_focus) + button.move(left + xPos, top + yPos) + button.clicked.connect(self.ICChatFocus) button.show() button.lower() - self.emotebuttons.append(button) + self.emoteButtons.append(button) self.prevemotepage.raise_() self.nextemotepage.raise_() @@ -1724,7 +1724,7 @@ class GUI(QtGui.QWidget): self.setBackground() self.setScene() self.emotedropdown.setCurrentIndex(0) - self.set_emote_page() + self.setEmotePage() self.gamewindow.setFixedSize(self.width, self.height) self.gamewindow.center() except Exception as e: @@ -1756,21 +1756,21 @@ class GUI(QtGui.QWidget): self.text.move(16,32) self.screenshake.stop() - def icchat_focus(self): + def ICChatFocus(self): self.icchatinput.setFocus() - def on_realization_button(self): + def onRealizationClicked(self): if self.realizationbtn.isPressed(): self.effectdropdown.setCurrentIndex(1) # realization elif self.effectdropdown.currentText() == "realization": self.effectdropdown.setCurrentIndex(0) - self.icchat_focus() + self.ICChatFocus() - def on_shake_button(self): + def onShakeClicked(self): self.sfxbutton.setChecked(False) - self.icchat_focus() + self.ICChatFocus() - def on_ooc_login(self): + def onOOCLoginClicked(self): if not self.oocnameinput.text(): self.oocnameinput.setText("unnamed") @@ -1782,16 +1782,16 @@ class GUI(QtGui.QWidget): else: self.sendOOCchat(self.oocnameinput.text().toUtf8(), "/logout") - def set_ping(self, newping): + def setPing(self, newping): self.pinglabel.setText("Ping: %d" % newping) - def set_position(self, ind): + def setPosition(self, ind): if not self.oocnameinput.text(): self.oocnameinput.setText("unnamed") self.posdropdown.setCurrentIndex(ind) - self.charside = str(self.posdropdown.itemText(ind)) + self.charSide = str(self.posdropdown.itemText(ind)) self.setJudgeButtons() - self.icchat_focus() + self.ICChatFocus() if self.demoPlaying: return @@ -1799,11 +1799,11 @@ class GUI(QtGui.QWidget): server_is_2_8 = "additive" in self.features and "looping_sfx" in self.features and "effects" in self.features if server_is_2_8: - self.tcp.send("SP#"+self.charside+"#%") # all hail new AO 2.8 packet + self.tcp.send("SP#"+self.charSide+"#%") # all hail new AO 2.8 packet else: - self.sendOOCchat(self.oocnameinput.text().toUtf8(), "/pos "+self.charside) + self.sendOOCchat(self.oocnameinput.text().toUtf8(), "/pos "+self.charSide) - def change_music_volume(self, value): + def changeMusicVolume(self, value): if self.music: audio.sethandleattr(self.music, BASS_ATTRIB_VOL, value / 100.0) if value == 0: @@ -1811,22 +1811,22 @@ class GUI(QtGui.QWidget): elif audio.handleisactive(self.music) == BASS_ACTIVE_PAUSED: audio.playhandle(self.music, False) - def change_sound_volume(self, value): + def changeSoundVolume(self, value): if self.sound: audio.sethandleattr(self.sound, BASS_ATTRIB_VOL, value / 100.0) audio.sethandleattr(self.realizationsnd, BASS_ATTRIB_VOL, value / 100.0) - audio.sethandleattr(self.wtcesfx, BASS_ATTRIB_VOL, value / 100.0) - audio.sethandleattr(self.guiltysfx, BASS_ATTRIB_VOL, value / 100.0) - audio.sethandleattr(self.notguiltysfx, BASS_ATTRIB_VOL, value / 100.0) + audio.sethandleattr(self.wtceSfx, BASS_ATTRIB_VOL, value / 100.0) + audio.sethandleattr(self.guiltySfx, BASS_ATTRIB_VOL, value / 100.0) + audio.sethandleattr(self.notGuiltySfx, BASS_ATTRIB_VOL, value / 100.0) if self.modcall: audio.sethandleattr(self.modcall, BASS_ATTRIB_VOL, value / 100.0) - def change_blip_volume(self, value): + def changeBlipVolume(self, value): if self.blipsnd: audio.sethandleattr(self.blipsnd, BASS_ATTRIB_VOL, value / 100.0) def setJudgeButtons(self): - if self.charside == 'jud': + if self.charSide == 'jud': self.defensebar.minusbtn.show() self.defensebar.plusbtn.show() self.prosecutionbar.minusbtn.show() @@ -1845,14 +1845,14 @@ class GUI(QtGui.QWidget): self.notguiltybtn.hide() self.guiltybtn.hide() - def onChangeShowname(self, text): + def onShownameChanged(self, text): self.showname = str(text.toUtf8()) def onMusicSearch(self, text): self.musicitems.clear() if text: - for song, fname in self.musiclist.items(): + for song, fname in self.musicList.items(): if QtCore.QString(fname).contains(text, QtCore.Qt.CaseInsensitive): songitem = QtGui.QListWidgetItem() songitem.setText(song) @@ -1860,7 +1860,7 @@ class GUI(QtGui.QWidget): songitem.setBackgroundColor(QtGui.QColor(self.found_songitem_color)) self.musicitems.addItem(songitem) else: - self.allMusic() + self.loadAllMusic() def loadBackgrounds(self): self.backgrounditems.clear() @@ -1881,7 +1881,7 @@ class GUI(QtGui.QWidget): for bg in self.backgrounds: self.backgrounditems.addItem(bg) - def setEvidenceImg(self, guiobj, image, scale=False): + def setEvidenceImage(self, guiobj, image, scale=False): if exists(AOpath + 'evidence/' + image): img = QtGui.QPixmap(AOpath + "evidence/%s" % image) if not img.isNull() and scale: @@ -1898,60 +1898,60 @@ class GUI(QtGui.QWidget): if ini.read_ini_bool("AO2XP.ini", "General", "download evidence", True): url = "base/evidence/"+image.lower() url = url.replace("evidence/../", "") - path = AOpath+"evidence/"+image + path = AOpath + "evidence/"+image path = path.replace("evidence/../", "") - thread.start_new_thread(download_thread, (url, path)) + thread.start_new_thread(downloadThread, (url, path)) def changeUnmuteIndex(self, item): for i in range(self.unmutedlist.count()): if self.unmutedlist.item(i) == item: - self.muteselected = i + self.muteSelected = i def changeMuteIndex(self, item): for i in range(self.mutedlist.count()): if self.mutedlist.item(i) == item: - self.unmuteselected = i + self.unmuteSelected = i - def onMuteClick(self): + def onMuteClicked(self): if self.unmutedlist.count() == 0: return QtGui.QMessageBox.information(self, 'No character selected', 'There are no characters to mute.') - if self.muteselected == -1: + if self.muteSelected == -1: return QtGui.QMessageBox.information(self, 'No character selected', 'To mute a character, select their name from the list to the left, then click the >> button.') - for i in range(len(self.charlist)): - if self.charlist[i][0] == self.unmutedlist.item(self.muteselected).text(): + for i in range(len(self.charList)): + if self.charList[i][0] == self.unmutedlist.item(self.muteSelected).text(): self.muted.append(i) self.muted.sort() - self.muteselected = -1 + self.muteSelected = -1 break self.unmutedlist.clear() self.mutedlist.clear() - for i in range(len(self.charlist)): + for i in range(len(self.charList)): if i in self.muted: - self.mutedlist.addItem(self.charlist[i][0]) + self.mutedlist.addItem(self.charList[i][0]) else: - self.unmutedlist.addItem(self.charlist[i][0]) + self.unmutedlist.addItem(self.charList[i][0]) - def onUnmuteClick(self): + def onUnmuteClicked(self): if self.mutedlist.count() == 0: return QtGui.QMessageBox.information(self, 'No character selected', "There are no characters to unmute.") - if self.unmuteselected == -1: + if self.unmuteSelected == -1: return QtGui.QMessageBox.information(self, 'No character selected', 'To unmute a character, select their name from the list to the right, then click the << button.') - for char in self.charlist: - if char[0] == self.mutedlist.item(self.unmuteselected).text(): - del self.muted[self.unmuteselected] - self.unmuteselected = -1 + for char in self.charList: + if char[0] == self.mutedlist.item(self.unmuteSelected).text(): + del self.muted[self.unmuteSelected] + self.unmuteSelected = -1 break self.unmutedlist.clear() self.mutedlist.clear() - for i in range(len(self.charlist)): + for i in range(len(self.charList)): if i in self.muted: - self.mutedlist.addItem(self.charlist[i][0]) + self.mutedlist.addItem(self.charList[i][0]) else: - self.unmutedlist.addItem(self.charlist[i][0]) + self.unmutedlist.addItem(self.charList[i][0]) - def penaltyBarMinus(self, barType): + def onPenaltyBarMinusClicked(self, barType): netmsg = 'HP#' + str(barType) + '#' if barType == 1: if self.defensebar.getHealth() <= 0: @@ -1963,9 +1963,9 @@ class GUI(QtGui.QWidget): netmsg += str(self.prosecutionbar.getHealth() - 1) + '#' netmsg += '%' self.tcp.send(netmsg) - self.icchat_focus() + self.ICChatFocus() - def penaltyBarPlus(self, barType): + def onPenaltyBarPlusClicked(self, barType): netmsg = 'HP#' + str(barType) + '#' if barType == 1: if self.defensebar.getHealth() >= 10: @@ -1977,160 +1977,160 @@ class GUI(QtGui.QWidget): netmsg += str(self.prosecutionbar.getHealth() + 1) + '#' netmsg += '%' self.tcp.send(netmsg) - self.icchat_focus() + self.ICChatFocus() def setWhiteFlash(self, on, realizationtype=0, msec=0): - self.whiteflashlab.setVisible(on) + self.whiteFlashLabel.setVisible(on) if realizationtype == 1: self.playRealization(f) if msec: - self.whiteflash.start(msec) + self.whiteFlash.start(msec) def setScreenShake(self, on, amount=20): self.shakesRemaining = amount if on else 1 self.screenshake.start(25) - def WTCEbuttonPressed(self, type, variant): + def OnWTCEButtonClicked(self, type, variant): if type != 2: self.tcp.send('RT#testimony' + str(type + 1) + '#%') else: self.tcp.send("RT#judgeruling#" +str(variant)+ "#%") - self.icchat_focus() + self.ICChatFocus() - def onPVPacket(self, charname=""): + def onPVPacket(self, charName=""): self.gamewindow.setFixedSize(self.width, self.height) self.gamewindow.center() - if not self.swapping and charname: - self.loadCharacter(charname) + if not self.swapping and charName: + self.loadCharacter(charName) - def loadCharacter(self, charname): + def loadCharacter(self, charName): self.msgqueue_list.clear() - self.msgqueue = [] + self.messageQueue = [] self.effectdropdown.clear() self.emotedropdown.clear() - self.charemotes = [] - self.selectedemote = 0 - self.current_emote_page = 0 + self.charEmotes = [] + self.selectedEmote = 0 + self.currentEmotePage = 0 self.swapping = False - self.iniswapinfo.setText('Not swapped') + self.iniSwapInfo.setText('Not swapped') - effectslist = ini.get_effects(charname) - self.effectdropdown.setVisible(bool(effectslist)) - if effectslist: - effectslist.insert(0, "No effect") - self.effectdropdown.addItems(effectslist) + effectsList = ini.get_effects(charName) + self.effectdropdown.setVisible(bool(effectsList)) + if effectsList: + effectsList.insert(0, "No effect") + self.effectdropdown.addItems(effectsList) - if isinstance(charname, str): - charname = unicode(charname.lower()) - elif isinstance(charname, QtCore.QString): - charname = unicode(charname.toLower()) + if isinstance(charName, str): + charName = unicode(charName.lower()) + elif isinstance(charName, QtCore.QString): + charName = unicode(charName.toLower()) - #self.charname = ini.read_ini(AOpath + 'characters/' + charname + '/char.ini', "options", "name", charname.decode('utf-8').lower() - self.charname = charname # Just use the folder name + #self.charName = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "options", "name", charName.decode('utf-8').lower() + self.charName = charName # Just use the folder name - self.charshowname = ini.read_ini(AOpath + 'characters/' + charname + '/char.ini', "options", "showname") - if not self.charshowname == "": - self.charshowname = self.charshowname.decode('utf-8') - self.charside = ini.read_ini(AOpath + 'characters/' + charname + '/char.ini', "options", "side", "def") + self.charShowname = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "options", "showname") + if not self.charShowname == "": + self.charShowname = self.charShowname.decode('utf-8') + self.charSide = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "options", "side", "def") - self.posdropdown.setCurrentIndex(self.posdropdown.findText(self.charside)) + self.posdropdown.setCurrentIndex(self.posdropdown.findText(self.charSide)) self.setJudgeButtons() - for emoteind in range(1, ini.read_ini_int(AOpath+"characters/"+self.charname+"/char.ini", "emotions", "number") + 1): + for emoteind in range(1, ini.read_ini_int(AOpath + "characters/"+self.charName+"/char.ini", "emotions", "number") + 1): if emoteind == 1: suffix = 'on' else: suffix = 'off' - emote = ini.read_ini(AOpath + 'characters/' + charname + '/char.ini', "emotions", str(emoteind), 'normal#(a)normal#normal#0#') - sound = ini.read_ini(AOpath + 'characters/' + charname + '/char.ini', "soundn", str(emoteind), '1') - soundt = ini.read_ini(AOpath + 'characters/' + charname + '/char.ini', "soundt", str(emoteind), '0') - soundl = ini.read_ini(AOpath + 'characters/' + charname + '/char.ini', "soundl", str(emoteind), '0') # AO 2.8 + emote = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "emotions", str(emoteind), 'normal#(a)normal#normal#0#') + sound = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "soundn", str(emoteind), '1') + soundt = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "soundt", str(emoteind), '0') + soundl = ini.read_ini(AOpath + 'characters/' + charName + '/char.ini', "soundl", str(emoteind), '0') # AO 2.8 - emotelist = emote.split('#') - deskmod = emotelist.pop(len(emotelist) - 1) + emoteList = emote.split('#') + deskmod = emoteList.pop(len(emoteList) - 1) - emotelist.append(sound) - emotelist.append(soundt) - emotelist.append(soundl) # AO 2.8 - emotelist.append(deskmod) - self.charemotes.append(emotelist) - if emotelist[0]: - self.emotedropdown.addItem(emotelist[0]) + emoteList.append(sound) + emoteList.append(soundt) + emoteList.append(soundl) # AO 2.8 + emoteList.append(deskmod) + self.charEmotes.append(emoteList) + if emoteList[0]: + self.emotedropdown.addItem(emoteList[0]) else: - self.emotedropdown.addItem(emotelist[1] + ' ' + emotelist[2]) + self.emotedropdown.addItem(emoteList[1] + ' ' + emoteList[2]) self.emotedropdown.setCurrentIndex(0) - self.set_emote_page() + self.setEmotePage() - def set_emote_page(self): - if self.mychar < 0: + def setEmotePage(self): + if self.myChar < 0: return self.prevemotepage.hide() self.nextemotepage.hide() - total_emotes = len(self.charemotes) + totalEmotes = len(self.charEmotes) - for button in self.emotebuttons: + for button in self.emoteButtons: button.hide() - if not total_emotes: + if not totalEmotes: print "[client] The selected character appears to have no emotions defined" return - total_pages = total_emotes / self.max_emotes_on_page - emotes_on_page = 0 - if total_emotes % self.max_emotes_on_page != 0: - total_pages += 1 - if total_pages > self.current_emote_page + 1: - emotes_on_page = self.max_emotes_on_page + totalPages = totalEmotes / self.maxEmotesOnPage + emotesOnPage = 0 + if totalEmotes % self.maxEmotesOnPage != 0: + totalPages += 1 + if totalPages > self.currentEmotePage + 1: + emotesOnPage = self.maxEmotesOnPage else: - emotes_on_page = total_emotes % self.max_emotes_on_page + emotesOnPage = totalEmotes % self.maxEmotesOnPage else: - emotes_on_page = self.max_emotes_on_page - if total_pages > self.current_emote_page + 1: + emotesOnPage = self.maxEmotesOnPage + if totalPages > self.currentEmotePage + 1: self.nextemotepage.show() - if self.current_emote_page > 0: + if self.currentEmotePage > 0: self.prevemotepage.show() - for n_emote in range(emotes_on_page): - n_real_emote = n_emote + self.current_emote_page * self.max_emotes_on_page - if n_real_emote == self.selectedemote: - image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(n_real_emote + 1) + '_on.png') + for nEmote in range(emotesOnPage): + nRealEmote = nEmote + self.currentEmotePage * self.maxEmotesOnPage + if nRealEmote == self.selectedEmote: + image = QtGui.QPixmap(AOpath + 'characters/' + self.charName + '/emotions/button' + str(nRealEmote + 1) + '_on.png') else: - image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(n_real_emote + 1) + '_off.png') + image = QtGui.QPixmap(AOpath + 'characters/' + self.charName + '/emotions/button' + str(nRealEmote + 1) + '_off.png') if not image.isNull() and not image.width() == 40: - self.emotebuttons[n_emote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) + self.emoteButtons[nEmote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) else: - self.emotebuttons[n_emote].setPixmap(image) + self.emoteButtons[nEmote].setPixmap(image) - self.emotebuttons[n_emote].show() - self.emotebuttons[n_emote].setToolTip(self.charemotes[n_emote + self.current_emote_page * self.max_emotes_on_page][0]) + self.emoteButtons[nEmote].show() + self.emoteButtons[nEmote].setToolTip(self.charEmotes[nEmote + self.currentEmotePage * self.maxEmotesOnPage][0]) - def iniswap_index_change(self, ind): - self.iniswapindex = ind + def iniSwapIndexChange(self, ind): + self.iniSwapIndex = ind def loadSwapCharacters(self): - self.charsfolder = [] + self.charsFolder = [] self.iniSwapList.clear() for folder in os.listdir(unicode(AOpath + 'characters')): if exists(AOpath + 'characters/' + folder + '/char.ini'): - self.charsfolder.append(folder) + self.charsFolder.append(folder) self.iniSwapList.addItem(folder) - def iniswap_confirm(self): - if self.charlist[self.mychar][0].lower() == self.charsfolder[self.iniswapindex].lower(): + def onIniSwapConfirmClicked(self): + if self.charList[self.myChar][0].lower() == self.charsFolder[self.iniSwapIndex].lower(): self.resetIniSwap() else: self.swapping = True - self.iniswapinfo.setText('Swapped to ' + self.charsfolder[self.iniswapindex]) - self.loadCharacter(self.charsfolder[self.iniswapindex]) + self.iniSwapInfo.setText('Swapped to ' + self.charsFolder[self.iniSwapIndex]) + self.loadCharacter(self.charsFolder[self.iniSwapIndex]) def resetIniSwap(self): self.swapping = False - self.iniswapinfo.setText('Not swapped') - self.loadCharacter(self.charlist[self.mychar][0]) + self.iniSwapInfo.setText('Not swapped') + self.loadCharacter(self.charList[self.myChar][0]) def onAddEvidence(self): self.evidenceEditor.show() @@ -2138,29 +2138,29 @@ class GUI(QtGui.QWidget): def onEditEvidence(self): if not self.evidence: return QtGui.QMessageBox.information(self, 'No evidence', "There's no evidence on the court record.") - self.evidenceEditor.edit_evidence(self.selectedevi) + self.evidenceEditor.editEvidence(self.selectedEvidence) def onDeleteEvidence(self): - if self.selectedevi == -1: + if self.selectedEvidence == -1: return - if not self.privateinv: + if not self.privateInventorySelected: if self.evidence: - self.tcp.send('DE#' + str(self.selectedevi) + '#%') + self.tcp.send('DE#' + str(self.selectedEvidence) + '#%') else: self.tcp.send('DE#0#%') - elif len(self.privateevidence): - del self.privateevidence[self.selectedevi] - self.privatedropdown.removeItem(self.selectedevi) + elif len(self.privateEvidence): + del self.privateEvidence[self.selectedEvidence] + self.privatedropdown.removeItem(self.selectedEvidence) - def onExportEvidence(self, is_autosave=False): + def onExportEvidence(self, isAutosave=False): if not exists("evidence"): os.mkdir("evidence") - path = unicode(QtGui.QFileDialog.getSaveFileName(self, "Save evidence", "evidence", "Evidence (*.ini)")) if not is_autosave else "evidence/inventory.ini" + path = unicode(QtGui.QFileDialog.getSaveFileName(self, "Save evidence", "evidence", "Evidence (*.ini)")) if not isAutosave else "evidence/inventory.ini" if path: - evidence = self.evidence if not self.privateinv else self.privateevidence + evidence = self.evidence if not self.privateInventorySelected else self.privateEvidence inifile = ConfigParser() for i in range(len(evidence)): evi = evidence[i] @@ -2186,7 +2186,7 @@ class GUI(QtGui.QWidget): def onImportEvidence(self, is_autoload=False): if not is_autoload: - if not self.privateinv: + if not self.privateInventorySelected: if QtGui.QMessageBox.warning(self, "Import evidence", 'This will OVERWRITE the global evidence server-side.\n\nContinue?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) == QtGui.QMessageBox.No: return else: @@ -2216,77 +2216,77 @@ class GUI(QtGui.QWidget): evidence.append([name, description, image]) - if self.privateinv or is_autoload: + if self.privateInventorySelected or is_autoload: dropdown = self.privatedropdown - self.privateevidence = evidence + self.privateEvidence = evidence if dropdown.count() > 0: dropdown.clear() if evidence: for evi in evidence: dropdown.addItem(evi[0]) - dropdown.setCurrentIndex(self.selectedevi) + dropdown.setCurrentIndex(self.selectedEvidence) if not is_autoload: self.onExportEvidence(True) elif evidence: if self.evidence: for i in range(len(self.evidence)): - self.tcp.send('DE#' + str(self.selectedevi) + '#%') + self.tcp.send('DE#' + str(self.selectedEvidence) + '#%') for evi in evidence: self.tcp.send('PE#' + evi[0] + '#' + evi[1] + '#' + evi[2] + '#%') def onTransferEvidence(self): - if self.privateinv: - evi = self.privateevidence[self.selectedevi] + if self.privateInventorySelected: + evi = self.privateEvidence[self.selectedEvidence] target = self.evidence target_str = "global" else: - evi = self.evidence[self.selectedevi] - target = self.privateevidence + evi = self.evidence[self.selectedEvidence] + target = self.privateEvidence target_str = "private" if evi in target: return QtGui.QMessageBox.information(self, "Can't transfer evidence", 'The evidence "%s" already exists in the %s inventory.' % (evi[0], target_str)) else: - if self.privateinv: + if self.privateInventorySelected: for i in range(len(evi)): evi[i] = evi[i].replace('#', '').replace('%', '').replace('&', '').replace('$', '').replace('\\n', '\n') self.tcp.send('PE#' + evi[0] + '#' + evi[1] + '#' + evi[2] + '#%') else: - self.privateevidence.append(evi) + self.privateEvidence.append(evi) self.privatedropdown.addItem(evi[0]) def onTransferAllEvidence(self): fail = [] - if self.privateinv: - evi = self.privateevidence[self.selectedevi] - origin = self.privateevidence + if self.privateInventorySelected: + evi = self.privateEvidence[self.selectedEvidence] + origin = self.privateEvidence target = self.evidence target_str = "global" else: - evi = self.evidence[self.selectedevi] + evi = self.evidence[self.selectedEvidence] origin = self.evidence - target = self.privateevidence + target = self.privateEvidence target_str = "private" for evi in origin: if evi in target: fail.append(evi[0]) else: - if self.privateinv: + if self.privateInventorySelected: self.tcp.send('PE#' + evi[0] + '#' + evi[1] + '#' + evi[2] + '#%') else: - self.privateevidence.append(evi) + self.privateEvidence.append(evi) self.privatedropdown.addItem(evi[0]) if fail: return QtGui.QMessageBox.information(self, "Some evidence wasn't transferred", "The following evidence already exists in the %s inventory:\n\n%s." % (target_str, ", ".join(fail))) def onSwitchInventory(self, reset=False): - self.privateinv = not self.privateinv - if self.privateinv and not reset: + self.privateInventorySelected = not self.privateInventorySelected + if self.privateInventorySelected and not reset: self.present = False self.evidencepresent.setPixmap(self.evidencepresent.button_off) self.evidencepresent.hide() @@ -2313,107 +2313,107 @@ class GUI(QtGui.QWidget): self.evidencedropdown.setCurrentIndex(0) self.changeEvidence(0, 0) - def onClick_callMod(self): + def onCallModClicked(self): if "modcall_reason" in self.features: reason, ok = QtGui.QInputDialog.getText(self, "Call a moderator", "Enter your reason.") if ok and reason: - self.tcp.send("ZZ#"+reason.toUtf8()+"#%") + self.tcp.send("ZZ#"+reason.toUtf8() + "#%") else: self.tcp.send("ZZ#%") - def onClick_changeChar(self): + def onChangeCharClicked(self): if self.demoPlaying: - self.inbox_timer.stop() - self.chat_tick_timer.stop() + self.inboxTimer.stop() + self.chatTickTimer.stop() self.disconnectCommon() self.gamewindow.returnToMenu() else: - self.charselect.showCharSelect() + self.charSelect.showCharSelect() def changeFlipCheck(self, on): if on == 2: on = 1 - self.myflip = on - self.icchat_focus() + self.myFlip = on + self.ICChatFocus() - def changeSfxCheck(self, on): + def changePreanimCheck(self, on): if on == 2: on = 1 - self.playsfx = on + self.playPreanim = on self.nointerruptbtn.setDisabled(not on) if on == 0: self.nointerruptbtn.setChecked(False) - self.icchat_focus() + self.ICChatFocus() - def onClicked_msgqueue(self, item): + def onMessageQueueItemClicked(self, item): for i in range(len(self.msgqueue_list)): if self.msgqueue_list.item(i) == item: - self.selectedmsg = i + self.selectedMessage = i + + def onRemoveQueueClicked(self): + if len(self.msgqueue_list) == 0: + return QtGui.QMessageBox.information(self, "No messages in queue", 'Enter a message on the game chat to add one.') + if self.selectedMessage == -1: + return QtGui.QMessageBox.information(self, 'No message selected', 'Select a message from the list to remove it.') + self.msgqueue_list.takeItem(self.selectedMessage) + del self.messageQueue[self.selectedMessage] + + def onClearQueueClicked(self): + return QtGui.QMessageBox.information(self, "Clear queue", 'Not implemented.') - def onClicked_playerList(self, item): + def onPlayerListItemClicked(self, item): for i in range(len(self.player_list)): sel = self.player_list.item(i) if sel == item: s = sel.text() - self.selectedplayer = s[1:s.indexOf("]")] + self.selectedPlayer = s[1:s.indexOf("]")] - def onClicked_remove_queue(self): - if len(self.msgqueue_list) == 0: - return QtGui.QMessageBox.information(self, "No messages in queue", 'Enter a message on the game chat to add one.') - if self.selectedmsg == -1: - return QtGui.QMessageBox.information(self, 'No message selected', 'Select a message from the list to remove it.') - self.msgqueue_list.takeItem(self.selectedmsg) - del self.msgqueue[self.selectedmsg] - - def onClicked_clear_queue(self): - return QtGui.QMessageBox.information(self, "Clear queue", 'Not implemented.') - - def onClicked_playerPair(self): - if not self.selectedplayer == -1: + def onPlayerPairClicked(self): + if not self.selectedPlayer == -1: self.gametabs.setCurrentWidget(self.gametab_pair) self.paircheckbox.setChecked(True) - char = self.playerlist[str(self.selectedplayer)][1] + char = self.playerList[str(self.selectedPlayer)][1] if char == '': return QtGui.QMessageBox.information(self, "Unable to pair", 'That player has no character selected.') else: - self.pairdropdown.setCurrentIndex([c[0] for c in self.charlist].index(char)) + self.pairdropdown.setCurrentIndex([c[0] for c in self.charList].index(char)) else: return QtGui.QMessageBox.information(self, 'No player selected', 'Select a player from the list to attempt pairing.') - def onClicked_playerKick(self): - if not self.selectedplayer == -1: + def onPlayerKickClicked(self): + if not self.selectedPlayer == -1: reason, ok = QtGui.QInputDialog.getText(self, "Kick a player", "Please enter the reason.", text="Being annoying") if reason and ok: - self.tcp.send("MA#%s#0#%s#%%" % (self.selectedplayer, reason)) + self.tcp.send("MA#%s#0#%s#%%" % (self.selectedPlayer, reason)) else: return QtGui.QMessageBox.information(self, 'No player selected', 'Select a player from the list to kick.') - def onClicked_playerBan(self): - if not self.selectedplayer == -1: + def onPlayerBanClicked(self): + if not self.selectedPlayer == -1: reason, ok = QtGui.QInputDialog.getText(self, "Ban a player", "Please enter the reason.", text="Being annoying") if reason and ok: duration, ok = QtGui.QInputDialog.getInt(self, "Ban a player", "Please enter the ban length in minutes.", 60, 1) if duration and ok: - self.tcp.send("MA#%s#%s#%s#%%" % (self.selectedplayer, duration, reason)) + self.tcp.send("MA#%s#%s#%s#%%" % (self.selectedPlayer, duration, reason)) else: return QtGui.QMessageBox.information(self, 'No player selected', 'Select a player from the list to ban.') def changeEvidence(self, ind, kind): if ind < 0: return - if self.privateinv: + if self.privateInventorySelected: if not kind == 1: return - evi = self.privateevidence + evi = self.privateEvidence else: if not kind == 0: return evi = self.evidence - self.selectedevi = ind + self.selectedEvidence = ind if len(evi) > 0: self.evidencedesc.setText(evi[ind][1]) - self.setEvidenceImg(self.evidenceimage, evi[ind][2]) + self.setEvidenceImage(self.evidenceimage, evi[ind][2]) def changeGlobalEvidence(self, ind): self.changeEvidence(ind, 0) @@ -2425,17 +2425,17 @@ class GUI(QtGui.QWidget): if ind == -1: return - self.icchat_focus() + self.ICChatFocus() if not dropdown: - self.selectedemote = ind + self.current_emote_page * self.max_emotes_on_page + self.selectedEmote = ind + self.currentEmotePage * self.maxEmotesOnPage else: - self.selectedemote = ind - for button in self.emotebuttons: + self.selectedEmote = ind + for button in self.emoteButtons: if button.emoteid == ind: - button.path = AOpath + 'characters/' + self.charname + '/emotions/button' + str(button.emoteid + self.current_emote_page * self.max_emotes_on_page + 1) + button.path = AOpath + 'characters/' + self.charName + '/emotions/button' + str(button.emoteid + self.currentEmotePage * self.maxEmotesOnPage + 1) image = QtGui.QPixmap(button.path + '_on.png') else: - image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(button.emoteid + self.current_emote_page * self.max_emotes_on_page + 1) + '_off.png') + image = QtGui.QPixmap(AOpath + 'characters/' + self.charName + '/emotions/button' + str(button.emoteid + self.currentEmotePage * self.maxEmotesOnPage + 1) + '_off.png') if not image.isNull() and not image.width() == 40: button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) @@ -2443,8 +2443,8 @@ class GUI(QtGui.QWidget): button.setPixmap(image) def setChatColor(self, ind): - self.mychatcolor = ind - self.icchat_focus() + self.myChatColor = ind + self.ICChatFocus() def showMessage(self, type, *args, **kwargs): if type == 'critical': @@ -2461,13 +2461,13 @@ class GUI(QtGui.QWidget): def disconnectCommon(self): self.onSwitchInventory(True) - self.selectedplayer = -1 + self.selectedPlayer = -1 self.player_list.clear() self.player_kick.setDisabled(True) self.player_ban.setDisabled(True) self.ooclogin.setText("Lo&gin") self.login = False - self.privateinv = False + self.privateInventorySelected = False if self.tcp: self.tcp.close() if self.demoPlayer: @@ -2477,32 +2477,32 @@ class GUI(QtGui.QWidget): self.demoPlaying = False self.stopMusic() - def onMusicClick(self, item): - self.sendMC(self.musiclist[item.text()]) + def onMusicListItemClicked(self, item): + self.sendMC(self.musicList[item.text()]) - def onAreaClick(self, item): + def onAreaListItemClicked(self, item): area = item.text().split('\n')[0] self.sendMC(area) - def onBackgroundClick(self, item): + def onBackgroundListClick(self, item): self.sendOOCchat(self.oocnameinput.text().toUtf8(), "/bg " + item.text()) def sendMC(self, content): if "cccc_ic_support" in self.features and self.showname: - self.tcp.send('MC#' + content + '#' + str(self.mychar) + '#' + self.showname.decode('utf-8') + '#%') + self.tcp.send('MC#' + content + '#' + str(self.myChar) + '#' + self.showname.decode('utf-8') + '#%') else: - self.tcp.send('MC#' + content + '#' + str(self.mychar) + '#%') + self.tcp.send('MC#' + content + '#' + str(self.myChar) + '#%') - def icLogChanged(self): + def onICLogChanged(self): if self.iclog.verticalScrollBar().value() == self.iclog.verticalScrollBar().maximum(): self.iclog.verticalScrollBar().setValue(self.iclog.verticalScrollBar().maximum()) - def ooclog_update(self): + def onOOCLogChanged(self): if self.ooclog.verticalScrollBar().value() == self.ooclog.verticalScrollBar().maximum(): self.ooclog.verticalScrollBar().setValue(self.ooclog.verticalScrollBar().maximum()) def sendOOCchat(self, name, text): self.tcp.send('CT#' + name + '#' + text + '#%') - def onOOCreturn(self): + def onOOCReturn(self): text = self.oocinput.text().replace('#', '').replace('%', '').replace('&', '').replace('$', '').replace('\\n', '\n') if text.startsWith('//'): code = str(self.oocinput.text()).replace('//', '', 1).replace('\\NEWLINE', '\n') @@ -2542,7 +2542,7 @@ class GUI(QtGui.QWidget): self.sendOOCchat(self.oocnameinput.text().toUtf8(), text) self.oocinput.clear() - def onICreturn(self): + def onICReturn(self): text = unicode(self.icchatinput.text()).replace('#', '').replace('%', '').replace('&', '').replace('$', '')#.replace('/n', '\n') if text: @@ -2564,12 +2564,12 @@ class GUI(QtGui.QWidget): l.insert(i, " ") text = "".join(l) - emote = self.charemotes[self.selectedemote] + emote = self.charEmotes[self.selectedEmote] if self.nointerruptbtn.isChecked(): modifier = 0 else: - modifier = self.playsfx + modifier = self.playPreanim objection = 0 if self.customobject.isPressed(): objection = 4 @@ -2611,33 +2611,33 @@ class GUI(QtGui.QWidget): msg += "chat#" msg += emote[1]+"#" #pre-anim - msg += self.charname.title()+"#" + msg += self.charName.title() + "#" msg += emote[2]+"#" #anim msg += text+"#" - msg += self.charside+"#" - msg += (ini.get_effect_sound(self.effectdropdown.currentText(), self.charname) if self.effectdropdown.currentIndex() > 0 else emote[4])+"#" #sfx + msg += self.charSide+"#" + msg += (ini.get_effect_sound(self.effectdropdown.currentText(), self.charName) if self.effectdropdown.currentIndex() > 0 else emote[4])+"#" #sfx msg += str(modifier)+"#" #emote modifier - msg += str(self.mychar)+"#" #character ID + msg += str(self.myChar)+"#" #character ID msg += emote[5]+"#" #sfx delay msg += str(objection)+"#" - msg += str((self.selectedevi + 1) * int(self.present))+"#" #selected evidence + msg += str((self.selectedEvidence + 1) * int(self.present))+"#" #selected evidence if self.present: self.present = False self.evidencepresent.setPixmap(self.evidencepresent.button_off) if "flipping" in self.features: - msg += str(self.myflip)+"#" + msg += str(self.myFlip)+"#" else: - msg += str(self.mychar)+"#" # old AO servers send a second charID in the message because drunk fanat + msg += str(self.myChar)+"#" # old AO servers send a second charID in the message because drunk fanat msg += str(int(self.realizationbtn.isPressed()))+"#" - msg += str(self.mychatcolor)+"#" + msg += str(self.myChatColor)+"#" if "cccc_ic_support" in self.features: showname = self.showname.decode('utf-8') - if self.showname == "" and not self.charshowname == "": - showname = self.charshowname + if self.showname == "" and not self.charShowname == "": + showname = self.charShowname msg += showname+"#" # custom showname if self.paircheckbox.isChecked(): msg += str(self.pairdropdown.currentIndex()) # pair charID @@ -2667,7 +2667,7 @@ class GUI(QtGui.QWidget): for f_emote in emotes_to_check: packet += f_emote if ini.read_ini_bool("AO2XP.ini", "General", "network frame effects", True): - sfx_frames = "|".join(ini.read_ini_tags(AOpath+"characters/"+self.charname+"/char.ini", f_emote + f_effect)) + sfx_frames = "|".join(ini.read_ini_tags(AOpath + "characters/"+self.charName+"/char.ini", f_emote + f_effect)) if sfx_frames: packet += "|" + sfx_frames packet += "^" @@ -2678,16 +2678,16 @@ class GUI(QtGui.QWidget): if "effects" in self.features: fx = self.effectdropdown.currentText() if self.effectdropdown.currentIndex() > 0 else "" - fx_sound = ini.get_effect_sound(fx, self.charname) - p_effect = ini.read_ini(AOpath+"characters/"+self.charname+"/char.ini", "options", "effects") - msg += str(fx + "|" + p_effect + "|" + fx_sound + "#").encode('utf-8') + fxSound = ini.get_effect_sound(fx, self.charName) + p_effect = ini.read_ini(AOpath + "characters/"+self.charName+"/char.ini", "options", "effects") + msg += str(fx + "|" + p_effect + "|" + fxSound + "#").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 "customBlips" 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") + blip = ini.read_ini(AOpath + "characters/"+self.charName+"/char.ini", "options", "gender") if blip: msg += str(blip) + "#" @@ -2697,8 +2697,8 @@ class GUI(QtGui.QWidget): msg += "%" self.msgqueue_list.addItem(self.icchatinput.text()) - self.msgqueue.append(msg) - self.lastmsg = msg + self.messageQueue.append(msg) + self.lastMessage = msg self.icchatinput.clear() self.realizationbtn.setPressed(False) @@ -2746,14 +2746,14 @@ class GUI(QtGui.QWidget): slide = QtGui.QPixmap(court) slide_width = slide.width() * 2 - self.slide_bg.resize(slide_width, self.viewport.height()) - self.slide_bg.setPixmap(slide.scaled(slide.width() * 2, self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) + self.slideBg.resize(slide_width, self.viewport.height()) + self.slideBg.setPixmap(slide.scaled(slide.width() * 2, self.viewport.height(), 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, self.viewport.height()) - self.slide_overlay.setPixmap(slide_overlay.scaled(slide.width() * 2, self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) + courtOverlay = AOpath + 'background/' + bg + '/courtOverlay.png' + if exists(courtOverlay): + slideOverlay = QtGui.QPixmap(courtOverlay) + self.slideOverlay.resize(slide_width, self.viewport.height()) + self.slideOverlay.setPixmap(slideOverlay.scaled(slide.width() * 2, self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) self.slideHasOverlay = True else: self.slideHasOverlay = False @@ -2765,112 +2765,112 @@ class GUI(QtGui.QWidget): self.char.hide() self.setScene(True) - def slide_start(self, value = [0, 0]): + def startSlide(self, value = [0, 0]): self.chatbox.hide() - self.presentedevi.hide() + self.presentedEvidence.hide() slide_time = 500 self.bench.hide() - self.slide_bg.show() + self.slideBg.show() - def_pos = QtCore.QRect(0, 0, self.slide_bg.width(), self.viewport.height()) - pro_pos = QtCore.QRect(-(def_pos.size().width() - self.viewport.width()), 0, def_pos.size().width(), self.viewport.height()) - wit_pos = QtCore.QRect(-(self.slide_bg.width() / 2 - self.viewport.width() / 2), 0, self.slide_bg.width(), self.viewport.height()) + defPos = QtCore.QRect(0, 0, self.slideBg.width(), self.viewport.height()) + proPos = QtCore.QRect(-(defPos.size().width() - self.viewport.width()), 0, defPos.size().width(), self.viewport.height()) + witPos = QtCore.QRect(-(self.slideBg.width() / 2 - self.viewport.width() / 2), 0, self.slideBg.width(), self.viewport.height()) self.slideKind = value[0] self.slideDirection = value[1] # TODO: play only first frame of preanim, figure out zooms - scaling = get_scaling(ini.read_ini(AOpath + 'characters/' + self.m_chatmessage[CHARNAME] + '/char.ini', "options", "scaling").lower()) - if self.m_chatmessage[FLIP] == "1": - self.slideSpeaker.set_flipped(True) + scaling = getScaling(ini.read_ini(AOpath + 'characters/' + self.mChatMessage[CHARNAME] + '/char.ini', "options", "scaling").lower()) + if self.mChatMessage[FLIP] == "1": + self.slideSpeaker.setFlipped(True) else: - self.slideSpeaker.set_flipped(False) + self.slideSpeaker.setFlipped(False) - self.slideSpeaker.play_idle(self.m_chatmessage[CHARNAME], self.m_chatmessage[ANIM], scaling) + self.slideSpeaker.playIdle(self.mChatMessage[CHARNAME], self.mChatMessage[ANIM], scaling) self.slideSpeaker.show() if self.slideKind == 0: - if self.slide_last_wit: - self.slideWitness.play_idle(self.slide_last_wit[0], self.slide_last_wit[1], self.slide_last_wit[2]) + if self.slideLastWit: + self.slideWitness.playIdle(self.slideLastWit[0], self.slideLastWit[1], self.slideLastWit[2]) self.slideWitness.show() if self.slideDirection == 0: - bg_start = def_pos - bg_end = pro_pos + bg_start = defPos + bg_end = proPos else: - bg_start = pro_pos - bg_end = def_pos + bg_start = proPos + bg_end = defPos elif self.slideKind == 1: if self.slideDirection == 0: - bg_start = def_pos - bg_end = wit_pos + bg_start = defPos + bg_end = witPos else: - bg_start = wit_pos - bg_end = def_pos + bg_start = witPos + bg_end = defPos elif self.slideKind == 2: if self.slideDirection == 0: - bg_start = wit_pos - bg_end = pro_pos + bg_start = witPos + bg_end = proPos else: - bg_start = pro_pos - bg_end = wit_pos + bg_start = proPos + bg_end = witPos - self.slide_bg.setGeometry(bg_start) - 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() + self.slideBg.setGeometry(bg_start) + self.slideBgAnimation.setStartValue(bg_start) + self.slideBgAnimation.setEndValue(bg_end) + self.slideBgAnimation.setDuration(slide_time) + self.slideBgAnimation.setEasingCurve(QtCore.QEasingCurve.InOutQuad) + self.slideBgAnimation.start() if self.slideHasOverlay: - self.slide_overlay.show() - self.slide_overlay.setGeometry(bg_start) + self.slideOverlay.show() + self.slideOverlay.setGeometry(bg_start) - def slide_changed(self): - x = self.slide_bg.x() - self.slide_overlay.move(x, 0) + def slideChanged(self): + x = self.slideBg.x() + self.slideOverlay.move(x, 0) # def-pro if self.slideKind == 0: - if self.slide_last_wit: - self.slideWitness.move_slide(x + self.slide_bg.width() / 2 - self.viewport.width() / 2) + if self.slideLastWit: + self.slideWitness.moveSlide(x + self.slideBg.width() / 2 - self.viewport.width() / 2) if self.slideDirection == 0: - self.char.move_slide(x) - self.slideSpeaker.move_slide(x + self.slide_bg.width() - self.viewport.width()) + self.char.moveSlide(x) + self.slideSpeaker.moveSlide(x + self.slideBg.width() - self.viewport.width()) else: - self.char.move_slide(x + self.slide_bg.width() - self.viewport.width()) - self.slideSpeaker.move_slide(x) + self.char.moveSlide(x + self.slideBg.width() - self.viewport.width()) + self.slideSpeaker.moveSlide(x) # def-wit elif self.slideKind == 1: if self.slideDirection == 0: - self.char.move_slide(x) - self.slideSpeaker.move_slide(x + self.slide_bg.width() / 2 - self.viewport.width() / 2) + self.char.moveSlide(x) + self.slideSpeaker.moveSlide(x + self.slideBg.width() / 2 - self.viewport.width() / 2) else: - self.char.move_slide(x + self.slide_bg.width() / 2 - self.viewport.width() / 2) - self.slideSpeaker.move_slide(x) + self.char.moveSlide(x + self.slideBg.width() / 2 - self.viewport.width() / 2) + self.slideSpeaker.moveSlide(x) # pro-wit elif self.slideKind == 2: if self.slideDirection == 0: - self.char.move_slide(x + self.slide_bg.width() / 2 - self.viewport.width() / 2) - self.slideSpeaker.move_slide(x + self.slide_bg.width() - self.viewport.width()) + self.char.moveSlide(x + self.slideBg.width() / 2 - self.viewport.width() / 2) + self.slideSpeaker.moveSlide(x + self.slideBg.width() - self.viewport.width()) else: - self.char.move_slide(x + self.slide_bg.width() - self.viewport.width()) - self.slideSpeaker.move_slide(x + self.slide_bg.width() / 2 - self.viewport.width() / 2) + self.char.moveSlide(x + self.slideBg.width() - self.viewport.width()) + self.slideSpeaker.moveSlide(x + self.slideBg.width() / 2 - self.viewport.width() / 2) - def slide_done(self): - self.slide_bg.hide() - self.slide_overlay.hide() + def slideDone(self): + self.slideBg.hide() + self.slideOverlay.hide() self.slideWitness.hide() self.slideSpeaker.hide() - self.handle_chatmessage_2() + self.handleChatMessage2() - def netmsg_hp(self, type, health): + def netmsgHP(self, type, health): if type == 1: self.defensebar.setHealth(health) elif type == 2: self.prosecutionbar.setHealth(health) - def netmsg_ms(self, p_contents): + def netmsgMS(self, p_contents): if len(p_contents) < 15: #this is already done on the TCP thread but i'll do it here anyway as well return @@ -2879,66 +2879,66 @@ class GUI(QtGui.QWidget): if int(p_contents[CHAR_ID]) in self.muted: # skip the self.chatmessage copy line below return - m_chatmessage = {} + mChatMessage = {} - for n_string in range(self.chatmessage_size): + for n_string in range(self.chatMessageSize): if n_string < len(p_contents) and (n_string < 16 or AO2chat): - m_chatmessage[n_string] = p_contents[n_string] + mChatMessage[n_string] = p_contents[n_string] else: - m_chatmessage[n_string] = "" + mChatMessage[n_string] = "" # For debugging - # print m_chatmessage + # print mChatMessage - f_char_id = int(m_chatmessage[CHAR_ID]) + fCharId = int(mChatMessage[CHAR_ID]) - if f_char_id < 0 or f_char_id >= len(self.charlist): + if fCharId < 0 or fCharId >= len(self.charList): return - f_showname = "" - if not m_chatmessage[SHOWNAME]: - f_showname = m_chatmessage[CHARNAME] + fShowname = "" + if not mChatMessage[SHOWNAME]: + fShowname = mChatMessage[CHARNAME] else: - f_showname = m_chatmessage[SHOWNAME] + fShowname = mChatMessage[SHOWNAME] - if self.msgqueue: - chatmsgcomp = (self.msgqueue[0].split('#')[5]).replace('', '$').replace('', '%').replace('', '&').replace('', '#') - examine = chatmsgcomp == ">" or chatmsgcomp == "<" or chatmsgcomp == "=" - special = not chatmsgcomp or chatmsgcomp.isspace() - if examine or (f_char_id == self.mychar and (special or m_chatmessage[CHATMSG] == chatmsgcomp)): # our message showed up - del self.msgqueue[0] + if self.messageQueue: + chatMsgComp = (self.messageQueue[0].split('#')[5]).replace('', '$').replace('', '%').replace('', '&').replace('', '#') + examine = chatMsgComp == ">" or chatMsgComp == "<" or chatMsgComp == "=" + special = not chatMsgComp or chatMsgComp.isspace() + if examine or (fCharId == self.myChar and (special or mChatMessage[CHATMSG] == chatMsgComp)): # our message showed up + del self.messageQueue[0] self.msgqueue_list.takeItem(0) if self.additivebtn.isChecked(): self.icchatinput.insert(" ") - m_chatmessage[CHARNAME] = m_chatmessage[CHARNAME].decode("utf-8") - m_chatmessage[OTHER_NAME] = m_chatmessage[OTHER_NAME].decode("utf-8") - m_chatmessage[SHOWNAME] = m_chatmessage[SHOWNAME].decode('utf-8') + mChatMessage[CHARNAME] = mChatMessage[CHARNAME].decode("utf-8") + mChatMessage[OTHER_NAME] = mChatMessage[OTHER_NAME].decode("utf-8") + mChatMessage[SHOWNAME] = mChatMessage[SHOWNAME].decode('utf-8') - f_char = m_chatmessage[CHARNAME] - evidence = int(m_chatmessage[EVIDENCE])-1 + fChar = mChatMessage[CHARNAME] + evidence = int(mChatMessage[EVIDENCE])-1 # Some characters use " - " instead of "-" for no preanim. - m_chatmessage[PREANIM] = m_chatmessage[PREANIM].strip() + mChatMessage[PREANIM] = mChatMessage[PREANIM].strip() t = time.localtime() - logcharname = f_char + logcharName = fChar timestamp = "[%d:%.2d] " % (t[3], t[4]) if not self.demoPlaying else "" - if f_char.lower() != self.charlist[f_char_id][0].lower(): - logcharname = self.charlist[f_char_id][0] + ' (' + f_char + ')' + if fChar.lower() != self.charList[fCharId][0].lower(): + logcharName = self.charList[fCharId][0] + ' (' + fChar + ')' - chatmsg = m_chatmessage[CHATMSG] + chatmsg = mChatMessage[CHATMSG] - if m_chatmessage[SHOWNAME] and m_chatmessage[SHOWNAME].lower() != f_char.lower(): + if mChatMessage[SHOWNAME] and mChatMessage[SHOWNAME].lower() != fChar.lower(): try: - logcharname += " (" + m_chatmessage[SHOWNAME]+")" + logcharName += " (" + mChatMessage[SHOWNAME]+")" except: - logcharname += " (???)" + logcharName += " (???)" if evidence == -1: - self.iclog.append(timestamp + '%s: %s' % (logcharname, chatmsg)) + self.iclog.append(timestamp + '%s: %s' % (logcharName, chatmsg)) else: eviname = '(NULL) %d' % evidence try: @@ -2946,51 +2946,51 @@ class GUI(QtGui.QWidget): except: pass - self.iclog.append(timestamp + '%s: %s\n%s presented an evidence: %s' % (logcharname, chatmsg, f_char, eviname.strip())) + self.iclog.append(timestamp + '%s: %s\n%s presented an evidence: %s' % (logcharName, chatmsg, fChar, eviname.strip())) - self.is_additive = (m_chatmessage[ADDITIVE] == "1") + self.isAdditive = (mChatMessage[ADDITIVE] == "1") - custom_objection = "custom" + customObjection = "custom" try: - objection_mod = int(m_chatmessage[SHOUT_MOD]) + objectionMod = int(mChatMessage[SHOUT_MOD]) except: - if "4&" in m_chatmessage[SHOUT_MOD]: # custom objection name - objection_mod = 4 - custom_objection = m_chatmessage[SHOUT_MOD].split("4&")[1] # get the name + if "4&" in mChatMessage[SHOUT_MOD]: # custom objection name + objectionMod = 4 + customObjection = mChatMessage[SHOUT_MOD].split("4&")[1] # get the name else: # just in case of mindfuckery - objection_mod = 0 + objectionMod = 0 - if objection_mod <= 4 and objection_mod >= 1: + if objectionMod <= 4 and objectionMod >= 1: # Skip everything in the queue, show message immediately - self.inboxqueue = [] - self.inboxqueue.append(m_chatmessage) - self.inbox_timer.stop() - self.chat_tick_timer.stop() - self.m_chatmessage = m_chatmessage + self.inboxQueue = [] + self.inboxQueue.append(mChatMessage) + self.inboxTimer.stop() + self.chatTickTimer.stop() + self.mChatMessage = mChatMessage - objections = ["holdit", "objection", "takethat", "custom_objections/"+custom_objection if custom_objection != "custom" else "custom"] + objections = ["holdit", "objection", "takethat", "custom_objections/"+customObjection if customObjection != "custom" else "custom"] self.objectionView.stop() - self.objectionView.play(objections[objection_mod-1], f_char.lower()) - self.presentedevi.hide() - self.playObjectionSnd(f_char.lower(), objection_mod) + self.objectionView.play(objections[objectionMod-1], fChar.lower()) + self.presentedEvidence.hide() + self.playObjectionSound(fChar.lower(), objectionMod) - emote_mod = int(self.m_chatmessage[EMOTE_MOD]) - if emote_mod == 0: - self.m_chatmessage[EMOTE_MOD] = 1 + emoteMod = int(self.mChatMessage[EMOTE_MOD]) + if emoteMod == 0: + self.mChatMessage[EMOTE_MOD] = 1 else: # Old behavior - #self.m_chatmessage = m_chatmessage - #self.handle_chatmessage_2() + #self.mChatMessage = mChatMessage + #self.handleChatMessage2() # Add message to queue and wait, unless queue empty - self.inboxqueue.append(m_chatmessage) - if len(self.inboxqueue) == 1: - self.handle_chatmessage_1(m_chatmessage) + self.inboxQueue.append(mChatMessage) + if len(self.inboxQueue) == 1: + self.handleChatMessage1(mChatMessage) - def set_text_color(self): - textColor = int(self.m_chatmessage[TEXT_COLOR]) + def setTextColor(self): + textColor = int(self.mChatMessage[TEXT_COLOR]) - is_rainbow = textColor == C_RAINBOW + isRainbow = textColor == C_RAINBOW if textColor == 0: color = QtGui.QColor(255, 255, 255) @@ -3015,7 +3015,7 @@ class GUI(QtGui.QWidget): else: color = QtGui.QColor(255, 255, 255) - if is_rainbow: + if isRainbow: self.text.show() self.ao2text.hide() else: @@ -3023,19 +3023,19 @@ class GUI(QtGui.QWidget): self.ao2text.show() style = "background-color: rgba(0, 0, 0, 0);\n" - style += "color: rgb("+str(color.red())+", "+str(color.green())+", "+str(color.blue())+")" + style += "color: rgb(" + str(color.red()) + ", " + str(color.green()) + ", " + str(color.blue()) + ")" self.ao2text.setStyleSheet(style) def setScene(self, init=False): if not init: - side = self.m_chatmessage[SIDE] + side = self.mChatMessage[SIDE] # TODO: support custom positions - if side not in self.default_positions: + if side not in self.defaultPositions: side = 'wit' else: side = 'wit' - self.presentedevi.hide() + self.presentedEvidence.hide() if side == 'def': self.court.setPixmap(self.side_def) @@ -3065,104 +3065,104 @@ class GUI(QtGui.QWidget): self.court.setPixmap(self.side_jud if self.side_jur.isNull() else self.side_jur) self.bench.setPixmap(self.bench_jud if self.bench_jur.isNull() else self.bench_jur) - def set_desk(self, is_preanim=False): - if self.anim_is_empty: + def setBench(self, isPreanim = False): + if self.animIsEmpty: return - deskmod = self.m_chatmessage[DESK_MOD] + deskmod = self.mChatMessage[DESK_MOD] if deskmod == "0" or (deskmod == "chat" and side in ("jud", "hld", "hlp")): self.bench.hide() elif deskmod == "1" or (deskmod == "chat" and side in ("def", "pro", "wit")): self.bench.show() elif deskmod == "2" or deskmod == "4": - if is_preanim: + if isPreanim: self.bench.hide() else: self.bench.show() elif deskmod == "3" or deskmod == "5": - if is_preanim: + if isPreanim: self.bench.show() else: self.bench.hide() else: self.bench.hide() - def objection_done(self): - self.handle_chatmessage_1() + def objectionDone(self): + self.handleChatMessage1() - def handle_chatmessage_1(self, m_chatmessage = None): + def handleChatMessage1(self, mChatMessage = None): if not self.slideEnabled: - if m_chatmessage: - self.m_chatmessage = m_chatmessage - self.handle_chatmessage_2() + if mChatMessage: + self.mChatMessage = mChatMessage + self.handleChatMessage2() return - was_zoom = self.m_chatmessage[EMOTE_MOD] and int(self.m_chatmessage[EMOTE_MOD]) >= 5 + wasZoom = self.mChatMessage[EMOTE_MOD] and int(self.mChatMessage[EMOTE_MOD]) >= 5 - if m_chatmessage: - self.m_chatmessage = m_chatmessage + if mChatMessage: + self.mChatMessage = mChatMessage - new_side = self.m_chatmessage[SIDE] - can_slide = self.slideAvailable and not was_zoom and int(self.m_chatmessage[EMOTE_MOD]) < 5 + new_side = self.mChatMessage[SIDE] + can_slide = self.slideAvailable and not wasZoom and int(self.mChatMessage[EMOTE_MOD]) < 5 - if can_slide and self.m_chatmessage[SLIDE] == "1" and self.slide_last_pos and new_side != self.slide_last_pos and new_side in ["def", "pro", "wit"]: - self.slide_start(self.slideMap[self.slide_last_pos][new_side]) + if can_slide and self.mChatMessage[SLIDE] == "1" and self.slideLastPos and new_side != self.slideLastPos and new_side in ["def", "pro", "wit"]: + self.startSlide(self.slideMap[self.slideLastPos][new_side]) else: - self.handle_chatmessage_2() + self.handleChatMessage2() - def handle_chatmessage_2(self): - self.zoom.set_zoom(False) + def handleChatMessage2(self): + self.zoom.setZoom(False) self.effectView.stop() - self.text_state = 0 - self.anim_state = 0 + self.textState = 0 + self.animState = 0 self.objectionView.stop() - self.chat_tick_timer.stop() - self.presentedevi.hide() + self.chatTickTimer.stop() + self.presentedEvidence.hide() - self.chatmessage_is_empty = self.m_chatmessage[CHATMSG].strip() == "" - self.anim_is_empty = self.m_chatmessage[ANIM].strip() == "" + self.chatMessageIsEmpty = self.mChatMessage[CHATMSG].strip() == "" + self.animIsEmpty = self.mChatMessage[ANIM].strip() == "" - if not self.anim_is_empty: + if not self.animIsEmpty: self.char.stop() - if not self.m_chatmessage[SHOWNAME]: - self.name.setText(self.m_chatmessage[CHARNAME]) + if not self.mChatMessage[SHOWNAME]: + self.name.setText(self.mChatMessage[CHARNAME]) else: - self.name.setText(self.m_chatmessage[SHOWNAME]) + self.name.setText(self.mChatMessage[SHOWNAME]) self.chatbox.hide() self.setScene() - self.set_text_color() + self.setTextColor() - f_message = self.m_chatmessage[CHATMSG] - if len(f_message) >= 2: - self.message_is_centered = f_message.startswith("~~") + fMessage = self.mChatMessage[CHATMSG] + if len(fMessage) >= 2: + self.messageIsCentered = fMessage.startswith("~~") else: self.ao2text.setAlignment(QtCore.Qt.AlignLeft) self.text.setAlignment(QtCore.Qt.AlignLeft) - if self.m_chatmessage[FLIP] == "1": - self.char.set_flipped(True) + if self.mChatMessage[FLIP] == "1": + self.char.setFlipped(True) else: - self.char.set_flipped(False) + self.char.setFlipped(False) - side = self.m_chatmessage[SIDE] - emote_mod = int(self.m_chatmessage[EMOTE_MOD]) - no_preanim = not self.m_chatmessage[PREANIM] or self.m_chatmessage[PREANIM] == "-" + side = self.mChatMessage[SIDE] + emoteMod = int(self.mChatMessage[EMOTE_MOD]) + no_preanim = not self.mChatMessage[PREANIM] or self.mChatMessage[PREANIM] == "-" # AO 2.8: always offset player hor_offset = vert_offset = 0 if "y_offset" in self.features: # AO 2.9 - keyword = "" if "" in self.m_chatmessage[SELF_OFFSET] else "&" # i don't think it's hdf's fault but this is still ridiculous - offset = self.m_chatmessage[SELF_OFFSET].split(keyword) + keyword = "" if "" in self.mChatMessage[SELF_OFFSET] else "&" # i don't think it's hdf's fault but this is still ridiculous + offset = self.mChatMessage[SELF_OFFSET].split(keyword) hor_offset = int(offset[0]) if offset[0] else 0 vert_offset = int(offset[1]) if len(offset) > 1 else 0 else: - hor_offset = int(self.m_chatmessage[SELF_OFFSET]) + hor_offset = int(self.mChatMessage[SELF_OFFSET]) if side == "def": if hor_offset > 0 and vert_offset == 0: @@ -3171,23 +3171,23 @@ class GUI(QtGui.QWidget): if hor_offset < 0 and vert_offset == 0: vert_offset = -1 * hor_offset / 10 - if not self.anim_is_empty: + if not self.animIsEmpty: self.char.move(self.viewport.width() * hor_offset / 100, self.viewport.height() * vert_offset / 100) # check if paired - if not self.m_chatmessage[OTHER_CHARID] and not self.anim_is_empty: + if not self.mChatMessage[OTHER_CHARID] and not self.animIsEmpty: self.sideChar.hide() self.sideChar.move(0,0) else: if "effects" in self.features: - got_other_charid = int(self.m_chatmessage[OTHER_CHARID].split("^")[0]) + got_otherCharId = int(self.mChatMessage[OTHER_CHARID].split("^")[0]) else: - got_other_charid = int(self.m_chatmessage[OTHER_CHARID]) + got_otherCharId = int(self.mChatMessage[OTHER_CHARID]) - if got_other_charid > -1: # user is paired + if got_otherCharId > -1: # user is paired self.sideChar.show() - pair_order = self.m_chatmessage[OTHER_CHARID].split("^") + pair_order = self.mChatMessage[OTHER_CHARID].split("^") if "effects" in self.features and len(pair_order) > 1: pair_order = int(pair_order[1]) else: @@ -3195,11 +3195,11 @@ class GUI(QtGui.QWidget): hor2_offset = vert2_offset = 0 if "y_offset" in self.features: # AO 2.9 - keyword = "" if "" in self.m_chatmessage[OTHER_OFFSET] else "&" # i don't think it's hdf's fault but this is still ridiculous - hor2_offset = int(self.m_chatmessage[OTHER_OFFSET].split(keyword)[0]) - vert2_offset = int(self.m_chatmessage[OTHER_OFFSET].split(keyword)[1]) if len(self.m_chatmessage[OTHER_OFFSET].split(keyword)) > 1 else 0 + keyword = "" if "" in self.mChatMessage[OTHER_OFFSET] else "&" # i don't think it's hdf's fault but this is still ridiculous + hor2_offset = int(self.mChatMessage[OTHER_OFFSET].split(keyword)[0]) + vert2_offset = int(self.mChatMessage[OTHER_OFFSET].split(keyword)[1]) if len(self.mChatMessage[OTHER_OFFSET].split(keyword)) > 1 else 0 else: - hor2_offset = int(self.m_chatmessage[OTHER_OFFSET]) + hor2_offset = int(self.mChatMessage[OTHER_OFFSET]) if side == "def": if hor2_offset > 0: @@ -3229,232 +3229,232 @@ class GUI(QtGui.QWidget): self.chatbox.raise_() self.effectView.raise_() self.objectionView.raise_() - self.whiteflashlab.raise_() + self.whiteFlashLabel.raise_() - self.scaling[1] = get_scaling(ini.read_ini(AOpath + 'characters/' + self.m_chatmessage[OTHER_NAME] + '/char.ini', "options", "scaling").lower()) + self.scaling[1] = getScaling(ini.read_ini(AOpath + 'characters/' + self.mChatMessage[OTHER_NAME] + '/char.ini', "options", "scaling").lower()) - self.sideChar.set_flipped(self.m_chatmessage[OTHER_FLIP] == "1") - if not self.anim_is_empty: - self.sideChar.play_idle(self.m_chatmessage[OTHER_NAME], self.m_chatmessage[OTHER_EMOTE], self.scaling[1]) + self.sideChar.setFlipped(self.mChatMessage[OTHER_FLIP] == "1") + if not self.animIsEmpty: + self.sideChar.playIdle(self.mChatMessage[OTHER_NAME], self.mChatMessage[OTHER_EMOTE], self.scaling[1]) - elif not self.anim_is_empty: + elif not self.animIsEmpty: self.sideChar.hide() self.sideChar.move(0, 0) - self.scaling[0] = get_scaling(ini.read_ini(AOpath + 'characters/' + self.m_chatmessage[CHARNAME] + '/char.ini', "options", "scaling").lower()) + self.scaling[0] = getScaling(ini.read_ini(AOpath + 'characters/' + self.mChatMessage[CHARNAME] + '/char.ini', "options", "scaling").lower()) if self.slideEnabled and self.slideAvailable: if side == "wit": - if int(self.m_chatmessage[EMOTE_MOD]) < 5: # Don't save anim if zoom - self.slide_last_wit = [ - self.m_chatmessage[CHARNAME], - self.m_chatmessage[ANIM], + if int(self.mChatMessage[EMOTE_MOD]) < 5: # Don't save anim if zoom + self.slideLastWit = [ + self.mChatMessage[CHARNAME], + self.mChatMessage[ANIM], self.scaling[0] ] - self.slide_last_pos = "wit" + self.slideLastPos = "wit" elif side == "def" or side == "pro": - self.slide_last_pos = side + self.slideLastPos = side else: - self.slide_last_pos = None + self.slideLastPos = None - 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 - # if sfx_delay > 0: - # self.sfx_delay_timer.start(sfx_delay) + if (emoteMod == 1 or emoteMod == 2 or emoteMod == 6) and self.mChatMessage[PREANIM] != "-": + # sfxDelay = int(self.mChatMessage[SFX_DELAY]) * 60 + # if sfxDelay > 0: + # self.sfxDelayTimer.start(sfxDelay) # else: - # self.play_sfx() - self.set_desk(True) - self.play_preanim(False) - elif emote_mod == 0 or emote_mod == 5 or no_preanim: - if self.m_chatmessage[NO_INTERRUPT] == "0" or no_preanim: - self.handle_chatmessage_3() + # self.playSfx() + self.setBench(True) + self.playPre(False) + elif emoteMod == 0 or emoteMod == 5 or no_preanim: + if self.mChatMessage[NO_INTERRUPT] == "0" or no_preanim: + self.handleChatMessage3() else: - self.play_preanim(True) + self.playPre(True) - def play_preanim(self, noninterrupting): - f_char = self.m_chatmessage[CHARNAME].lower() - f_preanim = self.m_chatmessage[PREANIM].strip() + def playPre(self, nonInterrupting): + fChar = self.mChatMessage[CHARNAME].lower() + fPreanim = self.mChatMessage[PREANIM].strip() - ao2_duration = ini.read_ini_int(AOpath+"characters/"+f_char+"/char.ini", "time", f_preanim, -1) - text_delay = ini.read_ini_int(AOpath+"characters/"+f_char+"/char.ini", "textdelay", f_preanim, -1) - sfx_delay = int(self.m_chatmessage[SFX_DELAY]) * 60 + ao2Duration = ini.read_ini_int(AOpath + "characters/"+fChar+"/char.ini", "time", fPreanim, -1) + textDelay = ini.read_ini_int(AOpath + "characters/"+fChar+"/char.ini", "textdelay", fPreanim, -1) + sfxDelay = int(self.mChatMessage[SFX_DELAY]) * 60 - if sfx_delay > 0: - self.sfx_delay_timer.start(sfx_delay) + if sfxDelay > 0: + self.sfxDelayTimer.start(sfxDelay) else: - self.play_sfx() + self.playSfx() - preanim_duration = ao2_duration + preanimDuration = ao2Duration - anim_to_find = AOpath+"characters/"+f_char+"/"+f_preanim+".gif" - apng_to_find = AOpath+"characters/"+f_char+"/"+f_preanim+".apng" - webp_to_find = AOpath+"characters/"+f_char+"/"+f_preanim+".webp" + animToFind = AOpath + "characters/"+fChar+"/"+fPreanim+".gif" + apngToFind = AOpath + "characters/"+fChar+"/"+fPreanim+".apng" + webpToFind = AOpath + "characters/"+fChar+"/"+fPreanim+".webp" - if (not anim_to_find and not apng_to_find and not webp_to_find) or preanim_duration < 0: - if noninterrupting: - self.anim_state = 4 + if (not animToFind and not apngToFind and not webpToFind) or preanimDuration < 0: + if nonInterrupting: + self.animState = 4 else: - self.anim_state = 1 - self.preanim_done() + self.animState = 1 + self.preanimDone() return - self.char.play_pre(f_char, f_preanim, preanim_duration, self.scaling[0]) - if noninterrupting: - self.anim_state = 4 + self.char.playPre(fChar, fPreanim, preanimDuration, self.scaling[0]) + if nonInterrupting: + self.animState = 4 else: - self.anim_state = 1 + self.animState = 1 - if text_delay >= 0: + if textDelay >= 0: pass #text delay timer, but not now. - if noninterrupting: - self.handle_chatmessage_3() + if nonInterrupting: + self.handleChatMessage3() - def preanim_done(self): - self.anim_state = 1 - self.handle_chatmessage_3() + def preanimDone(self): + self.animState = 1 + self.handleChatMessage3() - def handle_chatmessage_3(self): - self.start_chat_ticking() - self.set_desk(False) + def handleChatMessage3(self): + self.startChatTicking() + self.setBench(False) - f_evi_id = int(self.m_chatmessage[EVIDENCE]) - f_side = self.m_chatmessage[SIDE] + fEvidenceId = int(self.mChatMessage[EVIDENCE]) + fSide = self.mChatMessage[SIDE] - emote_mod = int(self.m_chatmessage[EMOTE_MOD]) + emoteMod = int(self.mChatMessage[EMOTE_MOD]) - if f_evi_id > 0 and f_evi_id <= len(self.evidence): - f_image = self.evidence[f_evi_id-1][2] - is_left_side = not (f_side == "def" or f_side == "hlp" or f_side == "jud" or f_side == "jur") + if fEvidenceId > 0 and fEvidenceId <= len(self.evidence): + fImage = self.evidence[fEvidenceId-1][2] + isLeftSide = not (fSide == "def" or fSide == "hlp" or fSide == "jud" or fSide == "jur") - self.setEvidenceImg(self.presentedevi, f_image, True) + self.setEvidenceImage(self.presentedEvidence, fImage, True) self.playSound("sfx-evidenceshoop.opus") - if not is_left_side: - self.presentedevi.move(self.viewport.x() + 170 * self.viewportScale, self.viewport.y() + 16 * self.viewportScale) + if not isLeftSide: + self.presentedEvidence.move(self.viewport.x() + 170 * self.viewportScale, self.viewport.y() + 16 * self.viewportScale) else: - self.presentedevi.move(self.viewport.x() + 16 * self.viewportScale, self.viewport.y() + 16 * self.viewportScale) - self.presentedevi.show() + self.presentedEvidence.move(self.viewport.x() + 16 * self.viewportScale, self.viewport.y() + 16 * self.viewportScale) + self.presentedEvidence.show() else: - self.presentedevi.hide() + self.presentedEvidence.hide() - side = self.m_chatmessage[SIDE] - if emote_mod == 5 or emote_mod == 6: + side = self.mChatMessage[SIDE] + if emoteMod == 5 or emoteMod == 6: self.bench.hide() self.sideChar.hide() self.char.move(0,0) if side == "pro" or side == "hlp" or side == "wit": - self.zoom.set_zoom(True, 1) + self.zoom.setZoom(True, 1) else: - self.zoom.set_zoom(True, 0) + self.zoom.setZoom(True, 0) - f_anim_state = 0 - text_is_blue = int(self.m_chatmessage[TEXT_COLOR]) == 4 + f_animState = 0 + text_is_blue = int(self.mChatMessage[TEXT_COLOR]) == 4 - if not text_is_blue and self.text_state == 1: - f_anim_state = 2 - self.entire_message_is_blue = False + if not text_is_blue and self.textState == 1: + f_animState = 2 + self.entireMessageIsBlue = False else: - f_anim_state = 3 - self.entire_message_is_blue = True + f_animState = 3 + self.entireMessageIsBlue = True - if f_anim_state <= self.anim_state: + if f_animState <= self.animState: return - f_char = self.m_chatmessage[CHARNAME] - f_emote = self.m_chatmessage[ANIM] + fChar = self.mChatMessage[CHARNAME] + f_emote = self.mChatMessage[ANIM] - if not self.anim_is_empty: + if not self.animIsEmpty: self.char.stop() - if f_anim_state == 2: - self.char.play_talking(f_char, f_emote, self.scaling[0]) - self.anim_state = 2 + if f_animState == 2: + self.char.playTalking(fChar, f_emote, self.scaling[0]) + self.animState = 2 else: - self.char.play_idle(f_char, f_emote, self.scaling[0]) - self.anim_state = 3 + self.char.playIdle(fChar, f_emote, self.scaling[0]) + self.animState = 3 - if exists(AO2XPpath+"callwords.ini"): - with open(AO2XPpath+"callwords.ini") as f: + if exists(AO2XPpath + "callwords.ini"): + with open(AO2XPpath + "callwords.ini") as f: callwords = [line.rstrip() for line in f] for callword in callwords: - if callword.decode('utf-8').lower() in self.m_chatmessage[CHATMSG].lower().split(" "): - self.ooclog.append("%s called you." % f_char) + if callword.decode('utf-8').lower() in self.mChatMessage[CHATMSG].lower().split(" "): + self.ooclog.append("%s called you." % fChar) QtGui.QApplication.alert(self, 1000) snd = audio.loadhandle(False, "word_call.wav", 0, 0, BASS_STREAM_AUTOFREE) if snd: audio.playhandle(snd, True) break - def do_effect(self, fx_name, fx_sound, p_char, p_folder): - effect = ini.get_effect(fx_name, p_char, p_folder) + def playEffect(self, fxName, fxSound, pChar, pFolder): + effect = ini.get_effect(fxName, pChar, pFolder) if not effect: return - if fx_sound: - self.playSound(fx_sound) + if fxSound: + self.playSound(fxSound) if "effects" not in self.features: return self.effectView.set_play_once(True) self.effectView.play(effect) - def start_chat_ticking(self): - if self.text_state != 0: + def startChatTicking(self): + if self.textState != 0: return - if self.m_chatmessage[EFFECTS]: - fx_list = self.m_chatmessage[EFFECTS].split("|") - fx = fx_list[0] - fx_sound = "" - fx_folder = "" + if self.mChatMessage[EFFECTS]: + fxList = self.mChatMessage[EFFECTS].split("|") + fx = fxList[0] + fxSound = "" + fxFolder = "" - if len(fx_list) > 1: - fx_sound = fx_list[1] - if len(fx_list) > 2: - fx_folder = fx_list[1] - fx_sound = fx_list[2] + if len(fxList) > 1: + fxSound = fxList[1] + if len(fxList) > 2: + fxFolder = fxList[1] + fxSound = fxList[2] if fx and fx not in ("-", "None"): - self.do_effect(fx, fx_sound, self.m_chatmessage[CHARNAME], fx_folder) + self.playEffect(fx, fxSound, self.mChatMessage[CHARNAME], fxFolder) - elif self.m_chatmessage[REALIZATION] == "1": + elif self.mChatMessage[REALIZATION] == "1": self.setWhiteFlash(True, 1, 125) - self.set_text_color() + self.setTextColor() - charid = int(self.m_chatmessage[CHAR_ID]) - if not self.is_additive or self.additive_char != charid: + charid = int(self.mChatMessage[CHAR_ID]) + if not self.isAdditive or self.additiveChar != charid: self.ao2text.clear() self.text.setText("") - self.additive_char = charid + self.additiveChar = charid - if self.chatmessage_is_empty: - self.text_state = 2 - self.inbox_timer.start(self.textWaitTime) + if self.chatMessageIsEmpty: + self.textState = 2 + self.inboxTimer.start(self.textWaitTime) return - self.inline_color_stack = [] + self.inlineColorStack = [] self.chatbox.show() - self.tick_pos = 0 - self.blip_pos = 0 - self.inline_blue_depth = 0 + self.tickPos = 0 + self.blipPos = 0 + self.inlineBlueDepth = 0 - self.current_display_speed = 3 - self.chat_tick_timer.start(self.message_display_speed[self.current_display_speed]) + self.currentDisplaySpeed = 3 + self.chatTickTimer.start(self.messageDisplaySpeed[self.currentDisplaySpeed]) - self.blip = self.m_chatmessage[BLIPS].lower() + self.blip = self.mChatMessage[BLIPS].lower() if not self.blip: - self.blip = self.charlist[charid][2].lower() + self.blip = self.charList[charid][2].lower() path = testPath( - AOpath+"sounds/blips/"+self.blip+".wav", - AOpath+"sounds/blips/"+self.blip+".opus", - AOpath+"sounds/general/sfx-blip"+self.blip+".wav", - AOpath+"sounds/general/sfx-blip"+self.blip+".opus" + AOpath + "sounds/blips/"+self.blip+".wav", + AOpath + "sounds/blips/"+self.blip+".opus", + AOpath + "sounds/general/sfx-blip"+self.blip+".wav", + AOpath + "sounds/general/sfx-blip"+self.blip+".opus" ) if path: @@ -3463,250 +3463,250 @@ class GUI(QtGui.QWidget): if self.blipsnd: audio.sethandleattr(self.blipsnd, BASS_ATTRIB_VOL, self.blipslider.value() / 100.0) - emote_mod = int(self.m_chatmessage[EMOTE_MOD]) - if emote_mod in (0, 5) and self.m_chatmessage[SCREENSHAKE] == "1": + emoteMod = int(self.mChatMessage[EMOTE_MOD]) + if emoteMod in (0, 5) and self.mChatMessage[SCREENSHAKE] == "1": self.setScreenShake(True) - self.text_state = 1 + self.textState = 1 - def chat_tick(self): - f_message = self.m_chatmessage[CHATMSG] + def chatTick(self): + fMessage = self.mChatMessage[CHATMSG] - self.chat_tick_timer.stop() - formatting_char = False + self.chatTickTimer.stop() + formattingChar = False - if self.message_is_centered: - f_message = f_message.strip("~~") + if self.messageIsCentered: + fMessage = fMessage.strip("~~") - if self.tick_pos >= len(f_message): - self.text_state = 2 - if self.anim_state != 4: - self.anim_state = 3 - if not self.anim_is_empty: - self.char.play_idle(self.m_chatmessage[CHARNAME], self.m_chatmessage[ANIM], self.scaling[0]) - self.inbox_timer.start(self.textWaitTime) + if self.tickPos >= len(fMessage): + self.textState = 2 + if self.animState != 4: + self.animState = 3 + if not self.animIsEmpty: + self.char.playIdle(self.mChatMessage[CHARNAME], self.mChatMessage[ANIM], self.scaling[0]) + self.inboxTimer.start(self.textWaitTime) else: - f_character2 = f_message[self.tick_pos] - f_character = QtCore.QString(f_character2) + fCharacter2 = fMessage[self.tickPos] + fCharacter = QtCore.QString(fCharacter2) - if f_character == " ": + if fCharacter == " ": self.text.insertPlainText(" ") self.ao2text.insertPlainText(" ") - elif f_character == "\n" or f_character == "\r": + elif fCharacter == "\n" or fCharacter == "\r": self.text.insertPlainText("\n") self.ao2text.insertPlainText("\n") - elif f_character == "\\" and not self.next_character_is_not_special: - self.next_character_is_not_special = True - formatting_char = True + elif fCharacter == "\\" and not self.nextCharacterIsNotSpecial: + self.nextCharacterIsNotSpecial = True + formattingChar = True - elif f_character == "{" and not self.next_character_is_not_special: - self.current_display_speed += 1 - formatting_char = True + elif fCharacter == "{" and not self.nextCharacterIsNotSpecial: + self.currentDisplaySpeed += 1 + formattingChar = True - elif f_character == "}" and not self.next_character_is_not_special: - self.current_display_speed -= 1 - formatting_char = True + elif fCharacter == "}" and not self.nextCharacterIsNotSpecial: + self.currentDisplaySpeed -= 1 + formattingChar = True - elif f_character == "|" and not self.next_character_is_not_special: #orange. - if self.inline_color_stack: - if self.inline_color_stack[-1] == INLINE_ORANGE: - del self.inline_color_stack[-1] + elif fCharacter == "|" and not self.nextCharacterIsNotSpecial: #orange. + if self.inlineColorStack: + if self.inlineColorStack[-1] == INLINE_ORANGE: + del self.inlineColorStack[-1] else: - self.inline_color_stack.append(INLINE_ORANGE) + self.inlineColorStack.append(INLINE_ORANGE) else: - self.inline_color_stack.append(INLINE_ORANGE) - formatting_char = True + self.inlineColorStack.append(INLINE_ORANGE) + formattingChar = True - elif f_character == "(" and not self.next_character_is_not_special: #blue. - self.inline_color_stack.append(INLINE_BLUE) - html = "" + f_character + "" + elif fCharacter == "(" and not self.nextCharacterIsNotSpecial: #blue. + self.inlineColorStack.append(INLINE_BLUE) + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) - self.inline_blue_depth += 1 - if not self.entire_message_is_blue and self.anim_state != 4: - f_char = self.m_chatmessage[CHARNAME] - f_emote = self.m_chatmessage[ANIM] - if not self.anim_is_empty: - self.char.play_idle(f_char, f_emote, self.scaling[0]) + self.inlineBlueDepth += 1 + if not self.entireMessageIsBlue and self.animState != 4: + fChar = self.mChatMessage[CHARNAME] + f_emote = self.mChatMessage[ANIM] + if not self.animIsEmpty: + self.char.playIdle(fChar, f_emote, self.scaling[0]) - elif f_character == ")" and not self.next_character_is_not_special and self.inline_color_stack: - if self.inline_color_stack[-1] == INLINE_BLUE: - del self.inline_color_stack[-1] - html = "" + f_character + "" + elif fCharacter == ")" and not self.nextCharacterIsNotSpecial and self.inlineColorStack: + if self.inlineColorStack[-1] == INLINE_BLUE: + del self.inlineColorStack[-1] + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) - if self.inline_blue_depth > 0: - self.inline_blue_depth -= 1 + if self.inlineBlueDepth > 0: + self.inlineBlueDepth -= 1 - if not self.entire_message_is_blue: - if self.inline_blue_depth == 0 and self.anim_state != 4 and not (self.tick_pos+1 >= len(f_message)): - f_char = self.m_chatmessage[CHARNAME] - f_emote = self.m_chatmessage[ANIM] - self.char.play_talking(f_char, f_emote, self.scaling[0]) + if not self.entireMessageIsBlue: + if self.inlineBlueDepth == 0 and self.animState != 4 and not (self.tickPos+1 >= len(fMessage)): + fChar = self.mChatMessage[CHARNAME] + f_emote = self.mChatMessage[ANIM] + self.char.playTalking(fChar, f_emote, self.scaling[0]) else: - self.next_character_is_not_special = True - self.tick_pos -= 1 + self.nextCharacterIsNotSpecial = True + self.tickPos -= 1 - elif f_character == "[" and not self.next_character_is_not_special: #gray. - self.inline_color_stack.append(INLINE_GRAY) - html = "" + f_character + "" + elif fCharacter == "[" and not self.nextCharacterIsNotSpecial: #gray. + self.inlineColorStack.append(INLINE_GRAY) + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) - elif f_character == "]" and not self.next_character_is_not_special and self.inline_color_stack: - if self.inline_color_stack[-1] == INLINE_GRAY: - del self.inline_color_stack[-1] - html = "" + f_character + "" + elif fCharacter == "]" and not self.nextCharacterIsNotSpecial and self.inlineColorStack: + if self.inlineColorStack[-1] == INLINE_GRAY: + del self.inlineColorStack[-1] + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) else: - self.next_character_is_not_special = True - self.tick_pos -= 1 + self.nextCharacterIsNotSpecial = True + self.tickPos -= 1 - elif f_character == "`" and not self.next_character_is_not_special: #green. - if self.inline_color_stack: - if self.inline_color_stack[-1] == INLINE_GREEN: - del self.inline_color_stack[-1] + elif fCharacter == "`" and not self.nextCharacterIsNotSpecial: #green. + if self.inlineColorStack: + if self.inlineColorStack[-1] == INLINE_GREEN: + del self.inlineColorStack[-1] else: - self.inline_color_stack.append(INLINE_GREEN) + self.inlineColorStack.append(INLINE_GREEN) else: - self.inline_color_stack.append(INLINE_GREEN) - formatting_char = True + self.inlineColorStack.append(INLINE_GREEN) + formattingChar = True - elif f_character == "~" and not self.next_character_is_not_special: #green. - if self.inline_color_stack: - if self.inline_color_stack[-1] == INLINE_RED: - del self.inline_color_stack[-1] + elif fCharacter == "~" and not self.nextCharacterIsNotSpecial: #green. + if self.inlineColorStack: + if self.inlineColorStack[-1] == INLINE_RED: + del self.inlineColorStack[-1] else: - self.inline_color_stack.append(INLINE_RED) + self.inlineColorStack.append(INLINE_RED) else: - self.inline_color_stack.append(INLINE_RED) - formatting_char = True + self.inlineColorStack.append(INLINE_RED) + formattingChar = True - elif f_character == "s" and self.next_character_is_not_special: # shake + elif fCharacter == "s" and self.nextCharacterIsNotSpecial: # shake self.setScreenShake(True) - self.next_character_is_not_special = False + self.nextCharacterIsNotSpecial = False - elif f_character == "f" and self.next_character_is_not_special: # flash + elif fCharacter == "f" and self.nextCharacterIsNotSpecial: # flash self.setWhiteFlash(True, 0, 75) - self.next_character_is_not_special = False + self.nextCharacterIsNotSpecial = False - elif f_character == "n" and self.next_character_is_not_special: # newline + elif fCharacter == "n" and self.nextCharacterIsNotSpecial: # newline self.text.insertPlainText("\n") self.ao2text.insertPlainText("\n") - self.next_character_is_not_special = False + self.nextCharacterIsNotSpecial = False else: - self.next_character_is_not_special = False - if self.inline_color_stack: - top_color = self.inline_color_stack[-1] + self.nextCharacterIsNotSpecial = False + if self.inlineColorStack: + top_color = self.inlineColorStack[-1] if top_color == INLINE_ORANGE: - html = "" + f_character + "" + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) elif top_color == INLINE_BLUE: - html = "" + f_character + "" + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) elif top_color == INLINE_GREEN: - html = "" + f_character + "" + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) elif top_color == INLINE_GRAY: - html = "" + f_character + "" + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) elif top_color == INLINE_RED: - html = "" + f_character + "" + html = "" + fCharacter + "" self.ao2text.insertHtml(html) self.text.insertHtml(html) else: - self.text.insertHtml(f_character) - self.ao2text.insertHtml(f_character) + self.text.insertHtml(fCharacter) + self.ao2text.insertHtml(fCharacter) else: - if int(self.m_chatmessage[TEXT_COLOR]) == C_RAINBOW: - self.text.insertHtml(f_character) + if int(self.mChatMessage[TEXT_COLOR]) == C_RAINBOW: + self.text.insertHtml(fCharacter) else: - self.ao2text.insertHtml(f_character) + self.ao2text.insertHtml(fCharacter) - if self.message_is_centered: + if self.messageIsCentered: self.ao2text.setAlignment(QtCore.Qt.AlignCenter) self.text.setAlignment(QtCore.Qt.AlignCenter) else: self.ao2text.setAlignment(QtCore.Qt.AlignLeft) self.text.setAlignment(QtCore.Qt.AlignLeft) - if f_message[self.tick_pos] != " " or self.blank_blip: - if self.blip_pos % self.blip_rate == 0 and not formatting_char: - self.blip_pos = 0 + if fMessage[self.tickPos] != " " or self.blankBlip: + if self.blipPos % self.blipRate == 0 and not formattingChar: + self.blipPos = 0 if self.blipsnd: audio.playhandle(self.blipsnd, True) - self.blip_pos += 1 + self.blipPos += 1 - self.tick_pos += 1 + self.tickPos += 1 - if self.current_display_speed < 0: - self.current_display_speed = 0 - elif self.current_display_speed > 6: - self.current_display_speed = 6 + if self.currentDisplaySpeed < 0: + self.currentDisplaySpeed = 0 + elif self.currentDisplaySpeed > 6: + self.currentDisplaySpeed = 6 - if formatting_char: - self.chat_tick_timer.start(1) + if formattingChar: + self.chatTickTimer.start(1) else: - self.chat_tick_timer.start(self.message_display_speed[self.current_display_speed]) + self.chatTickTimer.start(self.messageDisplaySpeed[self.currentDisplaySpeed]) - def inbox_timer_timeout(self): - if len(self.inboxqueue) > 0: - del self.inboxqueue[0] - if len(self.inboxqueue) > 0: - self.handle_chatmessage_1(self.inboxqueue[0]) + def inboxTimerTimeout(self): + if len(self.inboxQueue) > 0: + del self.inboxQueue[0] + if len(self.inboxQueue) > 0: + self.handleChatMessage1(self.inboxQueue[0]) def playRealization(self): audio.playhandle(self.realizationsnd, True) - def playObjectionSnd(self, charname, objection): + def playObjectionSound(self, charName, objection): try: - charname = str(charname) + charName = str(charName) except: - print "WARNING: Can't play objection sound if charname is unicode yet" + print "WARNING: Can't play objection sound if charName is unicode yet" - if self.objectsnd: - if audio.handleisactive(self.objectsnd): - audio.stophandle(self.objectsnd) - audio.freehandle(self.objectsnd) + if self.objectSound: + if audio.handleisactive(self.objectSound): + audio.stophandle(self.objectSound) + audio.freehandle(self.objectSound) objecting = ["holdit", "objection", "takethat", "custom"][objection-1] if objecting: - if exists(AOpath + 'characters/' + charname + '/' + objecting + '.wav'): - self.objectsnd = audio.loadhandle(False, AOpath + 'characters/' + charname + '/' + objecting + '.wav', 0, 0, 0) - elif exists(AOpath + 'characters/' + charname + '/' + objecting + '.opus'): - self.objectsnd = audio.loadhandle(False, AOpath + 'characters/' + charname + '/' + objecting + '.opus', 0, 0, 0) + if exists(AOpath + 'characters/' + charName + '/' + objecting + '.wav'): + self.objectSound = audio.loadhandle(False, AOpath + 'characters/' + charName + '/' + objecting + '.wav', 0, 0, 0) + elif exists(AOpath + 'characters/' + charName + '/' + objecting + '.opus'): + self.objectSound = audio.loadhandle(False, AOpath + 'characters/' + charName + '/' + objecting + '.opus', 0, 0, 0) else: - self.objectsnd = None + self.objectSound = None if ini.read_ini_bool("AO2XP.ini", "General", "download sounds", True): - thread.start_new_thread(download_thread, ("base/characters/"+charname+"/"+objecting+".wav", AOpath+"characters/"+charname+"/"+objecting.lower()+".wav")) - thread.start_new_thread(download_thread, ("base/characters/"+charname+"/"+objecting+".opus", AOpath+"characters/"+charname+"/"+objecting.lower()+".wav")) + thread.start_new_thread(downloadThread, ("base/characters/"+charName+"/"+objecting+".wav", AOpath + "characters/"+charName+"/"+objecting.lower() + ".wav")) + thread.start_new_thread(downloadThread, ("base/characters/"+charName+"/"+objecting+".opus", AOpath + "characters/"+charName+"/"+objecting.lower() + ".wav")) if exists(AOpath + 'sounds/general/sfx-objection.opus'): - self.objectsnd = audio.loadhandle(False, AOpath + 'sounds/general/sfx-objection.opus', 0, 0, 0) + self.objectSound = audio.loadhandle(False, AOpath + 'sounds/general/sfx-objection.opus', 0, 0, 0) else: - self.objectsnd = audio.loadhandle(False, AOpath + 'sounds/general/sfx-objection.wav', 0, 0, 0) - audio.sethandleattr(self.objectsnd, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0) - audio.playhandle(self.objectsnd, True) + self.objectSound = audio.loadhandle(False, AOpath + 'sounds/general/sfx-objection.wav', 0, 0, 0) + audio.sethandleattr(self.objectSound, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0) + audio.playhandle(self.objectSound, True) - def play_sfx(self): - sfx_name = self.m_chatmessage[SFX] - if sfx_name == "1" or sfx_name == "0": + def playSfx(self): + sfxName = self.mChatMessage[SFX] + if sfxName == "1" or sfxName == "0": return - self.playSound(sfx_name) + self.playSound(sfxName) def playSound(self, sfx): if self.sound: @@ -3727,7 +3727,7 @@ class GUI(QtGui.QWidget): self.stopMusic() return - if not mus.endswith(".mp3") and "===MUSIC START===.mp3" in self.musiclist: #vidya workaround + if not mus.endswith(".mp3") and "===MUSIC START===.mp3" in self.musicList: #vidya workaround mus += ".mp3" musl = mus.lower() #musp = urllib.unquote(urlparse(musl).path)[1:] @@ -3764,39 +3764,39 @@ class GUI(QtGui.QWidget): # Here comes the evil HTTPS hack for XP systems, but it also allows us to download and play modules and midis, because, why not? musext = os.path.splitext(basename(musl))[-1] if musext in ['.mid', '.midi']: - self.specialstream = 1 + self.specialStream = 1 elif musext in ['.xm', '.mod', '.mo3', '.it', '.s3m', '.mtm', '.umx']: - self.specialstream = 2 - if (musl.startswith("https") and error == 2) or self.specialstream: + self.specialStream = 2 + if (musl.startswith("https") and error == 2) or self.specialStream: print "[audio] Downloading music with urllib2" - self.download_thread = MusicDownloadThread(self, mus) - self.download_thread.finished_signal.connect(self.playDownloadedMusic) - self.download_thread.start() + self.downloadThread = MusicDownloadThread(self, mus) + self.downloadThread.finished_signal.connect(self.playDownloadedMusic) + self.downloadThread.start() def stopMusic(self): if self.music: if audio.handleisactive(self.music): audio.stophandle(self.music) - if self.specialstream: - if self.specialstream == 2: + if self.specialStream: + if self.specialStream == 2: audio.freeMOD(self.music) - self.specialstream = 0 + self.specialStream = 0 else: audio.freehandle(self.music) if self.stream: self.stream = None - if self.download_thread: - self.download_thread.stop() - #self.download_thread.wait() - self.download_thread = None + if self.downloadThread: + self.downloadThread.stop() + #self.downloadThread.wait() + self.downloadThread = None def playDownloadedMusic(self, file_length): # Part of the evil HTTPS music download hack for XP systems print "[audio] Done downloading; playing stream" - if self.specialstream == 1: + if self.specialStream == 1: self.music = audio.loadMIDI(True, self.stream, 0, file_length, BASS_SAMPLE_LOOP) - elif self.specialstream == 2: + elif self.specialStream == 2: self.music = audio.loadMOD(True, self.stream, 0, file_length, BASS_SAMPLE_LOOP) else: self.music = audio.loadhandle(True, self.stream, 0, file_length, BASS_SAMPLE_LOOP) @@ -3805,8 +3805,8 @@ class GUI(QtGui.QWidget): if self.musicslider.value() == 0: audio.pausehandle(self.music) - def allMusic(self): - for song, fname in self.musiclist.items(): + def loadAllMusic(self): + for song, fname in self.musicList.items(): songitem = QtGui.QListWidgetItem() songitem.setText(song) if exists(unicode(AOpath + 'sounds/music/' + fname.replace("","&").lower())): @@ -3815,7 +3815,7 @@ class GUI(QtGui.QWidget): #songitem.setBackgroundColor(QtGui.QColor(255, 128, 128)) self.musicitems.addItem(songitem) - def allEvidence(self, evi): + def loadAllEvidence(self, evi): self.evidence = evi if self.evidencedropdown.count() > 0: @@ -3823,73 +3823,73 @@ class GUI(QtGui.QWidget): for evi in self.evidence: while len(evi) < 3: # new AO 2.9 bug where they never correctly escaped evidence name/desc/image on FantaProtocol evi += [""] - evi[0] = decode_ao_str(evi[0].decode('utf-8')) - evi[1] = decode_ao_str(evi[1].decode('utf-8')) - evi[2] = decode_ao_str(evi[2].decode('utf-8')) + evi[0] = decodeAOString(evi[0].decode('utf-8')) + evi[1] = decodeAOString(evi[1].decode('utf-8')) + evi[2] = decodeAOString(evi[2].decode('utf-8')) self.evidencedropdown.addItem(evi[0].strip()) if not self.evidence: self.evidencedropdown.setCurrentIndex(0) self.evidencedesc.setText('.') else: - self.evidencedropdown.setCurrentIndex(self.selectedevi) + self.evidencedropdown.setCurrentIndex(self.selectedEvidence) def updatePlayerList(self, pid, op, utype, data=""): - if not self.playerlist: + if not self.playerList: return pid = str(pid) if op == 0: # Add or remove player if utype == 0: # Add a player self.player_list.addItem("[%s]" % pid) - if not pid in self.playerlist: - self.playerlist[pid] = ["", "", "", ""] + if not pid in self.playerList: + self.playerList[pid] = ["", "", "", ""] if utype == 1: # Remove a player item = self.player_list.findItems("[%s]" % pid, QtCore.Qt.MatchStartsWith) if item: self.player_list.takeItem(self.player_list.row(item[0])) - if pid in self.playerlist: - del self.playerlist[pid] + if pid in self.playerList: + del self.playerList[pid] else: # Update a player - if pid in self.playerlist: - self.playerlist[pid][utype] = data + if pid in self.playerList: + self.playerList[pid][utype] = data item = self.player_list.findItems("[%s]" % pid, QtCore.Qt.MatchStartsWith) if item: - name = self.playerlist[pid][0] - char = self.playerlist[pid][1] - charname = self.playerlist[pid][2] + name = self.playerList[pid][0] + char = self.playerList[pid][1] + charName = self.playerList[pid][2] text = "[%s]" % pid if char: text += " %s" % char - if charname: - text += " (%s)" % charname + if charName: + text += " (%s)" % charName if name: text += " %s" % name item[0].setText(text) - def start_pause_timers(self, command, timer_id, timer_ms): + def startPauseOnscreenTimers(self, command, timer_id, timer_ms): if timer_id > 4: return if command == 0: - if not self.onscreen_timer.isActive(): - self.onscreen_timer.start(self.timer_tick) - self.onscreen_timer_times[timer_id] = timer_ms - self.onscreen_timer_paused[timer_id] = False - self.update_timers() + if not self.onscreenTimer.isActive(): + self.onscreenTimer.start(self.onscreenTimerTick) + self.onscreenTimerTimes[timer_id] = timer_ms + self.onscreenTimerPaused[timer_id] = False + self.updateOnscreenTimers() print "[client] Timer %d was started for %d ms" % (timer_id, timer_ms) elif command == 1: - self.onscreen_timer_paused[timer_id] = True + self.onscreenTimerPaused[timer_id] = True elif command == 2: self.onscreenTimerLabels[timer_id].show() elif command == 3: self.onscreenTimerLabels[timer_id].hide() - def update_timers(self): + def updateOnscreenTimers(self): for timer_id, label in enumerate(self.onscreenTimerLabels): - time_ms = self.onscreen_timer_times[timer_id] - if not time_ms or self.onscreen_timer_paused[timer_id]: + time_ms = self.onscreenTimerTimes[timer_id] + if not time_ms or self.onscreenTimerPaused[timer_id]: continue secs = time_ms / 1000 @@ -3897,17 +3897,17 @@ class GUI(QtGui.QWidget): hours = mins / 60 label.setText("%02d:%02d:%02d" % (hours, mins % 60, secs % 60)) - self.onscreen_timer_times[timer_id] -= self.timer_tick - if self.onscreen_timer_times[timer_id] <= 0: + self.onscreenTimerTimes[timer_id] -= self.onscreenTimerTick + if self.onscreenTimerTimes[timer_id] <= 0: label.hide() - self.onscreen_timer_times[timer_id] = 0 - self.onscreen_timer_paused[timer_id] = True + self.onscreenTimerTimes[timer_id] = 0 + self.onscreenTimerPaused[timer_id] = True - if self.onscreen_timer_times == [0, 0, 0, 0, 0]: - self.onscreen_timer.stop() + if self.onscreenTimerTimes == [0, 0, 0, 0, 0]: + self.onscreenTimer.stop() - def on_demo_click(self, item): - fname = demo.get_demo_fname(self.demoitems, item) + def onDemoClicked(self, item): + fname = demo.getDemoFilename(self.demoItems, item) if not fname: return @@ -3919,58 +3919,58 @@ class GUI(QtGui.QWidget): if not self.demoPlaying: self.enableWidgets(True) - self.tcpthread.stop() + self.tcpThread.stop() self.demoPlaying = True self.demoPlayer = demo.DemoPlayer(self) - self.demoPlayer.MS_Chat.connect(self.netmsg_ms) + self.demoPlayer.MS_Chat.connect(self.netmsgMS) self.demoPlayer.newChar.connect(self.onPVPacket) self.demoPlayer.newBackground.connect(self.setBackground) self.demoPlayer.OOC_Log.connect(self.ooclog.append) self.demoPlayer.IC_Log.connect(self.iclog.append) - self.demoPlayer.charSlots.connect(partial(self.charselect.setCharList, self.charlist)) - self.demoPlayer.allEvidence.connect(self.allEvidence) + self.demoPlayer.charSlots.connect(partial(self.charSelect.setCharList, self.charList)) + self.demoPlayer.loadAllEvidence.connect(self.loadAllEvidence) self.demoPlayer.updatePlayerList.connect(self.updatePlayerList) self.demoPlayer.rainbowColor.connect(self.text.setStyleSheet) - self.demoPlayer.timerUpdate.connect(self.start_pause_timers) + self.demoPlayer.timerUpdate.connect(self.startPauseOnscreenTimers) self.demoPlayer.start(fname) - def demo_seek(self, time): + def demoSeek(self, time): self.demoPlayer.seek(time) - def start_game(self, tcp, playerlist, charlist, musiclist, background, evidence, areas, features=[], oocjoin=[], hplist=[], webAO_bucket=""): + def startGame(self, tcp, playerList, charList, musicList, background, evidence, areas, features=[], joinOOC=[], hpList=[], webAO_bucket=""): self.willDisconnect = False - self.mychar = -1 - self.mychatcolor = 0 + self.myChar = -1 + self.myChatColor = 0 self.tcp = tcp - self.playerlist = playerlist - self.charlist = charlist + self.playerList = playerList + self.charList = charList self.evidence = evidence self.areas = areas - self.areas_len = len(areas[0]) + self.areasLen = len(areas[0]) self.features = features - self.musiclist = OrderedDict([]) + self.musicList = OrderedDict([]) # We want only song names without paths or extensions in the music list - for song in musiclist: - self.musiclist[QtCore.QString(os.path.splitext(basename(song))[0].decode('utf-8').replace("","&"))] = song.decode('utf-8') + for song in musicList: + self.musicList[QtCore.QString(os.path.splitext(basename(song))[0].decode('utf-8').replace("","&"))] = song.decode('utf-8') if "base/" in webAO_bucket: webAO_bucket = webAO_bucket.replace("base/", "") buckets[0] = webAO_bucket - self.charselect.setCharList(charlist) + self.charSelect.setCharList(charList) autopick = getOption("General", "auto pick").decode('utf-8').lower() coincidence = -1 - for i, char in enumerate(self.charlist): + for i, char in enumerate(self.charList): if char[0].lower() == autopick and char[1] == 0: coincidence = i break if coincidence > -1: - self.charselect.selectChar(coincidence) + self.charSelect.selectChar(coincidence) else: - self.charselect.showCharSelect(False) + self.charSelect.showCharSelect(False) # Putting it down here because some servers won't allow you to switch areas without picking a character first autojoinarea = getOption("General", "auto join area").decode('utf-8') @@ -3986,7 +3986,7 @@ class GUI(QtGui.QWidget): self.nointerruptbtn.show() self.paircheckbox.setDisabled(False) self.paircheckbox.setText("Enable pairing") - for char in charlist: + for char in charList: self.pairdropdown.addItem(char[0]) else: self.shownameedit.hide() @@ -4004,12 +4004,12 @@ class GUI(QtGui.QWidget): self.colordropdown.addItems(['White', 'Green', 'Red', 'Orange', 'Blue']) if "yellowtext" in features: self.colordropdown.addItems(['Yellow', 'Pink', 'Cyan', 'Gray', 'Rainbow', 'Black']) - self.colordropdown.setCurrentIndex(self.mychatcolor) + self.colordropdown.setCurrentIndex(self.myChatColor) - for hp in hplist: + for hp in hpList: self.healthbars.emit(hp[0], hp[1]) - for char in self.charlist: + for char in self.charList: if not exists(AOpath + 'characters/' + char[0].lower() + '/char.ini'): continue char[2] = getCharIni(char[0], "Options", "gender").lower() @@ -4020,7 +4020,7 @@ class GUI(QtGui.QWidget): self.customobject.setPressed(False) self.mutedlist.clear() self.unmutedlist.clear() - for char in self.charlist: + for char in self.charList: self.unmutedlist.addItem(char[0]) self.musicitems.clear() @@ -4043,22 +4043,22 @@ class GUI(QtGui.QWidget): self.setScene(True) self.chatbox.hide() - for msg in oocjoin: + for msg in joinOOC: self.ooclog.append(msg) - if self.areas_len: - for i in range(self.areas_len): + if self.areasLen: + for i in range(self.areasLen): areaitem = QtGui.QListWidgetItem() self.areaitems.addItem(areaitem) - self.allMusic() - self.update_area_list() + self.loadAllMusic() + self.updateAreaList() else: - self.no_arup = True + self.noARUP = True - for pid in playerlist: + for pid in playerList: self.updatePlayerList(pid, 0, 0) - for type in range(len(playerlist[pid])): - self.updatePlayerList(pid, 1, type, playerlist[pid][type]) + for type in range(len(playerList[pid])): + self.updatePlayerList(pid, 1, type, playerList[pid][type]) self.musicslider.setValue(ini.read_ini_int("AO2XP.ini", "Audio", "Music volume", 100)) self.soundslider.setValue(ini.read_ini_int("AO2XP.ini", "Audio", "Sound volume", 100)) @@ -4066,19 +4066,19 @@ class GUI(QtGui.QWidget): self.onImportEvidence(True) - self.tcpthread = TCPThread(self) - self.tcpthread.MS_Chat.connect(self.netmsg_ms) - self.tcpthread.newChar.connect(self.onPVPacket) - self.tcpthread.newBackground.connect(self.setBackground) - self.tcpthread.OOC_Log.connect(self.ooclog.append) - self.tcpthread.IC_Log.connect(self.iclog.append) - self.tcpthread.charSlots.connect(partial(self.charselect.setCharList, self.charlist)) - self.tcpthread.showCharSelect.connect(self.charselect.showCharSelect) - self.tcpthread.allEvidence.connect(self.allEvidence) - self.tcpthread.updatePlayerList.connect(self.updatePlayerList) - self.tcpthread.rainbowColor.connect(self.text.setStyleSheet) - self.tcpthread.timerUpdate.connect(self.start_pause_timers) - self.tcpthread.start() + self.tcpThread = TCPThread(self) + self.tcpThread.MS_Chat.connect(self.netmsgMS) + self.tcpThread.newChar.connect(self.onPVPacket) + self.tcpThread.newBackground.connect(self.setBackground) + self.tcpThread.OOC_Log.connect(self.ooclog.append) + self.tcpThread.IC_Log.connect(self.iclog.append) + self.tcpThread.charSlots.connect(partial(self.charSelect.setCharList, self.charList)) + self.tcpThread.showCharSelect.connect(self.charSelect.showCharSelect) + self.tcpThread.loadAllEvidence.connect(self.loadAllEvidence) + self.tcpThread.updatePlayerList.connect(self.updatePlayerList) + self.tcpThread.rainbowColor.connect(self.text.setStyleSheet) + self.tcpThread.timerUpdate.connect(self.startPauseOnscreenTimers) + self.tcpThread.start() self.demoPlaying = False self.enableWidgets() @@ -4086,15 +4086,15 @@ class GUI(QtGui.QWidget): self.startDemoRecorder(background) self.icchatinput.setFocus() - def start_demo(self, fname): - self.playerlist = [] - self.charlist = [] + def startDemo(self, fname): + self.playerList = [] + self.charList = [] self.evidence = [] self.areas = [] - self.areas_len = 0 - self.features = ['noencryption', 'yellowtext', 'prezoom', 'flipping', 'customobjections', 'fastloading', 'deskmod', 'evidence', 'cccc_ic_support', 'arup', 'casing_alerts', 'modcall_reason', 'looping_sfx', 'additive', 'effects', 'y_offset', 'expanded_desk_mods', 'auth_packet', 'custom_blips'] - self.musiclist = OrderedDict([]) - self.charselect.hide() + self.areasLen = 0 + self.features = ['noencryption', 'yellowtext', 'prezoom', 'flipping', 'customobjections', 'fastloading', 'deskmod', 'evidence', 'cccc_ic_support', 'arup', 'casing_alerts', 'modcall_reason', 'looping_sfx', 'additive', 'effects', 'y_offset', 'expanded_deskMods', 'auth_packet', 'customBlips'] + self.musicList = OrderedDict([]) + self.charSelect.hide() self.onPVPacket() self.setBackground("default") @@ -4108,16 +4108,16 @@ class GUI(QtGui.QWidget): self.onImportEvidence(True) self.demoPlayer = demo.DemoPlayer(self) - self.demoPlayer.MS_Chat.connect(self.netmsg_ms) + self.demoPlayer.MS_Chat.connect(self.netmsgMS) self.demoPlayer.newChar.connect(self.onPVPacket) self.demoPlayer.newBackground.connect(self.setBackground) self.demoPlayer.OOC_Log.connect(self.ooclog.append) self.demoPlayer.IC_Log.connect(self.iclog.append) - self.demoPlayer.charSlots.connect(partial(self.charselect.setCharList, self.charlist)) - self.demoPlayer.allEvidence.connect(self.allEvidence) + self.demoPlayer.charSlots.connect(partial(self.charSelect.setCharList, self.charList)) + self.demoPlayer.loadAllEvidence.connect(self.loadAllEvidence) self.demoPlayer.updatePlayerList.connect(self.updatePlayerList) self.demoPlayer.rainbowColor.connect(self.text.setStyleSheet) - self.demoPlayer.timerUpdate.connect(self.start_pause_timers) + self.demoPlayer.timerUpdate.connect(self.startPauseOnscreenTimers) self.player_list.clear() self.stopMusic() @@ -4133,7 +4133,7 @@ class GUI(QtGui.QWidget): if ini.read_ini_bool("AO2XP.ini", "General", "record demos", False): self.demoRecorder = demo.DemoRecorder() self.demoRecorder.start() - self.demoRecorder.record([["SC"] + [char[0] for char in self.charlist]], encode=True) + self.demoRecorder.record([["SC"] + [char[0] for char in self.charList]], encode=True) if bg: self.demoRecorder.record([["BN", bg, ""]], encode=True) @@ -4161,9 +4161,9 @@ class GUI(QtGui.QWidget): else: self.changechar.setText('Switch &character') - def update_area_list(self): + def updateAreaList(self): try: - for i in range(self.areas_len): + for i in range(self.areasLen): area_players = self.areas[0][i] area_status = self.areas[1][i].title() area_cm = self.areas[2][i].decode('utf-8') diff --git a/mainmenu.py b/mainmenu.py index e63ab81..e429c39 100644 --- a/mainmenu.py +++ b/mainmenu.py @@ -9,9 +9,9 @@ import AOsocket import ini from constants import * -def decode_ao_str(text): +def decodeAOString(text): return text.replace("", "%").replace("", "#").replace("", "#").replace("", "&").replace("", "$") -def encode_ao_str(text): +def encodeAOString(text): return text.replace("%", "").replace("#", "").replace("&", "").replace("$", "") class PicButton(QtGui.QAbstractButton): @@ -225,8 +225,8 @@ class lobby(QtGui.QWidget): self.actual_serverlist.append((ip, port, name, desc, ws_port, wss_port)) def moveToGame(self, stuff): - tcp, playerlist, charlist, musiclist, background, evidence, areas, features, joinooc, hplist, webAO_bucket = stuff - self.move_to_game(tcp, playerlist, charlist, musiclist, background, evidence, areas, features, joinooc, hplist, webAO_bucket) + tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, webAO_bucket = stuff + self.move_to_game(tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, webAO_bucket) def onSettingsClicked(self): self.gamewindow.showSettings() @@ -351,8 +351,8 @@ class lobby(QtGui.QWidget): self.aoserverinfo.stop() self.aoserverinfo.start() - def move_to_game(self, tcp, playerlist, charlist, musiclist, background, evidence, areas, features=[], oocjoin=[], hplist=[], webAO_bucket=""): - self.gamewindow.showGame(tcp, playerlist, charlist, musiclist, background, evidence, areas, features, oocjoin, hplist, webAO_bucket) + def move_to_game(self, tcp, playerList, charList, musicList, background, evidence, areas, features=[], joinOOC=[], hpList=[], webAO_bucket=""): + self.gamewindow.showGame(tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, webAO_bucket) def lobby_sendchat(self): #text = self.lobbychatinput.text().toUtf8() @@ -446,13 +446,13 @@ class AOServerInfo(QtCore.QThread): got_stuff = False gotChars = False - hplist = [] - joinooc = [] + hpList = [] + joinOOC = [] areas = [[], [], [], [], []] features = [] evidence = [] - playerlist = {} - musiclist = [] + playerList = {} + musicList = [] pingtimer = 150 readytick = -1 @@ -474,7 +474,7 @@ class AOServerInfo(QtCore.QThread): if readytick == 0: readytick = -1 try: - self.moveToGameSignal.emit([self.tcp, playerlist, charlist, musiclist, background, evidence, areas, features, joinooc, hplist, self.webAO_bucket]) + self.moveToGameSignal.emit([self.tcp, playerList, charList, musicList, background, evidence, areas, features, joinOOC, hpList, self.webAO_bucket]) except Exception as err: self.msgbox_signal.emit(0, "Error caught while loading", traceback.format_exc(err)) self.returnToLobby.emit() @@ -539,34 +539,34 @@ class AOServerInfo(QtCore.QThread): del network[0] gotChars = True - charlist = [ [char.split('&')[0].decode('utf-8'), 0, "male", True ] for char in network ] + charList = [ [char.split('&')[0].decode('utf-8'), 0, "male", True ] for char in network ] # Disable characters not found in filesystem - for char in charlist: - if not exists(AOpath+"characters/" + char[0].lower()): + for char in charList: + if not exists(AOpath + "characters/" + char[0].lower()): char[3] = False self.setConnectProgress.emit('Requesting music list (%d)...' % maxmusic) self.tcp.send('RM#%') - print '[client]', 'Received characters (%d)' % len(charlist) + print '[client]', 'Received characters (%d)' % len(charList) elif header == 'SM': if self.disconnect: continue del network[0] - musiclist = [music for music in network] + musicList = [music for music in network] self.setConnectProgress.emit('Finishing...') self.tcp.send('RD#%') - print '[client]', 'Received songs (%d)' % len(musiclist) + print '[client]', 'Received songs (%d)' % len(musicList) elif header == 'CharsCheck': if self.disconnect or not gotChars: continue del network[0] for i in range(len(network)): - charlist[i][1] = int(network[i]) + charList[i][1] = int(network[i]) elif header == 'BN': if self.disconnect: @@ -586,9 +586,9 @@ class AOServerInfo(QtCore.QThread): for evi in evidence: while len(evi) < 3: # new AO 2.9 bug where they never correctly escaped evidence name/desc/image on FantaProtocol evi += [""] - evi[0] = decode_ao_str(evi[0].decode("utf-8")) - evi[1] = decode_ao_str(evi[1].decode("utf-8")) - evi[2] = decode_ao_str(evi[2].decode("utf-8")) + evi[0] = decodeAOString(evi[0].decode("utf-8")) + evi[1] = decodeAOString(evi[1].decode("utf-8")) + evi[2] = decodeAOString(evi[2].decode("utf-8")) print '[client]', 'Received evidence' elif header == 'HP': @@ -596,7 +596,7 @@ class AOServerInfo(QtCore.QThread): continue kind = int(network[1]) health = int(network[2]) - hplist.append([kind, health]) + hpList.append([kind, health]) #AO2 2.6 new feature: area update. Not all servers send this during the handshake! elif header == "ARUP": @@ -616,10 +616,10 @@ class AOServerInfo(QtCore.QThread): print '[client]', 'The server has %d areas' % areas_len got_arup = True - if musiclist and not len(areas[4]): + if musicList and not len(areas[4]): for i in range(areas_len): - areas[4].append(musiclist[0]) - del musiclist[0] + areas[4].append(musicList[0]) + del musicList[0] elif header == 'DONE': if self.disconnect: @@ -634,11 +634,11 @@ class AOServerInfo(QtCore.QThread): continue name = network[1].decode("utf-8").replace('', '$').replace('', '%').replace('', '&').replace('', '#').replace('', '#') chatmsg = network[2].decode("utf-8").replace('', '$').replace('', '%').replace('', '&').replace('', '#').replace('', '#') - joinooc.append("%s: %s" % (name, chatmsg)) + joinOOC.append("%s: %s" % (name, chatmsg)) elif header == 'PU': del network[0] pid = network[0] - if not pid in playerlist: - playerlist[pid] = [] - playerlist[pid].append(network[2].decode('utf-8')) + if not pid in playerList: + playerList[pid] = [] + playerList[pid].append(network[2].decode('utf-8')) diff --git a/options.py b/options.py index 88877d6..e46b00d 100644 --- a/options.py +++ b/options.py @@ -116,9 +116,9 @@ class Settings(QtGui.QDialog): currtheme_layout = QtGui.QHBoxLayout() currtheme_label = QtGui.QLabel("Current theme") self.currtheme = QtGui.QComboBox() - self.themes = listdir(AO2XPpath+"ao2xp_themes") + self.themes = listdir(AO2XPpath + "ao2xp_themes") for theme in self.themes: - if exists(AO2XPpath+"ao2xp_themes/"+theme+"/theme.py"): + if exists(AO2XPpath + "ao2xp_themes/"+theme+"/theme.py"): self.currtheme.addItem(theme) currtheme_layout.addWidget(currtheme_label) currtheme_layout.addWidget(self.currtheme) @@ -293,8 +293,8 @@ class Settings(QtGui.QDialog): self.blipslider.setValue(100) self.callwords_edit.clear() - if exists(AO2XPpath+"callwords.ini"): - with open(AO2XPpath+"callwords.ini") as f: + if exists(AO2XPpath + "callwords.ini"): + with open(AO2XPpath + "callwords.ini") as f: for line in f: self.callwords_edit.append(line.rstrip().decode("utf-8")) @@ -340,7 +340,7 @@ class Settings(QtGui.QDialog): with open("AO2XP.ini", "wb") as f: self.inifile.write(f) - with open(AO2XPpath+"callwords.ini", "w") as f: + with open(AO2XPpath + "callwords.ini", "w") as f: f.write(self.callwords_edit.toPlainText().toUtf8()) self.gamewindow.gamewidget.textWaitTime = self.textstaytime.value() @@ -350,8 +350,8 @@ class Settings(QtGui.QDialog): if not self.gamewindow.gamewidget.demoPlaying: if not (self.savelogs_state == self.savetolog.isChecked() and self.combinelogs_state == self.savetolog_combine.isChecked()): - self.gamewindow.gamewidget.ooclog.set_logfiles() - self.gamewindow.gamewidget.iclog.set_logfiles(self.gamewindow.gamewidget.ooclog.logfile) + self.gamewindow.gamewidget.ooclog.setLogFiles() + self.gamewindow.gamewidget.iclog.setLogFiles(self.gamewindow.gamewidget.ooclog.logfile) if not self.savedemos_state == self.savedemos.isChecked(): if self.savedemos.isChecked(): diff --git a/packets.py b/packets.py index 2c43a2a..a759a81 100644 --- a/packets.py +++ b/packets.py @@ -4,7 +4,7 @@ from PyQt4 import QtGui from os.path import exists from pybass_constants import * -def handle_packets(caller, total, record=True): +def handlePackets(caller, total, record=True): # Record the packet if demos enabled if record and caller.parent.demoRecorder: caller.parent.demoRecorder.record(total) @@ -17,20 +17,20 @@ def handle_packets(caller, total, record=True): continue if isinstance(network[CHATMSG], unicode): - network[CHATMSG] = decode_ao_str(network[CHATMSG]) + network[CHATMSG] = decodeAOString(network[CHATMSG]) else: - network[CHATMSG] = decode_ao_str(network[CHATMSG].decode('utf-8')) + network[CHATMSG] = decodeAOString(network[CHATMSG].decode('utf-8')) caller.MS_Chat.emit(network) elif header == 'MC': - music = decode_ao_str(network[1]) + music = decodeAOString(network[1]) charid = int(network[2]) t = time.localtime() timestamp = "[%d:%.2d] " % (t[3], t[4]) if not caller.parent.demoPlaying else "" if charid != -1: try: - name = caller.parent.charlist[charid][0] + name = caller.parent.charList[charid][0] except: name = 'char id %d' % charid @@ -45,18 +45,18 @@ def handle_packets(caller, total, record=True): caller.newBackground.emit(network[1].lower(), True) elif header == 'CT': - name = decode_ao_str(network[1].decode('utf-8')) - chatmsg = decode_ao_str(network[2].decode('utf-8').replace("\n", "
")) + name = decodeAOString(network[1].decode('utf-8')) + chatmsg = decodeAOString(network[2].decode('utf-8').replace("\n", "
")) caller.OOC_Log.emit("%s: %s" % (name, chatmsg)) elif header == 'PV': - caller.parent.mychar = int(network[3]) - caller.parent.charselect.hide() - caller.newChar.emit(caller.parent.charlist[caller.parent.mychar][0]) + caller.parent.myChar = int(network[3]) + caller.parent.charSelect.hide() + caller.newChar.emit(caller.parent.charList[caller.parent.myChar][0]) elif header == 'LE': del network[0] - caller.allEvidence.emit([evi.split('&') for evi in network]) + caller.loadAllEvidence.emit([evi.split('&') for evi in network]) elif header == 'ZZ': if caller.parent.modcall: @@ -72,29 +72,29 @@ def handle_packets(caller, total, record=True): elif header == 'CharsCheck': del network[0] for i in range(len(network)): - caller.parent.charlist[i][1] = int(network[i]) + caller.parent.charList[i][1] = int(network[i]) caller.charSlots.emit() elif header == 'RT': testimony = network[1] - wtcefile = AOpath+"sounds/general/sfx-testimony2" - if caller.parent.wtcesfx: - audio.freehandle(caller.parent.wtcesfx) + wtcefile = AOpath + "sounds/general/sfx-testimony2" + if caller.parent.wtceSfx: + audio.freehandle(caller.parent.wtceSfx) if testimony == 'judgeruling': variant = int(network[2]) if variant == 0: - wtcefile = AOpath+"sounds/general/sfx-notguilty" + wtcefile = AOpath + "sounds/general/sfx-notguilty" elif variant == 1: - wtcefile = AOpath+"sounds/general/sfx-guilty" + wtcefile = AOpath + "sounds/general/sfx-guilty" else: variant = 0 - caller.parent.wtcesfx = audio.loadhandle(False, wtcefile+".opus" if exists(wtcefile+".opus") else wtcefile+".wav", 0, 0, 0) - audio.sethandleattr(caller.parent.wtcesfx, BASS_ATTRIB_VOL, caller.parent.soundslider.value() / 100.0) - if caller.parent.wtcesfx: - audio.playhandle(caller.parent.wtcesfx, True) - caller.parent.wtcesignal.emit(testimony, variant) + caller.parent.wtceSfx = audio.loadhandle(False, wtcefile+".opus" if exists(wtcefile+".opus") else wtcefile+".wav", 0, 0, 0) + audio.sethandleattr(caller.parent.wtceSfx, BASS_ATTRIB_VOL, caller.parent.soundslider.value() / 100.0) + if caller.parent.wtceSfx: + audio.playhandle(caller.parent.wtceSfx, True) + caller.parent.wtceSignal.emit(testimony, variant) elif header == 'HP': kind = int(network[1]) @@ -149,14 +149,14 @@ def handle_packets(caller, total, record=True): caller.parent.areas[kind] = [network[i] for i in range(1, len(network))] # This is much harder than doing it during the handshake because of the way the music list is implemented - if caller.parent.no_arup: - caller.parent.no_arup = False - caller.parent.areas_len = len(caller.parent.areas[kind]) - print '[client]', 'The server has %d areas' % caller.parent.areas_len + if caller.parent.noARUP: + caller.parent.noARUP = False + caller.parent.areasLen = len(caller.parent.areas[kind]) + print '[client]', 'The server has %d areas' % caller.parent.areasLen - if caller.parent.areas_len: - for i in range(caller.parent.areas_len): - area_key, area_val = caller.parent.musiclist.items()[0] + if caller.parent.areasLen: + for i in range(caller.parent.areasLen): + area_key, area_val = caller.parent.musicList.items()[0] caller.parent.areas[4].append(area_val) areaitem = QtGui.QListWidgetItem() @@ -167,11 +167,11 @@ def handle_packets(caller, total, record=True): caller.parent.areas[j].append("") # Remove the area from the music list - caller.parent.musiclist.popitem(False) + caller.parent.musicList.popitem(False) - caller.parent.allMusic() + caller.parent.loadAllMusic() - caller.parent.update_area_list() + caller.parent.updateAreaList() elif header == 'TI': del network[0] @@ -186,4 +186,4 @@ def handle_packets(caller, total, record=True): # For demos elif header == 'SC': del network[0] - caller.parent.charlist = [ [char.split('&')[0].decode('utf-8'), 0, "male", True ] for char in network ] \ No newline at end of file + caller.parent.charList = [ [char.split('&')[0].decode('utf-8'), 0, "male", True ] for char in network ] \ No newline at end of file