Skip to content

Commit

Permalink
fix: pytest error
Browse files Browse the repository at this point in the history
  • Loading branch information
ElpadoCan committed Jun 19, 2023
1 parent ad86ba7 commit a867a90
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
13 changes: 8 additions & 5 deletions cellacdc/__init__.py
Expand Up @@ -18,11 +18,14 @@
# Load default light mode
shutil.copyfile(qrc_resources_light_path, qrc_resources_path)

with open(qrc_resources_path, 'r') as qrc_py:
text = qrc_py.read()
text = text.replace('from PyQt5', 'from qtpy')
with open(qrc_resources_path, 'w') as qrc_py:
qrc_py.write(text)
try:
with open(qrc_resources_path, 'r') as qrc_py:
text = qrc_py.read()
text = text.replace('from PyQt5', 'from qtpy')
with open(qrc_resources_path, 'w') as qrc_py:
qrc_py.write(text)
except Exception as err:
raise err

try:
import qtpy
Expand Down
14 changes: 12 additions & 2 deletions cellacdc/gui.py
Expand Up @@ -8947,7 +8947,12 @@ def addDelROI(self, event):
self.fixCcaDfAfterEdit('Delete IDs using ROI')
self.updateAllImages()
else:
self.warnEditingWithCca_df('Delete IDs using ROI')
cancelled_str = self.warnEditingWithCca_df(
'Delete IDs using ROI', get_cancelled=True
)
if cancelled_str == 'cancelled':
self.roi_to_del = roi
self.removeDelROI()

def replacePolyLineRoiWithLineRoi(self, roi):
roi = self.polyLineRoi
Expand Down Expand Up @@ -18050,7 +18055,10 @@ def fixCcaDfAfterEdit(self, editTxt):
self.update_cca_df_snapshots(editTxt, posData)
self.store_data()

def warnEditingWithCca_df(self, editTxt, return_answer=False, get_answer=False):
def warnEditingWithCca_df(
self, editTxt, return_answer=False, get_answer=False,
get_cancelled=False
):
# Function used to warn that the user is editing in "Segmentation and
# Tracking" mode a frame that contains cca annotations.
# Ask whether to remove annotations from all future frames
Expand Down Expand Up @@ -18099,6 +18107,8 @@ def warnEditingWithCca_df(self, editTxt, return_answer=False, get_answer=False):
), widgets=checkBox
)
if msg.cancel:
if get_cancelled:
return 'cancelled'
removeAnnotations = False
return removeAnnotations

Expand Down

0 comments on commit a867a90

Please sign in to comment.