Пример #1
0
 def __actualizar_recientes(self):
     """Actualiza la lista de ficheros recientemente abiertos"""
     self.PopupMenuEditor_3.clear()
     for i in range(len(self.__config.configuracion["lfichero"]) - 1):
         self.__colectorfunciones.append(lambda nombre=self.__config.configuracion["lfichero"][i]: self.abrir_proyecto(self, nombre))
         accion = QAction(self, self.__config.configuracion["lfichero"][i])
         accion.setText(self.__config.configuracion["lfichero"][i])
         accion.addTo(self.PopupMenuEditor_3)
         self.connect(accion, SIGNAL("activated()"), self.__colectorfunciones[-1])
Пример #2
0
    def __init__(self, parent, config, portero, idu, gestorproyectos, gestortemas, gestoroperaciones): 
        """Inicializador de la ventana principal"""
        vprincipal.__init__(self, None)
        #VARIABLES PUBLICAS
        self.parent = parent
        self.__config = config
        self.__gestortemas = gestortemas
        self.__idu = idu
        #Bloque de inicialización de dialogos
        self.__dbuscar = DBuscar(self, "busqueda")
        self.__dconfig = DConfig(config, self)
        self.__dfiltro = DFiltrado(self, self.__idu)
        self.__dayuda = DAyuda(self)
        self.__portero = portero
        self.__gestorproyectos = gestorproyectos
        self.grid = Grid(self, self.__idu, self.__portero)
        self.widgetStack1.addWidget(self.grid)
        self.widgetStack1.raiseWidget(self.grid)

        # Funciones de inicializacion de componentes
        self.__init_toolbar()
        self.mostrar_undo_redo()

        self.setIcon(self.__gestortemas.icono_programa())
        self.__diccionarioarbolmenu = {}
        self.__diccionarioacciones = {}
        self.__colectorfunciones = []
        listalistasetiquetas = [operacion.etiquetas for operacion in gestoroperaciones.values()]
        from Driza import categorias
        arbol = categorias.conv_categorias_arbol("Raiz", listalistasetiquetas)
        self.__conv_arbol_menu(self.Analizar, arbol, self.__diccionarioarbolmenu)
        listaelementosmenu =  self.__lista_etiquetas_menu(self.__diccionarioarbolmenu, [])
        from sets import Set
        for operacion in gestoroperaciones.values():
            for elementofinal in listaelementosmenu:
                if Set(operacion.etiquetas) == Set(elementofinal[1]):
                    accion = QAction(self, "")
                    accion.setText(unicode(operacion.nombre))
                    accion.addTo(elementofinal[0])
                    self.__diccionarioacciones[operacion.nombre] = accion
        self.__atajos()
