|
1 | | -VERSION = '1.233.246' |
| 1 | +VERSION = '1.233.247' |
2 | 2 |
|
3 | 3 | ''' |
4 | 4 | qtplasmac_handler.py |
@@ -3482,7 +3482,10 @@ def user_button_setup(self): |
3482 | 3482 | self.idleHomedList.append('button_{}'.format(str(bNum))) |
3483 | 3483 | elif command and command[0] == '%': |
3484 | 3484 | cmd = command.lstrip('%').lstrip(' ').split(' ', 1)[0] |
3485 | | - reply = Popen('which {}'.format(cmd), stdout=PIPE, stderr=PIPE, shell=True).communicate()[0] |
| 3485 | + if cmd[-3:] == '.py': |
| 3486 | + reply = os.path.exists(os.path.expanduser(cmd)) |
| 3487 | + else: |
| 3488 | + reply = Popen('which {}'.format(cmd), stdout=PIPE, stderr=PIPE, shell=True).communicate()[0] |
3486 | 3489 | if not reply: |
3487 | 3490 | head = _translate('HandlerClass', 'External Code Error') |
3488 | 3491 | msg1 = _translate('HandlerClass', 'External command') |
@@ -3640,8 +3643,13 @@ def user_button_command(self, bNum, command): |
3640 | 3643 | command = newCommand |
3641 | 3644 | ACTION.CALL_MDI(command) |
3642 | 3645 | elif command and command[0] == '%': |
3643 | | - command = command.lstrip('%').lstrip() + '&' |
3644 | | - Popen(command, stdout=PIPE, stderr=PIPE, shell=True) |
| 3646 | + command = command.lstrip('%').lstrip() |
| 3647 | + if command[-3:] == '.py': |
| 3648 | + cmd = 'python3 ' + command |
| 3649 | + Popen(cmd, stdin = None, stdout=PIPE, stderr=PIPE, shell=True) |
| 3650 | + else: |
| 3651 | + command += '&' |
| 3652 | + Popen(command, stdout=PIPE, stderr=PIPE, shell=True) |
3645 | 3653 | else: |
3646 | 3654 | head = _translate('HandlerClass', 'Code Error') |
3647 | 3655 | msg0 = _translate('HandlerClass', 'Invalid code for user button') |
|
0 commit comments