瀏覽代碼

- when applying a new language if there are any changes in the current project, the app will offer to save the project before the reboot

Marius Stanciu 6 年之前
父節點
當前提交
3d54932713
共有 2 個文件被更改,包括 18 次插入0 次删除
  1. 17 0
      FlatCAMTranslation.py
  2. 1 0
      README.md

+ 17 - 0
FlatCAMTranslation.py

@@ -159,6 +159,23 @@ def restart_program(app):
     Note: this function does not return. Any cleanup action (like
     saving data) must be done before calling this function.
     """
+    if app.should_we_save and app.collection.get_list():
+        msgbox = QtWidgets.QMessageBox()
+        msgbox.setText(_("There are files/objects modified in FlatCAM. "
+                         "\n"
+                         "Do you want to Save the project?"))
+        msgbox.setWindowTitle(_("Save changes"))
+        msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
+        bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
+        bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
+
+        msgbox.setDefaultButton(bt_yes)
+        msgbox.exec_()
+        response = msgbox.clickedButton()
+
+        if response == bt_yes:
+            app.on_file_saveprojectas(thread=True, quit=True)
+
     app.save_defaults()
     python = sys.executable
     os.execl(python, python, *sys.argv)

+ 1 - 0
README.md

@@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
 
 - made sure that if using an negative Gerber isolation diameter, the resulting Geometry object will use a tool with positive diameter
 - fixed bug that when isolating a Gerber file made out of a single polygon, an Recurrsion Exception was issued together with inability to create tbe isolation
+- when applying a new language if there are any changes in the current project, the app will offer to save the project before the reboot
 
 3.08.2019