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

+ 14 - 6
FlatCAMApp.py

@@ -2668,6 +2668,9 @@ class App(QtCore.QObject):
         # set the value used in the Windows Title
         # set the value used in the Windows Title
         self.engine = self.ui.general_defaults_form.general_app_group.ge_radio.get_value()
         self.engine = self.ui.general_defaults_form.general_app_group.ge_radio.get_value()
 
 
+        # this holds a widget that is installed in the Plot Area when View Source option is used
+        self.source_editor_tab = None
+
         # ###############################################################################
         # ###############################################################################
         # ############# Save defaults to factory_defaults.FlatConfig file ###############
         # ############# Save defaults to factory_defaults.FlatConfig file ###############
         # ############# It's done only once after install                 ###############
         # ############# It's done only once after install                 ###############
@@ -9557,8 +9560,7 @@ class App(QtCore.QObject):
         self.ui.plot_tab_area.setCurrentWidget(self.text_editor_tab)
         self.ui.plot_tab_area.setCurrentWidget(self.text_editor_tab)
 
 
     def on_view_source(self):
     def on_view_source(self):
-        self.inform.emit('%s' %
-                         _("Viewing the source code of the selected object."))
+        self.inform.emit('%s' % _("Viewing the source code of the selected object."))
         self.proc_container.view.set_busy(_("Loading..."))
         self.proc_container.view.set_busy(_("Loading..."))
 
 
         try:
         try:
@@ -9569,14 +9571,13 @@ class App(QtCore.QObject):
                              _("Select an Gerber or Excellon file to view it's source file."))
                              _("Select an Gerber or Excellon file to view it's source file."))
             return 'fail'
             return 'fail'
 
 
+        flt = "All Files (*.*)"
         if obj.kind == 'gerber':
         if obj.kind == 'gerber':
             flt = "Gerber Files (*.GBR);;All Files (*.*)"
             flt = "Gerber Files (*.GBR);;All Files (*.*)"
         elif obj.kind == 'excellon':
         elif obj.kind == 'excellon':
             flt = "Excellon Files (*.DRL);;All Files (*.*)"
             flt = "Excellon Files (*.DRL);;All Files (*.*)"
         elif obj.kind == 'cncjob':
         elif obj.kind == 'cncjob':
             "GCode Files (*.NC);;All Files (*.*)"
             "GCode Files (*.NC);;All Files (*.*)"
-        else:
-            flt = "All Files (*.*)"
 
 
         self.source_editor_tab = TextEditor(app=self)
         self.source_editor_tab = TextEditor(app=self)
 
 
@@ -9598,9 +9599,16 @@ class App(QtCore.QObject):
         # Switch plot_area to CNCJob tab
         # Switch plot_area to CNCJob tab
         self.ui.plot_tab_area.setCurrentWidget(self.source_editor_tab)
         self.ui.plot_tab_area.setCurrentWidget(self.source_editor_tab)
 
 
-        self.source_editor_tab.buttonOpen.clicked.disconnect()
+        try:
+            self.source_editor_tab.buttonOpen.clicked.disconnect()
+        except TypeError:
+            pass
         self.source_editor_tab.buttonOpen.clicked.connect(lambda: self.source_editor_tab.handleOpen(filt=flt))
         self.source_editor_tab.buttonOpen.clicked.connect(lambda: self.source_editor_tab.handleOpen(filt=flt))
-        self.source_editor_tab.buttonSave.clicked.disconnect()
+
+        try:
+            self.source_editor_tab.buttonSave.clicked.disconnect()
+        except TypeError:
+            pass
         self.source_editor_tab.buttonSave.clicked.connect(lambda: self.source_editor_tab.handleSaveGCode(filt=flt))
         self.source_editor_tab.buttonSave.clicked.connect(lambda: self.source_editor_tab.handleSaveGCode(filt=flt))
 
 
         # then append the text from GCode to the text editor
         # then append the text from GCode to the text editor

+ 2 - 0
README.md

@@ -15,6 +15,8 @@ CAD program, and create G-Code for Isolation routing.
 - updated the About FlatCAM window
 - updated the About FlatCAM window
 - reverted change in tool dia being able to take only positive values in Gerber Object UI
 - reverted change in tool dia being able to take only positive values in Gerber Object UI
 - started to work to a new tool: Calibrate Excellon Tool
 - started to work to a new tool: Calibrate Excellon Tool
+- solved the issue #329
+
 
 
 18.10.2019
 18.10.2019