示例#1
0
def test_addRemoveOutputDevicePlugin():
    manager = OutputDeviceManager()
    plugin_1 = OutputDevicePlugin()
    plugin_1.setPluginId("plugin_one")

    plugin_1.start = MagicMock()
    plugin_1.stop = MagicMock()

    manager.addOutputDevicePlugin(plugin_1)
    assert manager.getOutputDevicePlugin("plugin_one") == plugin_1
    assert plugin_1.start.call_count == 1

    # adding it again shouldn't cause the start to be called again!
    manager.addOutputDevicePlugin(plugin_1)
    assert plugin_1.start.call_count == 1

    manager.removeOutputDevicePlugin("plugin_one")
    assert manager.getOutputDevicePlugin("plugin_one") is None
    assert plugin_1.start.call_count == 1

    # And removing it again shouldn't cause issues.
    manager.removeOutputDevicePlugin("plugin_two")
    assert plugin_1.start.call_count == 1

    # As the default output device plugin is an interface, the start and stop will raise exceptions.
    # but the outputdevice manager should be robust against that, so even in that case it shouldn't fail!
    plugin_2 = OutputDevicePlugin()
    plugin_2.setPluginId("plugin_two")
    manager.addOutputDevicePlugin(plugin_2)
    manager.removeOutputDevicePlugin("plugin_two")
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        Extension.__init__(self)
        OutputDevicePlugin.__init__(self)
        self.addMenuItem(catalog.i18n("OctoPrint Servers"),
                         self.showSettingsDialog)
        self._dialogs = {}
        self._dialogView = None

        Preferences.getInstance().addPreference("octoprint/instances",
                                                json.dumps({}))
        self._instances = json.loads(
            Preferences.getInstance().getValue("octoprint/instances"))
def test_addRemoveOutputDevicePlugin():
    manager = OutputDeviceManager()
    plugin_1 = OutputDevicePlugin()
    plugin_1.setPluginId("plugin_one")

    plugin_1.start = MagicMock()
    plugin_1.stop = MagicMock()

    manager.addOutputDevicePlugin(plugin_1)
    assert manager.getOutputDevicePlugin("plugin_one") == plugin_1
    # Outputdevice manager wasn't started, so the start of the plugin should not be called
    assert plugin_1.start.call_count == 0

    # So once we do, it should be called.
    manager.start()
    assert plugin_1.start.call_count == 1

    # Adding it again shouldn't cause the start to be called again!
    manager.addOutputDevicePlugin(plugin_1)
    assert plugin_1.start.call_count == 1

    manager.removeOutputDevicePlugin("plugin_one")
    assert manager.getOutputDevicePlugin("plugin_one") is None
    assert plugin_1.start.call_count == 1

    # And removing it again shouldn't cause issues.
    manager.removeOutputDevicePlugin("plugin_two")
    assert plugin_1.start.call_count == 1

    # As the default output device plugin is an interface, the start and stop will raise exceptions.
    # but the outputdevice manager should be robust against that, so even in that case it shouldn't fail!
    plugin_2 = OutputDevicePlugin()
    plugin_2.setPluginId("plugin_two")
    manager.addOutputDevicePlugin(plugin_2)
    manager.removeOutputDevicePlugin("plugin_two")
示例#4
0
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        Extension.__init__(self)
        OutputDevicePlugin.__init__(self)
        self.addMenuItem(catalog.i18n("DuetRRF Connections"),
                         self.showSettingsDialog)
        self._dialogs = {}
        self._dialogView = None

        CuraApplication.getInstance().getPreferences().addPreference(
            "duetrrf/instances", json.dumps({}))
        self._instances = json.loads(
            CuraApplication.getInstance().getPreferences().getValue(
                "duetrrf/instances"))
示例#5
0
    def __init__(self, parent = None):
        QObject.__init__(self, parent)
        SignalEmitter.__init__(self)
        OutputDevicePlugin.__init__(self)
        Extension.__init__(self)
        self._serial_port_list = []
        self._printer_connections = {}
        self._printer_connections_model = None
        self._update_thread = threading.Thread(target = self._updateThread)
        self._update_thread.setDaemon(True)

        self._check_updates = True
        self._firmware_view = None

        ## Add menu item to top menu of the application.
        self.setMenuName(i18n_catalog.i18nc("@title:menu","Firmware"))
        self.addMenuItem(i18n_catalog.i18nc("@item:inmenu", "Update Firmware"), self.updateAllFirmware)

        Application.getInstance().applicationShuttingDown.connect(self.stop)
        self.addConnectionSignal.connect(self.addConnection) #Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
示例#6
0
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        SignalEmitter.__init__(self)
        OutputDevicePlugin.__init__(self)
        Extension.__init__(self)

        self._serial_port_list = []
        self._printer_connections = {}
        self._printer_connections_model = None
        self._update_thread = threading.Thread(target=self._updateThread)
        self._update_thread.setDaemon(True)

        self._check_updates = True
        self._firmware_view = None
        self.updatetrigger = False

        # Add menu item to top menu of the application.
        self.setMenuName(i18n_catalog.i18nc("@title:menu", "Doodle3D"))
        self.addMenuItem(i18n_catalog.i18nc("@item:inlistbox", "Enable Scan devices..."), self.updateAllFirmware)

        Application.getInstance().applicationShuttingDown.connect(self.stop)
        self.addConnectionSignal.connect(self.addConnection)