pyams-table 1.0.0__py3.5.egg

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. EGG-INFO/PKG-INFO +55 -0
  2. EGG-INFO/SOURCES.txt +32 -0
  3. EGG-INFO/dependency_links.txt +1 -0
  4. EGG-INFO/namespace_packages.txt +1 -0
  5. EGG-INFO/not-zip-safe +1 -0
  6. EGG-INFO/requires.txt +14 -0
  7. EGG-INFO/top_level.txt +1 -0
  8. pyams_table/__init__.py +29 -0
  9. pyams_table/__pycache__/__init__.cpython-35.pyc +0 -0
  10. pyams_table/__pycache__/batch.cpython-35.pyc +0 -0
  11. pyams_table/__pycache__/column.cpython-35.pyc +0 -0
  12. pyams_table/__pycache__/header.cpython-35.pyc +0 -0
  13. pyams_table/__pycache__/include.cpython-35.pyc +0 -0
  14. pyams_table/__pycache__/interfaces.cpython-35.pyc +0 -0
  15. pyams_table/__pycache__/table.cpython-35.pyc +0 -0
  16. pyams_table/__pycache__/testing.cpython-35.pyc +0 -0
  17. pyams_table/__pycache__/value.cpython-35.pyc +0 -0
  18. pyams_table/batch.py +159 -0
  19. pyams_table/column.py +495 -0
  20. pyams_table/doctests/README.rst +668 -0
  21. pyams_table/doctests/batch.rst +660 -0
  22. pyams_table/doctests/column.rst +1274 -0
  23. pyams_table/doctests/miscellaneous.rst +123 -0
  24. pyams_table/doctests/sequence.rst +267 -0
  25. pyams_table/doctests/sort.rst +388 -0
  26. pyams_table/header.py +102 -0
  27. pyams_table/include.py +27 -0
  28. pyams_table/interfaces.py +249 -0
  29. pyams_table/locales/fr/LC_MESSAGES/pyams_table.mo +0 -0
  30. pyams_table/locales/fr/LC_MESSAGES/pyams_table.po +40 -0
  31. pyams_table/locales/pyams_table.pot +41 -0
  32. pyams_table/table.py +383 -0
  33. pyams_table/testing.py +129 -0
  34. pyams_table/tests/__init__.py +29 -0
  35. pyams_table/tests/__pycache__/__init__.cpython-35.pyc +0 -0
  36. pyams_table/tests/__pycache__/test_utilsdocs.cpython-35.pyc +0 -0
  37. pyams_table/tests/__pycache__/test_utilsdocstrings.cpython-35.pyc +0 -0
  38. pyams_table/tests/test_utilsdocs.py +60 -0
  39. pyams_table/tests/test_utilsdocstrings.py +65 -0
  40. pyams_table/value.py +51 -0
