Interface consistency bugs

This commit is contained in:
Carlos Galindo 2019-09-12 23:34:33 +02:00
parent d3d07b7541
commit 7d835018e3
Signed by: kauron
GPG Key ID: 83E68706DEE119A3
2 changed files with 12 additions and 5 deletions

View File

@ -66,7 +66,10 @@ public class Controller implements Initializable {
} else { // update if in table tab
tabIsTable.set(tabMap.get(n) != null);
menuCloseTab.setDisable(!n.isClosable());
menuSave.disableProperty().unbind();
menuSave.setDisable(!tabMap.containsKey(n) || tabMap.get(n).saved.get());
if (tabMap.containsKey(n))
menuSave.disableProperty().bind(tabMap.get(n).saved);
}
});
tabPane.getTabs().removeListener((ListChangeListener<Tab>) c -> theTest = null);

View File

@ -44,7 +44,6 @@ public class TestController implements Initializable {
void setList(List<TestItem> list) {
this.list = list;
int total = list.size();
progress.setProgress(0);
progressLabel.textProperty().bind(Bindings.format(
String.format("%%.2f%%%% %%d / %d %%d mistakes", total),
done.multiply(100.0).divide(total), done, errors));
@ -75,18 +74,23 @@ public class TestController implements Initializable {
}
// Remove the question from the pool if the question was correctly answered or there is no repetition
if ((right && !correctingError.get()) || !AppPrefs.repeatWrong.get()) {
if (right || !AppPrefs.repeatWrong.get()) {
if (!correctingError.get())
done.set(done.get() + 1);
correctingError.set(!right && AppPrefs.repeatImmediately.get());
list.remove(item.get());
done.set(done.get() + 1);
if (list.size() == 0) {
onEndAction(null);
return;
}
chooseQuestion();
} else if (!AppPrefs.repeatImmediately.get()) {
} else if (AppPrefs.repeatImmediately.get()) {
correctingError.set(true);
item.set(new TestItem(item.get()));
list.add(item.get());
} else {
chooseQuestion();
}
correctingError.set(!right && AppPrefs.repeatImmediately.get());
answer.setText("");
answer.requestFocus();
}