"""
    inspector
"""
from __future__ import absolute_import, division, print_function
import logging
from PySide import QtGui
from mcedit2.util.load_ui import load_ui

log = logging.getLogger(__name__)


class InspectorWidget(QtGui.QWidget):
    def __init__(self, editorSession):
        """

        :param editorSession:
        :type editorSession: mcedit2.editorsession.EditorSession
        :return:
        :rtype:
        """
        super(InspectorWidget, self).__init__()
        load_ui("inspector.ui", baseinstance=self)
        self.editorSession = editorSession

        self.blockNBTEditor.editorSession = self.editorSession
        self.blockNBTEditor.editMade.connect(self.editWasMade)

        self.entityNBTEditor.editorSession = self.editorSession
        self.entityNBTEditor.editMade.connect(self.editWasMade)

        self.tileEntity = None
        self.entity = None


    def editWasMade(self):
        if self.currentEntity and self.currentEntity.chunk:
            self.currentEntity.chunk.dirty = True

    def inspectBlock(self, pos):
        self.stackedWidget.setCurrentWidget(self.pageInspectBlock)
        x, y, z = pos
        self.blockXLabel.setText(str(x))
        self.blockYLabel.setText(str(y))
        self.blockZLabel.setText(str(z))
        self.tileEntity = self.editorSession.currentDimension.getTileEntity(pos)
        if self.tileEntity is not None:
            self.blockNBTEditor.setRootTag(self.tileEntity.raw_tag())

        self.removeTileEntityButton.setEnabled(self.tileEntity is not None)

    def inspectEntity(self, entity):
        self.entity = entity
        self.stackedWidget.setCurrentWidget(self.pageInspectEntity)
        self.entityIDLabel.setText(entity.id)
        try:
            self.entityUUIDLabel.setText(entity.UUID)
        except KeyError:
            self.entityUUIDLabel.setText(self.tr("(Not set)"))

        x, y, z = entity.Position
        self.entityXLabel.setText("%0.2f" % x)
        self.entityYLabel.setText("%0.2f" % y)
        self.entityZLabel.setText("%0.2f" % z)

        self.entityNBTEditor.setRootTag(entity.raw_tag())

@@ -1461,16 +1461,78 @@
 _tag())%0A
+        else:%0A            self.blockNBTEditor.setRootTag(None)
 %0A       
@@ -1831,24 +1831,28 @@
 bel.setText(
+str(
 entity.UUID)
@@ -1851,16 +1851,17 @@
 ty.UUID)
+)
 %0A       

Clear tileEntity inspector when no tile entity, use correct type for entity UUID label