Esempio n. 1
0
    def edit_node(self):
        """ Edit Node in tab workspace"""

        index = self.currentIndex()
        obj   = self.model().data(index, PkgModel.pkgmodelRole)

        if isinstance(obj, CompositeNodeFactory):
            self.compositeFactoryOpenRequest.emit(obj)
        elif isinstance(obj, NodeFactory) or \
             isinstance(obj, DataFactory):
            widget = obj.instantiate_widget(edit=True)
            if(widget.is_widget()) :
                open_dialog(self, widget, obj.get_id())
Esempio n. 2
0
    def open_node(self):
        """ Instantiate Node : open a dialog """
        index = self.currentIndex()
        obj   = self.model().data(index, PkgModel.pkgmodelRole)

        if(isinstance(obj, AbstractFactory)):
            widget = obj.instantiate_widget(autonomous=True)
            open_dialog(self, widget, obj.get_id())

        elif(isinstance(obj, Package)):
            # Display URL
            urlstr = obj.get_metainfo('url')
            QtGui.QDesktopServices.openUrl(QtCore.QUrl(urlstr))
Esempio n. 3
0
    def edit_pkg_code(self):
        """ Edit __wralea__ """

        pkg = self.get_current_pkg()
        pman = self.model().pman # pkgmanager

        if(not pkg.is_directory()):
            QtGui.QMessageBox.warning(self, "Error",
                                             "Cannot edit code of old style package\n")
            return

        filename = pkg.get_wralea_path()
        widget = get_editor()(self)
        widget.edit_file(filename)
        if(widget.is_widget()) : open_dialog(self, widget, pkg.name)
Esempio n. 4
0
    def edit_node(self):
        """ Edit Node in tab workspace"""

        if self.main_win is None:
            return

        item = self.currentIndex()
        obj = item.internalPointer()

        if (isinstance(obj, CompositeNodeFactory)):
            self.main_win().open_compositenode(obj)

        elif (isinstance(obj, NodeFactory) or isinstance(obj, DataFactory)):
            widget = obj.instantiate_widget(edit=True)
            if (widget.is_widget()):
                open_dialog(self.main_win(), widget, obj.get_id())
Esempio n. 5
0
    def button_clicked(self):

        name = str(self.sender().text())
        command = self.editors[name]
        fn = str(self.params[0])
        
        if(not command):
            widget = get_editor()(self.parent())
            
            if(widget.is_widget()):
                open_dialog(self.parent(), widget, fn, 
                            delete_on_close=True)

            widget.edit_file(fn)

        else:
            c = Command(command)
            c(fn)
Esempio n. 6
0
    def edit_node(self):
        """ Edit Node in tab workspace"""

        if self.main_win is None:
            return

        item = self.currentIndex()
        obj =  item.internalPointer()

        if(isinstance(obj, CompositeNodeFactory)):
            self.main_win().open_compositenode(obj)

        elif(isinstance(obj, NodeFactory)
             or isinstance(obj, DataFactory)
             ):
            widget = obj.instantiate_widget(edit=True)
            if(widget.is_widget()) :
                open_dialog(self.main_win(), widget, obj.get_id())
Esempio n. 7
0
    def open_node(self):
        """ Instantiate Node : open a dialog """

        item = self.currentIndex()
        obj = item.internalPointer()

        if self.main_win is None:
            parent = self
        else:
            parent = self.main_win()

        if(isinstance(obj, AbstractFactory)):
            widget = obj.instantiate_widget(autonomous=True)
            open_dialog(parent, widget, obj.get_id())

        elif(isinstance(obj, PseudoPackage)):
            # Display URL
            urlstr = obj.get_metainfo('url')
            qt.QtGui.QDesktopServices.openUrl(qt.QtCore.QUrl(urlstr))
Esempio n. 8
0
    def open_node(self):
        """ Instantiate Node : open a dialog """

        item = self.currentIndex()
        obj = item.internalPointer()

        if self.main_win is None:
            parent = self
        else:
            parent = self.main_win()

        if (isinstance(obj, AbstractFactory)):
            widget = obj.instantiate_widget(autonomous=True)
            open_dialog(parent, widget, obj.get_id())

        elif (isinstance(obj, PseudoPackage)):
            # Display URL
            urlstr = obj.get_metainfo('url')
            qt.QtGui.QDesktopServices.openUrl(qt.QtCore.QUrl(urlstr))
Esempio n. 9
0
    def vertex_open(self):
        master = self.master
        widget = master.get_sensible_parent()
        item = master.get_vertex_item()
        vertex = item.vertex()
        vwidget = item.get_editor_instance()
        if(vwidget):
            if(vwidget.isVisible()):
                vwidget.raise_()
                vwidget.activateWindow()
            else:
                vwidget.show()
            return

        # Create the dialog.
        # NOTE: WE REQUEST THE MODEL TO CREATE THE DIALOG
        # THIS IS NOT DESIRED BECAUSE IT COUPLES THE MODEL
        # TO THE UI.
        factory = vertex.get_factory()
        if(not factory):
            return
        innerWidget = factory.instantiate_widget(vertex, None)
        if(not innerWidget):
            return
        if (innerWidget.is_empty()):
            innerWidget.close()
            del innerWidget
            return

        title = innerWidget.windowTitle()
        if title == "":
            title = factory.get_id()

        vwidget = open_dialog(widget,
                              innerWidget,
                              title,
                              False)

        item.set_editor_instance(vwidget)
Esempio n. 10
0
    def vertex_open(self):
        master = self.master
        widget = master.get_sensible_parent()
        item = master.get_vertex_item()
        vertex = item.vertex()
        vwidget = item.get_editor_instance()
        if (vwidget):
            if (vwidget.isVisible()):
                vwidget.raise_()
                vwidget.activateWindow()
            else:
                vwidget.show()
            return

        # Create the dialog.
        # NOTE: WE REQUEST THE MODEL TO CREATE THE DIALOG
        # THIS IS NOT DESIRED BECAUSE IT COUPLES THE MODEL
        # TO THE UI.
        factory = vertex.get_factory()
        if (not factory):
            return
        innerWidget = factory.instantiate_widget(vertex, None)
        if (not innerWidget):
            return
        if (innerWidget.is_empty()):
            innerWidget.close()
            del innerWidget
            return

        title = innerWidget.windowTitle()
        if title == "":
            title = factory.get_id()

        vwidget = open_dialog(widget, innerWidget, title, False)

        item.set_editor_instance(vwidget)