Revert "Merge branch 'fix_garbled_fonts_macos' into 3.0"

This reverts commit b62c19206f, reversing
changes made to 104926c6ed.

Contributes to issue CURA-4414.
This commit is contained in:
Ghostkeeper 2017-10-05 10:28:54 +02:00
parent 30be02be14
commit e07e7bc9e7
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75
17 changed files with 41 additions and 99 deletions

2
.gitignore vendored
View file

@ -57,6 +57,4 @@ cmake_install.cmake
#Debug #Debug
*.gcode *.gcode
run.sh run.sh
.scannerwork/
CuraEngine

View file

@ -266,7 +266,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
if self._getSettingProperty("mold_enabled", "value"): if self._getSettingProperty("mold_enabled", "value"):
mold_width = self._getSettingProperty("mold_width", "value") mold_width = self._getSettingProperty("mold_width", "value")
hull_offset = horizontal_expansion + mold_width hull_offset = horizontal_expansion + mold_width
if hull_offset > 0: #TODO: Implement Minkowski subtraction for if the offset < 0. if hull_offset != 0:
expansion_polygon = Polygon(numpy.array([ expansion_polygon = Polygon(numpy.array([
[-hull_offset, -hull_offset], [-hull_offset, -hull_offset],
[-hull_offset, hull_offset], [-hull_offset, hull_offset],

View file

@ -362,7 +362,7 @@ UM.Dialog
Label Label
{ {
id: warningLabel id: warningLabel
text: catalog.i18nc("@action:warning", "Loading a project will clear all models on the build plate.") text: catalog.i18nc("@action:warning", "Loading a project will clear all models on the buildplate")
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
} }

View file

@ -1,7 +1,7 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.4 import QtQuick 2.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
@ -602,7 +602,7 @@ Item
anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2; anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
width: fontMetrics.averageCharacterWidth * (maxValue.length) + UM.Theme.getSize("default_margin").width; width: Math.max(UM.Theme.getSize("line").width * maxValue.length + 2 * screenScaleFactor, 20 * screenScaleFactor);
style: TextFieldStyle style: TextFieldStyle
{ {
textColor: UM.Theme.getColor("setting_control_text"); textColor: UM.Theme.getColor("setting_control_text");
@ -630,9 +630,4 @@ Item
} }
} }
} }
FontMetrics {
id: fontMetrics
font: UM.Theme.getFont("default")
}
} }

View file

@ -217,7 +217,7 @@ UM.Dialog
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: licenseDialog.pluginName + catalog.i18nc("@label", "This plugin contains a license.\nYou need to accept this license to install this plugin.\nDo you agree with the terms below?") text: licenseDialog.pluginName + catalog.i18nc("@label", " plugin contains a license.\nYou need to accept this license to install this plugin.\nDo you agree with the terms below?")
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }

View file

