[cig-commits] r11818 - in cs/portal/trunk/seismo/SeismoWebPortal: . designs/plone static/pics static/pics/th templates/SeismoWebPortal
leif at geodynamics.org
leif at geodynamics.org
Tue Apr 15 15:53:53 PDT 2008
Author: leif
Date: 2008-04-15 15:53:53 -0700 (Tue, 15 Apr 2008)
New Revision: 11818
Added:
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/attenuation.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/ellipticity.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/gravity.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/i_c_toroidal.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/oceans.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/radial.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/receivers_at_depth.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/rotation.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/sampling_period.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/spheroidal.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/topography.gif
cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/toroidal.gif
cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/seismogram_table.html
Modified:
cs/portal/trunk/seismo/SeismoWebPortal/designs/plone/style.css
cs/portal/trunk/seismo/SeismoWebPortal/designs/plone/style.py
cs/portal/trunk/seismo/SeismoWebPortal/models.py
cs/portal/trunk/seismo/SeismoWebPortal/views.py
Log:
Dressed-up the seismogram table.
Modified: cs/portal/trunk/seismo/SeismoWebPortal/designs/plone/style.css
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/designs/plone/style.css 2008-04-15 18:07:08 UTC (rev 11817)
+++ cs/portal/trunk/seismo/SeismoWebPortal/designs/plone/style.css 2008-04-15 22:53:53 UTC (rev 11818)
@@ -345,14 +345,18 @@
/* tables */
table.cool {
- border: thin solid black;
+ border: 1px solid black;
}
table.cool caption {
- font-size: large;
background-color: #ccf;
+ border: 1px solid black;
}
+table.cool tbody {
+ border-top: 1px solid black;
+}
+
table.cool .even {
background-color: #eef;
}
@@ -372,7 +376,7 @@
table.cool th.colgroup {
text-align: center;
background-color: #ffd;
- border-bottom: thin dotted purple;
+ border-bottom: 1px dotted purple;
}
table.cool td {
Modified: cs/portal/trunk/seismo/SeismoWebPortal/designs/plone/style.py
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/designs/plone/style.py 2008-04-15 18:07:08 UTC (rev 11817)
+++ cs/portal/trunk/seismo/SeismoWebPortal/designs/plone/style.py 2008-04-15 22:53:53 UTC (rev 11818)
@@ -33,10 +33,10 @@
currentTime=time.time
__CHEETAH_version__ = '2.0rc7'
__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 7)
-__CHEETAH_genTime__ = 1207967402.526777
-__CHEETAH_genTimestamp__ = 'Fri Apr 11 19:30:02 2008'
+__CHEETAH_genTime__ = 1208286939.0294361
+__CHEETAH_genTimestamp__ = 'Tue Apr 15 12:15:39 2008'
__CHEETAH_src__ = 'style.css'
-__CHEETAH_srcLastModified__ = 'Fri Apr 11 19:29:56 2008'
+__CHEETAH_srcLastModified__ = 'Tue Apr 15 12:15:34 2008'
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -430,14 +430,18 @@
/* tables */
table.cool {
- border: thin solid black;
+ border: 1px solid black;
}
table.cool caption {
- font-size: large;
background-color: #ccf;
+ border: 1px solid black;
}
+table.cool tbody {
+ border-top: 1px solid black;
+}
+
table.cool .even {
background-color: #eef;
}
@@ -457,7 +461,7 @@
table.cool th.colgroup {
text-align: center;
background-color: #ffd;
- border-bottom: thin dotted purple;
+ border-bottom: 1px dotted purple;
}
table.cool td {
@@ -486,15 +490,15 @@
span.True:before {
content: url(''')
- _v = VFFSL(SL,"root",True) # '$root' on line 403, col 18
- if _v is not None: write(_filter(_v, rawExpr='$root')) # from line 403, col 18.
+ _v = VFFSL(SL,"root",True) # '$root' on line 407, col 18
+ if _v is not None: write(_filter(_v, rawExpr='$root')) # from line 407, col 18.
write('''/pics/icon-yes.gif) " ";
}
span.False:before {
content: url(''')
- _v = VFFSL(SL,"root",True) # '$root' on line 407, col 18
- if _v is not None: write(_filter(_v, rawExpr='$root')) # from line 407, col 18.
+ _v = VFFSL(SL,"root",True) # '$root' on line 411, col 18
+ if _v is not None: write(_filter(_v, rawExpr='$root')) # from line 411, col 18.
write('''/pics/icon-no.gif) " ";
}
Modified: cs/portal/trunk/seismo/SeismoWebPortal/models.py
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/models.py 2008-04-15 18:07:08 UTC (rev 11817)
+++ cs/portal/trunk/seismo/SeismoWebPortal/models.py 2008-04-15 22:53:53 UTC (rev 11818)
@@ -587,7 +587,6 @@
return p
code = 1 # cf. CODE_CHOICES
- offering = "3D Synthetics by Specfem 3D Globe"
@classmethod
def canHandleEvent(cls, event):
@@ -762,7 +761,6 @@
return p
code = 2 # cf. CODE_CHOICES
- offering = "1D Synthetics by Mineos"
@classmethod
def canHandleEvent(cls, event):
@@ -876,6 +874,13 @@
started = models.DateTimeField(auto_now_add=True, editable=False)
finished = models.DateTimeField(null=True, blank=True)
+ def outputList(self):
+ l = []
+ for job in self.job_set.all():
+ for file in job.outputfile_set.all():
+ l.append(file)
+ return l
+
class Admin:
list_display = ('status', 'started', 'finished')
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/attenuation.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/attenuation.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/ellipticity.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/ellipticity.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/gravity.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/gravity.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/i_c_toroidal.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/i_c_toroidal.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/oceans.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/oceans.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/radial.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/radial.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/receivers_at_depth.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/receivers_at_depth.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/rotation.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/rotation.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/sampling_period.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/sampling_period.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/spheroidal.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/spheroidal.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/topography.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/topography.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/toroidal.gif
===================================================================
(Binary files differ)
Property changes on: cs/portal/trunk/seismo/SeismoWebPortal/static/pics/th/toroidal.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/seismogram_table.html
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/seismogram_table.html (rev 0)
+++ cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/seismogram_table.html 2008-04-15 22:53:53 UTC (rev 11818)
@@ -0,0 +1,136 @@
+
+<h2>Seismograms - {{ workspace }}</h2>
+
+<table border=0 class=infobar width="100%"><tr>
+ <td align=left><b>station list:</b> <a href="{{workspace.stations.fsNode.url}}">{{ workspace.stations }}</a></td>
+ <td align=left><b>record length:</b> >= {{ workspace.record_length }} minutes</td>
+
+ <td align=left>
+ <img src="{{ root }}/pics/icon-{% if workspace.zero_half_duration %}yes{% else %}no{% endif %}.gif" alt="{{ workspace.zero_half_duration }}">
+ zero half duration
+ </td>
+
+ <td align=left><a href="settings/">Edit...</a></td>
+</tr></table>
+
+<table border=0 cellpadding=8><tr>
+
+{% if mineos_parameter_set_list %}
+<td><table rules=cols class=cool width="100%">
+ <caption>1D Synthetics by Mineos</caption>
+ <thead>
+ <tr>
+ <th rowspan=3 valign=bottom>model</th>
+ <th rowspan=3 valign=bottom>mode catalog</th>
+ <th colspan=4 valign=bottom>oscillations</th>
+ <th colspan=2 rowspan=2 valign=bottom><center>select<br>frequency<br>range<br><small>(mHz)</small></center></th>
+ <th rowspan=3 valign=bottom><img src="{{root}}/pics/th/sampling_period.gif" width=12 height=97 align=bottom></th>
+ <th rowspan=3 valign=bottom>data</th>
+ </tr>
+ <tr>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/radial.gif" width=12 height=29 align=bottom></th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/toroidal.gif" width=12 height=40 align=bottom></th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/spheroidal.gif" width=12 height=52 align=bottom></th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/i_c_toroidal.gif" width=12 height=92 align=bottom></th>
+ </tr>
+ <tr>
+ <th valign=bottom><small>min</small></th>
+ <th valign=bottom><small>max</small></th>
+ </tr>
+ </thead>
+
+ <tbody>
+ {% for ps in mineos_parameter_set_list %}
+ <tr class="{% cycle odd,even %}">
+ <td>{{ ps.model }}</td>
+ <td>{{ ps.catalog }}</td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.radial %}yes{% else %}no{% endif %}.gif" alt="{{ ps.radial }}"></td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.toroidal %}yes{% else %}no{% endif %}.gif" alt="{{ ps.toroidal }}"></td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.spheroidal %}yes{% else %}no{% endif %}.gif" alt="{{ ps.spheroidal }}"></td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.ictoroidal %}yes{% else %}no{% endif %}.gif" alt="{{ ps.ictoroidal }}"></td>
+ <td>{{ ps.fmin }}</td>
+ <td>{{ ps.fmax }}</td>
+ <td>{{ ps.step }}</td>
+
+ <td>
+ {% if ps.request %}
+ {% if ps.request.run.outputList %}
+ <ul class=output>
+ {% for file in ps.request.run.outputList %}
+ <li><a href="{{ file.url }}">{{ file.name }}</a>
+ {% endfor %}
+ </ul>
+ {% else %}
+ {{ ps.request.run.status }}
+ {% endif %}
+ {% else %}
+ {{ ps.requestForm }}
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table></td>
+{% endif %}
+
+</tr><tr>
+
+{% if specfem3dglobe_parameter_set_list %}
+<td><table rules=cols class=cool width="100%">
+ <caption>3D Synthetics by Specfem 3D Globe</caption>
+ <thead>
+ <tr>
+ <th colspan=7 valign=bottom>model</th>
+ <th valign=bottom rowspan=3>mesh</th>
+ <th valign=bottom rowspan=3><img src="{{root}}/pics/th/receivers_at_depth.gif" width=12 height=92 align=bottom></th>
+ <th rowspan=3 valign=bottom>data</th>
+ </tr>
+ <tr>
+ <th valign=bottom rowspan=2>type</th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/oceans.gif" width=12 height=35 align=bottom></th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/gravity.gif" width=12height=37 align=bottom></th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/attenuation.gif" width=12 height=61 align=bottom></th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/topography.gif" width=12 height=58 align=bottom></th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/rotation.gif" width=12 height=42 align=bottom></th>
+ <th valign=bottom rowspan=2><img src="{{root}}/pics/th/ellipticity.gif" width=12 height=49 align=bottom></th>
+ </tr>
+ <tr>
+ </tr>
+ </thead>
+
+ <tbody>
+ {% for ps in specfem3dglobe_parameter_set_list %}
+ <tr class="{% cycle odd,even %}">
+ <td>{{ ps.model.get_type_display }}</td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.model.oceans %}yes{% else %}no{% endif %}.gif" alt="{{ ps.model.oceans }}"></td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.model.gravity %}yes{% else %}no{% endif %}.gif" alt="{{ ps.model.gravity }}"></td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.model.attenuation %}yes{% else %}no{% endif %}.gif" alt="{{ ps.model.attenuation }}"></td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.model.topography %}yes{% else %}no{% endif %}.gif" alt="{{ ps.model.topography }}"></td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.model.rotation %}yes{% else %}no{% endif %}.gif" alt="{{ ps.model.rotation }}"></td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.model.ellipticity %}yes{% else %}no{% endif %}.gif" alt="{{ ps.model.ellipticity }}"></td>
+ <td>{{ ps.mesh }}</td>
+ <td><img src="{{ root }}/pics/icon-{% if ps.receivers_can_be_buried %}yes{% else %}no{% endif %}.gif" alt="{{ ps.receivers_can_be_buried }}"></td>
+
+ <td>
+ {% if ps.request %}
+ {% if ps.request.run.outputList %}
+ <ul class=output>
+ {% for file in ps.request.run.outputList %}
+ <li><a href="{{ file.url }}">{{ file.name }}</a>
+ {% endfor %}
+ </ul>
+ {% else %}
+ {{ ps.request.run.status }}
+ {% endif %}
+ {% else %}
+ {{ ps.requestForm }}
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+</td>
+{% endif %}
+
+</tr></table>
Modified: cs/portal/trunk/seismo/SeismoWebPortal/views.py
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/views.py 2008-04-15 18:07:08 UTC (rev 11817)
+++ cs/portal/trunk/seismo/SeismoWebPortal/views.py 2008-04-15 22:53:53 UTC (rev 11818)
@@ -16,7 +16,7 @@
from models import Specfem3DGlobeModel, Specfem3DGlobeMesh, Specfem3DGlobeParameters
from models import MineosModeCatalog, MineosModel, MineosParameters
from models import Run, Job, OutputFile
-from models import FSNode, Folder
+from models import FSNode, Folder, userFSChoices
from models import EventWorkspace, Request
from models import CMTSolution as CMTSolutionModel
from cmt import CMTSolution
@@ -1234,7 +1234,7 @@
appWindow = desktop.eventViewers[workspace.id]
appWindow.root.appendNodes([
- gui.Directory("seismograms", "Seismograms", [], url = url),
+ gui.File("seismograms", "Seismograms", url = url),
sources,
gui.Directory("maps", "Maps", [], url = url + "maps/"),
gui.File("settings", "Settings", url = url + "settings/"),
@@ -1302,69 +1302,52 @@
config.root, config.root, offset)
-def runOutputList(run):
- html = ''
- for job in run.job_set.all():
- for file in job.outputfile_set.all():
- html += '<li><a href="%s">%s</a>' % (file.url(), file.name)
- return '<ul class=output>%s</ul>' % html
-
-
def seismogramTable(workspace, url, request, path, appWindow, desktop):
+ from django.template import Context
event = workspace.event
seismogramsIcon = appWindow.root.contents[0]
appWindow.path.append(seismogramsIcon)
- window = gui.ChildWindow(url, "Seismograms")
+ window = gui.ChildWindow(url, "View")
desktop.activeWindow.insertWindow(window)
- html = StringIO()
- print >>html, '<h2>%s - Seismograms</h2>' % workspace
- if False:
- print >>html, progressBar(0.25)
- print >>html, progressBar(0.5)
- print >>html, progressBar(1.0)
+ parameterClasses = []
+ for ParameterClass in [MineosParameters, Specfem3DGlobeParameters]:
+ if not ParameterClass.canHandleEvent(event):
+ continue
+ parameterClasses.append(ParameterClass)
- parameterClasses = [MineosParameters, Specfem3DGlobeParameters]
-
+ parameterSetList = {}
requests = {}
+
for ParameterClass in parameterClasses:
+ parameterSetList[ParameterClass] = [ps for ps in ParameterClass.objects.filter(userFSChoices)]
requests[ParameterClass.code] = []
+
for request in Request.objects.filter(event = requestEventId(event),
stations = workspace.stations,
record_length__gte = workspace.record_length):
requests[request.code].append(request)
+ # Pair each parameter set with matching requests, if any.
for ParameterClass in parameterClasses:
- if not ParameterClass.canHandleEvent(event):
- continue
- print >>html, '<h3>%s</h3>' % ParameterClass.offering
- print >>html, '<table rules="groups" class="cool">'
- print >>html, '<thead>'
- print >>html, '<tr><th>parameter set</th><th>status</th><th></th><th>output</th></tr>'
- print >>html, '</thead>'
- print >>html, '<tbody>'
- for i, ps in enumerate(ParameterClass.objects.all()):
- status = '<td>unavailable</td><td>%s</td>' % requestForm(workspace, ps)
- output = '<td></td>'
+ for ps in parameterSetList[ParameterClass]:
parameters = ps.snapshot(workspace)
+ ps.request = None
+ ps.requestForm = requestForm(workspace, ps)
for request in requests[ParameterClass.code]:
if request.parameters == parameters:
- run = request.run
- status = '<td colspan=2>%s</td>' % run.status
- output = '<td>%s</td>' % runOutputList(run)
- break
- print >>html, '<tr class=%s><td><a href="%s">%s</a></td>%s%s</tr>' % (
- (i % 2 and 'even' or 'odd'), ps.fsNode.url(), ps, status, output)
- print >>html, '</tbody>'
- print >>html, '</table>'
+ ps.request = request
- print >>html, "<p></p>"
-
- window.content = gui.StaticContent(html.getvalue())
+ t = loader.get_template('SeismoWebPortal/seismogram_table.html')
+ c = Context({'root': config.root,
+ 'workspace': workspace,
+ 'mineos_parameter_set_list': parameterSetList.get(MineosParameters),
+ 'specfem3dglobe_parameter_set_list': parameterSetList.get(Specfem3DGlobeParameters),
+ })
+ window.content = gui.StaticContent(t.render(c))
desktop.activeWindow.selectWindow(window)
-
return desktop
More information about the cig-commits
mailing list