When I change a module, the designer is not picking up the change.
I think it is because I am using dynamic loading. While debugging the following (app.colour), as soon as I got the dynamic loading working, any changes in the loaded module(app.sc5802) were no longer reflected in the running code. I have to close and reopen the designer to pick up the changes.
code:
app.colour
def find_2_colour(data):
import fpmi
switch1 = data[0]
switch2 = data[1]
_sw1 = __import__("app." + switch1[0], globals(), locals(), ['*'])
_sw2 = __import__("app." + switch2[0], globals(), locals(), ['*'])
# get required info to start
closed1 = _sw1.is_closed(switch1[1])
closed2 = _sw2.is_closed(switch2[1])
current1 = _sw1.current(switch1[1])
current2 = _sw2.current(switch1[1])
# check for open switches first
if closed1 and closed2:
if current1 > current2:
return 1
elif current1 < current2:
return 2
else:
return 0
elif not closed1 and closed2: # one sw open 'ther one closed
return 2
elif closed1 and not closed2: # other way 'round
return 1
# one or more switches are offline or unknown
return 0
app.sc5802
def is_closed(data):
device = data[0]
breaker = data[1]
from fpmi.gui import getWindow
window = getWindow("Test colour changes lines")
_device = window.rootContainer.getComponent(device)
if breaker == 1:
breaker = _substation.SW1OpenStatus
elif breaker == 2:
breaker = _substation.SW2OpenStatus
else:
breaker = 9999
if breaker == 2:
return 1
if breaker == 3:
return 0
return
def current(data):
device = data[0]
breaker = data[1]
from fpmi.gui import getWindow
window = getWindow("Test colour changes lines")
_device = window.rootContainer.getComponent(device)
return _device.getPropertyValue("%dVA"%(breaker))