mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 11:56:06 +08:00
#333 Fix for freecad for linux/macos os.
Also: - change tooltip - add sys import to lib directory - better layout - freecad icon
This commit is contained in:
parent
87236c23a2
commit
bf72c34598
256
resources/icons/freecad.svg
Normal file
256
resources/icons/freecad.svg
Normal file
@ -0,0 +1,256 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="64px"
|
||||
height="64px"
|
||||
id="svg3140"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="freecad.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
version="1.1"
|
||||
inkscape:export-filename="/home/alex/Documents/code/FreeCAD/src/Gui/Icons/freecad-icon-64.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<defs
|
||||
id="defs3142">
|
||||
<linearGradient
|
||||
id="linearGradient3864">
|
||||
<stop
|
||||
id="stop3866"
|
||||
offset="0"
|
||||
style="stop-color:#71b2f8;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop3868"
|
||||
offset="1"
|
||||
style="stop-color:#002795;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3682">
|
||||
<stop
|
||||
style="stop-color:#ff6d0f;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3684" />
|
||||
<stop
|
||||
style="stop-color:#ff1000;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3686" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
id="perspective3148" />
|
||||
<linearGradient
|
||||
id="linearGradient3864-9">
|
||||
<stop
|
||||
style="stop-color:#204a87;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop3866-1" />
|
||||
<stop
|
||||
style="stop-color:#729fcf;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop3868-1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3682-0">
|
||||
<stop
|
||||
id="stop3684-0"
|
||||
offset="0"
|
||||
style="stop-color:#a40000;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3686-0"
|
||||
offset="1"
|
||||
style="stop-color:#ef2929;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
id="perspective3148-5"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<radialGradient
|
||||
r="19.571428"
|
||||
fy="33.899986"
|
||||
fx="270.58316"
|
||||
cy="33.899986"
|
||||
cx="270.58316"
|
||||
gradientTransform="matrix(1.2361257,0.30001695,-0.83232803,3.3883821,-499.9452,-167.33108)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3817-5-3"
|
||||
xlink:href="#linearGradient3682-0-6"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
id="linearGradient3682-0-6">
|
||||
<stop
|
||||
id="stop3684-0-7"
|
||||
offset="0"
|
||||
style="stop-color:#ff390f;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3686-0-5"
|
||||
offset="1"
|
||||
style="stop-color:#ff1000;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3682-0"
|
||||
id="linearGradient3806"
|
||||
x1="-206.69949"
|
||||
y1="68.841812"
|
||||
x2="-211.40184"
|
||||
y2="7.7114096"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864-9"
|
||||
id="linearGradient3808"
|
||||
x1="-146.74467"
|
||||
y1="58.261547"
|
||||
x2="-157.32494"
|
||||
y2="26.520763"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0094494,0,0,1.0094493,-20.307973,3.7260081)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864-9-6"
|
||||
id="linearGradient3808-5"
|
||||
x1="-146.74467"
|
||||
y1="58.261547"
|
||||
x2="-157.32494"
|
||||
y2="26.520763"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0094494,0,0,1.0094493,-20.307973,3.7260081)" />
|
||||
<linearGradient
|
||||
id="linearGradient3864-9-6">
|
||||
<stop
|
||||
style="stop-color:#204a87;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop3866-1-2" />
|
||||
<stop
|
||||
style="stop-color:#729fcf;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop3868-1-9" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864-9-7"
|
||||
id="linearGradient3808-2"
|
||||
x1="-146.74467"
|
||||
y1="58.261547"
|
||||
x2="-157.32494"
|
||||
y2="26.520763"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0094494,0,0,1.0094493,-20.307973,3.7260081)" />
|
||||
<linearGradient
|
||||
id="linearGradient3864-9-7">
|
||||
<stop
|
||||
style="stop-color:#204a87;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop3866-1-0" />
|
||||
<stop
|
||||
style="stop-color:#729fcf;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop3868-1-93" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="3.8890873"
|
||||
inkscape:cx="79.509621"
|
||||
inkscape:cy="37.606687"
|
||||
inkscape:current-layer="g3813-3"
|
||||
showgrid="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:window-width="1600"
|
||||
inkscape:window-height="837"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-nodes="false"
|
||||
inkscape:snap-bbox="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3002"
|
||||
empspacing="2"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata3145">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
id="layer1-4"
|
||||
transform="translate(-6e-6,-0.36363683)">
|
||||
<g
|
||||
transform="matrix(0.8506406,0,0,0.8506406,187.82699,-0.1960013)"
|
||||
id="g3813-3">
|
||||
<path
|
||||
style="fill:url(#linearGradient3808);fill-opacity:1;fill-rule:evenodd;stroke:#000137;stroke-width:2.35116911;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
d="m -159.14682,27.762572 -7.26628,4.168914 -3.20873,-1.113515 -3.06139,-7.823962 -4.81574,0.253068 -2.19659,8.090466 -3.07424,1.472191 -7.66769,-3.354213 -3.23863,3.598875 4.16893,7.266276 -1.13925,3.199324 -7.82397,3.061399 0.27879,4.825129 8.09048,2.196583 1.47219,3.074238 -3.37993,7.658303 3.59887,3.238623 7.26627,-4.168916 3.22506,1.148635 3.03567,7.81457 4.85085,-0.269405 2.17086,-8.099855 3.07425,-1.472193 7.68401,3.389334 3.23863,-3.598876 -4.16892,-7.266274 1.1229,-3.234445 7.81458,-3.035677 -0.24366,-4.841457 -8.09987,-2.170857 -1.4722,-3.074238 3.36361,-7.693423 -3.59886,-3.238622 z m -10.88267,11.915801 1.49161,0.865459 1.29232,1.171703 1.03462,1.398312 0.74426,1.554681 0.43759,1.67593 0.0725,1.71754 -0.24807,1.717095 -0.56614,1.630089 -0.90058,1.507949 -1.13658,1.275982 -1.39832,1.034618 -1.55468,0.744257 -1.67593,0.43758 -1.72693,0.09823 -1.71711,-0.248055 -1.63008,-0.566152 -1.50794,-0.900579 -1.26661,-1.162311 -1.04399,-1.372584 -0.74428,-1.554679 -0.42818,-1.701656 -0.0982,-1.726934 0.24806,-1.717099 0.56616,-1.630085 0.89118,-1.482225 1.14599,-1.301706 1.3983,-1.034618 1.55468,-0.744261 1.70165,-0.428183 1.71754,-0.0725 1.7171,0.248053 1.63009,0.566153 z"
|
||||
id="path3659-5"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;stroke:#729fcf;stroke-width:2.35116910999999984;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
d="m -159.40722,30.604211 -6.78206,3.885229 -5.11355,-1.83873 -2.97765,-7.211069 -1.43915,0.07782 -2.07148,7.584439 -4.99186,2.2766 -7.06968,-3.072549 -0.94649,1.083504 3.90414,6.857637 -1.95648,5.010571 -7.1355,2.845405 0.0822,1.531739 7.52777,2.062954 2.33329,4.991861 -3.11471,7.061187 1.0457,0.908702 6.7065,-3.828556 5.39281,1.889398 2.65209,7.164787 1.44166,-0.01704 2.09636,-7.536257 4.8974,-2.446633 7.38672,3.161002 0.88982,-0.951258 -3.90413,-6.687603 1.6772,-5.250163 7.33482,-2.916596 -0.0504,-1.508727 -7.44181,-1.907432 -2.46554,-5.048537 3.11884,-7.22521 z"
|
||||
id="path3659-5-6"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccc" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:none;stroke:#729fcf;stroke-width:1.81196654;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:6"
|
||||
id="path3898"
|
||||
sodipodi:cx="41.15683"
|
||||
sodipodi:cy="40.103004"
|
||||
sodipodi:rx="8.6941996"
|
||||
sodipodi:ry="8.6941996"
|
||||
d="m 49.851029,40.103004 c 0,4.801674 -3.892525,8.6942 -8.694199,8.6942 -4.801674,0 -8.6942,-3.892526 -8.6942,-8.6942 0,-4.801673 3.892526,-8.694199 8.6942,-8.694199 4.801674,0 8.694199,3.892526 8.694199,8.694199 z"
|
||||
transform="matrix(1.2975787,0,0,1.2975787,-227.20403,-4.4100648)" />
|
||||
<path
|
||||
style="fill:url(#linearGradient3806);fill-opacity:1;fill-rule:evenodd;stroke:#280000;stroke-width:2.35116887;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
d="m -217.27976,4.1846558 1e-5,68.1839092 14.10701,-2e-6 0,-28.21403 14.10701,0 0,-14.107015 -14.10701,0 0,-11.755847 23.51169,0 0,-14.1070152 z"
|
||||
id="rect3663-8"
|
||||
sodipodi:nodetypes="ccccccccccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;stroke:#ef2929;stroke-width:2.35116887;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
d="m -214.92859,6.535825 0,63.481569 9.40468,0 0,-28.21403 14.10701,0 0,-9.404677 -14.10701,0 0,-16.458185 23.51169,0 0,-9.404677 z"
|
||||
id="rect3663-8-3"
|
||||
sodipodi:nodetypes="ccccccccccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 11 KiB |
@ -207,10 +207,6 @@ FreeCADDialog::FreeCADDialog(GUI_App* app, MainFrame* mainframe)
|
||||
//const wxFont& bold_font = wxGetApp().bold_font();
|
||||
SetFont(font);
|
||||
|
||||
wxIcon *freecad_icon = new wxIcon();
|
||||
freecad_icon->LoadFile( (boost::filesystem::path(Slic3r::resources_dir()) / "icons" / "Freecad.svg").generic_string());
|
||||
//sadly, this do nothing in dialog
|
||||
//this->SetIcon(freecad_icon);
|
||||
|
||||
main_sizer = new wxGridBagSizer(1,1); //(int vgap, int hgap)
|
||||
// | |_icon_|
|
||||
@ -221,6 +217,9 @@ FreeCADDialog::FreeCADDialog(GUI_App* app, MainFrame* mainframe)
|
||||
//main view
|
||||
createSTC();
|
||||
|
||||
wxStaticBitmap* logo = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap);
|
||||
logo->SetBitmap(create_scaled_bitmap("freecad", this, 64));
|
||||
|
||||
m_errors = new wxTextCtrl(this, wxID_ANY, "",
|
||||
wxDefaultPosition, wxSize(200, 100 * this->scale_factor()), wxHW_SCROLLBAR_AUTO | wxTE_MULTILINE);
|
||||
m_errors->SetEditable(false);
|
||||
@ -230,7 +229,8 @@ FreeCADDialog::FreeCADDialog(GUI_App* app, MainFrame* mainframe)
|
||||
m_help->SetEditable(false);
|
||||
|
||||
main_sizer->Add(m_text, wxGBPosition(1,1), wxGBSpan(2,1), wxEXPAND | wxALL, 2);
|
||||
main_sizer->Add(m_help, wxGBPosition(1, 2), wxGBSpan(3, 1), wxEXPAND | wxVERTICAL, 2);
|
||||
main_sizer->Add(logo, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALIGN_RIGHT, 2);
|
||||
main_sizer->Add(m_help, wxGBPosition(2, 2), wxGBSpan(2, 1), wxEXPAND | wxVERTICAL, 2);
|
||||
main_sizer->Add(m_errors, wxGBPosition(3, 1), wxGBSpan(1, 1), wxEXPAND | wxHORIZONTAL, 2);
|
||||
|
||||
this->main_sizer->AddGrowableCol(1);
|
||||
@ -252,19 +252,19 @@ FreeCADDialog::FreeCADDialog(GUI_App* app, MainFrame* mainframe)
|
||||
bt_quick_save->Hide();
|
||||
buttons->Add(bt_quick_save);
|
||||
|
||||
buttons->AddSpacer(30);
|
||||
buttons->AddStretchSpacer();
|
||||
wxButton* bt_create_geometry = new wxButton(this, wxID_APPLY, _(L("Generate")));
|
||||
bt_create_geometry->Bind(wxEVT_BUTTON, &FreeCADDialog::create_geometry, this);
|
||||
buttons->Add(bt_create_geometry);
|
||||
buttons->SetAffirmativeButton(bt_create_geometry);
|
||||
bt_create_geometry->SetDefault();
|
||||
bt_create_geometry->SetFocus();
|
||||
buttons->Realize();
|
||||
main_sizer->Add(buttons, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND, 5);
|
||||
|
||||
wxButton* close = new wxButton(this, wxID_CLOSE, _(L("Close")));
|
||||
close->Bind(wxEVT_BUTTON, &FreeCADDialog::close_me, this);
|
||||
buttons->AddButton(close);
|
||||
close->SetDefault();
|
||||
close->SetFocus();
|
||||
SetAffirmativeId(wxID_CLOSE);
|
||||
buttons->Realize();
|
||||
main_sizer->Add(buttons, wxGBPosition(4, 1), wxGBSpan(1, 2), wxEXPAND | wxALL, 5);
|
||||
main_sizer->Add(close, wxGBPosition(4, 2), wxGBSpan(1, 2), wxEXPAND | wxALIGN_RIGHT, 5);
|
||||
|
||||
SetSizer(main_sizer);
|
||||
main_sizer->SetSizeHints(this);
|
||||
@ -758,6 +758,7 @@ bool FreeCADDialog::init_start_python() {
|
||||
m_errors->AppendText("Error, cannot find the freecad (version 0.19 or higher) python at '" + pythonpath.string() + "', please update your freecad python path in the preferences.");
|
||||
return false;
|
||||
}
|
||||
boost::filesystem::path freecadpath = pythonpath.parent_path().parent_path();
|
||||
|
||||
const boost::filesystem::path scripts_path(boost::filesystem::path(Slic3r::data_dir()) / "scripts");
|
||||
boost::filesystem::create_directories(scripts_path / "FreePySCAD");
|
||||
@ -777,10 +778,14 @@ bool FreeCADDialog::init_start_python() {
|
||||
|
||||
exec_var->process.reset(new boost::process::child(pythonpath.string() + " -u -i", boost::process::std_in < exec_var->pyin,
|
||||
boost::process::std_out > exec_var->data_out, boost::process::std_err > exec_var->data_err, exec_var->ios));
|
||||
exec_var->pyin << "import sys" << std::endl;
|
||||
#ifndef __WINDOWS__
|
||||
// add freecad lib path if not already done
|
||||
exec_var->pyin << "sys.path.append('" << (freecadpath / "lib").string() << "')" << std::endl;
|
||||
#endif
|
||||
exec_var->pyin << "import FreeCAD" << std::endl;
|
||||
exec_var->pyin << "import Part" << std::endl;
|
||||
exec_var->pyin << "import Draft" << std::endl;
|
||||
exec_var->pyin << "import sys" << std::endl;
|
||||
exec_var->pyin << "sys.path.append('" << scripts_path.generic_string() << "')" << std::endl;
|
||||
//std::cout << "sys.path.append('" << pyscad_path.generic_string() << "')" << std::endl;
|
||||
exec_var->pyin << "from FreePySCAD.freepyscad import *" << std::endl;
|
||||
|
@ -114,7 +114,7 @@ void PreferencesDialog::build()
|
||||
};
|
||||
def.label = L("FreeCAD path");
|
||||
def.type = coString;
|
||||
def.tooltip = L("If it pont to a valid freecad instance, you can use the built-in script to generate quickly things in a scripted python.");
|
||||
def.tooltip = L("If it point to a valid freecad instance (the bin directory or the python executable), you can use the built-in python script to quickly generate geometry.");
|
||||
def.set_default_value(new ConfigOptionString{ app_config->get("freecad_path") });
|
||||
option = Option(def, "freecad_path");
|
||||
option.opt.full_width = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user