Skip to content

Commit

Permalink
[cuegui] Fix CueGUI version handling and improve error handling (#1538)
Browse files Browse the repository at this point in the history
- Refactored version determination logic in `cuegui/cuegui/Constants.py` to avoid repetition and improve readability.
- Improved error handling in `__get_version_from_cmd` function.
- Fix errors in `cuegui/tests/Constants_tests.py` when `cuegui.use.custom.version` is True
- Updated `displayAbout` method in `MainWindow.py` to explicitly check for `OPENCUE_BETA` environment variable.
  • Loading branch information
ramonfigueiredo authored Oct 16, 2024
1 parent 2400979 commit 0f2c98f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cuegui/cuegui/Constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __get_version_from_cmd(command):
print(f"Command failed with return code {e.returncode}: {e}")
except Exception as e:
print(f"Failed to get version from command: {e}")
return None
return __config.get('version', __packaged_version())

__config = __loadConfigFromFile()

Expand Down
21 changes: 12 additions & 9 deletions cuegui/cuegui/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,19 @@ def showStatusBarMessage(self, message, delay=5000):

def displayAbout(self):
"""Displays about text."""
msg = self.app_name + "\n\nA opencue tool\n\n"
msg += "CueGUI:\n%s\n\n" % cuegui.Constants.VERSION

if os.getenv('OPENCUE_BETA'):
msg += "(Beta Version)\n\n"
else:
msg += "(Stable Version)\n\n"
msg = f"{self.app_name}\n\nA opencue tool\n\n"
msg += f"CueGUI:\n{cuegui.Constants.VERSION}\n\n"

# Only show the labels (Beta or Stable) if OPENCUE_BETA exists
opencue_beta = os.getenv('OPENCUE_BETA')
if opencue_beta:
if opencue_beta == '1':
msg += "(Beta Version)\n\n"
else:
msg += "(Stable Version)\n\n"

msg += "Qt:\n%s\n\n" % QtCore.qVersion()
msg += "Python:\n%s\n\n" % sys.version
msg += f"Qt:\n{QtCore.qVersion()}\n\n"
msg += f"Python:\n{sys.version}\n\n"
QtWidgets.QMessageBox.about(self, "About", msg)

def handleExit(self, sig, flag):
Expand Down

0 comments on commit 0f2c98f

Please sign in to comment.