Пример #3
0
    def initContextMenu(self, context):
        """
        Initiates the popup menu depending on the context and
        adds appropriate menu items.
        """

        #ACTION TO ARRANGE THE ICONS IN A LINE
        arrangeIcons01Action = QAction("Lines", QKeySequence(), self, "arrangeIcons01Actions")
        arrangeIcons01Action.setIconSet(QIconSet())
        self.connect(arrangeIcons01Action, SIGNAL("activated()"), self.parent().arrangeIconsInLines)

        #ACTION TO ARRANGE THE ICONS IN A CIRCLE
        arrangeIcons02Action = QAction("Circle", QKeySequence(), self, "arrangeIcons02Actions")
        arrangeIcons02Action.setIconSet(QIconSet())
        self.connect(arrangeIcons02Action, SIGNAL("activated()"), self.parent().arrangeIconsInCircle)

        #SUBMENU TO CHOOSE THE WAY OF ARRANGEMENT
        #----------------------------------------
        subMenu01 = QPopupMenu(self, "Arrange Icons")
        arrangeIcons01Action.addTo(subMenu01)
        arrangeIcons02Action.addTo(subMenu01)

        #ACTION TO UPDATE THE SCREEN
        updateCanvasViewAction = QAction("Update Screen", QKeySequence(), self, "updateCanvasViewAction")
        updateCanvasViewAction.setIconSet(QIconSet())
        self.connect(updateCanvasViewAction, SIGNAL("activated()"), self.parent().updateCanvasView)

        #ACTION TO ADD A NEW DATATYPE
        newDataTypeAction = QAction("New Data Type...", QKeySequence(), self, "newDataTypeAction")
        newDataTypeAction.setIconSet(QIconSet(QPixmap.fromMimeSource("newDataType16.png")))
        self.connect(newDataTypeAction, SIGNAL("activated()"), self.myFrame.addDataTypeSlot)

        #ACTION TO ADD A NEW RELATIONTYPE
        newRelationTypeAction = QAction("New Relation Type...", QKeySequence(), self, "newRelationTypeAction")
        newRelationTypeAction.setIconSet(QIconSet(QPixmap.fromMimeSource("newRelationType16.png")))
        self.connect(newRelationTypeAction, SIGNAL("activated()"), self.myFrame.addRelationTypeSlot)

        #ACTION TO EDIT THE MARKED DATATYPE
        editDataTypeAction = QAction("Edit Data Type...", QKeySequence(), self, "editDataTypeAction")
        editDataTypeAction.setIconSet(QIconSet(QPixmap.fromMimeSource("edit16.png")))

        #ACTION TO EDIT THE MARKED RELATIONTYPE
        editRelationTypeAction = QAction("Edit Relation Type...", QKeySequence(), self, "editRelationTypeAction")
        editRelationTypeAction.setIconSet(QIconSet(QPixmap.fromMimeSource("edit16.png")))

        #ACTION TO REMOVE THE MARKED ICON FROM SCREEN
        removeIconAction = QAction("Remove Icon", QKeySequence(), self, "removeIconAction")
        removeIconAction.setIconSet(QIconSet(QPixmap.fromMimeSource("delete16.png")))
        self.connect(removeIconAction, SIGNAL("activated()"), self.parent().removeIcon)

        #ACTION TO DELETE THE MARKED DATATYPEICON
        deleteDataTypeAction = QAction("Delete Data Type", QKeySequence(), self, "deleteDataTypeAction")
        deleteDataTypeAction.setIconSet(QIconSet(QPixmap.fromMimeSource("delete16.png")))
        self.connect(deleteDataTypeAction, SIGNAL("activated()"), self.myFrame.deleteSelectedDataType)

        #ACTION TO DELETE THE MARKED RELATIONTYPE
        deleteRelationTypeAction = QAction("Delete Relation Type", QKeySequence(), self, "deleteRelationTypeAction")
        deleteRelationTypeAction.setIconSet(QIconSet(QPixmap.fromMimeSource("delete16.png")))
        self.connect(deleteRelationTypeAction, SIGNAL("activated()"), self.myFrame.deleteSelectedRelationType)

        #CONTEXT-MENU IF NOTHING IS MARKED
        if context == 0:
            newDataTypeAction.addTo(self)
            newRelationTypeAction.addTo(self)

            self.insertSeparator()

            self.insertItem("Arrange Icons...", subMenu01)
            updateCanvasViewAction.addTo(self)

        else:
        #CONTEXT-MENU IF A DATATYPE IS MARKED
            if context.iconType == 1:
                dataTypeController = data_type_dialog.DataTypeController(self.myFrame, context.iconLabel, 
                                                                         self.myFrame.repositoryConfiguration)
                self.connect(editDataTypeAction, SIGNAL("activated()"), dataTypeController.show)

                editDataTypeAction.addTo(self)
                deleteDataTypeAction.addTo(self)

                self.insertSeparator()

                newDataTypeAction.addTo(self)
                newRelationTypeAction.addTo(self)

                self.insertSeparator()

                removeIconAction.addTo(self)
                self.insertItem("Arrange Icons...", subMenu01)
                updateCanvasViewAction.addTo(self)

        #CONTEXT-MENU IF A RELATIONTYPE IS MARKED
            if context.iconType == 2:
                relationTypeController = relation_type_dialog.RelationTypeController(self.myFrame, context.iconLabel, 
                                                                                     self.myFrame.repositoryConfiguration)
                self.connect(editRelationTypeAction, SIGNAL("activated()"), relationTypeController.show)

                editRelationTypeAction.addTo(self)
                deleteRelationTypeAction.addTo(self)

                self.insertSeparator()

                newDataTypeAction.addTo(self)
                newRelationTypeAction.addTo(self)

                self.insertSeparator()

                removeIconAction.addTo(self)
                self.insertItem("Arrange Icons...", subMenu01)
                updateCanvasViewAction.addTo(self)
