Skip to content

Commit

Permalink
Add browse_auto_height docs, related tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
hugetim committed Oct 25, 2024
1 parent bc7fc2d commit a3ba998
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nbs/09_magics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
"@patch_to(StataMagics)\n",
"def magic(self, code, kernel, cell):\n",
" try:\n",
" if not kernel.ipydatagrid_height_set:\n",
" if kernel.nbstata_config.browse_auto_height and not kernel.ipydatagrid_height_set:\n",
" browse.set_ipydatagrid_height()\n",
" kernel.ipydatagrid_height_set = True\n",
" name, code = self._parse_code_for_magic(code)\n",
Expand Down
1 change: 1 addition & 0 deletions nbs/15_install.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
"graph_height = 4in\n",
"echo = None\n",
"missing = .\n",
"browse_auto_height = True\n",
"\n"
]
}
Expand Down
Binary file added nbs/images/status example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions nbs/user_guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
" - 'False': the kernel will not echo single-line commands.\n",
" - 'None': the kernel will not echo any command. \n",
"- `missing`: What to display for a missing value in the output of the `%browse`, `%head`, and `%tail` magics. Default is '.', following Stata. To defer to pandas's format for `NaN`, specify 'pandas'.\n",
"- `browse_auto_height`: Whether to set 'height: 100%' for the [%browse](#browse-head-tail-and-frame-equivalents) widget (default: 'True'):\n",
" - 'True': allows browse widget to expand to height of its container, such as when using 'Create New View for Output' in Jupyter Lab.\n",
" - 'False': fixed height of around 22 rows, recommended for NBClassic and VSCode.\n",
"\n",
"Settings must be under the title `[nbstata]`. Not all settings need be included. Example:\n",
"\n",
Expand Down Expand Up @@ -361,6 +364,13 @@
"*Display Stata status and configuration values*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<img align=\"center\" width=\"500\" src=\"images/status example.png\" alt=\"%status example\">"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
2 changes: 1 addition & 1 deletion nbstata/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _do_magic(self, name, code, kernel, cell):
@patch_to(StataMagics)
def magic(self, code, kernel, cell):
try:
if not kernel.ipydatagrid_height_set:
if kernel.nbstata_config.browse_auto_height and not kernel.ipydatagrid_height_set:
browse.set_ipydatagrid_height()
kernel.ipydatagrid_height_set = True
name, code = self._parse_code_for_magic(code)
Expand Down

0 comments on commit a3ba998

Please sign in to comment.