删除服务器步骤1,询问是否删除
(self, index)
| 723 | # 删除服务器 # |
| 724 | ################## |
| 725 | def deleteServer_Step1(self, index): |
| 726 | """删除服务器步骤1,询问是否删除""" |
| 727 | # exec() 返回1:取消,0:继续(此处) |
| 728 | title = self.tr('是否要删除服务器"') + self.globalServerConfig[index]["name"] + '"?' |
| 729 | content = self.tr("此操作是不可逆的!你确定这么做吗?") |
| 730 | w = MessageBox(title, content, self) |
| 731 | w.yesButton.setText(self.tr("取消")) |
| 732 | w.cancelButton.setText(self.tr("删除")) |
| 733 | w.cancelButton.setStyleSheet( |
| 734 | GlobalMCSL2Variables.darkWarnBtnStyleSheet |
| 735 | if isDarkTheme() |
| 736 | else GlobalMCSL2Variables.lightWarnBtnStyleSheet |
| 737 | ) |
| 738 | if w.exec() == 1: |
| 739 | return |
| 740 | |
| 741 | """删除服务器步骤2:输入确认""" |
| 742 | globalConfig: list = readGlobalServerConfig() |
| 743 | title = self.tr('你真的要删除服务器"') + globalConfig[index]["name"] + self.tr('"?') |
| 744 | content = ( |
| 745 | self.tr('此操作是不可逆的!它会失去很久,很久!\n如果真的要删除,请在下方输入框内输入"') |
| 746 | + globalConfig[index]["name"] |
| 747 | + self.tr('",然后点击「删除」按钮:') |
| 748 | ) |
| 749 | w2 = MessageBox(title, content, self) |
| 750 | w2.yesButton.setText(self.tr("取消")) |
| 751 | w2.cancelButton.setText(self.tr("删除")) |
| 752 | w2.cancelButton.setStyleSheet( |
| 753 | GlobalMCSL2Variables.darkWarnBtnStyleSheet |
| 754 | if isDarkTheme() |
| 755 | else GlobalMCSL2Variables.lightWarnBtnStyleSheet |
| 756 | ) |
| 757 | w2.cancelButton.setEnabled(False) |
| 758 | confirmLineEdit = LineEdit(w2) |
| 759 | confirmLineEdit.textChanged.connect( |
| 760 | lambda: self.compareDeleteServerName( |
| 761 | name=globalConfig[index]["name"], LineEditText=confirmLineEdit.text() |
| 762 | ) |
| 763 | ) |
| 764 | confirmLineEdit.setPlaceholderText(self.tr('在此输入"') + globalConfig[index]["name"] + '"') |
| 765 | self.deleteBtnEnabled.connect(w2.cancelButton.setEnabled) |
| 766 | w2.textLayout.addWidget(confirmLineEdit) |
| 767 | if w2.exec() == 1: |
| 768 | return |
| 769 | |
| 770 | """删除服务器步骤3:弹窗提示正在删除""" |
| 771 | globalConfig: list = readGlobalServerConfig() |
| 772 | delServerName = globalConfig[index]["name"] |
| 773 | |
| 774 | self.deletingServerStateToolTip = StateToolTip( |
| 775 | self.tr("删除服务器"), self.tr("请稍后,正在删除..."), self |
| 776 | ) |
| 777 | self.deletingServerStateToolTip.move(self.deletingServerStateToolTip.getSuitablePos()) |
| 778 | self.deletingServerStateToolTip.show() |
| 779 | |
| 780 | # 真正删除服务器文件夹 |
| 781 | |
| 782 | globalServerList = loads(readFile(r"MCSL2/MCSL2_ServerList.json")) |
no test coverage detected