Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added -nogs option for diving class and timeout for subprocess class #26469

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions sympy/interactive/printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _init_ipython_printing(ip, stringify_func, use_latex, euler, forecolor,
imagesize = 'tight'
offset = "0cm,0cm"
resolution = round(150*scale)
dvi = r"-T %s -D %d -bg %s -fg %s -O %s" % (
dvi = r"-T %s -D %d -bg %s -fg %s -O %s --nogs" % (
imagesize, resolution, backcolor, forecolor, offset)
dvioptions = dvi.split()

Expand Down Expand Up @@ -315,7 +315,7 @@ def _is_ipython(shell):
except ImportError:
# IPython < 0.11
try:
from IPython.iplib import InteractiveShell
from IPython.iplib import InteractiveShell # type: ignore
except ImportError:
# Reaching this points means IPython has changed in a backward-incompatible way
# that we don't know about. Warn?
Expand Down Expand Up @@ -498,7 +498,7 @@ def init_printing(pretty_print=True, order=None, use_unicode=None,
in_ipython = False
if ip is None:
try:
ip = get_ipython()
ip = get_ipython() # type: ignore
except NameError:
pass
else:
Expand All @@ -516,7 +516,7 @@ def init_printing(pretty_print=True, order=None, use_unicode=None,
if version_tuple(IPython.__version__) >= version_tuple('1.0'):
from IPython.terminal.interactiveshell import TerminalInteractiveShell
else:
from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell # type: ignore
from code import InteractiveConsole
except ImportError:
pass
Expand Down
5 changes: 3 additions & 2 deletions sympy/printing/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

__doctest_requires__ = {('preview',): ['pyglet']}

CALLS_TIMEOUT = 10.0 # Time-out system command calls

def _check_output_no_window(*args, **kwargs):
# Avoid showing a cmd.exe window when running this
Expand All @@ -22,7 +23,7 @@ def _check_output_no_window(*args, **kwargs):
creation_flag = 0x08000000 # CREATE_NO_WINDOW
else:
creation_flag = 0 # Default value
return check_output(*args, creationflags=creation_flag, **kwargs)
return check_output(*args, creationflags=creation_flag, timeout=CALLS_TIMEOUT, **kwargs)


def system_default_viewer(fname, fmt):
Expand Down Expand Up @@ -346,7 +347,7 @@ def preview(expr, output='png', viewer=None, euler=True, packages=(),
raise RuntimeError("%s is not installed" % cmd_variants[0])

defaultoptions = {
"dvipng": ["-T", "tight", "-z", "9", "--truecolor"],
"dvipng": ["-T", "tight", "--nogs", "-z", "9", "--truecolor"],
"dvisvgm": ["--no-fonts"],
}

Expand Down