diff --git a/FlatCAMApp.py b/FlatCAMApp.py index c94da6ee..e2cf4d83 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -3171,6 +3171,8 @@ class App(QtCore.QObject): # select the just opened object but deselect the previous ones self.collection.set_all_inactive() self.collection.set_active(obj.options["name"]) + else: + self.collection.set_all_inactive() # here it is done the object plotting def worker_task(t_obj): @@ -4847,12 +4849,11 @@ class App(QtCore.QObject): # a geometry object before we update it. if self.geo_editor.editor_active is False and self.exc_editor.editor_active is False: if self.collection.get_active(): - self.log.debug("on_delete()") - self.report_usage("on_delete") + self.log.debug("App.on_delete()") while (self.collection.get_active()): obj_active = self.collection.get_active() - # if the deleted object is FlatCAMGerber then make sure to delete the possbile mark shapes + # if the deleted object is FlatCAMGerber then make sure to delete the possible mark shapes if isinstance(obj_active, FlatCAMGerber): for el in obj_active.mark_shapes: obj_active.mark_shapes[el].clear(update=True) @@ -4868,6 +4869,27 @@ class App(QtCore.QObject): else: self.inform.emit(_("Save the work in Editor and try again ...")) + def delete_first_selected(self): + # Keep this for later + try: + sel_obj = self.collection.get_active() + name = sel_obj.options["name"] + except AttributeError: + self.log.debug("Nothing selected for deletion") + return + + # Remove plot + # self.plotcanvas.figure.delaxes(self.collection.get_active().axes) + # self.plotcanvas.auto_adjust_axes() + + # Clear form + self.setup_component_editor() + + # Remove from dictionary + self.collection.delete_active() + + self.inform.emit("Object deleted: %s" % name) + def on_set_origin(self): """ Set the origin to the left mouse click position @@ -5485,26 +5507,6 @@ class App(QtCore.QObject): self.object_changed.emit(obj) self.inform.emit(_("[success] Skew on Y axis done.")) - def delete_first_selected(self): - # Keep this for later - try: - name = self.collection.get_active().options["name"] - except AttributeError: - self.log.debug("Nothing selected for deletion") - return - - # Remove plot - # self.plotcanvas.figure.delaxes(self.collection.get_active().axes) - # self.plotcanvas.auto_adjust_axes() - - # Clear form - self.setup_component_editor() - - # Remove from dictionary - self.collection.delete_active() - - self.inform.emit("Object deleted: %s" % name) - def on_plots_updated(self): """ Callback used to report when the plots have changed. diff --git a/FlatCAMObj.py b/FlatCAMObj.py index b4166058..0dbaba3d 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -183,7 +183,7 @@ class FlatCAMObj(QtCore.QObject): try: self.app.ui.selected_scroll_area.takeWidget() except Exception as e: - self.app.log.debug("Nothing to remove") + self.app.log.debug("FlatCAMObj.build_ui() --> Nothing to remove: %s" % str(e)) self.app.ui.selected_scroll_area.setWidget(self.ui) self.muted_ui = False diff --git a/README.md b/README.md index 60359f5e..27a9238a 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ CAD program, and create G-Code for Isolation routing. ================================================= +6.08.2019 + +- fixed bug that crashed the app after creating a new geometry, if a new object is loaded and the new geometry is deleted and then trying to select the just loaded new object +- made some GUI elements in Edit -> Preferences to have a minimum width as opposed to the previous fixed one + 5.08.2019 - made sure that if using an negative Gerber isolation diameter, the resulting Geometry object will use a tool with positive diameter diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 7e6bd5d8..b8a1c9e3 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -3148,13 +3148,13 @@ class GeneralPreferencesUI(QtWidgets.QWidget): self.setLayout(self.layout) self.general_app_group = GeneralAppPrefGroupUI() - self.general_app_group.setFixedWidth(290) + self.general_app_group.setMinimumWidth(290) self.general_gui_group = GeneralGUIPrefGroupUI() - self.general_gui_group.setFixedWidth(250) + self.general_gui_group.setMinimumWidth(250) self.general_gui_set_group = GeneralGUISetGroupUI() - self.general_gui_set_group.setFixedWidth(250) + self.general_gui_set_group.setMinimumWidth(250) self.layout.addWidget(self.general_app_group) self.layout.addWidget(self.general_gui_group) @@ -3171,15 +3171,15 @@ class GerberPreferencesUI(QtWidgets.QWidget): self.setLayout(self.layout) self.gerber_gen_group = GerberGenPrefGroupUI() - self.gerber_gen_group.setFixedWidth(250) + self.gerber_gen_group.setMinimumWidth(250) self.gerber_opt_group = GerberOptPrefGroupUI() - self.gerber_opt_group.setFixedWidth(250) + self.gerber_opt_group.setMinimumWidth(250) self.gerber_exp_group = GerberExpPrefGroupUI() - self.gerber_exp_group.setFixedWidth(230) + self.gerber_exp_group.setMinimumWidth(230) self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI() - self.gerber_adv_opt_group.setFixedWidth(200) + self.gerber_adv_opt_group.setMinimumWidth(200) self.gerber_editor_group = GerberEditorPrefGroupUI() - self.gerber_editor_group.setFixedWidth(200) + self.gerber_editor_group.setMinimumWidth(200) self.vlay = QtWidgets.QVBoxLayout() self.vlay.addWidget(self.gerber_opt_group) @@ -3201,15 +3201,15 @@ class ExcellonPreferencesUI(QtWidgets.QWidget): self.setLayout(self.layout) self.excellon_gen_group = ExcellonGenPrefGroupUI() - self.excellon_gen_group.setFixedWidth(220) + self.excellon_gen_group.setMinimumWidth(220) self.excellon_opt_group = ExcellonOptPrefGroupUI() - self.excellon_opt_group.setFixedWidth(290) + self.excellon_opt_group.setMinimumWidth(290) self.excellon_exp_group = ExcellonExpPrefGroupUI() - self.excellon_exp_group.setFixedWidth(250) + self.excellon_exp_group.setMinimumWidth(250) self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI() - self.excellon_adv_opt_group.setFixedWidth(250) + self.excellon_adv_opt_group.setMinimumWidth(250) self.excellon_editor_group = ExcellonEditorPrefGroupUI() - self.excellon_editor_group.setFixedWidth(260) + self.excellon_editor_group.setMinimumWidth(260) self.vlay = QtWidgets.QVBoxLayout() self.vlay.addWidget(self.excellon_opt_group) @@ -3231,13 +3231,13 @@ class GeometryPreferencesUI(QtWidgets.QWidget): self.setLayout(self.layout) self.geometry_gen_group = GeometryGenPrefGroupUI() - self.geometry_gen_group.setFixedWidth(220) + self.geometry_gen_group.setMinimumWidth(220) self.geometry_opt_group = GeometryOptPrefGroupUI() - self.geometry_opt_group.setFixedWidth(300) + self.geometry_opt_group.setMinimumWidth(300) self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI() - self.geometry_adv_opt_group.setFixedWidth(270) + self.geometry_adv_opt_group.setMinimumWidth(270) self.geometry_editor_group = GeometryEditorPrefGroupUI() - self.geometry_editor_group.setFixedWidth(250) + self.geometry_editor_group.setMinimumWidth(250) self.layout.addWidget(self.geometry_gen_group) self.layout.addWidget(self.geometry_opt_group) @@ -3313,11 +3313,11 @@ class CNCJobPreferencesUI(QtWidgets.QWidget): self.setLayout(self.layout) self.cncjob_gen_group = CNCJobGenPrefGroupUI() - self.cncjob_gen_group.setFixedWidth(320) + self.cncjob_gen_group.setMinimumWidth(320) self.cncjob_opt_group = CNCJobOptPrefGroupUI() - self.cncjob_opt_group.setFixedWidth(260) + self.cncjob_opt_group.setMinimumWidth(260) self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI() - self.cncjob_adv_opt_group.setFixedWidth(260) + self.cncjob_adv_opt_group.setMinimumWidth(260) self.layout.addWidget(self.cncjob_gen_group) self.layout.addWidget(self.cncjob_opt_group) diff --git a/flatcamGUI/GUIElements.py b/flatcamGUI/GUIElements.py index c99c4d11..f53a891c 100644 --- a/flatcamGUI/GUIElements.py +++ b/flatcamGUI/GUIElements.py @@ -830,6 +830,13 @@ class FCTab(QtWidgets.QTabWidget): self.tabBar().setTabButton(currentIndex, QtWidgets.QTabBar.RightSide, None) +# class FCTabBar(QtWidgets.QTabBar): +# def tabSizeHint(self, index): +# size =QtWidgets.QTabBar.tabSizeHint(self, index) +# w = int(self.width()/self.count()) +# return QtCore.QSize(w, size.height()) + + class FCDetachableTab(QtWidgets.QTabWidget): """ From here: