Jelajahi Sumber

Merged marius_stanciu/flatcam_beta/Beta_8.994 into Beta

Marius Stanciu 5 tahun lalu
induk
melakukan
dc01605c04

+ 2 - 0
CHANGELOG.md

@@ -12,6 +12,8 @@ CHANGELOG for FlatCAM beta
 - added icons in most application Tools
 - added icons in most application Tools
 - updated Punch Gerber Tool such that the aperture table is updated upon clicking of the checboxes in Processed Pads Type
 - updated Punch Gerber Tool such that the aperture table is updated upon clicking of the checboxes in Processed Pads Type
 - updated Punch Gerber Tool: the Excellon method now takes into consideration the pads choice 
 - updated Punch Gerber Tool: the Excellon method now takes into consideration the pads choice 
+- minor change for the FCComboBox UI element by setting its size policy as ignored so it will not expand the notebook when the name of one of its items is very long
+- added a protection on opening the tools database UI if the tools DB file is not loaded
 
 
 28.10.2020
 28.10.2020
 
 

+ 3 - 0
appGUI/GUIElements.py

@@ -2111,6 +2111,9 @@ class FCComboBox(QtWidgets.QComboBox):
         self._set_last = False
         self._set_last = False
         self._obj_type = None
         self._obj_type = None
 
 
+        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Preferred)
+        self.setSizePolicy(sizePolicy)
+
         # the callback() will be called on customcontextmenu event and will be be passed 2 parameters:
         # the callback() will be called on customcontextmenu event and will be be passed 2 parameters:
         # pos = mouse right click click position
         # pos = mouse right click click position
         # self = is the combobox object itself
         # self = is the combobox object itself

+ 3 - 1
appObjects/FlatCAMGeometry.py

@@ -1100,7 +1100,9 @@ class GeometryObject(FlatCAMObj, Geometry):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 break
                 break
-        self.app.on_tools_database()
+        ret_val = self.app.on_tools_database()
+        if ret_val == 'fail':
+            return
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.add_tool_from_db.show()
         self.app.tools_db_tab.ui.add_tool_from_db.show()

+ 3 - 1
appTools/ToolCutOut.py

@@ -525,7 +525,9 @@ class CutOut(AppTool):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 break
                 break
-        self.app.on_tools_database(source='cutout')
+        ret_val = self.app.on_tools_database(source='cutout')
+        if ret_val == 'fail':
+            return
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.add_tool_from_db.show()
         self.app.tools_db_tab.ui.add_tool_from_db.show()

+ 3 - 1
appTools/ToolIsolation.py

@@ -2680,7 +2680,9 @@ class ToolIsolation(AppTool, Gerber):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 break
                 break
-        self.app.on_tools_database(source='iso')
+        ret_val = self.app.on_tools_database(source='iso')
+        if ret_val == 'fail':
+            return
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.add_tool_from_db.show()
         self.app.tools_db_tab.ui.add_tool_from_db.show()

+ 3 - 1
appTools/ToolNCC.py

@@ -3809,7 +3809,9 @@ class NonCopperClear(AppTool, Gerber):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 break
                 break
-        self.app.on_tools_database(source='ncc')
+        ret_val = self.app.on_tools_database(source='ncc')
+        if ret_val == 'fail':
+            return
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.add_tool_from_db.show()
         self.app.tools_db_tab.ui.add_tool_from_db.show()

+ 3 - 1
appTools/ToolPaint.py

@@ -2725,7 +2725,9 @@ class ToolPaint(AppTool, Gerber):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
             if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
                 break
                 break
-        self.app.on_tools_database(source='paint')
+        ret_val = self.app.on_tools_database(source='paint')
+        if ret_val == 'fail':
+            return
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ok_to_add = True
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.buttons_frame.hide()
         self.app.tools_db_tab.ui.add_tool_from_db.show()
         self.app.tools_db_tab.ui.add_tool_from_db.show()

+ 15 - 0
app_Main.py

@@ -5648,6 +5648,21 @@ class App(QtCore.QObject):
 
 
         :return:
         :return:
         """
         """
+        filename = self.data_path + '\\tools_db.FlatDB'
+
+        # load the database tools from the file
+        try:
+            with open(filename) as f:
+                __ = f.read()
+        except Exception as eros:
+            log.debug("The tools DB file is not loaded: %s" % str(eros))
+            log.error("Could not access tools DB file. The file may be locked,\n"
+                      "not existing or doesn't have the read permissions.\n"
+                      "Check to see if exists, it should be here: %s\n"
+                      "It may help to reboot the app, it will try to recreate it if it's missing." % self.data_path)
+            self.inform.emit('[ERROR] %s' % _("Could not load Tools DB file."))
+            return 'fail'
+
         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) == _("Tools Database"):
             if self.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
                 # there can be only one instance of Tools Database at one time
                 # there can be only one instance of Tools Database at one time