Turn StartPage "Import" quickstart button into "Open"

This commit is contained in:
qewer33
2023-08-31 22:04:50 +03:00
parent 3d251e4986
commit 4269c9f4a0
5 changed files with 12 additions and 10 deletions

View File

@@ -27,7 +27,7 @@ SET(StartPage_ImageResources
images/new_file_thumbnail.svg
images/icon_settings.png
images/new_empty_file.png
images/new_import_file.png
images/new_open_file.png
images/new_parametric_part.png
images/new_csg_part.png
images/new_2d_draft.png

View File

@@ -29,10 +29,12 @@ template_name = str(template)
if template_name == "empty_file":
FreeCADGui.runCommand('Std_New')
StartPage.postStart()
elif template_name == "import_file":
FreeCADGui.runCommand('Std_New')
StartPage.postStart()
FreeCADGui.runCommand("Std_Import")
elif template_name == "open_file":
previous_doc = FreeCADGui.ActiveDocument
FreeCADGui.runCommand("Std_Open")
# workaround to not run postStart() if user cancels the Open dialog
if FreeCADGui.ActiveDocument != previous_doc:
StartPage.postStart()
elif template_name == "parametric_part":
FreeCADGui.runCommand('Std_New')
FreeCADGui.activateWorkbench("PartDesignWorkbench")

View File

@@ -258,7 +258,7 @@ def build_new_file_card(template):
templates = {
"empty_file": [TranslationTexts.T_TEMPLATE_EMPTYFILE_NAME, TranslationTexts.T_TEMPLATE_EMPTYFILE_DESC],
"import_file": [TranslationTexts.T_TEMPLATE_IMPORTFILE_NAME, TranslationTexts.T_TEMPLATE_IMPORTFILE_DESC],
"open_file": [TranslationTexts.T_TEMPLATE_OPENFILE_NAME, TranslationTexts.T_TEMPLATE_OPENFILE_DESC],
"parametric_part": [TranslationTexts.T_TEMPLATE_PARAMETRICPART_NAME, TranslationTexts.T_TEMPLATE_PARAMETRICPART_DESC],
# "csg_part": [TranslationTexts.T_TEMPLATE_CSGPART_NAME, TranslationTexts.T_TEMPLATE_CSGPART_DESC],
"2d_draft": [TranslationTexts.T_TEMPLATE_2DDRAFT_NAME, TranslationTexts.T_TEMPLATE_2DDRAFT_DESC],
@@ -266,7 +266,7 @@ def build_new_file_card(template):
}
if template not in templates:
return
return ""
image = 'file:///'+os.path.join(os.path.join(FreeCAD.getResourceDir(), "Mod", "Start", "StartPage"), 'images/new_'+template+".png").replace('\\','/')
@@ -439,7 +439,7 @@ def handle():
SECTION_NEW_FILE = "<h2>"+TranslationTexts.T_NEWFILE+"</h2>"
SECTION_NEW_FILE += "<ul>"
SECTION_NEW_FILE += build_new_file_card("empty_file")
SECTION_NEW_FILE += build_new_file_card("import_file")
SECTION_NEW_FILE += build_new_file_card("open_file")
SECTION_NEW_FILE += build_new_file_card("parametric_part")
# SECTION_NEW_FILE += build_new_file_card("csg_part")
SECTION_NEW_FILE += build_new_file_card("2d_draft")

View File

@@ -44,8 +44,8 @@ T_BLOG_TOOLTIP = translate("StartPage", "Link to the FreeCAD blog")
T_NEWFILE = translate("StartPage", "New file")
T_TEMPLATE_EMPTYFILE_NAME = translate("StartPage", "Empty File")
T_TEMPLATE_EMPTYFILE_DESC = translate("StartPage", "Create an empty FreeCAD file")
T_TEMPLATE_IMPORTFILE_NAME = translate("StartPage", "Import File")
T_TEMPLATE_IMPORTFILE_DESC = translate("StartPage", "Work on an existing CAD file or 3D model")
T_TEMPLATE_OPENFILE_NAME = translate("StartPage", "Open File")
T_TEMPLATE_OPENFILE_DESC = translate("StartPage", "Open an existing CAD file or 3D model")
T_TEMPLATE_PARAMETRICPART_NAME = translate("StartPage", "Standard Part")
T_TEMPLATE_PARAMETRICPART_DESC = translate("StartPage", "Create a part with the Part Design workbench")
# T_TEMPLATE_CSGPART_NAME = translate("StartPage", "CSG Part")

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB