MCPcopy Create free account
hub / github.com/MCSLTeam/MCSL2 / goBack

Method goBack

MCSL2Lib/Pages/serverManagerPage.py:636–658  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

634 self.editServerIcon.setMaxVisibleItems(8)
635
636 def goBack(self):
637 # 没改就直接退出
638 if self.checkDuplicateConfig():
639 self.stackedWidget.setCurrentIndex(0)
640 self.disconnectEditServerSlot()
641 # 改了得确认
642 else:
643 w = MessageBox(
644 parent=self,
645 title=self.tr("是否要退出此页面?"),
646 content=self.tr("任何没有保存的修改都会消失!你确定要这么做吗?"),
647 )
648 w.yesButton.setText(self.tr("取消"))
649 w.cancelButton.setText(self.tr("退出"))
650 w.cancelButton.setStyleSheet(
651 GlobalMCSL2Variables.darkWarnBtnStyleSheet
652 if isDarkTheme()
653 else GlobalMCSL2Variables.lightWarnBtnStyleSheet
654 )
655 w.cancelButton.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(0))
656 w.cancelButton.clicked.connect(self.disconnectEditServerSlot)
657 w.cancelButton.clicked.connect(self.refreshServers)
658 w.exec()
659
660 @pyqtSlot(int)
661 def onPageChangedRefresh(self, currentChanged):

Callers

nothing calls this directly

Calls 3

checkDuplicateConfigMethod · 0.95
setCurrentIndexMethod · 0.45

Tested by

no test coverage detected