diff --git a/GIMPCommand.py b/AppCommand.py similarity index 71% rename from GIMPCommand.py rename to AppCommand.py index 0be18e3..a7ed421 100644 --- a/GIMPCommand.py +++ b/AppCommand.py @@ -1,18 +1,20 @@ +import os import FreeCAD import FreeCADGui as Gui import PySide from PySide import QtGui from PySide import QtCore +import ExternalAppsList import Embed -class GIMPCommand(): +class AppCommand(): def __init__(self, appName): self.appName = appName def GetResources(self): return { - 'Pixmap': ':/icons/GIMP.svg', + 'Pixmap': ExternalAppsList.apps[self.appName].Icon, 'Accel': "Shit+E", # E for Embed 'MenuText': "Start " + self.appName, 'ToolTip': "Start " + self.appName, @@ -26,6 +28,5 @@ class GIMPCommand(): # return false to grey out the command in the menus, toolbars etc. return True -Gui.addCommand('MousepadCommand', GIMPCommand('Mousepad')) -Gui.addCommand('InkscapeCommand', GIMPCommand('Inkscape')) -Gui.addCommand('GIMPCommand', GIMPCommand('GIMP')) +for appName in ExternalAppsList.apps: + Gui.addCommand('ExternalAppsOpen' + appName + 'Command', AppCommand(appName)) diff --git a/ExternalAppsList.py b/ExternalAppsList.py index 3eb35d5..bd05c73 100644 --- a/ExternalAppsList.py +++ b/ExternalAppsList.py @@ -1,3 +1,4 @@ +import os import FreeCAD import FreeCADGui as Gui import subprocess @@ -11,6 +12,7 @@ from MyX11Utils import * class App(): def __init__(self, name, *, start_command_and_args, xwininfo_filter_re, extra_xprop_filter): self.name = name + self.Icon = os.path.dirname(__file__) + '/icons/' + self.name + '.svg' self.start_command_and_args = start_command_and_args self.xwininfo_filter_re = re.compile(xwininfo_filter_re) self.extra_xprop_filter = extra_xprop_filter diff --git a/InitGui.py b/InitGui.py index d2e36e0..303bab3 100644 --- a/InitGui.py +++ b/InitGui.py @@ -43,23 +43,19 @@ class XternalAppsWorkbench(Workbench): """Subclasses must implement the appName attribute""" global myIcon global XternalAppsWorkbench - - Icon = myIcon + global ExternalAppsList def __init__(self): self.MenuText = "XternalApps: " + self.appName self.ToolTip = "Embeds " + self.appName + " in FreeCAD" + self.Icon = ExternalAppsList.apps[self.appName].Icon super(XternalAppsWorkbench, self).__init__() def Initialize(self): - if sys.version_info[0] == 2: - import Resources2 - else: - import Resources3 - import GIMPCommand + import AppCommand import Embed Embed.ExternalApps() - self.list = [self.appName + 'Command'] + self.list = ['ExternalAppsOpen' + self.appName + 'Command'] self.appendMenu("ExternalApplications", self.list) self.appendToolbar("ExternalApplications", self.list) @@ -81,5 +77,5 @@ def addAppWorkbench(appName): (XternalAppsWorkbench,), { 'appName': appName }) Gui.addWorkbench(workbenchClass()) -for app in ExternalAppsList.apps: - addAppWorkbench(app) +for appName in ExternalAppsList.apps: + addAppWorkbench(appName) diff --git a/LICENSE b/LICENSE index a6f206a..5029a7f 100644 --- a/LICENSE +++ b/LICENSE @@ -1 +1,5 @@ -The contents of this repository are released under the CC0, with the exception of the GIMP logo which comes from the GIMP project and is therefore under the GPL license. +The contents of this repository are released under the CC0, +with the exception of: +* the GIMP logo which comes from the GIMP project and is therefore under the GPL v3 license. +* the Inkscape logo which comes from the Inkscape project and is therefore under the GPL v2 license. +* the Mousepad logo which comes from the Mousepad project and is therefore under the GPL v2 license. diff --git a/Resources2.py b/Resources2.py deleted file mode 100644 index 8af6c01..0000000 --- a/Resources2.py +++ /dev/null @@ -1,1406 +0,0 @@ -# -*- coding: utf-8 -*- - -# Resource object code -# -# Created: Thu Jan 21 01:44:33 2021 -# by: The Resource Compiler for PySide2 (Qt v5.11.3) -# -# WARNING! All changes made in this file will be lost! - -from PySide2 import QtCore - -qt_resource_data = b"\ -\x00\x00U\x5c\ -<\ -?xml version=\x221.\ -0\x22 encoding=\x22UTF\ --8\x22 standalone=\x22\ -no\x22?>\x0a\x0a\ -\x0a \x0a \ -\x0a\ - \x0a \ - \x0a \x0a\ - \x0a \x0a \ - \x0a \x0a\ - \x0a \x0a \ - \x0a \x0a\ - \x0a \x0a \ - \x0a \x0a\ - \x0a \x0a \ - \x0a \x0a \x0a \x0a \ - \ -\x0a \x0a \ - \x0a \x0a \ -\x0a \x0a \x0a\ - \x0a \ -\x0a \x0a \x0a \ - \x0a \x0a\ - \x0a \x0a <\ -stop\x0a st\ -yle=\x22stop-color:\ -#857c63;stop-opa\ -city:1\x22\x0a \ - offset=\x220\x22\x0a \ - id=\x22stop650\ -2\x22 />\x0a \x0a \x0a \x0a \ - \x0a \x0a \x0a \x0a \ - \x0a \x0a \x0a \x0a \ - \x0a \x0a \x0a <\ -linearGradient\x0a \ - id=\x22linear\ -Gradient6452\x22>\x0a \ - \x0a \ -\x0a \x0a <\ -linearGradient\x0a \ - x1=\x226.3051\ -529\x22\x0a y1=\x22\ -23.362427\x22\x0a \ - x2=\x225.9846287\x22\ -\x0a y2=\x2231.5\ -7\x22\x0a id=\x22li\ -nearGradient6458\ -\x22\x0a xlink:h\ -ref=\x22#linearGrad\ -ient6452\x22\x0a \ - gradientUnits=\x22\ -userSpaceOnUse\x22 \ -/>\x0a \x0a \x0a \ - \x0a \x0a \x0a \x0a \x0a \x0a <\ -/defs>\x0a \x0a \ - \x0a \x0a \ - \x0a <\ -path\x0a d=\x22M\ - 36.96875,11.843\ -75 C 36.406772,1\ -2.770645 35.5622\ -58,13.876916 34.\ -28125,14.9375 C \ -31.649332,17.116\ -542 27.230687,19\ -.099847 20,19.28\ -125 C 15.775627,\ -19.386299 13.047\ -259,17.347101 11\ -.375,15.53125 L \ -11.25,20 C 11.38\ -6107,20.418802 1\ -1.665455,21.3904\ -98 11.1875,22.71\ -875 C 10.673186,\ -24.148046 9.0329\ -86,25.610113 6.2\ -1875,26.71875 C \ -6.4690804,27.240\ -783 6.7142345,27\ -.76237 7.46875,2\ -8.5 C 8.4967003,\ -29.504945 9.9257\ -833,30.588049 11\ -.625,31.5625 C 1\ -5.023433,33.5114\ -02 19.426583,35.\ -055712 23.53125,\ -35.125 C 27.6359\ -17,35.194288 31.\ -388376,33.89045 \ -33.96875,30.125 \ -C 36.347494,26.6\ -53782 37.651223,\ -20.777057 36.968\ -75,11.84375 z \x22\x0a\ - style=\x22op\ -acity:0.18539327\ -;color:black;fil\ -l:none;fill-opac\ -ity:1;fill-rule:\ -evenodd;stroke:u\ -rl(#linearGradie\ -nt8530);stroke-w\ -idth:0.9999997;s\ -troke-linecap:bu\ -tt;stroke-linejo\ -in:miter;marker:\ -none;marker-star\ -t:none;marker-mi\ -d:none;marker-en\ -d:none;stroke-mi\ -terlimit:10;stro\ -ke-dasharray:non\ -e;stroke-dashoff\ -set:0;stroke-opa\ -city:1;visibilit\ -y:visible;displa\ -y:inline;overflo\ -w:visible\x22\x0a \ - id=\x22path8520\x22 \ -/>\x0a \x0a <\ -path\x0a d=\x22M\ - 10.429825 27.22\ -8739 A 4.3310289\ - 6.0987959 0 1 1\ - 1.767767,27.22\ -8739 A 4.3310289\ - 6.0987959 0 1 1\ - 10.429825 27.2\ -28739 z\x22\x0a \ -transform=\x22matri\ -x(0.810984,-0.58\ -5069,0.585069,0.\ -810984,-14.77791\ -,6.947121)\x22\x0a \ - style=\x22color:\ -black;fill:url(#\ -radialGradient85\ -48);fill-opacity\ -:1;fill-rule:eve\ -nodd;stroke:blac\ -k;stroke-width:0\ -.9999997;stroke-\ -linecap:butt;str\ -oke-linejoin:mit\ -er;marker:none;m\ -arker-start:none\ -;marker-mid:none\ -;marker-end:none\ -;stroke-miterlim\ -it:10;stroke-das\ -harray:none;stro\ -ke-dashoffset:0;\ -stroke-opacity:1\ -;visibility:visi\ -ble;display:inli\ -ne;overflow:visi\ -ble\x22\x0a id=\x22\ -path5198\x22 />\x0a \ - \ -\x0a \x0a \x0a <\ -path\x0a d=\x22M\ - 23.157747 20.95\ -3165 A 1.767767 \ -1.767767 0 1 1 \ -19.622213,20.953\ -165 A 1.767767 1\ -.767767 0 1 1 2\ -3.157747 20.9531\ -65 z\x22\x0a tra\ -nsform=\x22matrix(0\ -.766666,0,0,0.76\ -6666,-2.556414,5\ -.029841)\x22\x0a \ - style=\x22color:bl\ -ack;fill:white;f\ -ill-opacity:1;fi\ -ll-rule:evenodd;\ -stroke:none;stro\ -ke-width:0.99999\ -97;stroke-lineca\ -p:butt;stroke-li\ -nejoin:miter;mar\ -ker:none;marker-\ -start:none;marke\ -r-mid:none;marke\ -r-end:none;strok\ -e-miterlimit:10;\ -stroke-dasharray\ -:none;stroke-das\ -hoffset:0;stroke\ --opacity:1;visib\ -ility:visible;di\ -splay:inline;ove\ -rflow:visible\x22\x0a \ - id=\x22path43\ -61\x22 />\x0a \x0a \x0a \x0a \x0a \x0a \x0a \x0a \ -\x0a \x0a \x0a \ - \x0a \x0a <\ -path\x0a d=\x22M\ - 23.003067,31.73\ -6544 C 24.500439\ -,31.879636 25.85\ -2696,31.464331 2\ -6.41496,31.26249\ -7 C 26.513185,30\ -.707111 26.95151\ -2,29.64124 28.46\ -1048,29.571029 L\ - 27.930718,28.64\ -2952 C 27.930718\ -,28.642952 25.96\ -4077,29.990873 2\ -3.864854,30.3886\ -21 L 23.003067,3\ -1.736544 z \x22\x0a \ - style=\x22color\ -:black;fill:url(\ -#linearGradient4\ -330);fill-opacit\ -y:1;fill-rule:ev\ -enodd;stroke:non\ -e;stroke-width:0\ -.9999997;stroke-\ -linecap:butt;str\ -oke-linejoin:mit\ -er;marker:none;m\ -arker-start:none\ -;marker-mid:none\ -;marker-end:none\ -;stroke-miterlim\ -it:10;stroke-das\ -harray:none;stro\ -ke-dashoffset:0;\ -stroke-opacity:1\ -;visibility:visi\ -ble;display:inli\ -ne;overflow:visi\ -ble\x22\x0a id=\x22\ -path8532\x22 />\x0a <\ -/g>\x0a\x0a\ -" - -qt_resource_name = b"\ -\x00\x05\ -\x00o\xa6S\ -\x00i\ -\x00c\x00o\x00n\x00s\ -\x00\x08\ -\x0e#S\xa7\ -\x00G\ -\x00I\x00M\x00P\x00.\x00s\x00v\x00g\ -" - -qt_resource_struct = b"\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ -\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -" - -def qInitResources(): - QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) - -def qCleanupResources(): - QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) - -qInitResources() diff --git a/Resources3.py b/Resources3.py deleted file mode 100644 index 8af6c01..0000000 --- a/Resources3.py +++ /dev/null @@ -1,1406 +0,0 @@ -# -*- coding: utf-8 -*- - -# Resource object code -# -# Created: Thu Jan 21 01:44:33 2021 -# by: The Resource Compiler for PySide2 (Qt v5.11.3) -# -# WARNING! All changes made in this file will be lost! - -from PySide2 import QtCore - -qt_resource_data = b"\ -\x00\x00U\x5c\ -<\ -?xml version=\x221.\ -0\x22 encoding=\x22UTF\ --8\x22 standalone=\x22\ -no\x22?>\x0a\x0a\ -\x0a \x0a \ -\x0a\ - \x0a \ - \x0a \x0a\ - \x0a \x0a \ - \x0a \x0a\ - \x0a \x0a \ - \x0a \x0a\ - \x0a \x0a \ - \x0a \x0a\ - \x0a \x0a \ - \x0a \x0a \x0a \x0a \ - \ -\x0a \x0a \ - \x0a \x0a \ -\x0a \x0a \x0a\ - \x0a \ -\x0a \x0a \x0a \ - \x0a \x0a\ - \x0a \x0a <\ -stop\x0a st\ -yle=\x22stop-color:\ -#857c63;stop-opa\ -city:1\x22\x0a \ - offset=\x220\x22\x0a \ - id=\x22stop650\ -2\x22 />\x0a \x0a \x0a \x0a \ - \x0a \x0a \x0a \x0a \ - \x0a \x0a \x0a \x0a \ - \x0a \x0a \x0a <\ -linearGradient\x0a \ - id=\x22linear\ -Gradient6452\x22>\x0a \ - \x0a \ -\x0a \x0a <\ -linearGradient\x0a \ - x1=\x226.3051\ -529\x22\x0a y1=\x22\ -23.362427\x22\x0a \ - x2=\x225.9846287\x22\ -\x0a y2=\x2231.5\ -7\x22\x0a id=\x22li\ -nearGradient6458\ -\x22\x0a xlink:h\ -ref=\x22#linearGrad\ -ient6452\x22\x0a \ - gradientUnits=\x22\ -userSpaceOnUse\x22 \ -/>\x0a \x0a \x0a \ - \x0a \x0a \x0a \x0a \x0a \x0a <\ -/defs>\x0a \x0a \ - \x0a \x0a \ - \x0a <\ -path\x0a d=\x22M\ - 36.96875,11.843\ -75 C 36.406772,1\ -2.770645 35.5622\ -58,13.876916 34.\ -28125,14.9375 C \ -31.649332,17.116\ -542 27.230687,19\ -.099847 20,19.28\ -125 C 15.775627,\ -19.386299 13.047\ -259,17.347101 11\ -.375,15.53125 L \ -11.25,20 C 11.38\ -6107,20.418802 1\ -1.665455,21.3904\ -98 11.1875,22.71\ -875 C 10.673186,\ -24.148046 9.0329\ -86,25.610113 6.2\ -1875,26.71875 C \ -6.4690804,27.240\ -783 6.7142345,27\ -.76237 7.46875,2\ -8.5 C 8.4967003,\ -29.504945 9.9257\ -833,30.588049 11\ -.625,31.5625 C 1\ -5.023433,33.5114\ -02 19.426583,35.\ -055712 23.53125,\ -35.125 C 27.6359\ -17,35.194288 31.\ -388376,33.89045 \ -33.96875,30.125 \ -C 36.347494,26.6\ -53782 37.651223,\ -20.777057 36.968\ -75,11.84375 z \x22\x0a\ - style=\x22op\ -acity:0.18539327\ -;color:black;fil\ -l:none;fill-opac\ -ity:1;fill-rule:\ -evenodd;stroke:u\ -rl(#linearGradie\ -nt8530);stroke-w\ -idth:0.9999997;s\ -troke-linecap:bu\ -tt;stroke-linejo\ -in:miter;marker:\ -none;marker-star\ -t:none;marker-mi\ -d:none;marker-en\ -d:none;stroke-mi\ -terlimit:10;stro\ -ke-dasharray:non\ -e;stroke-dashoff\ -set:0;stroke-opa\ -city:1;visibilit\ -y:visible;displa\ -y:inline;overflo\ -w:visible\x22\x0a \ - id=\x22path8520\x22 \ -/>\x0a \x0a <\ -path\x0a d=\x22M\ - 10.429825 27.22\ -8739 A 4.3310289\ - 6.0987959 0 1 1\ - 1.767767,27.22\ -8739 A 4.3310289\ - 6.0987959 0 1 1\ - 10.429825 27.2\ -28739 z\x22\x0a \ -transform=\x22matri\ -x(0.810984,-0.58\ -5069,0.585069,0.\ -810984,-14.77791\ -,6.947121)\x22\x0a \ - style=\x22color:\ -black;fill:url(#\ -radialGradient85\ -48);fill-opacity\ -:1;fill-rule:eve\ -nodd;stroke:blac\ -k;stroke-width:0\ -.9999997;stroke-\ -linecap:butt;str\ -oke-linejoin:mit\ -er;marker:none;m\ -arker-start:none\ -;marker-mid:none\ -;marker-end:none\ -;stroke-miterlim\ -it:10;stroke-das\ -harray:none;stro\ -ke-dashoffset:0;\ -stroke-opacity:1\ -;visibility:visi\ -ble;display:inli\ -ne;overflow:visi\ -ble\x22\x0a id=\x22\ -path5198\x22 />\x0a \ - \ -\x0a \x0a \x0a <\ -path\x0a d=\x22M\ - 23.157747 20.95\ -3165 A 1.767767 \ -1.767767 0 1 1 \ -19.622213,20.953\ -165 A 1.767767 1\ -.767767 0 1 1 2\ -3.157747 20.9531\ -65 z\x22\x0a tra\ -nsform=\x22matrix(0\ -.766666,0,0,0.76\ -6666,-2.556414,5\ -.029841)\x22\x0a \ - style=\x22color:bl\ -ack;fill:white;f\ -ill-opacity:1;fi\ -ll-rule:evenodd;\ -stroke:none;stro\ -ke-width:0.99999\ -97;stroke-lineca\ -p:butt;stroke-li\ -nejoin:miter;mar\ -ker:none;marker-\ -start:none;marke\ -r-mid:none;marke\ -r-end:none;strok\ -e-miterlimit:10;\ -stroke-dasharray\ -:none;stroke-das\ -hoffset:0;stroke\ --opacity:1;visib\ -ility:visible;di\ -splay:inline;ove\ -rflow:visible\x22\x0a \ - id=\x22path43\ -61\x22 />\x0a \x0a \x0a \x0a \x0a \x0a \x0a \x0a \ -\x0a \x0a \x0a \ - \x0a \x0a <\ -path\x0a d=\x22M\ - 23.003067,31.73\ -6544 C 24.500439\ -,31.879636 25.85\ -2696,31.464331 2\ -6.41496,31.26249\ -7 C 26.513185,30\ -.707111 26.95151\ -2,29.64124 28.46\ -1048,29.571029 L\ - 27.930718,28.64\ -2952 C 27.930718\ -,28.642952 25.96\ -4077,29.990873 2\ -3.864854,30.3886\ -21 L 23.003067,3\ -1.736544 z \x22\x0a \ - style=\x22color\ -:black;fill:url(\ -#linearGradient4\ -330);fill-opacit\ -y:1;fill-rule:ev\ -enodd;stroke:non\ -e;stroke-width:0\ -.9999997;stroke-\ -linecap:butt;str\ -oke-linejoin:mit\ -er;marker:none;m\ -arker-start:none\ -;marker-mid:none\ -;marker-end:none\ -;stroke-miterlim\ -it:10;stroke-das\ -harray:none;stro\ -ke-dashoffset:0;\ -stroke-opacity:1\ -;visibility:visi\ -ble;display:inli\ -ne;overflow:visi\ -ble\x22\x0a id=\x22\ -path8532\x22 />\x0a <\ -/g>\x0a\x0a\ -" - -qt_resource_name = b"\ -\x00\x05\ -\x00o\xa6S\ -\x00i\ -\x00c\x00o\x00n\x00s\ -\x00\x08\ -\x0e#S\xa7\ -\x00G\ -\x00I\x00M\x00P\x00.\x00s\x00v\x00g\ -" - -qt_resource_struct = b"\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ -\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -" - -def qInitResources(): - QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) - -def qCleanupResources(): - QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) - -qInitResources() diff --git a/icons/Inkscape.svg b/icons/Inkscape.svg new file mode 100644 index 0000000..56e21aa --- /dev/null +++ b/icons/Inkscape.svg @@ -0,0 +1,727 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icons/Mousepad.svg b/icons/Mousepad.svg new file mode 100644 index 0000000..492a76f --- /dev/null +++ b/icons/Mousepad.svg @@ -0,0 +1,119 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +