Update picodulce.py

This commit is contained in:
Nix 2024-05-23 21:37:19 -03:00 committed by GitHub
parent 5709e849d3
commit 9446d6e404
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,9 +15,6 @@ from PyQt5.QtCore import Qt
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
class PicomcVersionSelector(QWidget):
def __init__(self):
super().__init__()
@ -57,11 +54,7 @@ class PicomcVersionSelector(QWidget):
# Default to dark palette if the type is not specified or invalid
palette = self.create_dark_palette()
QApplication.instance().setPalette(palette)
# Set window border color to dark mode on Windows
if sys.platform == 'win32':
self.setStyleSheet("QMainWindow { border: 2px solid rgb(53, 53, 53); }")
# Create title label
title_label = QLabel('PicoDulce Launcher') # Change label text
title_label.setFont(QFont("Arial", 24, QFont.Bold))
@ -290,6 +283,17 @@ class PicomcVersionSelector(QWidget):
QMessageBox.warning(self, "No Version Available", "Please download a version first.")
return
# Check if there are any accounts
account_list_output = subprocess.check_output(["picomc", "account", "list"]).decode("utf-8").strip()
if not account_list_output:
QMessageBox.warning(self, "No Account Available", "Please create an account first.")
return
# Check if the selected account has a '*' (indicating it's the selected one)
if '*' not in account_list_output:
QMessageBox.warning(self, "No Account Selected", "Please select an account.")
return
selected_instance = self.installed_version_combo.currentText()
# Create a separate thread to run the game process
@ -862,4 +866,4 @@ if __name__ == '__main__':
app = QApplication(sys.argv)
window = PicomcVersionSelector()
window.show()
sys.exit(app.exec_())
sys.exit(app.exec_())