| 1 | CIRCLE = 0 |
|---|
| 2 | SQUARE = 1 |
|---|
| 3 | ROUND_RECT = 2 |
|---|
| 4 | |
|---|
| 5 | NOTHING = 0 |
|---|
| 6 | ZOOMING = 1 |
|---|
| 7 | SELECT_RECTANGLE = 2 |
|---|
| 8 | SELECT_POLYGON = 3 |
|---|
| 9 | MOVE_SELECTION = 100 |
|---|
| 10 | |
|---|
| 11 | import Orange |
|---|
| 12 | import random |
|---|
| 13 | |
|---|
| 14 | from numpy import * |
|---|
| 15 | from plot.owplot import * |
|---|
| 16 | from plot.owpoint import * |
|---|
| 17 | from orngScaleScatterPlotData import * |
|---|
| 18 | import orangeplot |
|---|
| 19 | |
|---|
| 20 | class NodeItem(orangeplot.NodeItem): |
|---|
| 21 | def __init__(self, index, x=None, y=None, parent=None): |
|---|
| 22 | orangeplot.NodeItem.__init__(self, index, OWPoint.Ellipse, Qt.blue, 5, parent) |
|---|
| 23 | if x is not None: |
|---|
| 24 | self.set_x(x) |
|---|
| 25 | if y is not None: |
|---|
| 26 | self.set_y(y) |
|---|
| 27 | |
|---|
| 28 | class EdgeItem(orangeplot.EdgeItem): |
|---|
| 29 | def __init__(self, u=None, v=None, weight=1, links_index=0, label='', parent=None): |
|---|
| 30 | orangeplot.EdgeItem.__init__(self, u, v, parent) |
|---|
| 31 | self.set_u(u) |
|---|
| 32 | self.set_v(v) |
|---|
| 33 | self.set_weight(weight) |
|---|
| 34 | self.set_links_index(links_index) |
|---|
| 35 | |
|---|
| 36 | class NetworkCurve(orangeplot.NetworkCurve): |
|---|
| 37 | def __init__(self, parent=None, pen=QPen(Qt.black), xData=None, yData=None): |
|---|
| 38 | orangeplot.NetworkCurve.__init__(self, parent) |
|---|
| 39 | self.name = "Network Curve" |
|---|
| 40 | self.showEdgeLabels = 0 |
|---|
| 41 | |
|---|
| 42 | def set_node_sizes(self, values={}, min_size=0, max_size=0): |
|---|
| 43 | orangeplot.NetworkCurve.set_node_sizes(self, values, min_size, max_size) |
|---|
| 44 | |
|---|
| 45 | def move_selected_nodes(self, dx, dy): |
|---|
| 46 | selected = self.get_selected_nodes() |
|---|
| 47 | |
|---|
| 48 | self.coors[selected][0] = self.coors[0][selected] + dx |
|---|
| 49 | self.coors[1][selected][1] = self.coors[1][selected] + dy |
|---|
| 50 | |
|---|
| 51 | self.update_properties() |
|---|
| 52 | return selected |
|---|
| 53 | |
|---|
| 54 | def get_selected_nodes(self): |
|---|
| 55 | return [vertex.index() for vertex in self.nodes().itervalues() if vertex.is_selected()] |
|---|
| 56 | |
|---|
| 57 | def get_unselected_nodes(self): |
|---|
| 58 | return [vertex.index() for vertex in self.nodes().itervalues() if not vertex.is_selected()] |
|---|
| 59 | |
|---|
| 60 | def get_marked_nodes(self): |
|---|
| 61 | return [vertex.index() for vertex in self.nodes().itervalues() if vertex.is_marked()] |
|---|
| 62 | |
|---|
| 63 | def set_marked_nodes(self, vertices): |
|---|
| 64 | n = self.nodes() |
|---|
| 65 | for vertex in n.itervalues(): |
|---|
| 66 | vertex.set_marked(False) |
|---|
| 67 | for index in vertices: |
|---|
| 68 | if index in n: |
|---|
| 69 | n[index].set_marked(True) |
|---|
| 70 | |
|---|
| 71 | def mark_to_sel(self): |
|---|
| 72 | for vertex in self.nodes().itervalues(): |
|---|
| 73 | if vertex.is_marked(): |
|---|
| 74 | vertex.set_selected(True) |
|---|
| 75 | |
|---|
| 76 | def sel_to_mark(self): |
|---|
| 77 | for vertex in self.nodes().itervalues(): |
|---|
| 78 | if vertex.is_selected(): |
|---|
| 79 | vertex.set_selected(False) |
|---|
| 80 | vertex.set_marked(True) |
|---|
| 81 | |
|---|
| 82 | def unmark(self): |
|---|
| 83 | for vertex in self.nodes().itervalues(): |
|---|
| 84 | vertex.set_marked(False) |
|---|
| 85 | |
|---|
| 86 | def unselect(self): |
|---|
| 87 | for vertex in self.nodes().itervalues(): |
|---|
| 88 | vertex.set_selected(False) |
|---|
| 89 | |
|---|
| 90 | def set_hidden_nodes(self, nodes): |
|---|
| 91 | for vertex in self.nodes().itervalues(): |
|---|
| 92 | vertex.setVisible(vertex.index() in nodes) |
|---|
| 93 | |
|---|
| 94 | def hide_selected_nodes(self): |
|---|
| 95 | for vertex in self.nodes().itervalues(): |
|---|
| 96 | if vertex.selected: |
|---|
| 97 | vertex.hide() |
|---|
| 98 | |
|---|
| 99 | def hide_unselected_nodes(self): |
|---|
| 100 | for vertex in self.nodes().itervalues(): |
|---|
| 101 | if not vertex.selected: |
|---|
| 102 | vertex.hide() |
|---|
| 103 | |
|---|
| 104 | def show_all_vertices(self): |
|---|
| 105 | for vertex in self.nodes().itervalues(): |
|---|
| 106 | vertex.show() |
|---|
| 107 | |
|---|
| 108 | def changed(self): |
|---|
| 109 | self.itemChanged() |
|---|
| 110 | # |
|---|
| 111 | # def draw(self, painter, xMap, yMap, rect): |
|---|
| 112 | # for edge in self.edges: |
|---|
| 113 | # if edge.u.show and edge.v.show: |
|---|
| 114 | # painter.setPen(edge.pen) |
|---|
| 115 | # |
|---|
| 116 | # px1 = xMap.transform(self.coors[edge.u.index][0]) #ali pa tudi self.x1, itd |
|---|
| 117 | # py1 = yMap.transform(self.coors[edge.u.index][1]) |
|---|
| 118 | # px2 = xMap.transform(self.coors[edge.v.index][0]) |
|---|
| 119 | # py2 = yMap.transform(self.coors[edge.v.index][1]) |
|---|
| 120 | # |
|---|
| 121 | # painter.drawLine(px1, py1, px2, py2) |
|---|
| 122 | # |
|---|
| 123 | # d = 12 |
|---|
| 124 | # #painter.setPen(QPen(Qt.lightGray, 1)) |
|---|
| 125 | # painter.setBrush(Qt.lightGray) |
|---|
| 126 | # if edge.arrowu: |
|---|
| 127 | # x = px2 - px1 |
|---|
| 128 | # y = py2 - py1 |
|---|
| 129 | # |
|---|
| 130 | # fi = math.atan2(y, x) * 180 * 16 / math.pi |
|---|
| 131 | # |
|---|
| 132 | # if not fi is None: |
|---|
| 133 | # # (180*16) - fi - (20*16), (40*16) |
|---|
| 134 | # rect = QRectF(px2 - d, py2 - d, 2 * d, 2 * d) |
|---|
| 135 | # painter.drawPie(rect, 2560 - fi, 640) |
|---|
| 136 | # |
|---|
| 137 | # if edge.arrowv: |
|---|
| 138 | # x = px2 - px1 |
|---|
| 139 | # y = py2 - py1 |
|---|
| 140 | # |
|---|
| 141 | # fi = math.atan2(y, x) * 180 * 16 / math.pi |
|---|
| 142 | # if not fi is None: |
|---|
| 143 | # # (180*16) - fi - (20*16), (40*16) |
|---|
| 144 | # rect = QRectF(px2 - d, py2 - d, 2 * d, 2 * d) |
|---|
| 145 | # painter.drawPie(rect, 2560 - fi, 640) |
|---|
| 146 | # |
|---|
| 147 | # if self.showEdgeLabels and len(edge.label) > 0: |
|---|
| 148 | # lbl = ', '.join(edge.label) |
|---|
| 149 | # x = (px1 + px2) / 2 |
|---|
| 150 | # y = (py1 + py2) / 2 |
|---|
| 151 | # |
|---|
| 152 | # th = painter.fontMetrics().height() |
|---|
| 153 | # tw = painter.fontMetrics().width(lbl) |
|---|
| 154 | # r = QRect(x - tw / 2, y - th / 2, tw, th) |
|---|
| 155 | # painter.fillRect(r, QBrush(Qt.white)) |
|---|
| 156 | # painter.drawText(r, Qt.AlignHCenter + Qt.AlignVCenter, lbl) |
|---|
| 157 | # |
|---|
| 158 | # for key, vertex in self.vertices.iteritems(): |
|---|
| 159 | # if vertex.show: |
|---|
| 160 | # pX = xMap.transform(self.coors[vertex.index][0]) #dobimo koordinati v pikslih (tipa integer) |
|---|
| 161 | # pY = yMap.transform(self.coors[vertex.index][1]) #ki se stejeta od zgornjega levega kota canvasa |
|---|
| 162 | # if vertex.selected: |
|---|
| 163 | # painter.setPen(QPen(Qt.yellow, 3)) |
|---|
| 164 | # painter.setBrush(vertex.color) |
|---|
| 165 | # rect = QRectF(pX - (vertex.size + 4) / 2, pY - (vertex.size + 4) / 2, vertex.size + 4, vertex.size + 4) |
|---|
| 166 | # painter.drawEllipse(rect) |
|---|
| 167 | # elif vertex.marked: |
|---|
| 168 | # painter.setPen(vertex.pen) |
|---|
| 169 | # painter.setBrush(vertex.color) |
|---|
| 170 | # rect = QRectF(pX - vertex.size / 2, pY - vertex.size / 2, vertex.size, vertex.size) |
|---|
| 171 | # painter.drawEllipse(rect) |
|---|
| 172 | # else: |
|---|
| 173 | # painter.setPen(vertex.pen) |
|---|
| 174 | # painter.setBrush(vertex.nocolor) |
|---|
| 175 | # rect = QRectF(pX - vertex.size / 2, pY - vertex.size / 2, vertex.size, vertex.size) |
|---|
| 176 | # painter.drawEllipse(rect) |
|---|
| 177 | |
|---|
| 178 | def closest_node(self, px, py): |
|---|
| 179 | ndx = min(self.coors, key=lambda x: abs(self.coors[x][0]-px) + abs(self.coors[x][1]-py)) |
|---|
| 180 | return ndx, math.sqrt((self.coors[ndx][0]-px)**2 + (self.coors[ndx][0]-px)**2) |
|---|
| 181 | |
|---|
| 182 | def get_nodes_in_rect(self, x1, y1, x2, y2): |
|---|
| 183 | if x1 > x2: |
|---|
| 184 | x1, x2 = x2, x1 |
|---|
| 185 | if y1 > y2: |
|---|
| 186 | y1, y2 = y2, y1 |
|---|
| 187 | return [key for key in self.coors if x1 < self.coors[key][0] < x2 and y1 < self.coors[key][1] < y2] |
|---|
| 188 | |
|---|
| 189 | class OWNxCanvas(OWPlot): |
|---|
| 190 | def __init__(self, master, parent=None, name="None"): |
|---|
| 191 | OWPlot.__init__(self, parent, name) |
|---|
| 192 | self.master = master |
|---|
| 193 | self.parent = parent |
|---|
| 194 | #self.vertices_old = {} # distionary of nodes (orngIndex: vertex_objekt) |
|---|
| 195 | #self.edges_old = {} # distionary of edges (curveKey: edge_objekt) |
|---|
| 196 | #self.vertices = [] |
|---|
| 197 | #self.edges = [] |
|---|
| 198 | self.indexPairs = {} # distionary of type CurveKey: orngIndex (for nodes) |
|---|
| 199 | #self.selection = [] # list of selected nodes (indices) |
|---|
| 200 | self.markerKeys = {} # dictionary of type NodeNdx : markerCurveKey |
|---|
| 201 | self.tooltipKeys = {} # dictionary of type NodeNdx : tooltipCurveKey |
|---|
| 202 | self.graph = None |
|---|
| 203 | self.layout = None |
|---|
| 204 | self.vertexDegree = [] # seznam vozlisc oblike (vozlisce, stevilo povezav), sortiran po stevilu povezav |
|---|
| 205 | self.edgesKey = -1 |
|---|
| 206 | #self.vertexSize = 6 |
|---|
| 207 | self.state = NOTHING #default je rocno premikanje |
|---|
| 208 | self.hiddenNodes = [] |
|---|
| 209 | self.markedNodes = set() |
|---|
| 210 | self.markWithRed = False |
|---|
| 211 | self.circles = [] |
|---|
| 212 | self.tooltipNeighbours = 2 |
|---|
| 213 | self.selectionNeighbours = 2 |
|---|
| 214 | self.freezeNeighbours = False |
|---|
| 215 | self.labelsOnMarkedOnly = 0 |
|---|
| 216 | self.enableWheelZoom = 1 |
|---|
| 217 | self.optimizing = 0 |
|---|
| 218 | self.stopOptimizing = 0 |
|---|
| 219 | self.insideview = 0 |
|---|
| 220 | self.insideviewNeighbours = 2 |
|---|
| 221 | self.enableGridXB(False) |
|---|
| 222 | self.enableGridYL(False) |
|---|
| 223 | self.renderAntialiased = 1 |
|---|
| 224 | self.sendMarkedNodes = None |
|---|
| 225 | self.showEdgeLabels = 0 |
|---|
| 226 | self.showDistances = 0 |
|---|
| 227 | self.showMissingValues = 0 |
|---|
| 228 | |
|---|
| 229 | self.showWeights = 0 |
|---|
| 230 | self.showIndexes = 0 |
|---|
| 231 | self.minEdgeWeight = sys.maxint |
|---|
| 232 | self.maxEdgeWeight = 0 |
|---|
| 233 | self.maxEdgeSize = 1 |
|---|
| 234 | |
|---|
| 235 | self.invertEdgeSize = 0 |
|---|
| 236 | self.showComponentAttribute = None |
|---|
| 237 | self.forceVectors = None |
|---|
| 238 | self.appendToSelection = 1 |
|---|
| 239 | self.fontSize = 12 |
|---|
| 240 | |
|---|
| 241 | self.networkCurve = NetworkCurve() |
|---|
| 242 | self.add_custom_curve(self.networkCurve) |
|---|
| 243 | self.callbackMoveVertex = None |
|---|
| 244 | |
|---|
| 245 | self.minComponentEdgeWidth = 0 |
|---|
| 246 | self.maxComponentEdgeWidth = 0 |
|---|
| 247 | self.items_matrix = None |
|---|
| 248 | self.controlPressed = False |
|---|
| 249 | self.altPressed = False |
|---|
| 250 | self.items = None |
|---|
| 251 | self.links = None |
|---|
| 252 | |
|---|
| 253 | self.axis_margin = 0 |
|---|
| 254 | self.title_margin = 0 |
|---|
| 255 | self.graph_margin = 1 |
|---|
| 256 | self._legend_margin = QRectF(0, 0, 0, 0) |
|---|
| 257 | |
|---|
| 258 | self.setFocusPolicy(Qt.StrongFocus) |
|---|
| 259 | |
|---|
| 260 | def update_canvas(self): |
|---|
| 261 | self.networkCurve.update_properties() |
|---|
| 262 | |
|---|
| 263 | def get_marked_nodes(self): |
|---|
| 264 | return self.networkCurve.get_marked_nodes() |
|---|
| 265 | |
|---|
| 266 | def set_hidden_nodes(self, nodes): |
|---|
| 267 | self.networkCurve.set_hidden_nodes(nodes) |
|---|
| 268 | |
|---|
| 269 | def hide_selected_nodes(self): |
|---|
| 270 | self.networkCurve.hide_selected_nodes() |
|---|
| 271 | self.drawPlotItems() |
|---|
| 272 | |
|---|
| 273 | def hide_unselected_nodes(self): |
|---|
| 274 | self.networkCurve.hide_unselected_nodes() |
|---|
| 275 | self.drawPlotItems() |
|---|
| 276 | |
|---|
| 277 | def show_all_vertices(self): |
|---|
| 278 | self.networkCurve.show_all_vertices() |
|---|
| 279 | self.drawPlotItems() |
|---|
| 280 | |
|---|
| 281 | # def optimize(self, frSteps): |
|---|
| 282 | # qApp.processEvents() |
|---|
| 283 | # tolerance = 5 |
|---|
| 284 | # initTemp = 100 |
|---|
| 285 | # breakpoints = 20 |
|---|
| 286 | # k = int(frSteps / breakpoints) |
|---|
| 287 | # o = frSteps % breakpoints |
|---|
| 288 | # iteration = 0 |
|---|
| 289 | # coolFactor = exp(log(10.0 / 10000.0) / frSteps) |
|---|
| 290 | # #print coolFactor |
|---|
| 291 | # if k > 0: |
|---|
| 292 | # while iteration < breakpoints: |
|---|
| 293 | # initTemp = self.layout.fruchtermanReingold(k, initTemp, coolFactor, self.hiddenNodes) |
|---|
| 294 | # iteration += 1 |
|---|
| 295 | # qApp.processEvents() |
|---|
| 296 | # self.updateCanvas() |
|---|
| 297 | # |
|---|
| 298 | # initTemp = self.layout.fruchtermanReingold(o, initTemp, coolFactor, self.hiddenNodes) |
|---|
| 299 | # qApp.processEvents() |
|---|
| 300 | # self.updateCanvas() |
|---|
| 301 | # else: |
|---|
| 302 | # while iteration < o: |
|---|
| 303 | # initTemp = self.layout.fruchtermanReingold(1, initTemp, coolFactor, self.hiddenNodes) |
|---|
| 304 | # iteration += 1 |
|---|
| 305 | # qApp.processEvents() |
|---|
| 306 | # self.updateCanvas() |
|---|
| 307 | |
|---|
| 308 | def markedToSelection(self): |
|---|
| 309 | self.networkCurve.mark_to_sel() |
|---|
| 310 | self.drawPlotItems() |
|---|
| 311 | |
|---|
| 312 | def selectionToMarked(self): |
|---|
| 313 | self.networkCurve.sel_to_mark() |
|---|
| 314 | self.drawPlotItems() |
|---|
| 315 | |
|---|
| 316 | if self.sendMarkedNodes != None: |
|---|
| 317 | self.sendMarkedNodes(self.networkCurve.get_marked_nodes()) |
|---|
| 318 | |
|---|
| 319 | def removeSelection(self, replot=True): |
|---|
| 320 | self.networkCurve.unselect() |
|---|
| 321 | |
|---|
| 322 | if replot: |
|---|
| 323 | self.replot() |
|---|
| 324 | |
|---|
| 325 | def selectNeighbours(self, sel, nodes, depth, maxdepth): |
|---|
| 326 | #print "list: " + str(sel) |
|---|
| 327 | #print "nodes: " + str(nodes) |
|---|
| 328 | sel.update(nodes) |
|---|
| 329 | if depth < maxdepth: |
|---|
| 330 | for i in nodes: |
|---|
| 331 | neighbours = set(self.graph.neighbors(i)) |
|---|
| 332 | #print "neighbours: " + str(neighbours) |
|---|
| 333 | self.selectNeighbours(sel, neighbours - sel, depth + 1, maxdepth) |
|---|
| 334 | |
|---|
| 335 | def getSelectedExamples(self): |
|---|
| 336 | return self.networkCurve.get_selected_nodes() |
|---|
| 337 | |
|---|
| 338 | def getUnselectedExamples(self): |
|---|
| 339 | return self.networkCurve.get_unselected_nodes() |
|---|
| 340 | |
|---|
| 341 | def getSelectedGraph(self): |
|---|
| 342 | selection = self.networkCurve.get_selected_nodes() |
|---|
| 343 | |
|---|
| 344 | if len(selection) == 0: |
|---|
| 345 | return None |
|---|
| 346 | |
|---|
| 347 | subgraph = self.graph.subgraph(selection) |
|---|
| 348 | subnet = Network(subgraph) |
|---|
| 349 | return subnet |
|---|
| 350 | |
|---|
| 351 | def selected_nodes(self): |
|---|
| 352 | return [p.index() for p in self.selected_points()] |
|---|
| 353 | |
|---|
| 354 | def getNeighboursUpTo(self, ndx, dist): |
|---|
| 355 | newNeighbours = neighbours = set([ndx]) |
|---|
| 356 | for d in range(dist): |
|---|
| 357 | tNewNeighbours = set() |
|---|
| 358 | for v in newNeighbours: |
|---|
| 359 | tNewNeighbours |= set(self.graph.neighbors(v)) |
|---|
| 360 | newNeighbours = tNewNeighbours - neighbours |
|---|
| 361 | neighbours |= newNeighbours |
|---|
| 362 | return neighbours |
|---|
| 363 | |
|---|
| 364 | def markSelectionNeighbours(self): |
|---|
| 365 | if not self.freezeNeighbours and self.selectionNeighbours: |
|---|
| 366 | toMark = set() |
|---|
| 367 | for ndx in self.networkCurve.get_selected_nodes(): |
|---|
| 368 | toMark |= self.getNeighboursUpTo(ndx, self.selectionNeighbours) |
|---|
| 369 | |
|---|
| 370 | self.networkCurve.set_marked_nodes(toMark) |
|---|
| 371 | self.drawPlotItems() |
|---|
| 372 | |
|---|
| 373 | elif not self.freezeNeighbours and self.selectionNeighbours == 0: |
|---|
| 374 | self.networkCurve.set_marked_nodes(self.networkCurve.get_selected_nodes()) |
|---|
| 375 | self.drawPlotItems() |
|---|
| 376 | |
|---|
| 377 | if self.sendMarkedNodes != None: |
|---|
| 378 | self.sendMarkedNodes(self.networkCurve.get_marked_nodes()) |
|---|
| 379 | |
|---|
| 380 | def unmark(self): |
|---|
| 381 | self.networkCurve.unmark() |
|---|
| 382 | self.drawPlotItems(replot=0) |
|---|
| 383 | |
|---|
| 384 | if self.sendMarkedNodes != None: |
|---|
| 385 | self.sendMarkedNodes([]) |
|---|
| 386 | |
|---|
| 387 | def set_marked_nodes(self, vertices): |
|---|
| 388 | self.networkCurve.set_marked_nodes(vertices) |
|---|
| 389 | self.drawPlotItems(replot=0) |
|---|
| 390 | |
|---|
| 391 | if self.sendMarkedNodes != None: |
|---|
| 392 | self.sendMarkedNodes(self.networkCurve.get_marked_nodes()) |
|---|
| 393 | |
|---|
| 394 | def updateData(self): |
|---|
| 395 | if self.graph is None: |
|---|
| 396 | return |
|---|
| 397 | |
|---|
| 398 | self.clear() |
|---|
| 399 | self.tooltipData = [] |
|---|
| 400 | # |
|---|
| 401 | # if self.items_matrix and self.minComponentEdgeWidth > 0 and self.maxComponentEdgeWidth > 0: |
|---|
| 402 | # components = Orange.network.nx.algorithms.components.connected_components(self.graph) |
|---|
| 403 | # matrix = self.items_matrix.avgLinkage(components) |
|---|
| 404 | # |
|---|
| 405 | # edges = set() |
|---|
| 406 | # for u in range(matrix.dim): |
|---|
| 407 | # neighbours = matrix.getKNN(u, 2) |
|---|
| 408 | # for v in neighbours: |
|---|
| 409 | # if v < u: |
|---|
| 410 | # edges.add((v, u)) |
|---|
| 411 | # else: |
|---|
| 412 | # edges.add((u, v)) |
|---|
| 413 | # edges = list(edges) |
|---|
| 414 | # show 2n strongest edges |
|---|
| 415 | # vals = matrix.getValues() |
|---|
| 416 | # vals = zip(vals, range(len(vals))) |
|---|
| 417 | # count = 0 |
|---|
| 418 | # add = 0 |
|---|
| 419 | # for i in range(matrix.dim): |
|---|
| 420 | # add += i + 1 |
|---|
| 421 | # for j in range(i+1, matrix.dim): |
|---|
| 422 | # v, ind = vals[count] |
|---|
| 423 | # ind += add |
|---|
| 424 | # vals[count] = (v, ind) |
|---|
| 425 | # count += 1 |
|---|
| 426 | # vals.sort(reverse=0) |
|---|
| 427 | # vals = vals[:2 * matrix.dim] |
|---|
| 428 | # edges = [(ind / matrix.dim, ind % matrix.dim) for v, ind in vals] |
|---|
| 429 | # print "number of component edges:", len(edges), "number of components:", len(components) |
|---|
| 430 | # components_c = [(sum(self.networkCurve.coors[c][0]) / len(c), sum(self.networkCurve.coors[c][1]) / len(c)) for c in components] |
|---|
| 431 | # weights = [1 - matrix[u,v] for u,v in edges] |
|---|
| 432 | # |
|---|
| 433 | # max_weight = max(weights) |
|---|
| 434 | # min_weight = min(weights) |
|---|
| 435 | # span_weights = max_weight - min_weight |
|---|
| 436 | # |
|---|
| 437 | # self.networkCurve.update_properties() |
|---|
| 438 | |
|---|
| 439 | if self.insideview == 1: |
|---|
| 440 | selection = self.networkCurve.get_selected_nodes() |
|---|
| 441 | if len(selection) >= 1: |
|---|
| 442 | visible = set() |
|---|
| 443 | visible |= set(selection) |
|---|
| 444 | visible |= self.getNeighboursUpTo(selection[0], self.insideviewNeighbours) |
|---|
| 445 | self.networkCurve.set_hidden_nodes(set(range(self.graph.number_of_nodes())) - visible) |
|---|
| 446 | |
|---|
| 447 | edgesCount = 0 |
|---|
| 448 | |
|---|
| 449 | if self.forceVectors != None: |
|---|
| 450 | for v in self.forceVectors: |
|---|
| 451 | self.addCurve("force", Qt.white, Qt.green, 1, style=QwtPlotCurve.Lines, xData=v[0], yData=v[1], showFilledSymbols=False) |
|---|
| 452 | |
|---|
| 453 | for r in self.circles: |
|---|
| 454 | step = 2 * pi / 64; |
|---|
| 455 | fi = 0 |
|---|
| 456 | x = [] |
|---|
| 457 | y = [] |
|---|
| 458 | for i in range(65): |
|---|
| 459 | x.append(r * cos(fi) + 5000) |
|---|
| 460 | y.append(r * sin(fi) + 5000) |
|---|
| 461 | fi += step |
|---|
| 462 | |
|---|
| 463 | self.addCurve("radius", Qt.white, Qt.green, 1, style=NetworkCurve.Lines, xData=x, yData=y, showFilledSymbols=False) |
|---|
| 464 | |
|---|
| 465 | """ |
|---|
| 466 | if self.renderAntialiased: |
|---|
| 467 | self.networkCurve.setRenderHint(QwtPlotItem.RenderAntialiased) |
|---|
| 468 | else: |
|---|
| 469 | self.networkCurve.setRenderHint(QwtPlotItem.RenderAntialiased, False) |
|---|
| 470 | """ |
|---|
| 471 | |
|---|
| 472 | self.networkCurve.showEdgeLabels = self.showEdgeLabels |
|---|
| 473 | self.networkCurve.attach(self) |
|---|
| 474 | |
|---|
| 475 | def drawComponentKeywords(self): |
|---|
| 476 | if self.showComponentAttribute == None: |
|---|
| 477 | return |
|---|
| 478 | |
|---|
| 479 | if self.layout is None or self.graph is None or self.items is None: |
|---|
| 480 | return |
|---|
| 481 | |
|---|
| 482 | if str(self.showComponentAttribute) not in self.items.domain: |
|---|
| 483 | self.showComponentAttribute = None |
|---|
| 484 | return |
|---|
| 485 | |
|---|
| 486 | components = Orange.network.nx.algorithms.components.connected_components(self.graph) |
|---|
| 487 | |
|---|
| 488 | for component in components: |
|---|
| 489 | if len(component) == 0: |
|---|
| 490 | continue |
|---|
| 491 | |
|---|
| 492 | vertices = [vertex for vertex in component if self.networkCurve.vertices[vertex].show] |
|---|
| 493 | |
|---|
| 494 | if len(vertices) == 0: |
|---|
| 495 | continue |
|---|
| 496 | |
|---|
| 497 | xes = [self.networkCurve.coors[vertex][0] for vertex in vertices] |
|---|
| 498 | yes = [self.networkCurve.coors[vertex][1] for vertex in vertices] |
|---|
| 499 | |
|---|
| 500 | x1 = sum(xes) / len(xes) |
|---|
| 501 | y1 = sum(yes) / len(yes) |
|---|
| 502 | |
|---|
| 503 | lbl = str(self.items[component[0]][str(self.showComponentAttribute)]) |
|---|
| 504 | |
|---|
| 505 | mkey = self.addMarker(lbl, float(x1), float(y1), alignment=Qt.AlignCenter, size=self.fontSize) |
|---|
| 506 | |
|---|
| 507 | def drawIndexes(self): |
|---|
| 508 | if self.showIndexes: |
|---|
| 509 | for vertex in self.networkCurve.vertices.itervalues(): |
|---|
| 510 | if not vertex.show: |
|---|
| 511 | continue |
|---|
| 512 | |
|---|
| 513 | if self.labelsOnMarkedOnly and not (vertex.marked): |
|---|
| 514 | continue |
|---|
| 515 | |
|---|
| 516 | x1 = self.networkCurve.coors[vertex.index][0] |
|---|
| 517 | y1 = self.networkCurve.coors[vertex.index][1] |
|---|
| 518 | |
|---|
| 519 | lbl = str(vertex.index) |
|---|
| 520 | mkey = self.addMarker(lbl, float(x1), float(y1), alignment=Qt.AlignTop, size=self.fontSize) |
|---|
| 521 | self.markerKeys['index ' + str(vertex.index)] = mkey |
|---|
| 522 | |
|---|
| 523 | def drawWeights(self): |
|---|
| 524 | if self.showWeights: |
|---|
| 525 | for edge in self.edges: |
|---|
| 526 | if not (edge.u.show and edge.v.show): |
|---|
| 527 | continue |
|---|
| 528 | |
|---|
| 529 | if self.labelsOnMarkedOnly and not (edge.u.marked and edge.v.marked): |
|---|
| 530 | continue |
|---|
| 531 | |
|---|
| 532 | x1 = (self.networkCurve.coors[edge.u.index][0] + self.networkCurve.coors[edge.v.index][0]) / 2 |
|---|
| 533 | y1 = (self.networkCurve.coors[edge.u.index][1] + self.networkCurve.coors[edge.v.index][1]) / 2 |
|---|
| 534 | |
|---|
| 535 | if edge.weight == None: |
|---|
| 536 | lbl = "None" |
|---|
| 537 | else: |
|---|
| 538 | lbl = "%.2f" % float(edge.weight) |
|---|
| 539 | |
|---|
| 540 | mkey = self.addMarker(lbl, float(x1), float(y1), alignment=Qt.AlignCenter, size=self.fontSize) |
|---|
| 541 | self.markerKeys[(edge.u, edge.v)] = mkey |
|---|
| 542 | |
|---|
| 543 | def getColorIndeces(self, table, attribute, palette): |
|---|
| 544 | colorIndices = {} |
|---|
| 545 | colorIndex = None |
|---|
| 546 | minValue = None |
|---|
| 547 | maxValue = None |
|---|
| 548 | |
|---|
| 549 | if attribute[0] != "(" or attribute[ -1] != ")": |
|---|
| 550 | i = 0 |
|---|
| 551 | for var in table.domain.variables: |
|---|
| 552 | if var.name == attribute: |
|---|
| 553 | colorIndex = i |
|---|
| 554 | if var.varType == orange.VarTypes.Discrete: |
|---|
| 555 | colorIndices = getVariableValueIndices(var, colorIndex) |
|---|
| 556 | |
|---|
| 557 | i += 1 |
|---|
| 558 | metas = table.domain.getmetas() |
|---|
| 559 | for i, var in metas.iteritems(): |
|---|
| 560 | if var.name == attribute: |
|---|
| 561 | colorIndex = i |
|---|
| 562 | if var.varType == orange.VarTypes.Discrete: |
|---|
| 563 | colorIndices = getVariableValueIndices(var, colorIndex) |
|---|
| 564 | |
|---|
| 565 | colorIndices['?'] = len(colorIndices) |
|---|
| 566 | palette.setNumberOfColors(len(colorIndices)) |
|---|
| 567 | |
|---|
| 568 | if colorIndex != None and table.domain[colorIndex].varType == orange.VarTypes.Continuous: |
|---|
| 569 | minValue = float(min([x[colorIndex].value for x in table if x[colorIndex].value != "?"] or [0.0])) |
|---|
| 570 | maxValue = float(max([x[colorIndex].value for x in table if x[colorIndex].value != "?"] or [0.0])) |
|---|
| 571 | |
|---|
| 572 | return colorIndices, colorIndex, minValue, maxValue |
|---|
| 573 | |
|---|
| 574 | def set_edge_color(self, attribute): |
|---|
| 575 | if self.graph is None: |
|---|
| 576 | return |
|---|
| 577 | |
|---|
| 578 | colorIndices, colorIndex, minValue, maxValue = self.getColorIndeces(self.items, attribute, self.discPalette) |
|---|
| 579 | colors = [] |
|---|
| 580 | |
|---|
| 581 | if colorIndex is not None and self.items.domain[colorIndex].varType == orange.VarTypes.Continuous and minValue == maxValue: |
|---|
| 582 | colors = [self.discEdgePalette[0] for edge in self.networkCurve.edge_indices()] |
|---|
| 583 | |
|---|
| 584 | elif colorIndex is not None and self.items.domain[colorIndex].varType == orange.VarTypes.Continuous: |
|---|
| 585 | #colors.update((v, self.contPalette[(float(self.items[v][colorIndex].value) - minValue) / (maxValue - minValue)]) |
|---|
| 586 | # if str(self.items[v][colorIndex].value) != '?' else |
|---|
| 587 | # (v, self.discPalette[0]) for v in nodes) |
|---|
| 588 | print "TODO set continuous color" |
|---|
| 589 | elif colorIndex is not None and self.items.domain[colorIndex].varType == orange.VarTypes.Discrete: |
|---|
| 590 | #colors.update((v, self.discPalette[colorIndices[self.items[v][colorIndex].value]]) for v in nodes) |
|---|
| 591 | print "TODO set discrete color" |
|---|
| 592 | else: |
|---|
| 593 | colors = [self.discEdgePalette[0] for edge in self.networkCurve.edge_indices()] |
|---|
| 594 | |
|---|
| 595 | self.networkCurve.set_edge_color(colors) |
|---|
| 596 | self.replot() |
|---|
| 597 | |
|---|
| 598 | # if self.links.domain[colorIndex].varType == orange.VarTypes.Continuous: |
|---|
| 599 | # newColor = self.discEdgePalette[0] |
|---|
| 600 | # else: |
|---|
| 601 | # value = (float(self.links[links_index][colorIndex].value) - minValue) / (maxValue - minValue) |
|---|
| 602 | # newColor = self.contEdgePalette[value] |
|---|
| 603 | # elif self.links.domain[colorIndex].varType == orange.VarTypes.Discrete: |
|---|
| 604 | # newColor = self.discEdgePalette[colorIndices[self.links[links_index][colorIndex].value]] |
|---|
| 605 | # if self.links[links_index][colorIndex].value == "0": |
|---|
| 606 | # self.networkCurve.set_edge_color(index, newColor, nocolor=1) |
|---|
| 607 | # else: |
|---|
| 608 | # self.networkCurve.set_edge_color(index, newColor) |
|---|
| 609 | |
|---|
| 610 | def set_node_colors(self, attribute, nodes=None): |
|---|
| 611 | if self.graph is None: |
|---|
| 612 | return |
|---|
| 613 | |
|---|
| 614 | colorIndices, colorIndex, minValue, maxValue = self.getColorIndeces(self.items, attribute, self.discPalette) |
|---|
| 615 | colors = {} |
|---|
| 616 | |
|---|
| 617 | if nodes is None: |
|---|
| 618 | nodes = self.graph.nodes() |
|---|
| 619 | |
|---|
| 620 | if colorIndex is not None and self.items.domain[colorIndex].varType == orange.VarTypes.Continuous and minValue == maxValue: |
|---|
| 621 | colors.update((node, self.discPalette[0]) for node in nodes) |
|---|
| 622 | |
|---|
| 623 | elif colorIndex is not None and self.items.domain[colorIndex].varType == orange.VarTypes.Continuous: |
|---|
| 624 | colors.update((v, self.contPalette[(float(self.items[v][colorIndex].value) - minValue) / (maxValue - minValue)]) |
|---|
| 625 | if str(self.items[v][colorIndex].value) != '?' else |
|---|
| 626 | (v, self.discPalette[0]) for v in nodes) |
|---|
| 627 | |
|---|
| 628 | elif colorIndex is not None and self.items.domain[colorIndex].varType == orange.VarTypes.Discrete: |
|---|
| 629 | colors.update((v, self.discPalette[colorIndices[self.items[v][colorIndex].value]]) for v in nodes) |
|---|
| 630 | |
|---|
| 631 | else: |
|---|
| 632 | colors.update((node, self.discPalette[0]) for node in nodes) |
|---|
| 633 | |
|---|
| 634 | self.networkCurve.set_node_colors(colors) |
|---|
| 635 | self.replot() |
|---|
| 636 | |
|---|
| 637 | def set_label_attributes(self, attributes): |
|---|
| 638 | if self.graph is None or self.items is None or \ |
|---|
| 639 | not isinstance(self.items, orange.ExampleTable): |
|---|
| 640 | return |
|---|
| 641 | |
|---|
| 642 | label_attributes = [self.items.domain[att] for att in \ |
|---|
| 643 | attributes if att in self.items.domain] |
|---|
| 644 | self.networkCurve.set_node_labels(dict((node, ', '.join(str( \ |
|---|
| 645 | self.items[node][att]) for att in label_attributes)) \ |
|---|
| 646 | for node in self.graph)) |
|---|
| 647 | |
|---|
| 648 | def set_tooltip_attributes(self, attributes): |
|---|
| 649 | if self.graph is None or self.items is None or \ |
|---|
| 650 | not isinstance(self.items, orange.ExampleTable): |
|---|
| 651 | return |
|---|
| 652 | |
|---|
| 653 | tooltip_attributes = [self.items.domain[att] for att in \ |
|---|
| 654 | attributes if att in self.items.domain] |
|---|
| 655 | self.networkCurve.set_node_tooltips(dict((node, ', '.join(str( \ |
|---|
| 656 | self.items[node][att]) for att in tooltip_attributes)) \ |
|---|
| 657 | for node in self.graph)) |
|---|
| 658 | |
|---|
| 659 | def setEdgeLabelText(self, attributes): |
|---|
| 660 | self.edgeLabelText = [] |
|---|
| 661 | if self.layout is None or self.graph is None or self.items is None: |
|---|
| 662 | return |
|---|
| 663 | |
|---|
| 664 | def change_graph(self, newgraph): |
|---|
| 665 | old_nodes = set(self.graph.nodes_iter()) |
|---|
| 666 | new_nodes = set(newgraph.nodes_iter()) |
|---|
| 667 | inter_nodes = old_nodes.intersection(new_nodes) |
|---|
| 668 | remove_nodes = list(old_nodes.difference(inter_nodes)) |
|---|
| 669 | add_nodes = new_nodes.difference(inter_nodes) |
|---|
| 670 | |
|---|
| 671 | self.graph = newgraph |
|---|
| 672 | |
|---|
| 673 | self.networkCurve.remove_nodes(list(remove_nodes)) |
|---|
| 674 | |
|---|
| 675 | nodes = dict((v, NodeItem(v, parent=self.networkCurve)) for v in add_nodes) |
|---|
| 676 | self.networkCurve.add_nodes(nodes) |
|---|
| 677 | nodes = self.networkCurve.nodes() |
|---|
| 678 | |
|---|
| 679 | #build edge index |
|---|
| 680 | row_ind = {} |
|---|
| 681 | if self.links is not None and len(self.links) > 0: |
|---|
| 682 | for i, r in enumerate(self.links): |
|---|
| 683 | u = int(r['u'].value) |
|---|
| 684 | v = int(r['v'].value) |
|---|
| 685 | if u in self.graph and v in self.graph: |
|---|
| 686 | u_dict = row_ind.get(u, {}) |
|---|
| 687 | v_dict = row_ind.get(v, {}) |
|---|
| 688 | u_dict[v] = i |
|---|
| 689 | v_dict[u] = i |
|---|
| 690 | row_ind[u] = u_dict |
|---|
| 691 | row_ind[v] = v_dict |
|---|
| 692 | |
|---|
| 693 | #add edges |
|---|
| 694 | if self.links is not None and len(self.links) > 0: |
|---|
| 695 | links = self.links |
|---|
| 696 | links_indices = (row_ind[i + 1][j + 1] for (i, j) in self.graph.edges(add_nodes)) |
|---|
| 697 | labels = ([str(row[r].value) for r in range(2, len(row))] for row \ |
|---|
| 698 | in (links[links_index] for links_index in links_indices)) |
|---|
| 699 | |
|---|
| 700 | if self.graph.is_directed(): |
|---|
| 701 | edges = [EdgeItem(nodes[i], nodes[j], |
|---|
| 702 | self.graph[i][j].get('weight', 1), 0, 1, links_index, label, \ |
|---|
| 703 | parent=self.networkCurve) for ((i, j), links_index, label) in \ |
|---|
| 704 | zip(self.graph.edges(add_nodes), links_indices, labels)] |
|---|
| 705 | else: |
|---|
| 706 | edges = [EdgeItem(nodes[i], nodes[j], |
|---|
| 707 | self.graph[i][j].get('weight', 1), links_index, label) for \ |
|---|
| 708 | ((i, j), links_index, label) in zip(self.graph.edges(add_nodes), \ |
|---|
| 709 | links_indices, labels, parent=self.networkCurve)] |
|---|
| 710 | elif self.graph.is_directed(): |
|---|
| 711 | edges = [EdgeItem(nodes[i], nodes[j], self.graph[i][j].get('weight', 1), \ |
|---|
| 712 | 0, 1, parent=self.networkCurve) for (i, j) in self.graph.edges(add_nodes)] |
|---|
| 713 | else: |
|---|
| 714 | edges = [EdgeItem(nodes[i], nodes[j], self.graph[i][j].get('weight', 1), \ |
|---|
| 715 | parent=self.networkCurve) for (i, j) in self.graph.edges(add_nodes)] |
|---|
| 716 | |
|---|
| 717 | self.networkCurve.add_edges(edges) |
|---|
| 718 | |
|---|
| 719 | def set_graph(self, graph, curve=None, items=None, links=None): |
|---|
| 720 | self.clear() |
|---|
| 721 | self.vertexDegree = [] |
|---|
| 722 | self.minEdgeWeight = sys.maxint |
|---|
| 723 | self.maxEdgeWeight = 0 |
|---|
| 724 | |
|---|
| 725 | if graph is None: |
|---|
| 726 | self.graph = None |
|---|
| 727 | #self.layout = None |
|---|
| 728 | self.networkCurve = None |
|---|
| 729 | self.items = None |
|---|
| 730 | self.links = None |
|---|
| 731 | xMin = -1.0 |
|---|
| 732 | xMax = 1.0 |
|---|
| 733 | yMin = -1.0 |
|---|
| 734 | yMax = 1.0 |
|---|
| 735 | self.addMarker("no network", (xMax - xMin) / 2, (yMax - yMin) / 2, alignment=Qt.AlignCenter, size=self.fontSize) |
|---|
| 736 | self.tooltipNeighbours = 0 |
|---|
| 737 | self.replot() |
|---|
| 738 | return |
|---|
| 739 | |
|---|
| 740 | self.graph = graph |
|---|
| 741 | #self.layout = layout |
|---|
| 742 | self.networkCurve = NetworkCurve() if curve is None else curve |
|---|
| 743 | self.items = items if items is not None else self.graph.items() |
|---|
| 744 | self.links = links if links is not None else self.graph.links() |
|---|
| 745 | |
|---|
| 746 | #add nodes |
|---|
| 747 | #self.vertices_old = [(None, []) for v in self.graph] |
|---|
| 748 | vertices = dict((v, NodeItem(v, parent=self.networkCurve)) for v in self.graph) |
|---|
| 749 | self.networkCurve.set_nodes(vertices) |
|---|
| 750 | |
|---|
| 751 | #build edge index |
|---|
| 752 | row_ind = {} |
|---|
| 753 | if self.links is not None and len(self.links) > 0: |
|---|
| 754 | for i, r in enumerate(self.links): |
|---|
| 755 | u = int(r['u'].value) |
|---|
| 756 | v = int(r['v'].value) |
|---|
| 757 | if u in self.graph and v in self.graph: |
|---|
| 758 | u_dict = row_ind.get(u, {}) |
|---|
| 759 | v_dict = row_ind.get(v, {}) |
|---|
| 760 | u_dict[v] = i |
|---|
| 761 | v_dict[u] = i |
|---|
| 762 | row_ind[u] = u_dict |
|---|
| 763 | row_ind[v] = v_dict |
|---|
| 764 | |
|---|
| 765 | #add edges |
|---|
| 766 | if self.links is not None and len(self.links) > 0: |
|---|
| 767 | links = self.links |
|---|
| 768 | links_indices = (row_ind[i + 1][j + 1] for (i, j) in self.graph.edges()) |
|---|
| 769 | labels = ([str(row[r].value) for r in range(2, len(row))] for row in (links[links_index] for links_index in links_indices)) |
|---|
| 770 | |
|---|
| 771 | if self.graph.is_directed(): |
|---|
| 772 | edges = [EdgeItem(vertices[i], vertices[j], |
|---|
| 773 | graph[i][j].get('weight', 1), 0, 1, links_index, label, parent=self.networkCurve) for \ |
|---|
| 774 | ((i, j), links_index, label) in zip(self.graph.edges(), \ |
|---|
| 775 | links_indices, labels)] |
|---|
| 776 | else: |
|---|
| 777 | edges = [EdgeItem(vertices[i], vertices[j], |
|---|
| 778 | graph[i][j].get('weight', 1), links_index, label) for \ |
|---|
| 779 | ((i, j), links_index, label) in zip(self.graph.edges(), \ |
|---|
| 780 | links_indices, labels, parent=self.networkCurve)] |
|---|
| 781 | elif self.graph.is_directed(): |
|---|
| 782 | edges = [EdgeItem(vertices[i], vertices[j], |
|---|
| 783 | graph[i][j].get('weight', 1), 0, 1, parent=self.networkCurve) for (i, j) in self.graph.edges()] |
|---|
| 784 | else: |
|---|
| 785 | edges = [EdgeItem(vertices[i], vertices[j], |
|---|
| 786 | graph[i][j].get('weight', 1), parent=self.networkCurve) for (i, j) in self.graph.edges()] |
|---|
| 787 | |
|---|
| 788 | self.networkCurve.set_edges(edges) |
|---|
| 789 | self.networkCurve.update_properties() |
|---|
| 790 | self.replot() |
|---|
| 791 | |
|---|
| 792 | def setEdgesSize(self): |
|---|
| 793 | # if self.maxEdgeWeight > self.minEdgeWeight: |
|---|
| 794 | # #print 'maxEdgeSize',self.maxEdgeSize |
|---|
| 795 | # #print 'maxEdgeWeight',self.maxEdgeWeight |
|---|
| 796 | # #print 'minEdgeWeight',self.minEdgeWeight |
|---|
| 797 | # k = (self.maxEdgeSize - 1) / (self.maxEdgeWeight - self.minEdgeWeight) |
|---|
| 798 | # for edge in self.networkCurve.edges: |
|---|
| 799 | # if edge.weight == None: |
|---|
| 800 | # size = 1 |
|---|
| 801 | # edge.pen = QPen(edge.pen.color(), size) |
|---|
| 802 | # edge.pen.setCapStyle(Qt.RoundCap) |
|---|
| 803 | # else: |
|---|
| 804 | # if self.invertEdgeSize: |
|---|
| 805 | # size = (self.maxEdgeWeight - edge.weight - self.minEdgeWeight) * k + 1 |
|---|
| 806 | # else: |
|---|
| 807 | # size = (edge.weight - self.minEdgeWeight) * k + 1 |
|---|
| 808 | # edge.pen = QPen(edge.pen.color(), size) |
|---|
| 809 | # edge.pen.setCapStyle(Qt.RoundCap) |
|---|
| 810 | # else: |
|---|
| 811 | # for edge in self.networkCurve.edges: |
|---|
| 812 | # edge.pen = QPen(edge.pen.color(), 1) |
|---|
| 813 | # edge.pen.setCapStyle(Qt.RoundCap) |
|---|
| 814 | pass |
|---|
| 815 | |
|---|
| 816 | def update_animations(self): |
|---|
| 817 | OWPlot.use_animations(self) |
|---|
| 818 | self.networkCurve.set_use_animations(True) |
|---|
| 819 | |
|---|
| 820 | def replot(self): |
|---|
| 821 | OWPlot.replot(self) |
|---|
| 822 | if hasattr(self, 'networkCurve') and self.networkCurve is not None: |
|---|
| 823 | self.networkCurve.update() |
|---|