Is there an event that signals to 'CB' the end of an external application launched from the 'Tools' menu?
explanation : I launch 'Poedit' from the 'Tools' menu and I would like to be warned in 'CB' of its closing.
Do you want to be warned in codeblocks that po edit is closed, or that po edit is still open when you close codeblocks
Anyway at the moment there is not such functionality. Also i think this would be quite complicated...
I want be warned when 'Poedit' is closed.
And also probably prevent the closing?
No.
When I close 'Poedit', it has already saved two files '*.po' and '*.mo' and these are the two files I want to recover next automatically.
1- The only event that handles the termination of an executable in 'CB' is
Quote'cbEVT_PIPEDPROCESS_TERMINATED'.
2- in 'ToolsManager::Execute(...)' then you have to use the option
Quote'LAUNCH_VISIBLE' to use a 'PipedProcess'
3- then the event ending is reserved for the parent in
'PipedProcess::OnTerminate(...)' by
'wxPostEvent(m_Parent, event)'4- I then added
'Manager::Get()->ProcessEvent(event)'and I can get this event from a 'CB' plugin.
But I don't know if there are side effects, and if this modification is possible in 'CB' !
What do you think?
Quote from: LETARTARE on May 25, 2022, 01:53:05 PM
Is there an event that signals to 'CB' the end of an external application launched from the 'Tools' menu?
explanation : I launch 'Poedit' from the 'Tools' menu and I would like to be warned in 'CB' of its closing.
You could run your own wrapper program from the tools menu that wxExecutes then waits for the poedit process. Just the fact that it returned means that poedit ended.
It also gives you control over return codes from poedit and the ability to start/stop subsequent programs.
@Pecan :Thanks
I will try this track.
Also, do the files exists, or are they generated by po edit?
I would need some event handling about changes in files. And i am willing to work on this...
In the 1st solution I had added
Quote'Manager::Get()->ProcessEvent(event)'
to
Quote'PipedProcess::OnTerminate(...)'
In a 2nd solution I added
Quote'Manager::Get()->ProcessEvent(event)'
at the end of
Quote'ToolsManager::OnToolTerminated(CodeBlocksEvent& event)'
Both work well for me.
In the plugin 'CB' I proposed in 'https://github.com/LETARTARE/CB_Collector' :
1- I generated the file 'project_name.po' in the 'CB' editor,
2- I call by program the menu 'Tools->Poedit' with parameter 'project_name.po'
3- from 'Poedit, I translate strings then i create 'project_name.mo' and quit
4- on return,
- if I have translated strings, I get a warning from 'CB' to reload 'project_name.po' which has been
modified : I reload
- otherwise nothing to do
5- I want to be notified when 'Poedit' is closed to copy the file ''project_name.po'' to another directory
Actually, I use 'cbEVT_EDITOR_MODIFIED' but it is not satisfactory.
Quote from: Pecan on May 25, 2022, 06:23:45 PM
You could run your own wrapper program from the tools menu that wxExecutes then waits for the poedit process. Just the fact that it returned means that poedit ended.
Thanks very much.
I already had a synchronous wrapper to run 'xgettext' and 'wxrc', so this simplified the code, avoiding event monitoring.
You can replace the call to poedit with a batch file calling poedit followed by the copy command.