Commit 6aca17674848338f37fb750dbba2f4e933a36942

Authored by Pavel Govyadinov
1 parent 81fb1e02

Added a signal to communicate the path between the two containers

GraphWidget.py
... ... @@ -18,6 +18,7 @@ These are connected to the slots such that each is processes by this class
18 18 and the class it wraps.
19 19 """
20 20 class GraphWidget(QtGui.QWidget):
  21 + select = QtCore.pyqtSignal(list)
21 22 def __init__(self):
22 23 super(GraphWidget, self).__init__()
23 24 box = QtGui.QVBoxLayout(self)
... ... @@ -141,8 +142,7 @@ class GraphWidget(QtGui.QWidget):
141 142 Pass-through function.
142 143 """
143 144 def on_mouse_double_click(self, event):
144   - #print("in applet")
145   - n = 0
  145 + self.select.emit(self.canvas.path)
146 146  
147 147 """
148 148 Handles the mouse release event.
... ...
GuiVisPy_tube.py
... ... @@ -52,6 +52,7 @@ graph = GraphWidget()
52 52 graph.canvas.create_native()
53 53  
54 54 graph.connect(fibers)
  55 +fibers.connect(graph)
55 56  
56 57 #initialize the layout
57 58 layout.addWidget(graph, 0, 0, 2, 3)
... ...
TubeCanvas.py
... ... @@ -23,12 +23,13 @@ import network_dep as nwt
23 23  
24 24 from tube_shaders import FRAG_SHADER, VERT_SHADER
25 25  
26   -from mpl_toolkits.mplot3d import Axes3D
27   -import matplotlib
28   -import matplotlib.pyplot as plt
29 26  
30   -DEBUG = False
31 27  
  28 +DEBUG = False
  29 +if DEBUG:
  30 + from mpl_toolkits.mplot3d import Axes3D
  31 + import matplotlib
  32 + import matplotlib.pyplot as plt
32 33 class TubeDraw(scene.SceneCanvas):
33 34 #sigUpdate = QtCore.pyqtSignal(float, float, float)
34 35  
... ... @@ -38,7 +39,7 @@ class TubeDraw(scene.SceneCanvas):
38 39 scene.SceneCanvas.__init__(self, size=(512,512), keys='interactive', **kwargs)
39 40 #unfreeze the drawing area to allow for dynamic drawing and interaction
40 41 self.unfreeze()
41   -
  42 + self.edge_dict = {}
42 43 #generate dummy buffers for the meshes
43 44 self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
44 45 self.cylinder_data = np.zeros(5*5, dtype=[('a_position', np.float32, 3),
... ... @@ -298,6 +299,7 @@ class TubeDraw(scene.SceneCanvas):
298 299 pts_normals.reshape((pts.shape[0]*num_sides, 3))
299 300  
300 301 index += pts.shape[0]*num_sides
  302 + self.edge_dict[(e.source(), e.target())] = (index-pts.shape[0]*num_sides, index)
301 303  
302 304 #Add the caps for each of the endpoints.
303 305  
... ...
TubeWidget.py
... ... @@ -65,4 +65,18 @@ class TubeWidget(QtGui.QWidget):
65 65 if DEBUG:
66 66 print("stuff", self.camera[0], self.camera[1], self.camera[2])
67 67 self.sigUpdate.emit(self.camera[0], self.camera[1], self.camera[2])
  68 +
  69 + """
  70 + Function to receive the signal with the information necessary to visualize
  71 + specific fibers only. With the rest of them being minimized.
  72 + """
  73 + @QtCore.pyqtSlot(list)
  74 + def select(self, x):
  75 + print("got signal", x)
68 76  
  77 + """
  78 + Initialization method that connects the slot to the function that handles
  79 + the information being sent.
  80 + """
  81 + def connect(self, signal_object):
  82 + signal_object.select.connect(self.select)
... ...