Example #1
0
def test_search():
    pkgman = PackageManager()
    pkgman.load_directory("./")

    assert 'Test' in pkgman

    res = pkgman.search_node("sum")
    print res
    assert "sum" in res[0].name
Example #2
0
def test_search():
    pkgman = PackageManager()
    pkgman.load_directory("./")

    assert 'Test' in pkgman

    res = pkgman.search_node("sum")
    print res
    assert "sum" in res[0].name
Example #3
0
class NodeChooser(qt.QtGui.QDialog, ui_nodechooser.Ui_NodeChooser):

    """ Dialog allowing to choose a node (package view) """

    def __init__(self, parent):
        from node_treeview import SearchListView, SearchModel

        qt.QtGui.QDialog.__init__(self, parent)
        ui_nodechooser.Ui_NodeChooser.__init__(self)
        self.setupUi(self)

        self.pman = PackageManager()
        self.map = {}

    def search(self, name='', nb_inputs=-1, nb_outputs=-1):
        """ Add node to combo box selector corresponding to request
        @param name
        @param nb_inputs
        @param nb_outputs
        """

        res = self.pman.search_node(name, nb_inputs, nb_outputs)
        strs = []

        for f in res:
            key = "%s.%s" % (f.package.get_id().lower(), f.name)
            self.map[key] = f
            strs.append(key)

        strs.sort()
        self.comboBox.addItems(strs)

    def get_selection(self):
        """ Return selected factory """

        s = str(self.comboBox.currentText())

        if(self.map.has_key(s)):
            return self.map[s]

        return None

    def accept(self):
        """ Validate result """

        s = str(self.comboBox.currentText())

        if(self.map.has_key(s)):
            qt.QtGui.QDialog.accept(self)

        else:
            qt.QtGui.QMessageBox.warning(self, "Error", "Unknown component name")
Example #4
0
class NodeChooser(qt.QtGui.QDialog, ui_nodechooser.Ui_NodeChooser):
    """ Dialog allowing to choose a node (package view) """
    def __init__(self, parent):
        from node_treeview import SearchListView, SearchModel

        qt.QtGui.QDialog.__init__(self, parent)
        ui_nodechooser.Ui_NodeChooser.__init__(self)
        self.setupUi(self)

        self.pman = PackageManager()
        self.map = {}

    def search(self, name='', nb_inputs=-1, nb_outputs=-1):
        """ Add node to combo box selector corresponding to request
        @param name
        @param nb_inputs
        @param nb_outputs
        """

        res = self.pman.search_node(name, nb_inputs, nb_outputs)
        strs = []

        for f in res:
            key = "%s.%s" % (f.package.get_id().lower(), f.name)
            self.map[key] = f
            strs.append(key)

        strs.sort()
        self.comboBox.addItems(strs)

    def get_selection(self):
        """ Return selected factory """

        s = str(self.comboBox.currentText())

        if (self.map.has_key(s)):
            return self.map[s]

        return None

    def accept(self):
        """ Validate result """

        s = str(self.comboBox.currentText())

        if (self.map.has_key(s)):
            qt.QtGui.QDialog.accept(self)

        else:
            qt.QtGui.QMessageBox.warning(self, "Error",
                                         "Unknown component name")