我在一个名为的文件中有以下类SymbolManager.py
:
from qgis.core import *
class SimbolManager:
def __init__(self):
self.initSymbols()
def initSymbols(self):
self.symbolMap = {}
props = {'color': '0,0,200'}
self.symbolMap['SimpleVertex'] = QgsMarkerSymbolV2.createSimple(props)
props = {'width': '1', 'color': '0,0,255'}
self.symbolMap['SimpleLine'] = QgsLineSymbolV2.createSimple(props)
def getSymbolRenderer(self, name):
symb = self.symbolMap[name]
if symb is not None:
return QgsSingleSymbolRendererV2(symb)
return None
从同一目录中的文件中,我尝试以SymbolManager
这种方式导入:
from PyQt4 import QtCore, QtGui
from Ui_OsmNavigator import Ui_OsmNavigator
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
import DbConnection
from SymbolManager import SymbolManager // HERE IS THE PROBLEM
当我运行脚本时,从 QGIS 内部它给了我以下错误:
第 28 行,在 from SymbolManager import SymbolManager ImportError: cannot import name SymbolManager
我究竟做错了什么?