- working on adding DPI setting for PNG export in the Film Tool

This commit is contained in:
Marius Stanciu
2020-10-05 12:53:06 +03:00
committed by Marius
parent d5cf7b4980
commit f99a5a8073
7 changed files with 114 additions and 41 deletions

View File

@@ -461,6 +461,7 @@ class PreferencesUIManager:
"tools_film_file_type_radio": self.ui.tools_defaults_form.tools_film_group.file_type_radio,
"tools_film_orientation": self.ui.tools_defaults_form.tools_film_group.orientation_radio,
"tools_film_pagesize": self.ui.tools_defaults_form.tools_film_group.pagesize_combo,
"tools_film_png_dpi": self.ui.tools_defaults_form.tools_film_group.png_dpi_spinner,
# Panelize Tool
"tools_panelize_spacing_columns": self.ui.tools_defaults_form.tools_panelize_group.pspacing_columns,

View File

@@ -1,7 +1,7 @@
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import Qt, QSettings
from PyQt5 import QtWidgets
from PyQt5.QtCore import QSettings
from appGUI.GUIElements import RadioSet, FCEntry, FCDoubleSpinner, FCCheckBox, FCComboBox, FCColorEntry
from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox, FCColorEntry, FCLabel, FCSpinner
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext
@@ -28,7 +28,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
self.decimals = decimals
# ## Parameters
self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
self.film_label = FCLabel("<b>%s:</b>" % _("Parameters"))
self.film_label.setToolTip(
_("Create a PCB film from a Gerber or Geometry object.\n"
"The file is saved in SVG format.")
@@ -40,7 +40,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
{'label': 'Neg', 'value': 'neg'}])
ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
ftypelbl = FCLabel('%s:' % _('Film Type'))
ftypelbl.setToolTip(
_("Generate a Positive black film or a Negative film.\n"
"Positive means that it will print the features\n"
@@ -53,7 +53,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.film_type_radio, 0, 1)
# Film Color
self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
self.film_color_label = FCLabel('%s:' % _('Film Color'))
self.film_color_label.setToolTip(
_("Set the film color when positive film is selected.")
)
@@ -68,7 +68,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
self.film_boundary_entry.set_range(0, 9999.9999)
self.film_boundary_entry.setSingleStep(0.1)
self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
self.film_boundary_label = FCLabel('%s:' % _("Border"))
self.film_boundary_label.setToolTip(
_("Specify a border around the object.\n"
"Only for negative film.\n"
@@ -87,7 +87,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
self.film_scale_stroke_entry.set_range(0, 9999.9999)
self.film_scale_stroke_entry.setSingleStep(0.1)
self.film_scale_stroke_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
self.film_scale_stroke_label = FCLabel('%s:' % _("Scale Stroke"))
self.film_scale_stroke_label.setToolTip(
_("Scale the line stroke thickness of each feature in the SVG file.\n"
"It means that the line that envelope each SVG feature will be thicker or thinner,\n"
@@ -96,7 +96,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.film_scale_stroke_label, 3, 0)
grid0.addWidget(self.film_scale_stroke_entry, 3, 1)
self.film_adj_label = QtWidgets.QLabel('<b>%s</b>' % _("Film Adjustments"))
self.film_adj_label = FCLabel('<b>%s</b>' % _("Film Adjustments"))
self.film_adj_label.setToolTip(
_("Sometime the printers will distort the print shape, especially the Laser types.\n"
"This section provide the tools to compensate for the print distortions.")
@@ -117,7 +117,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
)
grid0.addWidget(self.film_scale_cb, 5, 0, 1, 2)
self.film_scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
self.film_scalex_label = FCLabel('%s:' % _("X factor"))
self.film_scalex_entry = FCDoubleSpinner()
self.film_scalex_entry.set_range(-999.9999, 999.9999)
self.film_scalex_entry.set_precision(self.decimals)
@@ -126,7 +126,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.film_scalex_label, 6, 0)
grid0.addWidget(self.film_scalex_entry, 6, 1)
self.film_scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
self.film_scaley_label = FCLabel('%s:' % _("Y factor"))
self.film_scaley_entry = FCDoubleSpinner()
self.film_scaley_entry.set_range(-999.9999, 999.9999)
self.film_scaley_entry.set_precision(self.decimals)
@@ -148,7 +148,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
)
grid0.addWidget(self.film_skew_cb, 8, 0, 1, 2)
self.film_skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
self.film_skewx_label = FCLabel('%s:' % _("X angle"))
self.film_skewx_entry = FCDoubleSpinner()
self.film_skewx_entry.set_range(-999.9999, 999.9999)
self.film_skewx_entry.set_precision(self.decimals)
@@ -157,7 +157,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.film_skewx_label, 9, 0)
grid0.addWidget(self.film_skewx_entry, 9, 1)
self.film_skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
self.film_skewy_label = FCLabel('%s:' % _("Y angle"))
self.film_skewy_entry = FCDoubleSpinner()
self.film_skewy_entry.set_range(-999.9999, 999.9999)
self.film_skewy_entry.set_precision(self.decimals)
@@ -166,7 +166,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.film_skewy_label, 10, 0)
grid0.addWidget(self.film_skewy_entry, 10, 1)
self.film_skew_ref_label = QtWidgets.QLabel('%s:' % _("Reference"))
self.film_skew_ref_label = FCLabel('%s:' % _("Reference"))
self.film_skew_ref_label.setToolTip(
_("The reference point to be used as origin for the skew.\n"
"It can be one of the four points of the geometry bounding box.")
@@ -198,7 +198,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
{'label': _('Y'), 'value': 'y'},
{'label': _('Both'), 'value': 'both'}],
stretch=False)
self.film_mirror_axis_label = QtWidgets.QLabel('%s:' % _("Mirror axis"))
self.film_mirror_axis_label = FCLabel('%s:' % _("Mirror axis"))
grid0.addWidget(self.film_mirror_axis_label, 13, 0)
grid0.addWidget(self.film_mirror_axis, 13, 1)
@@ -213,7 +213,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
{'label': _('PDF'), 'value': 'pdf'}
], stretch=False)
self.file_type_label = QtWidgets.QLabel(_("Film Type:"))
self.file_type_label = FCLabel(_("Film Type:"))
self.file_type_label.setToolTip(
_("The file type of the saved film. Can be:\n"
"- 'SVG' -> open-source vectorial format\n"
@@ -224,7 +224,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.file_type_radio, 15, 1)
# Page orientation
self.orientation_label = QtWidgets.QLabel('%s:' % _("Page Orientation"))
self.orientation_label = FCLabel('%s:' % _("Page Orientation"))
self.orientation_label.setToolTip(_("Can be:\n"
"- Portrait\n"
"- Landscape"))
@@ -237,7 +237,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.orientation_radio, 16, 1)
# Page Size
self.pagesize_label = QtWidgets.QLabel('%s:' % _("Page Size"))
self.pagesize_label = FCLabel('%s:' % _("Page Size"))
self.pagesize_label.setToolTip(_("A selection of standard ISO 216 page sizes."))
self.pagesize_combo = FCComboBox()
@@ -302,6 +302,17 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.pagesize_label, 17, 0)
grid0.addWidget(self.pagesize_combo, 17, 1)
# PNG DPI
self.png_dpi_label = FCLabel('%s:' % "PNG DPI")
self.png_dpi_label.setToolTip(
_("Default value is 96 DPI. Change this value to scale the PNG file.")
)
self.png_dpi_spinner = FCSpinner()
self.png_dpi_spinner.set_range(0, 100000)
grid0.addWidget(self.png_dpi_label, 19, 0)
grid0.addWidget(self.png_dpi_spinner, 19, 1)
self.layout.addStretch()
# Film Tool