pturmel, – Boy you’re being tough on me today.
First, I always check event.propertyName
The propertyChange event handler for this template is below, however the template does contain other templates that have their own propertyChange event handlers.
The other thing, is that if it was because of the looping property changes I would expect that it would happen more frequently, and not just start to go slower and then get stuck. Since I sent the first message, I left the thing there and 3 hours later it was still spinning.
I would not be against the idea that there was an endless loop going on, but I’m not sure what, and the log messages that I have are not being triggered during the issue.
logger = event.source.getLogger("propertyChange")
#logger.info("PropertyChange Name = %s, Value %s --> %s" % (str(event.propertyName), str(event.oldValue), str(event.newValue)))
if event.propertyName in ( 'editor', 'componentRunning' ):
logger.info("Component Running")
event.source.ComponentInitialized = True
elif event.propertyName == "OnDeckRecipeNumber":
logger.info("PropertyChange Name = %s, Value %s --> %s" % (str(event.propertyName), str(event.oldValue), str(event.newValue)))
event.source.setOnDeckOrCurrentFlags(event.newValue, event.source.CurrentRecipeNumber)
elif event.propertyName == "CurrentRecipeNumber":
logger.info("PropertyChange Name = %s, Value %s --> %s" % (str(event.propertyName), str(event.oldValue), str(event.newValue)))
event.source.setOnDeckOrCurrentFlags(event.source.OnDeckRecipeNumber, event.newValue)
elif event.propertyName in ( "BinId", "FieldId", "VarietyId" ):
if event.source.ComponentInitialized and event.oldValue == 0 and event.source.ShearSettings == 0:
logger.info("PropertyChange Name = %s, Value %s --> %s" % (str(event.propertyName), str(event.oldValue), str(event.newValue)))
binId = event.source.BinId
fieldId = event.source.FieldId
varietyId = event.source.VarietyId
if event.propertyName == "BinId":
binId = event.newValue
elif event.propertyName == "FieldId":
fieldId = event.newValue
elif event.propertyName == "VarietyId":
varietyId = event.newValue
if binId > 0 and fieldId > 0 and varietyId > 0:
logger.info("Initializing Values")
event.source.ShearSettings = 1
event.source.ManualTank = False
if event.source.HaveSizer:
event.source.RatioDiameterMode = 1
event.source.RatioValue = event.source.DefaultRatioValue
event.source.DiameterValue = event.source.DefaultDiameterValue
elif event.propertyName == "SelectBox": # Check Box Indicator Field (Somebody else changed it)
if event.source.SelectRecipe != event.newValue:
logger.info("PropertyChange Name = %s, Value %s --> %s" % (str(event.propertyName), str(event.oldValue), str(event.newValue)))
event.source.SelectRecipe = event.newValue
elif event.propertyName == "SelectRecipe": # Check Box Control Field (Checkbox was clicked or pressed)
if not event.newValue: # Transition from True to False
if event.source.IsOnDeckJob:
logger.info("PropertyChange Name = %s, Value %s --> %s ==> Remove from On Deck" % (str(event.propertyName), str(event.oldValue), str(event.newValue)))
event.source.SelectBox = False # The propertyChange for SelectBox will clear the On Deck Recipe for me (I hope)
else:
if not event.source.IsOnDeckJob and not event.source.IsCurrentJob:
if event.source.OnDeckRecipeNumber <= 0:
logger.info("PropertyChange Name = %s, Value %s --> %s ==> Put On Deck" % (str(event.propertyName), str(event.oldValue), str(event.newValue)))
def loadOnDeck(event=event):
event.source.loadOnDeckRecipe(event.source.RecipeNumber)
system.util.invokeLater(loadOnDeck, 100)
else:
system.gui.errorBox("Deselect the On Deck grading job before putting another job On Deck")
def resetSelectRecipe(event=event):
event.source.SelectRecipe = False
system.util.invokeLater(resetSelectRecipe,100)
elif event.propertyName == "ClearRequested":
if event.newValue:
logger.info("PropertyChange Name = %s, Value %s --> %s" % (str(event.propertyName), str(event.oldValue), str(event.newValue)))
def processClearRequested(event=event):
event.source.processClearButton()
system.util.invokeLater(processClearRequested, 500)