Skip to content

Commit

Permalink
Merge pull request #97 from hanjinliu/update-rst
Browse files Browse the repository at this point in the history
Update rst
  • Loading branch information
hanjinliu authored Jan 9, 2023
2 parents 7801129 + 46d9be2 commit a2afd05
Show file tree
Hide file tree
Showing 60 changed files with 1,907 additions and 699 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.vscode/
_build/
make_doc.bat
_tabulous_history.txt
_docs_temp/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ release:

images:
python ./image/generate_figs.py

images-rst:
python ./rst/fig/generate_figs.py

watch-rst:
watchfiles "sphinx-build -b html ./rst ./_docs_temp" rst
48 changes: 12 additions & 36 deletions image/generate_figs.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
from typing import Callable
from functools import wraps
from pathlib import Path
import numpy as np
from magicgui import magicgui
from magicgui.widgets import TextEdit

from tabulous import TableViewer, commands as cmds

_ALL_FUNCTIONS = []
_DIR_PATH = Path(__file__).parent
from tabulous_doc import FunctionRegistry

REG = FunctionRegistry(Path(__file__).parent)

def register(f: Callable[[], TableViewer]):
@wraps(f)
def wrapped():
viewer = f()
viewer.save_screenshot(_DIR_PATH / f"{f.__name__}.png")
viewer.close()

_ALL_FUNCTIONS.append(wrapped)
return wrapped


def main():
for f in _ALL_FUNCTIONS:
f()


@register
@REG.register
def viewer_example():
viewer = TableViewer()
sheet = viewer.open_sample("iris", type="spreadsheet")
Expand All @@ -40,7 +23,7 @@ def viewer_example():
return viewer


@register
@REG.register
def filter_example():
viewer = TableViewer()
rng = np.random.default_rng(1234)
Expand All @@ -52,7 +35,7 @@ def filter_example():
return viewer


@register
@REG.register
def sort_example():
viewer = TableViewer()
rng = np.random.default_rng(1234)
Expand All @@ -67,29 +50,22 @@ def sort_example():
return viewer


@register
@REG.register
def colormap_example():
viewer = TableViewer()
sheet = viewer.open_sample("iris", type="spreadsheet")
sheet.background_colormap(
"species",
sheet["species"].background_color.set(
{"setosa": "lightblue", "versicolor": "orange", "virginica": "violet"},
)

@sheet.foreground_colormap("petal_width")
def _cmap(v):
v = float(v)
r = (v - 0.1) / 2.4 * 255
b = (1 - (v - 0.1) / 2.4) * 255
return [r, 255, b, 255]
sheet["petal_width"].text_color.set(interp_from=["red", "blue"])

viewer.resize(100, 100)
sheet.move_iloc(53, 4)
sheet.move_iloc(49, 3)
return viewer


@register
@REG.register
def eval_example():
viewer = TableViewer()
sheet = viewer.add_spreadsheet(np.arange(100))
Expand All @@ -103,7 +79,7 @@ def eval_example():
return viewer


@register
@REG.register
def command_palette_example():
viewer = TableViewer()
viewer.add_spreadsheet()
Expand All @@ -112,7 +88,7 @@ def command_palette_example():
return viewer


@register
@REG.register
def custom_widget_example():
viewer = TableViewer()
sheet = viewer.add_spreadsheet()
Expand Down Expand Up @@ -140,4 +116,4 @@ def read_csv(save_path: Path):


if __name__ == "__main__":
main()
REG.run_all()
54 changes: 54 additions & 0 deletions rst/_static/font.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
.gray {color: gray;}

.silver {color: silver;}

.white {color: white;}

.red {color: red;}

.magenta {color: magenta;}

.pink {color: pink;}

.orange {color: orange;}

.yellow {color: yellow;}

.lime {color: lime;}

.green {color: green;}

.teal {color: teal;}

.cyan {color: cyan;}

.aqua {color: aqua;}

.blue {color: blue;}

.navy {color: navy;}

.purple {color: purple;}

.kbd {
background-color: #f1f1f1;
border: 1px solid #ccc;
border-radius: 3px;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px #fff inset;
color: #444;
display: inline-block;
font-size: 0.85em;
font-weight: 700;
line-height: 1;
padding: 0.2em 0.4em;
white-space: nowrap;
}

.menu {
background-color: #f1f1f1;
border: 1px solid #ccc;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 1px #fff inset;
font-size: 0.85em;
padding: 0.2em 0.4em;
white-space: nowrap;
}
11 changes: 0 additions & 11 deletions rst/apidoc/tabulous.widgets.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
tabulous.widgets package
========================

Submodules
----------

tabulous.widgets.filtering module
---------------------------------

.. automodule:: tabulous.widgets.filtering
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

Expand Down
1 change: 1 addition & 0 deletions rst/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_css_files = ["font.css"]

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
Binary file added rst/fig/cell_labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified rst/fig/colormap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rst/fig/colormap_interpolate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rst/fig/column_filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rst/fig/command_palette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rst/fig/dock_with_table_data_annotation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rst/fig/edit_cell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed rst/fig/filter.gif
Binary file not shown.
Binary file added rst/fig/formatter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 0 additions & 43 deletions rst/fig/generage_figures.py

This file was deleted.

Loading

0 comments on commit a2afd05

Please sign in to comment.