@@ -0,0 +1,249 @@
1
+ #
2
+ # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
3
+ # All Rights Reserved.
4
+ #
5
+ # This software is subject to the provisions of the Zope Public License,
6
+ # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
7
+ # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
8
+ # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9
+ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
10
+ # FOR A PARTICULAR PURPOSE.
11
+ #
12
+
13
+ """PyAMS_table.interfaces module
14
+
15
+ This module provides all package interfaces.
16
+ """
17
+
18
+ from zope.contentprovider.interfaces import IContentProvider
19
+ from zope.interface import Attribute, Interface
20
+ from zope.schema import BytesLine, Int, List, TextLine
21
+
22
+
23
+ __docformat__ = 'restructuredtext'
24
+
25
+
26
+ class IValues(Interface):
27
+ """Table value adapter."""
28
+
29
+ values = Attribute("Iterable table row data sequence.")
30
+
31
+
32
+ class ITable(IContentProvider):
33
+ # pylint: disable=too-many-public-methods
34
+ """Table provider"""
35
+
36
+ column_counter = Int(title="Column counter",
37
+ description="Column counter",
38
+ default=0)
39
+
40
+ column_index_by_id = Attribute("Dict of column index number by id")
41
+
42
+ column_by_name = Attribute("Dict of columns by name")
43
+
44
+ columns = Attribute("Sequence of columns")
45
+
46
+ rows = Attribute("Sequence of rows")
47
+
48
+ selected_items = Attribute("Sequence of selected items")
49
+
50
+ # customize this part if needed
51
+ prefix = BytesLine(title="Prefix",
52
+ description="The prefix of the table used to uniquely identify it.",
53
+ default=b"table")
54
+
55
+ # css classes
56
+ css_classes = Attribute("Dict of element name and CSS classes")
57
+
58
+ # additional (row) css
59
+ css_class_even = TextLine(title="Even css row class",
60
+ description="CSS class for even rows.",
61
+ default=u"even",
62
+ required=False)
63
+
64
+ css_class_odd = TextLine(title="Odd css row class",
65
+ description="CSS class for odd rows.",
66
+ default=u"odd",
67
+ required=False)
68
+
69
+ css_class_selected = TextLine(title="Selected css row class",
70
+ description="CSS class for selected rows.",
71
+ default=u"selected",
72
+ required=False)
73
+
74
+ # sort attributes
75
+ sort_on = Int(title="Sort on table index",
76
+ description="Sort on table index",
77
+ default=0)
78
+
79
+ sort_order = TextLine(title="Sort order",
80
+ description="Row sort order",
81
+ default="ascending")
82
+
83
+ reverse_sort_order_names = List(title="Selected css row class",
84
+ description="CSS class for selected rows.",
85
+ value_type=TextLine(title="Reverse sort order name",
86
+ description="Reverse sort order name"),
87
+ default=["descending", "reverse", "down"],
88
+ required=False)
89
+
90
+ # batch attributes
91
+ batch_start = Int(title="Batch start index",
92
+ description="Index the batch starts with",
93
+ default=0)
94
+
95
+ batch_size = Int(title="Batch size",
96
+ description="The batch size",
97
+ default=50)
98
+
99
+ start_batching_at = Int(title="Batch start size",
100
+ description="The minimal size the batch starts to get used",
101
+ default=50)
102
+
103
+ values = Attribute("Iterable table row data sequence.")
104
+
105
+ def get_css_class(self, element, css_class=None):
106
+ """Return the css class if any or an empty string."""
107
+
108
+ def setup_columns(self):
109
+ """Setup table column renderer."""
110
+
111
+ def update_columns(self):
112
+ """Update columns."""
113
+
114
+ def init_columns(self):
115
+ """Initialize columns definitions used by the table"""
116
+
117
+ def order_columns(self):
118
+ """Order columns."""
119
+
120
+ def setup_row(self, item):
121
+ """Setup table row."""
122
+
123
+ def setup_rows(self):
124
+ """Setup table rows."""
125
+
126
+ def get_sort_on(self):
127
+ """Return sort on column id."""
128
+
129
+ def get_sort_order(self):
130
+ """Return sort order criteria."""
131
+
132
+ def sort_rows(self):
133
+ """Sort rows."""
134
+
135
+ def get_batch_size(self):
136
+ """Return the batch size."""
137
+
138
+ def get_batch_start(self):
139
+ """Return the batch start index."""
140
+
141
+ def batch_rows(self):
142
+ """Batch rows."""
143
+
144
+ def is_selected_row(self, row):
145
+ """Return `True for selected row."""
146
+
147
+ def render_table(self):
148
+ """Render the table."""
149
+
150
+ def render_head(self):
151
+ """Render the thead."""
152
+
153
+ def render_head_row(self):
154
+ """Render the table header rows."""
155
+
156
+ def render_head_cell(self, column):
157
+ """Setup the table header rows."""
158
+
159
+ def render_body(self):
160
+ """Render the table body."""
161
+
162
+ def render_rows(self):
163
+ """Render the table body rows."""
164
+
165
+ def render_row(self, row, css_class=None):
166
+ """Render the table body rows."""
167
+
168
+ def render_cell(self, item, column, colspan=0):
169
+ """Render a single table body cell."""
170
+
171
+ def render(self): # pylint:disable=arguments-differ
172
+ """Plain render method without keyword arguments."""
173
+
174
+
175
+ class ISequenceTable(ITable):
176
+ """Sequence table adapts a sequence as context.
177
+
178
+ This table can be used for adapting a pyams_batching.batch.Batch instance as
179
+ context. Batch which wraps a ResultSet sequence.
180
+ """
181
+
182
+
183
+ class IColumn(Interface):
184
+ """Column provider"""
185
+
186
+ # pylint: disable=invalid-name
187
+ id = TextLine(title="Id",
188
+ description="The column id",
189
+ default=None)
190
+
191
+ # customize this part if needed
192
+ colspan = Int(title="Colspan",
193
+ description="The colspan value",
194
+ default=0)
195
+
196
+ weight = Int(title="Weight",
197
+ description="The column weight",
198
+ default=0)
199
+
200
+ header = TextLine(title="Header name",
201
+ description="The header name",
202
+ default="")
203
+
204
+ css_classes = Attribute("Dict of element name and CSS classes")
205
+
206
+ def get_colspan(self, item):
207
+ """Colspan value based on the given item."""
208
+
209
+ def render_head_cell(self):
210
+ """Render the column header label."""
211
+
212
+ def render_cell(self, item):
213
+ """Render the column content."""
214
+
215
+
216
+ class INoneCell(IColumn):
217
+ """None cell used for colspan."""
218
+
219
+
220
+ class IBatchProvider(IContentProvider):
221
+ """Batch content provider"""
222
+
223
+ def render_batch_link(self, batch, css_class=None):
224
+ """Render batch links."""
225
+
226
+ def render(self): # pylint: disable=arguments-differ
227
+ """Plain render method without keyword arguments."""
228
+
229
+
230
+ class IColumnHeader(Interface):
231
+ """Multi-adapter for header rendering."""
232
+
233
+ def update(self):
234
+ """Override this method in subclasses if required"""
235
+
236
+ def render(self):
237
+ """Return the HTML output for the header
238
+
239
+ Make sure HTML special chars are escaped.
240
+ Override this method in subclasses"""
241
+
242
+ def get_query_string_args(self):
243
+ """
244
+ Because the header will most often be used to add links for sorting the
245
+ columns it may also be necessary to collect other query arguments from
246
+ the request.
247
+
248
+ The initial use case here is to maintain a search term.
249
+ """
@@ -0,0 +1,40 @@
1
+ #
2
+ # SOME DESCRIPTIVE TITLE
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2019.
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: PyAMS_table 1.0.0\n"
8
+ "POT-Creation-Date: 2019-12-24 12:35+0100\n"
9
+ "PO-Revision-Date: 2019-12-24 12:35+0100\n"
10
+ "Last-Translator: Thierry Florac <tflorac@ulthar.net>\n"
11
+ "Language-Team: FRENCH <FR@li.org>\n"
12
+ "Language: French\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "Generated-By: Lingua 3.10.dev0\n"
17
+
18
+ #: src/pyams_table/header.py:102
19
+ msgid "Sort"
20
+ msgstr "Trier"
21
+
22
+ #: src/pyams_table/column.py:146 src/pyams_table/column.py:344
23
+ msgid "Name"
24
+ msgstr "Nom"
25
+
26
+ #: src/pyams_table/column.py:155 src/pyams_table/column.py:201
27
+ msgid "X"
28
+ msgstr "X"
29
+
30
+ #: src/pyams_table/column.py:312
31
+ msgid "Created"
32
+ msgstr "Création"
33
+
34
+ #: src/pyams_table/column.py:328
35
+ msgid "Modified"
36
+ msgstr "Dernière modification"
37
+
38
+ #: src/pyams_table/column.py:392
39
+ msgid "E-Mail"
40
+ msgstr "E-Mail"
@@ -0,0 +1,41 @@
1
+ #
2
+ # SOME DESCRIPTIVE TITLE
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2019.
5
+ #, fuzzy
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: PACKAGE 1.0\n"
9
+ "POT-Creation-Date: 2019-12-24 12:35+0100\n"
10
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
12
+ "Language-Team: LANGUAGE <LL@li.org>\n"
13
+ "Language: \n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Lingua 3.10.dev0\n"
18
+
19
+ #: ./src/pyams_table/header.py:102
20
+ msgid "Sort"
21
+ msgstr ""
22
+
23
+ #: ./src/pyams_table/column.py:146 ./src/pyams_table/column.py:344
24
+ msgid "Name"
25
+ msgstr ""
26
+
27
+ #: ./src/pyams_table/column.py:155 ./src/pyams_table/column.py:201
28
+ msgid "X"
29
+ msgstr ""
30
+
31
+ #: ./src/pyams_table/column.py:312
32
+ msgid "Created"
33
+ msgstr ""
34
+
35
+ #: ./src/pyams_table/column.py:328
36
+ msgid "Modified"
37
+ msgstr ""
38
+
39
+ #: ./src/pyams_table/column.py:392
40
+ msgid "E-Mail"
41
+ msgstr ""