aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--octopart.py2
-rw-r--r--partdb.py1
-rw-r--r--static/style.css55
-rw-r--r--templates/grid.html39
-rw-r--r--xilinx.py4
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 %}
<h1>{{ grid.vendor }} {{ grid.familyname }}</h1>
+<table class="sharedspecs">
{% for spec in grid.shared_specs %}
- <b>{{ spec }}:</b> {{ grid.shared_specs[spec] }}<br>
+ <tr><th>{{ spec }}</th>
+ <td>{{ grid.shared_specs[spec] }}</td>
+ </tr>
{% endfor %}
+</table>
<br>
-<table>
+<table class="grid">
{% for row in grid.data_table %}
-<tr>
+<tr class="{{ loop.cycle("evenrow", "oddrow") }} {% if loop.first %}strongrow{% endif %}">
{% for cell in row %}
- <td colspan="{{ cell[0] }}">{{ cell[1] }}</td>
+ {% if loop.first %}
+ <th class="colheader" colspan="{{ cell[0] }}">{{ cell[1] }}</th>
+ {% else %}
+ <td colspan="{{ cell[0] }}">{{ cell[1] }}</td>
+ {% endif %}
{% endfor %}
+ {% if loop.first %}</span>{% endif %}
</tr>
{% endfor %}
-<tr>
-<td>Price: </td>
+<tr class="strongrow">
+<th class="colheader">Price</th>
{% for cell in grid.price_row %}
<td class="{{ cell.css }}">
{% if cell.url %}<a href="{{ cell.url }}">{% endif %}
@@ -29,15 +38,19 @@
</tr>
{% for row in grid.package_table %}
-<tr>
+<tr class="{{ loop.cycle("evenrow", "oddrow") }}">
{% for cell in row %}
- <td>{{ cell }}</td>
+ {% if loop.first %}
+ <th class="colheader">Pins in {{ cell }} Package</th>
+ {% else %}
+ <td>{{ cell }}</td>
+ {% endif %}
{% endfor %}
</tr>
{% endfor %}
-<tr>
-<td>All Parts: </td>
+<tr class="strongrow allparts">
+<th class="colheader">All Parts</th>
{% for cell in grid.suffix_row %}
<td>
{% for part in cell %}
@@ -50,4 +63,10 @@
</tr>
</table>
+
+<div class="fineprint">
+Fineprint: Prices from <a href="http://octopart.com">Octopart</a> API and only
+include "authorized" distributors, regardless of stock. Some distributors
+(Avnet?) do not allow their pricing to be included in the API results.
+</div>
{% 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)