Surface: new SVG icon for the workbench, rename others

Replace the hard-coded XPM icon in `InitGui.py` for the workbench
with an SVG file, which at this time is identical to the `Surface` icon.
Change `CMakeLists.txt` to properly install this new icon.

Rename all icons, so that all have the `Surface_` prefix.

Use the new icon names in the viewproviders and task panels.
This commit is contained in:
vocx-fc
2020-09-27 22:56:48 -05:00
committed by Yorik van Havre
parent d5d5301144
commit 1d486dc669
12 changed files with 346 additions and 94 deletions

View File

@@ -76,11 +76,19 @@ SET(SurfaceGui_SRCS
# ViewProviderCut.h
)
SET(SurfaceGuiIcon_SVG
Resources/icons/Surface_Workbench.svg
)
link_directories(${OCC_LIBRARY_DIR})
add_library(SurfaceGui SHARED ${SurfaceGui_SRCS})
add_library(SurfaceGui SHARED ${SurfaceGui_SRCS} ${SurfaceGuiIcon_SVG})
target_link_libraries(SurfaceGui ${SurfaceGui_LIBS})
SET_BIN_DIR(SurfaceGui SurfaceGui /Mod/Surface)
SET_PYTHON_PREFIX_SUFFIX(SurfaceGui)
fc_copy_sources(SurfaceGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Surface" ${SurfaceGuiIcon_SVG})
install(TARGETS SurfaceGui DESTINATION ${CMAKE_INSTALL_LIBDIR})
INSTALL(FILES ${SurfaceGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/Surface/Resources/icons")

View File

@@ -169,7 +169,7 @@ CmdSurfaceGeomFillSurface::CmdSurfaceGeomFillSurface()
sToolTipText = QT_TR_NOOP("Creates a surface from two, three or four boundary edges");
sWhatsThis = "Surface_GeomFillSurface";
sStatusTip = sToolTipText;
sPixmap = "BSplineSurf";
sPixmap = "Surface_BSplineSurface";
}
bool CmdSurfaceGeomFillSurface::isActive(void)

View File

@@ -1,10 +1,13 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>icons/BezSurf.svg</file>
<file>icons/BSplineSurf.svg</file>
<RCC>
<qresource>
<file>icons/Surface_BezierSurface.svg</file>
<file>icons/Surface_BSplineSurface.svg</file>
<file>icons/Surface_Cut.svg</file>
<file>icons/Surface_Filling.svg</file>
<file>icons/Surface_Sections.svg</file>
<file>icons/Sewing.svg</file>
<file>icons/Surface_Sewing.svg</file>
<file>icons/Surface_Surface.svg</file>
<file>icons/Surface_Workbench.svg</file>
</qresource>
</RCC>
</RCC>

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@@ -0,0 +1,281 @@
<?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="svg3364"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Surface_Tools_Workbench_3.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1"
inkscape:export-filename="/home/user/Downloads/cad/mystuff/icons/surface_tools/more_stuff/Surface_Tools_Workbench_3_16px.png"
inkscape:export-xdpi="22.5"
inkscape:export-ydpi="22.5">
<defs
id="defs3366">
<linearGradient
id="linearGradient3814">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop3816" />
<stop
id="stop3818"
offset="0.27319029"
style="stop-color:#002795;stop-opacity:1;" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="0.62831503"
id="stop3822" />
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="1"
id="stop3820" />
</linearGradient>
<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>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="radialGradient2571"
gradientUnits="userSpaceOnUse"
cx="342.58258"
cy="27.256668"
fx="342.58258"
fy="27.256668"
r="19.571428"
gradientTransform="matrix(1.6258409,0.5434973,-8.8819886e-2,0.2656996,-215.02413,-170.90186)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3593"
id="radialGradient3352"
gradientUnits="userSpaceOnUse"
cx="345.28433"
cy="15.560534"
fx="345.28433"
fy="15.560534"
r="19.571428"
gradientTransform="translate(-0.1767767,-2.6516504)" />
<linearGradient
id="linearGradient3593">
<stop
style="stop-color:#c8e0f9;stop-opacity:1;"
offset="0"
id="stop3595" />
<stop
style="stop-color:#637dca;stop-opacity:1;"
offset="1"
id="stop3597" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3593"
id="radialGradient3354"
gradientUnits="userSpaceOnUse"
cx="330.63791"
cy="39.962704"
fx="330.63791"
fy="39.962704"
r="19.571428"
gradientTransform="translate(-0.1767767,-2.6516504)" />
<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="perspective3372" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="radialGradient3369"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.6258409,0.5434973,-8.8819886e-2,0.2656996,-461.81066,-173.06271)"
cx="342.58258"
cy="27.256668"
fx="342.58258"
fy="27.256668"
r="19.571428" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3593"
id="radialGradient3372"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0012324,0,0,0.9421773,-327.50313,-4.3316646)"
cx="345.28433"
cy="15.560534"
fx="345.28433"
fy="15.560534"
r="19.571428" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3593"
id="radialGradient3375"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0012324,0,0,0.9421773,-287.81791,-28.143054)"
cx="330.63791"
cy="39.962704"
fx="330.63791"
fy="39.962704"
r="19.571428" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="radialGradient3380"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9829174,1.3240854,-1.2330051,0.8105158,-131.04134,-483.74563)"
cx="320.44025"
cy="113.23357"
fx="320.44025"
fy="113.23357"
r="19.571428" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="linearGradient3914"
x1="6.94525"
y1="36.838673"
x2="48.691113"
y2="36.838673"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0012324,0,0,0.9421773,-4.8699606,-2.3863162)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="linearGradient3792"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0012324,0,0,0.9421773,-4.8699606,-2.3863162)"
x1="6.8300767"
y1="34.146042"
x2="48.691113"
y2="36.838673" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="radialGradient3812"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0012324,0,0,0.9421773,-287.81791,-28.143054)"
cx="330.63791"
cy="39.962704"
fx="330.63791"
fy="39.962704"
r="19.571428" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3593"
id="radialGradient3814"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0012324,0,0,0.9421773,-327.50313,-4.3316646)"
cx="345.28433"
cy="15.560534"
fx="345.28433"
fy="15.560534"
r="19.571428" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="radialGradient3816"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9829174,1.3240854,-1.2330051,0.8105158,-131.04134,-483.74563)"
cx="320.44025"
cy="113.23357"
fx="320.44025"
fy="113.23357"
r="19.571428" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3864-1"
id="linearGradient3828-2"
x1="20.383333"
y1="32.634235"
x2="52.726578"
y2="32.634235"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3864-1">
<stop
id="stop3866-6"
offset="0"
style="stop-color:#71b2f8;stop-opacity:1;" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="0.5"
id="stop3812" />
<stop
id="stop3868-7"
offset="1"
style="stop-color:#71b2f8;stop-opacity:1;" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.97382749,0,0,0.97679383,-16.999788,24.343455)"
y2="5.5175142"
x2="63.67384"
y1="18.997772"
x1="44.79789"
gradientUnits="userSpaceOnUse"
id="linearGradient3845"
xlink:href="#linearGradient3814"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="12.328125"
inkscape:cx="19.467681"
inkscape:cy="32"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1680"
inkscape:window-height="995"
inkscape:window-x="-2"
inkscape:window-y="-3"
inkscape:window-maximized="1" />
<metadata
id="metadata3369">
<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">
<path
style="fill:url(#linearGradient3845);fill-opacity:1;stroke:#0f118e;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 4.089465,27.453551 15.18275,25.838201 C 29.286194,26.73456 49.250839,57.680348 60.036108,30.763894 L 42.56161,10.156144 C 31.242931,28.661919 10.308791,9.0212675 4.089465,27.453551 z"
id="path3820-1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@@ -102,7 +102,7 @@ void ViewProviderFilling::unsetEdit(int ModNum)
QIcon ViewProviderFilling::getIcon(void) const
{
return Gui::BitmapFactory().pixmap("BSplineSurf");
return Gui::BitmapFactory().pixmap("Surface_Filling");
}
void ViewProviderFilling::highlightReferences(ShapeType type, const References& refs, bool on)
@@ -529,7 +529,7 @@ void FillingPanel::on_listBoundary_itemDoubleClicked(QListWidgetItem* item)
const TopTools_ListOfShape& adj_faces = edge2Face.FindFromKey(edge);
if (adj_faces.Extent() > 0) {
int n = adj_faces.Extent();
ui->statusLabel->setText(tr("Edge has %n adjacent face(s)", 0, n));
ui->statusLabel->setText(tr("Edge has %n adjacent faces", 0, n));
// fill up the combo boxes
modifyBoundary(true);
@@ -818,7 +818,7 @@ TaskFilling::TaskFilling(ViewProviderFilling* vp, Surface::Filling* obj)
// first task box
widget1 = new FillingPanel(vp, obj);
Gui::TaskView::TaskBox* taskbox1 = new Gui::TaskView::TaskBox(
Gui::BitmapFactory().pixmap("BezSurf"),
Gui::BitmapFactory().pixmap("Surface_Filling"),
widget1->windowTitle(), true, 0);
taskbox1->groupLayout()->addWidget(widget1);
Content.push_back(taskbox1);

View File

@@ -98,7 +98,7 @@ void ViewProviderGeomFillSurface::unsetEdit(int ModNum)
QIcon ViewProviderGeomFillSurface::getIcon(void) const
{
return Gui::BitmapFactory().pixmap("BSplineSurf");
return Gui::BitmapFactory().pixmap("Surface_BSplineSurface");
}
void ViewProviderGeomFillSurface::highlightReferences(bool on)
@@ -585,7 +585,7 @@ TaskGeomFillSurface::TaskGeomFillSurface(ViewProviderGeomFillSurface* vp, Surfac
widget = new GeomFillSurface(vp, obj);
widget->setWindowTitle(QObject::tr("Surface"));
taskbox = new Gui::TaskView::TaskBox(
Gui::BitmapFactory().pixmap("BezSurf"),
Gui::BitmapFactory().pixmap("Surface_BSplineSurface"),
widget->windowTitle(), true, 0);
taskbox->groupLayout()->addWidget(widget);
Content.push_back(taskbox);

View File

@@ -100,7 +100,7 @@ void ViewProviderSections::unsetEdit(int ModNum)
QIcon ViewProviderSections::getIcon(void) const
{
return Gui::BitmapFactory().pixmap("BSplineSurf");
return Gui::BitmapFactory().pixmap("Surface_Sections");
}
void ViewProviderSections::highlightReferences(ShapeType type, const References& refs, bool on)

View File

@@ -1,90 +1,50 @@
# Surface gui init module
# (c) 2001 Juergen Riegel LGPL
# -*- coding: utf8 -*-
# ***************************************************************************
# * Copyright (c) 2014 Nathan Miller <Nathan.A.Mill@gmail.com> *
# * Copyright (c) 2014 Balázs Bámer *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This library is free software; you can redistribute it and/or *
# * modify it under the terms of the GNU Library General Public *
# * License as published by the Free Software Foundation; either *
# * version 2 of the License, or (at your option) any later version. *
# * *
# * This library is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this library; see the file COPYING.LIB. If not, *
# * write to the Free Software Foundation, Inc., 59 Temple Place, *
# * Suite 330, Boston, MA 02111-1307, USA *
# * *
# ***************************************************************************
"""The Surface Workbench GUI initialization."""
class SurfaceWorkbench ( Workbench ):
"Surface workbench object"
Icon = """
/* XPM */
static char * Surface_Tools_Workbench_Main_xpm[] = {
"16 16 48 1",
" c None",
". c #171D96",
"+ c #1A229B",
"@ c #222CA1",
"# c #181D95",
"$ c #232DA2",
"% c #3344B3",
"& c #2A36A9",
"* c #181C96",
"= c #181B94",
"- c #161C96",
"; c #4961C8",
"> c #5776D5",
", c #192098",
"' c #171C96",
") c #394DB9",
"! c #5C7DDB",
"~ c #5B7BDA",
"{ c #465FC5",
"] c #384AB5",
"^ c #4D67CB",
"/ c #4D67CC",
"( c #171D97",
"_ c #3D51BC",
": c #181E96",
"< c #181E97",
"[ c #4961C7",
"} c #1B2099",
"| c #1F269E",
"1 c #506DCF",
"2 c #516ED0",
"3 c #171F96",
"4 c #4861C8",
"5 c #5A7BDA",
"6 c #2631A5",
"7 c #191E97",
"8 c #181F99",
"9 c #1B229A",
"0 c #445AC3",
"a c #597AD9",
"b c #1F279E",
"c c #2E3BAD",
"d c #181D97",
"e c #192097",
"f c #181D98",
"g c #181F97",
"h c #3C51BC",
"i c #10128F",
" ",
" ",
" .. ",
" +@ ",
" #$%&*= -;>, ",
" ')!!!~{]^!!/( ",
" '!!!!!!!!!!!_: ",
" <[!!!!!!!!!!!} ",
" |!!!!11!!!!23 ",
" :4!567890!ab ",
" |!c def ",
" gh( ",
" i ",
" ",
" ",
" "};
"""
import os
import FreeCAD as App
import FreeCADGui as Gui
class SurfaceWorkbench(Gui.Workbench):
"""Surface workbench object."""
Icon = os.path.join(App.getResourceDir(),
"Mod", "Surface",
"Resources", "icons", "Surface_Workbench.svg")
MenuText = "Surface"
ToolTip = "Surface workbench: Create and edit complex surfaces"
def Initialize(self):
# load the module
import SurfaceGui
import FreeCADGui
"""Initialize the module."""
import Surface
# Set path to icon labels
FreeCADGui.addIconPath('./Gui/Resources/Icons/')
import SurfaceGui
def GetClassName(self):
return "SurfaceGui::Workbench"
Gui.addWorkbench(SurfaceWorkbench())