-
Notifications
You must be signed in to change notification settings - Fork 73
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
Provide a dialog to change the engine version of an existing container #1832
Comments
For wine it would simply be: changeVersion: function (containerName, subCategory, version) {
this.kill();
this.install(subCategory, version);
var parts = subCategory.split("-");
var distribution = parts[0];
var architecture = parts[2];
var containerNameCleaned = containerName.replace(this._containerRegex, '');
var containerDirectory = this._winePrefixesDirectory + "/" + containerNameCleaned + "/";
var containerConfiguration = this._configFactory.open(containerDirectory + "/phoenicis.cfg");
containerConfiguration.writeValue("wineVersion", version);
containerConfiguration.writeValue("wineDistribution", distribution);
containerConfiguration.writeValue("wineArchitecture", architecture);
this.kill();
} But I do not know how to do the GUI part ^^. |
Just thinking: we could also make changeVersion: function (containerName) and open a wizard from Javascript (like e.g. the custom installer script). Maybe this would even be the cleaner solution because we could get rid of the |
Ok, how would you ask the user for the required wine version (There is the distribution plus the version that you can change) ? EDIT: something like this ? changeVersion: function (containerName) {
var wizard = this.getWizard();
this.kill();
var architecture = containerConfiguration.readValue("wineArchitecture", "x86");
var operatingSystem = this._operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage();
var wineJson = JSON.parse(this.getAvailableVersions());
var distributions = new Array();
var versions = new Array();
wineJson.forEach(function (subPart) {
var parts = subPart.split("-");
if(parts[2] == architecture) {
distributions.push(parts[0]);
versions.push(new Array());
subPart.packages.forEach(function (winePackage) {
versions[distributions.size()].push(winePackage.version);
});
}
});
var selectedDistribution = wizard.menu(tr("Please select the distribution of wine."), distributions);
var selectedVersion = wizard.menu(tr("Please select the version of wine."), versions[distributions.indexOf(selectedDistribution)]);
subCategory = selectedDistribution + "-" + operatingSystem + "-" + architecture;
this.install(subCategory, version);
var containerNameCleaned = containerName.replace(this._containerRegex, '');
var containerDirectory = this._winePrefixesDirectory + "/" + containerNameCleaned + "/";
var containerConfiguration = this._configFactory.open(containerDirectory + "/phoenicis.cfg");
containerConfiguration.writeValue("wineVersion", selectedVersion);
containerConfiguration.writeValue("wineDistribution", selectedDistribution);
containerConfiguration.writeValue("wineArchitecture", architecture);
this.kill();
} |
Not completely sure about the way the wizard is retrieved (might be required to create a new one) but yeah something in that direction. |
How could I add a button for that in the container information tab ? (next to delete container for example) |
See Line 68 in bd9af0c
@madoar do you think this stuff would be easier to find if it was in https://github.com/PhoenicisOrg/phoenicis/tree/master/phoenicis-javafx/src/main/java/org/phoenicis/javafx/views/mainwindow/containers ? |
Okay, but how do I generate a "callback" that will call the javascript changeVersion method when the button is clicked ? |
I'm still planning to remove the old About how to add a new button: Line 77 in bd9af0c
This can be done similar to the other buttons, for example the delete button: Lines 69 to 71 in bd9af0c
When implementing a new button you should be aware that the container overview has already been modularized by me. This means it has been split into three components:
To add behavior to your new |
But how do I ask the callback to execute a javascript method ? |
Check where this is used: phoenicis/phoenicis-engines/src/main/java/org/phoenicis/engines/EnginesManager.java Line 64 in 8061ef2
The javascript engine object can be used like a Java object. |
@ImperatorS79 To get an
Afterwards you should be able to access the If you have additional questions feel free to ask! |
That's above my java skills ^^. I see a little bit what you mean (the general flow), but the implementation details are too difficult for me and I do not have time currently for such things. |
@ImperatorS79 what do you require to continue? If you just require a button calling a method inside an interface, implemented by a script, I can implement that for you. |
Just a button that call the |
The superseded issue was alpha-3. |
Solved by #1970. |
Currently it is not possible to change the engine version of an existing container from inside the container tab. Therefore I propose to provide a dialog which allows changing the engine version of an existing container.
Reaching the dialog
The dialog can be reached via a new button on the overview tab in the container information panel.
Content of the dialog
I propose to design the new dialog similar to the already existing engines tab. This means that the new dialog should consist of the following areas:
TabPane
for each engine subcategory of the selected engine type in the sidebar.Each tab in the
TabPane
contains a combined list widget with the corresponding engine versionsScreenshot of the mentioned engines tab:
Changing the engine version of a container
The engine version change itself should be performed in a new
changeVersion
version, that should be added to theEngine
interface. ThechangeVersion
method could be defined as:or if we want to define it analogous to
createContainer
:Implementing
changeVersion
for the wine engineFor the wine engine the following method needs to be implemented in https://github.com/PhoenicisOrg/scripts/blob/master/Engines/Wine/Engine/Implementation/script.js:
Implementing
changeVersion
for engine types that don't support version changesFor engine types that don't support version changes a dummy implementation needs to be added to their engine implementation. Such a dummy implementation could look like the following:
or if we want to do provide an implementation which allows for a once only execution:
Selecting all allowed engine versions for a container
Containers are often only compatible with a subset of the engine versions. If you try to apply an incompatible engine version on a container, it is possible that the container breaks. To prevent this additionally a
selectCompatibleEngineVersions
method should be added for the engines. This method then returns a list of all compatible engine versions for a given container.For more information see the discussion in #1829
The text was updated successfully, but these errors were encountered: