Open janezd opened 4 years ago
Hi, Janez, Glad to receive your comment. I'v modified the widget OWNxTable.py according to your suggestion today. I'm quite new to Python, Orange, and QT UI, just get to know with Python 3 months ago, and know little about Orange and QT UI, thanks for your suggestion!
When the vertices data table connected to the "Network From Tables" widget is a subset of selected veritces, for example, if there're vertices ids of 300,301 and the number of vertices in the subset is 100, then we'll get an index out of range exception while creating the sparse array of the network, or in the network explorer widget, this is what happend actually. So I add a check box "Remove nodes without any edge" to force reindexing of the vertices, and update the source and target vertex id of all edges. The widget will then also check if the vertices passed in is a subset, and will force reindexing by setting the check box to 1 to avoid the exception.
As to those self.infoa, self.infob..., just for statistical information to be reviewed, so I keep most of them, and add some important information of Infromation,Warning,Error class on the canvas widget icon according to your suggestion. I think that it'd be O.K. in this way.
When ids of vertices and edges are reindexed, we need to change them both at the same time. So if one is changed, the widget will set the other one to None, and give a Warning icon to inform. We need to delete the connection of the other one and reconnect manually to get a new input. I don't know whether it is the best way to do it or not, but it works.
Remember the input, don't throw it away, so you'll be able to recompute. Remembering the input doesn't cost you any memory because it's only a reference to data that is stored in the signal manager anyway.
Good idea, I'v modified the "Network From Tables" widget to remember the vertices and edges inputs, and reference it to compute again when one of them is changed later. Thanks for your suggestion! Now the widget works well enough already.
This refers to https://github.com/icejean/orange3-glueviz/blob/master/glueviz/OWNxTable.py, but it's also applicable to (at least) OWNx2Table.
self.infoa
,self.infob
, ... could be replaced with the more usualError
,Warning
andInfo
classes. See https://orange-development.readthedocs.io/tutorial-utilities.html#multiple-messages.This is not OK:
self.infof.setText("Vertices ids are reindexed, please delete & create the widget again!")
. I haven't followed the logic of the code enough to understand why this is needed, but perhaps you shouldset_vertices
should contain onlyself.vertices = vertices
, same forset_edges
. The implementhandleNewSignals
. See https://orange-development.readthedocs.io/widget.html.