Final grid refactor; we now have just 'grids' :)

this also removes some old UI stuff for the first attempt at continuum
versioning..among other cruft
This commit is contained in:
Lance Edgar 2017-07-14 20:30:00 -05:00
parent 52c7f485ab
commit c57e2e17cc
61 changed files with 179 additions and 1590 deletions

View file

@ -41,9 +41,8 @@ from pyramid import httpexceptions
from pyramid.renderers import get_renderer, render_to_response, render
from webhelpers2.html import HTML, tags
from tailbone import forms, newgrids as grids
from tailbone import forms, grids
from tailbone.views import View
from tailbone.newgrids import filters, AlchemyGrid, GridAction, MobileGrid
class MasterView(View):
@ -161,24 +160,6 @@ class MasterView(View):
grid.load_settings()
return grid
@classmethod
def get_mobile_grid_factory(cls):
"""
Must return a callable to be used when creating new mobile grid
instances. Instead of overriding this, you can set
:attr:`mobile_grid_factory`. Default factory is :class:`MobileGrid`.
"""
return getattr(cls, 'mobile_grid_factory', MobileGrid)
@classmethod
def get_mobile_row_grid_factory(cls):
"""
Must return a callable to be used when creating new mobile grid
instances. Instead of overriding this, you can set
:attr:`mobile_grid_factory`. Default factory is :class:`MobileGrid`.
"""
return getattr(cls, 'mobile_row_grid_factory', MobileGrid)
@classmethod
def get_mobile_grid_key(cls):
"""
@ -422,14 +403,6 @@ class MasterView(View):
grid.load_settings()
return grid
@classmethod
def get_version_grid_factory(cls):
"""
Returns the grid factory or class which is to be used when creating new
version grid instances.
"""
return getattr(cls, 'version_grid_factory', AlchemyGrid)
@classmethod
def get_version_grid_key(cls):
"""
@ -1254,23 +1227,6 @@ class MasterView(View):
# Grid Stuff
##############################
@classmethod
def get_grid_factory(cls):
"""
Returns the grid factory or class which is to be used when creating new
grid instances.
"""
return getattr(cls, 'grid_factory', AlchemyGrid)
@classmethod
def get_row_grid_factory(cls):
"""
Must return a callable to be used when creating new row grid instances.
Instead of overriding this, you can set :attr:`row_grid_factory`.
Default factory is :class:`AlchemyGrid`.
"""
return getattr(cls, 'row_grid_factory', AlchemyGrid)
@classmethod
def get_grid_key(cls):
"""
@ -1385,7 +1341,7 @@ class MasterView(View):
if url is None:
route = '{}.{}'.format(self.get_route_prefix(), key)
url = lambda r, i: self.request.route_url(route, **self.get_action_route_kwargs(r))
return GridAction(key, url=url, **kwargs)
return grids.GridAction(key, url=url, **kwargs)
def get_action_route_kwargs(self, row):
"""
@ -1424,20 +1380,6 @@ class MasterView(View):
def _preconfigure_grid(self, grid):
pass
def configure_grid(self, grid):
"""
Configure the grid, customizing as necessary. Subclasses are
encouraged to override this method.
As a bare minimum, the logic for this method must at some point invoke
the ``configure()`` method on the grid instance. The default
implementation does exactly (and only) this, passing no arguments.
This requirement is a result of using FormAlchemy under the hood, and
it is in fact a call to :meth:`formalchemy:formalchemy.tables.Grid.configure()`.
"""
if hasattr(grid, 'configure'):
grid.configure()
def get_data(self, session=None):
"""
Generate the base data set for the grid. This typically will be a