Skip to content

Commit 73a6cc2

Browse files
committed
Docs update (fixes iommirocks#703)
1 parent 9291708 commit 73a6cc2

File tree

8 files changed

+39
-4
lines changed

8 files changed

+39
-4
lines changed

docs/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ API Reference
2828
Menu
2929
MenuItem
3030
Page
31+
Panel
32+
PanelCol
3133
Part
3234
Query
3335
QueryAutoConfig

docs/test_doc_cookbook_forms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,8 @@ def log_and_write(field, instance, value, **kwargs):
13781378
def test_layout_with_panels():
13791379
# language=rst
13801380
"""
1381+
.. _complex-layouts-forms:
1382+
13811383
How do I make complex layouts for forms?
13821384
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13831385

docs/test_doc_cookbook_tables.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,6 +1585,8 @@ def test_how_do_i_set_an_empty_message():
15851585
def test_row_layout_with_panels(small_discography):
15861586
# language=rst
15871587
"""
1588+
.. _complex-layouts-tables:
1589+
15881590
How do I make complex layouts for table rows?
15891591
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15901592

docs/test_doc_fragments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Fragments
66
---------
77
8-
If you are just using iommi's built in components like `Form` and `Table`, you won't need to use `Fragment` directly. `Fragment` is a class that is used to compose HTML tags in a way that is later :ref:`refinable`. The most basic example of this is the :ref:`h_tag <h_tag>` of a form or table. A `Fragment` has :ref:`attrs <attributes>`, :ref:`template` and :ref:`tag` configuration:
8+
If you are just using iommi's built in components like `Form` and `Table`, you won't need to use `Fragment` directly. `Fragment` is a class that is used to compose HTML tags in a way that is later refinable. The most basic example of this is the :ref:`h_tag <h_tag>` of a form or table. A `Fragment` has :ref:`attrs <attributes>`, :ref:`template` and :ref:`tag` configuration:
99
"""
1010
from docs.models import Artist
1111
from iommi.docs import show_output

docs/test_doc_main_menu.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ def fake_view():
2020
def test_base(settings, medium_discography):
2121
# language=rst
2222
"""
23+
.. _mainmenu:
24+
2325
Main menu
2426
~~~~~~~~~
2527

iommi/docs.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from iommi.refinable import (
3232
EvaluatedRefinable,
3333
is_refinable_function,
34+
RefinableObject,
3435
SpecialEvaluatedRefinable,
3536
)
3637
from iommi.shortcut import (
@@ -119,6 +120,8 @@ def get_default_classes():
119120
iommi.Page,
120121
iommi.Menu,
121122
iommi.MenuItem,
123+
iommi.M,
124+
iommi.MainMenu,
122125
iommi.Style,
123126
iommi.fragment.Header,
124127
iommi.Asset,
@@ -312,6 +315,8 @@ def auto_use(big_discography):
312315

313316
if c.__base__ in classes:
314317
w(0, f'Base class: :doc:`{c.__base__.__name__}`')
318+
elif c.__base__ is object:
319+
pass
315320
else:
316321
w(0, f'Base class: `{c.__base__.__name__}`')
317322

@@ -401,7 +406,7 @@ def default_description(v):
401406
cookbook_usages = uses_by_field.get(f'{c.__name__}.{refinable}', [])
402407
if cookbook_usages:
403408
w(0, '')
404-
w(0, f'Cookbook:')
409+
w(0, 'Cookbook:')
405410
for id_, title in cookbook_usages:
406411
w(1, f':ref:`{id_}`')
407412
w(0, '')
@@ -411,6 +416,16 @@ def default_description(v):
411416

412417
w(0, '')
413418

419+
if not issubclass(c, RefinableObject):
420+
section(3, 'Constructor arguments')
421+
422+
for k, v in inspect.signature(x.__init__).parameters.items():
423+
if k == 'self':
424+
continue
425+
w(0, f'* `{k}`')
426+
427+
w(0, '')
428+
414429
assert not defaults
415430

416431
shortcuts = get_shortcuts_by_name(c)

iommi/main_menu.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def path(path, view_or_list, name=None, kwargs=None):
5959

6060

6161
class MainMenu:
62+
# language=rst
63+
"""
64+
See the :ref:`MainMenu <mainmenu>` docs and the :ref:`MainMenu cookbook <cookbook-main-menu>`.
65+
"""
66+
6267
@dispatch(
6368
items=EMPTY,
6469
attrs__style=EMPTY,
@@ -209,6 +214,11 @@ def own_evaluate_parameters(self):
209214

210215

211216
class M:
217+
# language=rst
218+
"""
219+
See the :ref:`MainMenu <mainmenu>` docs and the :ref:`MainMenu cookbook <cookbook-main-menu>`.
220+
"""
221+
212222
@dispatch(
213223
items=EMPTY,
214224
attrs__style=EMPTY,

iommi/panel.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515
class PanelCol(Fragment):
1616
"""
17-
generates div.col - for wrapping all children of Panel.row
17+
Generates `div.col` - for wrapping all children of `Panel.row`.
18+
19+
See :ref:`the forms cookbook <complex-layouts-forms>` and :ref:`the table cookbook <complex-layouts-tables>`.
1820
"""
1921

2022
@with_defaults(
@@ -30,7 +32,7 @@ def __init__(self, **kwargs):
3032

3133
class Panel(Fragment):
3234
"""
33-
wrappers for defining Form.layout
35+
Class used to define form and table row layouts. See :ref:`the forms cookbook <complex-layouts-forms>` and :ref:`the table cookbook <complex-layouts-tables>`.
3436
"""
3537
_parent_form = Refinable() # Form|None
3638
_parent_table = Refinable() # Table|None

0 commit comments

Comments
 (0)