mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
'AI Circuit Analyzer' offers to log in instead of just showing the error
This commit is contained in:
@@ -697,6 +697,10 @@
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>'IEC Socket', 'Plastic DC Jack', 'Multi-Section Capacitor' and 'Mini Relay' terminals are now labeled by function (Earth, Line, Neutral; Sleeve, Switch, Center; the shared negative and each section's positive; coil, COM, NC and NO) instead of plain numbers, so netlists show what each terminal does</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>'AI Circuit Analyzer' offers to log in instead of just showing the error</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Single coil pickups rotated by 90 or 270 degrees had their start and finish lugs swapped relative to the pickup body</description>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package org.diylc.swing.actions.analyze;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.lang.LangUtil;
|
||||
import org.diylc.plugins.cloud.service.NotLoggedInException;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.plugins.cloud.actions.LoginAction;
|
||||
import org.diylc.swingframework.TextDialog;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
@@ -55,6 +58,10 @@ public class AiAnalyzeAction extends AbstractAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (!plugInPort.getCloudService().isLoggedIn()) {
|
||||
offerLogin(e);
|
||||
return;
|
||||
}
|
||||
|
||||
String message = WAITING_MESSAGES[(int) (Math.random() * WAITING_MESSAGES.length)];
|
||||
JOptionPane optionPane = new JOptionPane(message,
|
||||
@@ -86,6 +93,10 @@ public class AiAnalyzeAction extends AbstractAction {
|
||||
new TextDialog(swingUI.getOwnerFrame().getRootPane(), res, "AI Circuit Analyzer",
|
||||
new Dimension(800, 600)).setVisible(true);
|
||||
} catch (Exception ex) {
|
||||
if (ex.getCause() instanceof NotLoggedInException) {
|
||||
offerLogin(e);
|
||||
return;
|
||||
}
|
||||
String message =
|
||||
Optional.ofNullable(ex.getCause()).map(Throwable::getMessage).orElse(ex.getMessage());
|
||||
swingUI.showMessage(message, "AI Circuit Analyzer", ISwingUI.ERROR_MESSAGE);
|
||||
@@ -100,4 +111,15 @@ public class AiAnalyzeAction extends AbstractAction {
|
||||
worker.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void offerLogin(ActionEvent e) {
|
||||
int choice = swingUI.showConfirmDialog(
|
||||
LangUtil.translate(
|
||||
"AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?"),
|
||||
LangUtil.translate("AI Circuit Analyzer"), ISwingUI.YES_NO_OPTION,
|
||||
ISwingUI.QUESTION_MESSAGE);
|
||||
if (choice == ISwingUI.YES_OPTION && LoginAction.logIn(plugInPort, swingUI)) {
|
||||
actionPerformed(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-11
@@ -23,6 +23,7 @@ package org.diylc.swing.plugins.cloud.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.service.CloudException;
|
||||
@@ -46,27 +47,30 @@ public class LoginAction extends AbstractAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (logIn(cloudPlugIn.getPlugInPort(), cloudPlugIn.getSwingUI())) {
|
||||
cloudPlugIn.loggedIn();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean logIn(IPlugInPort plugInPort, ISwingUI swingUI) {
|
||||
LoginDialog dialog = DialogFactory.getInstance().createLoginDialog();
|
||||
do {
|
||||
dialog.setVisible(true);
|
||||
if (ButtonDialog.OK.equals(dialog.getSelectedButtonCaption())) {
|
||||
try {
|
||||
if (cloudPlugIn.getPlugInPort().getCloudService().logIn(dialog.getUserName(), dialog.getPassword())) {
|
||||
cloudPlugIn.getSwingUI().showMessage(
|
||||
"You have successfully logged into the system. You will remain logged in from this machine until logged out.",
|
||||
"Login Successful", IView.INFORMATION_MESSAGE);
|
||||
cloudPlugIn.loggedIn();
|
||||
break;
|
||||
if (plugInPort.getCloudService().logIn(dialog.getUserName(), dialog.getPassword())) {
|
||||
return true;
|
||||
} else {
|
||||
cloudPlugIn.getSwingUI().showMessage(
|
||||
swingUI.showMessage(
|
||||
"Could not login. Possible reasons are wrong credentials or lack of internet connection.",
|
||||
"Login Error", IView.ERROR_MESSAGE);
|
||||
}
|
||||
} catch (CloudException e1) {
|
||||
cloudPlugIn.getSwingUI().showMessage("Could not login. Error: " + e1.getMessage(), "Login Error", IView.ERROR_MESSAGE);
|
||||
swingUI.showMessage("Could not login. Error: " + e1.getMessage(), "Login Error", IView.ERROR_MESSAGE);
|
||||
}
|
||||
} else
|
||||
break;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,3 +713,4 @@ Replace %s with %s|%s durch %s ersetzen
|
||||
Reconnect %s to %s|%s mit %s neu verbinden
|
||||
Editing your circuit:|Der Bearbeitung Ihrer Schaltung:
|
||||
Generating new layouts:|Der Erstellung neuer Layouts:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|Der KI-Schaltungsanalysator erfordert ein DIYLC-Cloud-Konto. Möchten Sie sich jetzt anmelden?
|
||||
|
||||
@@ -706,3 +706,4 @@ Replace %s with %s
|
||||
Reconnect %s to %s
|
||||
Editing your circuit:
|
||||
Generating new layouts:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?
|
||||
|
||||
@@ -709,3 +709,4 @@ Replace %s with %s|Reemplazar %s por %s
|
||||
Reconnect %s to %s|Reconectar %s a %s
|
||||
Editing your circuit:|Edición de su circuito:
|
||||
Generating new layouts:|Generación de nuevos diseños:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|El Analizador de Circuitos IA requiere una cuenta de DIYLC Cloud. ¿Desea iniciar sesión ahora?
|
||||
|
||||
@@ -708,3 +708,4 @@ Replace %s with %s|Remplacer %s par %s
|
||||
Reconnect %s to %s|Reconnecter %s à %s
|
||||
Editing your circuit:|La modification de votre circuit :
|
||||
Generating new layouts:|La génération de nouvelles implantations :
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|L'analyseur de circuit IA nécessite un compte DIYLC Cloud. Voulez-vous vous connecter maintenant ?
|
||||
|
||||
@@ -710,3 +710,4 @@ Replace %s with %s|Sostituisci %s con %s
|
||||
Reconnect %s to %s|Ricollega %s a %s
|
||||
Editing your circuit:|Modifica del tuo circuito:
|
||||
Generating new layouts:|Generazione di nuovi layout:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|L'Analizzatore di Circuiti IA richiede un account DIYLC Cloud. Vuoi accedere ora?
|
||||
|
||||
@@ -714,3 +714,4 @@ Replace %s with %s|%s vervangen door %s
|
||||
Reconnect %s to %s|%s opnieuw verbinden met %s
|
||||
Editing your circuit:|Uw schakeling bewerken:
|
||||
Generating new layouts:|Nieuwe layouts genereren:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|De AI Circuit Analysator vereist een DIYLC Cloud-account. Wilt u nu inloggen?
|
||||
|
||||
@@ -709,3 +709,4 @@ Replace %s with %s|Substituir %s por %s
|
||||
Reconnect %s to %s|Reconectar %s a %s
|
||||
Editing your circuit:|Edição do seu circuito:
|
||||
Generating new layouts:|Geração de novos layouts:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|O Analisador de Circuito IA requer uma conta DIYLC Cloud. Deseja entrar agora?
|
||||
|
||||
@@ -705,3 +705,4 @@ Replace %s with %s|Zameni %s sa %s
|
||||
Reconnect %s to %s|Ponovo poveži %s sa %s
|
||||
Editing your circuit:|Izmenama vašeg kola:
|
||||
Generating new layouts:|Generisanju novih rasporeda:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|AI Analizator Kola zahteva DIYLC Cloud nalog. Da li želite da se prijavite sada?
|
||||
|
||||
@@ -707,3 +707,4 @@ Replace %s with %s|%s को %s से बदलें
|
||||
Reconnect %s to %s|%s को %s से फिर से जोड़ें
|
||||
Editing your circuit:|आपके सर्किट को संपादित करना:
|
||||
Generating new layouts:|नए लेआउट बनाना:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|AI सर्किट विश्लेषक के लिए DIYLC Cloud खाते की आवश्यकता है। क्या आप अभी लॉग इन करना चाहेंगे?
|
||||
|
||||
@@ -707,3 +707,4 @@ Replace %s with %s|将 %s 替换为 %s
|
||||
Reconnect %s to %s|将 %s 重新连接到 %s
|
||||
Editing your circuit:|编辑您的电路:
|
||||
Generating new layouts:|生成新的布局:
|
||||
AI Circuit Analyzer requires a DIYLC Cloud account. Would you like to log in now?|AI电路分析器需要 DIYLC Cloud 账户。是否立即登录?
|
||||
|
||||
Reference in New Issue
Block a user