diff --git a/FlatCAMApp.py b/FlatCAMApp.py
index 254fec1e..94316ff3 100644
--- a/FlatCAMApp.py
+++ b/FlatCAMApp.py
@@ -1631,7 +1631,7 @@ class App(QtCore.QObject):
self.toggle_units_ignore = False
# #############################################################################
- # ########################## LOAD POSTPROCESSORS ##############################
+ # ########################## LOAD PREPROCESSORS ###############################
# #############################################################################
# a dictionary that have as keys the name of the preprocessor files and the value is the class from
@@ -2464,7 +2464,10 @@ class App(QtCore.QObject):
self.fiducial_tool = None
# always install tools only after the shell is initialized because the self.inform.emit() depends on shell
- self.install_tools()
+ try:
+ self.install_tools()
+ except AttributeError:
+ pass
# ##################################################################################
# ########################### SETUP RECENT ITEMS ###################################
@@ -2628,7 +2631,10 @@ class App(QtCore.QObject):
# Storage for shapes, storage that can be used by FlatCAm tools for utility geometry
# VisPy visuals
if self.is_legacy is False:
- self.tool_shapes = ShapeCollection(parent=self.plotcanvas.view.scene, layers=1)
+ try:
+ self.tool_shapes = ShapeCollection(parent=self.plotcanvas.view.scene, layers=1)
+ except AttributeError:
+ self.tool_shapes = None
else:
from flatcamGUI.PlotCanvasLegacy import ShapeCollectionLegacy
self.tool_shapes = ShapeCollectionLegacy(obj=self, app=self, name="tool")
@@ -2639,9 +2645,20 @@ class App(QtCore.QObject):
# watch out for the position of the editors instantiation ... if it is done before a save of the default values
# at the first launch of the App , the editors will not be functional.
- self.geo_editor = FlatCAMGeoEditor(self, disabled=True)
- self.exc_editor = FlatCAMExcEditor(self)
- self.grb_editor = FlatCAMGrbEditor(self)
+ try:
+ self.geo_editor = FlatCAMGeoEditor(self, disabled=True)
+ except AttributeError:
+ pass
+
+ try:
+ self.exc_editor = FlatCAMExcEditor(self)
+ except AttributeError:
+ pass
+
+ try:
+ self.grb_editor = FlatCAMGrbEditor(self)
+ except AttributeError:
+ pass
self.log.debug("Finished adding FlatCAM Editor's.")
self.set_ui_title(name=_("New Project - Not saved"))
@@ -3136,7 +3153,11 @@ class App(QtCore.QObject):
self.ui.menutoolshell.triggered.connect(self.on_toggle_shell)
# third install all of them
- self.install_tools()
+ try:
+ self.install_tools()
+ except AttributeError:
+ pass
+
self.log.debug("Tools are initialized.")
# def parse_system_fonts(self):
@@ -11607,6 +11628,11 @@ class App(QtCore.QObject):
}
+ try:
+ image_opener = self.image_tool.import_image
+ except AttributeError:
+ image_opener = None
+
openers = {
'gerber': lambda fname: self.worker_task.emit({'fcn': self.open_gerber, 'params': [fname]}),
'excellon': lambda fname: self.worker_task.emit({'fcn': self.open_excellon, 'params': [fname]}),
@@ -11617,7 +11643,7 @@ class App(QtCore.QObject):
'project': self.open_project,
'svg': self.import_svg,
'dxf': self.import_dxf,
- 'image': self.image_tool.import_image,
+ 'image': image_opener,
'pdf': lambda fname: self.worker_task.emit({'fcn': self.pdf_tool.open_pdf, 'params': [fname]})
}
@@ -11946,7 +11972,7 @@ class App(QtCore.QObject):
def on_plotcanvas_setup(self, container=None):
"""
- This is doing the setup for the plot area (VisPy canvas)
+ This is doing the setup for the plot area (canvas)
:param container: widget where to install the canvas
:return: None
@@ -11957,7 +11983,18 @@ class App(QtCore.QObject):
plot_container = self.ui.right_layout
if self.is_legacy is False:
- self.plotcanvas = PlotCanvas(plot_container, self)
+ try:
+ self.plotcanvas = PlotCanvas(plot_container, self)
+ except Exception as er:
+ msg_txt = traceback.format_exc()
+ log.debug("App.on_plotcanvas_setup() failed -> %s" % str(er))
+ log.debug("OpenGL canvas initialization failed with the following error.\n" + msg_txt)
+ msg = '[ERROR_NOTCL] %s' % _("An internal error has occurred. See shell.\n")
+ msg += _("OpenGL canvas initialization failed. HW or HW configuration not supported."
+ "Change the graphic engine to Legacy(2D) in Edit -> Preferences -> General tab.\n\n")
+ msg += msg_txt
+ self.inform.emit(msg)
+ return 'fail'
else:
self.plotcanvas = PlotCanvasLegacy(plot_container, self)
diff --git a/README.md b/README.md
index 9909fb6d..db7ea631 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,9 @@ CAD program, and create G-Code for Isolation routing.
8.01.2019
- working in NCC Tool
+- selected rows in the Tools Tables will stay colored in blue after loosing focus instead of the default gray
+- in NCC Tool the Tool name in the Parameters section will be the Tool ID in the Tool Table
+- added an exception catch in case the plotcanvas init failed for the OpenGL graphic engine and warn user about what happened
7.01.2019
diff --git a/flatcamGUI/GUIElements.py b/flatcamGUI/GUIElements.py
index b604a414..f52aced9 100644
--- a/flatcamGUI/GUIElements.py
+++ b/flatcamGUI/GUIElements.py
@@ -2006,6 +2006,11 @@ class FCTable(QtWidgets.QTableWidget):
def __init__(self, drag_drop=False, protected_rows=None, parent=None):
super(FCTable, self).__init__(parent)
+ palette = QtGui.QPalette()
+ palette.setColor(QtGui.QPalette.Inactive, QtGui.QPalette.Highlight,
+ palette.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight))
+ self.setPalette(palette)
+
if drag_drop:
self.setDragEnabled(True)
self.setAcceptDrops(True)
diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py
index 19732939..9a6e047e 100644
--- a/flatcamTools/ToolNonCopperClear.py
+++ b/flatcamTools/ToolNonCopperClear.py
@@ -6,6 +6,7 @@
# ##########################################################
from PyQt5 import QtWidgets, QtCore, QtGui
+
from FlatCAMTool import FlatCAMTool
from flatcamGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCInputDialog, FCButton
from flatcamParsers.ParseGerber import Gerber
@@ -697,7 +698,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
# update the QLabel that shows for which Tool we have the parameters in the UI form
self.tool_data_label.setText(
- "%s: %s %d" % (_('Parameters for'), _("Tool"), tooluid)
+ "%s: %s %d" % (_('Parameters for'), _("Tool"), (current_row + 1))
)
try:
@@ -765,8 +766,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
type_item = self.tools_table.cellWidget(row, 2).currentText()
operation_type_item = self.ui.geo_tools_table.cellWidget(row, 4).currentText()
- offset_item = self.ncc_choice_offset_cb.get_value()
- offset_value_item = float(self.ncc_offset_spinner.get_value())
+ nccoffset_item = self.ncc_choice_offset_cb.get_value()
+ nccoffset_value_item = float(self.ncc_offset_spinner.get_value())
# this new dict will hold the actual useful data, another dict that is the value of key 'data'
temp_tools = {}
@@ -775,16 +776,6 @@ class NonCopperClear(FlatCAMTool, Gerber):
for tooluid_key, tooluid_value in self.ncc_tools.items():
for key, value in tooluid_value.items():
- if key == 'tooldia':
- temp_dia[key] = tooldia_item
- # update the 'offset', 'type' and 'tool_type' sections
- if key == 'offset':
- temp_dia[key] = offset_item
- if key == 'type':
- temp_dia[key] = type_item
- if key == 'offset_value':
- temp_dia[key] = offset_value_item
-
if key == 'data':
# update the 'data' section
for data_key in tooluid_value[key].keys():
@@ -798,8 +789,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
temp_dia[key] = deepcopy(temp_data)
temp_data.clear()
- if key == 'solid_geometry':
+ elif key == 'solid_geometry':
temp_dia[key] = deepcopy(self.tools[tooluid_key]['solid_geometry'])
+ else:
+ temp_dia[key] = deepcopy(value)
temp_tools[tooluid_key] = deepcopy(temp_dia)
@@ -1382,7 +1375,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
tooluid_del = int(self.tools_table.item(row, 3).text())
deleted_tools_list.append(tooluid_del)
except TypeError:
- deleted_tools_list.append(rows_to_delete)
+ tooluid_del = int(self.tools_table.item(rows_to_delete, 3).text())
+ deleted_tools_list.append(tooluid_del)
for t in deleted_tools_list:
self.ncc_tools.pop(t, None)