unicode support for autopick option

This commit is contained in:
cidoku 2025-02-20 01:11:51 -03:00
parent de78883190
commit ea20cb72b9
2 changed files with 6 additions and 6 deletions

View File

@ -2935,7 +2935,7 @@ class gui(QtGui.QWidget):
buckets[0] = webAO_bucket buckets[0] = webAO_bucket
self.charselect.setCharList(charlist) self.charselect.setCharList(charlist)
autopick = get_option("General", "auto pick").lower() autopick = get_option("General", "auto pick").decode('utf-8').lower()
coincidence = -1 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: if char[0].lower() == autopick and char[1] == 0:

View File

@ -102,7 +102,7 @@ class Settings(QtGui.QDialog):
self.autoconnect = QtGui.QComboBox() self.autoconnect = QtGui.QComboBox()
autopick_layout = QtGui.QHBoxLayout() autopick_layout = QtGui.QHBoxLayout()
autopick_label = QtGui.QLabel("Pick this character automatically after connecting") autopick_label = QtGui.QLabel("Pick this character automatically on join")
self.autopick = QtGui.QComboBox() self.autopick = QtGui.QComboBox()
for folder in listdir(unicode(AOpath + 'characters')): for folder in listdir(unicode(AOpath + 'characters')):
if exists(AOpath + 'characters/' + folder + '/char.ini'): if exists(AOpath + 'characters/' + folder + '/char.ini'):
@ -141,9 +141,9 @@ class Settings(QtGui.QDialog):
general_layout.addLayout(allowdownload_layout) general_layout.addLayout(allowdownload_layout)
general_layout.addWidget(separators[2]) general_layout.addWidget(separators[2])
general_layout.addLayout(currtheme_layout) general_layout.addLayout(currtheme_layout)
general_layout.addWidget(separators[3])
general_layout.addLayout(autoconnect_layout) general_layout.addLayout(autoconnect_layout)
general_layout.addLayout(autopick_layout) general_layout.addLayout(autopick_layout)
general_layout.addWidget(separators[3])
general_layout.addLayout(update_layout) general_layout.addLayout(update_layout)
general_layout.addWidget(savechangeswarn, 50, QtCore.Qt.AlignBottom) general_layout.addWidget(savechangeswarn, 50, QtCore.Qt.AlignBottom)
@ -220,7 +220,7 @@ class Settings(QtGui.QDialog):
self.allowdownload_evidence.setChecked(ini.read_ini_bool(self.inifile, "General", "download evidence")) self.allowdownload_evidence.setChecked(ini.read_ini_bool(self.inifile, "General", "download evidence"))
self.currtheme.setCurrentIndex(self.themes.index(ini.read_ini(self.inifile, "General", "theme", "default"))) self.currtheme.setCurrentIndex(self.themes.index(ini.read_ini(self.inifile, "General", "theme", "default")))
self.autoconnect.setCurrentIndex(ini.read_ini_int(self.inifile, "General", "auto connect", -1) + 1) self.autoconnect.setCurrentIndex(ini.read_ini_int(self.inifile, "General", "auto connect", -1) + 1)
self.autopick.setEditText(ini.read_ini(self.inifile, "General", "auto pick")) self.autopick.setEditText(ini.read_ini(self.inifile, "General", "auto pick").decode('utf-8'))
self.check_updates.setChecked(ini.read_ini_bool(self.inifile, "General", "install updates", False)) # Automatic updates are opt-in! self.check_updates.setChecked(ini.read_ini_bool(self.inifile, "General", "install updates", False)) # Automatic updates are opt-in!
self.device_list.setCurrentIndex(ini.read_ini_int(self.inifile, "Audio", "device", audio.getcurrdevice())) self.device_list.setCurrentIndex(ini.read_ini_int(self.inifile, "Audio", "device", audio.getcurrdevice()))
@ -271,7 +271,7 @@ class Settings(QtGui.QDialog):
self.inifile.set("General", "download evidence", self.allowdownload_evidence.isChecked()) self.inifile.set("General", "download evidence", self.allowdownload_evidence.isChecked())
self.inifile.set("General", "theme", self.currtheme.currentText()) self.inifile.set("General", "theme", self.currtheme.currentText())
self.inifile.set("General", "auto connect", self.autoconnect.currentIndex() - 1) self.inifile.set("General", "auto connect", self.autoconnect.currentIndex() - 1)
self.inifile.set("General", "auto pick", self.autopick.currentText()) self.inifile.set("General", "auto pick", self.autopick.currentText().toUtf8())
self.inifile.set("General", "install updates", self.check_updates.isChecked()) self.inifile.set("General", "install updates", self.check_updates.isChecked())
self.inifile.set("Audio", "device", self.device_list.currentIndex()) self.inifile.set("Audio", "device", self.device_list.currentIndex())
@ -279,7 +279,7 @@ 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", "w")) self.inifile.write(open("AO2XP.ini", "wb"))
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())