Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Syncing last changes including rw permission bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LP-CDF committed Jun 10, 2021
1 parent 2a654b7 commit 1524134
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
28 changes: 16 additions & 12 deletions AMi_Image_Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def initUI(self):
self.radioButton_ScoreCrystal.setStyleSheet("""color: green;""")
self.radioButton_ScorePhaseSep.setStyleSheet("""color: orange;""")
self.radioButton_ScoreOther.setStyleSheet("""color: magenta;""")
self.radioButton_ScoreUnknown.setStyleSheet("""background-color:yellow ; color: black;""")
self.radioButton_ScoreUnknown.setStyleSheet("""color: black;""")

#Listen Scoring RadioButtons
self.radioButton_ScoreClear.toggled.connect(lambda:self.ScoreDrop(self.radioButton_ScoreClear, self.currentWell))
Expand Down Expand Up @@ -367,17 +367,18 @@ def AutoCrop(self):
return

path=Path(self.imageDir).joinpath("cropped")
ensure_directory(path)

_f=ensure_directory(path)
if _f is not None: #if Permission issue
self.handle_error(f"> {_f}\n\nYou must change the permissions to continue")
return

errors, error_list = 0, []

count, size=0, len(self.files)

progress = QProgressDialog("Processing files...", "Abort", 0, size)
progress.setWindowTitle("AutoCrop")
progress.setMinimumWidth(300)
progress.setModal(True)


for _file in self.files:
progress.setValue(count+1)
Expand Down Expand Up @@ -980,19 +981,22 @@ def check_previous_notes(self, path, current_date):
return
most_recent = self.compare_most_recent(most_recent, date)
newPath = path.joinpath(current_date)
_f=ensure_directory(newPath)
if _f is not None: #if Permission issue
self.handle_error(f"> {_f}\n\nYou must change the permissions and reload the directory to continue")
return
# self.handle_error(f"> {ensure_directory(newPath)}\n\nThe program will quit")
# loop = QtCore.QEventLoop()
# QtCore.QTimer.singleShot(3000, loop.quit)
# loop.exec_()
# sys.exit()

if len(os.listdir(path)) !=0:
if len(os.listdir(path)) !=1: #if not first time more than one folder is present
path=path.joinpath(most_recent)
ensure_directory(newPath)
if not newPath.exists():
newPath.mkdir()

for file in path.iterdir():
copyfile(str(file), str(newPath.joinpath(file.name)))
print("> Copied previous notes from: " + most_recent)
print("> ")
else:
ensure_directory(newPath)


def LoadNotes(self, path, date, well):
Expand Down
4 changes: 4 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2021/05/20
Clicking a well in the Timeline spawns a new viewing window.
Added the option to class as "Unknown" in the drop score section.

2021/03/11:
Default folder tree has one more folder (see case 2 in INSTALL.txt).
If the local tree does not have this folder, use the following command at install "python3 Setup.py --no-ProjectID".
Expand Down
3 changes: 1 addition & 2 deletions tools/Merge_AllNewPlates.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
_rawimages="rawimages"

__version__ = "0.1"
__author__ = "Ludovic Pecqueur (ludovic.pecqueur \at college-de-france.fr)"
__date__ = "04-03-2021"
__date__ = "20-05-2021"
__license__ = "New BSD http://www.opensource.org/licenses/bsd-license.php"


Expand Down
4 changes: 4 additions & 0 deletions tools/SaveDiskSpace.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import shutil
import argparse

__version__ = "0.1"
__date__ = "20-05-2021"
__license__ = "New BSD http://www.opensource.org/licenses/bsd-license.php"

#Define below the name of the folder containing unstacked Z images.
_rawimages="rawimages"

Expand Down
5 changes: 4 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ def ensure_directory(file_path):
"""Checks the given file path for a directory, and creates one if not already present.
Args:
file_path: a pathlib.Path
returns the err message if permission issue, else is None
"""
if not file_path.exists(): file_path.mkdir()
if not file_path.exists():
try: file_path.mkdir()
except Exception as err: return err


class initProject(object):
Expand Down

0 comments on commit 1524134

Please sign in to comment.