Updated screenshots and README. Reordered SCM priority

This commit is contained in:
John Pateman 2020-03-02 23:14:18 +00:00
parent e1827b99a8
commit 22c0c7b2c7
30 changed files with 89 additions and 1534 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 473 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 473 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

BIN
Documents/composite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
Documents/cu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

BIN
Documents/diff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
Documents/gui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
Documents/gui2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

BIN
Documents/main1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
Documents/main2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

BIN
Documents/pair.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
Documents/text.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

101
README.md
View File

@ -1,88 +1,49 @@
# KiCad-Diff
NEWS
Added new SVG Branch which is much faster and compares SVGs directly rather than doing renderings in ImageMagick. Still needing some work but illustrates proof of concept.
This is a python program with a Tk inteface for comparing KiCad PCB revisions.
![SVG Branch](https://github.com/Gasman2014/KiCad-Diff/blob/master/Screen%20Shot%202019-05-18%20at%2014.35.22.png)
The diffing strategy has been changed for this version and SVGs are generated directly rather than doing renderings in ImageMagick as in previous versions. This has made the rendering possible for all layers in a few seconds (compared to 20-60s+ depending on resolution and number of layers selected in previous version).
Was originaly a bash script, this newer GUI version has been rewritten in Python3 and supports Git, SVN and Fossil as SCM tools.
The output is presented as a gallery of images of each layer. Each layer pair can be compared and the combined view highlights clearly where the layers differ from each other.
Was originaly a bash script, this newer GUI version has been rewritten in Python3 and supports Git, SVN and Fossil as SCM tools. I have also removed many of the dependencies.
Scripts for performing image diffs between pcbnew layout revisions. Extended to show the graphical diff in a webpage. Also included some general Kicad/Fossil observations.
Based on the initial scripts of Spuder and described in https://github.com/UltimateHackingKeyboard/electronics/tree/master/scripts
The workflow describes how to use a git repository for Kicad printed circuit board board versions. Kicad uses text files for schematic and pcb layout files. Whilst it is easy enough to generate and diff two pcb layout files, the results are almost meaningless as it is impossible to decide what items have moved where.
Additionally, Spuders workflow relied on git - and I rather prefer Fossil-scm as it is a more complete solution (has a wiki and bugtracker built in) and is a small memory footprint.
https://www.fossil-scm.org/index.html/doc/trunk/www/index.wiki
Also, Spuder's workflow relied on a python script that was downloaded to a /tmp directory. This makes the solution problematic if you are without internet access.
I have added a web interface to this project. It is functional but needs some work to render it more attractive...
The code is pretty sloppy and fairly sparsely commented but functional. The diff program should be run within a fossil checkout and takes 0, 1 or 2 commit hashes as arguments. With 0 arguments, the script compares the working copy with the last committed version (i.e what has changes since the last commit). With 1 argument, the current checkout is compared to the version identified and with two commit hashes a diff between those versions is calculated.
The diffed versions of the pcb are then used to generate parallel sets of svg files using the kicad python interface. The svg files are then converted to png and cropped to just the board area. ImageMagick is used to manipulate the images to highlight the changed items.
One strategy is to use the stereo 0 command but I had no luck with this and have come up with an alternative method.
Finally the images are presented in a webpage - clicking an image will bring up a 3-pane diff showing before and after and the composite image with the differences highlighted. The webpage generation code needs abstracting (next part of project). The three pane view is accompanied by a text diff (however, this is very limited and for it to be meaningful really needs a tool to 'reverse parse' the diff and generate a tree structure - i.e a change is noted in a gr-text line but this line is in the s-expression definition of a module that has been moved. Once the diff has been noted, you need to go back up through the s-expression tree to determine the originating module/net etc.
Determining coordinate position is also tricky. It is straightforward to overlay a grid but trickier to compute the necessary offset and scales - this is possible with the python interface but this seems to be in evolution at present. Adjusting or placing an auxillary zero causes problems. Plan to generate a full sized svg image of each page, do the visual diff and then crop the diff to the image extents. Then go back and apply the same crop to the DIFF_1 & DIFF_2 images & at the same time calculate the scale factor and the grid co-ordinates.
Working on python parsing of .kicad_pcb file to extract module/track location info. I have doubled the size of the svg to improve the render detailing when converted to png. Would like to be able to do all of thisi in the svg format.
Kicad tends to modify some of the minor data in the checkout making commits a bit 'noisy'. I have adopted the scheme proposed here https://jnavila.github.io/plotkicadsch/ to amend the kicad files before committing them. Although there is quite extensive scripting support in fossil it seems quite difficult to replicate the clean and smudge technique reliably in Fossil. There is a wrapper project called fsl (http://fossil.0branch.com/fsl/home) which acts as an interceptor to fossil commands and, additionally offers some extra shortcuts and some more colourful logging options (and the Dresden branch allows the use of simple revision numbers). The behaviour is controlled by a ~/.fslrc file which I have included in this repo.
I am running this setup on macOs 10.12 but I would imagine any linux variant would work as well. Windows - ymmv...
Dependencies
* gsed (Mac sed is limited)
* Kicad with python scripting enabled
* Image Magick
* Fossil scm (OR Git or SVN)
* Possibly some others but all have been installed with the help of brew
(If you are on MacOS X and having problems with Imagemagick's convert, you might try reinstalling it with RSVG lib.Using HomeBrew:
brew remove imagemagick
brew install imagemagick --with-librsvg
**Instructions**
* Check that the paths to your SCM tools are correct (lines 32-34)
* Install plotPCB2.py in /usr/local/bin (or adjust path in lines 480/481 to suit).
(I should probably add this sort of stuff to a config file but I might wait for V2...)
* Check that the paths to your SCM tools are correct (lines 39-45)
* Install plotPCB2.py in /usr/local/bin (or adjust path in lines 45 to suit).
* Run the main script and select a pair of versions in a source controlled repository from the GUI.
* Install imagemagick.
* Run the main script and select a pair of versions in a source controlled repository from the GUI.
* Select a resolution.
* Select which layers you wish to compare.
The script should build a series of svg files and display the diff in a webpage.
Plans:
Rewrite in Python to improve integration with Kicad. DONE
Possibly support other VCS tools. DONE
Mechanism to select layer sets and resolution. DONE
Improvement in parsing and meaning of text diffs. IN PROGRESS
Improvement in parsing and meaning of text diffs.
Place all template text/css text in external files.
Improve display of artifacts in diff choice window.
Consider changing GUI elements to wxPython.
Adjust <div> for three pane output to have white outer border & pan-zoom control, not filter colour.
Improve three pane output layout, perhaps with diff tree on LHS and not underneath.
## screenshots
## Screenshots
GUI
![GUI](/Documents/Screen%20Shot%202018-06-04%20at%2022.28.05.png)
![GUI](/Documents/gui.png)
![GUI](/Documents/gui2.png)
Overview
![screenshot overview](/Documents/Overview.png)
![Overview](/Documents/overview.png)
Three panel view
![screenshot Three panel view](/Documents/3panel.png)
F_Cu
![screenshot F-Cu](/Documents/F_Cu.png)
F_Cu2
![screenshot TF_Cu2](/Documents/F_Cu2.png)
F_Fab
![screenshot F_Fab](/Documents/F_Fab.png)
F_Mask
![screenshot F_Mask](/Documents/F_Mask.png)
Main view
![Main](/Documents/main1.png)
![Main](/Documents/main2.png)
Diff
![Fab Layer Diff](/Documents/diff.png)
Fab Layer
![Fab layer side by side](/Documents/pair.png)
Cu Layer
![Cu difference view](/Documents/cu.png)
![Cu layer - 3 pane view](/Documents/composite.png)
Output with PCBDraw (In progress)
![PCBDraw Output](/Documents/diff-74b1-b1d3.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

120
fslrc
View File

@ -1,120 +0,0 @@
# -*-tcl-*-
# -- Aliases:
alias . changes
alias d diff
alias , ui
alias log timeline
alias heads leaves; # for hg refugees
alias log timeline
alias history {timeline -n 100}
alias live {set autosync on}
alias local {set autosync off}
# -- Filters:
filter status {changes status timeline add rm addremove} {
lassign [split [string trim $line]] status
switch $status {
MERGED_WITH { coloured purple $line }
ADDED { coloured green $line }
EDITED { coloured cyan $line }
DELETED { coloured red $line }
default { set line }
}
}
filter log_entry {leaves tim:timeline} {
if {[regexp "^=== .* ===" $line]} {
coloured blue $line
} else {
regsub -all {\[[A-Fa-f0-9]+\]} $line [coloured yellow &]
}
}
# Filter on alias `d' instead of `diff' so that output can be
# redirected to create patch files.
filter diff {d} {
switch -regexp $line {
{^-} { coloured red $line }
{^\+} { coloured green $line }
{^@@} { coloured yellow $line }
default { set line }
}
}
filter branch {br:branch} {
switch -regexp $line {
{^\*} { coloured yellow $line }
default { set line }
}
}
# fsl purge
# Purge all files flagged as "MISSING".
alias capture_changes changes
filter captured_changes {capture_changes} {
variable captured
lappend captured $line
return {}
}
interceptor cr:create {
global tcl_platform
set repodir [file join [file normalize ~] Repositories]
set reponame [file join $repodir [file tail [pwd].fossil]]
set skeleton [file join $repodir skeleton.fossil]
set user $tcl_platform(user)
set password [lindex $params 1]
fossil new $reponame --template $skeleton
fossil open $reponame
if {$password != ""} {
fossil user password $user $password
}
fossil branch new development trunk
fossil update development
return {}
}
interceptor purge {
variable captured {}
fossil capture_changes
foreach line $captured {
if [string match MISSING* $line] {
regsub ^MISSING $line {} file
fossil rm [string trim $file]
}
}
return {}
}
proc fixKicadDates {} {
set fix_pro_cmd [string trim {
sh -c {find . -name "*.pro" -print0 | xargs -0 gsed -E -i.bkp 's/update=.*/update=Date/'}
}]
set fix_sch_cmd [string trim {
sh -c {find . -name "*.sch" -print0 | xargs -0 gsed -E -i 's/#(PWR|FLG)[0-9]+/#\1?/'}
}]
exec {*}$fix_pro_cmd
exec {*}$fix_sch_cmd
}
interceptor kici {
switch [catch fixKicadDates err] {
0 { fossil commit {*}[lrange $params 1 end] }
1 { puts stderr $err }
}
return {}
}

663
kidiff.sh
View File

@ -1,663 +0,0 @@
#!/usr/bin/env bash
# Takes one or two Fossil ref's as arguments and generates visual diffs between them
# If only one ref specified, generates a diff from that file
# If no refs specified, assumes CURRENT
# TODO Rewrite in Python & improve efficiency.
# A Python version should be easier to maintain esp the HTML generation.
# Would be possible to add as a 'plugin' (not sure if that is worthwhile).
# TODO Add a graticle/grid with grid references.
# TODO Add back code to support alternative SCM (eg git)
# TODO Improve 3-pane layout - possible two side by side and comparison image underneath? id:16
# TODO Improve diff text parser. Currently difficult to diff as modules have multiple
# entries on different layers - need to identify graphic change with s-expression parser
# Need to generate a 'tree' and diff changes need to propogate back up tree to id
# the changed heading category. This could then be used to drive a drop down menu tree.
# e.g.
#(module Mounting_Holes:MountingHole_5.5mm (layer F.Cu) (tedit 56D1B4CB) (tstamp 598A07F7)
# (at 112.28 125.28)
# (descr "Mounting Hole 5.5mm, no annular")
# (tags "mounting hole 5.5mm no annular")
# (fp_text reference REF** (at 0 -6.5) (layer F.SilkS)
# (effects (font (size 1 1) (thickness 0.15)))
# )
# (fp_text value MountingHole_5.5mm (at 0 6.5) (layer F.Fab)
# (effects (font (size 1 1) (thickness 0.15)))
# )
# (fp_circle (center 0 0) (end 5.5 0) (layer Cmts.User) (width 0.15))
# (fp_circle (center 0 0) (end 5.75 0) (layer F.CrtYd) (width 0.05))
# (pad 1 np_thru_hole circle (at 0 0) (size 5.5 5.5) (drill 5.5) (layers *.Cu *.Mask))
#)
# Changes to the last line need to propogate through to the parent 'Module Mounting_Holes'
# Ideally the aim would be to have 'clicakble' regions.
qual=100
VERSION=2.1
#Default
function usage () {
cat << EOF
Usage: kidiff [OPTION] (VERSION) (VERSION2)
-h displays this help
-v displays version
-q quality of image (dpi)
This takes none, one or two Fossil references as arguments and generates visual diffs between them.
If no fossil references are specified, will perform a visual diff between the saved version and CURRENT (HEAD).
If one fossil reference is specified, will performa a visual diff between that and CURRENT (HEAD).
If two fossil references are supplied, will perform a visula diff between them.
(Not yet implemented)
By setting flags for copper, fab, mask and ECO layers, subsets of the diff can be run (faster).
EOF
exit 0
}
while getopts ":hvq" opt; do
case "$opt" in
h) usage
;;
v) version=$VERSION
echo "KiDiff : $version"
exit 0
;;
q) if ([ $2 -gt 99 ] && [ $2 -lt 601 ]); then
qual=$2
shift $((OPTIND-1))
else
echo "Quality parameter (q) between 100 and 600 dpi" 1>&2
exit 1
fi
;;
\?) echo "KiDiff : illegal option: $1" 1>&2
echo "usage: KiDiff [-hvq]"
exit 1
;;
esac
done
shift $((OPTIND-1))
# TODO Consider removing filename from display format i.e 'filename-F_Cu' becomes 'F_Cu' id:13
# TODO Add command line quality option - Quality is dpi. 100 is fast but low quality id:4
# 600 is very detailed. 300 is a good compromise.
# TODO Consider alternatve generation orders
# 1. svg > png > compare > crop to comparison image > crop source images to match
# 2. svg > recolour
# 2) SVG 'swap'colours would be simplest but although you can colorise the black
#easily, swaping the white for black seems to be problematic - not sure why
#prob something to do with evenodd
# TODO Command line options for selecting which plots id:8
# Remove old plot files
rm -r /tmp/svg
# Set directory for plotting
OUTPUT_DIR="./Plots"
rm -r $OUTPUT_DIR
mkdir $OUTPUT_DIR
# TODO Have added this temporarily to simply remove all the plots prior to generating files. id:12
# Theoretically the script could check if the files have already been generated and then only generate the
# missing files. This would permit multiple diff compares and you could also use an external diff tool like p4merge
# but the disadvantage is that the resoultions have to match. It is also more complicated to script
# Ideally one could request random compares within the web interface and there would
# be 'on the fly' svg/png creation and diff showing.
# Try to keep the web components seperate from the images so that the images could be
# looked at using a graphical diff viewer like p4merge.
# Set directory for web backend
WEB_DIR="web"
mkdir $OUTPUT_DIR/$WEB_DIR
cp ~/Kicad/KiCad-Diff/style.css $OUTPUT_DIR/$WEB_DIR/
# TODO cat >> $OUTPUT_DIR/$WEB_DIR/style.css <<_EOF_ // _EOF_
# TODO Might need to use a more complex strategy to cope with spaces in filename id:17
# using some varient of 'find . -name "*.pro" -print0 | xargs -0'
#################################
# Colours to substitute per layer
#
# Additionally need to add vias, and internal layers.
# TODO Parse the pcbnew file to determine which layers are active. id:14
# TODO Sort these so that they make sense i.e all B together, all F etc id:5
# Presently these sort alphabetically - thus Cmts/Dwgs/Edge * ECO come between B & F Cu.
F_Cu="#952927"
B_Cu="#359632"
B_Paste="#3DC9C9"
F_Paste="#969696"
F_SilkS="#339697"
B_SilkS="#481649"
B_Mask="#943197"
F_Mask="#943197"
Edge_Cuts="#C9C83B"
Margin="#D357D2"
In1_Cu="#C2C200"
In2_Cu="#C200C2"
Dwgs_User="#0364D3"
Cmts_User="#7AC0F4"
Eco1_User="#008500"
Eco2_User="#C2C200"
B_Fab="#858585"
F_Fab="#C2C200"
B_Adhes="#3545A8"
F_Adhes="#A74AA8"
B_CrtYd="#D3D04B"
F_CrtYd="#A7A7A7"
# Do something like this
#layertable = {}
#numlayers = pcbnew.PCB_LAYER_ID_COUNT
#for i in range(numlayers):
# layertable[board.GetLayerName(i)] = i
# These are the colour definitions for the 'solarised' theme from pcbnew.
#ColorPCBLayer_F.Cu=rgb(221, 47, 44)
#ColorPCBLayer_In3.Cu=rgba(194, 194, 194, 0.800)
#ColorPCBLayer_In4.Cu=rgba(0, 132, 132, 0.800)
#ColorPCBLayer_In5.Cu=rgba(0, 132, 0, 0.800)
#ColorPCBLayer_In6.Cu=rgba(0, 0, 132, 0.800)
#ColorPCBLayer_Margin=rgba(194, 0, 194, 0.800)
#ColorPCBLayer_B.CrtYd=rgba(194, 194, 0, 0.800)
#ColorPCBLayer_F.CrtYd=rgba(132, 132, 132, 0.800)
#ColorTxtFrontEx=rgba(194, 194, 194, 0.800)
#ColorTxtBackEx=rgba(0, 0, 132, 0.800)
#ColorTxtInvisEx=rgba(132, 132, 132, 0.800)
#ColorAnchorEx=rgba(0, 0, 132, 0.800)
#ColorPadBackEx=rgba(0, 132, 0, 0.800)
#ColorPadFrontEx=rgba(132, 132, 132, 0.800)
#ColorViaThruEx=rgba(194, 194, 194, 0.800)
#ColorViaBBlindEx=rgba(132, 132, 0, 0.800)
#ColorViaMicroEx=rgba(0, 132, 132, 0.800)
#ColorNonPlatedEx=rgba(194, 194, 0, 0.800)
#########################################################
# Find the .kicad_pcb files that differ between commits #
#########################################################
# Look at number of arguments provided set different variables based on number of Fossil refs
#############################################################################################
# 0. User provided no Fossil references, compare against last Fossil commit
if [ $# -eq 0 ]; then
DIFF_1="current"
DIFF_2=$(fossil info current | grep ^uuid: | sed 's/uuid: *//g'| cut -c 1-6)
echo $DIFF_2
CHANGED_KICAD_FILES=$(fossil diff --brief -r "$DIFF_2" | grep '.kicad_pcb$' | tr -d 'CHANGED[:space:]||ADDED[:space:]')
if [[ -z "$CHANGED_KICAD_FILES" ]]; then echo "No .kicad_pcb files differ" && exit 0; fi
# Copy all modified kicad_pcb files to $OUTPUT_DIR/current
for k in $CHANGED_KICAD_FILES; do
mkdir -p "$OUTPUT_DIR/$DIFF_1"
cp "$k" $OUTPUT_DIR/current
done
# Copy the Fossil commit kicad_pcb file to $OUTPUT_DIR/commit uuid
for k in $CHANGED_KICAD_FILES; do
mkdir -p "$OUTPUT_DIR/$DIFF_2"
echo "Copying $DIFF_2:$k to $OUTPUT_DIR/$DIFF_2/"
fossil cat $k -r $DIFF_2 > "$OUTPUT_DIR/$DIFF_2/$(basename $k)"
done
# 1. User supplied one Fossil reference to compare against current files
elif [ $# -eq 1 ]; then
DIFF_1="current"
DIFF_2="$1"
CHANGED_KICAD_FILES=$(fossil diff --brief -r "$DIFF_2" | grep '.kicad_pcb$' | tr -d 'CHANGED[:space:]||ADDED[:space:]')
if [[ -z "$CHANGED_KICAD_FILES" ]]; then echo "No .kicad_pcb files differ" && exit 0; fi
# Copy all modified kicad_file to $OUTPUT_DIR/current
for k in $CHANGED_KICAD_FILES; do
mkdir -p "$OUTPUT_DIR/$DIFF_1"
cp "$k" $OUTPUT_DIR/current
fossil info $DIFF_1 > "$OUTPUT_DIR/current/info.txt"
done
# Copy the specified Fossil commit kicad_file to $OUTPUT_DIR/$(Fossil ref)
for k in $CHANGED_KICAD_FILES; do
mkdir -p "$OUTPUT_DIR/$DIFF_2"
echo "Copying $DIFF_2:$k to $OUTPUT_DIR/$DIFF_2/$k"
fossil cat $k -r $DIFF_2 > "$OUTPUT_DIR/$DIFF_2/$(basename $k)"
fossil info $DIFF_2 > "$OUTPUT_DIR/$DIFF_2/info.txt"
done
# 2. User supplied 2 Fossil references to compare
elif [ $# -eq 2 ]; then
DIFF_1="$1"
DIFF_2="$2"
CHANGED_KICAD_FILES=$(fossil diff --brief -r "$DIFF_1" --to "$DIFF_2" | grep '.kicad_pcb$' | tr -d 'CHANGED[:space:]||ADDED[:space:]')
if [[ -z "$CHANGED_KICAD_FILES" ]]; then echo "No .kicad_pcb files differ" && exit 0; fi
# Copy all modified kicad_file to $OUTPUT_DIR/current
for k in $CHANGED_KICAD_FILES; do
mkdir -p "$OUTPUT_DIR/$DIFF_1"
fossil cat $k -r $DIFF_1 > "$OUTPUT_DIR/$DIFF_1/$(basename $k)"
fossil info $DIFF_1 > "$OUTPUT_DIR/$DIFF_1/info.txt"
done
# Copy the specified Fossil commit kicad_file to $OUTPUT_DIR/Fossil uuid
for k in $CHANGED_KICAD_FILES; do
mkdir -p "$OUTPUT_DIR/$DIFF_2"
echo "Copying $DIFF_2:$k to $OUTPUT_DIR/$DIFF_2/$k"
fossil cat $k -r $DIFF_2 > "$OUTPUT_DIR/$DIFF_2/$(basename $k)"
fossil info $DIFF_2 > "$OUTPUT_DIR/$DIFF_2/info.txt"
done
# 3. User provided too many references
else
echo "Please only provide 1 or 2 arguments: not $#"
exit 2
fi
echo "Kicad files saved to: '$OUTPUT_DIR/$DIFF_1' and '$OUTPUT_DIR/$DIFF_2'"
# Generate svg files from kicad output
######################################
#
# Use the python script 'plot_pcbnew.py' to generate svg files from the two *.kicad_pcb files.
# Files are saved in /tmp/svg/COMMIT_ID
#
for f in $OUTPUT_DIR/$DIFF_1/*.kicad_pcb; do
mkdir -p /tmp/svg/$DIFF_1
echo "Converting $f to .svg: Files will be saved to /tmp/svg"
/usr/local/bin/plot_pcbnew.py "$f" "/tmp/svg/$DIFF_1"
done
for f in $OUTPUT_DIR/$DIFF_2/*.kicad_pcb; do
mkdir -p /tmp/svg/$DIFF_2
echo "Converting $f to .svg: Files will be saved to /tmp/svg"
/usr/local/bin/plot_pcbnew.py "$f" "/tmp/svg/$DIFF_2"
done
# Convert svg files into png
######################################
#
# Parse the svg files in /tmp/svg/COMMIT_ID using Image Magick.
# The conversion trims the image to the active area using the 'trim' function.
# Fuzz is probably not nescessary (trim measures the corner pixel value and trims
# to the first non-corner coloured pixel. Fuzz allows for minor variation but as this is
# a generated svg, pixels should be white.)
#
# The .png files are created in the output directory.
#
# BUG The crop size can alter if an item is added or removed on the periphery
# should check that both images are the same size. Provided nothing changes
# around the edges this retains focus and detail on the board.
# Alternativly, would need to scan both images and determine the x+y difference and pad.
# may need to pad both top and bottom -
for p in /tmp/svg/$DIFF_1/*.svg; do
d=$(basename $p)
echo "Converting $p to .png"
convert -density $qual -fuzz 1% -trim +repage "$p" "$OUTPUT_DIR/$DIFF_1/${d%%.*}.png"
# convert -density $qual "$p" "$OUTPUT_DIR/$DIFF_1/${d%%.*}.png"
convert "$OUTPUT_DIR/$DIFF_1/${d%%.*}.png" -negate "$OUTPUT_DIR/$DIFF_1/${d%%.*}.png"
done
for p in /tmp/svg/$DIFF_2/*.svg; do
d=$(basename $p)
echo "Converting $p to .png"
convert -density $qual -fuzz 1% -trim +repage "$p" "$OUTPUT_DIR/$DIFF_2/${d%%.*}.png"
# convert -density $qual "$p" "$OUTPUT_DIR/$DIFF_2/${d%%.*}.png"
convert "$OUTPUT_DIR/$DIFF_2/${d%%.*}.png" -negate "$OUTPUT_DIR/$DIFF_2/${d%%.*}.png"
done
#for p in $OUTPUT_DIR/$DIFF_1/*.png; do
# d=$(basename $p)
# img1w=$(identify -ping -format '%w' "$p")
# img1h=$(identify -ping -format '%h' "$p")
# img2w=$(identify -ping -format '%w' "$OUTPUT_DIR/$DIFF_2/$d")
# img2h=$(identify -ping -format '%h' "$OUTPUT_DIR/$DIFF_2/$d")
#if [ "$img1w" == "$img2w" ] && [ "$img1h" == "$img2h" ]
#then echo "$d - MATCH"
#else
# echo "$d size $img1w x $img1h _"
# echo "$OUTPUT_DIR/$DIFF_2/$d size $img2w x $img2h"
#fi
#done
# Generate png diffs between DIFF_1 and DIFF_2
##############################################
#
# Originally the intention was to use the ImageMagic 'composite stereo 0' function to identify
# where items have moved but I could not get this to work.
# This flattens the original files to greyscale and they need to be converted
# back to rgb in order to be colourised.
for g in $OUTPUT_DIR/$DIFF_1/*.png; do
d=$(basename $g)
y=${d%.png}
layerName=${y##*-}
mkdir -p "$OUTPUT_DIR/diff-$DIFF_1-$DIFF_2"
echo "Generating composite image $OUTPUT_DIR/diff-$DIFF_1-$DIFF_2/$(basename $g)"
convert '(' $OUTPUT_DIR/$DIFF_2/$(basename $g) -flatten -grayscale Rec709Luminance ')' \
'(' $OUTPUT_DIR/$DIFF_1/$(basename $g) -flatten -grayscale Rec709Luminance ')' \
'(' -clone 0-1 -compose darken -composite ')' \
-channel RGB -combine $OUTPUT_DIR/diff-$DIFF_1-$DIFF_2/$(basename $g)
convert "$OUTPUT_DIR/diff-$DIFF_1-$DIFF_2/$(basename $g)" -fill ${!layerName} -fuzz 75% -opaque "#ffffff" "$OUTPUT_DIR/diff-$DIFF_1-$DIFF_2/$(basename $g)"
done
# Done in this order so that if the diff image is cropped to a ROI, then the same crop
# can be applied to the source images. This does not work as the python plot crops
# to the ROI
for p in $OUTPUT_DIR/$DIFF_1/*.png; do
d=$(basename $p)
y=${d%.png}
layerName=${y##*-}
echo "Converting $layerName to .png with colour "${!layerName}
convert "$OUTPUT_DIR/$DIFF_1/${d%%.*}.png" -define png:color-type=2 "$OUTPUT_DIR/$DIFF_1/${d%%.*}.png"
convert "$OUTPUT_DIR/$DIFF_1/${d%%.*}.png" -fill ${!layerName} -fuzz 75% -opaque "#ffffff" "$OUTPUT_DIR/$DIFF_1/${d%%.*}.png"
done
for p in $OUTPUT_DIR/$DIFF_2/*.png; do
d=$(basename $p)
y=${d%.png}
layerName=${y##*-}
echo "Converting $layerName to .png with colour "${!layerName}
convert "$OUTPUT_DIR/$DIFF_2/${d%%.*}.png" -define png:color-type=2 "$OUTPUT_DIR/$DIFF_2/${d%%.*}.png"
convert "$OUTPUT_DIR/$DIFF_2/${d%%.*}.png" -fill ${!layerName} -fuzz 75% -opaque "#ffffff" "$OUTPUT_DIR/$DIFF_2/${d%%.*}.png"
done
# Setup web directories for web output
######################################
#
# Remove index.html prior to streaming new data
# TODO Would be neater to put thumbs, tryptych, index and any .css sheet in a 'web' directory id:9
#
if [ -e $OUTPUT_DIR/$WEB_DIR/index.html ]
then rm $OUTPUT_DIR/$WEB_DIR/index.html
fi
if [ -d thumbs ]
then echo "'thumbs' directory found"
else mkdir $OUTPUT_DIR/$WEB_DIR/thumbs && echo "'thumbs' directory created"
fi
if [ -d tryptych ]
then echo "'tryptych' directory found"
else mkdir $OUTPUT_DIR/$WEB_DIR/tryptych && echo "'tryptych' directory created"
fi
# Stream HTML <head> and <style> to index.html
##############################################
#
# It would make more sense to stream this to $OUTPUT_DIR/web/style.css
# and reuse it in the 'tryptych' section.
DIFF_1_DATE=$(fossil info $DIFF_1 | grep uuid: | awk -F' ' '{ print $3 }')
DIFF_1_TIME=$(fossil info $DIFF_1 | grep uuid: | awk -F' ' '{ print $4 }')
DIFF_2_DATE=$(fossil info $DIFF_2 | grep uuid: | awk -F' ' '{ print $3 }')
DIFF_2_TIME=$(fossil info $DIFF_2 | grep uuid: | awk -F' ' '{ print $4 }')
TITLE=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | grep title | sed 's/(title_block//g' | sed 's/title//g')
DATE=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | grep date | sed 's/(date //g' | sed 's/)//g')
COMPANY=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | grep company | sed 's/(company "//g' | sed 's/")//g')
THICK1=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | head -n 10 | grep thickness | sed 's/(thickness //g' | sed 's/)//g')
DRAWINGS1=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | head -n 10 | grep drawings | sed 's/(drawings //g' | sed 's/)//g')
TRACKS1=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | head -n 10 | grep tracks | sed 's/(tracks //g' | sed 's/)//g')
ZONES1=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | head -n 10 | grep zones | sed 's/(zones //g' | sed 's/)//g')
MODULES1=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | head -n 10 | grep modules | sed 's/(modules //g' | sed 's/)//g')
NETS1=$(cat $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | head -n 10 | grep nets | sed 's/(nets //g' | sed 's/)//g')
THICK2=$(cat $OUTPUT_DIR/$DIFF_2/*.kicad_pcb | head -n 10 | grep thickness | sed 's/(thickness //g' | sed 's/)//g')
DRAWINGS2=$(cat $OUTPUT_DIR/$DIFF_2/*.kicad_pcb | head -n 10 | grep drawings | sed 's/(drawings //g' | sed 's/)//g')
TRACKS2=$(cat $OUTPUT_DIR/$DIFF_2/*.kicad_pcb | head -n 10 | grep tracks | sed 's/(tracks //g' | sed 's/)//g')
ZONES2=$(cat $OUTPUT_DIR/$DIFF_2/*.kicad_pcb | head -n 10 | grep zones | sed 's/(zones //g' | sed 's/)//g')
MODULES2=$(cat $OUTPUT_DIR/$DIFF_2/*.kicad_pcb | head -n 10 | grep modules | sed 's/(modules //g' | sed 's/)//g')
NETS2=$(cat $OUTPUT_DIR/$DIFF_2/*.kicad_pcb | head -n 10 | grep nets | sed 's/(nets //g' | sed 's/)//g')
#sed 's/(/<td><div class="th">/g' | sed 's/)/<\/td>/g')
cat >> $OUTPUT_DIR/$WEB_DIR/index.html <<HTML
<!DOCTYPE HTML>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>
<table style="border-color: #aaaaaa; width: 100%; height: 2px;" border="2px" cellspacing="2px" cellpadding="3px">
<tbody>
<tr>
<td colspan="6" width="256">
<h1>$CHANGED_KICAD_FILES
<h4>$TITLE
<h5>$DATE
<h5>$COMPANY
</td>
</tr>
<tr>
<td width="83">
<div class = "h3"><b>Version</b></div>
</td>
<td width="89">
<div class="h2 green">$DIFF_1</div>
</td>
<td width="89">
<div class="h2 red">$DIFF_2</div>
</td>
<td width="84">
<div class="h3">Thickness (mm)</div>
</td>
<td width="40">
<div class="h2 green">$THICK1 </div>
</td>
<td width="41">
<div class="h2 red">$THICK2 </div>
</td>
</tr>
<tr>
<td width="83">
<div class="h2">Date</div>
</td>
<td width="89">
<div class="h3">$DIFF_1_DATE</div>
</td>
<td width="89">
<div class="h3">$DIFF_2_DATE</div>
</td>
<td width="84">
<div class="h3">Drawings</div>
</td>
<td width="40">
<div class="h2 green">$DRAWINGS1</div>
</td>
<td width="41">
<div class="h2 red">$DRAWINGS2</div>
</td>
</tr>
<tr>
<td width="83">
<div class="h3"><strong>Time</div>
</td>
<td width="89">
<div class="h3">$DIFF_1_TIME</div>
</td>
<td width="89">
<div class="h3">$DIFF_2_TIME</div>
</td>
<td width="84">
<div class="h3">Tracks</div>
</td>
<td width="40">
<div class="h2 green">$TRACKS1</div>
</td>
<td width="41">
<div class="h2 red">$TRACKS2</div>
</td>
</tr>
<tr>
<td colspan="3" rowspan="3" width="261">
</td>
<td width="84">
<div class="h3">Zones</div>
</td>
<td width="40">
<div class="h2 green">$ZONES1</div>
</td>
<td width="41">
<div class="h2 red">$ZONES2</div>
</td>
</tr>
<tr>
<td width="84">
<div class="h3">Modules</div>
</td>
<td width="40">
<div class="h2 green">$MODULES1</div>
</td>
<td width="41">
<div class="h2 red">$MODULES2</div>
</td>
</tr>
<tr>
<td width="84">
<div class="h3">Nets</div>
</td>
<td width="40">
<div class="h2 green">$NETS1</div>
</td>
<td width="41">
<div class="h2 red">$NETS2</div>
</td>
</tr>
</tbody>
</table>
HTML
#cat ThermocoupleLogger.kicad_pcb grep $mod | head -n 10 | sed 's/(/<td><div class="th">/g' | sed 's/)/<\/td>/g'
for g in $OUTPUT_DIR/diff-$DIFF_1-$DIFF_2/*.png; do
# Attempt to force to same size to prevent gaps in page.
#convert $g -resize 300x245 -extent 300x245 -gravity center -background black $OUTPUT_DIR/$WEB_DIR/thumbs/th_$(basename $g)
convert $g -resize 300x245 -background black -gravity center -extent 300x245 $OUTPUT_DIR/$WEB_DIR/thumbs/th_$(basename $g)
#cp $g ./plots/thumbs/th_$(basename $g)
route=$g
file=${route##*/}
base=${file%.*}
# dir=$(dirname $g)
# echo $dir
cat >> $OUTPUT_DIR/$WEB_DIR/index.html <<HTML
<div class="responsive">
<div class="gallery">
<a target="_blank" href = tryptych/$(basename $g).html>
<img src = thumbs/th_$(basename $g) height="200">
</a>
<div class="desc">$base</div>
</div>
</div>
HTML
cat >>$OUTPUT_DIR/$WEB_DIR/tryptych/$(basename $g).html<<HTML
<!DOCTYPE HTML>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="../style.css" media="screen" />
<style>
div.responsive {
padding: 0 6px;
float: left;
width: 49.99%;
}
</style>
</head>
<body>
<h2>$base</h><br>
<div class="responsive">
<div class="gallery">
<a target="_blank" href = $(basename $g).html>
<a href= ../../$DIFF_1/$(basename $g)><img src = ../../$DIFF_1/$(basename $g) width="500"></a>
</a>
<div class="desc green">$DIFF_1</div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href = $(basename $g).html>
<a href= ../../$DIFF_2/$(basename $g)> <img src = ../../$DIFF_2/$(basename $g) width="500"></a>
</a>
<div class="desc red">$DIFF_2</div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href = $OUTPUT_DIR/$(basename $g).html>
<a href = ../../diff-$DIFF_1-$DIFF_2/$(basename $g) ><img src = ../../diff-$DIFF_1-$DIFF_2/$(basename $g) width="500"></a>
</a>
<div class="desc white">Composite</div>
</div>
</div>
HTML
d=$(basename $g)
y=${d%.png}
layerName=${y##*-}
mod=${layerName//[_]/.}
echo $mod
diff $OUTPUT_DIR/$DIFF_2/*.kicad_pcb $OUTPUT_DIR/$DIFF_1/*.kicad_pcb >> $OUTPUT_DIR/diff-$DIFF_1-$DIFF_2/diff.txt
diff $OUTPUT_DIR/$DIFF_2/*.kicad_pcb $OUTPUT_DIR/$DIFF_1/*.kicad_pcb | grep $mod | sed 's/> /<\/div><div class="differences added">/g' | sed 's/< /<\/div><div class="differences removed">/g' | sed 's/\/n/<\/div>/g' >> $OUTPUT_DIR/$WEB_DIR/tryptych/$(basename $g).html
# grep $mod | grep 'module' | sed 's/> /<div class="details">/g' | sed 's/< /<div class="details">/g' | sed 's/))/)<\/div>/g' >> $OUTPUT_DIR/$WEB_DIR/tryptych/$(basename $g).html
cat >>$OUTPUT_DIR/$WEB_DIR/tryptych/$(basename $g).html<<FOOT
<div class="clearfix"></div>
<div style="padding:6px;">
</div>
FOOT
done
cat >>$OUTPUT_DIR/$WEB_DIR/index.html<<FOOT
<div class="clearfix"></div>
<div style="padding:6px;">
</div>
FOOT
echo "HTML created and written to index.html"
open $OUTPUT_DIR/$WEB_DIR/index.html

View File

@ -4,13 +4,15 @@
# held in a suitable version control repository and produce a graphical diff
# of generated svg files in a web browser.
# TODO [ ] Place all template text/css text in external files
# TODO [ ] Improve display of artifacts in diff choice window
# TODO [ ] Consider changing GUI elements to wxPython
# TODO [*] Manage any missing SCM paths - reflect available SCM progs in splash screen
# TODO [ ] Adjust <div> for three pane output to have white outer border, not filter colour
# TODO [ ] Improve three pane output layout, perhaps with diff tree on LHS and not underneath
#
# TODO [ ] Place all template text/css text in external files.
# TODO [ ] Improve display of artifacts in diff choice window.
# TODO [ ] Consider changing GUI elements to wxPython.
# TODO [*] Manage any missing SCM paths - reflect available SCM progs in splash screen.
# TODO [ ] Adjust <div> for three pane output to have white outer border & pan-zoom control, not filter colour.
# TODO [ ] Improve three pane output layout, perhaps with diff tree on LHS and not underneath.
# DEBUG Tk window not being destroyed when closed.
# DEBUG Minor error with parsing FP_Text diff.
import os
import time
@ -82,8 +84,8 @@ Handler = http.server.SimpleHTTPRequestHandler
# ------------------------------------------HTML Template Blocks-------------------------------------------
#
# NOTE These should go into external files to clean up and seperate the code
#
# FIXME These should go into external files to clean up and seperate the code
tail = '''
<div class="clearfix"></div>
@ -652,6 +654,8 @@ a:hover {
}
'''
# ----------------------Main Functions begin here---------------------------------------
#
def getGitDiff(diff1, diff2, prjctName, prjctPath):
'''Given two git artifacts, write out two kicad_pcb files to their respective
directories (named after the artifact). Returns the date and time of both commits'''
@ -942,7 +946,9 @@ def getFossilDiff(diff1, diff2, prjctName, prjctPath):
def getProject():
'''File select dialogue. Opens Tk File browser and
selector set for .kicad_pcb files. Returns path and file name
'''
selected = tk.filedialog.askopenfile(
initialdir="~/",
title="Select kicad_pcb file in a VC directory",
@ -962,40 +968,7 @@ def getSCM(prjctPath):
scm = ''
# Check if git
if (gitProg != ''):
gitCmd = 'cd ' + prjctPath + ' && ' + gitProg + ' status'
git = Popen(
gitCmd,
shell=True,
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
close_fds=True)
stdout, stderr = git.communicate()
git.wait()
if ((stdout.decode('utf-8') != '') & (stderr.decode('utf-8') == '')):
scm = 'Git'
# check if Fossil
if (fossilProg != ''):
fossilCmd = 'cd ' + prjctPath + ' && ' + fossilProg + ' status'
fossil = Popen(
fossilCmd,
shell=True,
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
close_fds=True)
stdout, stderr = fossil.communicate()
fossil.wait()
print(stdout.decode('utf-8'),"stdERROR=", stderr.decode('utf-8'))
# if ((stdout.decode('utf-8') != '') & (stderr.decode('utf-8') == '')):
if (stdout.decode('utf-8') != ''):
scm = 'Fossil'
# check if SVN
# check if SVN program installed and then check if *.kicad_pcb is in a SVN checkout
if (svnProg != ''):
svnCmd = 'cd ' + prjctPath + ' && ' + svnProg + ' log | perl -l4svn log0pe "s/^-+/\n/"'
svn = Popen(
@ -1010,6 +983,37 @@ def getSCM(prjctPath):
if ((stdout.decode('utf-8') != '') & (stderr.decode('utf-8') == '')):
scm = 'SVN'
# check if Fossil program installed and then check if *.kicad_pcb is in a Fossil checkout
if (fossilProg != ''):
fossilCmd = 'cd ' + prjctPath + ' && ' + fossilProg + ' status'
fossil = Popen(
fossilCmd,
shell=True,
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
close_fds=True)
stdout, stderr = fossil.communicate()
fossil.wait()
# print(stdout.decode('utf-8'),"stdERROR=", stderr.decode('utf-8'))
if (stdout.decode('utf-8') != ''):
scm = 'Fossil'
# Check if Git program installed and then check if *.kicad_pcb is in a Git checkout
if (gitProg != ''):
gitCmd = 'cd ' + prjctPath + ' && ' + gitProg + ' status'
git = Popen(
gitCmd,
shell=True,
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
close_fds=True)
stdout, stderr = git.communicate()
git.wait()
if ((stdout.decode('utf-8') != '') & (stderr.decode('utf-8') == '')):
scm = 'Git'
return scm
@ -1081,7 +1085,7 @@ def svnDiff(path, kicadPCB):
return sArtifacts
def makeSVG(d1, d2, prjctName, prjctPath, reqLayers):
def makeSVG(d1, d2, prjctName, prjctPath):
'''Hands off required .kicad_pcb files to "plotPCB2.py"
and generate .svg files. Routine is
v quick so all layers are plotted to svg.'''
@ -1393,10 +1397,7 @@ def processDiff(diffText, mod):
"[\"]":r'',
"[**]":r'',
}
# (pad 25 thru_hole oval (at 7.62 7.62 90) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)
# "[0-9] smd":"<td>Surface</td>",
final =""
content = ""
output = ""
@ -1514,11 +1515,9 @@ if __name__ == "__main__":
gui.deiconify()
scm = getSCM(prjctPath)
print(scm)
gui.destroy()
if scm == 'Git':
artifacts = gitDiff(prjctPath, prjctName)
if scm == 'Fossil':
@ -1535,9 +1534,6 @@ if __name__ == "__main__":
print("Commit1", d1)
print("Commit2", d2)
#£TODO Remove this layer dependancy
selectedLayers = []
if scm == 'Git':
times = getGitDiff(d1, d2, prjctName, prjctPath)
if scm == 'Fossil':
@ -1550,7 +1546,7 @@ if __name__ == "__main__":
times = getSVNDiff(d1, d2, prjctName, prjctPath)
svgDir1, svgDir2, boardDims1, boardDims2 = makeSVG(d1, d2, prjctName, prjctPath, selectedLayers)
svgDir1, svgDir2, boardDims1, boardDims2 = makeSVG(d1, d2, prjctName, prjctPath)
makeSupportFiles(prjctName, prjctPath)

598
style.css
View File

@ -1,598 +0,0 @@
body
{
background-color: #002b36;
margin: 0 auto;
max-width: 45cm;
border: 1pt solid #586e75;
padding: 1em;
}
.gallery
{
border: 1px solid #ccc;
background-color: #222;
}
.gallery:hover
{
border: 1px solid #777;
}
.gallery img
{
width: 100%;
height: auto;
}
.desc,.title
{
padding: 15px;
text-align: center;
font: 15px arial,sans-serif;
}
.title
{
text-align: left;
font: 25px arial,sans-serif;
color: #202b34;
}
.details,.subtitle
{
padding: 5px;
text-align: left;
font: 20px arial,sans-serif;
color: #000;
}
.details
{
padding: 20px;
font: 15px arial,sans-serif;
}
.differences
{
font: 12px courier,monospace;
}
.differences,.td,.th
{
padding: 5px;
text-align: left;
color: #000;
}
.th
{
font-weight: 700;
font: 20px arial,sans-serif;
}
.td
{
font: 15px arial,sans-serif;
}
*
{
box-sizing: border-box;
}
.responsive
{
padding: 0 6px;
float: left;
width: 19.99999%;
margin: 6px 0;
}
@media only screen and (max-width:700px)
{
.responsive
{
width: 49.98%;
margin: 6px 0;
}
}
@media only screen and (max-width:500px)
{
.responsive
{
width: 100%;
margin: 6px 0;
}
}
.responsivefull {
padding: 0 6px;
float: left;
width: 100%;
margin: 6px 0;
}
.clearfix:after
{
content: "";
display: table;
clear: both;
}
.box
{
float: left;
width: 20px;
height: 20px;
margin: 5px;
border: 1px solid rgba(0,0,0,.2);
}
.red
{
background: #ba312d;
}
.green
{
background: #5eb6c4;
}
.white
{
background: #fff;
}
.added
{
color: #5eb6c4;
}
.removed
{
color: #ba312d;
}
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary
{
display: block;
}
audio,canvas,video
{
display: inline-block;
}
audio:not([controls])
{
display: none;
height: 0;
}
[hidden]
{
display: none;
}
html
{
-webkit-text-size-adjust: 80%;
-ms-text-size-adjust: 90%;
font-family: 'PT Sans',sans-serif;
background-color: #073642;
color: #e2e3e3;
margin: 1em;
}
a:focus
{
outline: thin dotted;
}
a:active,a:hover
{
outline: 0;
}
abbr[title]
{
border-bottom: 1px dotted;
}
b,strong
{
font-weight: 700;
}
dfn
{
font-style: italic;
}
mark
{
background: #ff0;
color: #000;
}
code,kbd,pre,samp
{
font-size: 1em;
}
kbd,samp
{
font-family: monospace,serif;
}
pre
{
white-space: pre-wrap;
word-wrap: break-word;
}
q
{
quotes: "\201C" "\201D" "\2018" "\2019";
}
small
{
font-size: 80%;
}
sub,sup
{
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup
{
top: -.5em;
}
sub
{
bottom: -.25em;
}
img
{
border: 0;
}
svg:not(:root)
{
overflow: visible;
}
.F_Cu
{
filter: invert(28%) sepia(50%) saturate(2065%) hue-rotate(334deg) brightness(73%) contrast(97%);
}
.B_Cu
{
filter: invert(44%) sepia(14%) saturate(2359%) hue-rotate(70deg) brightness(103%) contrast(82%);
}
.B_Paste
{
filter: invert(91%) sepia(47%) saturate(4033%) hue-rotate(139deg) brightness(82%) contrast(91%);
}
.F_Paste
{
filter: invert(57%) sepia(60%) saturate(6%) hue-rotate(314deg) brightness(92%) contrast(99%);
}
.F_SilkS
{
filter: invert(46%) sepia(44%) saturate(587%) hue-rotate(132deg) brightness(101%) contrast(85%);
}
.B_SilkS
{
filter: invert(14%) sepia(27%) saturate(2741%) hue-rotate(264deg) brightness(95%) contrast(102%);
}
.B_Mask
{
filter: invert(22%) sepia(56%) saturate(2652%) hue-rotate(277deg) brightness(94%) contrast(87%);
}
.F_Mask
{
filter: invert(27%) sepia(51%) saturate(1920%) hue-rotate(269deg) brightness(89%) contrast(96%);
}
.Edge_Cuts
{
filter: invert(79%) sepia(79%) saturate(401%) hue-rotate(6deg) brightness(88%) contrast(88%);
}
.Margin
{
filter: invert(74%) sepia(71%) saturate(5700%) hue-rotate(268deg) brightness(89%) contrast(84%);
}
.In1_Cu
{
filter: invert(69%) sepia(39%) saturate(1246%) hue-rotate(17deg) brightness(97%) contrast(104%);
}
.In2_Cu
{
filter: invert(14%) sepia(79%) saturate(5231%) hue-rotate(293deg) brightness(91%) contrast(119%);
}
.Dwgs_User
{
filter: invert(40%) sepia(68%) saturate(7431%) hue-rotate(203deg) brightness(89%) contrast(98%);
}
.Cmts_User
{
filter: invert(73%) sepia(10%) saturate(1901%) hue-rotate(171deg) brightness(95%) contrast(102%);
}
.Eco1_User
{
filter: invert(25%) sepia(98%) saturate(2882%) hue-rotate(109deg) brightness(90%) contrast(104%);
}
.Eco2_User
{
filter: invert(85%) sepia(21%) saturate(5099%) hue-rotate(12deg) brightness(91%) contrast(102%);
}
.B_Fab
{
filter: invert(60%) sepia(0%) saturate(0%) hue-rotate(253deg) brightness(87%) contrast(90%);
}
.F_Fab
{
filter: invert(71%) sepia(21%) saturate(4662%) hue-rotate(21deg) brightness(103%) contrast(100%);
}
.B_Adhes
{
filter: invert(24%) sepia(48%) saturate(2586%) hue-rotate(218deg) brightness(88%) contrast(92%);
}
.F_Adhes
{
filter: invert(38%) sepia(49%) saturate(1009%) hue-rotate(254deg) brightness(88%) contrast(86%);
}
.B_CrtYd
{
filter: invert(79%) sepia(92%) saturate(322%) hue-rotate(3deg) brightness(89%) contrast(92%);
}
.F_CrtYd
{
filter: invert(73%) sepia(1%) saturate(0%) hue-rotate(116deg) brightness(92%) contrast(91%);
}
.section
{
margin: 0 0 1em;
}
figure
{
margin: 0;
}
fieldset
{
border: 1px solid silver;
margin: 0 2px;
padding: .35em .625em .75em;
}
legend
{
border: 0;
padding: 0;
}
button,input,select,textarea
{
font-family: inherit;
font-size: 100%;
margin: 0;
}
button,input
{
line-height: normal;
}
button,html input[type=button],input[type=reset],input[type=submit]
{
-webkit-appearance: button;
cursor: pointer;
}
button[disabled],input[disabled]
{
cursor: default;
}
input[type=checkbox],input[type=radio]
{
box-sizing: border-box;
padding: 0;
}
input[type=search]
{
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration
{
-webkit-appearance: none;
}
button::-moz-focus-inner,input::-moz-focus-inner
{
border: 0;
padding: 0;
}
textarea
{
overflow: auto;
vertical-align: top;
}
table
{
border-collapse: collapse;
border-spacing: 0;
}
code,pre
{
font-family: 'Inconsolata',sans-serif;
}
h1,h2,h3,h4,h5,h6
{
font-family: 'PT Sans Narrow',sans-serif;
font-weight: 400;
}
code
{
background-color: #073642;
padding: 2px;
}
a
{
color: #b58900;
}
a:hover,a:visited
{
color: #cb4b16;
}
.tag,h1
{
color: #d33682;
}
h1
{
font-size: 2.4em;
}
h2,h3,h4,h5,h6
{
color: #859900;
}
pre
{
color: #839496;
border: 1pt solid #586e75;
padding: 1em;
box-shadow: 5pt 5pt 8pt #073642;
}
pre,pre code
{
background-color: #002b36;
}
h2
{
font-size: 2em;
}
h3
{
font-size: 1.1em;
}
h4
{
font-size: 1.0em;
}
h5
{
font-size: 0.9em;
}
h6
{
font-size: .8em;
}
.tag
{
background-color: #073642;
padding: 0 .2em;
}
.done,.next,.todo
{
color: #002b36;
background-color: #dc322f;
padding: 0 .2em;
}
.tag
{
-webkit-border-radius: .35em;
-moz-border-radius: .35em;
border-radius: .35em;
}
.ACTIVE,.CANCELLED,.DONE,.HOLD,.NEXT,.NOTE,.TODO,.WAITING
{
-webkit-border-radius: .2em;
-moz-border-radius: .2em;
border-radius: .2em;
background-color: #2aa198;
}
.ACTIVE,.CANCELLED,.DONE,.HOLD,.NEXT,.NOTE,.WAITING
{
background-color: #268bd2;
}
.CANCELLED,.DONE,.HOLD,.NOTE,.WAITING
{
background-color: #859900;
}
.CANCELLED,.HOLD,.NOTE,.WAITING
{
background-color: #cb4b16;
}
.CANCELLED,.HOLD,.NOTE
{
background-color: #d33682;
}
.CANCELLED
{
background-color: #859900;
}

13
temp
View File

@ -1,13 +0,0 @@
</div><div class="differences added"> (fp_line (start 23.25 -1.7) (end 25.05 -1.7) (layer F.SilkS) (width 0.12))
</div><div class="differences added"> (fp_line (start 25.05 -1.7) (end 25.05 -2.45) (layer F.SilkS) (width 0.12))
</div><div class="differences added"> (fp_line (start 25.05 -2.45) (end 23.25 -2.45) (layer F.SilkS) (width 0.12))
</div><div class="differences removed"> (fp_line (start -1.8 2.75) (end 13.75 2.75) (layer F.SilkS) (width 0.12))
</div><div class="differences removed"> (fp_line (start 30.05 -0.2) (end 29.3 -0.2) (layer F.SilkS) (width 0.12))
</div><div class="differences removed"> (fp_line (start 29.3 -0.2) (end 29.3 2.75) (layer F.SilkS) (width 0.12))
</div><div class="differences removed"> (fp_line (start 29.3 2.75) (end 13.75 2.75) (layer F.SilkS) (width 0.12))
</div><div class="differences added"> (fp_line (start -1.8 2.75) (end 11.25 2.75) (layer F.SilkS) (width 0.12))
</div><div class="differences added"> (fp_line (start 25.05 -0.2) (end 24.3 -0.2) (layer F.SilkS) (width 0.12))
</div><div class="differences added"> (fp_line (start 24.3 -0.2) (end 24.3 2.75) (layer F.SilkS) (width 0.12))
</div><div class="differences added"> (fp_line (start 24.3 2.75) (end 11.25 2.75) (layer F.SilkS) (width 0.12))
</div><div class="differences removed"> (fp_text reference C13 (at 0 -1.65 270) (layer F.SilkS)
</div><div class="differences added"> (fp_text reference C13 (at 0 -1.65) (layer F.SilkS)

22
tkUI.py
View File

@ -10,19 +10,11 @@ global root, commitTop, commitBottom
def runProgram():
# Just break out of mainloop to return current variables
root.quit()
root.destroy()
# class Splash(tk.Toplevel):
# def __init__(self, parent):
# tk.Toplevel.__init__(self, parent)
# self.title("Kicad Visual Diff")
# action = messagebox.askokcancel(self,
# message="Select a *.kicad_pcb file under version control", detail="Git, Fossil or SVN supported")
# self.update()
# if action == "cancel":
# self.quit()
def quit():
root.destroy()
def CurSelect(event):
@ -81,8 +73,8 @@ def runGUI(checkouts_top, prjctName, prjctPath, scm):
commitTop = Variable()
listTop = Listbox(
frame2,
bd=0,
frame2,
bd=0,
selectmode=SINGLE,
exportselection=False,
font='TkFixedFont')
@ -148,5 +140,5 @@ def runGUI(checkouts_top, prjctName, prjctPath, scm):
root.update()
root.mainloop()
return(commitTop, commitBottom)
return (commitTop, commitBottom)
root.destroy()