From 8c524dcbd84ba353f802127abe0015e9f9d3ca34 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Mon, 7 Oct 2024 22:17:03 +0200 Subject: [PATCH] pre-commit run -a --- examples/notebooks/a-basics.ipynb | 219 ++++++++---------- .../b-display-force-or-velocities.ipynb | 176 ++++++-------- examples/pyplugin/pythonwidget.py | 3 +- 3 files changed, 175 insertions(+), 223 deletions(-) diff --git a/examples/notebooks/a-basics.ipynb b/examples/notebooks/a-basics.ipynb index ee4585f..8f91be6 100644 --- a/examples/notebooks/a-basics.ipynb +++ b/examples/notebooks/a-basics.ipynb @@ -1,133 +1,106 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Launch the gui and create a window." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], - "source": [ - "from gepetto.corbaserver import gui_client, start_server, Color\n", - "\n", - "start_server(args=[])\n", - "gui = gui_client(window_name=\"tuto\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Add some visual entities\n", - "\n", - "They are called nodes and are organised as a tree.\n", - "\n", - "When you create a window, a group node (called *group* from now on) is created with the same name. Adding nodes to this group displays them in the window." - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ + "cells" : [ { - "data": { - "text/plain": [ - "True" + "cell_type" : "markdown", + "metadata" : {}, + "source" : ["# Launch the gui and create a window."] + }, + { + "cell_type" : "code", + "execution_count" : 6, + "metadata" : {}, + "outputs" : [], + "source" : [ + "from gepetto.corbaserver import Color, gui_client, start_server\n", + "\n", "start_server(args=[])\n", + "gui = gui_client(window_name=\"tuto\")" ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "gui.addBox(\"box\", 0.1, 0.1, 0.1, Color.green)\n", - "gui.addToGroup(\"box\", \"tuto\")\n", - "gui.setCameraToBestFit(\"tuto\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Add another node, directly in group *tuto*." - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ + }, { - "data": { - "text/plain": [ - "True" + "cell_type" : "markdown", + "metadata" : {}, + "source" : [ + "# Add some visual entities\n", "\n", + "They are called nodes and are organised as a tree.\n", "\n", + "When you create a window, a group node (called *group* from now on) ", + "is created with the same name. Adding nodes to this group displays ", + "them in the window." ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "gui.addCylinder(\"tuto/cyl\", 0.01, 0.1, Color.red)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "To move one node, you must use `applyConfiguration` and then `refresh`. All calls to `applyConfiguration` are applied at the next `refresh`." - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [ + }, + { + "cell_type" : "code", + "execution_count" : 20, + "metadata" : {}, + "outputs" : [ { + "data" : {"text/plain" : ["True"]}, + "execution_count" : 20, + "metadata" : {}, + "output_type" : "execute_result" + } ], + "source" : [ + "gui.addBox(\"box\", 0.1, 0.1, 0.1, Color.green)\n", + "gui.addToGroup(\"box\", \"tuto\")\n", + "gui.setCameraToBestFit(\"tuto\")" + ] + }, + { + "cell_type" : "markdown", + "metadata" : {}, + "source" : ["Add another node, directly in group *tuto*."] + }, { - "data": { - "text/plain": [ - "True" + "cell_type" : "code", + "execution_count" : 15, + "metadata" : {}, + "outputs" : [ { + "data" : {"text/plain" : ["True"]}, + "execution_count" : 15, + "metadata" : {}, + "output_type" : "execute_result" + } ], + "source" : ["gui.addCylinder(\"tuto/cyl\", 0.01, 0.1, Color.red)"] + }, + { + "cell_type" : "markdown", + "metadata" : {}, + "source" : [ + "To move one node, you must use `applyConfiguration` and ", + "then `refresh`. All calls to `applyConfiguration` are ", + "applied at the next `refresh`." + ] + }, + { + "cell_type" : "code", + "execution_count" : 19, + "metadata" : {}, + "outputs" : [ { + "data" : {"text/plain" : ["True"]}, + "execution_count" : 19, + "metadata" : {}, + "output_type" : "execute_result" + } ], + "source" : [ + "gui.applyConfiguration(\"tuto/cyl\", [0, 0, 0.1, 0, 0, 0, 1])\n", + "gui.refresh()\n", "gui.setCameraToBestFit(\"tuto\")" ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" } - ], - "source": [ - "gui.applyConfiguration(\"tuto/cyl\", [0, 0, 0.1, 0, 0, 0, 1])\n", - "gui.refresh()\n", - "gui.setCameraToBestFit(\"tuto\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" + ], + "metadata" : { + "kernelspec" : { + "display_name" : "Python 3", + "language" : "python", + "name" : "python3" + }, + "language_info" : { + "codemirror_mode" : {"name" : "ipython", "version" : 3}, + "file_extension" : ".py", + "mimetype" : "text/x-python", + "name" : "python", + "nbconvert_exporter" : "python", + "pygments_lexer" : "ipython3", + "version" : "3.6.9" + } }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.9" - } - }, - "nbformat": 4, - "nbformat_minor": 2 + "nbformat" : 4, + "nbformat_minor" : 2 } diff --git a/examples/notebooks/b-display-force-or-velocities.ipynb b/examples/notebooks/b-display-force-or-velocities.ipynb index 5186e41..f9d9b1e 100644 --- a/examples/notebooks/b-display-force-or-velocities.ipynb +++ b/examples/notebooks/b-display-force-or-velocities.ipynb @@ -1,102 +1,80 @@ { - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "from gepetto.corbaserver import gui_client, start_server, Color\n", - "\n", - "start_server(args=[])\n", - "gui = gui_client(window_name=\"tuto\")\n", - "\n", - "gui.createGroup(\"frame\")\n", - "gui.addToGroup(\"frame\", \"tuto\")\n", - "gui.addLandmark(\"frame\", 0.01)\n", - "gui.applyConfiguration(\"frame\", [0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 1.0])\n", - "gui.refresh()" - ] + "cells" : [ + { + "cell_type" : "code", + "execution_count" : 1, + "metadata" : {}, + "outputs" : [], + "source" : [ + "from gepetto.corbaserver import Color, gui_client, start_server\n", + "\n", "start_server(args=[])\n", + "gui = gui_client(window_name=\"tuto\")\n", "\n", + "gui.createGroup(\"frame\")\n", "gui.addToGroup(\"frame\", \"tuto\")\n", + "gui.addLandmark(\"frame\", 0.01)\n", + "gui.applyConfiguration(\"frame\", [0.0, 0.5, 0.0, 0.0, 0.0, 0.0, ", + "1.0])\n", "gui.refresh()" + ] + }, + { + "cell_type" : "markdown", + "metadata" : {}, + "source" : [ + "# Display a 3D vector as a linear or rotational arrow\n", "\n", + "The green and blue shape will represent the same vector." + ] + }, + { + "cell_type" : "code", + "execution_count" : 2, + "metadata" : {}, + "outputs" : [], + "source" : [ + "from gepetto.corbaserver import tools\n", "\n", + "lin = tools.Linear(\"frame/lin_arrow\", color=Color.green)\n", + "lin.create(gui)\n", "\n", + "ang = tools.Angular(\"frame/ang_arrow\", color=Color.blue)\n", + "ang.create(gui)\n", "\n", "vel_in_local_frame = [\n", " 0.2,\n", + " 0.3,\n", " 0.5,\n", "]\n", "lin.set(gui, vel_in_local_frame)\n", + "ang.set(gui, vel_in_local_frame)\n", "\n", + "# This call is required.\n", "gui.refresh()" + ] + }, + { + "cell_type" : "markdown", + "metadata" : {}, + "source" : ["# Display a 6D vector"] + }, + { + "cell_type" : "code", + "execution_count" : 3, + "metadata" : {}, + "outputs" : [], + "source" : [ + "from gepetto.corbaserver import tools\n", "\n", + "# angFactor is the maximum norm of the angular vector.\n", + "vector6 = tools.Vector6(\"frame\", angFactor=3.14)\n", + "vector6.create(gui)\n", "\n", + "vel_in_local_frame = [0.1, 0.0, 0.2, 0.3, 0.5, 0.0]\n", + "vector6.set(gui, vel_in_local_frame)\n", "gui.refresh()" + ] + } + ], + "metadata" : { + "kernelspec" : { + "display_name" : "Python 3", + "language" : "python", + "name" : "python3" + }, + "language_info" : { + "codemirror_mode" : {"name" : "ipython", "version" : 3}, + "file_extension" : ".py", + "mimetype" : "text/x-python", + "name" : "python", + "nbconvert_exporter" : "python", + "pygments_lexer" : "ipython3", + "version" : "3.6.9" + } }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Display a 3D vector as a linear or rotational arrow\n", - "\n", - "The green and blue shape will represent the same vector." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "from gepetto.corbaserver import tools\n", - "\n", - "lin = tools.Linear(\"frame/lin_arrow\", color=Color.green)\n", - "lin.create(gui)\n", - "\n", - "ang = tools.Angular(\"frame/ang_arrow\", color=Color.blue)\n", - "ang.create(gui)\n", - "\n", - "vel_in_local_frame = [\n", - " 0.2,\n", - " 0.3,\n", - " 0.5,\n", - "]\n", - "lin.set(gui, vel_in_local_frame)\n", - "ang.set(gui, vel_in_local_frame)\n", - "\n", - "# This call is required.\n", - "gui.refresh()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Display a 6D vector" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "from gepetto.corbaserver import tools\n", - "\n", - "# angFactor is the maximum norm of the angular vector.\n", - "vector6 = tools.Vector6(\"frame\", angFactor=3.14)\n", - "vector6.create(gui)\n", - "\n", - "vel_in_local_frame = [0.1, 0.0, 0.2, 0.3, 0.5, 0.0]\n", - "vector6.set(gui, vel_in_local_frame)\n", - "gui.refresh()" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.9" - } - }, - "nbformat": 4, - "nbformat_minor": 2 + "nbformat" : 4, + "nbformat_minor" : 2 } diff --git a/examples/pyplugin/pythonwidget.py b/examples/pyplugin/pythonwidget.py index c31fd5c..ec88c05 100644 --- a/examples/pyplugin/pythonwidget.py +++ b/examples/pyplugin/pythonwidget.py @@ -1,6 +1,7 @@ -from gepetto.corbaserver import Client from PythonQt import Qt, QtGui +from gepetto.corbaserver import Client + class _NodeCreator(QtGui.QWidget): """This class represents one special tab of the new QDockWidget."""