Skip to content

Commit

Permalink
Started work on data_path_select from config
Browse files Browse the repository at this point in the history
  • Loading branch information
llegregam committed May 17, 2024
1 parent d2896c0 commit 7cd6781
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions physiofit/ui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
import pandas as pd
import streamlit as st

logger = logging.getLogger("physiofit")
logger.setLevel(logging.DEBUG)

import physiofit
from physiofit.base.io import IoHandler, ConfigParser
from physiofit.models.base_model import StandardDevs

logger = logging.getLogger("physiofit")
logger.setLevel(logging.DEBUG)


class App:
"""
Physiofit Graphical User Interface
Expand Down Expand Up @@ -94,6 +95,11 @@ def _initialize_opt_menu(self):
try:
# Get parameters from yaml file
self.config_parser = self.io.read_yaml(self.data_file)
# Check if the data path exists, if not open up prompt to
# select file
# if not self.config_parser.check_data_path():
# self._output_directory_selector()
# else:
# Load data into io_handler
self.io.data = self.io.read_data(
self.config_parser.path_to_data)
Expand Down Expand Up @@ -154,7 +160,7 @@ def _initialize_opt_menu(self):
handler.setLevel(logging.DEBUG)
stream.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %('
'levelname)s - %(message)s')
'levelname)s - %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.addHandler(stream)
Expand Down Expand Up @@ -398,7 +404,7 @@ def _initialize_opt_menu_widgets(self, file_extension):
with col2:
st.write("Parameter Value")
for key, value in self.model.args[
param].items():
param].items():
st.text_input(
label="label", # Unused
label_visibility="collapsed",
Expand Down Expand Up @@ -501,7 +507,7 @@ def _get_data_from_session_state(self):
for key in self.model.args[param].keys():
try:
if st.session_state[
f"Fixed_{param}_value_{key}"] == "0":
f"Fixed_{param}_value_{key}"] == "0":
self.model.args[param][key] = 0
else:
self.model.args[param][key] = literal_eval(
Expand Down Expand Up @@ -550,19 +556,19 @@ def _build_fitter_kwargs(self):

def _output_directory_selector(self):

# Set up tkinter for directory chooser
root = tk.Tk()
root.withdraw()

# Make folder picker dialog appear on top of other windows
root.wm_attributes('-topmost', 1)

# Initialize folder picker button and add logic
clicked = st.button(
"Select output data directory", key="clicker"
)
if clicked:

# Set up tkinter for directory chooser
root = tk.Tk()
root.withdraw()

# Make folder picker dialog appear on top of other windows
root.wm_attributes('-topmost', 1)

# Initialize home path from directory selector and add
# to session state
st.session_state.wkdir = Path(st.text_input(
Expand Down

0 comments on commit 7cd6781

Please sign in to comment.