I have a 30-record database table which takes less than a second to read. However rendering it to the screen in Reahl takes about 45 seconds.
class MainPage(HTML5Page):
def __init__(self, view, main_bookmarks):
super(MainPage, self).__init__(view, style='basic')
self.use_layout(PageColumnLayout('main'))
self.layout.header.add_child(Menu.from_bookmarks(
view, main_bookmarks).use_layout(HorizontalLayout()))
class RecordParserPanel(Panel):
def __init__(self, view, obfl_ui):
super(RecordParserPanel, self).__init__(view)
for row in _Session.query(t_QMx_OBFL_Parser):
self.add_child(RecordParserEntry(view, row, obfl_ui))
class RecordParserEntry(Widget):
def __init__(self, view, row, obfl_ui):
super(RecordParserEntry, self).__init__(view)
bookmark = obfl_ui.get_edit_bookmark(row=row, description='edit')
par = self.add_child(P(view, text='%s: %s ' % (row.Parser_Name, row.isEnabled)))
par.add_child(A.from_bookmark(view, bookmark))
class OBFLParserUI(UserInterface):
def assemble(self):
add = self.define_view('/add', title='Add a record parser')
add.set_slot('main', RecordParserAddForm.factory())
edit = self.define_view('/edit', view_class=RecordParserEditView, parser_id=IntegerField())
parsers = self.define_view('/', title='Record Parsers')
parsers.set_slot('main', RecordParserPanel.factory(self))
bookmarks = [f.as_bookmark(self) for f in [parsers, add]]
self.define_page(MainPage, bookmarks)
self.define_transition(RecordParser.events.save, add, parsers)
self.define_transition(RecordParser.events.update, edit, parsers)
self.edit = edit
def get_edit_bookmark(self, row, description=None):
return self.edit.as_bookmark(self, parser_id=row.ID, description=description)