Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macros plugin stops working after 1-2 calls #2521

Closed
MiroslavMatas opened this issue May 4, 2020 · 15 comments
Closed

Macros plugin stops working after 1-2 calls #2521

MiroslavMatas opened this issue May 4, 2020 · 15 comments
Labels

Comments

@MiroslavMatas
Copy link

MiroslavMatas commented May 4, 2020

@unzip cudatext-win-x64-1.98.2.0.zip to new folder (e.g. c:\temp\cuda)
start cudatext.exe
install Macros addon + exit
start and import Export of Macro.cuda-macros - one stupid Macro1
exit (just for sure… maybe not neccessary)
start and open attached new.txt
attach Alt+F12 shortcut to Macro1
set position at first row, begin of line (caret top left)
Alt+F12
Alt+F12
Alt+F12 - here we have the problem
new.txt
Export of Macro - cuda-macros.txt
@kvichans

@kvichans
Copy link
Collaborator

kvichans commented May 4, 2020

Yes. Repro problem on my Win.
I see that problem of CT core not of the Macros.

@MiroslavMatas
Copy link
Author

Yes. Repro problem on my Win.
I see that problem of CT core not of the Macros.

thanks a lot
will cross my fingers…

@MiroslavMatas
Copy link
Author

Yes. Repro problem on my Win.
I see that problem of CT core not of the Macros.

@Alexey-T

@Alexey-T
Copy link
Owner

Alexey-T commented May 5, 2020

@MiroslavMatas
I cannot validate this bugreport,

if someone can compile Cud on his PC, pls test this bug on new build.

@Alexey-T Alexey-T changed the title shortcuts, macros Macros plugin stops working after 1-2 calls May 5, 2020
@Alexey-T Alexey-T added the bug label May 5, 2020
@Alexey-T
Copy link
Owner

Alexey-T commented May 7, 2020

plugin Macros here (linux) cannot set hotkey alt+f12 for macro1 at all.
help to find where is the bug.
how plugin sets hotkey for macro1?
i found this in macros plugin.
help to find small repro.

        # Register new subcommands
        if '|reg|' in acts:
            reg_subs        = 'cuda_macros;run;{}'.format('\n'.join(
                             'Macros: {}\t{}'.format(mcr['nm'],mcr['id']) 
                                 for mcr in self.macros)
                             )
            pass;              #LOG and log('reg_subs={}',reg_subs)
            app.app_proc(app.PROC_SET_SUBCOMMANDS, reg_subs)

@kvichans

@kvichans
Copy link
Collaborator

kvichans commented May 8, 2020

  1. Для добавления в Куд всех новых команд (макросов) выполняется код
reg_subs        = 'cuda_macros;run;{}'.format('\n'.join(
                             'Macros: {}\t{}'.format(mcr['nm'],mcr['id']) 
                                 for mcr in self.macros)
                             )
app.app_proc(app.PROC_SET_SUBCOMMANDS, reg_subs)
  1. Для привязки одной команды к хоткею работает код
app.dlg_hotkeys('cuda_macros,run,'+str(mcr['id']))

В обоих местах mcr['id'] это число (пятизначное). В первом случае mcr['nm'] это имя макроса.

@Alexey-T
Copy link
Owner

Alexey-T commented May 8, 2020

need to know what API call is bad/broken. need small repro of bug.

@kvichans
Copy link
Collaborator

kvichans commented May 8, 2020

Это поможет только если ошибка ядра в логике работы. Но логика при отработке первых двух вызовов очевидно ТАКАЯ же как при третьем. Здесь подозрение на глобальную ошибку работы с памятью. Вряд ли получиться дать "small repro".

@Alexey-T
Copy link
Owner

Alexey-T commented May 8, 2020

после задания alt+f12 через dlg_hotkeys плаг хоткей видит а куда нет.
надо посмотреть.
Screenshot from 2020-05-08 18-34-31

@Alexey-T
Copy link
Owner

Alexey-T commented May 8, 2020

@kvichans seems Macros plugin is bad. you write keys.json by hands. dont do it, call dlg_hotkeys only.

your code

        # Clear keys.json
        if '|keys|' in acts and ':' in what:
            # Need delete a key 'cuda_macros,run,NNNNN'
            mcr_id      = what[1+what.index(':'):]
            mcr_key     = 'cuda_macros,run,{}'.format(mcr_id)
            keys_json   = app.app_path(app.APP_DIR_SETTINGS)+os.sep+'keys.json'
            if not os.path.exists(keys_json): return
            keys        = apx._json_loads(open(keys_json).read())
            pass;              #LOG and log('??? key={}',mcr_key)
            if keys.pop(mcr_key, None) is not None:
                pass;          #LOG and log('UPD keys.json deleted key={}',mcr_key)
                open(keys_json, 'w').write(json.dumps(keys, indent=2))

@Alexey-T
Copy link
Owner

Alexey-T commented May 8, 2020

I dont see bug in Cud.

@Alexey-T
Copy link
Owner

Alexey-T commented May 8, 2020

@kvichans I dont want to install Macros from GH, pls update in main addon list

@kvichans
Copy link
Collaborator

kvichans commented May 8, 2020

  1. Какое отношение имеет вызов GUI dlg_hotkeys к процессу удаления хоткея плагином. Нельзя править keys.json? ОК, укажите (дайте) API вызов, который это делает.
  2. Плагин в ГХ и в СФ (для PlugMan) один и тот же.

@Alexey-T
Copy link
Owner

Alexey-T commented May 9, 2020

вы имеет Вики? да. мне придется как и вам искать в нем. :(
dlg_hotkeys вроде сам пишет в keys.json. проверьте.
смотрите вики.

@Alexey-T
Copy link
Owner

Alexey-T commented May 9, 2020

продолжим тут kvichans/cuda_macros#17

@Alexey-T Alexey-T closed this as completed May 9, 2020
Repository owner locked and limited conversation to collaborators May 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants