-
Notifications
You must be signed in to change notification settings - Fork 32
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
Added arguments to export layout to image (#365) #398
Added arguments to export layout to image (#365) #398
Conversation
ea10881
to
dcd9145
Compare
maybe odd Q : what does |
It is an old behaviour. Something to do about inability to update AD files during update to new version of AD. Program should restart while asking user for admin access. And this verb was there to prevent infinite loop of restarting when for some reason even admin access isn't enough to update AD files. |
If you have time it would be great if you could add a document (in the |
b3f3a4b
to
5a28551
Compare
I managed to make the console output work as I would expect it. But I don't know how to add diff-files in a comment.
|
Just to keep feedback in one place (copied from discord):
|
Only way I see to make this work as a console app is to make it a console app which starts a WPF app if command line arguments are passed to do so. Problem that when running AD from cmd or powershell would now be synchronous is not that much of a problem I think. The main problem is that when running the AD from Windows explorer/whatever will open console by default. I could hide it as first thing after the app starts, but you still might see the console show up for couple of miliseconds. But seeing console blink before some program starts feels very mischievous. Bottom line: I don't know if it is a good idea to sacrifice AD being windows app for this fuctionality. |
TL;DR: It doesn't matter. This seems to be a problem of the used Also it is a feature for "power users" only I like to think. So even if there are some issues with the order of output on the This is my point of view. Do you think the order of output is that important? |
I think power users would be most confused about this, because the program doesn't behave like normal program. And if you are running a script you also might not be bothered by bunch of consoles to appear. In other words, it also doesn't matter IMHO. So if you really think it would be better to have it reuse parent console, then so be it! |
- tests can run in VS 2022
- fixed typos
Things that are missing (in my opinion) for a merge:
I'm working on the first two items of the list and getting familiar with the |
- adjusted help text - log used parameters
- show errors from ArgumentParser - add example of a script which exports all layouts in a directory
I would expect that the switch Maybe a name like Do I miss any settings apart from the one below? _appSettings.RenderSelectionHighlightsOnExportedImageValue
_appSettings.ShowGrid
_appSettings.ShowHarborBlockedArea
_appSettings.ShowIcons
_appSettings.ShowInfluences
_appSettings.ShowLabels
_appSettings.ShowPanorama
_appSettings.UseCurrentZoomOnExportedImageValue
_appSettings.ShowTrueInfluenceRange
_appSettings.StatsShowStats |
Well, you found more settings than me 😄 But I'd still call it Also there is still the question if properties which default to true should be renamed to better show it in their name. |
I'm in the process of implementing the Some code I already came up with: public CanvasRenderSetting GetRenderSettings(ExportArgs exportArgs)
{
//init with default values and overwrite later if necessary
var result = new CanvasRenderSetting
{
GridSize = Constants.GridStepDefault,
RenderGrid = true,
RenderHarborBlockedArea = false,
RenderIcon = true,
RenderInfluences = false,
RenderLabel = true,
RenderPanorama = false,
RenderStatistics = true,
RenderTrueInfluenceRange = false,
RenderVersion = true
};
//Use current user settings?
if (exportArgs is not null && exportArgs.UseAppSettings.HasValue && exportArgs.UseAppSettings.Value)
{
result.GridSize = _appSettings.UseCurrentZoomOnExportedImageValue ? AnnoCanvas.GridSize : null;
result.RenderGrid = _appSettings.ShowGrid;
result.RenderHarborBlockedArea = _appSettings.ShowHarborBlockedArea;
result.RenderIcon = _appSettings.ShowIcons;
result.RenderInfluences = _appSettings.ShowInfluences;
result.RenderLabel = _appSettings.ShowLabels;
result.RenderPanorama = _appSettings.ShowPanorama;
result.RenderStatistics = _appSettings.StatsShowStats;
result.RenderTrueInfluenceRange = _appSettings.ShowTrueInfluenceRange;
result.RenderVersion = true;
}
//Any settings provided via command line?
if (exportArgs is not null)
{
if (exportArgs.GridSize.HasValue)
{
result.GridSize = Math.Max(Math.Min(exportArgs.GridSize.Value, Constants.GridStepMax), Constants.GridStepMin);
}
if (exportArgs.RenderGrid.HasValue)
{
result.RenderGrid = exportArgs.RenderGrid.Value;
}
if (exportArgs.RenderHarborBlockedArea.HasValue)
{
result.RenderHarborBlockedArea = exportArgs.RenderHarborBlockedArea.Value;
}
if (exportArgs.RenderIcon.HasValue)
{
result.RenderIcon = exportArgs.RenderIcon.Value;
}
if (exportArgs.RenderInfluences.HasValue)
{
result.RenderInfluences = exportArgs.RenderInfluences.Value;
}
if (exportArgs.RenderLabel.HasValue)
{
result.RenderLabel = exportArgs.RenderLabel.Value;
}
if (exportArgs.RenderPanorama.HasValue)
{
result.RenderPanorama = exportArgs.RenderPanorama.Value;
}
if (exportArgs.RenderStatistics.HasValue)
{
result.RenderStatistics = exportArgs.RenderStatistics.Value;
}
if (exportArgs.RenderTrueInfluenceRange.HasValue)
{
result.RenderTrueInfluenceRange = exportArgs.RenderTrueInfluenceRange.Value;
}
if (exportArgs.RenderVersion.HasValue)
{
result.RenderVersion = exportArgs.RenderVersion.Value;
}
}
return result;
} |
I really don't like how you have to specify the value of the boolean options with these nullable options |
… program from starting if parsing failed
…dded option to use user render settings
- pluralized property
Ok, I'm not a fan of mixing the parameters ( But I think my above code needs to be used, because at the moment I'm not able to execute following command: .\AnnoDesigner.exe export --useUserSettings --border=2 --hideIcon "C:\path\to\layout\file.ad" "C:\path\to\exported\image.png" If the |
Maybe the "use user settings" should be the default while also having two options ("RenderX" and "HideX") for each render settings which would override the user settings. I really hate forcing users to explicitly specify value of boolean option |
Yes, but this seems to be an issue of the library. |
- supports nullable boolean options which are set to true if they are mentioned - render options override render configuration if useUserSettings is set
Switched to System.CommandLine as proposed. Only thing we lost are usage examples. Otherwise it is now possible to set boolean option just by mentioning it in the arguments, while also possible to set it to false. Also the render settings from user settings are overriden by the individual render options even if |
- copy debug-files to build output
@Atria1234 You are crazy. All that work is awesome!
|
- abstract console from `ArgumentParser` - abstract `ArgumentParser` - adjusted tests
- removed debugger
I started working on the list before I noticed you were already working on it. 😄 Nice, I wasn't aware this library had this support for files. |
@Atria1234 Could you check again if it still meets your expectations? |
Looks good to me, thanks for polishing it ❤️ |
There was a comment on discord about the first start of the app:
So will double check this and see if this can be solved. |
Clean solution would be to separate business logic from rendering and export the image without even creating the MainWindow instance. This is however tricky, because of all those stuff we are initializing in MainWindow and AnnoCanvas. The quick and dirty solution would be to just skip openning the Welcome window, but who knows if something will fail later if no language is not selected. Actually I'm pretty sure something will fail. |
For better context and easier implementation the behavior of language selection is tracked in issue #414. |
AD can now be started with 3 different verbs: