Fix #291 - FillCommandWidget cached globally instead of per-session

This commit is contained in:
David Vierra 2017-03-13 16:54:58 -10:00
parent b5d0553129
commit db38556357

View File

@ -18,15 +18,13 @@ class FillCommandWidget(QtGui.QDialog, Ui_fillDialog):
self.blockTypeInput.editorSession = editorSession
self.blockTypeInput.block = "minecraft:stone"
_fillWidget = None
# xxxx why?
# Cache the FillCommandWidget on the session. Gross.
def getFillWidget(editorSession):
global _fillWidget
if _fillWidget is None:
_fillWidget = FillCommandWidget(editorSession)
_fillWidget.editorSession = editorSession
return _fillWidget
widget = getattr(editorSession, '_fillWidget', None)
if widget is None:
widget = editorSession._fillWidget = FillCommandWidget(editorSession)
return widget
def fillCommand(editorSession):