Просмотр исходного кода

- solved issue #368 - when using the Enable/Disable prj context menu entries the plotted status is not updated in the object properties

Marius Stanciu 6 лет назад
Родитель
Сommit
b327c216d7
2 измененных файлов с 32 добавлено и 4 удалено
  1. 28 4
      FlatCAMApp.py
  2. 4 0
      README.md

+ 28 - 4
FlatCAMApp.py

@@ -12040,8 +12040,7 @@ class App(QtCore.QObject):
         log.debug("App.on_enable_sel_plot()")
         object_list = self.collection.get_selected()
         self.enable_plots(objects=object_list)
-        self.inform.emit('[success] %s' %
-                         _("Selected plots enabled..."))
+        self.inform.emit('[success] %s' % _("Selected plots enabled..."))
 
     def on_disable_sel_plots(self):
         log.debug("App.on_disable_sel_plot()")
@@ -12049,8 +12048,7 @@ class App(QtCore.QObject):
         # self.inform.emit(_("Disabling plots ..."))
         object_list = self.collection.get_selected()
         self.disable_plots(objects=object_list)
-        self.inform.emit('[success] %s' %
-                         _("Selected plots disabled..."))
+        self.inform.emit('[success] %s' % _("Selected plots disabled..."))
 
     def enable_plots(self, objects):
         """
@@ -12066,6 +12064,20 @@ class App(QtCore.QObject):
             if obj.options['plot'] is False:
                 obj.options.set_change_callback(lambda x: None)
                 obj.options['plot'] = True
+                try:
+                    # only the Gerber obj has on_plot_cb_click() method
+                    obj.ui.plot_cb.stateChanged.disconnect(obj.on_plot_cb_click)
+                    # disable this cb while disconnected,
+                    # in case the operation takes time the user is not allowed to change it
+                    obj.ui.plot_cb.setDisabled(True)
+                except AttributeError:
+                    pass
+                obj.set_form_item("plot")
+                try:
+                    obj.ui.plot_cb.stateChanged.connect(obj.on_plot_cb_click)
+                    obj.ui.plot_cb.setDisabled(False)
+                except AttributeError:
+                    pass
                 obj.options.set_change_callback(obj.on_options_change)
 
         def worker_task(objs):
@@ -12100,6 +12112,18 @@ class App(QtCore.QObject):
             if obj.options['plot'] is True:
                 obj.options.set_change_callback(lambda x: None)
                 obj.options['plot'] = False
+                try:
+                    # only the Gerber obj has on_plot_cb_click() method
+                    obj.ui.plot_cb.stateChanged.disconnect(obj.on_plot_cb_click)
+                    obj.ui.plot_cb.setDisabled(True)
+                except AttributeError:
+                    pass
+                obj.set_form_item("plot")
+                try:
+                    obj.ui.plot_cb.stateChanged.connect(obj.on_plot_cb_click)
+                    obj.ui.plot_cb.setDisabled(False)
+                except AttributeError:
+                    pass
                 obj.options.set_change_callback(obj.on_options_change)
 
         try:

+ 4 - 0
README.md

@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
 
 =================================================
 
+7.01.2019
+
+- solved issue #368 - when using the Enable/Disable prj context menu entries the plotted status is not updated in the object properties
+
 6.01.2019
 
 - working on new NCC Tool