Compare commits

..

4 Commits

Author SHA1 Message Date
9eeb7897f1 have autocaps deal with some more closing special chars 2025-02-23 15:32:09 -03:00
98e1da8225 add some shortcuts 2025-02-23 15:12:18 -03:00
b072f5dafd tabs -> spaces 2025-02-23 15:12:06 -03:00
b66ee7e619 handle some file open()s better 2025-02-23 14:09:24 -03:00
3 changed files with 215 additions and 211 deletions

View File

@ -3,195 +3,195 @@ import os
from constants import * from constants import *
class AOToggleButton(QtGui.QLabel): class AOToggleButton(QtGui.QLabel):
pressed = False pressed = False
clicked = QtCore.pyqtSignal() clicked = QtCore.pyqtSignal()
def __init__(self, parent, x, y, btnname): def __init__(self, parent, x, y, btnname):
super(AOToggleButton, self).__init__(parent) super(AOToggleButton, self).__init__(parent)
self.parent = parent self.parent = parent
self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/%s.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.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/%s_pressed.png" % btnname)
self.setPixmap(self.notpressed_pix) self.setPixmap(self.notpressed_pix)
self.setGeometry(x, y, self.notpressed_pix.size().width(), self.notpressed_pix.size().height()) self.setGeometry(x, y, self.notpressed_pix.size().width(), self.notpressed_pix.size().height())
self.show() self.show()
def setPressed(self, on): def setPressed(self, on):
self.pressed = on self.pressed = on
self.setPixmap(self.pressed_pix if on else self.notpressed_pix) self.setPixmap(self.pressed_pix if on else self.notpressed_pix)
def isPressed(self): def isPressed(self):
return self.pressed return self.pressed
def mousePressEvent(self, event): def mousePressEvent(self, event):
self.setPressed(not self.isPressed()) self.setPressed(not self.isPressed())
self.clicked.emit() self.clicked.emit()
class CustomObjection(QtGui.QLabel): class CustomObjection(QtGui.QLabel):
pressed = False pressed = False
def __init__(self, parent, x, y): def __init__(self, parent, x, y):
super(CustomObjection, self).__init__(parent) super(CustomObjection, self).__init__(parent)
self.parent = parent self.parent = parent
self.setGeometry(x, y, 76, 28) self.setGeometry(x, y, 76, 28)
self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/custom.png") self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/custom.png")
self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/custom_selected.png") self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/custom_selected.png")
self.setPixmap(self.notpressed_pix) self.setPixmap(self.notpressed_pix)
self.show() self.show()
def setPressed(self, on): def setPressed(self, on):
self.pressed = on self.pressed = on
if on: if on:
self.setPixmap(self.pressed_pix) self.setPixmap(self.pressed_pix)
else: else:
self.setPixmap(self.notpressed_pix) self.setPixmap(self.notpressed_pix)
def isPressed(self): def isPressed(self):
return self.pressed return self.pressed
def mousePressEvent(self, event): def mousePressEvent(self, event):
self.setPressed(not self.isPressed()) self.setPressed(not self.isPressed())
self.parent.objectbtn.setPressed(False) self.parent.objectbtn.setPressed(False)
self.parent.holditbtn.setPressed(False) self.parent.holditbtn.setPressed(False)
self.parent.takethatbtn.setPressed(False) self.parent.takethatbtn.setPressed(False)
class WTCEbuttons(QtGui.QLabel): class WTCEbuttons(QtGui.QLabel):
clicked = QtCore.pyqtSignal(int, int) clicked = QtCore.pyqtSignal(int, int)
type = 0 type = 0
variant = 0 variant = 0
def __init__(self, parent, x, y, type, variant=0): def __init__(self, parent, x, y, type, variant=0):
super(WTCEbuttons, self).__init__(parent) super(WTCEbuttons, self).__init__(parent)
self.setGeometry(x, y, 85, 42) self.setGeometry(x, y, 85, 42)
if type == 0: if type == 0:
self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/witnesstestimony.png")) self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/witnesstestimony.png"))
elif type == 1: elif type == 1:
self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/crossexamination.png")) self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/crossexamination.png"))
elif type == 2: elif type == 2:
if variant == 0: if variant == 0:
self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/notguilty.png")) self.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/notguilty.png"))
elif variant == 1: 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.type = type
self.variant = variant self.variant = variant
def mousePressEvent(self, event): def mousePressEvent(self, event):
self.clicked.emit(self.type, self.variant) self.clicked.emit(self.type, self.variant)
class Objections(QtGui.QLabel): class Objections(QtGui.QLabel):
pressed = False pressed = False
type = 0 type = 0
def __init__(self, parent, x, y, type): def __init__(self, parent, x, y, type):
super(Objections, self).__init__(parent) super(Objections, self).__init__(parent)
self.parent = parent self.parent = parent
self.type = type self.type = type
self.setGeometry(x, y, 76, 28) self.setGeometry(x, y, 76, 28)
if type == 1: if type == 1:
self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/holdit.png") self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/holdit.png")
self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/holdit_selected.png") self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/holdit_selected.png")
elif type == 2: elif type == 2:
self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/objection.png") self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/objection.png")
self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/objection_selected.png") self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/objection_selected.png")
elif type == 3: elif type == 3:
self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/takethat.png") self.notpressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/takethat.png")
self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/takethat_selected.png") self.pressed_pix = QtGui.QPixmap(AO2XPpath+"themes/default/takethat_selected.png")
self.setPixmap(self.notpressed_pix) self.setPixmap(self.notpressed_pix)
self.show() self.show()
def setPressed(self, on): def setPressed(self, on):
self.pressed = on self.pressed = on
if on: if on:
self.setPixmap(self.pressed_pix) self.setPixmap(self.pressed_pix)
else: else:
self.setPixmap(self.notpressed_pix) self.setPixmap(self.notpressed_pix)
def isPressed(self): def isPressed(self):
return self.pressed return self.pressed
def mousePressEvent(self, event): def mousePressEvent(self, event):
self.setPressed(not self.isPressed()) self.setPressed(not self.isPressed())
self.parent.customobject.setPressed(False) self.parent.customobject.setPressed(False)
if self.type == 1: if self.type == 1:
self.parent.objectbtn.setPressed(False) self.parent.objectbtn.setPressed(False)
self.parent.takethatbtn.setPressed(False) self.parent.takethatbtn.setPressed(False)
elif self.type == 2: elif self.type == 2:
self.parent.holditbtn.setPressed(False) self.parent.holditbtn.setPressed(False)
self.parent.takethatbtn.setPressed(False) self.parent.takethatbtn.setPressed(False)
elif self.type == 3: elif self.type == 3:
self.parent.objectbtn.setPressed(False) self.parent.objectbtn.setPressed(False)
self.parent.holditbtn.setPressed(False) self.parent.holditbtn.setPressed(False)
class PixmapButton(QtGui.QAbstractButton): class PixmapButton(QtGui.QAbstractButton):
def __init__(self, parent, pixmap): def __init__(self, parent, pixmap):
super(PixmapButton, self).__init__(parent) super(PixmapButton, self).__init__(parent)
self.pixmap = pixmap self.pixmap = pixmap
def paintEvent(self, event): def paintEvent(self, event):
painter = QtGui.QPainter(self) painter = QtGui.QPainter(self)
painter.drawPixmap(event.rect(), self.pixmap) painter.drawPixmap(event.rect(), self.pixmap)
def sizeHint(self): def sizeHint(self):
return self.pixmap.size() return self.pixmap.size()
def setPixmap(self, pixmap): def setPixmap(self, pixmap):
self.pixmap = pixmap self.pixmap = pixmap
class PixmapButton2(QtGui.QLabel): class PixmapButton2(QtGui.QLabel):
clicked = QtCore.pyqtSignal() clicked = QtCore.pyqtSignal()
rightClicked = QtCore.pyqtSignal() rightClicked = QtCore.pyqtSignal()
def __init__(self, parent, pixmap): def __init__(self, parent, pixmap):
super(PixmapButton2, self).__init__(parent) super(PixmapButton2, self).__init__(parent)
self.setPixmap(pixmap) self.setPixmap(pixmap)
self.show() self.show()
def mousePressEvent(self, ev): def mousePressEvent(self, ev):
if ev.buttons() == QtCore.Qt.LeftButton: if ev.buttons() == QtCore.Qt.LeftButton:
self.clicked.emit() self.clicked.emit()
elif ev.buttons() == QtCore.Qt.RightButton: elif ev.buttons() == QtCore.Qt.RightButton:
self.rightClicked.emit() self.rightClicked.emit()
class PenaltyBars(QtGui.QLabel): class PenaltyBars(QtGui.QLabel):
minusClicked = QtCore.pyqtSignal(int) minusClicked = QtCore.pyqtSignal(int)
plusClicked = QtCore.pyqtSignal(int) plusClicked = QtCore.pyqtSignal(int)
def __init__(self, parent, type): def __init__(self, parent, type):
super(PenaltyBars, self).__init__(parent) super(PenaltyBars, self).__init__(parent)
self.parent = parent self.parent = parent
self.penaltybars = [] self.penaltybars = []
self.type = type self.type = type
self.health = 10 self.health = 10
self.resize(84, 14) self.resize(84, 14)
if type == 1: #defense bar. if type == 1: #defense bar.
for i in range(11): 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" side = "def"
elif type == 2: #prosecution bar elif type == 2: #prosecution bar
for i in range(11): 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" side = "pro"
self.side = side self.side = side
self.minusbtn = PixmapButton(parent, QtGui.QPixmap(AO2XPpath+"themes/default/"+side+"minus.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.plusbtn = PixmapButton(parent, QtGui.QPixmap(AO2XPpath+"themes/default/"+side+"plus.png"))
self.minusbtn.clicked.connect(self.minusClick) self.minusbtn.clicked.connect(self.minusClick)
self.plusbtn.clicked.connect(self.plusClick) self.plusbtn.clicked.connect(self.plusClick)
self.setPixmap(self.penaltybars[10]) self.setPixmap(self.penaltybars[10])
self.minusbtn.show() self.minusbtn.show()
self.plusbtn.show() self.plusbtn.show()
self.show() self.show()
def moveBar(self, x, y): def moveBar(self, x, y):
self.move(x, y) self.move(x, y)
self.minusbtn.move(x-(9/2), y+(14/2)-(9/2)) self.minusbtn.move(x-(9/2), y+(14/2)-(9/2))
self.plusbtn.move(x+84-(9/2), y+(14/2)-(9/2)) self.plusbtn.move(x+84-(9/2), y+(14/2)-(9/2))
def plusClick(self): def plusClick(self):
self.plusClicked.emit(self.type) self.plusClicked.emit(self.type)
def minusClick(self): def minusClick(self):
self.minusClicked.emit(self.type) self.minusClicked.emit(self.type)
def setHealth(self, health): def setHealth(self, health):
self.minusbtn.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/"+self.side+"minus.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.plusbtn.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/"+self.side+"plus.png"))
self.setPixmap(self.penaltybars[health]) self.setPixmap(self.penaltybars[health])
self.health = health self.health = health
def getHealth(self): def getHealth(self):
return self.health return self.health

View File

@ -827,7 +827,7 @@ class gui(QtGui.QWidget):
self.oocinput.setPlaceholderText('Server chat/OOC chat...') self.oocinput.setPlaceholderText('Server chat/OOC chat...')
self.oocinput.returnPressed.connect(self.onOOCreturn) self.oocinput.returnPressed.connect(self.onOOCreturn)
self.ooclogin = QtGui.QPushButton("Login", self) self.ooclogin = QtGui.QPushButton("Lo&gin", self)
self.ooclogin.clicked.connect(self.onOOCLoginBtn) self.ooclogin.clicked.connect(self.onOOCLoginBtn)
self.musicareatabs = QtGui.QTabWidget(self) self.musicareatabs = QtGui.QTabWidget(self)
@ -989,17 +989,17 @@ class gui(QtGui.QWidget):
self.misc_layout.addWidget(self.spacebartext) self.misc_layout.addWidget(self.spacebartext)
self.misc_layout.addWidget(self.autocaps) self.misc_layout.addWidget(self.autocaps)
self.gametabs.addTab(self.gametab_log, 'Log') self.gametabs.addTab(self.gametab_log, '&Log')
self.gametabs.addTab(self.gametab_evidence, 'Evidence') self.gametabs.addTab(self.gametab_evidence, '&Evidence')
self.gametabs.addTab(self.gametab_mute, 'Mute') self.gametabs.addTab(self.gametab_mute, 'Mu&te')
self.gametabs.addTab(self.gametab_iniswap, 'INI swap') self.gametabs.addTab(self.gametab_iniswap, '&INI swap')
self.gametabs.addTab(self.gametab_pair, 'Pair') self.gametabs.addTab(self.gametab_pair, 'Pai&r')
self.gametabs.addTab(self.gametab_misc, 'Misc') self.gametabs.addTab(self.gametab_misc, 'Mi&sc')
self.gametabs.addTab(self.gametab_msgqueue, 'Queue') self.gametabs.addTab(self.gametab_msgqueue, '&Queue')
self.musicareatabs.addTab(self.musicitems, "Music") self.musicareatabs.addTab(self.musicitems, "&Music")
self.musicareatabs.addTab(self.areaitems, "Areas") self.musicareatabs.addTab(self.areaitems, "&Areas")
self.musicareatabs.addTab(self.gametab_players, 'Players') self.musicareatabs.addTab(self.gametab_players, 'Pla&yers')
self.icchatinput = QtGui.QLineEdit(self) self.icchatinput = QtGui.QLineEdit(self)
self.icchatinput.returnPressed.connect(self.onICreturn) self.icchatinput.returnPressed.connect(self.onICreturn)
@ -1020,14 +1020,14 @@ class gui(QtGui.QWidget):
self.flipbutton = QtGui.QCheckBox(self) self.flipbutton = QtGui.QCheckBox(self)
self.flipbutton.stateChanged.connect(self.changeFlipCheck) self.flipbutton.stateChanged.connect(self.changeFlipCheck)
self.flipbutton.setText('Flip') self.flipbutton.setText('&Flip')
self.flipbutton.resize(self.flipbutton.sizeHint()) self.flipbutton.resize(self.flipbutton.sizeHint())
self.flipbutton.setToolTip("Mirror your character horizontally") self.flipbutton.setToolTip("Mirror your character horizontally")
self.sfxbutton = QtGui.QCheckBox(self) self.sfxbutton = QtGui.QCheckBox(self)
self.sfxbutton.setChecked(True) self.sfxbutton.setChecked(True)
self.sfxbutton.stateChanged.connect(self.changeSfxCheck) self.sfxbutton.stateChanged.connect(self.changeSfxCheck)
self.sfxbutton.setText('Play pre-animation') self.sfxbutton.setText('Play &pre-animation')
self.sfxbutton.setToolTip("Play a character-specific animation before the next message") self.sfxbutton.setToolTip("Play a character-specific animation before the next message")
self.nointerruptbtn = QtGui.QCheckBox(self) self.nointerruptbtn = QtGui.QCheckBox(self)
@ -1060,7 +1060,7 @@ class gui(QtGui.QWidget):
self.settingsbtn.clicked.connect(self.gamewindow.showSettings) self.settingsbtn.clicked.connect(self.gamewindow.showSettings)
self.changechar = QtGui.QPushButton(self) self.changechar = QtGui.QPushButton(self)
self.changechar.setText('Switch character') self.changechar.setText('&Switch character')
self.changechar.clicked.connect(self.onClick_changeChar) self.changechar.clicked.connect(self.onClick_changeChar)
spacing = 1 spacing = 1
@ -1197,7 +1197,8 @@ class gui(QtGui.QWidget):
self.height = 730 self.height = 730
theme = get_option("General", "theme", "default") theme = get_option("General", "theme", "default")
try: try:
exec open(AO2XPpath+"ao2xp_themes/"+theme+"/theme.py") with open(AO2XPpath+"ao2xp_themes/"+theme+"/theme.py") as t:
exec t
except Exception as e: except Exception as e:
QtGui.QMessageBox.critical(None, "Unable to load theme", "There was a problem loading the current theme \"%s\":\n\n%s." % (theme, e)) QtGui.QMessageBox.critical(None, "Unable to load theme", "There was a problem loading the current theme \"%s\":\n\n%s." % (theme, e))
os._exit(-2) os._exit(-2)
@ -1601,8 +1602,9 @@ class gui(QtGui.QWidget):
inifile.set(id, "name", evi[0].replace('\n', '\\n').encode('utf-8')) inifile.set(id, "name", evi[0].replace('\n', '\\n').encode('utf-8'))
inifile.set(id, "description", evi[1].replace('\n', '\\n').encode('utf-8')) inifile.set(id, "description", evi[1].replace('\n', '\\n').encode('utf-8'))
inifile.set(id, "image", evi[2].encode('utf-8')) inifile.set(id, "image", evi[2].encode('utf-8'))
inifile.write(open(path, "wb")) with open(path, "wb") as f:
inifile.write(f)
def onImportEvidence(self, is_autoload=False): def onImportEvidence(self, is_autoload=False):
if not is_autoload: if not is_autoload:
@ -1865,7 +1867,7 @@ class gui(QtGui.QWidget):
self.playerList.clear() self.playerList.clear()
self.playerKick.setDisabled(True) self.playerKick.setDisabled(True)
self.playerBan.setDisabled(True) self.playerBan.setDisabled(True)
self.ooclogin.setText("Login") self.ooclogin.setText("Lo&gin")
self.login = False self.login = False
self.privateinv = False self.privateinv = False
self.charselect.onDisconnect() self.charselect.onDisconnect()
@ -1922,7 +1924,7 @@ class gui(QtGui.QWidget):
l = QtCore.QStringList(list(text)) l = QtCore.QStringList(list(text))
l[0] = l[0].toUpper() l[0] = l[0].toUpper()
last = [".", "?", "!"] last = [".", "?", "!", ")", "]"]
if not l[-1] in last: if not l[-1] in last:
l.append(".") l.append(".")
text = l.join("").replace(" i ", " I ").replace("i'm", "I'm").replace("it's", "It's") text = l.join("").replace(" i ", " I ").replace("i'm", "I'm").replace("it's", "It's")
@ -1936,16 +1938,14 @@ class gui(QtGui.QWidget):
self.oocinput.clear() self.oocinput.clear()
def onICreturn(self): def onICreturn(self):
text = str(self.icchatinput.text().toUtf8()).replace('#', '<num>').replace('%', '<percent>').replace('&', '<and>').replace('$', '<dollar>').replace('/n', '\n') text = str(self.icchatinput.text().toUtf8()).replace('#', '<num>').replace('%', '<percent>').replace('&', '<and>').replace('$', '<dollar>')#.replace('/n', '\n')
#if not text:
# return
if self.mocktext.isChecked(): if self.mocktext.isChecked():
text = mockStr(text) text = mockStr(text)
if self.autocaps.isChecked(): if self.autocaps.isChecked():
l = list(text) l = list(text)
l[0] = l[0].upper() l[0] = l[0].upper()
last = [".", "?", "!"] last = [".", "?", "!", "<", ">", ")", "]"]
if not l[-1] in last: if not l[-1] in last:
l.append(".") l.append(".")
text = "".join(l).replace(" i ", " I ").replace("i'm", "I'm").replace("it's", "It's") text = "".join(l).replace(" i ", " I ").replace("i'm", "I'm").replace("it's", "It's")
@ -2545,14 +2545,15 @@ class gui(QtGui.QWidget):
self.anim_state = 3 self.anim_state = 3
if exists(AO2XPpath+"callwords.ini"): if exists(AO2XPpath+"callwords.ini"):
callwords = [line.rstrip() for line in open(AO2XPpath+"callwords.ini")] with open(AO2XPpath+"callwords.ini") as f:
for callword in callwords: callwords = [line.rstrip() for line in f]
if callword.decode('utf-8').lower() in self.m_chatmessage[CHATMSG].lower().split(" "): for callword in callwords:
self.ooclog.append("<b>%s called you.</b>" % f_char) if callword.decode('utf-8').lower() in self.m_chatmessage[CHATMSG].lower().split(" "):
snd = audio.loadhandle(False, "word_call.wav", 0, 0, BASS_STREAM_AUTOFREE) self.ooclog.append("<b>%s called you.</b>" % f_char)
if snd: snd = audio.loadhandle(False, "word_call.wav", 0, 0, BASS_STREAM_AUTOFREE)
audio.playhandle(snd, True) if snd:
break audio.playhandle(snd, True)
break
def do_effect(self, fx_name, fx_sound, p_char, p_folder): def do_effect(self, fx_name, fx_sound, p_char, p_folder):
effect = ini.get_effect(fx_name, p_char, p_folder) effect = ini.get_effect(fx_name, p_char, p_folder)
@ -3104,6 +3105,8 @@ class gui(QtGui.QWidget):
self.tcpthread.updatePlayerList.connect(self.updatePlayerList) self.tcpthread.updatePlayerList.connect(self.updatePlayerList)
self.tcpthread.rainbowColor.connect(self.text.setStyleSheet) self.tcpthread.rainbowColor.connect(self.text.setStyleSheet)
self.tcpthread.start() self.tcpthread.start()
self.icchatinput.setFocus()
def allEvidence(self, evi): def allEvidence(self, evi):
self.evidence = evi self.evidence = evi
@ -3559,12 +3562,12 @@ class TCP_Thread(QtCore.QThread):
self.parent.login = True self.parent.login = True
self.parent.playerKick.setDisabled(False) self.parent.playerKick.setDisabled(False)
self.parent.playerBan.setDisabled(False) self.parent.playerBan.setDisabled(False)
self.parent.ooclogin.setText("Log out") self.parent.ooclogin.setText("Lo&g out")
elif status == -1: elif status == -1:
self.parent.login = False self.parent.login = False
self.parent.playerKick.setDisabled(True) self.parent.playerKick.setDisabled(True)
self.parent.playerBan.setDisabled(True) self.parent.playerBan.setDisabled(True)
self.parent.ooclogin.setText("Login") self.parent.ooclogin.setText("Lo&gin")
self.OOC_Log.emit("<b>%s</b>" % (statusStrings[status+1])) self.OOC_Log.emit("<b>%s</b>" % (statusStrings[status+1]))
elif header == "CHECK": #ping elif header == "CHECK": #ping

View File

@ -296,7 +296,8 @@ class Settings(QtGui.QDialog):
self.inifile.set("Audio", "Sound volume", self.soundslider.value()) self.inifile.set("Audio", "Sound volume", self.soundslider.value())
self.inifile.set("Audio", "Blip volume", self.blipslider.value()) self.inifile.set("Audio", "Blip volume", self.blipslider.value())
self.inifile.write(open("AO2XP.ini", "wb")) 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()) f.write(self.callwords_edit.toPlainText().toUtf8())