Search in sources :

Example 6 with IController

use of com.willwinder.universalgcodesender.IController in project Universal-G-Code-Sender by winder.

the class WizardPanelHoming method createInvertComboBox.

private JComboBox<String> createInvertComboBox(Axis axis) {
    JComboBox<String> result = new JComboBox<>();
    result.setVisible(false);
    result.addItem("+" + axis.name());
    result.addItem("-" + axis.name());
    result.addActionListener(event -> {
        IController controller = getBackend().getController();
        if (controller != null) {
            try {
                controller.getFirmwareSettings().setHomingDirectionInverted(axis, result.getSelectedIndex() == 1);
            } catch (FirmwareSettingsException e) {
                NotifyDescriptor nd = new NotifyDescriptor.Message("Unexpected error while updating setting: " + e.getMessage(), NotifyDescriptor.ERROR_MESSAGE);
                DialogDisplayer.getDefault().notify(nd);
            }
        }
    });
    return result;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) IController(com.willwinder.universalgcodesender.IController) JComboBox(javax.swing.JComboBox) FirmwareSettingsException(com.willwinder.universalgcodesender.firmware.FirmwareSettingsException)

Example 7 with IController

use of com.willwinder.universalgcodesender.IController in project Universal-G-Code-Sender by winder.

the class WizardPanelMotorWiring method refreshReverseDirectionCheckboxes.

private void refreshReverseDirectionCheckboxes() {
    IController controller = getBackend().getController();
    if (controller != null) {
        try {
            checkboxReverseX.setSelected(controller.getFirmwareSettings().isInvertDirection(Axis.X));
            checkboxReverseY.setSelected(controller.getFirmwareSettings().isInvertDirection(Axis.Y));
            checkboxReverseZ.setSelected(controller.getFirmwareSettings().isInvertDirection(Axis.Z));
        } catch (FirmwareSettingsException e) {
            NotifyDescriptor nd = new NotifyDescriptor.Message("Unexpected error while getting setting: " + e.getMessage(), NotifyDescriptor.ERROR_MESSAGE);
            DialogDisplayer.getDefault().notify(nd);
        }
    }
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) IController(com.willwinder.universalgcodesender.IController) FirmwareSettingsException(com.willwinder.universalgcodesender.firmware.FirmwareSettingsException)

Aggregations

IController (com.willwinder.universalgcodesender.IController)7 FirmwareSettingsException (com.willwinder.universalgcodesender.firmware.FirmwareSettingsException)3 IFirmwareSettings (com.willwinder.universalgcodesender.firmware.IFirmwareSettings)2 NotifyDescriptor (org.openide.NotifyDescriptor)2 ICommunicator (com.willwinder.universalgcodesender.ICommunicator)1 ControllerStatus (com.willwinder.universalgcodesender.listeners.ControllerStatus)1 BackendAPI (com.willwinder.universalgcodesender.model.BackendAPI)1 UnitUtils (com.willwinder.universalgcodesender.model.UnitUtils)1 Status (com.willwinder.universalgcodesender.pendantui.v1.model.Status)1 JComboBox (javax.swing.JComboBox)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Before (org.junit.Before)1 Test (org.junit.Test)1 FileObject (org.openide.filesystems.FileObject)1