- fixed the PDF Tool when importing as Gerber objects
- moved all the parsing out of the PDF Tool to a new file ParsePDF in the flatcamParsers folder - trying to fix the pixmap load crash when running a FlatCAMScript
This commit is contained in:
parent
4cfecfa70a
commit
1085d26b7b
|
@ -7,6 +7,12 @@ CHANGELOG for FlatCAM beta
|
||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
18.05.2020
|
||||||
|
|
||||||
|
- fixed the PDF Tool when importing as Gerber objects
|
||||||
|
- moved all the parsing out of the PDF Tool to a new file ParsePDF in the flatcamParsers folder
|
||||||
|
- trying to fix the pixmap load crash when running a FlatCAMScript
|
||||||
|
|
||||||
17.05.2020
|
17.05.2020
|
||||||
|
|
||||||
- added new FlatCAM Tool: Corner Markers Tool which will add line markers in the selected corners of the bounding box of the targeted Gerber object
|
- added new FlatCAM Tool: Corner Markers Tool which will add line markers in the selected corners of the bounding box of the targeted Gerber object
|
||||||
|
|
|
@ -9810,15 +9810,17 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
App.log.debug(" **************** Finished PROJECT loading... **************** ")
|
App.log.debug(" **************** Finished PROJECT loading... **************** ")
|
||||||
|
|
||||||
def plot_all(self, fit_view=True, use_thread=True):
|
def plot_all(self, fit_view=True, muted=False, use_thread=True):
|
||||||
"""
|
"""
|
||||||
Re-generates all plots from all objects.
|
Re-generates all plots from all objects.
|
||||||
|
|
||||||
:param fit_view: if True will plot the objects and will adjust the zoom to fit all plotted objects into view
|
:param fit_view: if True will plot the objects and will adjust the zoom to fit all plotted objects into view
|
||||||
|
:param muted: if True don't print messages
|
||||||
:param use_thread: if True will use threading for plotting the objects
|
:param use_thread: if True will use threading for plotting the objects
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
self.log.debug("Plot_all()")
|
self.log.debug("Plot_all()")
|
||||||
|
if muted is not True:
|
||||||
self.inform.emit('[success] %s...' % _("Redrawing all objects"))
|
self.inform.emit('[success] %s...' % _("Redrawing all objects"))
|
||||||
|
|
||||||
for plot_obj in self.collection.get_list():
|
for plot_obj in self.collection.get_list():
|
||||||
|
|
|
@ -4300,6 +4300,8 @@ class FlatCAMInfoBar(QtWidgets.QWidget):
|
||||||
self.pmap = QtGui.QPixmap(self.app.resource_location + '/graylight12.png')
|
self.pmap = QtGui.QPixmap(self.app.resource_location + '/graylight12.png')
|
||||||
self.icon.setPixmap(self.pmap)
|
self.icon.setPixmap(self.pmap)
|
||||||
|
|
||||||
|
self.lock_pmaps = False
|
||||||
|
|
||||||
layout = QtWidgets.QHBoxLayout()
|
layout = QtWidgets.QHBoxLayout()
|
||||||
layout.setContentsMargins(5, 0, 5, 0)
|
layout.setContentsMargins(5, 0, 5, 0)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
@ -4311,7 +4313,6 @@ class FlatCAMInfoBar(QtWidgets.QWidget):
|
||||||
self.text.setToolTip(_("Hello!"))
|
self.text.setToolTip(_("Hello!"))
|
||||||
|
|
||||||
layout.addWidget(self.text)
|
layout.addWidget(self.text)
|
||||||
|
|
||||||
layout.addStretch()
|
layout.addStretch()
|
||||||
|
|
||||||
def set_text_(self, text, color=None):
|
def set_text_(self, text, color=None):
|
||||||
|
@ -4323,6 +4324,7 @@ class FlatCAMInfoBar(QtWidgets.QWidget):
|
||||||
def set_status(self, text, level="info"):
|
def set_status(self, text, level="info"):
|
||||||
level = str(level)
|
level = str(level)
|
||||||
|
|
||||||
|
if self.lock_pmaps is not True:
|
||||||
self.pmap.fill()
|
self.pmap.fill()
|
||||||
if level == "ERROR" or level == "ERROR_NOTCL":
|
if level == "ERROR" or level == "ERROR_NOTCL":
|
||||||
self.pmap = QtGui.QPixmap(self.app.resource_location + '/redlight12.png')
|
self.pmap = QtGui.QPixmap(self.app.resource_location + '/redlight12.png')
|
||||||
|
|
|
@ -183,7 +183,13 @@ class ScriptObject(FlatCAMObj):
|
||||||
if self.app.ui.shell_dock.isHidden():
|
if self.app.ui.shell_dock.isHidden():
|
||||||
self.app.ui.shell_dock.show()
|
self.app.ui.shell_dock.show()
|
||||||
|
|
||||||
self.script_code = deepcopy(self.script_editor_tab.code_editor.toPlainText())
|
self.app.shell.open_processing() # Disables input box.
|
||||||
|
|
||||||
|
# make sure that the pixmaps are not updated when running this as they will crash
|
||||||
|
# TODO find why the pixmaps load crash when run from this object (perhaps another thread?)
|
||||||
|
self.app.ui.fcinfo.lock_pmaps = True
|
||||||
|
|
||||||
|
self.script_code = self.script_editor_tab.code_editor.toPlainText()
|
||||||
|
|
||||||
old_line = ''
|
old_line = ''
|
||||||
for tcl_command_line in self.script_code.splitlines():
|
for tcl_command_line in self.script_code.splitlines():
|
||||||
|
@ -202,8 +208,6 @@ class ScriptObject(FlatCAMObj):
|
||||||
|
|
||||||
# execute the actual Tcl command
|
# execute the actual Tcl command
|
||||||
try:
|
try:
|
||||||
self.app.shell.open_processing() # Disables input box.
|
|
||||||
|
|
||||||
result = self.app.shell.tcl.eval(str(new_command))
|
result = self.app.shell.tcl.eval(str(new_command))
|
||||||
if result != 'None':
|
if result != 'None':
|
||||||
self.app.shell.append_output(result + '\n')
|
self.app.shell.append_output(result + '\n')
|
||||||
|
@ -220,6 +224,7 @@ class ScriptObject(FlatCAMObj):
|
||||||
log.error("Exec command Exception: %s\n" % result)
|
log.error("Exec command Exception: %s\n" % result)
|
||||||
self.app.shell.append_error('ERROR: %s\n '% result)
|
self.app.shell.append_error('ERROR: %s\n '% result)
|
||||||
|
|
||||||
|
self.app.ui.fcinfo.lock_pmaps = False
|
||||||
self.app.shell.close_processing()
|
self.app.shell.close_processing()
|
||||||
|
|
||||||
def on_autocomplete_changed(self, state):
|
def on_autocomplete_changed(self, state):
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -98,6 +98,6 @@ class TclCommandSetOrigin(TclCommand):
|
||||||
loc = [0, 0]
|
loc = [0, 0]
|
||||||
|
|
||||||
self.app.on_set_zero_click(event=None, location=loc, noplot=True, use_thread=False)
|
self.app.on_set_zero_click(event=None, location=loc, noplot=True, use_thread=False)
|
||||||
self.app.inform.emit('[success] Tcl %s: %s' %
|
msg = '[success] Tcl %s: %s' % (_('Origin set by offsetting all loaded objects with '),
|
||||||
(_('Origin set by offsetting all loaded objects with '),
|
'{0:.4f}, {0:.4f}'.format(loc[0], loc[1]))
|
||||||
'{0:.4f}, {0:.4f}'.format(loc[0], loc[1])))
|
self.app.shell_message(msg, success=True, show=False)
|
||||||
|
|
|
@ -75,19 +75,22 @@ class TclCommandSetPath(TclCommand):
|
||||||
if path_isdir is False:
|
if path_isdir is False:
|
||||||
path_isfile = os.path.isfile(path)
|
path_isfile = os.path.isfile(path)
|
||||||
if path_isfile:
|
if path_isfile:
|
||||||
self.app.inform.emit('[ERROR] %s: %s, %s' % (
|
msg = '[ERROR] %s: %s, %s' % (
|
||||||
"The provided path",
|
"The provided path",
|
||||||
str(path),
|
str(path),
|
||||||
"is a path to file and not a directory as expected."))
|
"is a path to file and not a directory as expected.")
|
||||||
|
self.app.shell_message(msg, success=True, show=False)
|
||||||
return "Failed. The Tcl command set_path was used but it was not a directory."
|
return "Failed. The Tcl command set_path was used but it was not a directory."
|
||||||
else:
|
else:
|
||||||
self.app.inform.emit('[ERROR] %s: %s, %s' % (
|
msg = '[ERROR] %s: %s, %s' % (
|
||||||
"The provided path",
|
"The provided path",
|
||||||
str(path),
|
str(path),
|
||||||
"do not exist. Check for typos."))
|
"do not exist. Check for typos.")
|
||||||
|
self.app.shell_message(msg, success=True, show=False)
|
||||||
return "Failed. The Tcl command set_path was used but it does not exist."
|
return "Failed. The Tcl command set_path was used but it does not exist."
|
||||||
|
|
||||||
cd_command = 'cd %s' % path
|
cd_command = 'cd %s' % path
|
||||||
self.app.shell.exec_command(cd_command, no_echo=False)
|
self.app.shell.exec_command(cd_command, no_echo=False)
|
||||||
self.app.defaults["global_tcl_path"] = str(path)
|
self.app.defaults["global_tcl_path"] = str(path)
|
||||||
self.app.inform.emit('[success] %s: %s' % ("Relative path set to", str(path)))
|
msg = '[success] %s: %s' % ("Relative path set to", str(path))
|
||||||
|
self.app.shell_message(msg, success=True, show=False)
|
||||||
|
|
Loading…
Reference in New Issue