Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build-macos_pyqt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install -e .
python -m pip install -r requirements_gui_pyqt5.txt
python -m pip install -r requirements_test.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -40,4 +41,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
pytest -vv -s
3 changes: 2 additions & 1 deletion .github/workflows/build-macos_pyqt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install -e .
python -m pip install -r requirements_gui_pyqt6.txt
python -m pip install -r requirements_test.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -40,4 +41,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
pytest -vv -s
3 changes: 2 additions & 1 deletion .github/workflows/build-ubuntu_pyqt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install -e .
python -m pip install -r requirements_gui_pyqt5.txt
python -m pip install -r requirements_test.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -46,4 +47,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
pytest -vv -s
3 changes: 2 additions & 1 deletion .github/workflows/build-windows_pyqt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
python -m pip install flake8 pytest
python -m pip install -e .
python -m pip install -r requirements_gui_pyqt5.txt
python -m pip install -r requirements_test.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -39,4 +40,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
pytest -vv -s
3 changes: 2 additions & 1 deletion .github/workflows/build-windows_pyqt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
python -m pip install flake8 pytest
python -m pip install -e .
python -m pip install -r requirements_gui_pyqt6.txt
python -m pip install -r requirements_test.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -39,4 +40,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
pytest -vv -s
2 changes: 1 addition & 1 deletion cellacdc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _warn_ask_install_package(
print(text)

message_on_exit = (
'[WARNING]: Execution aborted. Run the following commands before '
'[WARNING]: Execution cancelled. Run the following commands before '
f'running spotMAX again:\n\n{commands_txt}\n'
)
msg_on_invalid = (
Expand Down
18 changes: 9 additions & 9 deletions cellacdc/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ def getSelectedPosPath(self, utilityName):
buttonsTexts=('Cancel', 'Ok')
)
if msg.cancel:
print(f'{utilityName} aborted by the user.')
print(f'{utilityName} cancelled by the user.')
return

mostRecentPath = myutils.getMostRecentPath()
Expand All @@ -1038,7 +1038,7 @@ def getSelectedPosPath(self, utilityName):
mostRecentPath
)
if not exp_path:
print(f'{utilityName} aborted by the user.')
print(f'{utilityName} cancelled by the user.')
return

myutils.addToRecentPaths(exp_path)
Expand Down Expand Up @@ -1072,7 +1072,7 @@ def getSelectedPosPath(self, utilityName):
buttonsTexts=('Cancel', 'Try again')
)
if msg.cancel:
print(f'{utilityName} aborted by the user.')
print(f'{utilityName} cancelled by the user.')
return

if len(posFolders) > 1:
Expand Down Expand Up @@ -1111,7 +1111,7 @@ def getSelectedExpPaths(
buttonsTexts=('Cancel', 'Ok')
)
if msg.cancel:
self.logger.info(f'{utilityName} aborted by the user.')
self.logger.info(f'{utilityName} cancelled by the user.')
return

expPaths = {}
Expand Down Expand Up @@ -1150,7 +1150,7 @@ def getSelectedExpPaths(
if not selected_exp_paths:
cancel = self.warnNoValidExpPaths(exp_path)
if cancel:
self.logger.info(f'{utilityName} aborted by the user.')
self.logger.info(f'{utilityName} cancelled by the user.')
return
continue

Expand All @@ -1162,7 +1162,7 @@ def getSelectedExpPaths(
selected_path, exp_path
)
if not proceed:
self.logger.info(f'{utilityName} aborted by the user.')
self.logger.info(f'{utilityName} cancelled by the user.')
return
warn_exp_already_selected = False
expPaths[exp_path].extend(pos_folders)
Expand All @@ -1185,7 +1185,7 @@ def getSelectedExpPaths(
break

if not expPaths:
self.logger.info(f'{utilityName} aborted by the user.')
self.logger.info(f'{utilityName} cancelled by the user.')
return

if len(expPaths) > 1 or is_multi_pos:
Expand All @@ -1197,7 +1197,7 @@ def getSelectedExpPaths(
)
selectPosWin.exec_()
if selectPosWin.cancel:
self.logger.info(f'{utilityName} aborted by the user.')
self.logger.info(f'{utilityName} cancelled by the user.')
return
selectedExpPaths = selectPosWin.selectedPaths
else:
Expand Down Expand Up @@ -1839,7 +1839,7 @@ def _showDataStructWin(self):
buttonsTexts=('Cancel', *buttons)
)
if msg.cancel:
self.logger.info('Creating data structure process aborted by the user.')
self.logger.info('Creating data structure process cancelled by the user.')
self.restoreDefaultButtons()
return

Expand Down
14 changes: 12 additions & 2 deletions cellacdc/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,21 @@ def download_model_params():
)
print(e)
pass

