Exemplo n.º 1
0
    def Symbols(self):
        """ Load symbols settings from config file
        """

        # Loading symbols conf
        basegroup = "Symbol.settings"
        c = ConfDB()
        c.beginGroup(basegroup)
        childGroups = c.childGroups()
        c.endGroup()

        loaded_symbols = []
        for id in childGroups:

            cgroup = basegroup + '/' + id
            name = str(c.get(cgroup + "/name", 'default'))
            type =  str(c.get(cgroup + "/type", 'DecorativeNode'))
            object = DecorativeNode
            for (object_class, type_name) in SYMBOL_TYPES.iteritems():
                if type_name == type:
                    object = object_class
                    break

            normal_svg_file = str(c.get(cgroup + "/normal_svg_file", ':/icons/default.svg'))
            selected_svg_file = str(c.get(cgroup + "/selected_svg_file", ':/icons/default.svg'))

            SYMBOLS.append(
                                {'name': name, 'object': object,
                                'normal_svg_file': normal_svg_file,
                                'select_svg_file': selected_svg_file, 
                                'translated': False})
Exemplo n.º 2
0
    def Symbols(self):
        """ Load symbols settings from config file
        """

        # Loading symbols conf
        basegroup = "Symbol.settings"
        c = ConfDB()
        c.beginGroup(basegroup)
        childGroups = c.childGroups()
        c.endGroup()

        loaded_symbols = []
        for id in childGroups:

            cgroup = basegroup + '/' + id
            name = str(c.get(cgroup + "/name", 'default'))
            type = str(c.get(cgroup + "/type", 'DecorativeNode'))
            object = DecorativeNode
            for (object_class, type_name) in SYMBOL_TYPES.iteritems():
                if type_name == type:
                    object = object_class
                    break

            normal_svg_file = str(
                c.get(cgroup + "/normal_svg_file", ':/icons/default.svg'))
            selected_svg_file = str(
                c.get(cgroup + "/selected_svg_file", ':/icons/default.svg'))

            SYMBOLS.append({
                'name': name,
                'object': object,
                'normal_svg_file': normal_svg_file,
                'select_svg_file': selected_svg_file,
                'translated': False
            })
Exemplo n.º 3
0
    def slotAdd(self):
        """ Add a symbol to the node list
        """

        symbols = self.treeWidgetSymbols.selectedItems()
        for symbol in symbols:
            name = unicode(symbol.text(0))
            resource_symbol = unicode(symbol.data(0, QtCore.Qt.UserRole).toString())
            if resource_symbol.startswith(':/symbols/'):
                normal_svg_file = resource_symbol
                selected_svg_file = ':/symbols/' + name + '.selected.svg'
            else:
                normal_svg_file = selected_svg_file = resource_symbol

            SYMBOLS.append(
                           {'name': name, 'object': DecorativeNode,
                            'normal_svg_file': normal_svg_file,
                            'select_svg_file': selected_svg_file,
                            'translated': False})

            item = QtGui.QTreeWidgetItem(self.treeWidgetNodes)
            item.setText(0, name)
            item.setIcon(0, symbol.icon(0))
            item.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(translate("nodesDock", "Decorative node")))
            item.setSelected(True)

            self.lineEditNodeName.setText(name)
            index = self.comboBoxNodeType.findText(translate("nodesDock", "Decorative node"))
            if index != -1:
                self.comboBoxNodeType.setCurrentIndex(index)
            self.treeWidgetNodes.setCurrentItem(item)