@ -378,7 +378,7 @@ Cura.MachineAction
}, },
Button { Button {
id: btnOk id: btnOk
text: catalog.i18nc("@action:button", "OK") text: catalog.i18nc("@action:button", "Ok")
onClicked: onClicked:
{ {
manualPrinterDialog.accept() manualPrinterDialog.accept()

View file

@ -27,7 +27,6 @@ import zlib
from time import time from time import time
from time import sleep from time import sleep
from time import gmtime
i18n_catalog = i18nCatalog("cura") i18n_catalog = i18nCatalog("cura")
@ -1133,11 +1132,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
else: else:
Logger.log("w", "Unable to save authentication for id %s and key %s", self._authentication_id, self._getSafeAuthKey()) Logger.log("w", "Unable to save authentication for id %s and key %s", self._authentication_id, self._getSafeAuthKey())
# Request 'system' printer data once, when we know we have authentication, so we know we can set the system time.
url = QUrl("http://" + self._address + self._api_prefix + "system")
system_data_request = QNetworkRequest(url)
self._manager.get(system_data_request)
else: # Got a response that we didn't expect, so something went wrong. else: # Got a response that we didn't expect, so something went wrong.
Logger.log("e", "While trying to authenticate, we got an unexpected response: %s", reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)) Logger.log("e", "While trying to authenticate, we got an unexpected response: %s", reply.attribute(QNetworkRequest.HttpStatusCodeAttribute))
self.setAuthenticationState(AuthState.NotAuthenticated) self.setAuthenticationState(AuthState.NotAuthenticated)
@ -1157,27 +1151,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
else: else:
pass pass
elif self._api_prefix + "system" in reply_url:
# Check if the printer has time, and if this has a valid system time.
try:
data = json.loads(bytes(reply.readAll()).decode("utf-8"))
except json.decoder.JSONDecodeError:
Logger.log("w", "Received an invalid authentication request reply from printer: Not valid JSON.")
return
if "time" in data and "utc" in data["time"]:
try:
printer_time = gmtime(float(data["time"]["utc"]))
Logger.log("i", "Printer has system time of: %s", str(printer_time))
except ValueError:
printer_time = None
if printer_time is not None and printer_time.tm_year < 1990:
# The system time is not valid, sync our current system time to it, so we at least have some reasonable time in the printer.
Logger.log("w", "Printer system time invalid, setting system time")
url = QUrl("http://" + self._address + self._api_prefix + "system/time/utc")
put_request = QNetworkRequest(url)
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
self._manager.put(put_request, str(time()).encode())
elif reply.operation() == QNetworkAccessManager.PostOperation: elif reply.operation() == QNetworkAccessManager.PostOperation:
if "/auth/request" in reply_url: if "/auth/request" in reply_url:
# We got a response to requesting authentication. # We got a response to requesting authentication.

View file

@ -31,7 +31,6 @@ class NetworkPrinterOutputDevicePlugin(QObject, OutputDevicePlugin):
self._zero_conf = None self._zero_conf = None
self._browser = None self._browser = None
self._printers = {} self._printers = {}
self._cluster_printers_seen = {} # do not forget a cluster printer when we have seen one, to not 'downgrade' from Connect to legacy printer
self._api_version = "1" self._api_version = "1"
self._api_prefix = "/api/v" + self._api_version + "/" self._api_prefix = "/api/v" + self._api_version + "/"
@ -219,16 +218,12 @@ class NetworkPrinterOutputDevicePlugin(QObject, OutputDevicePlugin):
## Because the model needs to be created in the same thread as the QMLEngine, we use a signal. ## Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
def addPrinter(self, name, address, properties, force_cluster=False): def addPrinter(self, name, address, properties, force_cluster=False):
cluster_size = int(properties.get(b"cluster_size", -1)) cluster_size = int(properties.get(b"cluster_size", -1))
was_cluster_before = name in self._cluster_printers_seen if force_cluster or cluster_size >= 0:
if was_cluster_before:
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( printer = NetworkClusterPrinterOutputDevice.NetworkClusterPrinterOutputDevice(
name, address, properties, self._api_prefix, self._plugin_path) name, address, properties, self._api_prefix, self._plugin_path)
else: else:
printer = NetworkPrinterOutputDevice.NetworkPrinterOutputDevice(name, address, properties, self._api_prefix) printer = NetworkPrinterOutputDevice.NetworkPrinterOutputDevice(name, address, properties, self._api_prefix)
self._printers[printer.getKey()] = printer self._printers[printer.getKey()] = printer
self._cluster_printers_seen[printer.getKey()] = name # Cluster printers that may be temporary unreachable or is rebooted keep being stored here
global_container_stack = Application.getInstance().getGlobalContainerStack() global_container_stack = Application.getInstance().getGlobalContainerStack()
if global_container_stack and printer.getKey() == global_container_stack.getMetaDataEntry("um_network_key"): if global_container_stack and printer.getKey() == global_container_stack.getMetaDataEntry("um_network_key"):
if printer.getKey() not in self._old_printers: # Was the printer already connected, but a re-scan forced? if printer.getKey() not in self._old_printers: # Was the printer already connected, but a re-scan forced?

View file

@ -11,7 +11,7 @@ Button {
UM.I18nCatalog { id: catalog; name: "cura"; } UM.I18nCatalog { id: catalog; name: "cura"; }
height: UM.Theme.getSize("save_button_save_to_button").height height: UM.Theme.getSize("save_button_save_to_button").height
tooltip: catalog.i18nc("@info:tooltip", "Opens the print jobs page with your default web browser.") tooltip: catalog.i18nc("@info:tooltip", "Opens the print jobs page with your default web browser.")
text: catalog.i18nc("@action:button", "View print jobs") text: catalog.i18nc("@action:button", "View print jobs")
// FIXME: This button style is copied and duplicated from SaveButton.qml // FIXME: This button style is copied and duplicated from SaveButton.qml

View file

@ -119,8 +119,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
self._sendCommand("G0 Y%s F%s" % (z, speed)) self._sendCommand("G0 Y%s F%s" % (z, speed))
def _homeHead(self): def _homeHead(self):
self._sendCommand("G28 X") self._sendCommand("G28")
self._sendCommand("G28 Y")
def _homeBed(self): def _homeBed(self):
self._sendCommand("G28 Z") self._sendCommand("G28 Z")

View file

@ -1405,28 +1405,6 @@
"limit_to_extruder": "infill_extruder_nr", "limit_to_extruder": "infill_extruder_nr",
"settable_per_mesh": true "settable_per_mesh": true
}, },
"infill_offset_x":
{
"label": "Infill X Offset",
"description": "The infill pattern is offset this distance along the X axis.",
"unit": "mm",
"type": "float",
"default_value": 0,
"enabled": "infill_pattern == 'grid' or infill_pattern == 'lines' or infill_pattern == 'triangles' or infill_pattern == 'cubic' or infill_pattern == 'tetrahedral' or infill_pattern == 'quarter_cubic' or infill_pattern == 'zigzag'",
"limit_to_extruder": "infill_extruder_nr",
"settable_per_mesh": true
},
"infill_offset_y":
{
"label": "Infill Y Offset",
"description": "The infill pattern is offset this distance along the Y axis.",
"unit": "mm",
"type": "float",
"default_value": 0,
"enabled": "infill_pattern == 'grid' or infill_pattern == 'lines' or infill_pattern == 'triangles' or infill_pattern == 'cubic' or infill_pattern == 'tetrahedral' or infill_pattern == 'quarter_cubic' or infill_pattern == 'zigzag'",
"limit_to_extruder": "infill_extruder_nr",
"settable_per_mesh": true
},
"sub_div_rad_add": "sub_div_rad_add":
{ {
"label": "Cubic Subdivision Shell", "label": "Cubic Subdivision Shell",
@ -4008,7 +3986,7 @@
"skirt_gap": "skirt_gap":
{ {
"label": "Skirt Distance", "label": "Skirt Distance",
"description": "The horizontal distance between the skirt and the first layer of the print.\nThis is the minimum distance. Multiple skirt lines will extend outwards from this distance.", "description": "The horizontal distance between the skirt and the first layer of the print.\nThis is the minimum distance, multiple skirt lines will extend outwards from this distance.",
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 3, "default_value": 3,

View file

@ -43,7 +43,7 @@ Item {
} }
} }
Label { Text {
id: statusLabel id: statusLabel
width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width
anchors.top: parent.top anchors.top: parent.top

View file

@ -114,7 +114,7 @@ Rectangle
} }
} }
Label { Text {
id: settingsModeLabel id: settingsModeLabel
text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified"); text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified");
anchors.left: parent.left anchors.left: parent.left
@ -324,7 +324,7 @@ Rectangle
anchors.bottom: timeSpecDescription.top anchors.bottom: timeSpecDescription.top
font: UM.Theme.getFont("large") font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text_subtext") color: UM.Theme.getColor("text_subtext")
text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label Hours and minutes", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
MouseArea MouseArea
{ {
@ -407,12 +407,12 @@ Rectangle
} }
if(someCostsKnown) if(someCostsKnown)
{ {
return catalog.i18nc("@label Print estimates: m for meters, g for grams, %4 is currency and %3 is print cost", "%1m / ~ %2g / ~ %4 %3").arg(lengths.join(" + ")) return catalog.i18nc("@label", "%1m / ~ %2g / ~ %4 %3").arg(lengths.join(" + "))
.arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency"));
} }
else else
{ {
return catalog.i18nc("@label Print estimates: m for meters, g for grams", "%1m / ~ %2g").arg(lengths.join(" + ")).arg(weights.join(" + ")); return catalog.i18nc("@label", "%1m / ~ %2g").arg(lengths.join(" + ")).arg(weights.join(" + "));
} }
} }
} }

