Marius Stanciu 7 лет назад
Родитель
Сommit
d71958262a
3 измененных файлов с 27 добавлено и 4 удалено
  1. 13 1
      FlatCAMApp.py
  2. 13 3
      FlatCAMGUI.py
  3. 1 0
      README.md

+ 13 - 1
FlatCAMApp.py

@@ -18,6 +18,7 @@ import simplejson as json
 import re
 import os
 from stat import S_IREAD, S_IRGRP, S_IROTH
+import subprocess
 
 import tkinter as tk
 from PyQt5 import QtCore, QtGui, QtWidgets, QtPrintSupport
@@ -183,7 +184,7 @@ class App(QtCore.QObject):
             else:
                 App.log.debug("Win64!")
             self.data_path = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, None, 0) + \
-                '/FlatCAM'
+                '\FlatCAM'
             self.os = 'windows'
         else:  # Linux/Unix/MacOS
             self.data_path = os.path.expanduser('~') + \
@@ -1001,6 +1002,8 @@ class App(QtCore.QObject):
         self.ui.pref_save_button.clicked.connect(self.on_save_button)
         self.ui.pref_import_button.clicked.connect(self.on_import_preferences)
         self.ui.pref_export_button.clicked.connect(self.on_export_preferences)
+        self.ui.pref_open_button.clicked.connect(self.on_preferences_open_folder)
+
         self.general_options_form.general_group.units_radio.group_toggle_fn = self.on_toggle_units
         # Setting plot colors signals
         self.general_defaults_form.general_group.pf_color_entry.editingFinished.connect(self.on_pf_color_entry)
@@ -1855,6 +1858,15 @@ class App(QtCore.QObject):
                 return
         self.inform.emit("[success]Exported Defaults to %s" % filename)
 
+    def on_preferences_open_folder(self):
+        if sys.platform == 'win32':
+            subprocess.Popen('explorer %s' % self.data_path)
+        elif sys.platform == 'darwin':
+            os.system('open "%s"' % self.data_path)
+        else:
+            subprocess.Popen(['xdg-open', self.data_path])
+        self.inform.emit("[success]FlatCAM Preferences Folder opened.")
+
     def save_geometry(self, x, y, width, height, notebook_width):
         self.defaults["global_def_win_x"] = x
         self.defaults["global_def_win_y"] = y

+ 13 - 3
FlatCAMGUI.py

@@ -589,8 +589,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         self.pref_import_button.setFixedWidth(130)
         self.pref_import_button.setToolTip(
             "Import a full set of FlatCAM settings from a file\n"
-            "previously saved on HDD.\n"
-            "FlatCAM automatically save a 'default' file\n"
+            "previously saved on HDD.\n\n"
+            "FlatCAM automatically save a 'factory_defaults' file\n"
             "on the first start. Do not delete that file.")
         self.pref_tab_bottom_layout_1.addWidget(self.pref_import_button)
 
@@ -598,10 +598,17 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         self.pref_export_button.setText("Export Preferences")
         self.pref_export_button.setFixedWidth(130)
         self.pref_export_button.setToolTip(
-            "Export a full set of FlatCAM settings ib a file\n"
+            "Export a full set of FlatCAM settings in a file\n"
             "that is saved on HDD.")
         self.pref_tab_bottom_layout_1.addWidget(self.pref_export_button)
 
+        self.pref_open_button = QtWidgets.QPushButton()
+        self.pref_open_button.setText("Open Pref Folder")
+        self.pref_open_button.setFixedWidth(130)
+        self.pref_open_button.setToolTip(
+            "Open the folder where FlatCAM save the preferences files.")
+        self.pref_tab_bottom_layout_1.addWidget(self.pref_open_button)
+
         self.pref_tab_bottom_layout_2 = QtWidgets.QHBoxLayout()
         self.pref_tab_bottom_layout_2.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
         self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_2)
@@ -609,6 +616,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         self.pref_save_button = QtWidgets.QPushButton()
         self.pref_save_button.setText("Save Preferences")
         self.pref_save_button.setFixedWidth(130)
+        self.pref_save_button.setToolTip(
+            "Save the current settings in the 'current_defaults' file\n"
+            "which is the file storing the working default preferences.")
         self.pref_tab_bottom_layout_2.addWidget(self.pref_save_button)
 
         ########################################

+ 1 - 0
README.md

@@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
 - added a new postprocessor file named 'line_xyz' which have x, y, z values on the same GCode line
 - fixed calculation of total path for Excellon Gcode file
 - modified the way FlatCAM preferences are saved. Now they can be saved as new files with .FlatConfig extension by the user and shared.
+- added possibility to open the folder where FlatCAM is saving the preferences files
 
 21.01.2019