Commits

Miha Stajdohar committed f7397f6

Bug fixes.

Comments (0)

Files changed (3)

orangecontrib/network/widgets/OWNxExplorer.py

             if len(set(positions.values())) > 1:
                 self.networkCanvas.networkCurve.set_node_coordinates(positions)
 
-
         self.networkCanvas.showEdgeLabels = self.showEdgeLabels
         self.networkCanvas.maxEdgeSize = self.maxLinkSize
         self.networkCanvas.minComponentEdgeWidth = self.minComponentEdgeWidth
     #######################################################################
 
     def graph_layout(self):
-        if self.graph is None or self.graph.number_of_nodes <= 0:   #grafa se ni
+        if self.graph is None or self.graph.number_of_nodes() <= 0:   #grafa se ni
             self.optButton.setChecked(False)
             return
 
 
         self.optButton.setChecked(False)
         self.networkCanvas.update_graph_layout()
+        qApp.processEvents()
 
     def graph_layout_method(self, method=None):
         self.information()

orangecontrib/network/widgets/OWNxHist.py

         OWGUI.appendRadioButton(ribg, self, "netOption", "Large components only. Min nodes:", insertInto=hb, callback=self.generateGraph)
         OWGUI.spin(hb, self, "excludeLimit", 2, 100, 1, callback=(lambda h=True: self.generateGraph(h)))
         OWGUI.appendRadioButton(ribg, self, "netOption", "Largest connected component only", callback=self.generateGraph)
-        OWGUI.appendRadioButton(ribg, self, "netOption", "Connected component with vertex")
+        #OWGUI.appendRadioButton(ribg, self, "netOption", "Connected component with vertex")
         self.attribute = None
-        self.attributeCombo = OWGUI.comboBox(parent, self, "attribute", box="Filter attribute", orientation='horizontal')#, callback=self.setVertexColor)
+
+        ### FILTER NETWORK BY ATTRIBUTE IS OBSOLETE - USE SELECT DATA WIDGET ###
+        #self.attributeCombo = OWGUI.comboBox(parent, self, "attribute", box="Filter attribute", orientation='horizontal')#, callback=self.setVertexColor)
+        #self.label = ''
+        #self.searchString = OWGUI.lineEdit(self.attributeCombo.box, self, "label", callback=self.setSearchStringTimer, callbackOnType=True)
+        #self.searchStringTimer = QTimer(self)
+        #self.connect(self.searchStringTimer, SIGNAL("timeout()"), self.generateGraph)
+        #if str(self.netOption) != '3':
+        #    self.attributeCombo.box.setEnabled(False)
 
         ribg = OWGUI.radioButtonsInBox(parent, self, "dstWeight", [], "Distance -> Weight", callback=self.generateGraph)
         hb = OWGUI.widgetBox(ribg, None, orientation="horizontal", addSpace=False)
         OWGUI.appendRadioButton(ribg, self, "dstWeight", "Weight := distance", insertInto=hb, callback=self.generateGraph)
         OWGUI.appendRadioButton(ribg, self, "dstWeight", "Weight := 1 - distance", insertInto=hb, callback=self.generateGraph)
 
-        self.label = ''
-        self.searchString = OWGUI.lineEdit(self.attributeCombo.box, self, "label", callback=self.setSearchStringTimer, callbackOnType=True)
-        self.searchStringTimer = QTimer(self)
-        self.connect(self.searchStringTimer, SIGNAL("timeout()"), self.generateGraph)
 
-        if str(self.netOption) != '3':
-            self.attributeCombo.box.setEnabled(False)
 
     def setPercentil(self):
         if self.matrix is None or self.percentil <= 0:
         self.generateGraph()
 
     def enableAttributeSelection(self):
-        self.attributeCombo.box.setEnabled(True)
+        #self.attributeCombo.box.setEnabled(True)
+        pass
 
     def setSearchStringTimer(self):
-        self.searchStringTimer.stop()
-        self.searchStringTimer.start(750)
+        # self.searchStringTimer.stop()
+        # self.searchStringTimer.start(750)
+        pass
 
     def setMatrix(self, data):
         if data == None:
             self.matrix = None
             self.histogram.setValues([])
-            self.attributeCombo.clear()
+            #self.attributeCombo.clear()
             self.generateGraph()
             return
 
         upp = max(values)
         self.spinLowerThreshold = self.spinUpperThreshold = math.floor(low - (0.03 * (upp - low)))
 
-        self.attributeCombo.clear()
+        # self.attributeCombo.clear()
         vars = []
 
         if hasattr(self.matrix, "items"):
 
         self.icons = self.createAttributeIconDict()
 
-        for var in vars:
-            try:
-                if var.varType != 7: # if not Orange.feature.Python
-                    self.attributeCombo.addItem(self.icons[var.varType], unicode(var.name))
-            except:
-                print "Error adding", var, "to the attribute combo."
+        # for var in vars:
+        #     try:
+        #         if var.varType != 7: # if not Orange.feature.Python
+        #             self.attributeCombo.addItem(self.icons[var.varType], unicode(var.name))
+        #     except:
+        #         print "Error adding", var, "to the attribute combo."
 
         self.setPercentil()
         self.generateGraph()
         self.generateGraph()
 
     def generateGraph(self, N_changed=False):
-        self.searchStringTimer.stop()
-        self.attributeCombo.box.setEnabled(False)
+        # self.searchStringTimer.stop()
+        # self.attributeCombo.box.setEnabled(False)
         self.error()
         matrix = None
         self.warning('')
                     self.graph = None
                     matrix = None
             # connected component with vertex by label
-            elif str(self.netOption) == '3':
-                self.attributeCombo.box.setEnabled(True)
-                self.graph = None
-                matrix = None
-                #print self.attributeCombo.currentText()
-                if self.attributeCombo.currentText() != '' and self.label != '':
-                    components = Orange.network.nx.algorithms.components.connected_components(graph)
+            # elif str(self.netOption) == '3':
+            #     self.attributeCombo.box.setEnabled(True)
+            #     self.graph = None
+            #     matrix = None
+            #     if self.attributeCombo.currentText() != '' and self.label != '':
+            #         components = Orange.network.nx.algorithms.components.connected_components(graph)
 
-                    txt = self.label.lower()
-                    #print 'txt:',txt
-                    nodes = [i for i, values in enumerate(self.matrix.items) if txt in str(values[str(self.attributeCombo.currentText())]).lower()]
-                    #print "nodes:",nodes
-                    if len(nodes) > 0:
-                        vertices = []
-                        for component in components:
-                            for node in nodes:
-                                if node in component:
-                                    if len(component) > 0:
-                                        vertices.extend(component)
+            #         txt = self.label.lower()
+            #         #print 'txt:',txt
+            #         nodes = [i for i, values in enumerate(self.matrix.items) if txt in str(values[str(self.attributeCombo.currentText())]).lower()]
+            #         #print "nodes:",nodes
+            #         if len(nodes) > 0:
+            #             vertices = []
+            #             for component in components:
+            #                 for node in nodes:
+            #                     if node in component:
+            #                         if len(component) > 0:
+            #                             vertices.extend(component)
 
-                        if len(vertices) > 0:
-                            #print "n vertices:", len(vertices), "n set vertices:", len(set(vertices))
-                            vertices = list(set(vertices))
-                            self.graph = graph.subgraph(include)
-                            matrix = self.matrix.getitems(vertices)
+            #             if len(vertices) > 0:
+            #                 #print "n vertices:", len(vertices), "n set vertices:", len(set(vertices))
+            #                 vertices = list(set(vertices))
+            #                 self.graph = graph.subgraph(include)
+            #                 matrix = self.matrix.getitems(vertices)
             else:
                 self.graph = graph
 

orangecontrib/network/widgets/OWPubmedView.py

 <name>Pubmed Network View</name>
 <description></description>
 <icon>icons/NetworkExplorer.svg</icon>
-<contact></contact> 
+<contact></contact>
 <priority>6470</priority>
 """
+raise Exception("This widget is a Prototype.")
 
 import Orange
 import OWGUI
 
 
 class PubmedNetworkView(Orange.network.NxView):
-    """Network Inside View
-    
-    """
+
+    """Network Inside View"""
 
     def __init__(self, parent):
         Orange.network.NxView.__init__(self)