Skip to content

Commit dadc5a1

Browse files
committed
qtdragon family -let ini mdi calls use the legacy version
numbered rather then labeled
1 parent 12ce9d1 commit dadc5a1

4 files changed

Lines changed: 40 additions & 34 deletions

File tree

share/qtvcp/screens/qtdragon/qtdragon_handler.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,25 +2059,31 @@ def log_version(self):
20592059
self.add_status(mess, CRITICAL,noLog=True)
20602060
STATUS.emit('update-machine-log', mess, None)
20612061

2062+
# called from hal_glib to run macros from external event
20622063
def request_macro_call(self, data):
2063-
flag = True
2064+
if not STATUS.is_mdi_mode():
2065+
self.add_status(_translate("HandlerClass",'Machine must be in MDI mode to run macros'), CRITICAL)
2066+
return
2067+
20642068
for b in range(0,10):
20652069
button = self.w['macrobutton{}'.format(b)]
20662070
# prefer named INI MDI commands
20672071
key = button.property('ini_mdi_key')
2068-
if key == '' or INFO.get_ini_mdi_command(key) is None:
2072+
code = INFO.get_ini_mdi_command(key)
2073+
if key == '' or code is None:
20692074
# fallback to legacy nth line
20702075
key = button.property('ini_mdi_number')
2071-
try:
20722076
code = INFO.get_ini_mdi_command(key)
2073-
if code is None: raise Exception
2074-
flag = False
2075-
except:
2076-
print('No macro code')
2077-
continue
2078-
if key == data:
2077+
if code is None:
2078+
continue
2079+
if str(key) == data:
20792080
#print('match',button.objectName())
2080-
button.click()
2081+
text = button.text().replace('\n',' ')
2082+
self.add_status(_translate("HandlerClass",'Running macro: {} {}'.format(key, text)))
2083+
try:
2084+
button.click()
2085+
except Exception as e:
2086+
self.add_status(_translate("HandlerClass",'Running macro: {} {}\n{}'.format(key, text, e)))
20812087
break
20822088

20832089
#####################

share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ def request_macro_call(self, data):
900900
if not STATUS.is_mdi_mode():
901901
self.add_status(_translate("HandlerClass",'Machine must be in MDI mode to run macros'), CRITICAL)
902902
return
903-
flag = True
903+
904904
for b in range(0,10):
905905
button = self.w['macrobutton{}'.format(b)]
906906
# prefer named INI MDI commands
@@ -910,16 +910,16 @@ def request_macro_call(self, data):
910910
# fallback to legacy nth line
911911
key = button.property('ini_mdi_number')
912912
code = INFO.get_ini_mdi_command(key)
913-
try:
914-
if code is None: raise Exception
915-
flag = False
916-
except:
917-
continue
918-
if key == data:
913+
if code is None:
914+
continue
915+
if str(key) == data:
919916
#print('match',button.objectName())
920917
text = button.text().replace('\n',' ')
921918
self.add_status(_translate("HandlerClass",'Running macro: {} {}'.format(key, text)))
922-
button.click()
919+
try:
920+
button.click()
921+
except Exception as e:
922+
self.add_status(_translate("HandlerClass",'Running macro: {} {}\n{}'.format(key, text, e)))
923923
break
924924

925925
#######################

share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ def request_macro_call(self, data):
900900
if not STATUS.is_mdi_mode():
901901
self.add_status(_translate("HandlerClass",'Machine must be in MDI mode to run macros'), CRITICAL)
902902
return
903-
flag = True
903+
904904
for b in range(0,10):
905905
button = self.w['macrobutton{}'.format(b)]
906906
# prefer named INI MDI commands
@@ -910,16 +910,16 @@ def request_macro_call(self, data):
910910
# fallback to legacy nth line
911911
key = button.property('ini_mdi_number')
912912
code = INFO.get_ini_mdi_command(key)
913-
try:
914-
if code is None: raise Exception
915-
flag = False
916-
except:
917-
continue
918-
if key == data:
913+
if code is None:
914+
continue
915+
if str(key) == data:
919916
#print('match',button.objectName())
920917
text = button.text().replace('\n',' ')
921918
self.add_status(_translate("HandlerClass",'Running macro: {} {}'.format(key, text)))
922-
button.click()
919+
try:
920+
button.click()
921+
except Exception as e:
922+
self.add_status(_translate("HandlerClass",'Running macro: {} {}\n{}'.format(key, text, e)))
923923
break
924924

925925
#######################

share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ def request_macro_call(self, data):
872872
if not STATUS.is_mdi_mode():
873873
self.add_status(_translate("HandlerClass",'Machine must be in MDI mode to run macros'), CRITICAL)
874874
return
875-
flag = True
875+
876876
for b in range(0,10):
877877
button = self.w['macrobutton{}'.format(b)]
878878
# prefer named INI MDI commands
@@ -882,16 +882,16 @@ def request_macro_call(self, data):
882882
# fallback to legacy nth line
883883
key = button.property('ini_mdi_number')
884884
code = INFO.get_ini_mdi_command(key)
885-
try:
886-
if code is None: raise Exception
887-
flag = False
888-
except:
889-
continue
890-
if key == data:
885+
if code is None:
886+
continue
887+
if str(key) == data:
891888
#print('match',button.objectName())
892889
text = button.text().replace('\n',' ')
893890
self.add_status(_translate("HandlerClass",'Running macro: {} {}'.format(key, text)))
894-
button.click()
891+
try:
892+
button.click()
893+
except Exception as e:
894+
self.add_status(_translate("HandlerClass",'Running macro: {} {}\n{}'.format(key, text, e)))
895895
break
896896

897897
#######################

0 commit comments

Comments
 (0)