Skip to content

Commit 7fcb701

Browse files
committed
gladevcp -gth_action: add ability to run new style INI MDI commands
named INI MDI commands were not recognised.
1 parent 755e22d commit 7fcb701

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

lib/python/gladevcp/gtk_action.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,23 @@ def CALL_MDI_WAIT(self, code, time=5, mode_return=False):
191191
self.ensure_mode(premode)
192192
return 0
193193

194-
def CALL_INI_MDI(self, number):
194+
def CALL_INI_MDI(self, key):
195195
try:
196-
mdi = INFO.MDI_COMMAND_LIST[number]
196+
# prefer named INI MDI commands
197+
mdi = INFO.get_ini_mdi_command(key)
198+
LOG.debug('COMMAND= {}'.format(mdi))
199+
if mdi is None: raise Exception
197200
except:
198-
msg = 'MDI_COMMAND= # {} Not found under [MDI_COMMAND_LIST] in INI file'.format(number)
199-
LOG.error(msg)
200-
self.SET_ERROR_MESSAGE(msg)
201-
return
201+
# fallback to legacy nth line
202+
try:
203+
mdi = INFO.MDI_COMMAND_LIST[key]
204+
except:
205+
msg = 'MDI_COMMAND_{} Not found under [MDI_COMMAND_LIST] in INI file'.format(key)
206+
LOG.error(msg)
207+
self.SET_ERROR_MESSAGE(msg)
208+
return
209+
210+
202211
mdi_list = mdi.split(';')
203212
self.ensure_mode(linuxcnc.MODE_MDI)
204213
for code in (mdi_list):

0 commit comments

Comments
 (0)