- added a message warning the user that the file is no longer available when it tries to open a file from the recent file, that was moved or deleted

This commit is contained in:
Marius Stanciu
2020-11-13 18:44:05 +02:00
parent 353eed4548
commit 09403a19ab
4 changed files with 32 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ CHANGELOG for FlatCAM beta
- Milling Tool - made sure that on target object change the UI is build again
- Geo Editor - Text sub-tool - fixed font size control not shown; fixes issue #470
- Geo Editor - fixed an issue with having a translatable text empty; updated the translation strings from sources
- added a message warning the user that the file is no longer available when it tries to open a file from the recent file, that was moved or deleted
12.11.2020

View File

@@ -10,6 +10,8 @@ from PyQt5 import QtGui, QtWidgets
from appTool import AppTool
from appGUI.GUIElements import RadioSet, FCComboBox, FCSpinner
import os
import gettext
import appTranslation as fcTranslate
import builtins
@@ -128,6 +130,9 @@ class ToolImage(AppTool):
"""
self.app.defaults.report_usage("import_image()")
if not os.path.exists(filename):
self.app.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
if mask is None:
mask = [250, 250, 250, 250]

View File

@@ -20,6 +20,7 @@ import re
import time
import logging
import traceback
import os
import gettext
import appTranslation as fcTranslate
@@ -106,6 +107,10 @@ class ToolPDF(AppTool):
'params': [filename]})
def open_pdf(self, filename):
if not os.path.exists(filename):
self.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
short_name = filename.split('/')[-1].split('\\')[-1]
self.parsing_promises.append(short_name)

View File

@@ -10099,6 +10099,9 @@ class MenuFileHandlers(QtCore.QObject):
:return:
"""
self.app.log.debug("App.import_svg()")
if not os.path.exists(filename):
self.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
obj_type = ""
if geo_type is None or geo_type == "geometry":
@@ -10149,6 +10152,9 @@ class MenuFileHandlers(QtCore.QObject):
:return:
"""
self.app.log.debug(" ********* Importing DXF as: %s ********* " % geo_type.capitalize())
if not os.path.exists(filename):
self.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
obj_type = ""
if geo_type is None or geo_type == "geometry":
@@ -10235,6 +10241,9 @@ class MenuFileHandlers(QtCore.QObject):
return "fail"
self.app.log.debug("open_gerber()")
if not os.path.exists(filename):
self.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
with self.app.proc_container.new(_("Opening ...")):
# Object name
@@ -10270,6 +10279,9 @@ class MenuFileHandlers(QtCore.QObject):
"""
self.app.log.debug("open_excellon()")
if not os.path.exists(filename):
self.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
# How the object should be initialized
def obj_init(excellon_obj, app_obj):
@@ -10332,6 +10344,9 @@ class MenuFileHandlers(QtCore.QObject):
:return: None
"""
self.app.log.debug("open_gcode()")
if not os.path.exists(filename):
self.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
# How the object should be initialized
def obj_init(job_obj, app_obj_):
@@ -10486,6 +10501,9 @@ class MenuFileHandlers(QtCore.QObject):
return "fail"
self.app.log.debug("open_script()")
if not os.path.exists(filename):
self.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
with self.app.proc_container.new(_("Opening ...")):
@@ -10570,6 +10588,9 @@ class MenuFileHandlers(QtCore.QObject):
:return: None
"""
self.app.log.debug("Opening project: " + filename)
if not os.path.exists(filename):
self.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
return
# block autosaving while a project is loaded
self.app.block_autosave = True