Skip to content
This repository has been archived by the owner on Apr 4, 2020. It is now read-only.

Commit

Permalink
Update default scilabmagic plot size and fix Makefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Aug 24, 2014
1 parent 8d47f3a commit b053889
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.PHONY: all clean test cover release gh-pages

export TEST_ARGS=--exe -v --with-doctest
export NAME='scilab2py'
export NAME=scilab2py
export KILL_PROC="from $(NAME) import kill_scilab; kill_scilab()"
export GHP_MSG="Generated gh-pages for `git log master -1 --pretty=short --abbrev-commit`"
export VERSION=`python -c "import $(NAME); print($(NAME).__version__)"`
Expand Down
27 changes: 15 additions & 12 deletions scilab2py/ipython/scilabmagic.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ class ScilabMagicError(scilab2py.Scilab2PyError):

@magics_class
class ScilabMagics(Magics):

"""A set of magics useful for interactive work with Scilab via scilab2py.
"""

def __init__(self, shell):
"""
Parameters
Expand Down Expand Up @@ -148,31 +150,30 @@ def scilab_pull(self, line):
'-i', '--input', action='append',
help='Names of input variables to be pushed to Scilab. Multiple names '
'can be passed, separated by commas with no whitespace.'
)
)
@argument(
'-o', '--output', action='append',
help='Names of variables to be pulled from Scilab after executing cell '
'body. Multiple names can be passed, separated by commas with no '
'whitespace.'
)
)
@argument(
'-f', '--format', action='store',
help='Plot format (png, svg or jpg).'
)
)
@argument(
'-s', '--size', action='store',
help='Pixel size of plots, "width,height". Default is "-s 400,250".'
)
)
@argument(
'-g', '--gui', action='store_true', default=False,
help='Show a gui for plots. Default is False'
)

)
@needs_local_scope
@argument(
'code',
nargs='*',
)
)
@line_cell_magic
def scilab(self, line, cell=None, local_ns=None):
'''
Expand Down Expand Up @@ -268,13 +269,15 @@ def scilab(self, line, cell=None, local_ns=None):
if args.size is not None:
size = args.size
else:
size = '400,240'
size = '690,540'
plot_width, plot_height = [int(s) for s in size.split(',')]

try:
text_output = str(self._sci.eval(code, plot_dir=plot_dir, plot_format=plot_format,
plot_width=plot_width, plot_height=plot_height,
verbose=False))
text_output = str(self._sci.eval(code, plot_dir=plot_dir,
plot_format=plot_format,
plot_width=plot_width,
plot_height=plot_height,
verbose=False))
except (scilab2py.Scilab2PyError) as exception:
msg = str(exception)
if 'Scilab Syntax Error' in msg:
Expand Down Expand Up @@ -333,7 +336,7 @@ def scilab(self, line, cell=None, local_ns=None):
SCILAB_DOC=dedent(ScilabMagics.scilab.__doc__),
SCILAB_PUSH_DOC=dedent(ScilabMagics.scilab_push.__doc__),
SCILAB_PULL_DOC=dedent(ScilabMagics.scilab_pull.__doc__)
)
)


def load_ipython_extension(ip):
Expand Down

0 comments on commit b053889

Please sign in to comment.