def _setup_app(splashscreen=False, icon_path=None, logo_path=None, scheme=None):
from qtpy import QtCore
if QtCore.QCoreApplication.instance() is not None:
return QtCore.QCoreApplication.instance(), None
class DummySplashScreen:
def __init__(self):
pass

def show(self):
pass

def close(self):
pass

return QtCore.QCoreApplication.instance(), DummySplashScreen()

from qtpy import QtWidgets
# Handle high resolution displays:
Expand Down
4 changes: 2 additions & 2 deletions cellacdc/cca_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def configuration_dialog():
win.exec_()
if win.cancel:
print('******************************')
print('Execution aborted by the user')
print('Execution cancelled by the user')
print('******************************')
raise InterruptedError
pos = win.selectedItemsText
Expand Down Expand Up @@ -131,7 +131,7 @@ def get_segm_endname(images_path, basename):
)
selectSegmWin.exec_()
if selectSegmWin.cancel:
raise FileNotFoundError(f'Segmentation file selection aborted by the user.')
raise FileNotFoundError(f'Segmentation file selection cancelled by the user.')

return selectSegmWin.selectedItemsText[0]

Expand Down
2 changes: 1 addition & 1 deletion cellacdc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def quit(self, error=None):
print('-'*60)
self.logger.info(f'[ERROR]: {error}{error_up_str}')
err_msg = (
'Cell-ACDC aborted due to **error**. '
'Cell-ACDC cancelled due to **error**. '
'More details above or in the following log file:\n\n'
f'{self.log_path}\n\n'
'If you cannot solve it, you can report this error by opening '
Expand Down
34 changes: 32 additions & 2 deletions cellacdc/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@
try:
import networkx as nx
NETWORKX_INSTALLED = True
except:
except Exception as err:
NETWORKX_INSTALLED = False

try:
from vispy.color import Colormap as VisPyColormap
except Exception as err:
pass

__all__ = ['ColorMap']

FLUO_CHANNELS_COLORS = {
Expand Down Expand Up @@ -366,4 +371,29 @@ def grayscale_apply_lut(image, lut):

def get_complementary_color(rgba_str: str) -> str:
r, g, b, a = rgba_str_to_values(rgba_str)
return f'rgba({255 - r}, {255 - g}, {255 - b}, {a})'
return f'rgba({255 - r}, {255 - g}, {255 - b}, {a})'

def pg_to_vispy_cmap(pg_cmap, n=256):
"""Convert PyQtGraph colormap to vispy

Parameters
----------
pg_cmap : pyqtgraph.colormap.ColorMap
PyQtGraph Colormap. For example, it can be obtained with
`pyqtgraph.HistogramLUTItem.gradient.colorMap()`
n : int, optional
Number of colors, by default 256

Returns
-------
vispy.color.Colormap
VisPy colormap
"""

# Sample the colormap
colors = pg_cmap.getLookupTable(0.0, 1.0, n)

# Normalize to 0–1 (VisPy expects floats)
colors = np.array(colors) / 255.0

return VisPyColormap(colors)
2 changes: 1 addition & 1 deletion cellacdc/dataPrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2347,7 +2347,7 @@ def prepData(self, event):
)
if msg.cancel:
self.setEnabledCropActions(True)
self.titleLabel.setText('Process aborted', color='w')
self.titleLabel.setText('Process cancelled', color='w')
return
if yes == msg.clickedButton:
doZip = True
Expand Down
6 changes: 3 additions & 3 deletions cellacdc/dataStruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ def checkInstallPythonBioformats(self, parent):
cancel = myutils.install_javabridge_help(parent=self)
if cancel:
raise ModuleNotFoundError(
'User aborted javabridge installation'
'User cancelled javabridge installation'
)

isGitInstalled = myutils.check_git_installed(parent=self)
Expand Down Expand Up @@ -1357,7 +1357,7 @@ def checkInstallPythonBioformats(self, parent):
cancel = myutils.install_java()
if cancel:
raise ModuleNotFoundError(
'User aborted Java installation'
'User cancelled Java installation'
)
return

Expand All @@ -1371,7 +1371,7 @@ def checkInstallPythonBioformats(self, parent):
cancel = myutils.install_java()
if cancel:
raise ModuleNotFoundError(
'User aborted Java installation'
'User cancelled Java installation'
)
return
myutils.install_javabridge(
Expand Down
Loading
Loading