def __init__(self, format="%d/%m/%Y", required=False): #def __init__(self, format=text, required=False): #if len(self) == 8: #self.format="%d%m%Y" #else: #self.format="%d%m%y" self.format = format Field.__init__(self, required=required)
def _show_contents(self, name, annotate): #---------------------------------------- repo = options.repository title = 'Recordings in %s' % repo.uri if name: uri = name recording = repo.get_recording(uri, open_dataset=False) if recording is None: ## Not part of a recording, so return RDF self.set_header('Content-Type', rdf.Format.RDFXML) self.write(repo.describe(uri, format=rdf.Format.RDFXML)) return selectedsig = None if str(recording.uri) != uri: if repo.has_signal(uri): selectedsig = uri uri = str(recording.uri) # By now we should have all of recording's RDF as a Graph so we # can use this to get events, annotations, etc, etc ## Is sending tree each time, that then has JScript setting up tooltips ## a cause of connection closed problems...??? kwds = dict(title=title, bodytitle=uri, style='signal', tree=self._xmltree(repo.recording_uris(), name), content=recording_info(recording) + signal_table(self, recording, selectedsig)) target = selectedsig if selectedsig else uri annotations = [ annotation_info(ann) for ann in repo.get_annotations(target, recording.graph.uri) ] if not annotate: annotations.append(annotatelink(target)) kwds['content'] += self.render_string('annotate.html', uri=target, annotations=annotations) if annotate: self.render( 'tform.html', bottom=True, # Form below other content treespace=True, formclass='annotform', rows=6, cols=0, buttons=[Button('Annotate', 1, 4), Button('Cancel', 1, 5)], fields=[ Field.textarea('Add Annotation', 'annotation', 60, 8), Field.hidden('target', target) ], **kwds) else: self.render('tpage.html', **kwds) else: self.render('tpage.html', title=title, tree=self._xmltree(repo.recording_uris()))
def render(self, query, results=''): frontend.BasePage.render(self, 'tform.html', title = 'SPARQL search...', rows = 22, cols = 0, buttons = [ Button('Search', 1, 2) ], fields = [ Field.textarea('SPARQL', 'query', 75, 26, data=query) ], content = results )
def _show_contents(self, name, annotate): #---------------------------------------- repo = options.repository title = 'Recordings in %s' % repo.uri if name: uri = name recording = repo.get_recording(uri, open_dataset=False) if recording is None: ## Not part of a recording, so return RDF self.set_header('Content-Type', rdf.Format.RDFXML) self.write(repo.describe(uri, format=rdf.Format.RDFXML)) return selectedsig = None if str(recording.uri) != uri: if repo.has_signal(uri): selectedsig = uri uri = str(recording.uri) # By now we should have all of recording's RDF as a Graph so we # can use this to get events, annotations, etc, etc ## Is sending tree each time, that then has JScript setting up tooltips ## a cause of connection closed problems...??? kwds = dict(title=title, bodytitle=uri, style='signal', tree = self._xmltree(repo.recording_uris(), name), content = recording_info(recording) + signal_table(self, recording, selectedsig) ) target = selectedsig if selectedsig else uri annotations = [ annotation_info(ann) for ann in repo.get_annotations(target, recording.graph.uri) ] if not annotate: annotations.append(annotatelink(target)) kwds['content'] += self.render_string('annotate.html', uri=target, annotations=annotations) if annotate: self.render('tform.html', bottom = True, # Form below other content treespace = True, formclass = 'annotform', rows = 6, cols = 0, buttons = [ Button('Annotate', 1, 4), Button('Cancel', 1, 5) ], fields = [ Field.textarea('Add Annotation', 'annotation', 60, 8), Field.hidden('target', target ) ], **kwds) else: self.render('tpage.html', **kwds) else: self.render('tpage.html', title=title, tree=self._xmltree(repo.recording_uris()))
def get(self): #------------- self.render( 'tform.html', title='Please log in:', rows=4, cols=0, buttons=[Button('Login', 35, 1), Button('Cancel', 42, 1)], fields=[ Field('Username', (1, 1), 'username', (11, 1), 20), Field('Password', (1, 2), 'password', (11, 2), 20, type='password'), Field.hidden('next', self.get_argument('next', '')) ], alert=('Session expired, please login' if self.get_argument( 'next', '') else 'Unauthorised, please login' if self.request.query.find('unauthorised') >= 0 else ''), )
def get(self): #------------- self.render('tform.html', title = 'Please log in:', rows = 4, cols = 0, buttons = [ Button('Login', 35, 1), Button('Cancel', 42, 1) ], fields = [ Field('Username', (1, 1), 'username', (11, 1), 20), Field('Password', (1, 2), 'password', (11, 2), 20, type='password'), Field.hidden('next', self.get_argument('next', '')) ], alert = ('Session expired, please login' if self.get_argument('next', '') else 'Unauthorised, please login' if self.request.query.find('unauthorised') >= 0 else ''), )
def __init__(self, valid=None, required=False): self.rx = None if valid: self.rx = re.compile("^%s$" % valid) Field.__init__(self, required=required)
def __init__(self, format="%d/%m/%Y", required=False): self.format = format Field.__init__(self, required=required)
def __init__(self, *args, **kw): Field.__init__(self, *args, **kw) self.delimiter = re.compile(".*$")