Skip to content

Commit

Permalink
working on looking at config file. this refs #76
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Aug 18, 2023
1 parent fc7e91c commit 18a5d1d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
19 changes: 16 additions & 3 deletions src/hyperctui/autonomous_reconstruction/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
from hyperctui import interact_me_style, normal_style, error_style, label_in_focus_style

from hyperctui.session import SessionKeys
from hyperctui.utilities.get import Get

from hyperctui.utilities.get import Get
from hyperctui.utilities.status_message_config import StatusMessageStatus, show_status_message
from hyperctui.utilities.table import TableHandler
from hyperctui.utilities.array import formatting_list_for_print
from hyperctui.utilities.config_handler import ConfigHandler

from hyperctui.preview_file.preview_file_launcher import PreviewFileLauncher, PreviewMetadataFileLauncher, \
PreviewImageLauncher
Expand Down Expand Up @@ -374,10 +375,22 @@ def checking_state_of_projections_table(self):
qcolor=background_color)
row_index += 1

def refrech_reconstruction_table_clicked(self):
def refresh_reconstruction_table_clicked(self):
"""this is where we will check the json file in {{location TBD}} and look for tag that
list the reconstruction done!"""
pass
logging.info("User is refreshing the autonomous reconstruction table.")

folder_path = self.parent.folder_path
reconstruction_config = folder_path.reconstruction_config
if not os.path.exists(reconstruction_config):
logging.info(f"- config file {reconstruction_config} not found!")
return

logging.info(f"- config file {reconstruction_config} has been located!")
o_config = ConfigHandler(parent=self.parent)
o_config.load_reconstruction_config()





Expand Down
Empty file.
3 changes: 2 additions & 1 deletion src/hyperctui/hyperctui.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
class HyperCTui(QMainWindow):
log_id = None # UI id of the logger
config = None # config dictionary
reconstruction_config = None # config of the

log_buffer_size = 500 # 500 lines

Expand Down Expand Up @@ -478,7 +479,7 @@ def autonomous_refresh_table_clicked(self):

def autonomous_checking_reconstruction_clicked(self):
o_event = AutonomousReconstructionHandler(parent=self)
o_event.refrech_reconstruction_table_clicked()
o_event.refresh_reconstruction_table_clicked()

# leaving ui
def closeEvent(self, c):
Expand Down
9 changes: 9 additions & 0 deletions src/hyperctui/utilities/config_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ def load(self):
level=logging.INFO)
logging.info("*** Starting a new session ***")
logging.info(f" Version: {versioneer.get_version()}")

def load_reconstruction_config(self, file_name=None):
if not os.path.exists(file_name):
return

with open(file_name) as f:
config = json.load(f)

self.parent.reconstruction_config = config
18 changes: 15 additions & 3 deletions src/hyperctui/utilities/folder_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from hyperctui.parent import Parent
from hyperctui.session import SessionKeys

RECONSTRUCTION_CONFIG = "reconstruction_config.json"


class FolderPath(Parent):
"""
Expand All @@ -19,6 +21,7 @@ class FolderPath(Parent):
nexus = None
mcp_raw = None
recon = None
reconstruction_config = None # json file created/updated by Shimin's code

def update(self):

Expand All @@ -42,12 +45,18 @@ def update(self):
self.mcp()
self.recon(title=title)
self.create_mcp_raw()
self.svmbir_config(title=title)

def __repr__(self):
return f"folder_path:\n" + \
f"- shared: \t\t{self.shared}\n- autoreduce: \t{self.autoreduce}" + \
f"\n- mcp: \t\t\t{self.mcp}\n- reduction_log: {self.reduction_log}\n- nexus: \t\t{self.nexus}" + \
f"\n- mcp_raw: \t\t{self.mcp_raw}\n- recon: \t\t{self.recon}"
f"- shared: \t\t{self.shared}\n" \
f"- autoreduce: \t{self.autoreduce}\n" + \
f"- mcp: \t\t{self.mcp}\n" \
f"- reduction_log:{self.reduction_log}\n" \
f"- nexus: \t\t{self.nexus}\n" + \
f"- mcp_raw: \t{self.mcp_raw}\n" \
f"- recon: \t\t{self.recon}\n" \
f"- reconstruction_config: {self.reconstruction_config}\n"

def shared(self):
self.shared = os.sep.join([self.ipts_full_path, "shared"])
Expand All @@ -74,3 +83,6 @@ def create_mcp_raw(self):
self.mcp_raw = os.sep.join([self.ipts_full_path,
'images',
'mcp'])

def svmbir_config(self, title=None):
self.reconstruction_config = os.sep.join([self.shared, "insitu_recon", title, RECONSTRUCTION_CONFIG])

0 comments on commit 18a5d1d

Please sign in to comment.