Merge branch '3.0'

This commit is contained in:
ChrisTerBeke 2017-10-11 14:13:57 +02:00
commit e97bdc526b
6 changed files with 46 additions and 19 deletions

View file

@ -285,11 +285,11 @@ Cura.MachineAction
}
else if (base.selectedPrinter.clusterSize === 0)
{
return catalog.i18nc("@label", "Cura Connect: This printer is not set up to host a group of connected Ultimaker 3 printers.");
return catalog.i18nc("@label", "This printer is not set up to host a group of Ultimaker 3 printers.");
}
else
{
return catalog.i18nc("@label", "Cura Connect: This printer is set up to host a group of %1 connected Ultimaker 3 printers".arg(base.selectedPrinter.clusterSize));
return catalog.i18nc("@label", "This printer is the host for a group of %1 Ultimaker 3 printers.".arg(base.selectedPrinter.clusterSize));
}
}

View file

@ -19,6 +19,7 @@ from UM.Message import Message
from UM.OutputDevice import OutputDeviceError
from UM.i18n import i18nCatalog
from UM.Qt.Duration import Duration, DurationFormat
from UM.PluginRegistry import PluginRegistry
from . import NetworkPrinterOutputDevice
@ -36,7 +37,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
printersChanged = pyqtSignal()
selectedPrinterChanged = pyqtSignal()
def __init__(self, key, address, properties, api_prefix, plugin_path):
def __init__(self, key, address, properties, api_prefix):
super().__init__(key, address, properties, api_prefix)
# Store the address of the master.
self._master_address = address
@ -47,7 +48,6 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
name = key
self._authentication_state = NetworkPrinterOutputDevice.AuthState.Authenticated # The printer is always authenticated
self._plugin_path = plugin_path
self.setName(name)
description = i18n_catalog.i18nc("@action:button Preceded by 'Ready to'.", "Print over network")
@ -709,3 +709,14 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
@pyqtSlot(int, result=str)
def formatDuration(self, seconds):
return Duration(seconds).getDisplayString(DurationFormat.Format.Short)
## For cluster below
def _get_plugin_directory_name(self):
current_file_absolute_path = os.path.realpath(__file__)
directory_path = os.path.dirname(current_file_absolute_path)
_, directory_name = os.path.split(directory_path)
return directory_name
@property
def _plugin_path(self):
return PluginRegistry.getInstance().getPluginPath(self._get_plugin_directory_name())

View file

@ -223,7 +223,7 @@ class NetworkPrinterOutputDevicePlugin(QObject, OutputDevicePlugin):
Logger.log("d", "Printer [%s] had Cura Connect before, so assume it's still equipped with Cura Connect.", name)
if force_cluster or cluster_size >= 0 or was_cluster_before:
printer = NetworkClusterPrinterOutputDevice.NetworkClusterPrinterOutputDevice(
name, address, properties, self._api_prefix, self._plugin_path)
name, address, properties, self._api_prefix)
else:
printer = NetworkPrinterOutputDevice.NetworkPrinterOutputDevice(name, address, properties, self._api_prefix)
self._printers[printer.getKey()] = printer
@ -289,17 +289,6 @@ class NetworkPrinterOutputDevicePlugin(QObject, OutputDevicePlugin):
Logger.log("d", "Bonjour service removed: %s" % name)
self.removePrinterSignal.emit(str(name))
## For cluster below
def _get_plugin_directory_name(self):
current_file_absolute_path = os.path.realpath(__file__)
directory_path = os.path.dirname(current_file_absolute_path)
_, directory_name = os.path.split(directory_path)
return directory_name
@property
def _plugin_path(self):
return PluginRegistry.getInstance().getPluginPath(self._get_plugin_directory_name())
@pyqtSlot()
def openControlPanel(self):
Logger.log("d", "Opening print jobs web UI...")

View file

@ -39,7 +39,8 @@ Rectangle
return catalog.i18nc("@label:status", "Printing");
case "idle":
return catalog.i18nc("@label:status", "Available");
case "unreachable": // TODO: new string
case "unreachable":
return catalog.i18nc("@label:MonitorStatus", "Lost connection with the printer");
case "maintenance": // TODO: new string
case "unknown":
default:
@ -165,6 +166,7 @@ Rectangle
anchors.right: printProgressArea.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
color: emphasisColor
opacity: printer != null && printer.status === "unreachable" ? 0.3 : 1
Image
{