Merge branch 'Beta' into preferences-refactoring
This commit is contained in:
commit
1c5a6de80d
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -7,6 +7,16 @@ CHANGELOG for FlatCAM beta
|
||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
5.05.2020
|
||||||
|
|
||||||
|
- fixed an issue that made the preprocessors comboxes in Preferences not to load and display the saved value fro the file
|
||||||
|
- some PEP8 corrections
|
||||||
|
|
||||||
|
4.05.2020
|
||||||
|
|
||||||
|
- in detachable tabs, Linux loose the reference of the detached tab and on close of the detachable tabs will gave a 'segmantation fault' error. Solved it by not deleting the reference in case of Unix-like systems
|
||||||
|
- some strings added to translation strings
|
||||||
|
|
||||||
3.05.2020
|
3.05.2020
|
||||||
|
|
||||||
- small changes to allow making the x86 installer that is made from a Python 3.5 run FlatCAM beta
|
- small changes to allow making the x86 installer that is made from a Python 3.5 run FlatCAM beta
|
||||||
|
|
|
@ -543,50 +543,15 @@ class App(QtCore.QObject):
|
||||||
self.save_project_auto_update()
|
self.save_project_auto_update()
|
||||||
self.autosave_timer.timeout.connect(self.save_project_auto)
|
self.autosave_timer.timeout.connect(self.save_project_auto)
|
||||||
|
|
||||||
# ###########################################################################################################
|
|
||||||
# ##################################### UPDATE PREFERENCES GUI FORMS ########################################
|
|
||||||
# ###########################################################################################################
|
|
||||||
|
|
||||||
self.preferencesUiManager = PreferencesUIManager(defaults=self.defaults, data_path=self.data_path, ui=self.ui,
|
|
||||||
inform=self.inform)
|
|
||||||
self.preferencesUiManager.defaults_write_form()
|
|
||||||
|
|
||||||
# When the self.defaults dictionary changes will update the Preferences GUI forms
|
|
||||||
self.defaults.set_change_callback(self.on_defaults_dict_change)
|
|
||||||
|
|
||||||
# ###########################################################################################################
|
|
||||||
# ##################################### FIRST RUN SECTION ###################################################
|
|
||||||
# ################################ It's done only once after install #####################################
|
|
||||||
# ###########################################################################################################
|
|
||||||
|
|
||||||
if self.defaults["first_run"] is True:
|
|
||||||
|
|
||||||
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'minimal'
|
|
||||||
initial_lay = 'minimal'
|
|
||||||
layout_field = self.preferencesUiManager.get_form_field("layout")
|
|
||||||
layout_field.setCurrentIndex(layout_field.findText(initial_lay))
|
|
||||||
self.ui.set_layout(initial_lay)
|
|
||||||
|
|
||||||
# after the first run, this object should be False
|
|
||||||
self.defaults["first_run"] = False
|
|
||||||
self.preferencesUiManager.save_defaults(silent=True)
|
|
||||||
|
|
||||||
# ###########################################################################################################
|
|
||||||
# ############################################ Data #########################################################
|
|
||||||
# ###########################################################################################################
|
|
||||||
|
|
||||||
self.recent = []
|
|
||||||
self.recent_projects = []
|
|
||||||
|
|
||||||
self.clipboard = QtWidgets.QApplication.clipboard()
|
|
||||||
|
|
||||||
self.project_filename = None
|
|
||||||
self.toggle_units_ignore = False
|
|
||||||
|
|
||||||
# ###########################################################################################################
|
# ###########################################################################################################
|
||||||
# #################################### LOAD PREPROCESSORS ###################################################
|
# #################################### LOAD PREPROCESSORS ###################################################
|
||||||
# ###########################################################################################################
|
# ###########################################################################################################
|
||||||
|
|
||||||
|
# ----------------------------------------- WARNING --------------------------------------------------------
|
||||||
|
# Preprocessors need to be loaded before the Preferences Manager builds the Preferences
|
||||||
|
# That's because the number of preprocessors can vary and here the comboboxes are populated
|
||||||
|
# -----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# a dictionary that have as keys the name of the preprocessor files and the value is the class from
|
# a dictionary that have as keys the name of the preprocessor files and the value is the class from
|
||||||
# the preprocessor file
|
# the preprocessor file
|
||||||
self.preprocessors = load_preprocessors(self)
|
self.preprocessors = load_preprocessors(self)
|
||||||
|
@ -619,6 +584,44 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb.addItem(name)
|
self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb.addItem(name)
|
||||||
|
|
||||||
|
# ###########################################################################################################
|
||||||
|
# ##################################### UPDATE PREFERENCES GUI FORMS ########################################
|
||||||
|
# ###########################################################################################################
|
||||||
|
|
||||||
|
self.preferencesUiManager = PreferencesUIManager(defaults=self.defaults, data_path=self.data_path, ui=self.ui,
|
||||||
|
inform=self.inform)
|
||||||
|
self.preferencesUiManager.defaults_write_form()
|
||||||
|
|
||||||
|
# When the self.defaults dictionary changes will update the Preferences GUI forms
|
||||||
|
self.defaults.set_change_callback(self.on_defaults_dict_change)
|
||||||
|
|
||||||
|
# ###########################################################################################################
|
||||||
|
# ##################################### FIRST RUN SECTION ###################################################
|
||||||
|
# ################################ It's done only once after install #####################################
|
||||||
|
# ###########################################################################################################
|
||||||
|
if self.defaults["first_run"] is True:
|
||||||
|
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'minimal'
|
||||||
|
initial_lay = 'minimal'
|
||||||
|
layout_field = self.preferencesUiManager.get_form_field("layout")
|
||||||
|
layout_field.setCurrentIndex(layout_field.findText(initial_lay))
|
||||||
|
self.ui.set_layout(initial_lay)
|
||||||
|
|
||||||
|
# after the first run, this object should be False
|
||||||
|
self.defaults["first_run"] = False
|
||||||
|
self.preferencesUiManager.save_defaults(silent=True)
|
||||||
|
|
||||||
|
# ###########################################################################################################
|
||||||
|
# ############################################ Data #########################################################
|
||||||
|
# ###########################################################################################################
|
||||||
|
|
||||||
|
self.recent = []
|
||||||
|
self.recent_projects = []
|
||||||
|
|
||||||
|
self.clipboard = QtWidgets.QApplication.clipboard()
|
||||||
|
|
||||||
|
self.project_filename = None
|
||||||
|
self.toggle_units_ignore = False
|
||||||
|
|
||||||
# ###########################################################################################################
|
# ###########################################################################################################
|
||||||
# ########################################## LOAD LANGUAGES ################################################
|
# ########################################## LOAD LANGUAGES ################################################
|
||||||
# ###########################################################################################################
|
# ###########################################################################################################
|
||||||
|
@ -2578,7 +2581,7 @@ class App(QtCore.QObject):
|
||||||
self.date = self.date.replace(' ', '_')
|
self.date = self.date.replace(' ', '_')
|
||||||
|
|
||||||
filter__ = "HTML File .html (*.html);;TXT File .txt (*.txt);;All Files (*.*)"
|
filter__ = "HTML File .html (*.html);;TXT File .txt (*.txt);;All Files (*.*)"
|
||||||
path_to_save = self.defaults["global_last_save_folder"] if\
|
path_to_save = self.defaults["global_last_save_folder"] if \
|
||||||
self.defaults["global_last_save_folder"] is not None else self.data_path
|
self.defaults["global_last_save_folder"] is not None else self.data_path
|
||||||
try:
|
try:
|
||||||
filename, _f = FCFileSaveDialog.get_saved_filename(
|
filename, _f = FCFileSaveDialog.get_saved_filename(
|
||||||
|
@ -3252,7 +3255,7 @@ class App(QtCore.QObject):
|
||||||
self.prog_grid_lay.addWidget(QtWidgets.QLabel('<b>%s</b>' % _("E-mail")), 0, 2)
|
self.prog_grid_lay.addWidget(QtWidgets.QLabel('<b>%s</b>' % _("E-mail")), 0, 2)
|
||||||
|
|
||||||
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Juan Pablo Caram"), 1, 0)
|
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Juan Pablo Caram"), 1, 0)
|
||||||
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Program Author"), 1, 1)
|
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % _("Program Author")), 1, 1)
|
||||||
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "<>"), 1, 2)
|
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "<>"), 1, 2)
|
||||||
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Denis Hayrullin"), 2, 0)
|
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Denis Hayrullin"), 2, 0)
|
||||||
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Kamil Sopko"), 3, 0)
|
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Kamil Sopko"), 3, 0)
|
||||||
|
@ -3348,7 +3351,7 @@ class App(QtCore.QObject):
|
||||||
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Italian"), 4, 0)
|
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Italian"), 4, 0)
|
||||||
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Golfetto Massimiliano"), 4, 1)
|
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Golfetto Massimiliano"), 4, 1)
|
||||||
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % " "), 4, 2)
|
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % " "), 4, 2)
|
||||||
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "pcb@golfetto.eu"), 4, 3)
|
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "<golfetto.pcb@gmail.com>"), 4, 3)
|
||||||
|
|
||||||
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "German"), 5, 0)
|
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "German"), 5, 0)
|
||||||
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Marius Stanciu (Google-Tr)"), 5, 1)
|
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Marius Stanciu (Google-Tr)"), 5, 1)
|
||||||
|
@ -3605,6 +3608,7 @@ class App(QtCore.QObject):
|
||||||
# quit app by signalling for self.kill_app() method
|
# quit app by signalling for self.kill_app() method
|
||||||
# self.close_app_signal.emit()
|
# self.close_app_signal.emit()
|
||||||
QtWidgets.qApp.quit()
|
QtWidgets.qApp.quit()
|
||||||
|
# QtCore.QCoreApplication.exit()
|
||||||
|
|
||||||
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
|
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
|
||||||
# we use the following command
|
# we use the following command
|
||||||
|
|
72
camlib.py
72
camlib.py
|
@ -249,7 +249,7 @@ class ApertureMacro:
|
||||||
|
|
||||||
pol, dia, x, y = ApertureMacro.default2zero(4, mods)
|
pol, dia, x, y = ApertureMacro.default2zero(4, mods)
|
||||||
|
|
||||||
return {"pol": int(pol), "geometry": Point(x, y).buffer(dia/2)}
|
return {"pol": int(pol), "geometry": Point(x, y).buffer(dia / 2)}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def make_vectorline(mods):
|
def make_vectorline(mods):
|
||||||
|
@ -262,7 +262,7 @@ class ApertureMacro:
|
||||||
pol, width, xs, ys, xe, ye, angle = ApertureMacro.default2zero(7, mods)
|
pol, width, xs, ys, xe, ye, angle = ApertureMacro.default2zero(7, mods)
|
||||||
|
|
||||||
line = LineString([(xs, ys), (xe, ye)])
|
line = LineString([(xs, ys), (xe, ye)])
|
||||||
box = line.buffer(width/2, cap_style=2)
|
box = line.buffer(width / 2, cap_style=2)
|
||||||
box_rotated = affinity.rotate(box, angle, origin=(0, 0))
|
box_rotated = affinity.rotate(box, angle, origin=(0, 0))
|
||||||
|
|
||||||
return {"pol": int(pol), "geometry": box_rotated}
|
return {"pol": int(pol), "geometry": box_rotated}
|
||||||
|
@ -278,7 +278,7 @@ class ApertureMacro:
|
||||||
|
|
||||||
pol, width, height, x, y, angle = ApertureMacro.default2zero(6, mods)
|
pol, width, height, x, y, angle = ApertureMacro.default2zero(6, mods)
|
||||||
|
|
||||||
box = shply_box(x-width/2, y-height/2, x+width/2, y+height/2)
|
box = shply_box(x - width / 2, y - height / 2, x + width / 2, y + height / 2)
|
||||||
box_rotated = affinity.rotate(box, angle, origin=(0, 0))
|
box_rotated = affinity.rotate(box, angle, origin=(0, 0))
|
||||||
|
|
||||||
return {"pol": int(pol), "geometry": box_rotated}
|
return {"pol": int(pol), "geometry": box_rotated}
|
||||||
|
@ -294,7 +294,7 @@ class ApertureMacro:
|
||||||
|
|
||||||
pol, width, height, x, y, angle = ApertureMacro.default2zero(6, mods)
|
pol, width, height, x, y, angle = ApertureMacro.default2zero(6, mods)
|
||||||
|
|
||||||
box = shply_box(x, y, x+width, y+height)
|
box = shply_box(x, y, x + width, y + height)
|
||||||
box_rotated = affinity.rotate(box, angle, origin=(0, 0))
|
box_rotated = affinity.rotate(box, angle, origin=(0, 0))
|
||||||
|
|
||||||
return {"pol": int(pol), "geometry": box_rotated}
|
return {"pol": int(pol), "geometry": box_rotated}
|
||||||
|
@ -309,12 +309,12 @@ class ApertureMacro:
|
||||||
|
|
||||||
pol = mods[0]
|
pol = mods[0]
|
||||||
n = mods[1]
|
n = mods[1]
|
||||||
points = [(0, 0)]*(n+1)
|
points = [(0, 0)] * (n + 1)
|
||||||
|
|
||||||
for i in range(n+1):
|
for i in range(n + 1):
|
||||||
points[i] = mods[2*i + 2:2*i + 4]
|
points[i] = mods[2 * i + 2:2 * i + 4]
|
||||||
|
|
||||||
angle = mods[2*n + 4]
|
angle = mods[2 * n + 4]
|
||||||
|
|
||||||
poly = Polygon(points)
|
poly = Polygon(points)
|
||||||
poly_rotated = affinity.rotate(poly, angle, origin=(0, 0))
|
poly_rotated = affinity.rotate(poly, angle, origin=(0, 0))
|
||||||
|
@ -333,11 +333,11 @@ class ApertureMacro:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pol, nverts, x, y, dia, angle = ApertureMacro.default2zero(6, mods)
|
pol, nverts, x, y, dia, angle = ApertureMacro.default2zero(6, mods)
|
||||||
points = [(0, 0)]*nverts
|
points = [(0, 0)] * nverts
|
||||||
|
|
||||||
for i in range(nverts):
|
for i in range(nverts):
|
||||||
points[i] = (x + 0.5 * dia * np.cos(2*np.pi * i/nverts),
|
points[i] = (x + 0.5 * dia * np.cos(2 * np.pi * i / nverts),
|
||||||
y + 0.5 * dia * np.sin(2*np.pi * i/nverts))
|
y + 0.5 * dia * np.sin(2 * np.pi * i / nverts))
|
||||||
|
|
||||||
poly = Polygon(points)
|
poly = Polygon(points)
|
||||||
poly_rotated = affinity.rotate(poly, angle, origin=(0, 0))
|
poly_rotated = affinity.rotate(poly, angle, origin=(0, 0))
|
||||||
|
@ -358,9 +358,9 @@ class ApertureMacro:
|
||||||
|
|
||||||
x, y, dia, thickness, gap, nrings, cross_th, cross_len, angle = ApertureMacro.default2zero(9, mods)
|
x, y, dia, thickness, gap, nrings, cross_th, cross_len, angle = ApertureMacro.default2zero(9, mods)
|
||||||
|
|
||||||
r = dia/2 - thickness/2
|
r = dia / 2 - thickness / 2
|
||||||
result = Point((x, y)).buffer(r).exterior.buffer(thickness/2.0)
|
result = Point((x, y)).buffer(r).exterior.buffer(thickness / 2.0)
|
||||||
ring = Point((x, y)).buffer(r).exterior.buffer(thickness/2.0) # Need a copy!
|
ring = Point((x, y)).buffer(r).exterior.buffer(thickness / 2.0) # Need a copy!
|
||||||
|
|
||||||
i = 1 # Number of rings created so far
|
i = 1 # Number of rings created so far
|
||||||
|
|
||||||
|
@ -370,13 +370,13 @@ class ApertureMacro:
|
||||||
r -= thickness + gap
|
r -= thickness + gap
|
||||||
if r <= 0:
|
if r <= 0:
|
||||||
break
|
break
|
||||||
ring = Point((x, y)).buffer(r).exterior.buffer(thickness/2.0)
|
ring = Point((x, y)).buffer(r).exterior.buffer(thickness / 2.0)
|
||||||
result = cascaded_union([result, ring])
|
result = cascaded_union([result, ring])
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
# ## Crosshair
|
# ## Crosshair
|
||||||
hor = LineString([(x - cross_len, y), (x + cross_len, y)]).buffer(cross_th/2.0, cap_style=2)
|
hor = LineString([(x - cross_len, y), (x + cross_len, y)]).buffer(cross_th / 2.0, cap_style=2)
|
||||||
ver = LineString([(x, y-cross_len), (x, y + cross_len)]).buffer(cross_th/2.0, cap_style=2)
|
ver = LineString([(x, y - cross_len), (x, y + cross_len)]).buffer(cross_th / 2.0, cap_style=2)
|
||||||
result = cascaded_union([result, hor, ver])
|
result = cascaded_union([result, hor, ver])
|
||||||
|
|
||||||
return {"pol": 1, "geometry": result}
|
return {"pol": 1, "geometry": result}
|
||||||
|
@ -394,9 +394,9 @@ class ApertureMacro:
|
||||||
|
|
||||||
x, y, dout, din, t, angle = ApertureMacro.default2zero(6, mods)
|
x, y, dout, din, t, angle = ApertureMacro.default2zero(6, mods)
|
||||||
|
|
||||||
ring = Point((x, y)).buffer(dout/2.0).difference(Point((x, y)).buffer(din/2.0))
|
ring = Point((x, y)).buffer(dout / 2.0).difference(Point((x, y)).buffer(din / 2.0))
|
||||||
hline = LineString([(x - dout/2.0, y), (x + dout/2.0, y)]).buffer(t/2.0, cap_style=3)
|
hline = LineString([(x - dout / 2.0, y), (x + dout / 2.0, y)]).buffer(t / 2.0, cap_style=3)
|
||||||
vline = LineString([(x, y - dout/2.0), (x, y + dout/2.0)]).buffer(t/2.0, cap_style=3)
|
vline = LineString([(x, y - dout / 2.0), (x, y + dout / 2.0)]).buffer(t / 2.0, cap_style=3)
|
||||||
thermal = ring.difference(hline.union(vline))
|
thermal = ring.difference(hline.union(vline))
|
||||||
|
|
||||||
return {"pol": 1, "geometry": thermal}
|
return {"pol": 1, "geometry": thermal}
|
||||||
|
@ -922,8 +922,10 @@ class Geometry(object):
|
||||||
|
|
||||||
:param offset: Offset distance.
|
:param offset: Offset distance.
|
||||||
:type offset: float
|
:type offset: float
|
||||||
|
:param geometry The geometry to work with
|
||||||
:param iso_type: type of isolation, can be 0 = exteriors or 1 = interiors or 2 = both (complete)
|
:param iso_type: type of isolation, can be 0 = exteriors or 1 = interiors or 2 = both (complete)
|
||||||
:param corner: type of corner for the isolation: 0 = round; 1 = square; 2= beveled (line that connects the ends)
|
:param corner: type of corner for the isolation:
|
||||||
|
0 = round; 1 = square; 2= beveled (line that connects the ends)
|
||||||
:param follow: whether the geometry to be isolated is a follow_geometry
|
:param follow: whether the geometry to be isolated is a follow_geometry
|
||||||
:param passes: current pass out of possible multiple passes for which the isolation is done
|
:param passes: current pass out of possible multiple passes for which the isolation is done
|
||||||
:return: The buffered geometry.
|
:return: The buffered geometry.
|
||||||
|
@ -1886,6 +1888,7 @@ class Geometry(object):
|
||||||
# ## Index first and last points in paths
|
# ## Index first and last points in paths
|
||||||
def get_pts(o):
|
def get_pts(o):
|
||||||
return [o.coords[0], o.coords[-1]]
|
return [o.coords[0], o.coords[-1]]
|
||||||
|
|
||||||
#
|
#
|
||||||
# storage = FlatCAMRTreeStorage()
|
# storage = FlatCAMRTreeStorage()
|
||||||
# storage.get_points = get_pts
|
# storage.get_points = get_pts
|
||||||
|
@ -1982,7 +1985,7 @@ class Geometry(object):
|
||||||
the geometry appropriately. This call ``scale()``. Don't call
|
the geometry appropriately. This call ``scale()``. Don't call
|
||||||
it again in descendents.
|
it again in descendents.
|
||||||
|
|
||||||
:param units: "IN" or "MM"
|
:param obj_units: "IN" or "MM"
|
||||||
:type units: str
|
:type units: str
|
||||||
:return: Scaling factor resulting from unit change.
|
:return: Scaling factor resulting from unit change.
|
||||||
:rtype: float
|
:rtype: float
|
||||||
|
@ -2432,7 +2435,7 @@ class CNCjob(Geometry):
|
||||||
pp_geometry_name='default', pp_excellon_name='default',
|
pp_geometry_name='default', pp_excellon_name='default',
|
||||||
depthpercut=0.1, z_pdepth=-0.02,
|
depthpercut=0.1, z_pdepth=-0.02,
|
||||||
spindlespeed=None, spindledir='CW', dwell=True, dwelltime=1000,
|
spindlespeed=None, spindledir='CW', dwell=True, dwelltime=1000,
|
||||||
toolchangez=0.787402, toolchange_xy=[0.0, 0.0],
|
toolchangez=0.787402, toolchange_xy='0.0,0.0',
|
||||||
endz=2.0, endxy='',
|
endz=2.0, endxy='',
|
||||||
segx=None,
|
segx=None,
|
||||||
segy=None,
|
segy=None,
|
||||||
|
@ -2441,7 +2444,8 @@ class CNCjob(Geometry):
|
||||||
self.decimals = self.app.decimals
|
self.decimals = self.app.decimals
|
||||||
|
|
||||||
# Used when parsing G-code arcs
|
# Used when parsing G-code arcs
|
||||||
self.steps_per_circle = int(self.app.defaults['cncjob_steps_per_circle'])
|
self.steps_per_circle = steps_per_circle if steps_per_circle is not None else \
|
||||||
|
int(self.app.defaults['cncjob_steps_per_circle'])
|
||||||
|
|
||||||
Geometry.__init__(self, geo_steps_per_circle=self.steps_per_circle)
|
Geometry.__init__(self, geo_steps_per_circle=self.steps_per_circle)
|
||||||
|
|
||||||
|
@ -2667,6 +2671,7 @@ class CNCjob(Geometry):
|
||||||
if self.xy_toolchange == '':
|
if self.xy_toolchange == '':
|
||||||
self.xy_toolchange = None
|
self.xy_toolchange = None
|
||||||
else:
|
else:
|
||||||
|
self.xy_toolchange = re.sub('[()\[\]]', '', str(self.xy_toolchange))
|
||||||
self.xy_toolchange = [float(eval(a)) for a in self.xy_toolchange.split(",") if self.xy_toolchange != '']
|
self.xy_toolchange = [float(eval(a)) for a in self.xy_toolchange.split(",") if self.xy_toolchange != '']
|
||||||
if self.xy_toolchange and len(self.xy_toolchange) < 2:
|
if self.xy_toolchange and len(self.xy_toolchange) < 2:
|
||||||
self.app.inform.emit('[ERROR]%s' %
|
self.app.inform.emit('[ERROR]%s' %
|
||||||
|
@ -2677,6 +2682,7 @@ class CNCjob(Geometry):
|
||||||
log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> %s" % str(e))
|
log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> %s" % str(e))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
self.xy_end = re.sub('[()\[\]]', '', str(self.xy_end))
|
||||||
self.xy_end = [float(eval(a)) for a in self.xy_end.split(",") if self.xy_end != '']
|
self.xy_end = [float(eval(a)) for a in self.xy_end.split(",") if self.xy_end != '']
|
||||||
if self.xy_end and len(self.xy_end) < 2:
|
if self.xy_end and len(self.xy_end) < 2:
|
||||||
self.app.inform.emit('[ERROR] %s' % _("The End Move X,Y field in Edit -> Preferences has to be "
|
self.app.inform.emit('[ERROR] %s' % _("The End Move X,Y field in Edit -> Preferences has to be "
|
||||||
|
@ -3101,7 +3107,7 @@ class CNCjob(Geometry):
|
||||||
raise grace
|
raise grace
|
||||||
|
|
||||||
self.tool = tool
|
self.tool = tool
|
||||||
self.postdata['toolC']=exobj.tools[tool]["C"]
|
self.postdata['toolC'] = exobj.tools[tool]["C"]
|
||||||
self.tooldia = exobj.tools[tool]["C"]
|
self.tooldia = exobj.tools[tool]["C"]
|
||||||
|
|
||||||
if self.use_ui:
|
if self.use_ui:
|
||||||
|
@ -3577,7 +3583,8 @@ class CNCjob(Geometry):
|
||||||
self.startz = float(startz) if startz is not None else None
|
self.startz = float(startz) if startz is not None else None
|
||||||
self.z_end = float(endz) if endz is not None else None
|
self.z_end = float(endz) if endz is not None else None
|
||||||
|
|
||||||
self.xy_end = [float(eval(a)) for a in endxy.split(",") if endxy != '']
|
self.xy_end = re.sub('[()\[\]]', '', str(endxy))
|
||||||
|
self.xy_end = [float(eval(a)) for a in self.xy_end.split(",") if endxy != '']
|
||||||
if self.xy_end and len(self.xy_end) < 2:
|
if self.xy_end and len(self.xy_end) < 2:
|
||||||
self.app.inform.emit('[ERROR] %s' % _("The End Move X,Y field in Edit -> Preferences has to be "
|
self.app.inform.emit('[ERROR] %s' % _("The End Move X,Y field in Edit -> Preferences has to be "
|
||||||
"in the format (x, y) but now there is only one value, not two."))
|
"in the format (x, y) but now there is only one value, not two."))
|
||||||
|
@ -3595,7 +3602,8 @@ class CNCjob(Geometry):
|
||||||
if toolchangexy == '':
|
if toolchangexy == '':
|
||||||
self.xy_toolchange = None
|
self.xy_toolchange = None
|
||||||
else:
|
else:
|
||||||
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
|
self.xy_toolchange = re.sub('[()\[\]]', '', str(toolchangexy))
|
||||||
|
self.xy_toolchange = [float(eval(a)) for a in self.xy_toolchange.split(",")]
|
||||||
if len(self.xy_toolchange) < 2:
|
if len(self.xy_toolchange) < 2:
|
||||||
self.app.inform.emit('[ERROR] %s' % _("The Toolchange X,Y field in Edit -> Preferences has to be "
|
self.app.inform.emit('[ERROR] %s' % _("The Toolchange X,Y field in Edit -> Preferences has to be "
|
||||||
"in the format (x, y) \n"
|
"in the format (x, y) \n"
|
||||||
|
@ -3961,7 +3969,9 @@ class CNCjob(Geometry):
|
||||||
|
|
||||||
self.startz = float(startz) if startz is not None else self.app.defaults["geometry_startz"]
|
self.startz = float(startz) if startz is not None else self.app.defaults["geometry_startz"]
|
||||||
self.z_end = float(endz) if endz is not None else self.app.defaults["geometry_endz"]
|
self.z_end = float(endz) if endz is not None else self.app.defaults["geometry_endz"]
|
||||||
|
|
||||||
self.xy_end = endxy if endxy != '' else self.app.defaults["geometry_endxy"]
|
self.xy_end = endxy if endxy != '' else self.app.defaults["geometry_endxy"]
|
||||||
|
self.xy_end = re.sub('[()\[\]]', '', str(self.xy_end))
|
||||||
self.xy_end = [float(eval(a)) for a in self.xy_end.split(",") if self.xy_end != '']
|
self.xy_end = [float(eval(a)) for a in self.xy_end.split(",") if self.xy_end != '']
|
||||||
if self.xy_end and len(self.xy_end) < 2:
|
if self.xy_end and len(self.xy_end) < 2:
|
||||||
self.app.inform.emit('[ERROR] %s' % _("The End Move X,Y field in Edit -> Preferences has to be "
|
self.app.inform.emit('[ERROR] %s' % _("The End Move X,Y field in Edit -> Preferences has to be "
|
||||||
|
@ -3978,7 +3988,8 @@ class CNCjob(Geometry):
|
||||||
if toolchangexy == '':
|
if toolchangexy == '':
|
||||||
self.xy_toolchange = None
|
self.xy_toolchange = None
|
||||||
else:
|
else:
|
||||||
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
|
self.xy_toolchange = re.sub('[()\[\]]', '', str(toolchangexy))
|
||||||
|
self.xy_toolchange = [float(eval(a)) for a in self.xy_toolchange.split(",")]
|
||||||
if len(self.xy_toolchange) < 2:
|
if len(self.xy_toolchange) < 2:
|
||||||
self.app.inform.emit(
|
self.app.inform.emit(
|
||||||
'[ERROR] %s' %
|
'[ERROR] %s' %
|
||||||
|
@ -4636,7 +4647,7 @@ class CNCjob(Geometry):
|
||||||
kind = ['C', 'F']
|
kind = ['C', 'F']
|
||||||
geometry.append(
|
geometry.append(
|
||||||
{
|
{
|
||||||
"geom": Point(current_drill_point_coords).buffer(dia/2.0).exterior,
|
"geom": Point(current_drill_point_coords).buffer(dia / 2.0).exterior,
|
||||||
"kind": kind
|
"kind": kind
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -4670,7 +4681,7 @@ class CNCjob(Geometry):
|
||||||
arcdir = [None, None, "cw", "ccw"]
|
arcdir = [None, None, "cw", "ccw"]
|
||||||
if current['G'] in [2, 3]: # arc
|
if current['G'] in [2, 3]: # arc
|
||||||
center = [gobj['I'] + current['X'], gobj['J'] + current['Y']]
|
center = [gobj['I'] + current['X'], gobj['J'] + current['Y']]
|
||||||
radius = np.sqrt(gobj['I']**2 + gobj['J']**2)
|
radius = np.sqrt(gobj['I'] ** 2 + gobj['J'] ** 2)
|
||||||
start = np.arctan2(-gobj['J'], -gobj['I'])
|
start = np.arctan2(-gobj['J'], -gobj['I'])
|
||||||
stop = np.arctan2(-center[1] + y, -center[0] + x)
|
stop = np.arctan2(-center[1] + y, -center[0] + x)
|
||||||
path += arc(center, radius, start, stop, arcdir[current['G']], int(self.steps_per_circle))
|
path += arc(center, radius, start, stop, arcdir[current['G']], int(self.steps_per_circle))
|
||||||
|
@ -6578,7 +6589,6 @@ class FlatCAMRTreeStorage(FlatCAMRTree):
|
||||||
tidx = super(FlatCAMRTreeStorage, self).nearest(pt)
|
tidx = super(FlatCAMRTreeStorage, self).nearest(pt)
|
||||||
return (tidx.bbox[0], tidx.bbox[1]), self.objects[tidx.object]
|
return (tidx.bbox[0], tidx.bbox[1]), self.objects[tidx.object]
|
||||||
|
|
||||||
|
|
||||||
# class myO:
|
# class myO:
|
||||||
# def __init__(self, coords):
|
# def __init__(self, coords):
|
||||||
# self.coords = coords
|
# self.coords = coords
|
||||||
|
|
|
@ -767,7 +767,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||||
self.setCentralWidget(self.splitter)
|
self.setCentralWidget(self.splitter)
|
||||||
|
|
||||||
# self.notebook = QtWidgets.QTabWidget()
|
# self.notebook = QtWidgets.QTabWidget()
|
||||||
self.notebook = FCDetachableTab(protect=True)
|
self.notebook = FCDetachableTab(protect=True, parent=self)
|
||||||
self.notebook.setTabsClosable(False)
|
self.notebook.setTabsClosable(False)
|
||||||
self.notebook.useOldIndex(True)
|
self.notebook.useOldIndex(True)
|
||||||
|
|
||||||
|
@ -1174,7 +1174,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# ########################## PLOT AREA Tab # #############################
|
# ########################## PLOT AREA Tab # #############################
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
self.plot_tab_area = FCDetachableTab2(protect=False, protect_by_name=[_('Plot Area')])
|
self.plot_tab_area = FCDetachableTab2(protect=False, protect_by_name=[_('Plot Area')], parent=self)
|
||||||
self.plot_tab_area.useOldIndex(True)
|
self.plot_tab_area.useOldIndex(True)
|
||||||
|
|
||||||
self.right_lay.addWidget(self.plot_tab_area)
|
self.right_lay.addWidget(self.plot_tab_area)
|
||||||
|
@ -1372,7 +1372,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||||
self.sh_tab_layout.addLayout(self.sh_hlay)
|
self.sh_tab_layout.addLayout(self.sh_hlay)
|
||||||
|
|
||||||
self.app_sh_msg = (
|
self.app_sh_msg = (
|
||||||
'''<b>General Shortcut list</b><br>
|
'''<b>%s</b><br>
|
||||||
<table border="0" cellpadding="0" cellspacing="0" style="width:283px">
|
<table border="0" cellpadding="0" cellspacing="0" style="width:283px">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr height="20">
|
<tr height="20">
|
||||||
|
@ -1716,6 +1716,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||||
</table>
|
</table>
|
||||||
''' %
|
''' %
|
||||||
(
|
(
|
||||||
|
_("General Shortcut list"),
|
||||||
_("SHOW SHORTCUT LIST"), _("Switch to Project Tab"), _("Switch to Selected Tab"),
|
_("SHOW SHORTCUT LIST"), _("Switch to Project Tab"), _("Switch to Selected Tab"),
|
||||||
_("Switch to Tool Tab"),
|
_("Switch to Tool Tab"),
|
||||||
_("New Gerber"), _("Edit Object (if selected)"), _("Grid On/Off"), _("Jump to Coordinates"),
|
_("New Gerber"), _("Edit Object (if selected)"), _("Grid On/Off"), _("Jump to Coordinates"),
|
||||||
|
@ -2446,6 +2447,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||||
self.grid_snap_btn.triggered.connect(self.on_grid_snap_triggered)
|
self.grid_snap_btn.triggered.connect(self.on_grid_snap_triggered)
|
||||||
self.snap_infobar_label.clicked.connect(self.on_grid_icon_snap_clicked)
|
self.snap_infobar_label.clicked.connect(self.on_grid_icon_snap_clicked)
|
||||||
|
|
||||||
|
# to be used in the future
|
||||||
|
# self.plot_tab_area.tab_attached.connect(lambda x: print(x))
|
||||||
|
# self.plot_tab_area.tab_detached.connect(lambda x: print(x))
|
||||||
|
|
||||||
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
# %%%%%%%%%%%%%%%%% GUI Building FINISHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
# %%%%%%%%%%%%%%%%% GUI Building FINISHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -20,6 +20,7 @@ from copy import copy
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
import html
|
import html
|
||||||
|
import sys
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
|
@ -1431,7 +1432,8 @@ class FCComboBox(QtWidgets.QComboBox):
|
||||||
return str(self.currentText())
|
return str(self.currentText())
|
||||||
|
|
||||||
def set_value(self, val):
|
def set_value(self, val):
|
||||||
self.setCurrentIndex(self.findText(str(val)))
|
idx = self.findText(str(val))
|
||||||
|
self.setCurrentIndex(idx)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_last(self):
|
def is_last(self):
|
||||||
|
@ -1575,9 +1577,11 @@ class FCDetachableTab(QtWidgets.QTabWidget):
|
||||||
From here:
|
From here:
|
||||||
https://stackoverflow.com/questions/47267195/in-pyqt4-is-it-possible-to-detach-tabs-from-a-qtabwidget
|
https://stackoverflow.com/questions/47267195/in-pyqt4-is-it-possible-to-detach-tabs-from-a-qtabwidget
|
||||||
"""
|
"""
|
||||||
|
tab_detached = QtCore.pyqtSignal(str)
|
||||||
|
tab_attached = QtCore.pyqtSignal(str)
|
||||||
|
|
||||||
def __init__(self, protect=None, protect_by_name=None, parent=None):
|
def __init__(self, protect=None, protect_by_name=None, parent=None):
|
||||||
super().__init__()
|
super().__init__(parent=parent)
|
||||||
|
|
||||||
self.tabBar = self.FCTabBar(self)
|
self.tabBar = self.FCTabBar(self)
|
||||||
self.tabBar.onMoveTabSignal.connect(self.moveTab)
|
self.tabBar.onMoveTabSignal.connect(self.moveTab)
|
||||||
|
@ -1714,7 +1718,7 @@ class FCDetachableTab(QtWidgets.QTabWidget):
|
||||||
self.insertTab(toIndex, widget, icon, text)
|
self.insertTab(toIndex, widget, icon, text)
|
||||||
self.setCurrentIndex(toIndex)
|
self.setCurrentIndex(toIndex)
|
||||||
|
|
||||||
@pyqtSlot(int, QtCore.QPoint)
|
# @pyqtSlot(int, QtCore.QPoint)
|
||||||
def detachTab(self, index, point):
|
def detachTab(self, index, point):
|
||||||
"""
|
"""
|
||||||
Detach the tab by removing it's contents and placing them in
|
Detach the tab by removing it's contents and placing them in
|
||||||
|
@ -1751,6 +1755,8 @@ class FCDetachableTab(QtWidgets.QTabWidget):
|
||||||
# Create a reference to maintain access to the detached tab
|
# Create a reference to maintain access to the detached tab
|
||||||
self.detachedTabs[name] = detachedTab
|
self.detachedTabs[name] = detachedTab
|
||||||
|
|
||||||
|
self.tab_detached.emit(name)
|
||||||
|
|
||||||
def attachTab(self, contentWidget, name, icon, insertAt=None):
|
def attachTab(self, contentWidget, name, icon, insertAt=None):
|
||||||
"""
|
"""
|
||||||
Re-attach the tab by removing the content from the DetachedTab window,
|
Re-attach the tab by removing the content from the DetachedTab window,
|
||||||
|
@ -1763,11 +1769,11 @@ class FCDetachableTab(QtWidgets.QTabWidget):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
old_name = name
|
||||||
|
|
||||||
# Make the content widget a child of this widget
|
# Make the content widget a child of this widget
|
||||||
contentWidget.setParent(self)
|
contentWidget.setParent(self)
|
||||||
|
|
||||||
# Remove the reference
|
|
||||||
del self.detachedTabs[name]
|
|
||||||
# make sure that we strip the 'FlatCAM' part of the detached name otherwise the tab name will be too long
|
# make sure that we strip the 'FlatCAM' part of the detached name otherwise the tab name will be too long
|
||||||
name = name.partition(' ')[2]
|
name = name.partition(' ')[2]
|
||||||
|
|
||||||
|
@ -1807,6 +1813,9 @@ class FCDetachableTab(QtWidgets.QTabWidget):
|
||||||
else:
|
else:
|
||||||
index = self.insertTab(insert_index, contentWidget, icon, name)
|
index = self.insertTab(insert_index, contentWidget, icon, name)
|
||||||
|
|
||||||
|
obj_name = contentWidget.objectName()
|
||||||
|
self.tab_attached.emit(obj_name)
|
||||||
|
|
||||||
# on reattaching the tab if protect is true then the closure button is not added
|
# on reattaching the tab if protect is true then the closure button is not added
|
||||||
if self.protect_tab is True:
|
if self.protect_tab is True:
|
||||||
self.protectTab(index)
|
self.protectTab(index)
|
||||||
|
@ -1822,6 +1831,14 @@ class FCDetachableTab(QtWidgets.QTabWidget):
|
||||||
if index > -1:
|
if index > -1:
|
||||||
self.setCurrentIndex(insert_index) if self.use_old_index else self.setCurrentIndex(index)
|
self.setCurrentIndex(insert_index) if self.use_old_index else self.setCurrentIndex(index)
|
||||||
|
|
||||||
|
# Remove the reference
|
||||||
|
# Unix-like OS's crash with segmentation fault after this. FOr whatever reason, they loose reference
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
try:
|
||||||
|
del self.detachedTabs[old_name]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
def removeTabByName(self, name):
|
def removeTabByName(self, name):
|
||||||
"""
|
"""
|
||||||
Remove the tab with the given name, even if it is detached
|
Remove the tab with the given name, even if it is detached
|
||||||
|
|
|
@ -1115,6 +1115,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
||||||
else:
|
else:
|
||||||
geo_obj.solid_geometry.append(
|
geo_obj.solid_geometry.append(
|
||||||
Point(hole['point']).buffer(buffer_value).exterior)
|
Point(hole['point']).buffer(buffer_value).exterior)
|
||||||
|
|
||||||
if use_thread:
|
if use_thread:
|
||||||
def geo_thread(app_obj):
|
def geo_thread(app_obj):
|
||||||
app_obj.new_object("geometry", outname, geo_init, plot=plot)
|
app_obj.new_object("geometry", outname, geo_init, plot=plot)
|
||||||
|
|
Loading…
Reference in New Issue