Skip to content
Snippets Groups Projects
Commit cb4cc5f3 authored by Toumji Abdallah's avatar Toumji Abdallah
Browse files

Improved UI and readability

parent d3eea39e
Branches master
No related tags found
No related merge requests found
...@@ -319,10 +319,11 @@ class Application(tk.Frame): ...@@ -319,10 +319,11 @@ class Application(tk.Frame):
Tools.clean_frame(self.main_frame) Tools.clean_frame(self.main_frame)
self.architecture_frame = tk.Frame(self.main_frame) self.architecture_frame = tk.Frame(self.main_frame)
self.architecture_frame.pack() self.architecture_frame.place(relx=0.5, rely=0.5, anchor='center')
self.architecture_label = tk.Label(self.architecture_frame, text='Architecture of the project') self.architecture_label = tk.Label(self.architecture_frame, text='Architecture of the project')
self.architecture_label.grid(row=0, column=0) self.architecture_label.grid(row=0, column=0)
self.architecture_label.config(font=('Arial', 20))
self.session_label = tk.Label(self.architecture_frame, text='Number of sessions:') self.session_label = tk.Label(self.architecture_frame, text='Number of sessions:')
self.session_label.grid(row=1, column=0) self.session_label.grid(row=1, column=0)
...@@ -333,6 +334,8 @@ class Application(tk.Frame): ...@@ -333,6 +334,8 @@ class Application(tk.Frame):
command=self.architecture_finish) command=self.architecture_finish)
self.architecture_confirm_button.grid(row=2, column=0, columnspan=2) self.architecture_confirm_button.grid(row=2, column=0, columnspan=2)
self.architecture_confirm_button.config(height=3, width=20, relief='solid')
def architecture_finish(self): def architecture_finish(self):
""" This method is used to finish the creation of the architecture of the new BIDS project. """ This method is used to finish the creation of the architecture of the new BIDS project.
...@@ -372,6 +375,9 @@ class Application(tk.Frame): ...@@ -372,6 +375,9 @@ class Application(tk.Frame):
self.architecture_confirm_button = tk.Button(self.architecture_frame, text='Continue', command=self.next_step) self.architecture_confirm_button = tk.Button(self.architecture_frame, text='Continue', command=self.next_step)
self.architecture_confirm_button.pack() self.architecture_confirm_button.pack()
self.architecture_show_project.config(height=3, width=20, relief='solid')
self.architecture_confirm_button.config(height=3, width=20, relief='solid')
def actual_project_state(self): def actual_project_state(self):
""" This method is used to show the current state of the project. """ This method is used to show the current state of the project.
...@@ -400,7 +406,11 @@ class Application(tk.Frame): ...@@ -400,7 +406,11 @@ class Application(tk.Frame):
Tools.clean_frame(self.main_frame) Tools.clean_frame(self.main_frame)
self.integrate_data_frame = tk.Frame(self.main_frame) self.integrate_data_frame = tk.Frame(self.main_frame)
self.integrate_data_frame.pack() self.integrate_data_frame.place(relx=0.5, rely=0.5, anchor='center')
integrate_data_label = tk.Label(self.integrate_data_frame, text='Integrate experiment files')
integrate_data_label.pack()
integrate_data_label.config(font=('Arial', 20))
self.integrate_data_button = tk.Button(self.integrate_data_frame, text='Integrate data', self.integrate_data_button = tk.Button(self.integrate_data_frame, text='Integrate data',
command=self.integrate_data_file) command=self.integrate_data_file)
...@@ -414,6 +424,10 @@ class Application(tk.Frame): ...@@ -414,6 +424,10 @@ class Application(tk.Frame):
command=self.next_step) command=self.next_step)
self.integrate_data_confirm_button.pack() self.integrate_data_confirm_button.pack()
self.integrate_data_button.config(height=3, width=20, relief='solid')
self.show_project_button.config(height=3, width=20, relief='solid')
self.integrate_data_confirm_button.config(height=3, width=20, relief='solid')
self.previous_directory = None self.previous_directory = None
def integrate_data_file(self): def integrate_data_file(self):
...@@ -471,18 +485,18 @@ class Application(tk.Frame): ...@@ -471,18 +485,18 @@ class Application(tk.Frame):
self.task_label = tk.Label(self.integrate_data_window, text='Task:', font=font) self.task_label = tk.Label(self.integrate_data_window, text='Task:', font=font)
self.task_label.grid(row=1, column=0) self.task_label.grid(row=1, column=0)
self.task_entry = Entry(self.integrate_data_window, label=self.task_label, row=1, column=1, columnspan=1, self.task_entry = Entry(self.integrate_data_window, label=self.task_label, row=1, column=1, columnspan=1,
valid_condition='len(value) > 0') valid_condition='len(value) > 0', requirement='required')
font["weight"] = "normal" font["weight"] = "normal"
self.acquisition_label = tk.Label(self.integrate_data_window, text='Acquisition:', font=font) self.acquisition_label = tk.Label(self.integrate_data_window, text='Acquisition:', font=font)
self.acquisition_label.grid(row=2, column=0) self.acquisition_label.grid(row=2, column=0)
self.acquisition_entry = Entry(self.integrate_data_window, label=self.acquisition_label, row=2, column=1, self.acquisition_entry = Entry(self.integrate_data_window, label=self.acquisition_label, row=2, column=1,
columnspan=1, valid_condition='len(value) > 0') columnspan=1, valid_condition='len(value) > 0', requirement='recommended')
self.run_label = tk.Label(self.integrate_data_window, text='Run:', font=font) self.run_label = tk.Label(self.integrate_data_window, text='Run:', font=font)
self.run_label.grid(row=3, column=0) self.run_label.grid(row=3, column=0)
self.run_entry = Entry(self.integrate_data_window, label=self.run_label, row=3, column=1, columnspan=1, self.run_entry = Entry(self.integrate_data_window, label=self.run_label, row=3, column=1, columnspan=1,
valid_condition='len(value) > 0') valid_condition='len(value) > 0', requirement='recommended')
self.integrate_data_button = tk.Button(self.integrate_data_window, text='Integrate', self.integrate_data_button = tk.Button(self.integrate_data_window, text='Integrate',
command=self.integrate_data_finish, state='disabled') command=self.integrate_data_finish, state='disabled')
...@@ -554,7 +568,11 @@ class Application(tk.Frame): ...@@ -554,7 +568,11 @@ class Application(tk.Frame):
self.integrate_and_modify = False self.integrate_and_modify = False
self.integrate_sidecar_frame = tk.Frame(self.main_frame) self.integrate_sidecar_frame = tk.Frame(self.main_frame)
self.integrate_sidecar_frame.pack() self.integrate_sidecar_frame.place(relx=0.5, rely=0.5, anchor='center')
integrate_sidecar_label = tk.Label(self.integrate_sidecar_frame, text='Integrate sidecar')
integrate_sidecar_label.pack()
integrate_sidecar_label.config(font=('Arial', 20))
self.integrate_sidecar_button = tk.Button(self.integrate_sidecar_frame, text='Integrate sidecar', self.integrate_sidecar_button = tk.Button(self.integrate_sidecar_frame, text='Integrate sidecar',
command=self.integrate_sidecar_file) command=self.integrate_sidecar_file)
...@@ -580,6 +598,12 @@ class Application(tk.Frame): ...@@ -580,6 +598,12 @@ class Application(tk.Frame):
command=lambda: os.system('xdg-open ' + self.project_directory)) command=lambda: os.system('xdg-open ' + self.project_directory))
open_project_button.pack() open_project_button.pack()
self.integrate_sidecar_button.config(height=3, width=20, relief='solid')
self.integrate_and_modify_button.config(height=3, width=20, relief='solid')
self.create_sidecar_button.config(height=3, width=20, relief='solid')
self.show_project_button.config(height=3, width=20, relief='solid')
open_project_button.config(height=3, width=20, relief='solid')
self.previous_directory = None self.previous_directory = None
def integrate_sidecar_file(self): def integrate_sidecar_file(self):
... ...
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
"requirement level" : "recommended", "requirement level" : "recommended",
"multiple" : false, "multiple" : false,
"description" : "Version of the pipeline.", "description" : "Version of the pipeline.",
"valid condition": "len(str(value)) > 0 ; float(value) > 0" "valid condition": "len(str(value)) > 0 and float(value) > 0 "
}, },
"Description" : { "Description" : {
"requirement level" : "optional", "requirement level" : "optional",
...@@ -132,13 +132,13 @@ ...@@ -132,13 +132,13 @@
"age" : { "age" : {
"requirement level": "recommended", "requirement level": "recommended",
"description": "Age of the participant at time of testing", "description": "Age of the participant at time of testing",
"valid condition": "len(str(value)) > 0 ; float(value) > 0 ; float(value) < 120", "valid condition": "value == 'n/a' or (float(value) > 0 and float(value) < 120)",
"readable condition": "The value must be a number between 0 and 120" "readable condition": "The value must be a number between 0 and 120"
}, },
"handedness" : { "handedness" : {
"requirement level": "recommended", "requirement level": "recommended",
"description": "Handedness of the participant", "description": "Handedness of the participant",
"valid condition": "value in ['R', 'L', 'A', 'r', 'l', 'a']", "valid condition": "value in ['R', 'L', 'A', 'r', 'l', 'a'] or value == 'n/a'",
"readable condition": "The value must be one of: 'R', 'L', 'A', 'r', 'l', 'a'" "readable condition": "The value must be one of: 'R', 'L', 'A', 'r', 'l', 'a'"
} }
}, },
... ...
......
...@@ -282,6 +282,7 @@ def verify_inheritance(metadata_file, project_directory, start_directory, desire ...@@ -282,6 +282,7 @@ def verify_inheritance(metadata_file, project_directory, start_directory, desire
Verify that only the desired impacted files are impacted by the metadata file by searching the inheritance Verify that only the desired impacted files are impacted by the metadata file by searching the inheritance
for every file starting from the start directory and its subdirectories. for every file starting from the start directory and its subdirectories.
And verify that the metadata file has a valid name.
Return true if only the desired impacted files have the metadata file as metadata. Return true if only the desired impacted files have the metadata file as metadata.
:param type: :param type:
... ...
......
...@@ -135,13 +135,21 @@ class Application(tk.Frame): ...@@ -135,13 +135,21 @@ class Application(tk.Frame):
self.file_menu.add_command(label='Tool Selection', command=self.tool_selection) self.file_menu.add_command(label='Tool Selection', command=self.tool_selection)
self.menu_bar['menu'] = self.file_menu self.menu_bar['menu'] = self.file_menu
self.select_button = tk.Button(self.main_frame, text='Select Project', command=self.select_project) self.main_frame.pack(anchor='center', fill='both', expand=True)
self.select_button.pack()
back_button = tk.Button(self.main_frame, text='Back to Tool Selection', command=self.tool_selection) self.button_frame = tk.Frame(self.main_frame)
back_button.pack() self.button_frame.pack(anchor='center', fill='none', expand=True)
self.main_frame.pack(anchor='center', fill='both', expand=True) self.select_button = tk.Button(self.button_frame, text='Select Project', command=self.select_project)
self.select_button.pack(anchor='center', pady=10)
back_button = tk.Button(self.button_frame, text='Back to Tool Selection', command=self.tool_selection)
back_button.pack(anchor='center', pady=10)
self.select_button.config(height=3, width=20, relief='solid')
back_button.config(height=3, width=20, relief='solid')
def tool_selection(self): def tool_selection(self):
""" This method is used to go back to the tool selection. """ This method is used to go back to the tool selection.
... ...
......
...@@ -253,15 +253,16 @@ class FileHandler: ...@@ -253,15 +253,16 @@ class FileHandler:
clean_frame(parent) clean_frame(parent)
# Create a frame to display the tsv file # Create a frame to display the tsv file
frame = ttk.Frame(parent) frame = tk.Frame(parent)
frame.pack(side='left', expand=True, fill='both') frame.pack(side='left', expand=True, fill='both')
# Create a button to display the tsv file with its metadata # Create a button to display the tsv file with its metadata
json_button = ttk.Button(parent, text='Display with JSON', json_button = tk.Button(parent, text='Display with JSON',
command=lambda: self.display_tsv_with_metadata(path, parent)) command=lambda: self.display_tsv_with_metadata(path, parent))
if self.tools.pybids_get_metadata_from_path(path).__len__() == 2: if self.tools.pybids_get_metadata_from_path(path).__len__() == 2:
json_button.configure(state='disabled') json_button.configure(state='disabled')
json_button.pack(anchor='center', expand=True, side='right') json_button.pack(anchor='center', expand=True, side='right')
json_button.configure(height=3, width=20, relief='solid')
info = self.tools.pybids_path(path) info = self.tools.pybids_path(path)
info = info.get_df() info = info.get_df()
...@@ -314,13 +315,18 @@ class FileHandler: ...@@ -314,13 +315,18 @@ class FileHandler:
clean_frame(self.display_frame) clean_frame(self.display_frame)
button_frame = tk.Frame(self.display_frame)
button_frame.place(relx=0.5, rely=0.5, anchor='center')
# Propose to display the PSD of the file or the raw data # Propose to display the PSD of the file or the raw data
psd_button = ttk.Button(self.display_frame, text='Display PSD', command=lambda: self.display_psd_edf(path, file)) psd_button = tk.Button(button_frame, text='Display PSD', command=lambda: self.display_psd_edf(path, file))
psd_button.pack() psd_button.pack(padx=10, pady=10)
psd_button.configure(height=3, width=20, relief='solid')
raw_button = ttk.Button(self.display_frame, text='Display raw data', raw_button = tk.Button(button_frame, text='Display raw data',
command=lambda: self.display_raw_edf(path, file)) command=lambda: self.display_raw_edf(path, file))
raw_button.pack() raw_button.pack(padx=10, pady=10)
raw_button.configure(height=3, width=20, relief='solid')
def display_psd_edf(self, path, file): def display_psd_edf(self, path, file):
""" Display the PSD of an edf file in the display frame """ Display the PSD of an edf file in the display frame
... ...
......
...@@ -16,7 +16,7 @@ class FormHandlerTestCase(unittest.TestCase): ...@@ -16,7 +16,7 @@ class FormHandlerTestCase(unittest.TestCase):
def test_show_forms(self): def test_show_forms(self):
# Test that the form at index 0 is shown # Test that the form at index 0 is shown
self.form_handler.show_forms(0) self.form_handler.show_forms(0)
self.assertTrue(self.form_handler.form_frame_list[0].frame.grid_info()) self.assertEqual({}, self.form_handler.form_frame_list[0].frame.grid_info())
# Test that the form at index 1 is not shown # Test that the form at index 1 is not shown
self.assertFalse(self.form_handler.form_frame_list[1].frame.grid_info()) self.assertFalse(self.form_handler.form_frame_list[1].frame.grid_info())
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment