-3

我在一个名为的文件中有以下类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

我究竟做错了什么?

4

1 回答 1

4

因为你的课没有被叫SymbolManager

class SimbolManager: 
      ^^^^^^
于 2012-11-30T11:42:57.623 回答