From c361486d5c6a08e912a9616440312377f8cdf0bb Mon Sep 17 00:00:00 2001 From: Melon Bread Date: Mon, 4 Mar 2019 01:02:16 -0500 Subject: [PATCH] Added Architecture selection --- RetroUFO_GUI.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/RetroUFO_GUI.py b/RetroUFO_GUI.py index 8154c15..53adec9 100644 --- a/RetroUFO_GUI.py +++ b/RetroUFO_GUI.py @@ -17,7 +17,7 @@ from urllib.request import urlretrieve from PySide2.QtWidgets import (QApplication, QCheckBox, QComboBox, QDialog, QFileDialog, QLineEdit, QPushButton, QTextEdit, - QVBoxLayout) + QVBoxLayout, QMessageBox) URL = 'https://buildbot.libretro.com/nightly' @@ -36,7 +36,7 @@ class Form(QDialog): # Create widgets self.chkboxPlatformDetect = QCheckBox('Platform Auto-Detect') self.chkboxPlatformDetect.setChecked(True) - self.chkboxPlatformDetect.stateChanged.connect(self.auto_platform) + self.chkboxPlatformDetect.stateChanged.connect(self.auto_detect) self.cmbboxPlatform = QComboBox() self.cmbboxPlatform.setEnabled(False) @@ -44,6 +44,12 @@ class Form(QDialog): self.cmbboxPlatform.addItem('Linux') self.cmbboxPlatform.addItem('Windows') + self.cmbboxArchitecture = QComboBox() + self.cmbboxArchitecture.setEnabled(False) + self.cmbboxArchitecture.setEditable(False) + self.cmbboxArchitecture.addItem('x86') + self.cmbboxArchitecture.addItem('x86_64') + self.chkboxLocationDetect = QCheckBox('Core Location Auto-Detect') self.chkboxLocationDetect.setChecked(True) self.chkboxLocationDetect.stateChanged.connect(self.auto_location) @@ -68,6 +74,7 @@ class Form(QDialog): layout = QVBoxLayout() layout.addWidget(self.chkboxPlatformDetect) layout.addWidget(self.cmbboxPlatform) + layout.addWidget(self.cmbboxArchitecture) layout.addWidget(self.chkboxLocationDetect) layout.addWidget(self.leditCoreLocation) layout.addWidget(self.btnCoreLocation) @@ -78,11 +85,13 @@ class Form(QDialog): # Set dialog layout self.setLayout(layout) - def auto_platform(self): + def auto_detect(self): if self.chkboxPlatformDetect.isChecked(): self.cmbboxPlatform.setEnabled(False) + self.cmbboxArchitecture.setEnabled(False) else: self.cmbboxPlatform.setEnabled(True) + self.cmbboxArchitecture.setEnabled(True) def auto_location(self): if self.chkboxLocationDetect.isChecked(): @@ -103,8 +112,7 @@ class Form(QDialog): """ Where the magic happens """ # If a platform and/or architecture is not supplied it is grabbed automatically - platform = self.get_platform( - ) # TODO: rename this var to prevent conflict + platform = self.get_platform() # TODO: rename this var to prevent conflict architecture = self.get_architecture() location = CORE_LOCATION[platform] @@ -120,11 +128,11 @@ class Form(QDialog): if platform.system() == 'Linux': return 'linux' - elif platform.system() == 'Windows' or 'MSYS_NT' in platform.system( - ): # Checks for MSYS environment as well + elif platform.system() == 'Windows' or 'MSYS_NT' in platform.system(): # Checks for MSYS environment as well return 'windows' else: - print('ERROR: Platform not found or supported') + msgBox = QMessageBox.warning(self, 'Error', 'Platform not found or supported!', QMessageBox.Ok) + msgBox.exec_() sys.exit(0) def get_architecture(self): @@ -136,7 +144,8 @@ class Form(QDialog): elif '32' in platform.architecture()[0]: return 'x86' else: - print('ERROR: Architecture not found or supported') + msgBox = QMessageBox.warning(self, 'Error', 'Architecture not found or supported', QMessageBox.Ok) + msgBox.exec_() sys.exit(0) def download_cores(self, _platform, _architecture):