mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Merge branch 'master' into WIP_improve_initialization
This commit is contained in:
commit
8ad409ff55
74 changed files with 1810 additions and 778 deletions
|
@ -14,6 +14,8 @@ from UM.i18n import i18nCatalog
|
|||
from UM.Logger import Logger
|
||||
from UM.Qt.Duration import Duration
|
||||
from UM.Scene.SceneNode import SceneNode
|
||||
from UM.i18n import i18nCatalog
|
||||
from UM.MimeTypeDatabase import MimeTypeDatabase
|
||||
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
|
@ -321,7 +323,7 @@ class PrintInformation(QObject):
|
|||
|
||||
# when a file is opened using the terminal; the filename comes from _onFileLoaded and still contains its
|
||||
# extension. This cuts the extension off if necessary.
|
||||
name = os.path.splitext(name)[0]
|
||||
check_name = os.path.splitext(name)[0]
|
||||
filename_parts = os.path.basename(base_name).split(".")
|
||||
|
||||
# If it's a gcode, also always update the job name
|
||||
|
@ -332,21 +334,21 @@ class PrintInformation(QObject):
|
|||
|
||||
# if this is a profile file, always update the job name
|
||||
# name is "" when I first had some meshes and afterwards I deleted them so the naming should start again
|
||||
is_empty = name == ""
|
||||
if is_gcode or is_project_file or (is_empty or (self._base_name == "" and self._base_name != name)):
|
||||
is_empty = check_name == ""
|
||||
if is_gcode or is_project_file or (is_empty or (self._base_name == "" and self._base_name != check_name)):
|
||||
# Only take the file name part, Note : file name might have 'dot' in name as well
|
||||
if is_project_file:
|
||||
# This is for .curaproject
|
||||
self._base_name = ".".join(filename_parts)
|
||||
elif len(filename_parts) > 1:
|
||||
if "gcode" in filename_parts:
|
||||
gcode_index = filename_parts.index('gcode')
|
||||
self._base_name = ".".join(filename_parts[0:gcode_index])
|
||||
else:
|
||||
self._base_name = name
|
||||
else:
|
||||
self._base_name = name
|
||||
|
||||
data = ''
|
||||
try:
|
||||
mime_type = MimeTypeDatabase.getMimeTypeForFile(name)
|
||||
data = mime_type.stripExtension(name)
|
||||
except:
|
||||
Logger.log("w", "Unsupported Mime Type Database file extension")
|
||||
|
||||
if data is not None:
|
||||
self._base_name = data
|
||||
else:
|
||||
self._base_name = ''
|
||||
|
||||
self._updateJobName()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue