Select and remove servers based on index instead of 'server'
This commit is contained in:
parent
afac304821
commit
8aa6a90f55
1 changed files with 24 additions and 7 deletions
|
@ -3836,9 +3836,18 @@ class PesterWindow(MovingWindow):
|
||||||
|
|
||||||
selected_entry = None
|
selected_entry = None
|
||||||
|
|
||||||
for i in range(len(server_list_obj)):
|
try:
|
||||||
if server_list_obj[i]["server"] == self.removeServerBox.currentText():
|
assert (
|
||||||
selected_entry = i
|
server_list_obj[self.removeServerBox.currentIndex()]["server"]
|
||||||
|
== self.removeServerBox.currentText()
|
||||||
|
)
|
||||||
|
selected_entry = self.removeServerBox.currentIndex()
|
||||||
|
except (IndexError, AssertionError) as e:
|
||||||
|
PchumLog.warning(e)
|
||||||
|
for i in range(len(server_list_obj)):
|
||||||
|
if server_list_obj[i]["server"] == self.removeServerBox.currentText():
|
||||||
|
selected_entry = i
|
||||||
|
|
||||||
if selected_entry is not None:
|
if selected_entry is not None:
|
||||||
server_list_obj.pop(selected_entry)
|
server_list_obj.pop(selected_entry)
|
||||||
|
|
||||||
|
@ -3927,7 +3936,7 @@ class PesterWindow(MovingWindow):
|
||||||
self.resetServerlist()
|
self.resetServerlist()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
PchumLog.info("server_list_items: " + str(server_list_items))
|
PchumLog.info(f"server_list_items: {server_list_items}")
|
||||||
|
|
||||||
# Widget 1
|
# Widget 1
|
||||||
self.chooseRemoveServerWidged = QtWidgets.QDialog()
|
self.chooseRemoveServerWidged = QtWidgets.QDialog()
|
||||||
|
@ -3982,9 +3991,17 @@ class PesterWindow(MovingWindow):
|
||||||
|
|
||||||
selected_entry = None
|
selected_entry = None
|
||||||
|
|
||||||
for i in range(len(server_obj)):
|
try:
|
||||||
if server_obj[i]["server"] == self.serverBox.currentText():
|
selected_entry = self.serverBox.currentIndex()
|
||||||
selected_entry = i
|
assert (
|
||||||
|
server_obj[selected_entry]["server"] == self.serverBox.currentText()
|
||||||
|
)
|
||||||
|
except (IndexError, AssertionError) as e:
|
||||||
|
# fallback using 'server' as primary key
|
||||||
|
PchumLog.warning(e)
|
||||||
|
for i in range(len(server_obj)):
|
||||||
|
if server_obj[i]["server"] == self.serverBox.currentText():
|
||||||
|
selected_entry = i
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(_datadir + "server.json", "w") as server_file:
|
with open(_datadir + "server.json", "w") as server_file:
|
||||||
|
|
Loading…
Reference in a new issue