Пример #4
0
    def initContextMenu(self, context):
        """
        Initiates the popup menu depending on the context and
        adds appropriate menu items.
        """

        #ACTION TO ARRANGE THE ICONS IN A LINE
        arrangeIcons01Action = QAction("Lines", QKeySequence(), self,
                                       "arrangeIcons01Actions")
        arrangeIcons01Action.setIconSet(QIconSet())
        self.connect(arrangeIcons01Action, SIGNAL("activated()"),
                     self.parent().arrangeIconsInLines)

        #ACTION TO ARRANGE THE ICONS IN A CIRCLE
        arrangeIcons02Action = QAction("Circle", QKeySequence(), self,
                                       "arrangeIcons02Actions")
        arrangeIcons02Action.setIconSet(QIconSet())
        self.connect(arrangeIcons02Action, SIGNAL("activated()"),
                     self.parent().arrangeIconsInCircle)

        #SUBMENU TO CHOOSE THE WAY OF ARRANGEMENT
        #----------------------------------------
        subMenu01 = QPopupMenu(self, "Arrange Icons")
        arrangeIcons01Action.addTo(subMenu01)
        arrangeIcons02Action.addTo(subMenu01)

        #ACTION TO UPDATE THE SCREEN
        updateCanvasViewAction = QAction("Update Screen", QKeySequence(), self,
                                         "updateCanvasViewAction")
        updateCanvasViewAction.setIconSet(QIconSet())
        self.connect(updateCanvasViewAction, SIGNAL("activated()"),
                     self.parent().updateCanvasView)

        #ACTION TO ADD A NEW DATATYPE
        newDataTypeAction = QAction("New Data Type...", QKeySequence(), self,
                                    "newDataTypeAction")
        newDataTypeAction.setIconSet(
            QIconSet(QPixmap.fromMimeSource("newDataType16.png")))
        self.connect(newDataTypeAction, SIGNAL("activated()"),
                     self.myFrame.addDataTypeSlot)

        #ACTION TO ADD A NEW RELATIONTYPE
        newRelationTypeAction = QAction("New Relation Type...", QKeySequence(),
                                        self, "newRelationTypeAction")
        newRelationTypeAction.setIconSet(
            QIconSet(QPixmap.fromMimeSource("newRelationType16.png")))
        self.connect(newRelationTypeAction, SIGNAL("activated()"),
                     self.myFrame.addRelationTypeSlot)

        #ACTION TO EDIT THE MARKED DATATYPE
        editDataTypeAction = QAction("Edit Data Type...", QKeySequence(), self,
                                     "editDataTypeAction")
        editDataTypeAction.setIconSet(
            QIconSet(QPixmap.fromMimeSource("edit16.png")))

        #ACTION TO EDIT THE MARKED RELATIONTYPE
        editRelationTypeAction = QAction("Edit Relation Type...",
                                         QKeySequence(), self,
                                         "editRelationTypeAction")
        editRelationTypeAction.setIconSet(
            QIconSet(QPixmap.fromMimeSource("edit16.png")))

        #ACTION TO REMOVE THE MARKED ICON FROM SCREEN
        removeIconAction = QAction("Remove Icon", QKeySequence(), self,
                                   "removeIconAction")
        removeIconAction.setIconSet(
            QIconSet(QPixmap.fromMimeSource("delete16.png")))
        self.connect(removeIconAction, SIGNAL("activated()"),
                     self.parent().removeIcon)

        #ACTION TO DELETE THE MARKED DATATYPEICON
        deleteDataTypeAction = QAction("Delete Data Type", QKeySequence(),
                                       self, "deleteDataTypeAction")
        deleteDataTypeAction.setIconSet(
            QIconSet(QPixmap.fromMimeSource("delete16.png")))
        self.connect(deleteDataTypeAction, SIGNAL("activated()"),
                     self.myFrame.deleteSelectedDataType)

        #ACTION TO DELETE THE MARKED RELATIONTYPE
        deleteRelationTypeAction = QAction("Delete Relation Type",
                                           QKeySequence(), self,
                                           "deleteRelationTypeAction")
        deleteRelationTypeAction.setIconSet(
            QIconSet(QPixmap.fromMimeSource("delete16.png")))
        self.connect(deleteRelationTypeAction, SIGNAL("activated()"),
                     self.myFrame.deleteSelectedRelationType)

        #CONTEXT-MENU IF NOTHING IS MARKED
        if context == 0:
            newDataTypeAction.addTo(self)
            newRelationTypeAction.addTo(self)

            self.insertSeparator()

            self.insertItem("Arrange Icons...", subMenu01)
            updateCanvasViewAction.addTo(self)

        else:
            #CONTEXT-MENU IF A DATATYPE IS MARKED
            if context.iconType == 1:
                dataTypeController = data_type_dialog.DataTypeController(
                    self.myFrame, context.iconLabel,
                    self.myFrame.repositoryConfiguration)
                self.connect(editDataTypeAction, SIGNAL("activated()"),
                             dataTypeController.show)

                editDataTypeAction.addTo(self)
                deleteDataTypeAction.addTo(self)

                self.insertSeparator()

                newDataTypeAction.addTo(self)
                newRelationTypeAction.addTo(self)

                self.insertSeparator()

                removeIconAction.addTo(self)
                self.insertItem("Arrange Icons...", subMenu01)
                updateCanvasViewAction.addTo(self)

        #CONTEXT-MENU IF A RELATIONTYPE IS MARKED
            if context.iconType == 2:
                relationTypeController = relation_type_dialog.RelationTypeController(
                    self.myFrame, context.iconLabel,
                    self.myFrame.repositoryConfiguration)
                self.connect(editRelationTypeAction, SIGNAL("activated()"),
                             relationTypeController.show)

                editRelationTypeAction.addTo(self)
                deleteRelationTypeAction.addTo(self)

                self.insertSeparator()

                newDataTypeAction.addTo(self)
                newRelationTypeAction.addTo(self)

                self.insertSeparator()

                removeIconAction.addTo(self)
                self.insertItem("Arrange Icons...", subMenu01)
                updateCanvasViewAction.addTo(self)