From 24cd1e99faf93d64019588d8344d8f89036088b0 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 13 May 2013 12:54:51 -0400 Subject: progress --- octopart.py | 2 +- partdb.py | 1 + static/style.css | 55 +++++++++++++++++++++++++++++++++++++++++++++++------ templates/grid.html | 39 +++++++++++++++++++++++++++---------- xilinx.py | 4 ++-- 5 files changed, 82 insertions(+), 19 deletions(-) diff --git a/octopart.py b/octopart.py index 106a69f..e992951 100644 --- a/octopart.py +++ b/octopart.py @@ -32,7 +32,7 @@ def fetch_bom(bom): for result in results: pid = result['reference'] - print "len(items[%s]): %d" % (pid, len(result['items'])) + #print "len(items[%s]): %d" % (pid, len(result['items'])) if len(result['items']) == 0: reply[pid] = None else: diff --git a/partdb.py b/partdb.py index 379bfd6..d838cee 100644 --- a/partdb.py +++ b/partdb.py @@ -8,6 +8,7 @@ import settings import octopart today = datetime.datetime.utcnow().strftime("%Y%m%d") +#today = "20130510" def safe(s): #TODO: this return s.lower() diff --git a/static/style.css b/static/style.css index 4b9f896..c798b78 100644 --- a/static/style.css +++ b/static/style.css @@ -12,26 +12,69 @@ h1 { border: 4px solid orange; color:red; } -table { - border: 1px solid black; +table.grid { border-collapse: collapse; border-spacing:2px; + font-size: 10pt; + width: 1200px; } th, td { border-width: 1px; border-style: inset; - border-color: gray; + border-color: white; padding: 2px; text-align: center; } - +tr.evenrow td { + background-color: #CCC; + } +tr.oddrow td { + background-color: #DDD; + } +tr.strongrow th { + background-color: #999; + font-size: 1.2em; + } +tr.strongrow td { + background-color: #999; + } +th.colheader { + background-color: #BBB; + text-align: right; + width: 300px; + padding-right: 4px; + vertical-align: top; + } td.outofstock a { color: #000; - font-size: 1.2em; text-decoration: none; } td.available a { color: #000; - font-size: 1.2em; text-decoration: none; } +tr.allparts { + vertical-align: top; + } +tr.allparts a { + color: #000; + text-decoration: none; + } +.fineprint { + border-top: 2px solid black; + margin-top: 25px; + padding-top: 5px; + font-size: 8pt; + font-style: italic; + } +table.sharedspecs { + border-collapse: collapse; + border-spacing:2px; + font-size: 10pt; + } +table.sharedspecs th { + text-align: right; + } +table.sharedspecs td { + text-align: left; + } diff --git a/templates/grid.html b/templates/grid.html index 3a4c71e..37f62d6 100644 --- a/templates/grid.html +++ b/templates/grid.html @@ -3,22 +3,31 @@ {% block content %}

{{ grid.vendor }} {{ grid.familyname }}

+ {% for spec in grid.shared_specs %} - {{ spec }}: {{ grid.shared_specs[spec] }}
+ + + {% endfor %} +
{{ spec }}{{ grid.shared_specs[spec] }}

- +
{% for row in grid.data_table %} - + {% for cell in row %} - + {% if loop.first %} + + {% else %} + + {% endif %} {% endfor %} + {% if loop.first %}{% endif %} {% endfor %} - - + + {% for cell in grid.price_row %} {% for row in grid.package_table %} - + {% for cell in row %} - + {% if loop.first %} + + {% else %} + + {% endif %} {% endfor %} {% endfor %} - - + + {% for cell in grid.suffix_row %}
{{ cell[1] }}{{ cell[1] }}{{ cell[1] }}
Price:
Price {% if cell.url %}{% endif %} @@ -29,15 +38,19 @@
{{ cell }}Pins in {{ cell }} Package{{ cell }}
All Parts:
All Parts {% for part in cell %} @@ -50,4 +63,10 @@
+ +
+Fineprint: Prices from Octopart API and only +include "authorized" distributors, regardless of stock. Some distributors +(Avnet?) do not allow their pricing to be included in the API results. +
{% endblock %} diff --git a/xilinx.py b/xilinx.py index ece0db7..872b3b5 100644 --- a/xilinx.py +++ b/xilinx.py @@ -24,7 +24,7 @@ def process_csv(data_path, shared_path, speed_grades, temp_grade): package_table = raw_data[split_row+1:] prefix_list = raw_data[0][1:] - # need to infill sparse prefix_lists (eg, xilinx zynq) + # infill sparse prefix_lists (eg, for xilinx zynq) last = None for i in range(len(prefix_list)): if not prefix_list[i]: @@ -55,7 +55,7 @@ def process_csv(data_path, shared_path, speed_grades, temp_grade): row = [[1, raw_row[0]], ] for raw_cell in raw_row[1:]: if raw_cell: - row.append([1, raw_cell]) + row.append([1, raw_cell.replace('n/a', '-')]) else: row[-1][0] += 1 data_table.append(row) -- cgit v1.2.3