Skip to content

Commit

Permalink
Go over screenshots (#94)
Browse files Browse the repository at this point in the history
* Adjust style="" to do the right thing. and squelch "set:raw" error in trying set PygmentsStyle
* Add gif for prompt-toolkit. Revise GNU gif.
  • Loading branch information
rocky authored Jan 31, 2025
1 parent 4fc3781 commit 7bbb526
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 67 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
/.eggs
/.hypothesis
/.mypy_cache
/.pyodide-xbuildenv*
/.pytest_cache
/.python-version
/.tox
/.venv*/*
/ChangeLog
/ChangeLog.orig
/ChangeLog.rej
/ChangeLog.spell-corrected
/PKG-INFO
/README
/README.html
Expand Down
4 changes: 2 additions & 2 deletions mathicsscript/autoload/settings.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

Settings`$ShowFullFormInput = False

(* This is a workarund for a bug in mathicsscript of mathics-core.
(* This is a workaround for a bug in mathicsscript of mathics-core.
Remove this and we get error:
Set::setraw: Cannot assign to raw object colorful. *)
Settings`$PygmentsStyle = False
Settings`$PygmentsStyle = Null

Settings`$PygmentsStyle::usage = "This variable sets the Pygments style used to colorize output. The value should be a string.
Expand Down
6 changes: 3 additions & 3 deletions mathicsscript/termshell.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2020-2022, 2024 Rocky Bernstein <[email protected]>
# Copyright (C) 2020-2022, 2024, 2025 Rocky Bernstein <[email protected]>

from columnize import columnize

Expand Down Expand Up @@ -67,7 +67,7 @@
SymbolPygmentsStylesAvailable = Symbol("Settings`PygmentsStylesAvailable")


def is_pygments_style(style: str):
def is_pygments_style(style: str) -> bool:
if style not in ALL_PYGMENTS_STYLES:
print(f"Pygments style name '{style}' not found.")
print(f"Style names are:\n{columnize(ALL_PYGMENTS_STYLES)}")
Expand Down Expand Up @@ -154,7 +154,7 @@ def __init__(
)

def change_pygments_style(self, style: str):
if style == self.pygments_style:
if not style or style == self.pygments_style:
return False
if is_pygments_style(style):
self.terminal_formatter = Terminal256Formatter(style=style)
Expand Down
8 changes: 3 additions & 5 deletions screenshots/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Character entry and highlighting

![demo session - part 1](mathicsscript1.gif)
![demo session - part 1](mathicsscript1-gnu.gif)

### Demo Notes

Expand All @@ -12,9 +12,7 @@ I hit the _Tab_ key after `Inte` to get the completions

Ater adding `gr` though there was just one completion: `Integrate`.

To get the theta (θ), I entered: _escape_ theta _escape_.

The next time around I entered `\[The` and the _Tab_ key.
To get the theta (θ), I entered: _escape_ .Theta _escape_.

The orange color is in output is the color the Pygments default dark style `paraiso-dark` uses for numbers.

Expand Down Expand Up @@ -43,7 +41,7 @@ The "cast" screenshot was made with asciienema and then running through `asciica
For example:

```
$ asciinema play mathicsscript1.caste
$ asciinema play mathicsscript1.cast
```

You can edit the `.cast` files. The specific commands used after this were:
Expand Down
Binary file added screenshots/mathicsscript1-gnu.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
122 changes: 122 additions & 0 deletions screenshots/mathicsscript1-prompt.cast

Large diffs are not rendered by default.

Binary file added screenshots/mathicsscript1-prompt.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 51 additions & 57 deletions screenshots/mathicsscript1.cast
Original file line number Diff line number Diff line change
@@ -1,57 +1,51 @@
{"version": 2, "width": 93, "height": 37, "timestamp": 1603631223, "env": {"SHELL": "/bin/bash", "TERM": "xterm-256color"}}
[0.005791, "o", "\u001b[33m$ \u001b[0m"]
[0.502157, "o", "math"]
[1.062212, "o", "ics"]
[1.502028, "o", "script"]
[2.034574, "o", "\r\n"]
[2.82522, "o", "\r\nMathicsscript: 8.0.0, Mathics 8.0.0\r\non CPython 3.12.8 (main, Dec 9 2024, 11:38:23) [GCC 13.2.0]\r\nusing SymPy 1.13.3, mpmath 1.130, cython 3.0.11\r\n\r\nCopyright (C) 2011-2025 The Mathics Team.\r\nThis program comes with ABSOLUTELY NO WARRANTY.\r\nThis is free software, and you are welcome to redistribute it\r\nunder certain conditions.\r\nSee the documentation for the full license.\r\n\r\nQuit by pressing CONTROL-D\r\n\r\n"]
[2.825361, "o", "\u001b[32mIn[\u001b[1m1\u001b[22m]:= \u001b[39m"]
[3.695122, "o", "I"]
[3.967145, "o", "n"]
[4.726812, "o", "t"]
[5.007269, "o", "e"]
[5.335371, "o", "g"]
[6.12223, "o", "\u0007"]
[6.815785, "o", "\r\nInteger IntegerExponent IntegerQ IntegerString Integrate\r\nIntegerDigits IntegerLength IntegerReverse Integers \r\n\u001b[32mIn[\u001b[1m1\u001b[22m]:= \u001b[39mInteg"]
[6.871228, "o", "r"]
[7.000000, "o", "\u0007"]
[7.520555, "o", "ate"]
[7.675848, "o", "["]
[8.031685, "o", "Sin["]
[9.656405, "o", "θ"]
[10.25736, "o", "]"]
[10.817809, "o", ", "]
[11.01777, "o", "{"]
[11.737943, "o", "\\"]
[11.773814, "o", "["]
[11.961852, "o", "The"]
[12.458474, "o", "\u0007"]
[13.386332, "o", "ta"]
[13.562337, "o", ", "]
[14.130843, "o", "0"]
[14.426842, "o", ", 1"]
[15.090745, "o", "}]"]
[15.555296, "o", "\r\n"]
[15.632594, "o", "\u001b[31mOut[\u001b[1m1\u001b[22m]= \u001b[39m\u001b[38;5;208m1\u001b[39m\u001b[38;5;7m \u001b[39m\u001b[38;5;79m-\u001b[39m\u001b[38;5;7m \u001b[39m\u001b[38;5;7mCos\u001b[39m\u001b[38;5;7m[\u001b[39m\u001b[38;5;208m1\u001b[39m\u001b[38;5;7m]\u001b[39m\r\n\r\n"]
[16.032643, "o", "\u001b[32mIn[\u001b[1m2\u001b[22m]:= \u001b[39m"]
[17.028024, "o", "N[%]"]
[17.435874, "o", "\r\n"]
[17.443821, "o", "\u001b[31mOut[\u001b[1m2\u001b[22m]= \u001b[39m\u001b[38;5;208m0.459698\u001b[39m\r\n\r\n"]
[17.443857, "o", "\u001b[32mIn[\u001b[1m3\u001b[22m]:= \u001b[39m"]
[17.436374, "o", "N[%]"]
[18.988696, "o", "\b\b\b\bIntegrate[Sin[θ], {θ, 0, 1}]"]
[19.11296, "o", "\b\u001b[K"]
[19.445726, "o", "\r\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[K"]
[20.533847, "o", "Integrate[Sin[θ], {\\[Theta], 0, 1}]"]
[20.845902, "o", "\b"]
[21.069995, "o", "\b"]
[21.222015, "o", "\b"]
[22.846123, "o", "P1}]\b\b\b"]
[23.278141, "o", "i1}]\b\b\b"]
[23.629824, "o", "\u001b[1P}]\b\b"]
[24.533706, "o", "\u001b[C\u001b[C"]
[25.318366, "o", "\r\n"]
[25.337909, "o", "\u001b[31mOut[\u001b[1m3\u001b[22m]= \u001b[39m\u001b[38;5;208m2\u001b[39m\r\n\r\n"]
[25.337952, "o", "\u001b[32mIn[\u001b[1m4\u001b[22m]:= \u001b[39m"]
[26.477806, "o", "\r\n\r\nGoodbye!\r\n\r\n"]
[26.480035, "o", "\u001b[0m"]
{"version": 2, "width": 80, "height": 24, "timestamp": 1738279347, "env": {"SHELL": "/bin/bash", "TERM": "xterm-256color"}}
[0.004157, "o", "\u001b[?2004h\u001b[33m$ \u001b[0m"]
[1.358551, "o", "\u001b[H\u001b[2J\u001b[33m$ \u001b[0m"]
[1.798216, "o", "mathicsscript --readline GNU"]
[2.773018, "o", "\r\n\u001b[?2004l\r"]
[3.447708, "o", "\r\nMathicscript: 8.0.0, Mathics 8.0.0\r\non CPython 3.12.8 (main, Dec 9 2024, 11:38:23) [GCC 13.2.0]\r\n\r\nUsing:\r\nSymPy 1.13.3, mpmath 1.3.0, numpy 1.26.4\r\ncython 3.0.11, matplotlib 3.9.3,\r\nAsymptote version 2.95\r\n\r\nCopyright (C) 2011-2025 The Mathics3 Team.\r\nThis program comes with ABSOLUTELY NO WARRANTY.\r\nThis is free software, and you are welcome to redistribute it\r\nunder certain conditions.\r\nSee the documentation for the full license.\r\n\r\nQuit by evaluating Quit[] or by pressing CONTROL-D.\r\n\r\n"]
[3.447822, "o", "\u001b[32mIn[\u001b[1m1\u001b[22m]:= \u001b[39m"]
[5.680936, "o", "I"]
[6.08154, "o", "n"]
[6.537755, "o", "t"]
[7.009703, "o", "e"]
[8.050647, "o", "g"]
[8.703203, "o", "\u0007"]
[9.172915, "o", "\r\nInteger IntegerLength IntegerQ Integers\r\nIntegerDigits IntegerPart IntegerReverse Integrate\r\nIntegerExponent IntegerPartitions IntegerString \r\n\u001b[32mIn[\u001b[1m1\u001b[22m]:= \u001b[39mInteg"]
[10.30575, "o", "r"]
[11.091369, "o", "ate"]
[12.09041, "o", "["]
[14.5699, "o", "S"]
[14.856797, "o", "i"]
[15.05787, "o", "n"]
[15.321605, "o", "["]
[16.514906, "o", "θ̣"]
[16.977232, "o", "]"]
[17.354395, "o", ","]
[17.448072, "o", " "]
[18.06578, "o", "{"]
[22.489797, "o", "θ̣"]
[23.102821, "o", ","]
[23.175574, "o", " "]
[23.455224, "o", "0"]
[23.697182, "o", ","]
[23.776832, "o", " "]
[24.353501, "o", "1"]
[24.89733, "o", "}"]
[25.263849, "o", "]"]
[28.497772, "o", "\r\n"]
[30.567943, "o", "\u001b[31mOut[\u001b[1m1\u001b[22m]\u001b[39m= \u001b[38;5;57;01m1\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;236m-\u001b[39m\u001b[38;5;250m \u001b[39m\u001b[38;5;25;01mCos\u001b[39;00m[\u001b[38;5;57;01m1\u001b[39;00m]\r\n\r\n\u001b[32mIn[\u001b[1m2\u001b[22m]:= \u001b[39m"]
[33.001598, "o", "%"]
[33.880615, "o", " "]
[34.194293, "o", "/"]
[34.366569, "o", "/"]
[34.435965, "o", " "]
[34.421543, "o", "N"]
[35.819642, "o", "\r\n"]
[35.83116, "o", "\u001b[31mOut[\u001b[1m2\u001b[22m]\u001b[39m= \u001b[38;5;57;01m0.459698\u001b[39;00m\r\n\r\n"]
[35.831283, "o", "\u001b[32mIn[\u001b[1m3\u001b[22m]:= \u001b[39m"]
[36.001598, "o", "Quit[]"]
[36.819642, "o", "\r\n"]
[37.713122, "o", "\r\n\r\nGoodbye!\r\n\r\n"]
[37.714901, "o", "\u001b[0m"]
[38.073713, "o", "\u001b[?2004l\r\r\n"]
Binary file removed screenshots/mathicsscript1.gif
Binary file not shown.

0 comments on commit 7bbb526

Please sign in to comment.