- added Preferences values for PDF margins when saving text in Code Editor as PDF
- when clicking Cancel in Preferences now the values are reverted to what they used to be before opening Preferences tab and start changing values
This commit is contained in:
parent
04d30fb1b4
commit
80f1d30a28
@ -416,6 +416,10 @@ class App(QtCore.QObject):
|
|||||||
"global_stats": dict(),
|
"global_stats": dict(),
|
||||||
"global_tabs_detachable": True,
|
"global_tabs_detachable": True,
|
||||||
"global_jump_ref": 'abs',
|
"global_jump_ref": 'abs',
|
||||||
|
"global_tpdf_tmargin": 15.0,
|
||||||
|
"global_tpdf_bmargin": 10.0,
|
||||||
|
"global_tpdf_lmargin": 20.0,
|
||||||
|
"global_tpdf_rmargin": 20.0,
|
||||||
|
|
||||||
# General
|
# General
|
||||||
"global_graphic_engine": '3D',
|
"global_graphic_engine": '3D',
|
||||||
@ -978,6 +982,10 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
self.current_units = self.defaults['units']
|
self.current_units = self.defaults['units']
|
||||||
|
|
||||||
|
# store here the current self.defaults so it can be restored if Preferences changes are cancelled
|
||||||
|
self.current_defaults = dict()
|
||||||
|
self.current_defaults.update(self.defaults)
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# ##################### CREATE MULTIPROCESSING POOL ###########################
|
# ##################### CREATE MULTIPROCESSING POOL ###########################
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
@ -1085,6 +1093,11 @@ class App(QtCore.QObject):
|
|||||||
"global_bookmarks_limit": self.ui.general_defaults_form.general_app_group.bm_limit_spinner,
|
"global_bookmarks_limit": self.ui.general_defaults_form.general_app_group.bm_limit_spinner,
|
||||||
"global_machinist_setting": self.ui.general_defaults_form.general_app_group.machinist_cb,
|
"global_machinist_setting": self.ui.general_defaults_form.general_app_group.machinist_cb,
|
||||||
|
|
||||||
|
"global_tpdf_tmargin": self.ui.general_defaults_form.general_app_group.tmargin_entry,
|
||||||
|
"global_tpdf_bmargin": self.ui.general_defaults_form.general_app_group.bmargin_entry,
|
||||||
|
"global_tpdf_lmargin": self.ui.general_defaults_form.general_app_group.lmargin_entry,
|
||||||
|
"global_tpdf_rmargin": self.ui.general_defaults_form.general_app_group.rmargin_entry,
|
||||||
|
|
||||||
# General GUI Preferences
|
# General GUI Preferences
|
||||||
"global_gridx": self.ui.general_defaults_form.general_gui_group.gridx_entry,
|
"global_gridx": self.ui.general_defaults_form.general_gui_group.gridx_entry,
|
||||||
"global_gridy": self.ui.general_defaults_form.general_gui_group.gridy_entry,
|
"global_gridy": self.ui.general_defaults_form.general_gui_group.gridy_entry,
|
||||||
@ -2940,17 +2953,25 @@ class App(QtCore.QObject):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("App.defaults_read_form() --> %s" % str(e))
|
log.debug("App.defaults_read_form() --> %s" % str(e))
|
||||||
|
|
||||||
def defaults_write_form(self, factor=None, fl_units=None):
|
def defaults_write_form(self, factor=None, fl_units=None, source_dict=None):
|
||||||
"""
|
"""
|
||||||
Will set the values for all the GUI elements in Preferences GUI based on the values found in the
|
Will set the values for all the GUI elements in Preferences GUI based on the values found in the
|
||||||
self.defaults dictionary.
|
self.defaults dictionary.
|
||||||
|
|
||||||
:param factor: will apply a factor to the values that written in the GUI elements
|
:param factor: will apply a factor to the values that written in the GUI elements
|
||||||
:param fl_units: current measuring units in FlatCAM: Metric or Inch
|
:param fl_units: current measuring units in FlatCAM: Metric or Inch
|
||||||
|
:param source_dict: the repository of options, usually is the self.defaults
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
for option in self.defaults:
|
|
||||||
self.defaults_write_form_field(option, factor=factor, units=fl_units)
|
options_storage = self.defaults if source_dict is None else source_dict
|
||||||
|
|
||||||
|
for option in options_storage:
|
||||||
|
if source_dict:
|
||||||
|
self.defaults_write_form_field(option, factor=factor, units=fl_units, defaults_dict=source_dict)
|
||||||
|
else:
|
||||||
|
self.defaults_write_form_field(option, factor=factor, units=fl_units)
|
||||||
|
|
||||||
# try:
|
# try:
|
||||||
# self.defaults_form_fields[option].set_value(self.defaults[option])
|
# self.defaults_form_fields[option].set_value(self.defaults[option])
|
||||||
# except KeyError:
|
# except KeyError:
|
||||||
@ -2958,7 +2979,7 @@ class App(QtCore.QObject):
|
|||||||
# # TODO: Rethink this?
|
# # TODO: Rethink this?
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
def defaults_write_form_field(self, field, factor=None, units=None):
|
def defaults_write_form_field(self, field, factor=None, units=None, defaults_dict=None):
|
||||||
"""
|
"""
|
||||||
Basically it is the worker in the self.defaults_write_form()
|
Basically it is the worker in the self.defaults_write_form()
|
||||||
|
|
||||||
@ -2967,21 +2988,23 @@ class App(QtCore.QObject):
|
|||||||
:param units: current FLatCAM measuring units
|
:param units: current FLatCAM measuring units
|
||||||
:return: None, it updates GUI elements
|
:return: None, it updates GUI elements
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def_dict = self.defaults if defaults_dict is None else defaults_dict
|
||||||
try:
|
try:
|
||||||
if factor is None:
|
if factor is None:
|
||||||
if units is None:
|
if units is None:
|
||||||
self.defaults_form_fields[field].set_value(self.defaults[field])
|
self.defaults_form_fields[field].set_value(def_dict[field])
|
||||||
elif units == 'IN' and (field == 'global_gridx' or field == 'global_gridy'):
|
elif units == 'IN' and (field == 'global_gridx' or field == 'global_gridy'):
|
||||||
self.defaults_form_fields[field].set_value(self.defaults[field])
|
self.defaults_form_fields[field].set_value(def_dict[field])
|
||||||
elif units == 'MM' and (field == 'global_gridx' or field == 'global_gridy'):
|
elif units == 'MM' and (field == 'global_gridx' or field == 'global_gridy'):
|
||||||
self.defaults_form_fields[field].set_value(self.defaults[field])
|
self.defaults_form_fields[field].set_value(def_dict[field])
|
||||||
else:
|
else:
|
||||||
if units is None:
|
if units is None:
|
||||||
self.defaults_form_fields[field].set_value(self.defaults[field] * factor)
|
self.defaults_form_fields[field].set_value(def_dict[field] * factor)
|
||||||
elif units == 'IN' and (field == 'global_gridx' or field == 'global_gridy'):
|
elif units == 'IN' and (field == 'global_gridx' or field == 'global_gridy'):
|
||||||
self.defaults_form_fields[field].set_value((self.defaults[field] * factor))
|
self.defaults_form_fields[field].set_value((def_dict[field] * factor))
|
||||||
elif units == 'MM' and (field == 'global_gridx' or field == 'global_gridy'):
|
elif units == 'MM' and (field == 'global_gridx' or field == 'global_gridy'):
|
||||||
self.defaults_form_fields[field].set_value((self.defaults[field] * factor))
|
self.defaults_form_fields[field].set_value((def_dict[field] * factor))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# self.log.debug("defaults_write_form(): No field for: %s" % option)
|
# self.log.debug("defaults_write_form(): No field for: %s" % option)
|
||||||
# TODO: Rethink this?
|
# TODO: Rethink this?
|
||||||
@ -3891,6 +3914,10 @@ class App(QtCore.QObject):
|
|||||||
_("Failed to parse defaults file."))
|
_("Failed to parse defaults file."))
|
||||||
return
|
return
|
||||||
self.defaults.update(defaults_from_file)
|
self.defaults.update(defaults_from_file)
|
||||||
|
# update the dict that is used to restore the values in the defaults form if Cancel is clicked in the
|
||||||
|
# Preferences window
|
||||||
|
self.current_defaults.update(defaults_from_file)
|
||||||
|
|
||||||
self.on_preferences_edited()
|
self.on_preferences_edited()
|
||||||
self.inform.emit('[success] %s: %s' %
|
self.inform.emit('[success] %s: %s' %
|
||||||
(_("Imported Defaults from"), filename))
|
(_("Imported Defaults from"), filename))
|
||||||
@ -5764,14 +5791,15 @@ class App(QtCore.QObject):
|
|||||||
"tools_cr_trace_size_val", "tools_cr_c2c_val", "tools_cr_c2o_val", "tools_cr_s2s_val",
|
"tools_cr_trace_size_val", "tools_cr_c2c_val", "tools_cr_c2o_val", "tools_cr_s2s_val",
|
||||||
"tools_cr_s2sm_val", "tools_cr_s2o_val", "tools_cr_sm2sm_val", "tools_cr_ri_val",
|
"tools_cr_s2sm_val", "tools_cr_s2o_val", "tools_cr_sm2sm_val", "tools_cr_ri_val",
|
||||||
"tools_cr_h2h_val", "tools_cr_dh_val", "tools_fiducials_dia", "tools_fiducials_margin",
|
"tools_cr_h2h_val", "tools_cr_dh_val", "tools_fiducials_dia", "tools_fiducials_margin",
|
||||||
"tools_fiducials_mode", "tools_fiducials_second_pos", "tools_fiducials_type",
|
|
||||||
"tools_fiducials_line_thickness",
|
"tools_fiducials_line_thickness",
|
||||||
"tools_copper_thieving_clearance", "tools_copper_thieving_margin",
|
"tools_copper_thieving_clearance", "tools_copper_thieving_margin",
|
||||||
"tools_copper_thieving_dots_dia", "tools_copper_thieving_dots_spacing",
|
"tools_copper_thieving_dots_dia", "tools_copper_thieving_dots_spacing",
|
||||||
"tools_copper_thieving_squares_size", "tools_copper_thieving_squares_spacing",
|
"tools_copper_thieving_squares_size", "tools_copper_thieving_squares_spacing",
|
||||||
"tools_copper_thieving_lines_size", "tools_copper_thieving_lines_spacing",
|
"tools_copper_thieving_lines_size", "tools_copper_thieving_lines_spacing",
|
||||||
"tools_copper_thieving_rb_margin", "tools_copper_thieving_rb_thickness",
|
"tools_copper_thieving_rb_margin", "tools_copper_thieving_rb_thickness",
|
||||||
'global_gridx', 'global_gridy', 'global_snap_max', "global_tolerance"]
|
|
||||||
|
'global_gridx', 'global_gridy', 'global_snap_max', "global_tolerance",
|
||||||
|
'global_tpdf_bmargin', 'global_tpdf_tmargin', 'global_tpdf_rmargin', 'global_tpdf_lmargin']
|
||||||
|
|
||||||
def scale_defaults(sfactor):
|
def scale_defaults(sfactor):
|
||||||
for dim in dimensions:
|
for dim in dimensions:
|
||||||
@ -5796,6 +5824,7 @@ class App(QtCore.QObject):
|
|||||||
tools_diameters = [eval(a) for a in tools_string if a != '']
|
tools_diameters = [eval(a) for a in tools_string if a != '']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("App.on_toggle_units().scale_options() --> %s" % str(e))
|
log.debug("App.on_toggle_units().scale_options() --> %s" % str(e))
|
||||||
|
continue
|
||||||
|
|
||||||
self.defaults['geometry_cnctooldia'] = ''
|
self.defaults['geometry_cnctooldia'] = ''
|
||||||
for t in range(len(tools_diameters)):
|
for t in range(len(tools_diameters)):
|
||||||
@ -5808,6 +5837,7 @@ class App(QtCore.QObject):
|
|||||||
ncctools = [eval(a) for a in tools_string if a != '']
|
ncctools = [eval(a) for a in tools_string if a != '']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("App.on_toggle_units().scale_options() --> %s" % str(e))
|
log.debug("App.on_toggle_units().scale_options() --> %s" % str(e))
|
||||||
|
continue
|
||||||
|
|
||||||
self.defaults['tools_ncctools'] = ''
|
self.defaults['tools_ncctools'] = ''
|
||||||
for t in range(len(ncctools)):
|
for t in range(len(ncctools)):
|
||||||
@ -5820,6 +5850,7 @@ class App(QtCore.QObject):
|
|||||||
sptools = [eval(a) for a in tools_string if a != '']
|
sptools = [eval(a) for a in tools_string if a != '']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("App.on_toggle_units().scale_options() --> %s" % str(e))
|
log.debug("App.on_toggle_units().scale_options() --> %s" % str(e))
|
||||||
|
continue
|
||||||
|
|
||||||
self.defaults['tools_solderpaste_tools'] = ""
|
self.defaults['tools_solderpaste_tools'] = ""
|
||||||
for t in range(len(sptools)):
|
for t in range(len(sptools)):
|
||||||
@ -5839,6 +5870,7 @@ class App(QtCore.QObject):
|
|||||||
val = float(self.defaults[dim]) * sfactor
|
val = float(self.defaults[dim]) * sfactor
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
||||||
|
continue
|
||||||
|
|
||||||
self.defaults[dim] = float('%.*f' % (self.decimals, val))
|
self.defaults[dim] = float('%.*f' % (self.decimals, val))
|
||||||
else:
|
else:
|
||||||
@ -5847,6 +5879,7 @@ class App(QtCore.QObject):
|
|||||||
val = float(self.defaults[dim]) * sfactor
|
val = float(self.defaults[dim]) * sfactor
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
||||||
|
continue
|
||||||
|
|
||||||
self.defaults[dim] = float('%.*f' % (self.decimals, val))
|
self.defaults[dim] = float('%.*f' % (self.decimals, val))
|
||||||
else:
|
else:
|
||||||
@ -5855,7 +5888,8 @@ class App(QtCore.QObject):
|
|||||||
try:
|
try:
|
||||||
val = float(self.defaults[dim]) * sfactor
|
val = float(self.defaults[dim]) * sfactor
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_defaults() --> Value: %s %s' % (str(dim), str(e)))
|
||||||
|
continue
|
||||||
|
|
||||||
self.defaults[dim] = val
|
self.defaults[dim] = val
|
||||||
|
|
||||||
@ -7029,6 +7063,9 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
self.inform.emit('%s' % _("Preferences applied."))
|
self.inform.emit('%s' % _("Preferences applied."))
|
||||||
|
|
||||||
|
# make sure we update the self.current_defaults dict used to undo changes to self.defaults
|
||||||
|
self.current_defaults.update(self.defaults)
|
||||||
|
|
||||||
if save_to_file:
|
if save_to_file:
|
||||||
self.save_defaults(silent=False)
|
self.save_defaults(silent=False)
|
||||||
# load the defaults so they are updated into the app
|
# load the defaults so they are updated into the app
|
||||||
@ -7067,7 +7104,18 @@ class App(QtCore.QObject):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.defaults_write_form()
|
try:
|
||||||
|
self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.disconnect()
|
||||||
|
except (TypeError, AttributeError):
|
||||||
|
pass
|
||||||
|
self.defaults_write_form(source_dict=self.current_defaults)
|
||||||
|
self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.connect(
|
||||||
|
lambda: self.on_toggle_units(no_pref=False))
|
||||||
|
self.defaults.update(self.current_defaults)
|
||||||
|
|
||||||
|
# shared_items = {k: self.defaults[k] for k in self.defaults if k in self.current_defaults and
|
||||||
|
# self.defaults[k] == self.current_defaults[k]}
|
||||||
|
# print(len(self.defaults), len(shared_items))
|
||||||
|
|
||||||
# Preferences save, update the color of the Preferences Tab text
|
# Preferences save, update the color of the Preferences Tab text
|
||||||
for idx in range(self.ui.plot_tab_area.count()):
|
for idx in range(self.ui.plot_tab_area.count()):
|
||||||
@ -7797,8 +7845,7 @@ class App(QtCore.QObject):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def on_preferences_edited(self):
|
def on_preferences_edited(self):
|
||||||
self.inform.emit('[WARNING_NOTCL] %s' %
|
self.inform.emit('[WARNING_NOTCL] %s' % _("Preferences edited but not saved."))
|
||||||
_("Preferences edited but not saved."))
|
|
||||||
|
|
||||||
for idx in range(self.ui.plot_tab_area.count()):
|
for idx in range(self.ui.plot_tab_area.count()):
|
||||||
if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
|
if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
|
||||||
|
@ -12,6 +12,9 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
19.12.2019
|
19.12.2019
|
||||||
|
|
||||||
- in 2-Sided Tool added a way to calculate the bounding box values for a selection of objects, and also the centroid
|
- in 2-Sided Tool added a way to calculate the bounding box values for a selection of objects, and also the centroid
|
||||||
|
- in 2-Sided Tool fixed the Reset Tool button handler to reset the bounds value too; changed a string
|
||||||
|
- added Preferences values for PDF margins when saving text in Code Editor as PDF
|
||||||
|
- when clicking Cancel in Preferences now the values are reverted to what they used to be before opening Preferences tab and start changing values
|
||||||
|
|
||||||
18.12.2019
|
18.12.2019
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ class TextEditor(QtWidgets.QWidget):
|
|||||||
_filter_ = filt
|
_filter_ = filt
|
||||||
else:
|
else:
|
||||||
_filter_ = "G-Code Files (*.nc);; G-Code Files (*.txt);; G-Code Files (*.tap);; G-Code Files (*.cnc);; " \
|
_filter_ = "G-Code Files (*.nc);; G-Code Files (*.txt);; G-Code Files (*.tap);; G-Code Files (*.cnc);; " \
|
||||||
"All Files (*.*)"
|
"PDF Files (*.pdf);;All Files (*.*)"
|
||||||
|
|
||||||
if name:
|
if name:
|
||||||
obj_name = name
|
obj_name = name
|
||||||
@ -206,7 +206,7 @@ class TextEditor(QtWidgets.QWidget):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
obj_name = 'file'
|
obj_name = 'file'
|
||||||
if filt is None:
|
if filt is None:
|
||||||
_filter_ = "FlatConfig Files (*.FlatConfig);;All Files (*.*)"
|
_filter_ = "FlatConfig Files (*.FlatConfig);;PDF Files (*.pdf);;All Files (*.*)"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filename = str(QtWidgets.QFileDialog.getSaveFileName(
|
filename = str(QtWidgets.QFileDialog.getSaveFileName(
|
||||||
@ -237,13 +237,24 @@ class TextEditor(QtWidgets.QWidget):
|
|||||||
styleH = styles['Heading1']
|
styleH = styles['Heading1']
|
||||||
story = []
|
story = []
|
||||||
|
|
||||||
|
if self.app.defaults['units'].lower() == 'mm':
|
||||||
|
bmargin = self.app.defaults['global_tpdf_bmargin'] * mm
|
||||||
|
tmargin = self.app.defaults['global_tpdf_tmargin'] * mm
|
||||||
|
rmargin = self.app.defaults['global_tpdf_rmargin'] * mm
|
||||||
|
lmargin = self.app.defaults['global_tpdf_lmargin'] * mm
|
||||||
|
else:
|
||||||
|
bmargin = self.app.defaults['global_tpdf_bmargin'] * inch
|
||||||
|
tmargin = self.app.defaults['global_tpdf_tmargin'] * inch
|
||||||
|
rmargin = self.app.defaults['global_tpdf_rmargin'] * inch
|
||||||
|
lmargin = self.app.defaults['global_tpdf_lmargin'] * inch
|
||||||
|
|
||||||
doc = SimpleDocTemplate(
|
doc = SimpleDocTemplate(
|
||||||
filename,
|
filename,
|
||||||
pagesize=page_size,
|
pagesize=page_size,
|
||||||
bottomMargin=0.4 * inch,
|
bottomMargin=bmargin,
|
||||||
topMargin=0.6 * inch,
|
topMargin=tmargin,
|
||||||
rightMargin=0.8 * inch,
|
rightMargin=rmargin,
|
||||||
leftMargin=0.8 * inch)
|
leftMargin=lmargin)
|
||||||
|
|
||||||
P = Paragraph(lined_gcode, styleN)
|
P = Paragraph(lined_gcode, styleN)
|
||||||
story.append(P)
|
story.append(P)
|
||||||
|
@ -1330,6 +1330,76 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
|
|||||||
|
|
||||||
grid0.addWidget(self.machinist_cb, 21, 0, 1, 2)
|
grid0.addWidget(self.machinist_cb, 21, 0, 1, 2)
|
||||||
|
|
||||||
|
separator_line = QtWidgets.QFrame()
|
||||||
|
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.layout.addWidget(separator_line)
|
||||||
|
|
||||||
|
self.layout.addWidget(QtWidgets.QLabel(''))
|
||||||
|
|
||||||
|
grid1 = QtWidgets.QGridLayout()
|
||||||
|
self.layout.addLayout(grid1)
|
||||||
|
grid1.setColumnStretch(0, 0)
|
||||||
|
grid1.setColumnStretch(1, 1)
|
||||||
|
|
||||||
|
self.pdf_param_label = QtWidgets.QLabel('<B>%s:</b>' % _("Text to PDF parameters"))
|
||||||
|
self.pdf_param_label.setToolTip(
|
||||||
|
_("Used when saving text in Code Editor or in FlatCAM Document objects.")
|
||||||
|
)
|
||||||
|
grid1.addWidget(self.pdf_param_label, 0, 0, 1, 2)
|
||||||
|
|
||||||
|
# Top Margin value
|
||||||
|
self.tmargin_entry = FCDoubleSpinner()
|
||||||
|
self.tmargin_entry.set_precision(self.decimals)
|
||||||
|
self.tmargin_entry.set_range(0.0000, 9999.9999)
|
||||||
|
|
||||||
|
self.tmargin_label = QtWidgets.QLabel('%s:' % _("Top Margin"))
|
||||||
|
self.tmargin_label.setToolTip(
|
||||||
|
_("Distance between text body and the top of the PDF file.")
|
||||||
|
)
|
||||||
|
|
||||||
|
grid1.addWidget(self.tmargin_label, 1, 0)
|
||||||
|
grid1.addWidget(self.tmargin_entry, 1, 1)
|
||||||
|
|
||||||
|
# Bottom Margin value
|
||||||
|
self.bmargin_entry = FCDoubleSpinner()
|
||||||
|
self.bmargin_entry.set_precision(self.decimals)
|
||||||
|
self.bmargin_entry.set_range(0.0000, 9999.9999)
|
||||||
|
|
||||||
|
self.bmargin_label = QtWidgets.QLabel('%s:' % _("Bottom Margin"))
|
||||||
|
self.bmargin_label.setToolTip(
|
||||||
|
_("Distance between text body and the bottom of the PDF file.")
|
||||||
|
)
|
||||||
|
|
||||||
|
grid1.addWidget(self.bmargin_label, 2, 0)
|
||||||
|
grid1.addWidget(self.bmargin_entry, 2, 1)
|
||||||
|
|
||||||
|
# Left Margin value
|
||||||
|
self.lmargin_entry = FCDoubleSpinner()
|
||||||
|
self.lmargin_entry.set_precision(self.decimals)
|
||||||
|
self.lmargin_entry.set_range(0.0000, 9999.9999)
|
||||||
|
|
||||||
|
self.lmargin_label = QtWidgets.QLabel('%s:' % _("Left Margin"))
|
||||||
|
self.lmargin_label.setToolTip(
|
||||||
|
_("Distance between text body and the left of the PDF file.")
|
||||||
|
)
|
||||||
|
|
||||||
|
grid1.addWidget(self.lmargin_label, 3, 0)
|
||||||
|
grid1.addWidget(self.lmargin_entry, 3, 1)
|
||||||
|
|
||||||
|
# Right Margin value
|
||||||
|
self.rmargin_entry = FCDoubleSpinner()
|
||||||
|
self.rmargin_entry.set_precision(self.decimals)
|
||||||
|
self.rmargin_entry.set_range(0.0000, 9999.9999)
|
||||||
|
|
||||||
|
self.rmargin_label = QtWidgets.QLabel('%s:' % _("Right Margin"))
|
||||||
|
self.rmargin_label.setToolTip(
|
||||||
|
_("Distance between text body and the right of the PDF file.")
|
||||||
|
)
|
||||||
|
|
||||||
|
grid1.addWidget(self.rmargin_label, 4, 0)
|
||||||
|
grid1.addWidget(self.rmargin_entry, 4, 1)
|
||||||
|
|
||||||
self.layout.addStretch()
|
self.layout.addStretch()
|
||||||
|
|
||||||
if sys.platform != 'win32':
|
if sys.platform != 'win32':
|
||||||
|
@ -281,13 +281,12 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
self.drill_dia.set_precision(self.decimals)
|
self.drill_dia.set_precision(self.decimals)
|
||||||
self.drill_dia.set_range(0.0000, 9999.9999)
|
self.drill_dia.set_range(0.0000, 9999.9999)
|
||||||
|
|
||||||
self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
|
self.drill_dia.setToolTip(
|
||||||
self.dd_label.setToolTip(
|
|
||||||
_("Diameter of the drill for the "
|
_("Diameter of the drill for the "
|
||||||
"alignment holes.")
|
"alignment holes.")
|
||||||
)
|
)
|
||||||
grid0.addWidget(self.dd_label, 1, 0)
|
|
||||||
grid0.addWidget(self.drill_dia, 1, 1)
|
grid0.addWidget(self.drill_dia, 1, 0, 1, 2)
|
||||||
|
|
||||||
# ## Buttons
|
# ## Buttons
|
||||||
self.create_alignment_hole_button = QtWidgets.QPushButton(_("Create Excellon Object"))
|
self.create_alignment_hole_button = QtWidgets.QPushButton(_("Create Excellon Object"))
|
||||||
@ -309,6 +308,8 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
self.layout.addWidget(separator_line)
|
self.layout.addWidget(separator_line)
|
||||||
|
|
||||||
|
self.layout.addWidget(QtWidgets.QLabel(''))
|
||||||
|
|
||||||
grid1 = QtWidgets.QGridLayout()
|
grid1 = QtWidgets.QGridLayout()
|
||||||
self.layout.addLayout(grid1)
|
self.layout.addLayout(grid1)
|
||||||
grid1.setColumnStretch(0, 0)
|
grid1.setColumnStretch(0, 0)
|
||||||
@ -384,7 +385,7 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
grid1.addWidget(self.center_entry, 5, 1)
|
grid1.addWidget(self.center_entry, 5, 1)
|
||||||
|
|
||||||
# Calculate Bounding box
|
# Calculate Bounding box
|
||||||
self.calculate_bb_button = QtWidgets.QPushButton(_("Calculate Bounding Box"))
|
self.calculate_bb_button = QtWidgets.QPushButton(_("Calculate Bounds Values"))
|
||||||
self.calculate_bb_button.setToolTip(
|
self.calculate_bb_button.setToolTip(
|
||||||
_("Calculate the enveloping rectangular shape coordinates,\n"
|
_("Calculate the enveloping rectangular shape coordinates,\n"
|
||||||
"for the selection of objects.\n"
|
"for the selection of objects.\n"
|
||||||
@ -419,7 +420,6 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
self.mirror_geo_button.clicked.connect(self.on_mirror_geo)
|
self.mirror_geo_button.clicked.connect(self.on_mirror_geo)
|
||||||
self.add_point_button.clicked.connect(self.on_point_add)
|
self.add_point_button.clicked.connect(self.on_point_add)
|
||||||
self.add_drill_point_button.clicked.connect(self.on_drill_add)
|
self.add_drill_point_button.clicked.connect(self.on_drill_add)
|
||||||
self.reset_button.clicked.connect(self.reset_fields)
|
|
||||||
self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type)
|
self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type)
|
||||||
|
|
||||||
self.axis_location.group_toggle_fn = self.on_toggle_pointbox
|
self.axis_location.group_toggle_fn = self.on_toggle_pointbox
|
||||||
@ -427,6 +427,8 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
self.create_alignment_hole_button.clicked.connect(self.on_create_alignment_holes)
|
self.create_alignment_hole_button.clicked.connect(self.on_create_alignment_holes)
|
||||||
self.calculate_bb_button.clicked.connect(self.on_bbox_coordinates)
|
self.calculate_bb_button.clicked.connect(self.on_bbox_coordinates)
|
||||||
|
|
||||||
|
self.reset_button.clicked.connect(self.set_tool_ui)
|
||||||
|
|
||||||
self.drill_values = ""
|
self.drill_values = ""
|
||||||
|
|
||||||
def install(self, icon=None, separator=None, **kwargs):
|
def install(self, icon=None, separator=None, **kwargs):
|
||||||
@ -469,6 +471,12 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
self.axis_location.set_value(self.app.defaults["tools_2sided_axis_loc"])
|
self.axis_location.set_value(self.app.defaults["tools_2sided_axis_loc"])
|
||||||
self.drill_dia.set_value(self.app.defaults["tools_2sided_drilldia"])
|
self.drill_dia.set_value(self.app.defaults["tools_2sided_drilldia"])
|
||||||
|
|
||||||
|
self.xmin_entry.set_value(0.0)
|
||||||
|
self.ymin_entry.set_value(0.0)
|
||||||
|
self.xmax_entry.set_value(0.0)
|
||||||
|
self.ymax_entry.set_value(0.0)
|
||||||
|
self.center_entry.set_value('')
|
||||||
|
|
||||||
def on_combo_box_type(self):
|
def on_combo_box_type(self):
|
||||||
obj_type = self.box_combo_type.currentIndex()
|
obj_type = self.box_combo_type.currentIndex()
|
||||||
self.box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
self.box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
||||||
|
Loading…
Reference in New Issue
Block a user