Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def addPythonVersions(self, pythonVersions):
- """
- Adding a list of Python Versions to the QComboBox and to the QMenu.
- :param pythonVersions: This can be a list or a single string.
- :return: Returns True if everything went good.
- """
- try:
- nextItemIndex = len(self.pythonVersions)
- if type(pythonVersions) is list:
- for newItem in pythonVersions:
- self.pythonVersions.insertItem(nextItemIndex, newItem)
- self.actionPython_Version.addAction(newItem)
- else:
- self.pythonVersions.insertItem(nextItemIndex, pythonVersions)
- self.actionPython_Version.addAction(pythonVersions)
- except Exception as ErrorCode:
- raise PythonVersionError(f'Error while adding the python versions to QComboBox:\n{ErrorCode}')
- return False
- else:
- self.pythonVersions.setCurrentIndex(0) # Setting the last Python Version as the default option.
- return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement