From f9bc9d91d0476e86a5b7f03eedca6994d7a24ed9 Mon Sep 17 00:00:00 2001 From: abdellah Date: Tue, 14 Apr 2020 09:43:31 +0200 Subject: [PATCH] Adding documentation panel per page. --- nmv/interface/ui/about/about_panel.py | 4 +- nmv/interface/ui/edit/edit_panel.py | 51 ++++++++++++++----- nmv/interface/ui/io/io_panel.py | 35 +++++++++++++ nmv/interface/ui/mesh/mesh_panel.py | 47 +++++++++++++---- .../ui/morphology/morphology_panel.py | 47 +++++++++++++---- nmv/interface/ui/soma/soma_panel.py | 47 +++++++++++++---- nmv/skeleton/ops/skeleton_connection_ops.py | 2 +- 7 files changed, 186 insertions(+), 47 deletions(-) diff --git a/nmv/interface/ui/about/about_panel.py b/nmv/interface/ui/about/about_panel.py index 3df3e4e80..a5fb6a159 100644 --- a/nmv/interface/ui/about/about_panel.py +++ b/nmv/interface/ui/about/about_panel.py @@ -100,8 +100,8 @@ def draw(self, update_button = layout.column() update_button.operator('update.nmv', emboss=True, icon='NODETREE') - update_button.operator('open.github', emboss=True, icon='URL') - update_button.operator('open.wiki', emboss=True, icon='SCRIPT') + update_button.operator('open.github', emboss=True, icon='SCRIPT') + update_button.operator('open.wiki', emboss=True, icon='URL') #################################################################################################### diff --git a/nmv/interface/ui/edit/edit_panel.py b/nmv/interface/ui/edit/edit_panel.py index 7249bc8b6..975091066 100644 --- a/nmv/interface/ui/edit/edit_panel.py +++ b/nmv/interface/ui/edit/edit_panel.py @@ -73,6 +73,11 @@ def draw(self, # Get a reference to the panel layout layout = self.layout + # Documentation button + documentation_button = layout.column() + documentation_button.operator('nmv.documentation_editing', icon='URL') + documentation_button.separator() + # Morphology sketching button if not in_edit_mode: sketching_morphology_column = layout.column(align=True) @@ -303,6 +308,34 @@ def execute(self, return {'FINISHED'} +#################################################################################################### +# @MorphologyEditingDocumentation +#################################################################################################### +class MorphologyEditingDocumentation(bpy.types.Operator): + """Open the documentation page of the Morphology Editing panel.""" + + # Operator parameters + bl_idname = "nmv.documentation_editing" + bl_label = "Documentation" + + ################################################################################################ + # @execute + ################################################################################################ + def execute(self, + context): + """Execute the operator. + + :param context: + Blender context + :return: + 'FINISHED' + """ + + import webbrowser + webbrowser.open('https://github.com/BlueBrain/NeuroMorphoVis/wiki/Morphology-Editing') + return {'FINISHED'} + + #################################################################################################### # @register_panel #################################################################################################### @@ -313,16 +346,11 @@ def register_panel(): # Morphology analysis panel bpy.utils.register_class(EditPanel) - # Morphology analysis button + # Buttons + bpy.utils.register_class(MorphologyEditingDocumentation) bpy.utils.register_class(SketchSkeleton) - - # Edit morphology coordinates button bpy.utils.register_class(EditMorphologyCoordinates) - - # Morphology analysis button bpy.utils.register_class(UpdateMorphologyCoordinates) - - # Export morphology as SWC file bpy.utils.register_class(ExportMorphologySWC) @@ -336,14 +364,9 @@ def unregister_panel(): # Morphology analysis panel bpy.utils.unregister_class(EditPanel) - # Morphology analysis button + # Buttons + bpy.utils.unregister_class(MorphologyEditingDocumentation) bpy.utils.unregister_class(SketchSkeleton) - - # Edit morphology coordinates button bpy.utils.unregister_class(EditMorphologyCoordinates) - - # Update the coordinates bpy.utils.unregister_class(UpdateMorphologyCoordinates) - - # Export the morphology bpy.utils.unregister_class(ExportMorphologySWC) diff --git a/nmv/interface/ui/io/io_panel.py b/nmv/interface/ui/io/io_panel.py index 007fc9f2f..7048fb6ef 100644 --- a/nmv/interface/ui/io/io_panel.py +++ b/nmv/interface/ui/io/io_panel.py @@ -62,6 +62,11 @@ def draw(self, context): # Get a reference to the scene scene = context.scene + # Documentation button + documentation_button = layout.column() + documentation_button.operator('nmv.documentation_io', icon='URL') + documentation_button.separator() + # Input data options input_data_options_row = layout.row() input_data_options_row.label(text='Input Data Options:', icon='LIBRARY_DATA_DIRECT') @@ -257,6 +262,34 @@ def execute(self, return {'FINISHED'} +#################################################################################################### +# @InputOutputDocumentation +#################################################################################################### +class InputOutputDocumentation(bpy.types.Operator): + """Open the documentation page of the IO module.""" + + # Operator parameters + bl_idname = "nmv.documentation_io" + bl_label = "Documentation" + + ################################################################################################ + # @execute + ################################################################################################ + def execute(self, + context): + """Execute the operator. + + :param context: + Blender context + :return: + 'FINISHED' + """ + + import webbrowser + webbrowser.open('https://github.com/BlueBrain/NeuroMorphoVis/wiki/Input-&-Output') + return {'FINISHED'} + + #################################################################################################### # @register_panel #################################################################################################### @@ -267,6 +300,7 @@ def register_panel(): bpy.utils.register_class(IOPanel) # Buttons + bpy.utils.register_class(InputOutputDocumentation) bpy.utils.register_class(LoadMorphology) @@ -283,4 +317,5 @@ def unregister_panel(): bpy.utils.unregister_class(IOPanel) # Buttons + bpy.utils.unregister_class(InputOutputDocumentation) bpy.utils.unregister_class(LoadMorphology) diff --git a/nmv/interface/ui/mesh/mesh_panel.py b/nmv/interface/ui/mesh/mesh_panel.py index 5cf3aee59..79a056309 100644 --- a/nmv/interface/ui/mesh/mesh_panel.py +++ b/nmv/interface/ui/mesh/mesh_panel.py @@ -83,6 +83,11 @@ def draw(self, Rendering context. """ + # Documentation button + documentation_button = self.layout.column() + documentation_button.operator('nmv.documentation_mesh', icon='URL') + documentation_button.separator() + # Meshing options draw_meshing_options(panel=self, scene=context.scene) @@ -573,6 +578,34 @@ def execute(self, context): return {'FINISHED'} +#################################################################################################### +# @InputOutputDocumentation +#################################################################################################### +class MeshReconstructionDocumentation(bpy.types.Operator): + """Open the documentation page of the Mesh Reconstruction panel.""" + + # Operator parameters + bl_idname = "nmv.documentation_mesh" + bl_label = "Documentation" + + ################################################################################################ + # @execute + ################################################################################################ + def execute(self, + context): + """Execute the operator. + + :param context: + Blender context + :return: + 'FINISHED' + """ + + import webbrowser + webbrowser.open('https://github.com/BlueBrain/NeuroMorphoVis/wiki/Mesh-Reconstruction') + return {'FINISHED'} + + #################################################################################################### # @register_panel #################################################################################################### @@ -582,16 +615,13 @@ def register_panel(): # Mesh reconstruction panel bpy.utils.register_class(MeshPanel) - # Mesh reconstruction button + # Buttons + bpy.utils.register_class(MeshReconstructionDocumentation) bpy.utils.register_class(ReconstructNeuronMesh) - - # Mesh rendering bpy.utils.register_class(RenderMeshFront) bpy.utils.register_class(RenderMeshSide) bpy.utils.register_class(RenderMeshTop) bpy.utils.register_class(RenderMesh360) - - # Neuron mesh saving operators bpy.utils.register_class(ExportMesh) @@ -604,15 +634,12 @@ def unregister_panel(): # Mesh reconstruction panel bpy.utils.unregister_class(MeshPanel) - # Mesh reconstruction button + # Buttons + bpy.utils.unregister_class(MeshReconstructionDocumentation) bpy.utils.unregister_class(ReconstructNeuronMesh) - - # Mesh rendering bpy.utils.unregister_class(RenderMeshFront) bpy.utils.unregister_class(RenderMeshSide) bpy.utils.unregister_class(RenderMeshTop) bpy.utils.unregister_class(RenderMesh360) - - # Neuron mesh saving operators bpy.utils.unregister_class(ExportMesh) diff --git a/nmv/interface/ui/morphology/morphology_panel.py b/nmv/interface/ui/morphology/morphology_panel.py index bf5b83d1e..7acea466e 100644 --- a/nmv/interface/ui/morphology/morphology_panel.py +++ b/nmv/interface/ui/morphology/morphology_panel.py @@ -78,6 +78,11 @@ def draw(self, context): # Get a reference to the scene current_scene = context.scene + # Documentation button + documentation_button = layout.column() + documentation_button.operator('nmv.documentation_morphology', icon='URL') + documentation_button.separator() + # Set the reconstruction options nmv.interface.ui.morphology_panel_ops.set_reconstruction_options( layout=layout, scene=current_scene, options=nmv.interface.ui_options) @@ -835,6 +840,34 @@ def execute(self, return {'FINISHED'} +#################################################################################################### +# @MorphologyReconstructionDocumentation +#################################################################################################### +class MorphologyReconstructionDocumentation(bpy.types.Operator): + """Open the documentation page of the Morphology Reconstruction panel.""" + + # Operator parameters + bl_idname = "nmv.documentation_morphology" + bl_label = "Documentation" + + ################################################################################################ + # @execute + ################################################################################################ + def execute(self, + context): + """Execute the operator. + + :param context: + Blender context + :return: + 'FINISHED' + """ + + import webbrowser + webbrowser.open('https://github.com/BlueBrain/NeuroMorphoVis/wiki/Morphology-Reconstruction') + return {'FINISHED'} + + #################################################################################################### # @register_panel #################################################################################################### @@ -844,17 +877,14 @@ def register_panel(): # Soma reconstruction panel bpy.utils.register_class(MorphologyPanel) - # Soma reconstruction operator + # Buttons + bpy.utils.register_class(MorphologyReconstructionDocumentation) bpy.utils.register_class(ReconstructMorphologyOperator) - - # Morphology rendering bpy.utils.register_class(RenderMorphologyFront) bpy.utils.register_class(RenderMorphologySide) bpy.utils.register_class(RenderMorphologyTop) bpy.utils.register_class(RenderMorphology360) bpy.utils.register_class(RenderMorphologyProgressive) - - # Saving morphology bpy.utils.register_class(SaveMorphologyBLEND) bpy.utils.register_class(SaveMorphologySWC) bpy.utils.register_class(SaveMorphologySegments) @@ -869,17 +899,14 @@ def unregister_panel(): # Morphology reconstruction panel bpy.utils.unregister_class(MorphologyPanel) - # Morphology reconstruction operator + # Buttons + bpy.utils.unregister_class(MorphologyReconstructionDocumentation) bpy.utils.unregister_class(ReconstructMorphologyOperator) - - # Morphology rendering bpy.utils.unregister_class(RenderMorphologyTop) bpy.utils.unregister_class(RenderMorphologySide) bpy.utils.unregister_class(RenderMorphologyFront) bpy.utils.unregister_class(RenderMorphology360) bpy.utils.unregister_class(RenderMorphologyProgressive) - - # Saving morphology bpy.utils.unregister_class(SaveMorphologyBLEND) bpy.utils.unregister_class(SaveMorphologySWC) bpy.utils.unregister_class(SaveMorphologySegments) diff --git a/nmv/interface/ui/soma/soma_panel.py b/nmv/interface/ui/soma/soma_panel.py index a9bda76b5..5908aebd7 100644 --- a/nmv/interface/ui/soma/soma_panel.py +++ b/nmv/interface/ui/soma/soma_panel.py @@ -70,6 +70,11 @@ def draw(self, context): # Get a reference to the panel layout layout = self.layout + # Documentation button + documentation_button = layout.column() + documentation_button.operator('nmv.documentation_soma', icon='URL') + documentation_button.separator() + # Get a reference to the soma options soma_options = nmv.interface.ui_options.soma @@ -1095,6 +1100,34 @@ def execute(self, return {'FINISHED'} +#################################################################################################### +# @SomaReconstructionDocumentation +#################################################################################################### +class SomaReconstructionDocumentation(bpy.types.Operator): + """Open the documentation page of the Soma Reconstruction panel.""" + + # Operator parameters + bl_idname = "nmv.documentation_soma" + bl_label = "Documentation" + + ################################################################################################ + # @execute + ################################################################################################ + def execute(self, + context): + """Execute the operator. + + :param context: + Blender context + :return: + 'FINISHED' + """ + + import webbrowser + webbrowser.open('https://github.com/BlueBrain/NeuroMorphoVis/wiki/Soma-Reconstruction') + return {'FINISHED'} + + #################################################################################################### # @register_panel #################################################################################################### @@ -1105,17 +1138,14 @@ def register_panel(): # Soma reconstruction panel bpy.utils.register_class(SomaPanel) - # Soma reconstruction operators + # Buttons + bpy.utils.register_class(SomaReconstructionDocumentation) bpy.utils.register_class(ReconstructSomaOperator) - - # Soma rendering operators bpy.utils.register_class(RenderSomaFront) bpy.utils.register_class(RenderSomaSide) bpy.utils.register_class(RenderSomaTop) bpy.utils.register_class(RenderSoma360) bpy.utils.register_class(RenderSomaProgressive) - - # Soma saving operators bpy.utils.register_class(SaveSomaMeshOBJ) bpy.utils.register_class(SaveSomaMeshPLY) bpy.utils.register_class(SaveSomaMeshSTL) @@ -1132,17 +1162,14 @@ def unregister_panel(): # Soma reconstruction panel bpy.utils.unregister_class(SomaPanel) - # Soma reconstruction + # Buttons + bpy.utils.unregister_class(SomaReconstructionDocumentation) bpy.utils.unregister_class(ReconstructSomaOperator) - - # Soma rendering bpy.utils.unregister_class(RenderSomaFront) bpy.utils.unregister_class(RenderSomaSide) bpy.utils.unregister_class(RenderSomaTop) bpy.utils.unregister_class(RenderSoma360) bpy.utils.unregister_class(RenderSomaProgressive) - - # Soma saving bpy.utils.unregister_class(SaveSomaMeshOBJ) bpy.utils.unregister_class(SaveSomaMeshPLY) bpy.utils.unregister_class(SaveSomaMeshSTL) diff --git a/nmv/skeleton/ops/skeleton_connection_ops.py b/nmv/skeleton/ops/skeleton_connection_ops.py index a93a8c978..5ada89a1e 100644 --- a/nmv/skeleton/ops/skeleton_connection_ops.py +++ b/nmv/skeleton/ops/skeleton_connection_ops.py @@ -468,7 +468,7 @@ def verify_arbor_proximity_to_soma(arbor, """ # TODO: nmv.consts.Skeleton.MAXIMUM_SOMA_RADIUS_REPORTED - if arbor.samples[0].point.length < soma.largest_radius: + if arbor.samples[0].point.length < 20.0: # soma.largest_radius: arbor.far_from_soma = False