News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

New Project Wizard - copying files

Started by jimbo, November 02, 2018, 03:13:42 PM

Previous topic - Next topic

jimbo

Hello all,

Writing a New Project Wizard. Need to be able to select a set of options using a multi select combo box (I can do that bit) which specifies which code files should be physically copied in to the project directories and added to the project files list, from a 'files' locations. I believe this files location should be under the folder the wizard.script file is in, but been trawling through various wizard.scripts files but not found what I need.

I am sure its obvious, but any hints? Are there functions to do this, is anything done automagically, do I have to simply grab the source file folder from somewhere, and use scripts to manually copy everything to the Projects folder? (They will be in a subfolder of the project itself if possible)

Jimbo

jimbo

Forgot to ask, also need to be able to setup various debugger settings so the generated projects can immediately use OpenOCD. Not found any functions for setting debugger options in the Wiizard.script , so any information there would also be useful.

TIA

BlueHazzard

Quote from: jimbo on November 02, 2018, 03:36:57 PM
Forgot to ask, also need to be able to setup various debugger settings so the generated projects can immediately use OpenOCD. Not found any functions for setting debugger options in the Wiizard.script , so any information there would also be useful.

TIA
at the moment this is  not possible:
http://forums.next.codeblocks.org/index.php/topic,16852.msg149433.html#msg149433
https://sourceforge.net/p/codeblocks/tickets/513/

Maybe i find some time to fix this...
@obfuscated: are changes to the scripting interface still locked?

Can you list the options you want to change?

oBFusCATed

The switch to scrat is frozen at the moment. The original changes you've made left the whole binding without proper error handling. I/we need to find a solution for this problem before continuing. But at the moment I don't have time/energy for it.

Also I'm not sure when I'll resume the work related to the removal of project hooks. Probably I should extract it from my branch with other changes.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

BlueHazzard

QuoteI am sure its obvious, but any hints? Are there functions to do this, is anything done automagically, do I have to simply grab the source file folder from somewhere, and use scripts to manually copy everything to the Projects folder?

The Wizard "asks" you for the file to generate in
function GetGeneratedFile(file_index)
function. As described you have to return the filename and content with the syntax:
filename.ext;contents
The variable index is incremented automatically on each call, so you can go trough an array of your files.
If you have templates you have to read them and return the content from this function
    local path = Wizard.FindTemplateFile("YourTemplateFileName");
    local buffer = IO.ReadFileContents(path);

You can modify the content of the file before you return it.

The function
Wizard.FindTemplateFile
Will search for the filename in the
Quote/templates/wizard/
sub folder. So you should put your template files in a  subfolder of these path. Ofc you have to add this subfolder to the name you provide to the FindTemplateFile function.

I hope this helps a bit...

@oBFusCATed
So is this a no or a go for the api changes to the script binding? Probably not before the next release?

oBFusCATed

Quote from: BlueHazzard on November 04, 2018, 11:50:23 PM
@oBFusCATed
So is this a no or a go for the api changes to the script binding? Probably not before the next release?
It is fine to add stuff to the script bindings. We'll have to do some conflict resolving, but this is inevitable anyway.
But keep in mind that the project hooks aren't a good design and it is not really a good idea to expose them to scripting.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

jimbo

Quote from: BlueHazzard on November 04, 2018, 11:50:23 PM
QuoteI am sure its obvious, but any hints? Are there functions to do this, is anything done automagically, do I have to simply grab the source file folder from somewhere, and use scripts to manually copy everything to the Projects folder?

The Wizard "asks" you for the file to generate in
function GetGeneratedFile(file_index)
function. As described you have to return the filename and content with the syntax:
filename.ext;contents
The variable index is incremented automatically on each call, so you can go trough an array of your files.
If you have templates you have to read them and return the content from this function
    local path = Wizard.FindTemplateFile("YourTemplateFileName");
    local buffer = IO.ReadFileContents(path);

You can modify the content of the file before you return it.

The function
Wizard.FindTemplateFile
Will search for the filename in the
Quote/templates/wizard/
sub folder. So you should put your template files in a  subfolder of these path. Ofc you have to add this subfolder to the name you provide to the FindTemplateFile function.

I hope this helps a bit...

@oBFusCATed
So is this a no or a go for the api changes to the script binding? Probably not before the next release?

Thanks.

So the process is :

Put all the requried template files in templates/wizard/jimbo/blahblah

In the script file GetGeneratedFile(idx)
   FindtemplateFile
   IO.ReadFileContents(path)
   Add required destintation file name to front of the file string read in.
   return that new string.
   If finished, return empty string.

Is this sort of process that could/should be in the common scripts file?


I see from the posts above that there are some gaps in the areas we would like to use (setting up debugger is one, we also need a functioning SVD dialog). I do not know who the lead developers are on Code::Blocks, but our company would likely be interested in funding development of any missing features that we are unable to add ourselves. Obviously experienced C::B developers are going to be able to produce results more quickly than we would be able to achieve internally, although we would be throwing resource at this. Who would I need to talk to about that? Would need all this stuff by Q2/3 next year or thereabouts.

oBFusCATed

I'm available for doing patch reviews and guidance how to implement something. If you're going to change something in Code::Blocks it is better to ask first if the direction is good, so there is a change that your modification would be accepted.

I'm not sure if I'll be available to do feature implementations next year.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

jimbo

Quote from: oBFusCATed on November 09, 2018, 07:07:24 PM
I'm available for doing patch reviews and guidance how to implement something. If you're going to change something in Code::Blocks it is better to ask first if the direction is good, so there is a change that your modification would be accepted.

I'm not sure if I'll be available to do feature implementations next year.

OK, thanks for getting back to me. I'm definitely going to be needing some pointers, but hopefully that will be enough to get the team here up to speed so we can make our own changes. We will of course run them by the devs here to make sure what we do is acceptable upstream  -we would want the work done to expand the feature set of CB for all, not just us. There's likely to be some GUI tidying up work, plus getting good SVD support and improving the New project stuff to allow debugger setup in project wizards.

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

jimbo

Quote from: oBFusCATed on September 29, 2019, 05:50:07 PM
The remote debugging feature have been committed.
See these two links:
* https://sourceforge.net/p/codeblocks/tickets/512/#fcab
* http://forums.next.codeblocks.org/index.php/topic,16852.msg159912.html#msg159912

That's good news. We've been delayed here (by exactly a year looking at the dates of my last post), but now getting back on to this.