Skip to content

Commit

Permalink
pyqt6.5.3 support with dep checking
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclifford1 committed Oct 20, 2023
1 parent e446c1c commit 622c7ad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
25 changes: 23 additions & 2 deletions IQM_Vis/ui_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
TODO: write docs on example usage/ what inputs etc. and what attributes that the data_store class needs
'''
# Author: Matt Clifford <[email protected]>
import os
import subprocess
import platform
import sys
from typing import Any
import warnings
Expand Down Expand Up @@ -48,6 +49,7 @@ def __init__(self,
self.restrict_options = restrict_options
self.num_steps_range = num_steps_range
self.debug = debug
check_pyqt_install_deps()
self.show()

def show(self):
Expand Down Expand Up @@ -183,4 +185,23 @@ def __eq__(self, other):
return self.function == other.function
else:
# unwrapped tranform function
return self.function == other
return self.function == other


def check_pyqt_install_deps():
''' PyQt6 on linux doesn't always ship with all the required libraries
so here we will warn the user if they need to install them, avoiding a crash '''
system_info = platform.system()
if not system_info == "Linux":
return True

# if on linux try see if package installed (only for debian based)
package_name = "libxcb-cursor0"
installed = False
try:
result = subprocess.run(["dpkg", "-l", package_name], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
installed = "ii" in result.stdout
except subprocess.CalledProcessError:
installed = False
if installed == False:
print(f"{'*'*30}\n\nWarning: not all dependencies are installed. If you get an 'Aborted (core dumped)' error below this message then please install them using:\n\n 'sudo apt install libxcb-cursor0'\n\n\n{'*'*30}\n\n")
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
numpy>=1.23.4
PyQt6==6.4
PyQt6-Qt6==6.4
PyQt6-sip==13.4
PyQt6==6.5.3
PyQt6-Qt6==6.5.3
PyQt6-sip==13.6
opencv-python-headless>=4.6.0.66
Pillow>=9.2.0
scikit-image>=0.19.3
Expand Down

0 comments on commit 622c7ad

Please sign in to comment.