Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

182 polish project #196

Merged
merged 20 commits into from
Apr 25, 2024
43 changes: 40 additions & 3 deletions GoVizzy/GoVizzy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,53 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "c31b2aca",
"metadata": {
"scrolled": true
},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3fd86141c62946fdb54b45d45f866c79",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"AppLayout(children=(HBox(children=(Output(layout=Layout(height='100%', width='70%')), VBox(children=(HBox(chil…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2cb54f0ea44448098ff04764f5fa88c5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(Text(value='', description='File Name:'), Button(description='Submit', style=ButtonStyle())), l…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%run Main.py\n",
"%matplotlib widget\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d3249bf7-7b2d-4e2d-bf95-d9cb12a45992",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -53,7 +90,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
19 changes: 8 additions & 11 deletions GoVizzy/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@ def handle_submit_button_clicked(b):
source_path = fileInput.find_source_path(fileName, directory)
if source_path:
print(f"Source file found: {source_path}")
unique_file_name = fileInput.generate_unique_filename(fileName, directory)
destination_path = os.path.join(directory, unique_file_name)
success = fileInput.copy_file(source_path, destination_path)
if success:
new_cube = cv.Cube()
new_cube.load_cube(destination_path)
DisplayUI.show_ui()
DisplayUI.display_cube(new_cube)
DisplayUI.display_app()
file_input.layout.visibility = 'hidden' # Hide the file input widget
submit_button.layout.visibility = 'hidden' # Hide the submit button widget
destination_path = os.path.join(directory, fileName)
new_cube = cv.Cube()
new_cube.load_cube(source_path)
DisplayUI.show_ui()
DisplayUI.display_cube(new_cube)
DisplayUI.display_app()
file_input.layout.visibility = 'hidden' # Hide the file input widget
submit_button.layout.visibility = 'hidden' # Hide the submit button widget


# Handlers for dropdown change and button clicks
Expand Down
29 changes: 12 additions & 17 deletions GoVizzy/gv_ui/gv_ui/DisplayUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

# Define globals
selected_option ='Slice Options'
options = ['Slice Options', 'Mesh Options'] #, 'Color Options']
options = ['Slice Options', 'Mesh Options']
dropdown = Dropdown(options=options, value=options[0], layout=Layout(margin='5px 0 0 5px'));
large_box = Output(layout=Layout(width="70%", height="100%"))
selected_view_options = Output(layout=Layout(width="auto", height="300px"))
selected_view_options = Output(layout=Layout(width="auto", height='500px'))
slice_picker = Output(layout=Layout(flex= '1',border='1px solid black'))
slice_picker_descr = widgets.Label(value="Slice Picker", layout=Layout(margin='5px 0 0 5px'))
exit_button = widgets.Button(description='[X]', button_style='danger',border='1px solid black')
exit_button.layout.margin = '0 0 0 auto' # Add margin to the left to push it to the right
in_app_exit = widgets.Button(description='[X]', button_style='danger',border='1px solid black')

newCube_button = Button(description='New Cube', layout=Layout(flex= '1', border='1px solid black'))
spacer = Output( layout=Layout(flex= '1'))
newCube_button = Button(description='New Cube', layout=Layout(width = 'auto', border='1px solid black'))
save_button = Button(description='Save', layout=Layout(flex= '1', border='1px solid black'))

# atom mesh globals
Expand Down Expand Up @@ -106,7 +106,7 @@ def display_app():
# Containers for right menu
global atom_meshes, visualizer
top_container = HBox([dropdown, in_app_exit])
bottom_container = HBox([newCube_button, save_button])


with selected_view_options:
selected_view_options.clear_output()
Expand All @@ -122,7 +122,8 @@ def display_app():
gvWidgets.slice_z_slider,
gvWidgets.slice_z_check,
gvWidgets.slice_color,
figure_controls,])
figure_controls,
newCube_button])
display(slice_box)


Expand All @@ -143,25 +144,19 @@ def display_app():
gvWidgets.bond_visibility_toggle,
gvWidgets.bond_color_picker,
gvWidgets.bond_scale_slider,
figure_controls])
figure_controls,
newCube_button])
display(mesh_box)





elif selected_option == 'Color Options':
#ADD color controls here
pass




else:
print("Invalid option selected")

# Display the layout
view_bar = VBox([top_container, selected_view_options, bottom_container], layout=Layout(flex='1'))
button_container = VBox([newCube_button], layout=Layout(justify_content='flex-end'))
view_bar = VBox([top_container, selected_view_options],
layout=Layout(flex='1'))

display_box = HBox([large_box, view_bar])
app_layout = AppLayout(header=None, left_sidebar=None, center=display_box,
Expand Down