View file

@ -363,7 +363,7 @@ Column
visible: !Cura.MachineManager.isCurrentSetupSupported visible: !Cura.MachineManager.isCurrentSetupSupported
} }
Label { Text {
id: materialInfoLabel id: materialInfoLabel
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: catalog.i18nc("@label", "<a href='%1'>Check material compatibility</a>") text: catalog.i18nc("@label", "<a href='%1'>Check material compatibility</a>")

View file

@ -154,7 +154,7 @@ Item
} }
} }
Label Text
{ {
id: qualityRowTitle id: qualityRowTitle
text: catalog.i18nc("@label", "Layer Height") text: catalog.i18nc("@label", "Layer Height")
@ -171,11 +171,11 @@ Item
{ {
model: qualityModel model: qualityModel
Label Text
{ {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height / 2) anchors.topMargin: UM.Theme.getSize("sidebar_margin").height / 2
color: (Cura.MachineManager.activeMachine != null && Cura.ProfilesModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") color: (Cura.MachineManager.activeMachine != null && Cura.ProfilesModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
text: text:
{ {
@ -194,13 +194,13 @@ Item
// Make sure the text aligns correctly with each tick // Make sure the text aligns correctly with each tick
if (qualityModel.totalTicks == 0) { if (qualityModel.totalTicks == 0) {
// If there is only one tick, align it centrally // If there is only one tick, align it centrally
return parseInt(((base.width * 0.55) - width) / 2) return ((base.width * 0.55) - width) / 2
} else if (index == 0) { } else if (index == 0) {
return (base.width * 0.55 / qualityModel.totalTicks) * index return (base.width * 0.55 / qualityModel.totalTicks) * index
} else if (index == qualityModel.totalTicks) { } else if (index == qualityModel.totalTicks) {
return (base.width * 0.55 / qualityModel.totalTicks) * index - width return (base.width * 0.55 / qualityModel.totalTicks) * index - width
} else { } else {
return parseInt((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2)) return (base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2)
} }
} }
} }
@ -310,7 +310,7 @@ Item
} }
} }
Label Text
{ {
id: speedLabel id: speedLabel
anchors.top: speedSlider.bottom anchors.top: speedSlider.bottom
@ -322,7 +322,7 @@ Item
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
} }
Label Text
{ {
anchors.bottom: speedLabel.bottom anchors.bottom: speedLabel.bottom
anchors.left: speedSlider.left anchors.left: speedSlider.left
@ -333,7 +333,7 @@ Item
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
} }
Label Text
{ {
anchors.bottom: speedLabel.bottom anchors.bottom: speedLabel.bottom
anchors.right: speedSlider.right anchors.right: speedSlider.right
@ -360,7 +360,7 @@ Item
width: UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width width: UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width
Label Text
{ {
id: infillLabel id: infillLabel
text: catalog.i18nc("@label", "Infill") text: catalog.i18nc("@label", "Infill")
@ -385,7 +385,7 @@ Item
anchors.top: infillCellLeft.top anchors.top: infillCellLeft.top
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
Label { Text {
id: selectedInfillRateText id: selectedInfillRateText
//anchors.top: parent.top //anchors.top: parent.top
@ -482,7 +482,7 @@ Item
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height / 2) anchors.topMargin: UM.Theme.getSize("sidebar_margin").height / 2
// we loop over all density icons and only show the one that has the current density and steps // we loop over all density icons and only show the one that has the current density and steps
Repeater Repeater
@ -533,7 +533,7 @@ Item
property alias _hovered: enableGradualInfillMouseArea.containsMouse property alias _hovered: enableGradualInfillMouseArea.containsMouse
anchors.top: infillSlider.bottom anchors.top: infillSlider.bottom
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height / 2) // closer to slider since it belongs to the same category anchors.topMargin: UM.Theme.getSize("sidebar_margin").height / 2 // closer to slider since it belongs to the same category
anchors.left: infillCellRight.left anchors.left: infillCellRight.left
style: UM.Theme.styles.checkbox style: UM.Theme.styles.checkbox
@ -566,10 +566,10 @@ Item
} }
} }
Label { Text {
id: gradualInfillLabel id: gradualInfillLabel
anchors.left: enableGradualInfillCheckBox.right anchors.left: enableGradualInfillCheckBox.right
anchors.leftMargin: parseInt(UM.Theme.getSize("sidebar_margin").width / 2) anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width / 2
text: catalog.i18nc("@label", "Enable gradual") text: catalog.i18nc("@label", "Enable gradual")
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
@ -624,13 +624,13 @@ Item
// //
// Enable support // Enable support
// //
Label Text
{ {
id: enableSupportLabel id: enableSupportLabel
visible: enableSupportCheckBox.visible visible: enableSupportCheckBox.visible
anchors.top: infillCellRight.bottom anchors.top: infillCellRight.bottom
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height * 1.5) anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 1.5
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.verticalCenter: enableSupportCheckBox.verticalCenter anchors.verticalCenter: enableSupportCheckBox.verticalCenter
@ -677,7 +677,7 @@ Item
} }
} }
Label Text
{ {
id: supportExtruderLabel id: supportExtruderLabel
visible: supportExtruderCombobox.visible visible: supportExtruderCombobox.visible
@ -753,7 +753,7 @@ Item
} }
Label Text
{ {
id: adhesionHelperLabel id: adhesionHelperLabel
visible: adhesionCheckBox.visible visible: adhesionCheckBox.visible
@ -839,12 +839,12 @@ Item
{ {
id: tipsCell id: tipsCell
anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom) anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom)
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height * 2) anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2
anchors.left: parent.left anchors.left: parent.left
width: parent.width width: parent.width
height: tipsText.contentHeight * tipsText.lineCount height: tipsText.contentHeight * tipsText.lineCount
Label Text
{ {
id: tipsText id: tipsText
anchors.left: parent.left anchors.left: parent.left

View file

@ -43,7 +43,7 @@ UM.PointingRectangle {
base.opacity = 0; base.opacity = 0;
} }
Label { Text {
id: label; id: label;
anchors { anchors {
top: parent.top; top: parent.top;

View file

@ -17,6 +17,10 @@
"size": 1.15, "size": 1.15,
"family": "Open Sans" "family": "Open Sans"
}, },
"default_little_big": {
"size": 1.17,
"family": "Open Sans"
},
"default_bold": { "default_bold": {
"size": 1.15, "size": 1.15,
"bold": true, "bold": true,