17 from datetime
import tzinfo, timedelta, datetime
18 from dateutil
import parser
32 from matplotlib.backends.backend_gtkcairo
import FigureCanvasGTKCairo
as FigureCanvas
33 from matplotlib.figure
import Figure
35 from ModelFactory
import ModelFactory
36 from Experiment
import Experiment
54 ModelFactory.addFactory(factory)
57 gladefile = __file__.replace(
".py",
".xml")
58 self.
wTree = gtk.glade.XML(gladefile)
66 self.
wTree.signal_autoconnect(dic)
67 window = self.
wTree.get_widget(
"window")
68 window.set_title(ModelFactory.title(self.
model) +
" experiment's browser")
77 comboexpe = self.
wTree.get_widget(
"comboexpe")
80 comboexpe.remove_text(0)
82 comboexpe.append_text(expe)
85 self.
plt = ModelFactory.createPlot(self.
model)
93 comboexpe.set_active(0)
110 now = time.mktime(time.localtime())
111 strNow = time.strftime(
"%Y-%m-%d-%H:%M:%S", time.gmtime(now))
112 pngFile = os.environ[
"HOME"] +
'/Images/' + strNow +
'.png' 113 self.
plt.getFigure().savefig(pngFile)
114 except ValueError, Argument:
115 print "Error in export pdf:", Argument
122 radio = self.
wTree.get_widget(
"animRefTime")
123 if radio.get_active()
is True:
124 combo = self.
wTree.get_widget(
"combodate")
127 combo = self.
wTree.get_widget(
"comboterm")
131 num = combo.get_active()
132 combo.set_active(num + 1)
136 if widget.get_active()
is True:
149 combodate = self.
wTree.get_widget(
"combodate")
150 oldDate = combodate.get_active_text()
151 for i
in range(0, self.
nDates):
152 combodate.remove_text(0)
164 if obsFile
is not None:
165 self.
odb = ModelFactory.createOdb(self.
model, self.
fdbdir +
'/' + os.path.split(obsFile)[1])
170 for d
in self.
fdb.getTimeList(self.
output):
171 combodate.append_text(d)
176 combodate.set_active(numOldDate)
177 except ValueError, Argument:
179 print "Error fired here !!", Argument
191 comboexpe = self.
wTree.get_widget(
"comboexpe")
192 comboterm = self.
wTree.get_widget(
"comboterm")
193 oldTerm = comboterm.get_active_text()
195 for i
in range(0, self.
nTerms):
196 comboterm.remove_text(0)
199 date = widget.get_active_text()
205 mData = self.
fdb.getMetaData()
206 arr = mData[self.
output][date]
209 comboterm.append_text(
"/")
213 comboterm.append_text(t)
218 comboterm.set_active(numOldTerm)
220 except ValueError, Argument:
222 print "Error fired here !!", Argument
235 comboexpe = self.
wTree.get_widget(
"comboexpe")
236 combodate = self.
wTree.get_widget(
"combodate")
237 if widget.get_active_text()
is None:
240 if comboexpe.get_active_text()
is None:
243 if combodate.get_active_text()
is None:
248 if widget.get_active_text() ==
"/":
249 expe = self.
output +
"." + combodate.get_active_text()
251 self.
termTitle = widget.get_active_text()
252 expe = self.
output +
"." + combodate.get_active_text() +
"." + widget.get_active_text()
260 except ValueError, Argument:
262 print "Error fired here !!", Argument
292 if self.
odb is not None:
293 obsData = self.
odb.getXYAt(self.
expeData[
"validTime"],
"ObsVal")
301 self.
plt.setPlot(title, expeData, bgData, obsData)
def onPngClicked(self, widget)
def onSelectDate(self, widget)
def onToggleAnim(self, widget)
def __init__(self, factory, expDir, fdbDir)
def onSelectTerm(self, widget)
def onQuitClicked(self, widget)
def onSelectExpe(self, widget)