# HG changeset patch # User Edouard Tisserant # Date 1708437213 -3600 # Node ID fc3621302cfe2b4549d63a74bf8ba4837d90788e # Parent df7ce3e1f44d94a4c2eefcb381a15fc4c6d62416# Parent 5b2f3a915a432ec8c37efa126a4fa20fe0695f22 merge diff -r df7ce3e1f44d -r fc3621302cfe docutil/docsvg.py --- a/docutil/docsvg.py Thu Feb 15 17:03:06 2024 +0100 +++ b/docutil/docsvg.py Tue Feb 20 14:53:33 2024 +0100 @@ -76,8 +76,12 @@ inkpath = get_inkscape_path() if inkpath is None: return None - return list(map(int, - subprocess.check_output([inkpath,"--version"]).split()[1].split(b'.'))) + version_string = subprocess.check_output( + [inkpath,"--version"], + stderr=subprocess.STDOUT) + if version_string: + return list(map(int,version_string.split()[1].split(b'.'))) + return [0,0] _inkscape_version = None def get_inkscape_version(): diff -r df7ce3e1f44d -r fc3621302cfe images/Build.png Binary file images/Build.png has changed diff -r df7ce3e1f44d -r fc3621302cfe images/Clean.png Binary file images/Clean.png has changed diff -r df7ce3e1f44d -r fc3621302cfe images/genicons.sh --- a/images/genicons.sh Thu Feb 15 17:03:06 2024 +0100 +++ b/images/genicons.sh Tue Feb 20 14:53:33 2024 +0100 @@ -10,7 +10,7 @@ else rm -f $i.png echo "$INKSCAPE" $fname -z -e $i.png -i $i - "$INKSCAPE" $fname -z -e $i.png -i $i + "$INKSCAPE" $fname -o $i.png -i $i fi done done diff -r df7ce3e1f44d -r fc3621302cfe images/icons.svg --- a/images/icons.svg Thu Feb 15 17:03:06 2024 +0100 +++ b/images/icons.svg Tue Feb 20 14:53:33 2024 +0100 @@ -2,22 +2,22 @@ + inkscape:output_extension="org.inkscape.output.svg.inkscape" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> @@ -31,8 +31,8 @@ + inkscape:bbox-paths="true" + inkscape:pagecheckerboard="0"> + id="filter4228" + x="-0.072894476" + y="-0.076842593" + width="1.145789" + height="1.1536852"> + id="filter19484" + x="-0.066174711" + y="-0.049398023" + width="1.1323494" + height="1.098796"> + x="-0.078079168" + width="1.1561583" + y="-0.1142207" + height="1.2284414"> + height="1.3508246"> + x="-0.096121542" + width="1.1922431" + y="-0.31690436" + height="1.6338087"> + x="-0.077696319" + width="1.1553926" + y="-0.47286011" + height="1.9457202"> + width="1.1523586" + y="-0.16557006" + height="1.3311401"> + id="filter9298" + x="-0.033676533" + y="-0.034051957" + width="1.0668162" + height="1.068276"> + y="-0.12233573" + height="1.2446715"> + id="filter5845" + x="-0.067752077" + y="-0.053323477" + width="1.1355042" + height="1.106647"> %% Build Clean editPLC HMIEditor ImportFile ManageFolder ImportSVG NetworkEdit ShowMaster ExportSlave Run ShowIECcode Stop EditSVG OpenPOT EditPO AddFont DelFont %% + style="font-size:12.761px;line-height:1.25">%% Build Clean editPLC HMIEditor ImportFile ManageFolder ImportSVG NetworkEdit ShowMaster ExportSlave Run ShowIECcode Stop EditSVG OpenPOT EditPO AddFont DelFont %% - - - + @@ -88566,13 +88579,13 @@ height="2.4448969" width="12.22449" /> Main Program @@ -88582,7 +88595,7 @@ d="m -1053.1533,448.8911 -0.044,0.005 c 0,8.7e-4 0,0.002 -0.01,0.003 l -2.5764,0.41802 c -9e-4,-10e-6 0,-10e-6 0,0 l -0.044,0.008 c -0.077,0.0142 -0.1299,0.0861 -0.1202,0.16393 l 0.01,0.0437 c 9e-4,0.002 0,0.004 0,0.005 l 0.3579,2.19389 0,0.0383 c 0.01,0.0404 0.027,0.0768 0.06,0.10053 0.033,0.0238 0.074,0.0329 0.1146,0.0251 l 0.044,-0.008 2.5764,-0.41801 0.035,-0.003 c 0.039,-0.005 0.075,-0.0253 0.099,-0.0566 0.024,-0.0313 0.035,-0.0709 0.03,-0.1101 l -0.01,-0.0437 c 10e-5,-0.002 10e-5,-0.004 0,-0.005 l -0.1448,-0.9098 1.3032,-0.21037 0.6448,3.99162 c 0.01,0.0394 0.029,0.0744 0.062,0.097 0.033,0.0226 0.074,0.031 0.1128,0.0232 l 0.087,-0.0164 c 0.01,-0.002 0.017,-0.005 0.025,-0.008 l 0,0 1.8606,-0.30054 0.1448,0.89887 c 0,0.002 0,0.004 0,0.005 l 0.01,0.041 c 0.015,0.0761 0.087,0.12733 0.1639,0.11748 l 0.044,-0.005 c 0,-8.8e-4 0,-0.002 0.01,-0.003 l 4.2348,-0.68576 c 9e-4,1e-5 0,1e-5 0,0 l 0.044,-0.008 c 0.077,-0.0142 0.1299,-0.0861 0.1202,-0.16392 l -0.01,-0.0437 c -9e-4,-0.002 0,-0.004 0,-0.005 l -0.3525,-2.1693 c 0,-9.1e-4 0,-0.002 0,-0.003 l -0.01,-0.0437 c -0.015,-0.0797 -0.092,-0.13215 -0.1721,-0.11748 l -0.044,0.008 -4.2321,0.68576 -0.038,0.003 c -0.039,0.005 -0.075,0.0253 -0.099,0.0566 -0.024,0.0313 -0.035,0.0709 -0.029,0.1101 l 0.01,0.0437 c 9e-4,0.002 0,0.004 0,0.005 l 0.1448,0.89613 -1.7459,0.27868 -0.6475,-3.98616 c -0.013,-0.0807 -0.089,-0.13573 -0.1694,-0.12295 l -0.085,0.0137 c -0.012,0.002 -0.024,0.006 -0.035,0.0109 0,8.7e-4 0,0.002 -0.01,0.003 l -1.4126,0.22677 -0.1448,-0.90707 c -9e-4,-9.2e-4 0,-0.002 0,-0.003 l -0.01,-0.0437 c -0.014,-0.0772 -0.086,-0.1299 -0.1639,-0.12022 z m -0.1721,0.41529 0.2923,1.81959 -2.2021,0.35517 -0.2923,-1.81959 2.2021,-0.35517 z m 8.7154,2.8414 0.2869,1.795 -3.855,0.62293 -0.2869,-1.79501 3.855,-0.62292 z" inkscape:connector-curvature="0" /> IN ST ST + STOP @@ -89224,7 +89238,7 @@ x="20" id="tspan16197" sodipodi:role="line" - style="font-size:12.76000023px;line-height:1.25">%% Add Delete Disabled Enabled HideVars IECCDown IECCUp Maximize Minimize minus plus ShowVars LeftCopy RightCopy%% + style="font-size:12.76px;line-height:1.25">%% Add Delete Disabled Enabled HideVars IECCDown IECCUp Maximize Minimize minus plus ShowVars LeftCopy RightCopy%% @@ -89395,7 +89409,7 @@ y="258.79065" id="text27339" xml:space="preserve" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.3936758px;line-height:0%;font-family:'Courier New';-inkscape-font-specification:'Courier New Bold';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:url(#linearGradient19193);fill-opacity:1;stroke:none">%% Compiler TargetType %% + style="font-size:12.76px;line-height:1.25">%% Compiler TargetType %% Buttons %% splash %% + style="font-size:51.04px">%% splash %% 100 + style="font-size:10.4962px;line-height:1.25">100 200 + style="font-size:10.4962px;line-height:1.25">200 300 + style="font-size:10.4962px;line-height:1.25">300 400 + style="font-size:10.4962px;line-height:1.25">400 0 + style="font-size:10.4962px;line-height:1.25">0 %% editIECrawcode editWXGLADE editPYTHONcode EditCfile Transfer Connect Disconnect Debug IDManager Repair %% + style="font-size:12.761px;line-height:1.25">%% editIECrawcode editWXGLADE editPYTHONcode EditCfile Transfer Connect Disconnect Debug IDManager Repair %% ST ST + @@ -90957,7 +90972,7 @@ transform="translate(-230.13257,-140)" id="g20864"> C C + @@ -91267,7 +91283,7 @@ transform="translate(-330.13257,-140)" id="g16441"> Py Py + @@ -91488,7 +91505,7 @@ transform="matrix(1.6473499,0,0,1.6473499,800.92342,263.57576)" id="flowRoot16492" xml:space="preserve" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0.01%;font-family:'Andale Mono';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:url(#linearGradient16582);fill-opacity:1;stroke:#547c1b;stroke-width:0.1061436;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">Wx Wx + @@ -91775,7 +91793,7 @@ transform="matrix(0.9283218,0.3717759,-1.4068753,0.5137849,0,0)" id="text16585" xml:space="preserve" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.71082616px;line-height:0%;font-family:'Nimbus Mono L';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none">Master @@ -91893,7 +91911,7 @@ sodipodi:nodetypes="cccsssccsssccccsssccsssccccsssccssscccsssccssscccsssccssscccsssccsssccccssssccssssccsssccssscccccsssccsssccccsssccssscccccsssccssscsssssccsssccccssscccccssscccccssssccssssccsssccsssccccssssssszssssssccsssssssccsssssssccccsssccssscsssssccsssccccssscccccssscccccssssccssssccsssccsssccccssssssssssssssccsssssssccssssssscccccsssccsssccccccccsssccsssccccccssssccssssccsssccssscccsssssssccsssssssccsssssssccssssssscccssssccssssccsssccssscccccsssccsssccccssssccccssccccsssssssssssssssssccsssssssssssssssssssssssssssssssssssssc" inkscape:connector-curvature="0" />     + %% Extension Cfile Pyfile wxGlade SVGHMI FOLDER FILE %% + style="font-size:12.76px;line-height:1.25">%% Extension Cfile Pyfile wxGlade SVGHMI FOLDER FILE %% C C + @@ -92281,7 +92301,7 @@ transform="matrix(0.48337242,0,0,0.48337242,-16.622911,193.05511)" id="g20864-0-1"> Py Py + @@ -92560,7 +92581,7 @@ transform="matrix(0.48337242,0,0,0.48337242,34.703335,192.63005)" id="g20864-0-1-3"> Wx Wx + @@ -93039,7 +93061,7 @@ transform="matrix(0.92832176,0.37177589,-1.4068753,0.51378489,0,0)" id="text16585-3" xml:space="preserve" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.71082616px;line-height:0%;font-family:'Nimbus Mono L';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none">%% tree_drive tree_folder tree_file %% + style="font-size:12.76px;line-height:1.25">%% tree_drive tree_folder tree_file %% @@ -93707,7 +93729,7 @@ @@ -93763,7 +93785,7 @@ x="365.61026" id="tspan16195-3-3" sodipodi:role="line" - style="font-size:12.76000023px;line-height:1.25">%% LOG_CRITICAL LOG_WARNING LOG_INFO LOG_DEBUG %% + style="font-size:12.76px;line-height:1.25">%% LOG_CRITICAL LOG_WARNING LOG_INFO LOG_DEBUG %% ! + style="font-size:12.4041px;line-height:1.25;font-family:sans-serif">! i + style="font-size:15.5644px;line-height:1.25;font-family:sans-serif">i %% about_brz_logo %% + style="font-size:51.04px">%% about_brz_logo %% diff -r df7ce3e1f44d -r fc3621302cfe svghmi/ui.py --- a/svghmi/ui.py Thu Feb 15 17:03:06 2024 +0100 +++ b/svghmi/ui.py Tue Feb 20 14:53:33 2024 +0100 @@ -81,7 +81,7 @@ def OnTreeNodeSelection(self, event): items = self.GetSelections() - items_pydata = [self.GetPyData(item) for item in items] + items_pydata = [self.GetItemData(item) for item in items] # append new items to ordered item list for item_pydata in items_pydata: @@ -488,7 +488,7 @@ """ global thumbnail_temp_path event.Skip() - item_pydata = self.widgetpicker.GetPyData(event.GetItem()) + item_pydata = self.widgetpicker.GetItemData(event.GetItem()) if item_pydata is not None: svgpath = item_pydata diff -r df7ce3e1f44d -r fc3621302cfe targets/toolchain_gcc.py --- a/targets/toolchain_gcc.py Thu Feb 15 17:03:06 2024 +0100 +++ b/targets/toolchain_gcc.py Tue Feb 20 14:53:33 2024 +0100 @@ -29,6 +29,8 @@ import re import operator import hashlib +import subprocess +import shlex from functools import reduce from util.ProcessLogger import ProcessLogger @@ -164,7 +166,28 @@ self.compiler = self.getCompiler() self.linker = self.getLinker() - Builder_CFLAGS = ' '.join(self.getBuilderCFLAGS()) + Builder_CFLAGS_str = ' '.join(self.getBuilderCFLAGS()) + Builder_LDFLAGS_str = ' '.join(self.getBuilderLDFLAGS()) + + Builder_CFLAGS = shlex.split(Builder_CFLAGS_str) + Builder_LDFLAGS = shlex.split(Builder_LDFLAGS_str) + + pattern = "{SYSROOT}" + if pattern in Builder_CFLAGS_str or pattern in Builder_LDFLAGS_str: + try: + sysrootb = subprocess.check_output(["arm-unknown-linux-gnueabihf-gcc","-print-sysroot"]) + except subprocess.CalledProcessError: + self.CTRInstance.logger.write("GCC failed with -print-sysroot\n") + return False + except FileNotFoundError: + self.CTRInstance.logger.write("GCC not found\n") + return False + + sysroot = sysrootb.decode().strip() + + replace_sysroot = lambda l:list(map(lambda s:s.replace(pattern, sysroot), l)) + Builder_CFLAGS = replace_sysroot(Builder_CFLAGS) + Builder_LDFLAGS = replace_sysroot(Builder_LDFLAGS) # ----------------- GENERATE OBJECT FILES ------------------------ obns = [] @@ -194,8 +217,12 @@ status, _result, _err_result = ProcessLogger( self.CTRInstance.logger, - "\"%s\" -c \"%s\" -o \"%s\" -O2 %s %s" % - (self.compiler, CFile, objectfilename, Builder_CFLAGS, CFLAGS) + [self.compiler, + "-c", CFile, + "-o", objectfilename, + "-O2"] + + Builder_CFLAGS + + shlex.split(CFLAGS) ).spin() if status: @@ -212,20 +239,14 @@ # Link all the object files into one binary file self.CTRInstance.logger.write(_("Linking :\n")) if relink: - # Generate list .o files - listobjstring = '"' + '" "'.join(objs) + '"' - - ALLldflags = ' '.join(self.getBuilderLDFLAGS()) self.CTRInstance.logger.write(" [CC] " + ' '.join(obns)+" -> " + self.bin + "\n") status, _result, _err_result = ProcessLogger( self.CTRInstance.logger, - "\"%s\" %s -o \"%s\" %s" % - (self.linker, - listobjstring, - self.bin_path, - ALLldflags) + [self.linker] + objs + + ["-o", self.bin_path] + + Builder_LDFLAGS ).spin() if status: diff -r df7ce3e1f44d -r fc3621302cfe util/ProcessLogger.py --- a/util/ProcessLogger.py Thu Feb 15 17:03:06 2024 +0100 +++ b/util/ProcessLogger.py Tue Feb 20 14:53:33 2024 +0100 @@ -28,6 +28,7 @@ import subprocess import ctypes import time +import shlex from threading import Timer, Lock, Thread, Semaphore, Condition import signal @@ -82,16 +83,9 @@ self.logger = logger if not isinstance(Command, list): self.Command_str = Command - self.Command = [] - for i, word in enumerate(Command.replace("'", '"').split('"')): - if i % 2 == 0: - word = word.strip() - if len(word) > 0: - self.Command.extend(word.split()) - else: - self.Command.append(word) - else: - self.Command = [x if type(x)==str else x.decode() for x in Command] + self.Command = shlex.split(Command) + else: + self.Command = Command self.Command_str = subprocess.list2cmdline(self.Command) fsencoding = sys.getfilesystemencoding()