本文整理汇总了Python中pyqtcore.QList.clear方法的典型用法代码示例。如果您正苦于以下问题:Python QList.clear方法的具体用法?Python QList.clear怎么用?Python QList.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtcore.QList
的用法示例。
在下文中一共展示了QList.clear方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tileset
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
class Tileset(Object):
##
# Constructor.
#
# @param name the name of the tileset
# @param tileWidth the width of the tiles in the tileset
# @param tileHeight the height of the tiles in the tileset
# @param tileSpacing the spacing between the tiles in the tileset image
# @param margin the margin around the tiles in the tileset image
##
def __init__(self, name, tileWidth, tileHeight, tileSpacing = 0, margin = 0):
super().__init__(Object.TilesetType)
self.mName = name
self.mTileWidth = tileWidth
self.mTileHeight = tileHeight
self.mTileSpacing = tileSpacing
self.mMargin = margin
self.mImageWidth = 0
self.mImageHeight = 0
self.mColumnCount = 0
self.mTerrainDistancesDirty = False
self.mTileOffset = QPoint()
self.mFileName = QString()
self.mTiles = QList()
self.mTransparentColor = QColor()
self.mImageSource = QString()
self.mTerrainTypes = QList()
self.mWeakPointer = None
##
# Destructor.
##
def __del__(self):
self.mTiles.clear()
self.mTerrainTypes.clear()
def create(name, tileWidth, tileHeight, tileSpacing = 0, margin = 0):
tileset = Tileset(name, tileWidth, tileHeight, tileSpacing, margin)
tileset.mWeakPointer = tileset
return tileset
def __iter__(self):
return self.mTiles.__iter__()
##
# Returns the name of this tileset.
##
def name(self):
return self.mName
##
# Sets the name of this tileset.
##
def setName(self, name):
self.mName = name
##
# Returns the file name of this tileset. When the tileset isn't an
# external tileset, the file name is empty.
##
def fileName(self):
return self.mFileName
##
# Sets the filename of this tileset.
##
def setFileName(self, fileName):
self.mFileName = fileName
##
# Returns whether this tileset is external.
##
def isExternal(self):
return self.mFileName!=''
##
# Returns the maximum width of the tiles in this tileset.
##
def tileWidth(self):
return self.mTileWidth
##
# Returns the maximum height of the tiles in this tileset.
##
def tileHeight(self):
return self.mTileHeight
##
# Returns the maximum size of the tiles in this tileset.
##
def tileSize(self):
return QSize(self.mTileWidth, self.mTileHeight)
##
# Returns the spacing between the tiles in the tileset image.
##
def tileSpacing(self):
return self.mTileSpacing
#.........这里部分代码省略.........
示例2: QtButtonPropertyBrowserPrivate
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
class QtButtonPropertyBrowserPrivate():
def __init__(self):
self.q_ptr = None
self.WidgetItem = WidgetItem()
self.m_indexToItem = QMap()
self.m_itemToIndex = QMap()
self.m_widgetToItem = QMap()
self.m_buttonToItem = QMap()
self.m_mainLayout = None
self.m_children = QList()
self.m_recreateQueue = QList()
def createEditor(self, property, parent):
return self.q_ptr.createEditor(property, parent)
def createButton(self, parent=None):
button = QToolButton(parent)
button.setCheckable(True)
button.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed))
button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
button.setArrowType(Qt.DownArrow)
button.setIconSize(QSize(3, 16))
###
#QIcon icon
#icon.addPixmap(self.style().standardPixmap(QStyle.SP_ArrowDown), QIcon.Normal, QIcon.Off)
#icon.addPixmap(self.style().standardPixmap(QStyle.SP_ArrowUp), QIcon.Normal, QIcon.On)
#button.setIcon(icon)
###
return button
def gridRow(self, item):
siblings = QList()
if (item.parent):
siblings = item.parent.children
else:
siblings = self.m_children
row = 0
for sibling in siblings:
if (sibling == item):
return row
row += self.gridSpan(sibling)
return -1
def gridSpan(self, item):
if (item.container and item.expanded):
return 2
return 1
def init(self, parent):
self.m_mainLayout = QGridLayout()
parent.setLayout(self.m_mainLayout)
item = QSpacerItem(0, 0, QSizePolicy.Fixed, QSizePolicy.Expanding)
self.m_mainLayout.addItem(item, 0, 0)
def slotEditorDestroyed(self):
editor = self.q_ptr.sender()
if (not editor):
return
if not self.m_widgetToItem.get(editor):
return
self.m_widgetToItem[editor].widget = 0
self.m_widgetToItem.remove(editor)
def slotUpdate(self):
for item in self.m_recreateQueue:
parent = item.parent
w = 0
l = 0
oldRow = self.gridRow(item)
if (parent):
w = parent.container
l = parent.layout
else:
w = self.q_ptr
l = self.m_mainLayout
span = 1
if (not item.widget and not item.widgetLabel):
span = 2
item.label = QLabel(w)
item.label.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
l.addWidget(item.label, oldRow, 0, 1, span)
self.updateItem(item)
self.m_recreateQueue.clear()
def setExpanded(self, item, expanded):
if (item.expanded == expanded):
return
if (not item.container):
return
item.expanded = expanded
row = self.gridRow(item)
parent = item.parent
l = 0
#.........这里部分代码省略.........
示例3: Map
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
#.........这里部分代码省略.........
self.mDrawMargins = map.mDrawMargins
self.mTilesets = map.mTilesets
self.mLayerDataFormat = map.mLayerDataFormat
self.mNextObjectId = 1
for layer in map.mLayers:
clone = layer.clone()
clone.setMap(self)
self.mLayers.append(clone)
elif l==5:
##
# Constructor, taking map orientation, size and tile size as parameters.
##
orientation, width, height, tileWidth, tileHeight = args
super().__init__(Object.MapType)
self.mLayers = QList()
self.mTilesets = QList()
self.mOrientation = orientation
self.mRenderOrder = Map.RenderOrder.RightDown
self.mWidth = width
self.mHeight = height
self.mTileWidth = tileWidth
self.mTileHeight = tileHeight
self.mHexSideLength = 0
self.mStaggerAxis = Map.StaggerAxis.StaggerY
self.mStaggerIndex = Map.StaggerIndex.StaggerOdd
self.mLayerDataFormat = Map.LayerDataFormat.Base64Zlib
self.mNextObjectId = 1
##
# Destructor.
##
def __del__(self):
self.mLayers.clear()
##
# Returns the orientation of the map.
##
def orientation(self):
return self.mOrientation
##
# Sets the orientation of the map.
##
def setOrientation(self, orientation):
self.mOrientation = orientation
##
# Returns the render order of the map.
##
def renderOrder(self):
return self.mRenderOrder
##
# Sets the render order of the map.
##
def setRenderOrder(self, renderOrder):
self.mRenderOrder = renderOrder
##
# Returns the width of this map in tiles.
##
def width(self):
return self.mWidth
##
示例4: QtGroupBoxPropertyBrowserPrivate
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
class QtGroupBoxPropertyBrowserPrivate():
def __init__(self):
self.q_ptr = None
self.m_indexToItem = QMap()
self.m_itemToIndex = QMap()
self.m_widgetToItem = QMap()
self.m_mainLayout = 0
self.m_children = QList()
self.m_recreateQueue = QList()
def createEditor(self, property, parent):
return self.q_ptr.createEditor(property, parent)
def init(self, parent):
self.m_mainLayout = QGridLayout()
parent.setLayout(self.m_mainLayout)
item = QSpacerItem(0, 0, QSizePolicy.Fixed, QSizePolicy.Expanding)
self.m_mainLayout.addItem(item, 0, 0)
def slotEditorDestroyed(self):
editor = self.q_ptr.sender()
if (not editor):
return
if (not editor in self.m_widgetToItem.keys()):
return
self.m_widgetToItem[editor].widget = 0
self.m_widgetToItem.remove(editor)
def slotUpdate(self):
for item in self.m_recreateQueue:
par = item.parent
w = 0
l = 0
oldRow = -1
if (not par):
w = self.q_ptr
l = self.m_mainLayout
oldRow = self.m_children.indexOf(item)
else:
w = par.groupBox
l = par.layout
oldRow = par.children.indexOf(item)
if (self.hasHeader(par)):
oldRow += 2
if (item.widget):
item.widget.setParent(w)
elif (item.widgetLabel):
item.widgetLabel.setParent(w)
else:
item.widgetLabel = QLabel(w)
item.widgetLabel.setSizePolicy(QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed))
item.widgetLabel.setTextFormat(Qt.PlainText)
span = 1
if (item.widget):
l.addWidget(item.widget, oldRow, 1, 1, 1)
elif (item.widgetLabel):
l.addWidget(item.widgetLabel, oldRow, 1, 1, 1)
else:
span = 2
item.label = QLabel(w)
item.label.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
l.addWidget(item.label, oldRow, 0, 1, span)
self.updateItem(item)
self.m_recreateQueue.clear()
def updateLater(self):
QTimer.singleShot(0, self.q_ptr, self.slotUpdate())
def propertyInserted(self, index, afterIndex):
afterItem = self.m_indexToItem[afterIndex]
parentItem = self.m_indexToItem.value(index.parent())
newItem = WidgetItem()
newItem.parent = parentItem
layout = 0
parentWidget = 0
row = -1
if (not afterItem):
row = 0
if (parentItem):
parentItem.children.insert(0, newItem)
else:
self.m_children.insert(0, newItem)
else:
if (parentItem):
row = parentItem.children.indexOf(afterItem) + 1
parentItem.children.insert(row, newItem)
else:
row = self.m_children.indexOf(afterItem) + 1
self.m_children.insert(row, newItem)
if (parentItem and self.hasHeader(parentItem)):
row += 2
if (not parentItem):
#.........这里部分代码省略.........
示例5: ObjectGroup
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
class ObjectGroup(Layer):
##
# Objects within an object group can either be drawn top down (sorted
# by their y-coordinate) or by index (manual stacking order).
#
# The default is top down.
##
class DrawOrder():
UnknownOrder = -1
TopDownOrder = 1
IndexOrder = 2
##
# Default constructor.
##
def __init__(self, *args):
self.mObjects = QList()
self.mColor = QColor()
l = len(args)
if l==0:
super().__init__(Layer.ObjectGroupType, QString(), 0, 0, 0, 0)
elif l==5:
##
# Constructor with some parameters.
##
name, x, y, width, height = args
super().__init__(Layer.ObjectGroupType, name, x, y, width, height)
else:
pass
self.mDrawOrder = ObjectGroup.DrawOrder.IndexOrder
##
# Destructor.
##
def __del__(self):
self.mObjects.clear()
##
# Returns a pointer to the list of objects in this object group.
##
def objects(self):
return QList(self.mObjects)
##
# Returns the number of objects in this object group.
##
def objectCount(self):
return self.mObjects.size()
##
# Returns the object at the specified index.
##
def objectAt(self, index):
return self.mObjects.at(index)
##
# Adds an object to this object group.
##
def addObject(self, object):
self.mObjects.append(object)
object.setObjectGroup(self)
if (self.mMap and object.id() == 0):
object.setId(self.mMap.takeNextObjectId())
##
# Inserts an object at the specified index. This is only used for undoing
# the removal of an object at the moment, to make sure not to change the
# saved order of the objects.
##
def insertObject(self, index, object):
self.mObjects.insert(index, object)
object.setObjectGroup(self)
if (self.mMap and object.id() == 0):
object.setId(self.mMap.takeNextObjectId())
##
# Removes an object from this object group. Ownership of the object is
# transferred to the caller.
#
# @return the index at which the specified object was removed
##
def removeObject(self, object):
index = self.mObjects.indexOf(object)
self.mObjects.removeAt(index)
object.setObjectGroup(None)
return index
##
# Removes the object at the given index. Ownership of the object is
# transferred to the caller.
#
# This is faster than removeObject when you've already got the index.
#
# @param index the index at which to remove an object
##
def removeObjectAt(self, index):
object = self.mObjects.takeAt(index)
object.setObjectGroup(None)
#.........这里部分代码省略.........
示例6: QtCursorDatabase
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
class QtCursorDatabase():
def __init__(self):
self.m_cursorNames = QList()
self.m_cursorIcons = QMap()
self.m_valueToCursorShape = QMap()
self.m_cursorShapeToValue = QMap()
self.appendCursor(Qt.ArrowCursor, QCoreApplication.translate("QtCursorDatabase", "Arrow"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-arrow.png"))
self.appendCursor(Qt.UpArrowCursor, QCoreApplication.translate("QtCursorDatabase", "Up Arrow"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-uparrow.png"))
self.appendCursor(Qt.CrossCursor, QCoreApplication.translate("QtCursorDatabase", "Cross"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-cross.png"))
self.appendCursor(Qt.WaitCursor, QCoreApplication.translate("QtCursorDatabase", "Wait"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-wait.png"))
self.appendCursor(Qt.IBeamCursor, QCoreApplication.translate("QtCursorDatabase", "IBeam"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-ibeam.png"))
self.appendCursor(Qt.SizeVerCursor, QCoreApplication.translate("QtCursorDatabase", "Size Vertical"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizev.png"))
self.appendCursor(Qt.SizeHorCursor, QCoreApplication.translate("QtCursorDatabase", "Size Horizontal"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeh.png"))
self.appendCursor(Qt.SizeFDiagCursor, QCoreApplication.translate("QtCursorDatabase", "Size Backslash"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizef.png"))
self.appendCursor(Qt.SizeBDiagCursor, QCoreApplication.translate("QtCursorDatabase", "Size Slash"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeb.png"))
self.appendCursor(Qt.SizeAllCursor, QCoreApplication.translate("QtCursorDatabase", "Size All"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeall.png"))
self.appendCursor(Qt.BlankCursor, QCoreApplication.translate("QtCursorDatabase", "Blank"),
QIcon())
self.appendCursor(Qt.SplitVCursor, QCoreApplication.translate("QtCursorDatabase", "Split Vertical"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-vsplit.png"))
self.appendCursor(Qt.SplitHCursor, QCoreApplication.translate("QtCursorDatabase", "Split Horizontal"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-hsplit.png"))
self.appendCursor(Qt.PointingHandCursor, QCoreApplication.translate("QtCursorDatabase", "Pointing Hand"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-hand.png"))
self.appendCursor(Qt.ForbiddenCursor, QCoreApplication.translate("QtCursorDatabase", "Forbidden"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-forbidden.png"))
self.appendCursor(Qt.OpenHandCursor, QCoreApplication.translate("QtCursorDatabase", "Open Hand"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-openhand.png"))
self.appendCursor(Qt.ClosedHandCursor, QCoreApplication.translate("QtCursorDatabase", "Closed Hand"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-closedhand.png"))
self.appendCursor(Qt.WhatsThisCursor, QCoreApplication.translate("QtCursorDatabase", "What's This"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-whatsthis.png"))
self.appendCursor(Qt.BusyCursor, QCoreApplication.translate("QtCursorDatabase", "Busy"),
QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-busy.png"))
def clear(self):
self.m_cursorNames.clear()
self.m_cursorIcons.clear()
self.m_valueToCursorShape.clear()
self.m_cursorShapeToValue.clear()
def appendCursor(self,shape, name, icon):
if self.m_cursorShapeToValue.get(shape):
return
value = len(self.m_cursorNames)
self.m_cursorNames.append(name)
self.m_cursorIcons[value] = icon
self.m_valueToCursorShape[value] = shape
self.m_cursorShapeToValue[shape] = value
def cursorShapeNames(self):
return self.m_cursorNames
def cursorShapeIcons(self):
return self.m_cursorIcons
def cursorToShapeName(self,cursor):
val = self.cursorToValue(cursor)
if val >= 0:
return self.m_cursorNames[val]
return ''
def cursorToShapeIcon(self,cursor):
val = self.cursorToValue(cursor)
return self.m_cursorIcons[val]
def cursorToValue(self,cursor):
shape = cursor.shape()
return self.m_cursorShapeToValue.get(shape, -1)
def valueToCursor(self,value):
if value in self.m_valueToCursorShape:
return QCursor(self.m_valueToCursorShape[value])
return QCursor()
示例7: MapObjectModel
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
#.........这里部分代码省略.........
def toObjectGroup(self, index):
if (not index.isValid()):
return None
oog = index.internalPointer()
if oog:
return oog.mGroup
def toMapObject(self, index):
if (not index.isValid()):
return None
oog = index.internalPointer()
if oog:
return oog.mObject
def toLayer(self, index):
if (not index.isValid()):
return None
oog = index.internalPointer()
if oog:
if oog.mGroup:
_x = oog.mGroup
else:
_x = oog.mObject.objectGroup()
return _x
def setMapDocument(self, mapDocument):
if (self.mMapDocument == mapDocument):
return
if (self.mMapDocument):
self.mMapDocument.disconnect()
self.beginResetModel()
self.mMapDocument = mapDocument
self.mMap = None
self.mObjectGroups.clear()
self.mGroups.clear()
self.mGroups.clear()
self.mObjects.clear()
self.mObjects.clear()
if (self.mMapDocument):
self.mMap = self.mMapDocument.map()
self.mMapDocument.layerAdded.connect(self.layerAdded)
self.mMapDocument.layerChanged.connect(self.layerChanged)
self.mMapDocument.layerAboutToBeRemoved.connect(self.layerAboutToBeRemoved)
for og in self.mMap.objectGroups():
if GROUPS_IN_DISPLAY_ORDER:
self.mObjectGroups.prepend(og)
else:
self.mObjectGroups.append(og)
self.mGroups.insert(og, ObjectOrGroup(og))
for o in og.objects():
self.mObjects.insert(o, ObjectOrGroup(o))
self.endResetModel()
def insertObject(self, og, index, o):
if (index >= 0):
_x = index
else:
_x = og.objectCount()
row = _x
self.beginInsertRows(self.index(og), row, row)
og.insertObject(row, o)
self.mObjects.insert(o, ObjectOrGroup(o))
self.endInsertRows()
self.objectsAdded.emit(QList([o]))
示例8: TileStampModel
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
#.........这里部分代码省略.........
self.beginRemoveRows(parent, row, row + count - 1)
for x in range(count, 0, -1):
self.mThumbnailCache.remove(stamp.variations().at(row).map)
stamp.deleteVariation(row)
self.endRemoveRows()
if (stamp.variations().isEmpty()):
# remove stamp since all its variations were removed
self.beginRemoveRows(QModelIndex(), parent.row(), parent.row())
self.stampRemoved.emit(stamp)
self.mStamps.removeAt(parent.row())
self.endRemoveRows()
else :
if (row == 0):
# preview on stamp and probability sum need update
# (while technically I think this is correct, it triggers a
# repainting issue in QTreeView)
#emit dataChanged(index(parent.row(), 0),
# self.index(parent.row(), 1))
pass
self.stampChanged.emit(stamp)
else :
# removing stamps
self.beginRemoveRows(parent, row, row + count - 1)
for x in range(count, 0, -1):
for variation in self.mStamps.at(row).variations():
self.mThumbnailCache.remove(variation.map)
self.stampRemoved.emit(self.mStamps.at(row))
self.mStamps.removeAt(row)
self.endRemoveRows()
return True
##
# Returns the stamp at the given \a index.
##
def stampAt(self, index):
return self.mStamps.at(index.row())
def isStamp(self, index):
return index.isValid() \
and not index.parent().isValid() \
and index.row() < self.mStamps.size()
def variationAt(self, index):
if (not index.isValid()):
return None
parent = index.parent()
if (self.isStamp(parent)):
stamp = self.mStamps.at(parent.row())
return stamp.variations().at(index.row())
return None
def stamps(self):
return self.mStamps
def addStamp(self, stamp):
if (self.mStamps.contains(stamp)):
return
self.beginInsertRows(QModelIndex(), self.mStamps.size(), self.mStamps.size())
self.mStamps.append(stamp)
self.stampAdded.emit(stamp)
self.endInsertRows()
def removeStamp(self, stamp):
index = self.mStamps.indexOf(stamp)
if (index == -1):
return
self.beginRemoveRows(QModelIndex(), index, index)
self.mStamps.removeAt(index)
self.endRemoveRows()
for variation in stamp.variations():
self.mThumbnailCache.remove(variation.map)
self.stampRemoved.emit(stamp)
def addVariation(self, stamp, variation):
index = self.mStamps.indexOf(stamp)
if (index == -1):
return
variationCount = stamp.variations().size()
if (variationCount == 1):
self.beginInsertRows(TileStampModel.index(index, 0), 0, 1)
else:
self.beginInsertRows(TileStampModel.index(index, 0),
variationCount, variationCount)
self.mStamps[index].addVariation(variation)
self.endInsertRows()
probabilitySumIndex = TileStampModel.index(index, 1)
self.dataChanged.emit(probabilitySumIndex, probabilitySumIndex)
self.stampChanged.emit(stamp)
def clear(self):
self.beginResetModel()
self.mStamps.clear()
self.mThumbnailCache.clear()
self.endResetModel()
示例9: AutoMapper
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import clear [as 别名]
#.........这里部分代码省略.........
def setupRuleMapProperties(self):
properties = self.mMapRules.properties()
for key in properties.keys():
value = properties.value(key)
raiseWarning = True
if (key.toLower() == "deletetiles"):
if (value.canConvert(QVariant.Bool)):
self.mDeleteTiles = value.toBool()
raiseWarning = False
elif (key.toLower() == "automappingradius"):
if (value.canConvert(QVariant.Int)):
self.mAutoMappingRadius = value
raiseWarning = False
elif (key.toLower() == "nooverlappingrules"):
if (value.canConvert(QVariant.Bool)):
self.mNoOverlappingRules = value.toBool()
raiseWarning = False
if (raiseWarning):
self.mWarning += self.tr("'%s': Property '%s' = '%s' does not make sense. \nIgnoring this property."%(self.mRulePath, key, value.toString()) + '\n')
return True
def cleanUpRulesMap(self):
self.cleanTilesets()
# mMapRules can be empty, when in prepareLoad the very first stages fail.
if (not self.mMapRules):
return
tilesetManager = TilesetManager.instance()
tilesetManager.removeReferences(self.mMapRules.tilesets())
del self.mMapRules
self.mMapRules = None
self.cleanUpRuleMapLayers()
self.mRulesInput.clear()
self.mRulesOutput.clear()
##
# Searches the rules layer for regions and stores these in \a rules.
# @return returns True when anything is ok, False when errors occured.
##
def setupRuleList(self):
combinedRegions = coherentRegions(
self.mLayerInputRegions.region() +
self.mLayerOutputRegions.region())
combinedRegions = QList(sorted(combinedRegions, key=lambda x:x.y(), reverse=True))
rulesInput = coherentRegions(
self.mLayerInputRegions.region())
rulesOutput = coherentRegions(
self.mLayerOutputRegions.region())
for i in range(combinedRegions.size()):
self.mRulesInput.append(QRegion())
self.mRulesOutput.append(QRegion())
for reg in rulesInput:
for i in range(combinedRegions.size()):
if (reg.intersects(combinedRegions[i])):
self.mRulesInput[i] += reg
break
for reg in rulesOutput:
for i in range(combinedRegions.size()):
if (reg.intersects(combinedRegions[i])):
self.mRulesOutput[i] += reg
break
for i in range(self.mRulesInput.size()):