From 6aca17674848338f37fb750dbba2f4e933a36942 Mon Sep 17 00:00:00 2001 From: Pavel Govyadinov Date: Thu, 8 Aug 2019 18:57:02 -0500 Subject: [PATCH] Added a signal to communicate the path between the two containers --- GraphWidget.py | 4 ++-- GuiVisPy_tube.py | 1 + TubeCanvas.py | 12 +++++++----- TubeWidget.py | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/GraphWidget.py b/GraphWidget.py index 2368e01..2026f84 100644 --- a/GraphWidget.py +++ b/GraphWidget.py @@ -18,6 +18,7 @@ These are connected to the slots such that each is processes by this class and the class it wraps. """ class GraphWidget(QtGui.QWidget): + select = QtCore.pyqtSignal(list) def __init__(self): super(GraphWidget, self).__init__() box = QtGui.QVBoxLayout(self) @@ -141,8 +142,7 @@ class GraphWidget(QtGui.QWidget): Pass-through function. """ def on_mouse_double_click(self, event): - #print("in applet") - n = 0 + self.select.emit(self.canvas.path) """ Handles the mouse release event. diff --git a/GuiVisPy_tube.py b/GuiVisPy_tube.py index 36538b7..ddfafec 100644 --- a/GuiVisPy_tube.py +++ b/GuiVisPy_tube.py @@ -52,6 +52,7 @@ graph = GraphWidget() graph.canvas.create_native() graph.connect(fibers) +fibers.connect(graph) #initialize the layout layout.addWidget(graph, 0, 0, 2, 3) diff --git a/TubeCanvas.py b/TubeCanvas.py index 2f17f64..2058740 100644 --- a/TubeCanvas.py +++ b/TubeCanvas.py @@ -23,12 +23,13 @@ import network_dep as nwt from tube_shaders import FRAG_SHADER, VERT_SHADER -from mpl_toolkits.mplot3d import Axes3D -import matplotlib -import matplotlib.pyplot as plt -DEBUG = False +DEBUG = False +if DEBUG: + from mpl_toolkits.mplot3d import Axes3D + import matplotlib + import matplotlib.pyplot as plt class TubeDraw(scene.SceneCanvas): #sigUpdate = QtCore.pyqtSignal(float, float, float) @@ -38,7 +39,7 @@ class TubeDraw(scene.SceneCanvas): scene.SceneCanvas.__init__(self, size=(512,512), keys='interactive', **kwargs) #unfreeze the drawing area to allow for dynamic drawing and interaction self.unfreeze() - + self.edge_dict = {} #generate dummy buffers for the meshes self.program = gloo.Program(VERT_SHADER, FRAG_SHADER) self.cylinder_data = np.zeros(5*5, dtype=[('a_position', np.float32, 3), @@ -298,6 +299,7 @@ class TubeDraw(scene.SceneCanvas): pts_normals.reshape((pts.shape[0]*num_sides, 3)) index += pts.shape[0]*num_sides + self.edge_dict[(e.source(), e.target())] = (index-pts.shape[0]*num_sides, index) #Add the caps for each of the endpoints. diff --git a/TubeWidget.py b/TubeWidget.py index 01a1c38..a0ee55b 100644 --- a/TubeWidget.py +++ b/TubeWidget.py @@ -65,4 +65,18 @@ class TubeWidget(QtGui.QWidget): if DEBUG: print("stuff", self.camera[0], self.camera[1], self.camera[2]) self.sigUpdate.emit(self.camera[0], self.camera[1], self.camera[2]) + + """ + Function to receive the signal with the information necessary to visualize + specific fibers only. With the rest of them being minimized. + """ + @QtCore.pyqtSlot(list) + def select(self, x): + print("got signal", x) + """ + Initialization method that connects the slot to the function that handles + the information being sent. + """ + def connect(self, signal_object): + signal_object.select.connect(self.select) -- libgit2 0.21.4