Skip to content

Commit

Permalink
Add browse_auto_height config option
Browse files Browse the repository at this point in the history
  • Loading branch information
hugetim committed Oct 23, 2024
1 parent a96b877 commit bc7fc2d
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 161 deletions.
69 changes: 41 additions & 28 deletions nbs/01_config.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Elapsed time: 0.0029 seconds\n"
"Elapsed time: 0.0030 seconds\n"
]
}
],
Expand Down Expand Up @@ -515,7 +515,7 @@
"output_type": "stream",
"text": [
" System information\n",
" Python version 3.10.4\n",
" Python version 3.11.10\n",
" Stata version Stata 18.0 (MP)\n",
" Stata library path C:\\Program Files\\Stata18\\mp-64.dll\n",
" Stata initialized True\n",
Expand All @@ -525,7 +525,7 @@
" graphic display True\n",
" graphic size width = default, height = default\n",
" graphic format svg\n",
"Elapsed time: 1.3971 seconds\n"
"Elapsed time: 1.9647 seconds\n"
]
}
],
Expand Down Expand Up @@ -598,7 +598,7 @@
"text": [
"Elapsed time: 0.0000 seconds\n",
" System information\n",
" Python version 3.10.4\n",
" Python version 3.11.10\n",
" Stata version Stata 18.0 (MP)\n",
" Stata library path C:\\Program Files\\Stata18\\mp-64.dll\n",
" Stata initialized True\n",
Expand Down Expand Up @@ -642,7 +642,7 @@
"output_type": "stream",
"text": [
" System information\n",
" Python version 3.10.4\n",
" Python version 3.11.10\n",
" Stata version Stata 18.0 (MP)\n",
" Stata library path C:\\Program Files\\Stata18\\mp-64.dll\n",
" Stata initialized True\n",
Expand Down Expand Up @@ -766,32 +766,47 @@
" \"nbstata configuration\"\n",
" env = {'stata_dir': None,\n",
" 'edition': None,\n",
" 'splash': 'False',\n",
" 'splash': 'False',\n",
" 'graph_format': 'png',\n",
" 'graph_width': '5.5in',\n",
" 'graph_height': '4in',\n",
" 'echo': 'None',\n",
" 'missing': '.',\n",
" 'browse_auto_height': 'True',\n",
" }\n",
" valid_values_of = dict(\n",
" edition={None, 'mp', 'se', 'be'},\n",
" graph_format={'pystata', 'svg', 'png', 'pdf'},\n",
" echo={'True', 'False', 'None'},\n",
" splash={'True', 'False'},\n",
" browse_auto_height={'True', 'False'},\n",
" )\n",
" \n",
" @property\n",
" def splash(self):\n",
" return False if self.env['splash'] == 'False' else True\n",
" \n",
" @property\n",
" def browse_auto_height(self):\n",
" return False if self.env['browse_auto_height'] == 'False' else True\n",
" \n",
" @property\n",
" def noecho(self):\n",
" return self.env['echo'] == 'None'\n",
" \n",
" @property\n",
" def echo(self):\n",
" return self.env['echo'] == 'True'\n",
" \n",
" def display_status(self):\n",
" import pystata\n",
" pystata.config.status()\n",
" print(f\"\"\"\n",
" echo {self.env['echo']}\n",
" missing {self.env['missing']}\n",
" browse_auto_height {self.env['browse_auto_height']}\n",
" config file path {self.config_path}\"\"\")\n",
"\n",
" def __init__(self):\n",
" \"\"\"First check if a configuration file exists. If not, try `find_dir_edition`.\"\"\"\n",
" self.errors = []\n",
Expand Down Expand Up @@ -849,15 +864,7 @@
" print_red(error_header)\n",
" for message in self.errors:\n",
" print_red(message)\n",
" self.errors = []\n",
" \n",
" def display_status(self):\n",
" import pystata\n",
" pystata.config.status()\n",
" print(f\"\"\"\n",
" echo {self.env['echo']}\n",
" missing {self.env['missing']}\n",
" config file path {self.config_path}\"\"\")"
" self.errors = []"
]
},
{
Expand All @@ -881,10 +888,11 @@
" 'edition': 'mp',\n",
" 'splash': 'False',\n",
" 'graph_format': 'png',\n",
" 'graph_width': '5.5in',\n",
" 'graph_height': '4in',\n",
" 'graph_width': 'default',\n",
" 'graph_height': 'default',\n",
" 'echo': 'None',\n",
" 'missing': '.'}"
" 'missing': '.',\n",
" 'browse_auto_height': 'True'}"
]
},
"execution_count": null,
Expand Down Expand Up @@ -1009,7 +1017,7 @@
"output_type": "stream",
"text": [
" System information\n",
" Python version 3.10.4\n",
" Python version 3.11.10\n",
" Stata version Stata 18.0 (MP)\n",
" Stata library path C:\\Program Files\\Stata18\\mp-64.dll\n",
" Stata initialized True\n",
Expand All @@ -1022,21 +1030,23 @@
"\n",
" echo None\n",
" missing .\n",
" browse_auto_height True\n",
" config file path C:\\Users\\tjhuegerich\\.config\\nbstata\\nbstata.conf\n",
" System information\n",
" Python version 3.10.4\n",
" Python version 3.11.10\n",
" Stata version Stata 18.0 (MP)\n",
" Stata library path C:\\Program Files\\Stata18\\mp-64.dll\n",
" Stata initialized True\n",
" sfi initialized True\n",
"\n",
" Settings\n",
" graphic display True\n",
" graphic size width = 5.5in, height = 4.0in\n",
" graphic size width = default, height = default\n",
" graphic format png\n",
"\n",
" echo None\n",
" missing .\n",
" browse_auto_height True\n",
" config file path C:\\Users\\tjhuegerich\\.config\\nbstata\\nbstata.conf\n"
]
}
Expand All @@ -1058,7 +1068,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"graph size was (5.5in, 4in), is now (3, 4in).\n"
"graph size was (default, default), is now (3, default).\n"
]
}
],
Expand All @@ -1079,19 +1089,20 @@
"output_type": "stream",
"text": [
" System information\n",
" Python version 3.10.4\n",
" Python version 3.11.10\n",
" Stata version Stata 18.0 (MP)\n",
" Stata library path C:\\Program Files\\Stata18\\mp-64.dll\n",
" Stata initialized True\n",
" sfi initialized True\n",
"\n",
" Settings\n",
" graphic display True\n",
" graphic size width = 3in, height = 4.0in\n",
" graphic size width = 3in, height = default\n",
" graphic format png\n",
"\n",
" echo None\n",
" missing .\n",
" browse_auto_height True\n",
" config file path C:\\Users\\tjhuegerich\\.config\\nbstata\\nbstata.conf\n"
]
},
Expand All @@ -1103,9 +1114,10 @@
" 'splash': 'True',\n",
" 'graph_format': 'png',\n",
" 'graph_width': '3',\n",
" 'graph_height': '4in',\n",
" 'graph_height': 'default',\n",
" 'echo': 'None',\n",
" 'missing': '.'}"
" 'missing': '.',\n",
" 'browse_auto_height': 'True'}"
]
},
"execution_count": null,
Expand Down Expand Up @@ -1140,9 +1152,10 @@
" 'splash': 'True',\n",
" 'graph_format': 'png',\n",
" 'graph_width': '3',\n",
" 'graph_height': '4in',\n",
" 'graph_height': 'default',\n",
" 'echo': 'None',\n",
" 'missing': '.'}"
" 'missing': '.',\n",
" 'browse_auto_height': 'True'}"
]
},
"execution_count": null,
Expand Down
Loading

0 comments on commit bc7fc2d

Please sign in to comment.