repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
Spinmob/spinmob | _pylab_tweaks.py | manipulate_shown_data | def manipulate_shown_data(f, input_axes="gca", output_axes=None, fxname=1, fyname=1, clear=1, pause=False, **kwargs):
"""
Loops over the visible data on the specified axes and modifies it based on
the function f(xdata, ydata), which must return new_xdata, new_ydata
input_axes which axes to pull the da... | python | def manipulate_shown_data(f, input_axes="gca", output_axes=None, fxname=1, fyname=1, clear=1, pause=False, **kwargs):
"""
Loops over the visible data on the specified axes and modifies it based on
the function f(xdata, ydata), which must return new_xdata, new_ydata
input_axes which axes to pull the da... | [
"def",
"manipulate_shown_data",
"(",
"f",
",",
"input_axes",
"=",
"\"gca\"",
",",
"output_axes",
"=",
"None",
",",
"fxname",
"=",
"1",
",",
"fyname",
"=",
"1",
",",
"clear",
"=",
"1",
",",
"pause",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"... | Loops over the visible data on the specified axes and modifies it based on
the function f(xdata, ydata), which must return new_xdata, new_ydata
input_axes which axes to pull the data from
output_axes which axes to dump the manipulated data (None for new figure)
fxname the name of the function on... | [
"Loops",
"over",
"the",
"visible",
"data",
"on",
"the",
"specified",
"axes",
"and",
"modifies",
"it",
"based",
"on",
"the",
"function",
"f",
"(",
"xdata",
"ydata",
")",
"which",
"must",
"return",
"new_xdata",
"new_ydata"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L791-L860 |
Spinmob/spinmob | _pylab_tweaks.py | manipulate_shown_xdata | def manipulate_shown_xdata(fx, fxname=1, **kwargs):
"""
This defines a function f(xdata,ydata) returning fx(xdata), ydata and
runs manipulate_shown_data() with **kwargs sent to this. See
manipulate_shown_data() for more info.
"""
def f(x,y): return fx(x), y
f.__name__ = fx.__name__
manip... | python | def manipulate_shown_xdata(fx, fxname=1, **kwargs):
"""
This defines a function f(xdata,ydata) returning fx(xdata), ydata and
runs manipulate_shown_data() with **kwargs sent to this. See
manipulate_shown_data() for more info.
"""
def f(x,y): return fx(x), y
f.__name__ = fx.__name__
manip... | [
"def",
"manipulate_shown_xdata",
"(",
"fx",
",",
"fxname",
"=",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"f",
"(",
"x",
",",
"y",
")",
":",
"return",
"fx",
"(",
"x",
")",
",",
"y",
"f",
".",
"__name__",
"=",
"fx",
".",
"__name__",
"manipu... | This defines a function f(xdata,ydata) returning fx(xdata), ydata and
runs manipulate_shown_data() with **kwargs sent to this. See
manipulate_shown_data() for more info. | [
"This",
"defines",
"a",
"function",
"f",
"(",
"xdata",
"ydata",
")",
"returning",
"fx",
"(",
"xdata",
")",
"ydata",
"and",
"runs",
"manipulate_shown_data",
"()",
"with",
"**",
"kwargs",
"sent",
"to",
"this",
".",
"See",
"manipulate_shown_data",
"()",
"for",
... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L862-L870 |
Spinmob/spinmob | _pylab_tweaks.py | manipulate_shown_ydata | def manipulate_shown_ydata(fy, fyname=1, **kwargs):
"""
This defines a function f(xdata,ydata) returning xdata, fy(ydata) and
runs manipulate_shown_data() with **kwargs sent to this. See
manipulate_shown_data() for more info.
"""
def f(x,y): return x, fy(y)
f.__name__ = fy.__name__
manip... | python | def manipulate_shown_ydata(fy, fyname=1, **kwargs):
"""
This defines a function f(xdata,ydata) returning xdata, fy(ydata) and
runs manipulate_shown_data() with **kwargs sent to this. See
manipulate_shown_data() for more info.
"""
def f(x,y): return x, fy(y)
f.__name__ = fy.__name__
manip... | [
"def",
"manipulate_shown_ydata",
"(",
"fy",
",",
"fyname",
"=",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"f",
"(",
"x",
",",
"y",
")",
":",
"return",
"x",
",",
"fy",
"(",
"y",
")",
"f",
".",
"__name__",
"=",
"fy",
".",
"__name__",
"manipu... | This defines a function f(xdata,ydata) returning xdata, fy(ydata) and
runs manipulate_shown_data() with **kwargs sent to this. See
manipulate_shown_data() for more info. | [
"This",
"defines",
"a",
"function",
"f",
"(",
"xdata",
"ydata",
")",
"returning",
"xdata",
"fy",
"(",
"ydata",
")",
"and",
"runs",
"manipulate_shown_data",
"()",
"with",
"**",
"kwargs",
"sent",
"to",
"this",
".",
"See",
"manipulate_shown_data",
"()",
"for",
... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L872-L880 |
Spinmob/spinmob | _pylab_tweaks.py | _print_figures | def _print_figures(figures, arguments='', file_format='pdf', target_width=8.5, target_height=11.0, target_pad=0.5):
"""
figure printing loop designed to be launched in a separate thread.
"""
for fig in figures:
# get the temp path
temp_path = _os.path.join(_settings.path_home, "temp")
... | python | def _print_figures(figures, arguments='', file_format='pdf', target_width=8.5, target_height=11.0, target_pad=0.5):
"""
figure printing loop designed to be launched in a separate thread.
"""
for fig in figures:
# get the temp path
temp_path = _os.path.join(_settings.path_home, "temp")
... | [
"def",
"_print_figures",
"(",
"figures",
",",
"arguments",
"=",
"''",
",",
"file_format",
"=",
"'pdf'",
",",
"target_width",
"=",
"8.5",
",",
"target_height",
"=",
"11.0",
",",
"target_pad",
"=",
"0.5",
")",
":",
"for",
"fig",
"in",
"figures",
":",
"# ge... | figure printing loop designed to be launched in a separate thread. | [
"figure",
"printing",
"loop",
"designed",
"to",
"be",
"launched",
"in",
"a",
"separate",
"thread",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L882-L935 |
Spinmob/spinmob | _pylab_tweaks.py | instaprint | def instaprint(figure='gcf', arguments='', threaded=False, file_format='pdf'):
"""
Quick function that saves the specified figure as a postscript and then
calls the command defined by spinmob.prefs['instaprint'] with this
postscript file as the argument.
figure='gcf' can be 'all', a number, or a... | python | def instaprint(figure='gcf', arguments='', threaded=False, file_format='pdf'):
"""
Quick function that saves the specified figure as a postscript and then
calls the command defined by spinmob.prefs['instaprint'] with this
postscript file as the argument.
figure='gcf' can be 'all', a number, or a... | [
"def",
"instaprint",
"(",
"figure",
"=",
"'gcf'",
",",
"arguments",
"=",
"''",
",",
"threaded",
"=",
"False",
",",
"file_format",
"=",
"'pdf'",
")",
":",
"global",
"_settings",
"if",
"'instaprint'",
"not",
"in",
"_settings",
".",
"keys",
"(",
")",
":",
... | Quick function that saves the specified figure as a postscript and then
calls the command defined by spinmob.prefs['instaprint'] with this
postscript file as the argument.
figure='gcf' can be 'all', a number, or a list of numbers | [
"Quick",
"function",
"that",
"saves",
"the",
"specified",
"figure",
"as",
"a",
"postscript",
"and",
"then",
"calls",
"the",
"command",
"defined",
"by",
"spinmob",
".",
"prefs",
"[",
"instaprint",
"]",
"with",
"this",
"postscript",
"file",
"as",
"the",
"argum... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L938-L985 |
Spinmob/spinmob | _pylab_tweaks.py | raise_figure_window | def raise_figure_window(f=0):
"""
Raises the supplied figure number or figure window.
"""
if _fun.is_a_number(f): f = _pylab.figure(f)
f.canvas.manager.window.raise_() | python | def raise_figure_window(f=0):
"""
Raises the supplied figure number or figure window.
"""
if _fun.is_a_number(f): f = _pylab.figure(f)
f.canvas.manager.window.raise_() | [
"def",
"raise_figure_window",
"(",
"f",
"=",
"0",
")",
":",
"if",
"_fun",
".",
"is_a_number",
"(",
"f",
")",
":",
"f",
"=",
"_pylab",
".",
"figure",
"(",
"f",
")",
"f",
".",
"canvas",
".",
"manager",
".",
"window",
".",
"raise_",
"(",
")"
] | Raises the supplied figure number or figure window. | [
"Raises",
"the",
"supplied",
"figure",
"number",
"or",
"figure",
"window",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1028-L1033 |
Spinmob/spinmob | _pylab_tweaks.py | set_figure_window_geometry | def set_figure_window_geometry(fig='gcf', position=None, size=None):
"""
This will currently only work for Qt4Agg and WXAgg backends.
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object.
"""
if type(fig)==str: fig = _pylab.gcf()
elif _fun... | python | def set_figure_window_geometry(fig='gcf', position=None, size=None):
"""
This will currently only work for Qt4Agg and WXAgg backends.
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object.
"""
if type(fig)==str: fig = _pylab.gcf()
elif _fun... | [
"def",
"set_figure_window_geometry",
"(",
"fig",
"=",
"'gcf'",
",",
"position",
"=",
"None",
",",
"size",
"=",
"None",
")",
":",
"if",
"type",
"(",
"fig",
")",
"==",
"str",
":",
"fig",
"=",
"_pylab",
".",
"gcf",
"(",
")",
"elif",
"_fun",
".",
"is_a... | This will currently only work for Qt4Agg and WXAgg backends.
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object. | [
"This",
"will",
"currently",
"only",
"work",
"for",
"Qt4Agg",
"and",
"WXAgg",
"backends",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1158-L1189 |
Spinmob/spinmob | _pylab_tweaks.py | set_yticks | def set_yticks(start, step, axes="gca"):
"""
This will generate a tick array and apply said array to the axis
"""
if axes=="gca": axes = _pylab.gca()
# first get one of the tick label locations
xposition = axes.yaxis.get_ticklabels()[0].get_position()[0]
# get the bounds
ymin, ymax = a... | python | def set_yticks(start, step, axes="gca"):
"""
This will generate a tick array and apply said array to the axis
"""
if axes=="gca": axes = _pylab.gca()
# first get one of the tick label locations
xposition = axes.yaxis.get_ticklabels()[0].get_position()[0]
# get the bounds
ymin, ymax = a... | [
"def",
"set_yticks",
"(",
"start",
",",
"step",
",",
"axes",
"=",
"\"gca\"",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"# first get one of the tick label locations",
"xposition",
"=",
"axes",
".",
"yaxis",
"... | This will generate a tick array and apply said array to the axis | [
"This",
"will",
"generate",
"a",
"tick",
"array",
"and",
"apply",
"said",
"array",
"to",
"the",
"axis"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1214-L1239 |
Spinmob/spinmob | _pylab_tweaks.py | set_xticks | def set_xticks(start, step, axes="gca"):
"""
This will generate a tick array and apply said array to the axis
"""
if axes=="gca": axes = _pylab.gca()
# first get one of the tick label locations
yposition = axes.xaxis.get_ticklabels()[0].get_position()[1]
# get the bounds
xmin, xmax = a... | python | def set_xticks(start, step, axes="gca"):
"""
This will generate a tick array and apply said array to the axis
"""
if axes=="gca": axes = _pylab.gca()
# first get one of the tick label locations
yposition = axes.xaxis.get_ticklabels()[0].get_position()[1]
# get the bounds
xmin, xmax = a... | [
"def",
"set_xticks",
"(",
"start",
",",
"step",
",",
"axes",
"=",
"\"gca\"",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"# first get one of the tick label locations",
"yposition",
"=",
"axes",
".",
"xaxis",
"... | This will generate a tick array and apply said array to the axis | [
"This",
"will",
"generate",
"a",
"tick",
"array",
"and",
"apply",
"said",
"array",
"to",
"the",
"axis"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1241-L1266 |
Spinmob/spinmob | _pylab_tweaks.py | coarsen_line | def coarsen_line(line, level=2, exponential=False, draw=True):
"""
Coarsens the specified line (see spinmob.coarsen_data() for more information).
Parameters
----------
line
Matplotlib line instance.
level=2
How strongly to coarsen.
exponential=False
If True, use ... | python | def coarsen_line(line, level=2, exponential=False, draw=True):
"""
Coarsens the specified line (see spinmob.coarsen_data() for more information).
Parameters
----------
line
Matplotlib line instance.
level=2
How strongly to coarsen.
exponential=False
If True, use ... | [
"def",
"coarsen_line",
"(",
"line",
",",
"level",
"=",
"2",
",",
"exponential",
"=",
"False",
",",
"draw",
"=",
"True",
")",
":",
"# get the actual data values",
"xdata",
"=",
"line",
".",
"get_xdata",
"(",
")",
"ydata",
"=",
"line",
".",
"get_ydata",
"(... | Coarsens the specified line (see spinmob.coarsen_data() for more information).
Parameters
----------
line
Matplotlib line instance.
level=2
How strongly to coarsen.
exponential=False
If True, use the exponential method (great for log-x plots).
draw=True
Redra... | [
"Coarsens",
"the",
"specified",
"line",
"(",
"see",
"spinmob",
".",
"coarsen_data",
"()",
"for",
"more",
"information",
")",
".",
"Parameters",
"----------",
"line",
"Matplotlib",
"line",
"instance",
".",
"level",
"=",
"2",
"How",
"strongly",
"to",
"coarsen",
... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1347-L1376 |
Spinmob/spinmob | _pylab_tweaks.py | coarsen_all_traces | def coarsen_all_traces(level=2, exponential=False, axes="all", figure=None):
"""
This function does nearest-neighbor coarsening of the data. See
spinmob.fun.coarsen_data for more information.
Parameters
----------
level=2
How strongly to coarsen.
exponential=False
If Tr... | python | def coarsen_all_traces(level=2, exponential=False, axes="all", figure=None):
"""
This function does nearest-neighbor coarsening of the data. See
spinmob.fun.coarsen_data for more information.
Parameters
----------
level=2
How strongly to coarsen.
exponential=False
If Tr... | [
"def",
"coarsen_all_traces",
"(",
"level",
"=",
"2",
",",
"exponential",
"=",
"False",
",",
"axes",
"=",
"\"all\"",
",",
"figure",
"=",
"None",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"if",
"axes",
... | This function does nearest-neighbor coarsening of the data. See
spinmob.fun.coarsen_data for more information.
Parameters
----------
level=2
How strongly to coarsen.
exponential=False
If True, use the exponential method (great for log-x plots).
axes="all"
Which axes... | [
"This",
"function",
"does",
"nearest",
"-",
"neighbor",
"coarsening",
"of",
"the",
"data",
".",
"See",
"spinmob",
".",
"fun",
".",
"coarsen_data",
"for",
"more",
"information",
".",
"Parameters",
"----------",
"level",
"=",
"2",
"How",
"strongly",
"to",
"coa... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1431-L1463 |
Spinmob/spinmob | _pylab_tweaks.py | line_math | def line_math(fx=None, fy=None, axes='gca'):
"""
applies function fx to all xdata and fy to all ydata.
"""
if axes=='gca': axes = _pylab.gca()
lines = axes.get_lines()
for line in lines:
if isinstance(line, _mpl.lines.Line2D):
xdata, ydata = line.get_data()
if ... | python | def line_math(fx=None, fy=None, axes='gca'):
"""
applies function fx to all xdata and fy to all ydata.
"""
if axes=='gca': axes = _pylab.gca()
lines = axes.get_lines()
for line in lines:
if isinstance(line, _mpl.lines.Line2D):
xdata, ydata = line.get_data()
if ... | [
"def",
"line_math",
"(",
"fx",
"=",
"None",
",",
"fy",
"=",
"None",
",",
"axes",
"=",
"'gca'",
")",
":",
"if",
"axes",
"==",
"'gca'",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"lines",
"=",
"axes",
".",
"get_lines",
"(",
")",
"for",
"li... | applies function fx to all xdata and fy to all ydata. | [
"applies",
"function",
"fx",
"to",
"all",
"xdata",
"and",
"fy",
"to",
"all",
"ydata",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1465-L1481 |
Spinmob/spinmob | _pylab_tweaks.py | export_figure | def export_figure(dpi=200, figure="gcf", path=None):
"""
Saves the actual postscript data for the figure.
"""
if figure=="gcf": figure = _pylab.gcf()
if path==None: path = _s.dialogs.Save("*.*", default_directory="save_plot_default_directory")
if path=="":
print("aborted.")
ret... | python | def export_figure(dpi=200, figure="gcf", path=None):
"""
Saves the actual postscript data for the figure.
"""
if figure=="gcf": figure = _pylab.gcf()
if path==None: path = _s.dialogs.Save("*.*", default_directory="save_plot_default_directory")
if path=="":
print("aborted.")
ret... | [
"def",
"export_figure",
"(",
"dpi",
"=",
"200",
",",
"figure",
"=",
"\"gcf\"",
",",
"path",
"=",
"None",
")",
":",
"if",
"figure",
"==",
"\"gcf\"",
":",
"figure",
"=",
"_pylab",
".",
"gcf",
"(",
")",
"if",
"path",
"==",
"None",
":",
"path",
"=",
... | Saves the actual postscript data for the figure. | [
"Saves",
"the",
"actual",
"postscript",
"data",
"for",
"the",
"figure",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1720-L1732 |
Spinmob/spinmob | _pylab_tweaks.py | save_plot | def save_plot(axes="gca", path=None):
"""
Saves the figure in my own ascii format
"""
global line_attributes
# choose a path to save to
if path==None: path = _s.dialogs.Save("*.plot", default_directory="save_plot_default_directory")
if path=="":
print("aborted.")
return
... | python | def save_plot(axes="gca", path=None):
"""
Saves the figure in my own ascii format
"""
global line_attributes
# choose a path to save to
if path==None: path = _s.dialogs.Save("*.plot", default_directory="save_plot_default_directory")
if path=="":
print("aborted.")
return
... | [
"def",
"save_plot",
"(",
"axes",
"=",
"\"gca\"",
",",
"path",
"=",
"None",
")",
":",
"global",
"line_attributes",
"# choose a path to save to",
"if",
"path",
"==",
"None",
":",
"path",
"=",
"_s",
".",
"dialogs",
".",
"Save",
"(",
"\"*.plot\"",
",",
"defaul... | Saves the figure in my own ascii format | [
"Saves",
"the",
"figure",
"in",
"my",
"own",
"ascii",
"format"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1734-L1774 |
Spinmob/spinmob | _pylab_tweaks.py | save_figure_raw_data | def save_figure_raw_data(figure="gcf", **kwargs):
"""
This will just output an ascii file for each of the traces in the shown figure.
**kwargs are sent to dialogs.Save()
"""
# choose a path to save to
path = _s.dialogs.Save(**kwargs)
if path=="": return "aborted."
# if no argument was... | python | def save_figure_raw_data(figure="gcf", **kwargs):
"""
This will just output an ascii file for each of the traces in the shown figure.
**kwargs are sent to dialogs.Save()
"""
# choose a path to save to
path = _s.dialogs.Save(**kwargs)
if path=="": return "aborted."
# if no argument was... | [
"def",
"save_figure_raw_data",
"(",
"figure",
"=",
"\"gcf\"",
",",
"*",
"*",
"kwargs",
")",
":",
"# choose a path to save to",
"path",
"=",
"_s",
".",
"dialogs",
".",
"Save",
"(",
"*",
"*",
"kwargs",
")",
"if",
"path",
"==",
"\"\"",
":",
"return",
"\"abo... | This will just output an ascii file for each of the traces in the shown figure.
**kwargs are sent to dialogs.Save() | [
"This",
"will",
"just",
"output",
"an",
"ascii",
"file",
"for",
"each",
"of",
"the",
"traces",
"in",
"the",
"shown",
"figure",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1776-L1807 |
Spinmob/spinmob | _pylab_tweaks.py | style_cycle.get_line_color | def get_line_color(self, increment=1):
"""
Returns the current color, then increments the color by what's specified
"""
i = self.line_colors_index
self.line_colors_index += increment
if self.line_colors_index >= len(self.line_colors):
self.line_colors_index ... | python | def get_line_color(self, increment=1):
"""
Returns the current color, then increments the color by what's specified
"""
i = self.line_colors_index
self.line_colors_index += increment
if self.line_colors_index >= len(self.line_colors):
self.line_colors_index ... | [
"def",
"get_line_color",
"(",
"self",
",",
"increment",
"=",
"1",
")",
":",
"i",
"=",
"self",
".",
"line_colors_index",
"self",
".",
"line_colors_index",
"+=",
"increment",
"if",
"self",
".",
"line_colors_index",
">=",
"len",
"(",
"self",
".",
"line_colors",... | Returns the current color, then increments the color by what's specified | [
"Returns",
"the",
"current",
"color",
"then",
"increments",
"the",
"color",
"by",
"what",
"s",
"specified"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1989-L2001 |
Spinmob/spinmob | _pylab_tweaks.py | style_cycle.get_marker | def get_marker(self, increment=1):
"""
Returns the current marker, then increments the marker by what's specified
"""
i = self.markers_index
self.markers_index += increment
if self.markers_index >= len(self.markers):
self.markers_index = self.markers_index-l... | python | def get_marker(self, increment=1):
"""
Returns the current marker, then increments the marker by what's specified
"""
i = self.markers_index
self.markers_index += increment
if self.markers_index >= len(self.markers):
self.markers_index = self.markers_index-l... | [
"def",
"get_marker",
"(",
"self",
",",
"increment",
"=",
"1",
")",
":",
"i",
"=",
"self",
".",
"markers_index",
"self",
".",
"markers_index",
"+=",
"increment",
"if",
"self",
".",
"markers_index",
">=",
"len",
"(",
"self",
".",
"markers",
")",
":",
"se... | Returns the current marker, then increments the marker by what's specified | [
"Returns",
"the",
"current",
"marker",
"then",
"increments",
"the",
"marker",
"by",
"what",
"s",
"specified"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L2009-L2021 |
Spinmob/spinmob | _pylab_tweaks.py | style_cycle.get_linestyle | def get_linestyle(self, increment=1):
"""
Returns the current marker, then increments the marker by what's specified
"""
i = self.linestyles_index
self.linestyles_index += increment
if self.linestyles_index >= len(self.linestyles):
self.linestyles_index = se... | python | def get_linestyle(self, increment=1):
"""
Returns the current marker, then increments the marker by what's specified
"""
i = self.linestyles_index
self.linestyles_index += increment
if self.linestyles_index >= len(self.linestyles):
self.linestyles_index = se... | [
"def",
"get_linestyle",
"(",
"self",
",",
"increment",
"=",
"1",
")",
":",
"i",
"=",
"self",
".",
"linestyles_index",
"self",
".",
"linestyles_index",
"+=",
"increment",
"if",
"self",
".",
"linestyles_index",
">=",
"len",
"(",
"self",
".",
"linestyles",
")... | Returns the current marker, then increments the marker by what's specified | [
"Returns",
"the",
"current",
"marker",
"then",
"increments",
"the",
"marker",
"by",
"what",
"s",
"specified"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L2027-L2039 |
Spinmob/spinmob | _pylab_tweaks.py | style_cycle.get_face_color | def get_face_color(self, increment=1):
"""
Returns the current face, then increments the face by what's specified
"""
i = self.face_colors_index
self.face_colors_index += increment
if self.face_colors_index >= len(self.face_colors):
self.face_colors_index = ... | python | def get_face_color(self, increment=1):
"""
Returns the current face, then increments the face by what's specified
"""
i = self.face_colors_index
self.face_colors_index += increment
if self.face_colors_index >= len(self.face_colors):
self.face_colors_index = ... | [
"def",
"get_face_color",
"(",
"self",
",",
"increment",
"=",
"1",
")",
":",
"i",
"=",
"self",
".",
"face_colors_index",
"self",
".",
"face_colors_index",
"+=",
"increment",
"if",
"self",
".",
"face_colors_index",
">=",
"len",
"(",
"self",
".",
"face_colors",... | Returns the current face, then increments the face by what's specified | [
"Returns",
"the",
"current",
"face",
"then",
"increments",
"the",
"face",
"by",
"what",
"s",
"specified"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L2045-L2057 |
Spinmob/spinmob | _pylab_tweaks.py | style_cycle.get_edge_color | def get_edge_color(self, increment=1):
"""
Returns the current face, then increments the face by what's specified
"""
i = self.edge_colors_index
self.edge_colors_index += increment
if self.edge_colors_index >= len(self.edge_colors):
self.edge_colors_index = ... | python | def get_edge_color(self, increment=1):
"""
Returns the current face, then increments the face by what's specified
"""
i = self.edge_colors_index
self.edge_colors_index += increment
if self.edge_colors_index >= len(self.edge_colors):
self.edge_colors_index = ... | [
"def",
"get_edge_color",
"(",
"self",
",",
"increment",
"=",
"1",
")",
":",
"i",
"=",
"self",
".",
"edge_colors_index",
"self",
".",
"edge_colors_index",
"+=",
"increment",
"if",
"self",
".",
"edge_colors_index",
">=",
"len",
"(",
"self",
".",
"edge_colors",... | Returns the current face, then increments the face by what's specified | [
"Returns",
"the",
"current",
"face",
"then",
"increments",
"the",
"face",
"by",
"what",
"s",
"specified"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L2063-L2075 |
Spinmob/spinmob | _pylab_tweaks.py | style_cycle.apply | def apply(self, axes="gca"):
"""
Applies the style cycle to the lines in the axes specified
"""
if axes == "gca": axes = _pylab.gca()
self.reset()
lines = axes.get_lines()
for l in lines:
l.set_color(self.get_line_color(1))
l.set_mfc(self... | python | def apply(self, axes="gca"):
"""
Applies the style cycle to the lines in the axes specified
"""
if axes == "gca": axes = _pylab.gca()
self.reset()
lines = axes.get_lines()
for l in lines:
l.set_color(self.get_line_color(1))
l.set_mfc(self... | [
"def",
"apply",
"(",
"self",
",",
"axes",
"=",
"\"gca\"",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"self",
".",
"reset",
"(",
")",
"lines",
"=",
"axes",
".",
"get_lines",
"(",
")",
"for",
"l",
"... | Applies the style cycle to the lines in the axes specified | [
"Applies",
"the",
"style",
"cycle",
"to",
"the",
"lines",
"in",
"the",
"axes",
"specified"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L2082-L2098 |
sgaynetdinov/py-vkontakte | vk/messages.py | Message._send_message | def _send_message(session, user_id, message=None, image_files=None):
"""
https://vk.com/dev/messages.send
"""
assert any([message, image_files])
attachment_items = None
if image_files:
attachment_items = Photo._upload_messages_photos_for_group(session, user_i... | python | def _send_message(session, user_id, message=None, image_files=None):
"""
https://vk.com/dev/messages.send
"""
assert any([message, image_files])
attachment_items = None
if image_files:
attachment_items = Photo._upload_messages_photos_for_group(session, user_i... | [
"def",
"_send_message",
"(",
"session",
",",
"user_id",
",",
"message",
"=",
"None",
",",
"image_files",
"=",
"None",
")",
":",
"assert",
"any",
"(",
"[",
"message",
",",
"image_files",
"]",
")",
"attachment_items",
"=",
"None",
"if",
"image_files",
":",
... | https://vk.com/dev/messages.send | [
"https",
":",
"//",
"vk",
".",
"com",
"/",
"dev",
"/",
"messages",
".",
"send"
] | train | https://github.com/sgaynetdinov/py-vkontakte/blob/c09654f89008b5847418bb66f1f9c408cd7aa128/vk/messages.py#L36-L47 |
sgaynetdinov/py-vkontakte | vk/messages.py | Message.get_dialog | def get_dialog(session, unread=False, important=False, unanswered=False):
"""
https://vk.com/dev/messages.getDialogs
"""
response = session.fetch("messages.getDialogs", unread=unread, important=important, unanswered=unanswered)
dialog_json_items = response["items"]
return... | python | def get_dialog(session, unread=False, important=False, unanswered=False):
"""
https://vk.com/dev/messages.getDialogs
"""
response = session.fetch("messages.getDialogs", unread=unread, important=important, unanswered=unanswered)
dialog_json_items = response["items"]
return... | [
"def",
"get_dialog",
"(",
"session",
",",
"unread",
"=",
"False",
",",
"important",
"=",
"False",
",",
"unanswered",
"=",
"False",
")",
":",
"response",
"=",
"session",
".",
"fetch",
"(",
"\"messages.getDialogs\"",
",",
"unread",
"=",
"unread",
",",
"impor... | https://vk.com/dev/messages.getDialogs | [
"https",
":",
"//",
"vk",
".",
"com",
"/",
"dev",
"/",
"messages",
".",
"getDialogs"
] | train | https://github.com/sgaynetdinov/py-vkontakte/blob/c09654f89008b5847418bb66f1f9c408cd7aa128/vk/messages.py#L57-L63 |
sgaynetdinov/py-vkontakte | vk/groups.py | Group.get_members | def get_members(self, sort='id_asc'):
"""
:param: sort {id_asc, id_desc, time_asc, time_desc} string
Docs: https://vk.com/dev/groups.getMembers
"""
return self._session.fetch_items("groups.getMembers", User.from_json, 1000, group_id=self.id, sort=sort, fields=User.__slots__ + Use... | python | def get_members(self, sort='id_asc'):
"""
:param: sort {id_asc, id_desc, time_asc, time_desc} string
Docs: https://vk.com/dev/groups.getMembers
"""
return self._session.fetch_items("groups.getMembers", User.from_json, 1000, group_id=self.id, sort=sort, fields=User.__slots__ + Use... | [
"def",
"get_members",
"(",
"self",
",",
"sort",
"=",
"'id_asc'",
")",
":",
"return",
"self",
".",
"_session",
".",
"fetch_items",
"(",
"\"groups.getMembers\"",
",",
"User",
".",
"from_json",
",",
"1000",
",",
"group_id",
"=",
"self",
".",
"id",
",",
"sor... | :param: sort {id_asc, id_desc, time_asc, time_desc} string
Docs: https://vk.com/dev/groups.getMembers | [
":",
"param",
":",
"sort",
"{",
"id_asc",
"id_desc",
"time_asc",
"time_desc",
"}",
"string",
"Docs",
":",
"https",
":",
"//",
"vk",
".",
"com",
"/",
"dev",
"/",
"groups",
".",
"getMembers"
] | train | https://github.com/sgaynetdinov/py-vkontakte/blob/c09654f89008b5847418bb66f1f9c408cd7aa128/vk/groups.py#L41-L46 |
sgaynetdinov/py-vkontakte | vk/groups.py | Group._get_user_groups | def _get_user_groups(session, user_id, filter):
"""
https://vk.com/dev/groups.get
:param filter: {admin, editor, moder, groups, publics, events}
:yield: Groups
"""
return session.fetch_items('groups.get', Group.from_json, count=1000, user_id=user_id, filter=filter, exten... | python | def _get_user_groups(session, user_id, filter):
"""
https://vk.com/dev/groups.get
:param filter: {admin, editor, moder, groups, publics, events}
:yield: Groups
"""
return session.fetch_items('groups.get', Group.from_json, count=1000, user_id=user_id, filter=filter, exten... | [
"def",
"_get_user_groups",
"(",
"session",
",",
"user_id",
",",
"filter",
")",
":",
"return",
"session",
".",
"fetch_items",
"(",
"'groups.get'",
",",
"Group",
".",
"from_json",
",",
"count",
"=",
"1000",
",",
"user_id",
"=",
"user_id",
",",
"filter",
"=",... | https://vk.com/dev/groups.get
:param filter: {admin, editor, moder, groups, publics, events}
:yield: Groups | [
"https",
":",
"//",
"vk",
".",
"com",
"/",
"dev",
"/",
"groups",
".",
"get"
] | train | https://github.com/sgaynetdinov/py-vkontakte/blob/c09654f89008b5847418bb66f1f9c408cd7aa128/vk/groups.py#L87-L94 |
Spinmob/spinmob | _spline.py | copy_spline_array | def copy_spline_array(a):
"""
This returns an instance of a new spline_array with all the fixins, and the data from a.
"""
b = spline_array()
b.x_splines = a.x_splines
b.y_splines = a.y_splines
b.max_y_splines = a.max_y_splines
b.xmin = a.xmin
b.xmax = a.xmax
b.ymin = a.ym... | python | def copy_spline_array(a):
"""
This returns an instance of a new spline_array with all the fixins, and the data from a.
"""
b = spline_array()
b.x_splines = a.x_splines
b.y_splines = a.y_splines
b.max_y_splines = a.max_y_splines
b.xmin = a.xmin
b.xmax = a.xmax
b.ymin = a.ym... | [
"def",
"copy_spline_array",
"(",
"a",
")",
":",
"b",
"=",
"spline_array",
"(",
")",
"b",
".",
"x_splines",
"=",
"a",
".",
"x_splines",
"b",
".",
"y_splines",
"=",
"a",
".",
"y_splines",
"b",
".",
"max_y_splines",
"=",
"a",
".",
"max_y_splines",
"b",
... | This returns an instance of a new spline_array with all the fixins, and the data from a. | [
"This",
"returns",
"an",
"instance",
"of",
"a",
"new",
"spline_array",
"with",
"all",
"the",
"fixins",
"and",
"the",
"data",
"from",
"a",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L343-L365 |
Spinmob/spinmob | _spline.py | splot | def splot(axes="gca", smoothing=5000, degree=5, presmoothing=0, plot=True, spline_class=spline_single, interactive=True, show_derivative=1):
"""
gets the data from the plot and feeds it into splint
returns an instance of spline_single
axes="gca" which axes to get the data from.
... | python | def splot(axes="gca", smoothing=5000, degree=5, presmoothing=0, plot=True, spline_class=spline_single, interactive=True, show_derivative=1):
"""
gets the data from the plot and feeds it into splint
returns an instance of spline_single
axes="gca" which axes to get the data from.
... | [
"def",
"splot",
"(",
"axes",
"=",
"\"gca\"",
",",
"smoothing",
"=",
"5000",
",",
"degree",
"=",
"5",
",",
"presmoothing",
"=",
"0",
",",
"plot",
"=",
"True",
",",
"spline_class",
"=",
"spline_single",
",",
"interactive",
"=",
"True",
",",
"show_derivativ... | gets the data from the plot and feeds it into splint
returns an instance of spline_single
axes="gca" which axes to get the data from.
smoothing=5000 spline_single smoothing parameter
presmoothing=0 spline_single data presmoothing factor (nearest neighbor)
... | [
"gets",
"the",
"data",
"from",
"the",
"plot",
"and",
"feeds",
"it",
"into",
"splint",
"returns",
"an",
"instance",
"of",
"spline_single"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L532-L558 |
Spinmob/spinmob | _spline.py | spline_single.evaluate | def evaluate(self, x, derivative=0, smooth=0, simple='auto'):
"""
smooth=0 is how much to smooth the spline data
simple='auto' is whether we should just use straight interpolation
you may want smooth > 0 for this, when derivative=1
"""
if simple==... | python | def evaluate(self, x, derivative=0, smooth=0, simple='auto'):
"""
smooth=0 is how much to smooth the spline data
simple='auto' is whether we should just use straight interpolation
you may want smooth > 0 for this, when derivative=1
"""
if simple==... | [
"def",
"evaluate",
"(",
"self",
",",
"x",
",",
"derivative",
"=",
"0",
",",
"smooth",
"=",
"0",
",",
"simple",
"=",
"'auto'",
")",
":",
"if",
"simple",
"==",
"'auto'",
":",
"simple",
"=",
"self",
".",
"simple",
"# make it into an array if it isn't one, and... | smooth=0 is how much to smooth the spline data
simple='auto' is whether we should just use straight interpolation
you may want smooth > 0 for this, when derivative=1 | [
"smooth",
"=",
"0",
"is",
"how",
"much",
"to",
"smooth",
"the",
"spline",
"data",
"simple",
"=",
"auto",
"is",
"whether",
"we",
"should",
"just",
"use",
"straight",
"interpolation",
"you",
"may",
"want",
"smooth",
">",
"0",
"for",
"this",
"when",
"deriva... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L77-L151 |
Spinmob/spinmob | _spline.py | spline_array.evaluate | def evaluate(self, x, y, x_derivative=0, smooth=0, simple='auto'):
"""
this evaluates the 2-d spline by doing linear interpolation of the curves
"""
if simple=='auto': simple = self.simple
# find which values y is in between
for n in range(0, len(self.y_va... | python | def evaluate(self, x, y, x_derivative=0, smooth=0, simple='auto'):
"""
this evaluates the 2-d spline by doing linear interpolation of the curves
"""
if simple=='auto': simple = self.simple
# find which values y is in between
for n in range(0, len(self.y_va... | [
"def",
"evaluate",
"(",
"self",
",",
"x",
",",
"y",
",",
"x_derivative",
"=",
"0",
",",
"smooth",
"=",
"0",
",",
"simple",
"=",
"'auto'",
")",
":",
"if",
"simple",
"==",
"'auto'",
":",
"simple",
"=",
"self",
".",
"simple",
"# find which values y is in ... | this evaluates the 2-d spline by doing linear interpolation of the curves | [
"this",
"evaluates",
"the",
"2",
"-",
"d",
"spline",
"by",
"doing",
"linear",
"interpolation",
"of",
"the",
"curves"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L239-L258 |
Spinmob/spinmob | _spline.py | spline_array.plot_fixed_x | def plot_fixed_x(self, x_values, x_derivative=0, steps=1000, smooth=0, simple='auto', ymin="auto", ymax="auto", format=True, clear=1):
"""
plots the data at fixed x-value, so z vs x
"""
if simple=='auto': simple=self.simple
# get the min and max
if ymin=="auto": ... | python | def plot_fixed_x(self, x_values, x_derivative=0, steps=1000, smooth=0, simple='auto', ymin="auto", ymax="auto", format=True, clear=1):
"""
plots the data at fixed x-value, so z vs x
"""
if simple=='auto': simple=self.simple
# get the min and max
if ymin=="auto": ... | [
"def",
"plot_fixed_x",
"(",
"self",
",",
"x_values",
",",
"x_derivative",
"=",
"0",
",",
"steps",
"=",
"1000",
",",
"smooth",
"=",
"0",
",",
"simple",
"=",
"'auto'",
",",
"ymin",
"=",
"\"auto\"",
",",
"ymax",
"=",
"\"auto\"",
",",
"format",
"=",
"Tru... | plots the data at fixed x-value, so z vs x | [
"plots",
"the",
"data",
"at",
"fixed",
"x",
"-",
"value",
"so",
"z",
"vs",
"x"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L261-L289 |
Spinmob/spinmob | _spline.py | spline_array.plot_fixed_y | def plot_fixed_y(self, y_values, x_derivative=0, steps=1000, smooth=0, simple='auto', xmin="auto", xmax="auto", format=True, clear=1):
"""
plots the data at a fixed y-value, so z vs y
"""
if simple=='auto': simple=self.simple
# get the min and max
if xmin=="auto": xmin ... | python | def plot_fixed_y(self, y_values, x_derivative=0, steps=1000, smooth=0, simple='auto', xmin="auto", xmax="auto", format=True, clear=1):
"""
plots the data at a fixed y-value, so z vs y
"""
if simple=='auto': simple=self.simple
# get the min and max
if xmin=="auto": xmin ... | [
"def",
"plot_fixed_y",
"(",
"self",
",",
"y_values",
",",
"x_derivative",
"=",
"0",
",",
"steps",
"=",
"1000",
",",
"smooth",
"=",
"0",
",",
"simple",
"=",
"'auto'",
",",
"xmin",
"=",
"\"auto\"",
",",
"xmax",
"=",
"\"auto\"",
",",
"format",
"=",
"Tru... | plots the data at a fixed y-value, so z vs y | [
"plots",
"the",
"data",
"at",
"a",
"fixed",
"y",
"-",
"value",
"so",
"z",
"vs",
"y"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L298-L329 |
Spinmob/spinmob | egg/_gui.py | BaseObject.get_window | def get_window(self):
"""
Returns the object's parent window. Returns None if no window found.
"""
x = self
while not x._parent == None and \
not isinstance(x._parent, Window):
x = x._parent
return x._parent | python | def get_window(self):
"""
Returns the object's parent window. Returns None if no window found.
"""
x = self
while not x._parent == None and \
not isinstance(x._parent, Window):
x = x._parent
return x._parent | [
"def",
"get_window",
"(",
"self",
")",
":",
"x",
"=",
"self",
"while",
"not",
"x",
".",
"_parent",
"==",
"None",
"and",
"not",
"isinstance",
"(",
"x",
".",
"_parent",
",",
"Window",
")",
":",
"x",
"=",
"x",
".",
"_parent",
"return",
"x",
".",
"_p... | Returns the object's parent window. Returns None if no window found. | [
"Returns",
"the",
"object",
"s",
"parent",
"window",
".",
"Returns",
"None",
"if",
"no",
"window",
"found",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L93-L101 |
Spinmob/spinmob | egg/_gui.py | BaseObject.sleep | def sleep(self, seconds=0.05, dt=0.01):
"""
A "smooth" version of time.sleep(): waits for the time to pass but
processes events every dt as well.
Note this requires that the object is either a window or embedded
somewhere within a window.
"""
t0 = _t.tim... | python | def sleep(self, seconds=0.05, dt=0.01):
"""
A "smooth" version of time.sleep(): waits for the time to pass but
processes events every dt as well.
Note this requires that the object is either a window or embedded
somewhere within a window.
"""
t0 = _t.tim... | [
"def",
"sleep",
"(",
"self",
",",
"seconds",
"=",
"0.05",
",",
"dt",
"=",
"0.01",
")",
":",
"t0",
"=",
"_t",
".",
"time",
"(",
")",
"while",
"_t",
".",
"time",
"(",
")",
"-",
"t0",
"<",
"seconds",
":",
"# Pause a bit to avoid heavy CPU",
"_t",
".",... | A "smooth" version of time.sleep(): waits for the time to pass but
processes events every dt as well.
Note this requires that the object is either a window or embedded
somewhere within a window. | [
"A",
"smooth",
"version",
"of",
"time",
".",
"sleep",
"()",
":",
"waits",
"for",
"the",
"time",
"to",
"pass",
"but",
"processes",
"events",
"every",
"dt",
"as",
"well",
".",
"Note",
"this",
"requires",
"that",
"the",
"object",
"is",
"either",
"a",
"win... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L114-L129 |
Spinmob/spinmob | egg/_gui.py | BaseObject.block_events | def block_events(self):
"""
Prevents the widget from sending signals.
"""
self._widget.blockSignals(True)
self._widget.setUpdatesEnabled(False) | python | def block_events(self):
"""
Prevents the widget from sending signals.
"""
self._widget.blockSignals(True)
self._widget.setUpdatesEnabled(False) | [
"def",
"block_events",
"(",
"self",
")",
":",
"self",
".",
"_widget",
".",
"blockSignals",
"(",
"True",
")",
"self",
".",
"_widget",
".",
"setUpdatesEnabled",
"(",
"False",
")"
] | Prevents the widget from sending signals. | [
"Prevents",
"the",
"widget",
"from",
"sending",
"signals",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L132-L137 |
Spinmob/spinmob | egg/_gui.py | BaseObject.unblock_events | def unblock_events(self):
"""
Allows the widget to send signals.
"""
self._widget.blockSignals(False)
self._widget.setUpdatesEnabled(True) | python | def unblock_events(self):
"""
Allows the widget to send signals.
"""
self._widget.blockSignals(False)
self._widget.setUpdatesEnabled(True) | [
"def",
"unblock_events",
"(",
"self",
")",
":",
"self",
".",
"_widget",
".",
"blockSignals",
"(",
"False",
")",
"self",
".",
"_widget",
".",
"setUpdatesEnabled",
"(",
"True",
")"
] | Allows the widget to send signals. | [
"Allows",
"the",
"widget",
"to",
"send",
"signals",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L139-L144 |
Spinmob/spinmob | egg/_gui.py | BaseObject.print_message | def print_message(self, message="heya!"):
"""
If self.log is defined to be an instance of TextLog, it print the
message there. Otherwise use the usual "print" to command line.
"""
if self.log == None: print(message)
else: self.log.append_text(message) | python | def print_message(self, message="heya!"):
"""
If self.log is defined to be an instance of TextLog, it print the
message there. Otherwise use the usual "print" to command line.
"""
if self.log == None: print(message)
else: self.log.append_text(message) | [
"def",
"print_message",
"(",
"self",
",",
"message",
"=",
"\"heya!\"",
")",
":",
"if",
"self",
".",
"log",
"==",
"None",
":",
"print",
"(",
"message",
")",
"else",
":",
"self",
".",
"log",
".",
"append_text",
"(",
"message",
")"
] | If self.log is defined to be an instance of TextLog, it print the
message there. Otherwise use the usual "print" to command line. | [
"If",
"self",
".",
"log",
"is",
"defined",
"to",
"be",
"an",
"instance",
"of",
"TextLog",
"it",
"print",
"the",
"message",
"there",
".",
"Otherwise",
"use",
"the",
"usual",
"print",
"to",
"command",
"line",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L170-L176 |
Spinmob/spinmob | egg/_gui.py | BaseObject.save_gui_settings | def save_gui_settings(self, *a):
"""
Saves just the current configuration of the controls if the
autosettings_path is set.
"""
# only if we're supposed to!
if self._autosettings_path:
# Get the gui settings directory
gui_settings_dir = _o... | python | def save_gui_settings(self, *a):
"""
Saves just the current configuration of the controls if the
autosettings_path is set.
"""
# only if we're supposed to!
if self._autosettings_path:
# Get the gui settings directory
gui_settings_dir = _o... | [
"def",
"save_gui_settings",
"(",
"self",
",",
"*",
"a",
")",
":",
"# only if we're supposed to!",
"if",
"self",
".",
"_autosettings_path",
":",
"# Get the gui settings directory",
"gui_settings_dir",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"_cwd",
",",
"'egg_se... | Saves just the current configuration of the controls if the
autosettings_path is set. | [
"Saves",
"just",
"the",
"current",
"configuration",
"of",
"the",
"controls",
"if",
"the",
"autosettings_path",
"is",
"set",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L178-L203 |
Spinmob/spinmob | egg/_gui.py | BaseObject.load_gui_settings | def load_gui_settings(self, lazy_only=False):
"""
Loads the settings (if we're supposed to).
Parameters
----------
lazy_only=False
If True, it will only load the settings into self._lazy_load, and
not try to update the value. Presumably the widget... | python | def load_gui_settings(self, lazy_only=False):
"""
Loads the settings (if we're supposed to).
Parameters
----------
lazy_only=False
If True, it will only load the settings into self._lazy_load, and
not try to update the value. Presumably the widget... | [
"def",
"load_gui_settings",
"(",
"self",
",",
"lazy_only",
"=",
"False",
")",
":",
"# only do this if we're supposed to",
"if",
"self",
".",
"_autosettings_path",
"is",
"not",
"None",
":",
"# Get the gui settings directory",
"gui_settings_dir",
"=",
"_os",
".",
"path"... | Loads the settings (if we're supposed to).
Parameters
----------
lazy_only=False
If True, it will only load the settings into self._lazy_load, and
not try to update the value. Presumably the widget will apply these
settings later, e.g., when enough ta... | [
"Loads",
"the",
"settings",
"(",
"if",
"we",
"re",
"supposed",
"to",
")",
".",
"Parameters",
"----------",
"lazy_only",
"=",
"False",
"If",
"True",
"it",
"will",
"only",
"load",
"the",
"settings",
"into",
"self",
".",
"_lazy_load",
"and",
"not",
"try",
"... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L206-L246 |
Spinmob/spinmob | egg/_gui.py | BaseObject._load_gui_setting | def _load_gui_setting(self, key, d=None):
"""
Safely reads the header setting and sets the appropriate control
value.
Parameters
----------
key
Key string of the format 'self.controlname'.
d = None
Databox instance or dictionary, ... | python | def _load_gui_setting(self, key, d=None):
"""
Safely reads the header setting and sets the appropriate control
value.
Parameters
----------
key
Key string of the format 'self.controlname'.
d = None
Databox instance or dictionary, ... | [
"def",
"_load_gui_setting",
"(",
"self",
",",
"key",
",",
"d",
"=",
"None",
")",
":",
"# Whether we should pop the value from the dictionary when we set it.",
"pop_value",
"=",
"False",
"# If d is None, assume we're using the lazy load settings.",
"if",
"d",
"==",
"None",
"... | Safely reads the header setting and sets the appropriate control
value.
Parameters
----------
key
Key string of the format 'self.controlname'.
d = None
Databox instance or dictionary, presumably containing the aforementioned
key. If d... | [
"Safely",
"reads",
"the",
"header",
"setting",
"and",
"sets",
"the",
"appropriate",
"control",
"value",
".",
"Parameters",
"----------",
"key",
"Key",
"string",
"of",
"the",
"format",
"self",
".",
"controlname",
".",
"d",
"=",
"None",
"Databox",
"instance",
... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L248-L286 |
Spinmob/spinmob | egg/_gui.py | BaseObject._store_gui_setting | def _store_gui_setting(self, databox, name):
"""
Stores the gui setting in the header of the supplied databox.
hkeys in the file are set to have the format
"self.controlname"
"""
try: databox.insert_header(name, eval(name + ".get_value()"))
except: print("ERROR... | python | def _store_gui_setting(self, databox, name):
"""
Stores the gui setting in the header of the supplied databox.
hkeys in the file are set to have the format
"self.controlname"
"""
try: databox.insert_header(name, eval(name + ".get_value()"))
except: print("ERROR... | [
"def",
"_store_gui_setting",
"(",
"self",
",",
"databox",
",",
"name",
")",
":",
"try",
":",
"databox",
".",
"insert_header",
"(",
"name",
",",
"eval",
"(",
"name",
"+",
"\".get_value()\"",
")",
")",
"except",
":",
"print",
"(",
"\"ERROR: Could not store gui... | Stores the gui setting in the header of the supplied databox.
hkeys in the file are set to have the format
"self.controlname" | [
"Stores",
"the",
"gui",
"setting",
"in",
"the",
"header",
"of",
"the",
"supplied",
"databox",
".",
"hkeys",
"in",
"the",
"file",
"are",
"set",
"to",
"have",
"the",
"format",
"self",
".",
"controlname"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L288-L295 |
Spinmob/spinmob | egg/_gui.py | GridLayout.place_object | def place_object(self, object, column=None, row=None, column_span=1, row_span=1, alignment=1):
"""
This adds either one of our simplified objects or a QWidget to the
grid at the specified position, appends the object to self.objects.
alignment=0 Fill the space.
alignment=1 ... | python | def place_object(self, object, column=None, row=None, column_span=1, row_span=1, alignment=1):
"""
This adds either one of our simplified objects or a QWidget to the
grid at the specified position, appends the object to self.objects.
alignment=0 Fill the space.
alignment=1 ... | [
"def",
"place_object",
"(",
"self",
",",
"object",
",",
"column",
"=",
"None",
",",
"row",
"=",
"None",
",",
"column_span",
"=",
"1",
",",
"row_span",
"=",
"1",
",",
"alignment",
"=",
"1",
")",
":",
"# pick a column",
"if",
"column",
"==",
"None",
":... | This adds either one of our simplified objects or a QWidget to the
grid at the specified position, appends the object to self.objects.
alignment=0 Fill the space.
alignment=1 Left-justified.
alignment=2 Right-justified.
If column isn't specified, the new object will... | [
"This",
"adds",
"either",
"one",
"of",
"our",
"simplified",
"objects",
"or",
"a",
"QWidget",
"to",
"the",
"grid",
"at",
"the",
"specified",
"position",
"appends",
"the",
"object",
"to",
"self",
".",
"objects",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L369-L408 |
Spinmob/spinmob | egg/_gui.py | GridLayout.remove_object | def remove_object(self, object=0, delete=True):
"""
Removes the supplied object from the grid. If object is an integer,
it removes the n'th object.
"""
if type(object) in [int, int]: n = object
else: n = self.objects.index(object)
# pop ... | python | def remove_object(self, object=0, delete=True):
"""
Removes the supplied object from the grid. If object is an integer,
it removes the n'th object.
"""
if type(object) in [int, int]: n = object
else: n = self.objects.index(object)
# pop ... | [
"def",
"remove_object",
"(",
"self",
",",
"object",
"=",
"0",
",",
"delete",
"=",
"True",
")",
":",
"if",
"type",
"(",
"object",
")",
"in",
"[",
"int",
",",
"int",
"]",
":",
"n",
"=",
"object",
"else",
":",
"n",
"=",
"self",
".",
"objects",
"."... | Removes the supplied object from the grid. If object is an integer,
it removes the n'th object. | [
"Removes",
"the",
"supplied",
"object",
"from",
"the",
"grid",
".",
"If",
"object",
"is",
"an",
"integer",
"it",
"removes",
"the",
"n",
"th",
"object",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L410-L429 |
Spinmob/spinmob | egg/_gui.py | GridLayout.set_column_stretch | def set_column_stretch(self, column=0, stretch=10):
"""
Sets the column stretch. Larger numbers mean it will expand more to
fill space.
"""
self._layout.setColumnStretch(column, stretch)
return self | python | def set_column_stretch(self, column=0, stretch=10):
"""
Sets the column stretch. Larger numbers mean it will expand more to
fill space.
"""
self._layout.setColumnStretch(column, stretch)
return self | [
"def",
"set_column_stretch",
"(",
"self",
",",
"column",
"=",
"0",
",",
"stretch",
"=",
"10",
")",
":",
"self",
".",
"_layout",
".",
"setColumnStretch",
"(",
"column",
",",
"stretch",
")",
"return",
"self"
] | Sets the column stretch. Larger numbers mean it will expand more to
fill space. | [
"Sets",
"the",
"column",
"stretch",
".",
"Larger",
"numbers",
"mean",
"it",
"will",
"expand",
"more",
"to",
"fill",
"space",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L439-L445 |
Spinmob/spinmob | egg/_gui.py | GridLayout.set_row_stretch | def set_row_stretch(self, row=0, stretch=10):
"""
Sets the row stretch. Larger numbers mean it will expand more to fill
space.
"""
self._layout.setRowStretch(row, stretch)
return self | python | def set_row_stretch(self, row=0, stretch=10):
"""
Sets the row stretch. Larger numbers mean it will expand more to fill
space.
"""
self._layout.setRowStretch(row, stretch)
return self | [
"def",
"set_row_stretch",
"(",
"self",
",",
"row",
"=",
"0",
",",
"stretch",
"=",
"10",
")",
":",
"self",
".",
"_layout",
".",
"setRowStretch",
"(",
"row",
",",
"stretch",
")",
"return",
"self"
] | Sets the row stretch. Larger numbers mean it will expand more to fill
space. | [
"Sets",
"the",
"row",
"stretch",
".",
"Larger",
"numbers",
"mean",
"it",
"will",
"expand",
"more",
"to",
"fill",
"space",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L447-L453 |
Spinmob/spinmob | egg/_gui.py | GridLayout.new_autorow | def new_autorow(self, row=None):
"""
Sets the auto-add row. If row=None, increments by 1
"""
if row==None: self._auto_row += 1
else: self._auto_row = row
self._auto_column=0
return self | python | def new_autorow(self, row=None):
"""
Sets the auto-add row. If row=None, increments by 1
"""
if row==None: self._auto_row += 1
else: self._auto_row = row
self._auto_column=0
return self | [
"def",
"new_autorow",
"(",
"self",
",",
"row",
"=",
"None",
")",
":",
"if",
"row",
"==",
"None",
":",
"self",
".",
"_auto_row",
"+=",
"1",
"else",
":",
"self",
".",
"_auto_row",
"=",
"row",
"self",
".",
"_auto_column",
"=",
"0",
"return",
"self"
] | Sets the auto-add row. If row=None, increments by 1 | [
"Sets",
"the",
"auto",
"-",
"add",
"row",
".",
"If",
"row",
"=",
"None",
"increments",
"by",
"1"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L455-L463 |
Spinmob/spinmob | egg/_gui.py | Window.place_docker | def place_docker(self, docker, area='top'):
"""
IN DEVELOPMENT
Places a DockWindow instance at the specified area ('top', 'bottom',
'left', 'right', or None)
"""
# map of options
m = dict(top = _g.QtCore.Qt.TopDockWidgetArea,
bottom = ... | python | def place_docker(self, docker, area='top'):
"""
IN DEVELOPMENT
Places a DockWindow instance at the specified area ('top', 'bottom',
'left', 'right', or None)
"""
# map of options
m = dict(top = _g.QtCore.Qt.TopDockWidgetArea,
bottom = ... | [
"def",
"place_docker",
"(",
"self",
",",
"docker",
",",
"area",
"=",
"'top'",
")",
":",
"# map of options",
"m",
"=",
"dict",
"(",
"top",
"=",
"_g",
".",
"QtCore",
".",
"Qt",
".",
"TopDockWidgetArea",
",",
"bottom",
"=",
"_g",
".",
"QtCore",
".",
"Qt... | IN DEVELOPMENT
Places a DockWindow instance at the specified area ('top', 'bottom',
'left', 'right', or None) | [
"IN",
"DEVELOPMENT",
"Places",
"a",
"DockWindow",
"instance",
"at",
"the",
"specified",
"area",
"(",
"top",
"bottom",
"left",
"right",
"or",
"None",
")"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L536-L562 |
Spinmob/spinmob | egg/_gui.py | Window._save_settings | def _save_settings(self):
"""
Saves all the parameters to a text file.
"""
if self._autosettings_path == None: return
# Get the gui settings directory
gui_settings_dir = _os.path.join(_cwd, 'egg_settings')
# make sure the directory exists
if not ... | python | def _save_settings(self):
"""
Saves all the parameters to a text file.
"""
if self._autosettings_path == None: return
# Get the gui settings directory
gui_settings_dir = _os.path.join(_cwd, 'egg_settings')
# make sure the directory exists
if not ... | [
"def",
"_save_settings",
"(",
"self",
")",
":",
"if",
"self",
".",
"_autosettings_path",
"==",
"None",
":",
"return",
"# Get the gui settings directory",
"gui_settings_dir",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"_cwd",
",",
"'egg_settings'",
")",
"# make s... | Saves all the parameters to a text file. | [
"Saves",
"all",
"the",
"parameters",
"to",
"a",
"text",
"file",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L602-L624 |
Spinmob/spinmob | egg/_gui.py | Window._load_settings | def _load_settings(self):
"""
Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path.
"""
if self._autosettings_path == None: return
# Get the gui settings directory
gui_settings_dir = _os.path.join(_cwd, 'egg_... | python | def _load_settings(self):
"""
Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path.
"""
if self._autosettings_path == None: return
# Get the gui settings directory
gui_settings_dir = _os.path.join(_cwd, 'egg_... | [
"def",
"_load_settings",
"(",
"self",
")",
":",
"if",
"self",
".",
"_autosettings_path",
"==",
"None",
":",
"return",
"# Get the gui settings directory",
"gui_settings_dir",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"_cwd",
",",
"'egg_settings'",
")",
"# make a... | Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path. | [
"Loads",
"all",
"the",
"parameters",
"from",
"a",
"databox",
"text",
"file",
".",
"If",
"path",
"=",
"None",
"loads",
"from",
"self",
".",
"_autosettings_path",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L626-L654 |
Spinmob/spinmob | egg/_gui.py | Window.show | def show(self, block_command_line=False, block_timing=0.05):
"""
Shows the window and raises it.
If block_command_line is 0, this will start the window up and allow you
to monkey with the command line at the same time. Otherwise, the
window will block the command line and proces... | python | def show(self, block_command_line=False, block_timing=0.05):
"""
Shows the window and raises it.
If block_command_line is 0, this will start the window up and allow you
to monkey with the command line at the same time. Otherwise, the
window will block the command line and proces... | [
"def",
"show",
"(",
"self",
",",
"block_command_line",
"=",
"False",
",",
"block_timing",
"=",
"0.05",
")",
":",
"self",
".",
"_is_open",
"=",
"True",
"self",
".",
"_window",
".",
"show",
"(",
")",
"self",
".",
"_window",
".",
"raise_",
"(",
")",
"# ... | Shows the window and raises it.
If block_command_line is 0, this will start the window up and allow you
to monkey with the command line at the same time. Otherwise, the
window will block the command line and process events every
block_timing seconds. | [
"Shows",
"the",
"window",
"and",
"raises",
"it",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L713-L738 |
Spinmob/spinmob | egg/_gui.py | Button.set_checked | def set_checked(self, value=True, block_events=False):
"""
This will set whether the button is checked.
Setting block_events=True will temporarily disable signals
from the button when setting the value.
"""
if block_events: self._widget.blockSignals(True)
self._w... | python | def set_checked(self, value=True, block_events=False):
"""
This will set whether the button is checked.
Setting block_events=True will temporarily disable signals
from the button when setting the value.
"""
if block_events: self._widget.blockSignals(True)
self._w... | [
"def",
"set_checked",
"(",
"self",
",",
"value",
"=",
"True",
",",
"block_events",
"=",
"False",
")",
":",
"if",
"block_events",
":",
"self",
".",
"_widget",
".",
"blockSignals",
"(",
"True",
")",
"self",
".",
"_widget",
".",
"setChecked",
"(",
"value",
... | This will set whether the button is checked.
Setting block_events=True will temporarily disable signals
from the button when setting the value. | [
"This",
"will",
"set",
"whether",
"the",
"button",
"is",
"checked",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L915-L926 |
Spinmob/spinmob | egg/_gui.py | Button.click | def click(self):
"""
Pretends to user clicked it, sending the signal and everything.
"""
if self.is_checkable():
if self.is_checked(): self.set_checked(False)
else: self.set_checked(True)
self.signal_clicked.emit(self.is_checked... | python | def click(self):
"""
Pretends to user clicked it, sending the signal and everything.
"""
if self.is_checkable():
if self.is_checked(): self.set_checked(False)
else: self.set_checked(True)
self.signal_clicked.emit(self.is_checked... | [
"def",
"click",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_checkable",
"(",
")",
":",
"if",
"self",
".",
"is_checked",
"(",
")",
":",
"self",
".",
"set_checked",
"(",
"False",
")",
"else",
":",
"self",
".",
"set_checked",
"(",
"True",
")",
"self... | Pretends to user clicked it, sending the signal and everything. | [
"Pretends",
"to",
"user",
"clicked",
"it",
"sending",
"the",
"signal",
"and",
"everything",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L949-L959 |
Spinmob/spinmob | egg/_gui.py | Label.set_style | def set_style(self, *args, **kwargs):
"""
Provides access to any number of style sheet settings via
self._widget.SetStyleSheet()
*args can be any element between semicolons, e.g.
self.set_stylesheet('text-align: right; padding-left: 5px')
**kwargs can be an... | python | def set_style(self, *args, **kwargs):
"""
Provides access to any number of style sheet settings via
self._widget.SetStyleSheet()
*args can be any element between semicolons, e.g.
self.set_stylesheet('text-align: right; padding-left: 5px')
**kwargs can be an... | [
"def",
"set_style",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# assemble the string",
"s",
"=",
"\"QLabel {\"",
"for",
"a",
"in",
"args",
":",
"s",
"=",
"s",
"+",
"a",
"+",
"\"; \"",
"for",
"k",
"in",
"list",
"(",
"kwargs",... | Provides access to any number of style sheet settings via
self._widget.SetStyleSheet()
*args can be any element between semicolons, e.g.
self.set_stylesheet('text-align: right; padding-left: 5px')
**kwargs can be any key-value pair, replacing '-' with '_' in the key, e.g.
... | [
"Provides",
"access",
"to",
"any",
"number",
"of",
"style",
"sheet",
"settings",
"via",
"self",
".",
"_widget",
".",
"SetStyleSheet",
"()",
"*",
"args",
"can",
"be",
"any",
"element",
"between",
"semicolons",
"e",
".",
"g",
".",
"self",
".",
"set_styleshee... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L990-L1011 |
Spinmob/spinmob | egg/_gui.py | NumberBox.set_value | def set_value(self, value, block_events=False):
"""
Sets the current value of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value.
"""
if block_events: self.block_events()
self._widget.setVal... | python | def set_value(self, value, block_events=False):
"""
Sets the current value of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value.
"""
if block_events: self.block_events()
self._widget.setVal... | [
"def",
"set_value",
"(",
"self",
",",
"value",
",",
"block_events",
"=",
"False",
")",
":",
"if",
"block_events",
":",
"self",
".",
"block_events",
"(",
")",
"self",
".",
"_widget",
".",
"setValue",
"(",
"value",
")",
"if",
"block_events",
":",
"self",
... | Sets the current value of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value. | [
"Sets",
"the",
"current",
"value",
"of",
"the",
"number",
"box",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1070-L1079 |
Spinmob/spinmob | egg/_gui.py | NumberBox.set_step | def set_step(self, value, block_events=False):
"""
Sets the step of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value.
"""
if block_events: self.block_events()
self._widget.setSingleStep(va... | python | def set_step(self, value, block_events=False):
"""
Sets the step of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value.
"""
if block_events: self.block_events()
self._widget.setSingleStep(va... | [
"def",
"set_step",
"(",
"self",
",",
"value",
",",
"block_events",
"=",
"False",
")",
":",
"if",
"block_events",
":",
"self",
".",
"block_events",
"(",
")",
"self",
".",
"_widget",
".",
"setSingleStep",
"(",
"value",
")",
"if",
"block_events",
":",
"self... | Sets the step of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value. | [
"Sets",
"the",
"step",
"of",
"the",
"number",
"box",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1081-L1090 |
Spinmob/spinmob | egg/_gui.py | ComboBox.get_text | def get_text(self, index=None):
"""
Gets text from a given index. If index=None, returns the current value
self.get_text(self.get_value())
"""
if index==None:
return self.get_text(self.get_value())
else:
return str(self._widget.itemText(index)) | python | def get_text(self, index=None):
"""
Gets text from a given index. If index=None, returns the current value
self.get_text(self.get_value())
"""
if index==None:
return self.get_text(self.get_value())
else:
return str(self._widget.itemText(index)) | [
"def",
"get_text",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"==",
"None",
":",
"return",
"self",
".",
"get_text",
"(",
"self",
".",
"get_value",
"(",
")",
")",
"else",
":",
"return",
"str",
"(",
"self",
".",
"_widget",
".",
... | Gets text from a given index. If index=None, returns the current value
self.get_text(self.get_value()) | [
"Gets",
"text",
"from",
"a",
"given",
"index",
".",
"If",
"index",
"=",
"None",
"returns",
"the",
"current",
"value",
"self",
".",
"get_text",
"(",
"self",
".",
"get_value",
"()",
")"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1193-L1201 |
Spinmob/spinmob | egg/_gui.py | ComboBox.get_all_items | def get_all_items(self):
"""
Returns all items in the combobox dictionary.
"""
return [self._widget.itemText(k) for k in range(self._widget.count())] | python | def get_all_items(self):
"""
Returns all items in the combobox dictionary.
"""
return [self._widget.itemText(k) for k in range(self._widget.count())] | [
"def",
"get_all_items",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"_widget",
".",
"itemText",
"(",
"k",
")",
"for",
"k",
"in",
"range",
"(",
"self",
".",
"_widget",
".",
"count",
"(",
")",
")",
"]"
] | Returns all items in the combobox dictionary. | [
"Returns",
"all",
"items",
"in",
"the",
"combobox",
"dictionary",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1206-L1210 |
Spinmob/spinmob | egg/_gui.py | TabArea.add_tab | def add_tab(self, title="Yeah!", block_events=True):
"""
Adds a tab to the area, and creates the layout for this tab.
"""
self._widget.blockSignals(block_events)
# create a widget to go in the tab
tab = GridLayout()
self.tabs.append(tab)
tab.set_parent(se... | python | def add_tab(self, title="Yeah!", block_events=True):
"""
Adds a tab to the area, and creates the layout for this tab.
"""
self._widget.blockSignals(block_events)
# create a widget to go in the tab
tab = GridLayout()
self.tabs.append(tab)
tab.set_parent(se... | [
"def",
"add_tab",
"(",
"self",
",",
"title",
"=",
"\"Yeah!\"",
",",
"block_events",
"=",
"True",
")",
":",
"self",
".",
"_widget",
".",
"blockSignals",
"(",
"block_events",
")",
"# create a widget to go in the tab",
"tab",
"=",
"GridLayout",
"(",
")",
"self",
... | Adds a tab to the area, and creates the layout for this tab. | [
"Adds",
"a",
"tab",
"to",
"the",
"area",
"and",
"creates",
"the",
"layout",
"for",
"this",
"tab",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1271-L1292 |
Spinmob/spinmob | egg/_gui.py | TabArea.remove_tab | def remove_tab(self, tab=0):
"""
Removes the tab by index.
"""
# pop it from the list
t = self.tabs.pop(tab)
# remove it from the gui
self._widget.removeTab(tab)
# return it in case someone cares
return t | python | def remove_tab(self, tab=0):
"""
Removes the tab by index.
"""
# pop it from the list
t = self.tabs.pop(tab)
# remove it from the gui
self._widget.removeTab(tab)
# return it in case someone cares
return t | [
"def",
"remove_tab",
"(",
"self",
",",
"tab",
"=",
"0",
")",
":",
"# pop it from the list",
"t",
"=",
"self",
".",
"tabs",
".",
"pop",
"(",
"tab",
")",
"# remove it from the gui",
"self",
".",
"_widget",
".",
"removeTab",
"(",
"tab",
")",
"# return it in c... | Removes the tab by index. | [
"Removes",
"the",
"tab",
"by",
"index",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1294-L1306 |
Spinmob/spinmob | egg/_gui.py | Table.get_value | def get_value(self, column=0, row=0):
"""
Returns a the value at column, row.
"""
x = self._widget.item(row, column)
if x==None: return x
else: return str(self._widget.item(row,column).text()) | python | def get_value(self, column=0, row=0):
"""
Returns a the value at column, row.
"""
x = self._widget.item(row, column)
if x==None: return x
else: return str(self._widget.item(row,column).text()) | [
"def",
"get_value",
"(",
"self",
",",
"column",
"=",
"0",
",",
"row",
"=",
"0",
")",
":",
"x",
"=",
"self",
".",
"_widget",
".",
"item",
"(",
"row",
",",
"column",
")",
"if",
"x",
"==",
"None",
":",
"return",
"x",
"else",
":",
"return",
"str",
... | Returns a the value at column, row. | [
"Returns",
"a",
"the",
"value",
"at",
"column",
"row",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1369-L1376 |
Spinmob/spinmob | egg/_gui.py | Table.set_value | def set_value(self, column=0, row=0, value='', block_events=False):
"""
Sets the value at column, row. This will create elements dynamically,
and in a totally stupid while-looping way.
Setting block_events=True will temporarily block the widget from
sending any signals when sett... | python | def set_value(self, column=0, row=0, value='', block_events=False):
"""
Sets the value at column, row. This will create elements dynamically,
and in a totally stupid while-looping way.
Setting block_events=True will temporarily block the widget from
sending any signals when sett... | [
"def",
"set_value",
"(",
"self",
",",
"column",
"=",
"0",
",",
"row",
"=",
"0",
",",
"value",
"=",
"''",
",",
"block_events",
"=",
"False",
")",
":",
"if",
"block_events",
":",
"self",
".",
"block_events",
"(",
")",
"# dynamically resize",
"while",
"co... | Sets the value at column, row. This will create elements dynamically,
and in a totally stupid while-looping way.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value. | [
"Sets",
"the",
"value",
"at",
"column",
"row",
".",
"This",
"will",
"create",
"elements",
"dynamically",
"and",
"in",
"a",
"totally",
"stupid",
"while",
"-",
"looping",
"way",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1378-L1398 |
Spinmob/spinmob | egg/_gui.py | Table.set_column_width | def set_column_width(self, n=0, width=120):
"""
Sets the n'th column width in pixels.
"""
self._widget.setColumnWidth(n, width)
return self | python | def set_column_width(self, n=0, width=120):
"""
Sets the n'th column width in pixels.
"""
self._widget.setColumnWidth(n, width)
return self | [
"def",
"set_column_width",
"(",
"self",
",",
"n",
"=",
"0",
",",
"width",
"=",
"120",
")",
":",
"self",
".",
"_widget",
".",
"setColumnWidth",
"(",
"n",
",",
"width",
")",
"return",
"self"
] | Sets the n'th column width in pixels. | [
"Sets",
"the",
"n",
"th",
"column",
"width",
"in",
"pixels",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1400-L1405 |
Spinmob/spinmob | egg/_gui.py | Table.set_header_visibility | def set_header_visibility(self, column=False, row=False):
"""
Sets whether we can see the column and row headers.
"""
if row: self._widget.verticalHeader().show()
else: self._widget.verticalHeader().hide()
if column: self._widget.horizontalHeader().show()
... | python | def set_header_visibility(self, column=False, row=False):
"""
Sets whether we can see the column and row headers.
"""
if row: self._widget.verticalHeader().show()
else: self._widget.verticalHeader().hide()
if column: self._widget.horizontalHeader().show()
... | [
"def",
"set_header_visibility",
"(",
"self",
",",
"column",
"=",
"False",
",",
"row",
"=",
"False",
")",
":",
"if",
"row",
":",
"self",
".",
"_widget",
".",
"verticalHeader",
"(",
")",
".",
"show",
"(",
")",
"else",
":",
"self",
".",
"_widget",
".",
... | Sets whether we can see the column and row headers. | [
"Sets",
"whether",
"we",
"can",
"see",
"the",
"column",
"and",
"row",
"headers",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1407-L1417 |
Spinmob/spinmob | egg/_gui.py | Table.set_row_height | def set_row_height(self, n=0, height=18):
"""
Sets the n'th row height in pixels.
"""
self._widget.setRowHeight(n, height)
return self | python | def set_row_height(self, n=0, height=18):
"""
Sets the n'th row height in pixels.
"""
self._widget.setRowHeight(n, height)
return self | [
"def",
"set_row_height",
"(",
"self",
",",
"n",
"=",
"0",
",",
"height",
"=",
"18",
")",
":",
"self",
".",
"_widget",
".",
"setRowHeight",
"(",
"n",
",",
"height",
")",
"return",
"self"
] | Sets the n'th row height in pixels. | [
"Sets",
"the",
"n",
"th",
"row",
"height",
"in",
"pixels",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1419-L1424 |
Spinmob/spinmob | egg/_gui.py | TableDictionary._clean_up_key | def _clean_up_key(self, key):
"""
Returns the key string with no naughty characters.
"""
for n in self.naughty: key = key.replace(n, '_')
return key | python | def _clean_up_key(self, key):
"""
Returns the key string with no naughty characters.
"""
for n in self.naughty: key = key.replace(n, '_')
return key | [
"def",
"_clean_up_key",
"(",
"self",
",",
"key",
")",
":",
"for",
"n",
"in",
"self",
".",
"naughty",
":",
"key",
"=",
"key",
".",
"replace",
"(",
"n",
",",
"'_'",
")",
"return",
"key"
] | Returns the key string with no naughty characters. | [
"Returns",
"the",
"key",
"string",
"with",
"no",
"naughty",
"characters",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1467-L1472 |
Spinmob/spinmob | egg/_gui.py | TableDictionary._cell_changed | def _cell_changed(self, *a):
"""
Called whenever a cell is changed. Updates the dictionary.
"""
# block all signals during the update (to avoid re-calling this)
self.block_events()
# loop over the rows
for n in range(self.get_row_count()):
# get the... | python | def _cell_changed(self, *a):
"""
Called whenever a cell is changed. Updates the dictionary.
"""
# block all signals during the update (to avoid re-calling this)
self.block_events()
# loop over the rows
for n in range(self.get_row_count()):
# get the... | [
"def",
"_cell_changed",
"(",
"self",
",",
"*",
"a",
")",
":",
"# block all signals during the update (to avoid re-calling this)",
"self",
".",
"block_events",
"(",
")",
"# loop over the rows",
"for",
"n",
"in",
"range",
"(",
"self",
".",
"get_row_count",
"(",
")",
... | Called whenever a cell is changed. Updates the dictionary. | [
"Called",
"whenever",
"a",
"cell",
"is",
"changed",
".",
"Updates",
"the",
"dictionary",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1474-L1511 |
Spinmob/spinmob | egg/_gui.py | TableDictionary.get_item | def get_item(self, key):
"""
Returns the value associated with the key.
"""
keys = list(self.keys())
# make sure it exists
if not key in keys:
self.print_message("ERROR: '"+str(key)+"' not found.")
return None
try:
x = eval(se... | python | def get_item(self, key):
"""
Returns the value associated with the key.
"""
keys = list(self.keys())
# make sure it exists
if not key in keys:
self.print_message("ERROR: '"+str(key)+"' not found.")
return None
try:
x = eval(se... | [
"def",
"get_item",
"(",
"self",
",",
"key",
")",
":",
"keys",
"=",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
"# make sure it exists",
"if",
"not",
"key",
"in",
"keys",
":",
"self",
".",
"print_message",
"(",
"\"ERROR: '\"",
"+",
"str",
"(",
"k... | Returns the value associated with the key. | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"key",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1513-L1530 |
Spinmob/spinmob | egg/_gui.py | TableDictionary.keys | def keys(self):
"""
Returns a sorted list of keys
"""
keys = list()
for n in range(len(self)):
# only append the valid keys
key = self.get_value()
if not key in ['', None]: keys.append(key)
return keys | python | def keys(self):
"""
Returns a sorted list of keys
"""
keys = list()
for n in range(len(self)):
# only append the valid keys
key = self.get_value()
if not key in ['', None]: keys.append(key)
return keys | [
"def",
"keys",
"(",
"self",
")",
":",
"keys",
"=",
"list",
"(",
")",
"for",
"n",
"in",
"range",
"(",
"len",
"(",
"self",
")",
")",
":",
"# only append the valid keys",
"key",
"=",
"self",
".",
"get_value",
"(",
")",
"if",
"not",
"key",
"in",
"[",
... | Returns a sorted list of keys | [
"Returns",
"a",
"sorted",
"list",
"of",
"keys"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1534-L1545 |
Spinmob/spinmob | egg/_gui.py | TableDictionary.set_item | def set_item(self, key, value):
"""
Sets the item by key, and refills the table sorted.
"""
keys = list(self.keys())
# if it exists, update
if key in keys:
self.set_value(1,keys.index(key),str(value))
# otherwise we have to add an element
els... | python | def set_item(self, key, value):
"""
Sets the item by key, and refills the table sorted.
"""
keys = list(self.keys())
# if it exists, update
if key in keys:
self.set_value(1,keys.index(key),str(value))
# otherwise we have to add an element
els... | [
"def",
"set_item",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"keys",
"=",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
"# if it exists, update",
"if",
"key",
"in",
"keys",
":",
"self",
".",
"set_value",
"(",
"1",
",",
"keys",
".",
"index... | Sets the item by key, and refills the table sorted. | [
"Sets",
"the",
"item",
"by",
"key",
"and",
"refills",
"the",
"table",
"sorted",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1547-L1560 |
Spinmob/spinmob | egg/_gui.py | TableDictionary.update | def update(self, dictionary=None, **kwargs):
"""
Adds/overwrites all the keys and values from the dictionary.
"""
if not dictionary == None: kwargs.update(dictionary)
for k in list(kwargs.keys()): self[k] = kwargs[k] | python | def update(self, dictionary=None, **kwargs):
"""
Adds/overwrites all the keys and values from the dictionary.
"""
if not dictionary == None: kwargs.update(dictionary)
for k in list(kwargs.keys()): self[k] = kwargs[k] | [
"def",
"update",
"(",
"self",
",",
"dictionary",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"dictionary",
"==",
"None",
":",
"kwargs",
".",
"update",
"(",
"dictionary",
")",
"for",
"k",
"in",
"list",
"(",
"kwargs",
".",
"keys",
"(... | Adds/overwrites all the keys and values from the dictionary. | [
"Adds",
"/",
"overwrites",
"all",
"the",
"keys",
"and",
"values",
"from",
"the",
"dictionary",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1565-L1570 |
Spinmob/spinmob | egg/_gui.py | TextBox.get_text | def get_text(self):
"""
Returns the current text.
"""
if self._multiline: return str(self._widget.toPlainText())
else: return str(self._widget.text()) | python | def get_text(self):
"""
Returns the current text.
"""
if self._multiline: return str(self._widget.toPlainText())
else: return str(self._widget.text()) | [
"def",
"get_text",
"(",
"self",
")",
":",
"if",
"self",
".",
"_multiline",
":",
"return",
"str",
"(",
"self",
".",
"_widget",
".",
"toPlainText",
"(",
")",
")",
"else",
":",
"return",
"str",
"(",
"self",
".",
"_widget",
".",
"text",
"(",
")",
")"
] | Returns the current text. | [
"Returns",
"the",
"current",
"text",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1640-L1645 |
Spinmob/spinmob | egg/_gui.py | TextBox.set_text | def set_text(self, text="YEAH."):
"""
Sets the current value of the text box.
"""
# Make sure the text is actually different, so as not to
# trigger a value changed signal
s = str(text)
if not s == self.get_text(): self._widget.setText(str(text))
return s... | python | def set_text(self, text="YEAH."):
"""
Sets the current value of the text box.
"""
# Make sure the text is actually different, so as not to
# trigger a value changed signal
s = str(text)
if not s == self.get_text(): self._widget.setText(str(text))
return s... | [
"def",
"set_text",
"(",
"self",
",",
"text",
"=",
"\"YEAH.\"",
")",
":",
"# Make sure the text is actually different, so as not to ",
"# trigger a value changed signal",
"s",
"=",
"str",
"(",
"text",
")",
"if",
"not",
"s",
"==",
"self",
".",
"get_text",
"(",
")",
... | Sets the current value of the text box. | [
"Sets",
"the",
"current",
"value",
"of",
"the",
"text",
"box",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1647-L1655 |
Spinmob/spinmob | egg/_gui.py | TextBox.set_colors | def set_colors(self, text='black', background='white'):
"""
Sets the colors of the text area.
"""
if self._multiline: self._widget.setStyleSheet("QTextEdit {background-color: "+str(background)+"; color: "+str(text)+"}")
else: self._widget.setStyleSheet("QLineEdit {b... | python | def set_colors(self, text='black', background='white'):
"""
Sets the colors of the text area.
"""
if self._multiline: self._widget.setStyleSheet("QTextEdit {background-color: "+str(background)+"; color: "+str(text)+"}")
else: self._widget.setStyleSheet("QLineEdit {b... | [
"def",
"set_colors",
"(",
"self",
",",
"text",
"=",
"'black'",
",",
"background",
"=",
"'white'",
")",
":",
"if",
"self",
".",
"_multiline",
":",
"self",
".",
"_widget",
".",
"setStyleSheet",
"(",
"\"QTextEdit {background-color: \"",
"+",
"str",
"(",
"backgr... | Sets the colors of the text area. | [
"Sets",
"the",
"colors",
"of",
"the",
"text",
"area",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1657-L1662 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.block_events | def block_events(self):
"""
Special version of block_events that loops over all tree elements.
"""
# block events in the usual way
BaseObject.block_events(self)
# loop over all top level parameters
for i in range(self._widget.topLevelItemCount()):
... | python | def block_events(self):
"""
Special version of block_events that loops over all tree elements.
"""
# block events in the usual way
BaseObject.block_events(self)
# loop over all top level parameters
for i in range(self._widget.topLevelItemCount()):
... | [
"def",
"block_events",
"(",
"self",
")",
":",
"# block events in the usual way",
"BaseObject",
".",
"block_events",
"(",
"self",
")",
"# loop over all top level parameters",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"_widget",
".",
"topLevelItemCount",
"(",
")",
... | Special version of block_events that loops over all tree elements. | [
"Special",
"version",
"of",
"block_events",
"that",
"loops",
"over",
"all",
"tree",
"elements",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1773-L1784 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.unblock_events | def unblock_events(self):
"""
Special version of unblock_events that loops over all tree elements as well.
"""
# unblock events in the usual way
BaseObject.unblock_events(self)
# loop over all top level parameters
for i in range(self._widget.topLevelItemC... | python | def unblock_events(self):
"""
Special version of unblock_events that loops over all tree elements as well.
"""
# unblock events in the usual way
BaseObject.unblock_events(self)
# loop over all top level parameters
for i in range(self._widget.topLevelItemC... | [
"def",
"unblock_events",
"(",
"self",
")",
":",
"# unblock events in the usual way",
"BaseObject",
".",
"unblock_events",
"(",
"self",
")",
"# loop over all top level parameters",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"_widget",
".",
"topLevelItemCount",
"(",
... | Special version of unblock_events that loops over all tree elements as well. | [
"Special",
"version",
"of",
"unblock_events",
"that",
"loops",
"over",
"all",
"tree",
"elements",
"as",
"well",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1786-L1797 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.connect_any_signal_changed | def connect_any_signal_changed(self, function):
"""
Connects the "anything changed" signal for all of the tree to the
specified function.
Parameters
----------
function
Function to connect to this signal.
"""
# loop over all t... | python | def connect_any_signal_changed(self, function):
"""
Connects the "anything changed" signal for all of the tree to the
specified function.
Parameters
----------
function
Function to connect to this signal.
"""
# loop over all t... | [
"def",
"connect_any_signal_changed",
"(",
"self",
",",
"function",
")",
":",
"# loop over all top level parameters",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"_widget",
".",
"topLevelItemCount",
"(",
")",
")",
":",
"# make sure there is only one connection!",
"try... | Connects the "anything changed" signal for all of the tree to the
specified function.
Parameters
----------
function
Function to connect to this signal. | [
"Connects",
"the",
"anything",
"changed",
"signal",
"for",
"all",
"of",
"the",
"tree",
"to",
"the",
"specified",
"function",
".",
"Parameters",
"----------",
"function",
"Function",
"to",
"connect",
"to",
"this",
"signal",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1800-L1821 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.connect_signal_changed | def connect_signal_changed(self, name, function):
"""
Connects a changed signal from the parameters of the specified name
to the supplied function.
"""
x = self._find_parameter(name.split("/"))
# if it pooped.
if x==None: return None
# connect it
... | python | def connect_signal_changed(self, name, function):
"""
Connects a changed signal from the parameters of the specified name
to the supplied function.
"""
x = self._find_parameter(name.split("/"))
# if it pooped.
if x==None: return None
# connect it
... | [
"def",
"connect_signal_changed",
"(",
"self",
",",
"name",
",",
"function",
")",
":",
"x",
"=",
"self",
".",
"_find_parameter",
"(",
"name",
".",
"split",
"(",
"\"/\"",
")",
")",
"# if it pooped.",
"if",
"x",
"==",
"None",
":",
"return",
"None",
"# conne... | Connects a changed signal from the parameters of the specified name
to the supplied function. | [
"Connects",
"a",
"changed",
"signal",
"from",
"the",
"parameters",
"of",
"the",
"specified",
"name",
"to",
"the",
"supplied",
"function",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1823-L1840 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.block_user_signals | def block_user_signals(self, name, ignore_error=False):
"""
Temporarily disconnects the user-defined signals for the specified
parameter name.
Note this only affects those connections made with
connect_signal_changed(), and I do not recommend adding new connections
... | python | def block_user_signals(self, name, ignore_error=False):
"""
Temporarily disconnects the user-defined signals for the specified
parameter name.
Note this only affects those connections made with
connect_signal_changed(), and I do not recommend adding new connections
... | [
"def",
"block_user_signals",
"(",
"self",
",",
"name",
",",
"ignore_error",
"=",
"False",
")",
":",
"x",
"=",
"self",
".",
"_find_parameter",
"(",
"name",
".",
"split",
"(",
"\"/\"",
")",
",",
"quiet",
"=",
"ignore_error",
")",
"# if it pooped.",
"if",
"... | Temporarily disconnects the user-defined signals for the specified
parameter name.
Note this only affects those connections made with
connect_signal_changed(), and I do not recommend adding new connections
while they're blocked! | [
"Temporarily",
"disconnects",
"the",
"user",
"-",
"defined",
"signals",
"for",
"the",
"specified",
"parameter",
"name",
".",
"Note",
"this",
"only",
"affects",
"those",
"connections",
"made",
"with",
"connect_signal_changed",
"()",
"and",
"I",
"do",
"not",
"reco... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1842-L1860 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.unblock_user_signals | def unblock_user_signals(self, name, ignore_error=False):
"""
Reconnects the user-defined signals for the specified
parameter name (blocked with "block_user_signal_changed")
Note this only affects those connections made with
connect_signal_changed(), and I do not recom... | python | def unblock_user_signals(self, name, ignore_error=False):
"""
Reconnects the user-defined signals for the specified
parameter name (blocked with "block_user_signal_changed")
Note this only affects those connections made with
connect_signal_changed(), and I do not recom... | [
"def",
"unblock_user_signals",
"(",
"self",
",",
"name",
",",
"ignore_error",
"=",
"False",
")",
":",
"x",
"=",
"self",
".",
"_find_parameter",
"(",
"name",
".",
"split",
"(",
"\"/\"",
")",
",",
"quiet",
"=",
"ignore_error",
")",
"# if it pooped.",
"if",
... | Reconnects the user-defined signals for the specified
parameter name (blocked with "block_user_signal_changed")
Note this only affects those connections made with
connect_signal_changed(), and I do not recommend adding new connections
while they're blocked! | [
"Reconnects",
"the",
"user",
"-",
"defined",
"signals",
"for",
"the",
"specified",
"parameter",
"name",
"(",
"blocked",
"with",
"block_user_signal_changed",
")",
"Note",
"this",
"only",
"affects",
"those",
"connections",
"made",
"with",
"connect_signal_changed",
"()... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1862-L1880 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary._find_parameter | def _find_parameter(self, name_list, create_missing=False, quiet=False):
"""
Tries to find and return the parameter of the specified name. The name
should be of the form
['branch1','branch2', 'parametername']
Setting create_missing=True means if it doesn't find a branch it
... | python | def _find_parameter(self, name_list, create_missing=False, quiet=False):
"""
Tries to find and return the parameter of the specified name. The name
should be of the form
['branch1','branch2', 'parametername']
Setting create_missing=True means if it doesn't find a branch it
... | [
"def",
"_find_parameter",
"(",
"self",
",",
"name_list",
",",
"create_missing",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"# make a copy so this isn't destructive to the supplied list",
"s",
"=",
"list",
"(",
"name_list",
")",
"# if the length is zero, return ... | Tries to find and return the parameter of the specified name. The name
should be of the form
['branch1','branch2', 'parametername']
Setting create_missing=True means if it doesn't find a branch it
will create one.
Setting quiet=True will suppress error messages (for checking) | [
"Tries",
"to",
"find",
"and",
"return",
"the",
"parameter",
"of",
"the",
"specified",
"name",
".",
"The",
"name",
"should",
"be",
"of",
"the",
"form"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1882-L1942 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary._clean_up_name | def _clean_up_name(self, name):
"""
Cleans up the name according to the rules specified in this exact
function. Uses self.naughty, a list of naughty characters.
"""
for n in self.naughty: name = name.replace(n, '_')
return name | python | def _clean_up_name(self, name):
"""
Cleans up the name according to the rules specified in this exact
function. Uses self.naughty, a list of naughty characters.
"""
for n in self.naughty: name = name.replace(n, '_')
return name | [
"def",
"_clean_up_name",
"(",
"self",
",",
"name",
")",
":",
"for",
"n",
"in",
"self",
".",
"naughty",
":",
"name",
"=",
"name",
".",
"replace",
"(",
"n",
",",
"'_'",
")",
"return",
"name"
] | Cleans up the name according to the rules specified in this exact
function. Uses self.naughty, a list of naughty characters. | [
"Cleans",
"up",
"the",
"name",
"according",
"to",
"the",
"rules",
"specified",
"in",
"this",
"exact",
"function",
".",
"Uses",
"self",
".",
"naughty",
"a",
"list",
"of",
"naughty",
"characters",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1946-L1952 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.add_button | def add_button(self, name, checkable=False, checked=False):
"""
Adds (and returns) a button at the specified location.
"""
# first clean up the name
name = self._clean_up_name(name)
# split into (presumably existing) branches and parameter
s = name.split('/')
... | python | def add_button(self, name, checkable=False, checked=False):
"""
Adds (and returns) a button at the specified location.
"""
# first clean up the name
name = self._clean_up_name(name)
# split into (presumably existing) branches and parameter
s = name.split('/')
... | [
"def",
"add_button",
"(",
"self",
",",
"name",
",",
"checkable",
"=",
"False",
",",
"checked",
"=",
"False",
")",
":",
"# first clean up the name",
"name",
"=",
"self",
".",
"_clean_up_name",
"(",
"name",
")",
"# split into (presumably existing) branches and paramet... | Adds (and returns) a button at the specified location. | [
"Adds",
"(",
"and",
"returns",
")",
"a",
"button",
"at",
"the",
"specified",
"location",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1954-L1997 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.add_parameter | def add_parameter(self, name='test', value=42.0, **kwargs):
"""
Adds a parameter "leaf" to the tree.
Parameters
----------
name='test'
The name of the leaf. It should be a string of the form
"branch1/branch2/parametername" and will be nested as i... | python | def add_parameter(self, name='test', value=42.0, **kwargs):
"""
Adds a parameter "leaf" to the tree.
Parameters
----------
name='test'
The name of the leaf. It should be a string of the form
"branch1/branch2/parametername" and will be nested as i... | [
"def",
"add_parameter",
"(",
"self",
",",
"name",
"=",
"'test'",
",",
"value",
"=",
"42.0",
",",
"*",
"*",
"kwargs",
")",
":",
"# update the default kwargs",
"other_kwargs",
"=",
"dict",
"(",
"type",
"=",
"None",
")",
"other_kwargs",
".",
"update",
"(",
... | Adds a parameter "leaf" to the tree.
Parameters
----------
name='test'
The name of the leaf. It should be a string of the form
"branch1/branch2/parametername" and will be nested as indicated.
value=42.0
Value of the leaf.
Com... | [
"Adds",
"a",
"parameter",
"leaf",
"to",
"the",
"tree",
".",
"Parameters",
"----------",
"name",
"=",
"test",
"The",
"name",
"of",
"the",
"leaf",
".",
"It",
"should",
"be",
"a",
"string",
"of",
"the",
"form",
"branch1",
"/",
"branch2",
"/",
"parametername... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1999-L2083 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary._get_parameter_dictionary | def _get_parameter_dictionary(self, base_name, dictionary, sorted_keys, parameter):
"""
Recursively loops over the parameter's children, adding
keys (starting with base_name) and values to the supplied dictionary
(provided they do not have a value of None).
"""
# assembl... | python | def _get_parameter_dictionary(self, base_name, dictionary, sorted_keys, parameter):
"""
Recursively loops over the parameter's children, adding
keys (starting with base_name) and values to the supplied dictionary
(provided they do not have a value of None).
"""
# assembl... | [
"def",
"_get_parameter_dictionary",
"(",
"self",
",",
"base_name",
",",
"dictionary",
",",
"sorted_keys",
",",
"parameter",
")",
":",
"# assemble the key for this parameter",
"k",
"=",
"base_name",
"+",
"\"/\"",
"+",
"parameter",
".",
"name",
"(",
")",
"# first ad... | Recursively loops over the parameter's children, adding
keys (starting with base_name) and values to the supplied dictionary
(provided they do not have a value of None). | [
"Recursively",
"loops",
"over",
"the",
"parameter",
"s",
"children",
"adding",
"keys",
"(",
"starting",
"with",
"base_name",
")",
"and",
"values",
"to",
"the",
"supplied",
"dictionary",
"(",
"provided",
"they",
"do",
"not",
"have",
"a",
"value",
"of",
"None"... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2086-L2103 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.send_to_databox_header | def send_to_databox_header(self, destination_databox):
"""
Sends all the information currently in the tree to the supplied
databox's header, in alphabetical order. If the entries already
exists, just updates them.
"""
k, d = self.get_dictionary()
destination_datab... | python | def send_to_databox_header(self, destination_databox):
"""
Sends all the information currently in the tree to the supplied
databox's header, in alphabetical order. If the entries already
exists, just updates them.
"""
k, d = self.get_dictionary()
destination_datab... | [
"def",
"send_to_databox_header",
"(",
"self",
",",
"destination_databox",
")",
":",
"k",
",",
"d",
"=",
"self",
".",
"get_dictionary",
"(",
")",
"destination_databox",
".",
"update_headers",
"(",
"d",
",",
"k",
")"
] | Sends all the information currently in the tree to the supplied
databox's header, in alphabetical order. If the entries already
exists, just updates them. | [
"Sends",
"all",
"the",
"information",
"currently",
"in",
"the",
"tree",
"to",
"the",
"supplied",
"databox",
"s",
"header",
"in",
"alphabetical",
"order",
".",
"If",
"the",
"entries",
"already",
"exists",
"just",
"updates",
"them",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2105-L2112 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.get_dictionary | def get_dictionary(self):
"""
Returns the list of parameters and a dictionary of values
(good for writing to a databox header!)
Return format is sorted_keys, dictionary
"""
# output
k = list()
d = dict()
# loop over the root items
for i ... | python | def get_dictionary(self):
"""
Returns the list of parameters and a dictionary of values
(good for writing to a databox header!)
Return format is sorted_keys, dictionary
"""
# output
k = list()
d = dict()
# loop over the root items
for i ... | [
"def",
"get_dictionary",
"(",
"self",
")",
":",
"# output",
"k",
"=",
"list",
"(",
")",
"d",
"=",
"dict",
"(",
")",
"# loop over the root items",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"_widget",
".",
"topLevelItemCount",
"(",
")",
")",
":",
"# g... | Returns the list of parameters and a dictionary of values
(good for writing to a databox header!)
Return format is sorted_keys, dictionary | [
"Returns",
"the",
"list",
"of",
"parameters",
"and",
"a",
"dictionary",
"of",
"values",
"(",
"good",
"for",
"writing",
"to",
"a",
"databox",
"header!",
")"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2114-L2135 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.get_value | def get_value(self, name):
"""
Returns the value of the parameter with the specified name.
"""
# first clean up the name
name = self._clean_up_name(name)
# now get the parameter object
x = self._find_parameter(name.split('/'))
# quit if it pooped.
... | python | def get_value(self, name):
"""
Returns the value of the parameter with the specified name.
"""
# first clean up the name
name = self._clean_up_name(name)
# now get the parameter object
x = self._find_parameter(name.split('/'))
# quit if it pooped.
... | [
"def",
"get_value",
"(",
"self",
",",
"name",
")",
":",
"# first clean up the name",
"name",
"=",
"self",
".",
"_clean_up_name",
"(",
"name",
")",
"# now get the parameter object",
"x",
"=",
"self",
".",
"_find_parameter",
"(",
"name",
".",
"split",
"(",
"'/'"... | Returns the value of the parameter with the specified name. | [
"Returns",
"the",
"value",
"of",
"the",
"parameter",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2162-L2209 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.get_list_values | def get_list_values(self, name):
"""
Returns the values for a list item of the specified name.
"""
# Make sure it's a list
if not self.get_type(name) in ['list']:
self.print_message('ERROR: "'+name+'" is not a list.')
return
# Return a co... | python | def get_list_values(self, name):
"""
Returns the values for a list item of the specified name.
"""
# Make sure it's a list
if not self.get_type(name) in ['list']:
self.print_message('ERROR: "'+name+'" is not a list.')
return
# Return a co... | [
"def",
"get_list_values",
"(",
"self",
",",
"name",
")",
":",
"# Make sure it's a list",
"if",
"not",
"self",
".",
"get_type",
"(",
"name",
")",
"in",
"[",
"'list'",
"]",
":",
"self",
".",
"print_message",
"(",
"'ERROR: \"'",
"+",
"name",
"+",
"'\" is not ... | Returns the values for a list item of the specified name. | [
"Returns",
"the",
"values",
"for",
"a",
"list",
"item",
"of",
"the",
"specified",
"name",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2213-L2223 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.set_value | def set_value(self, name, value, ignore_error=False, block_user_signals=False):
"""
Sets the variable of the supplied name to the supplied value.
Setting block_user_signals=True will temporarily block the widget from
sending any signals when setting the value.
"""
# firs... | python | def set_value(self, name, value, ignore_error=False, block_user_signals=False):
"""
Sets the variable of the supplied name to the supplied value.
Setting block_user_signals=True will temporarily block the widget from
sending any signals when setting the value.
"""
# firs... | [
"def",
"set_value",
"(",
"self",
",",
"name",
",",
"value",
",",
"ignore_error",
"=",
"False",
",",
"block_user_signals",
"=",
"False",
")",
":",
"# first clean up the name",
"name",
"=",
"self",
".",
"_clean_up_name",
"(",
"name",
")",
"# If we're supposed to, ... | Sets the variable of the supplied name to the supplied value.
Setting block_user_signals=True will temporarily block the widget from
sending any signals when setting the value. | [
"Sets",
"the",
"variable",
"of",
"the",
"supplied",
"name",
"to",
"the",
"supplied",
"value",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2225-L2259 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.save | def save(self, path=None):
"""
Saves all the parameters to a text file using the databox
functionality. If path=None, saves to self._autosettings_path. If
self._autosettings_path=None, does not save.
"""
if path==None:
if self._autosettings_path ... | python | def save(self, path=None):
"""
Saves all the parameters to a text file using the databox
functionality. If path=None, saves to self._autosettings_path. If
self._autosettings_path=None, does not save.
"""
if path==None:
if self._autosettings_path ... | [
"def",
"save",
"(",
"self",
",",
"path",
"=",
"None",
")",
":",
"if",
"path",
"==",
"None",
":",
"if",
"self",
".",
"_autosettings_path",
"==",
"None",
":",
"return",
"self",
"# Get the gui settings directory",
"gui_settings_dir",
"=",
"_os",
".",
"path",
... | Saves all the parameters to a text file using the databox
functionality. If path=None, saves to self._autosettings_path. If
self._autosettings_path=None, does not save. | [
"Saves",
"all",
"the",
"parameters",
"to",
"a",
"text",
"file",
"using",
"the",
"databox",
"functionality",
".",
"If",
"path",
"=",
"None",
"saves",
"to",
"self",
".",
"_autosettings_path",
".",
"If",
"self",
".",
"_autosettings_path",
"=",
"None",
"does",
... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2280-L2315 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.load | def load(self, path=None, ignore_errors=True, block_user_signals=False):
"""
Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path (provided this is not None).
Parameters
----------
path=None
Path to load ... | python | def load(self, path=None, ignore_errors=True, block_user_signals=False):
"""
Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path (provided this is not None).
Parameters
----------
path=None
Path to load ... | [
"def",
"load",
"(",
"self",
",",
"path",
"=",
"None",
",",
"ignore_errors",
"=",
"True",
",",
"block_user_signals",
"=",
"False",
")",
":",
"if",
"path",
"==",
"None",
":",
"# Bail if there is no path",
"if",
"self",
".",
"_autosettings_path",
"==",
"None",
... | Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path (provided this is not None).
Parameters
----------
path=None
Path to load the settings from. If None, will load from the
specified autosettings_path.
... | [
"Loads",
"all",
"the",
"parameters",
"from",
"a",
"databox",
"text",
"file",
".",
"If",
"path",
"=",
"None",
"loads",
"from",
"self",
".",
"_autosettings_path",
"(",
"provided",
"this",
"is",
"not",
"None",
")",
".",
"Parameters",
"----------",
"path",
"="... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2317-L2354 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.update | def update(self, d, ignore_errors=True, block_user_signals=False):
"""
Supply a dictionary or databox with a header of the same format
and see what happens! (Hint: it updates the existing values.)
This will store non-existent key-value pairs in the dictionary
self._lazy... | python | def update(self, d, ignore_errors=True, block_user_signals=False):
"""
Supply a dictionary or databox with a header of the same format
and see what happens! (Hint: it updates the existing values.)
This will store non-existent key-value pairs in the dictionary
self._lazy... | [
"def",
"update",
"(",
"self",
",",
"d",
",",
"ignore_errors",
"=",
"True",
",",
"block_user_signals",
"=",
"False",
")",
":",
"if",
"not",
"type",
"(",
"d",
")",
"==",
"dict",
":",
"d",
"=",
"d",
".",
"headers",
"# Update the lazy load",
"self",
".",
... | Supply a dictionary or databox with a header of the same format
and see what happens! (Hint: it updates the existing values.)
This will store non-existent key-value pairs in the dictionary
self._lazy_load. When you add settings in the future,
these will be checked for the defau... | [
"Supply",
"a",
"dictionary",
"or",
"databox",
"with",
"a",
"header",
"of",
"the",
"same",
"format",
"and",
"see",
"what",
"happens!",
"(",
"Hint",
":",
"it",
"updates",
"the",
"existing",
"values",
".",
")",
"This",
"will",
"store",
"non",
"-",
"existent... | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2356-L2380 |
Spinmob/spinmob | egg/_gui.py | TreeDictionary._set_value_safe | def _set_value_safe(self, k, v, ignore_errors=False, block_user_signals=False):
"""
Actually sets the value, first by trying it directly, then by
"""
# for safety: by default assume it's a repr() with python code
try:
self.set_value(k, v, ignore_error = ignore_... | python | def _set_value_safe(self, k, v, ignore_errors=False, block_user_signals=False):
"""
Actually sets the value, first by trying it directly, then by
"""
# for safety: by default assume it's a repr() with python code
try:
self.set_value(k, v, ignore_error = ignore_... | [
"def",
"_set_value_safe",
"(",
"self",
",",
"k",
",",
"v",
",",
"ignore_errors",
"=",
"False",
",",
"block_user_signals",
"=",
"False",
")",
":",
"# for safety: by default assume it's a repr() with python code",
"try",
":",
"self",
".",
"set_value",
"(",
"k",
",",... | Actually sets the value, first by trying it directly, then by | [
"Actually",
"sets",
"the",
"value",
"first",
"by",
"trying",
"it",
"directly",
"then",
"by"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2382-L2392 |
Spinmob/spinmob | egg/_gui.py | DataboxPlot._button_autosave_clicked | def _button_autosave_clicked(self, checked):
"""
Called whenever the button is clicked.
"""
if checked:
# get the path from the user
path = _spinmob.dialogs.save(filters=self.file_type)
# abort if necessary
if not path:
sel... | python | def _button_autosave_clicked(self, checked):
"""
Called whenever the button is clicked.
"""
if checked:
# get the path from the user
path = _spinmob.dialogs.save(filters=self.file_type)
# abort if necessary
if not path:
sel... | [
"def",
"_button_autosave_clicked",
"(",
"self",
",",
"checked",
")",
":",
"if",
"checked",
":",
"# get the path from the user",
"path",
"=",
"_spinmob",
".",
"dialogs",
".",
"save",
"(",
"filters",
"=",
"self",
".",
"file_type",
")",
"# abort if necessary",
"if"... | Called whenever the button is clicked. | [
"Called",
"whenever",
"the",
"button",
"is",
"clicked",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2556-L2573 |
Spinmob/spinmob | egg/_gui.py | DataboxPlot.save_file | def save_file(self, path=None, force_overwrite=False, just_settings=False, **kwargs):
"""
Saves the data in the databox to a file.
Parameters
----------
path=None
Path for output. If set to None, use a save dialog.
force_overwrite=False
Do not que... | python | def save_file(self, path=None, force_overwrite=False, just_settings=False, **kwargs):
"""
Saves the data in the databox to a file.
Parameters
----------
path=None
Path for output. If set to None, use a save dialog.
force_overwrite=False
Do not que... | [
"def",
"save_file",
"(",
"self",
",",
"path",
"=",
"None",
",",
"force_overwrite",
"=",
"False",
",",
"just_settings",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Update the binary mode",
"if",
"not",
"'binary'",
"in",
"kwargs",
":",
"kwargs",
"[",... | Saves the data in the databox to a file.
Parameters
----------
path=None
Path for output. If set to None, use a save dialog.
force_overwrite=False
Do not question the overwrite if the file already exists.
just_settings=False
Set to True to sa... | [
"Saves",
"the",
"data",
"in",
"the",
"databox",
"to",
"a",
"file",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2594-L2623 |
Spinmob/spinmob | egg/_gui.py | DataboxPlot.load_file | def load_file(self, path=None, just_settings=False):
"""
Loads a data file. After the file is loaded, calls self.after_load_file(self),
which you can overwrite if you like!
just_settings=True will only load the configuration of the controls,
and will not plot anything or run aft... | python | def load_file(self, path=None, just_settings=False):
"""
Loads a data file. After the file is loaded, calls self.after_load_file(self),
which you can overwrite if you like!
just_settings=True will only load the configuration of the controls,
and will not plot anything or run aft... | [
"def",
"load_file",
"(",
"self",
",",
"path",
"=",
"None",
",",
"just_settings",
"=",
"False",
")",
":",
"# if it's just the settings file, make a new databox",
"if",
"just_settings",
":",
"d",
"=",
"_d",
".",
"databox",
"(",
")",
"header_only",
"=",
"True",
"... | Loads a data file. After the file is loaded, calls self.after_load_file(self),
which you can overwrite if you like!
just_settings=True will only load the configuration of the controls,
and will not plot anything or run after_load_file | [
"Loads",
"a",
"data",
"file",
".",
"After",
"the",
"file",
"is",
"loaded",
"calls",
"self",
".",
"after_load_file",
"(",
"self",
")",
"which",
"you",
"can",
"overwrite",
"if",
"you",
"like!"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2625-L2655 |
Spinmob/spinmob | egg/_gui.py | DataboxPlot._autoscript | def _autoscript(self):
"""
Automatically generates a python script for plotting.
"""
# This should never happen unless I screwed up.
if self.combo_autoscript.get_index() == 0: return "ERROR: Ask Jack."
# if there is no data, leave it blank
if len(self)... | python | def _autoscript(self):
"""
Automatically generates a python script for plotting.
"""
# This should never happen unless I screwed up.
if self.combo_autoscript.get_index() == 0: return "ERROR: Ask Jack."
# if there is no data, leave it blank
if len(self)... | [
"def",
"_autoscript",
"(",
"self",
")",
":",
"# This should never happen unless I screwed up.",
"if",
"self",
".",
"combo_autoscript",
".",
"get_index",
"(",
")",
"==",
"0",
":",
"return",
"\"ERROR: Ask Jack.\"",
"# if there is no data, leave it blank",
"if",
"len",
"("... | Automatically generates a python script for plotting. | [
"Automatically",
"generates",
"a",
"python",
"script",
"for",
"plotting",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2673-L2747 |
Spinmob/spinmob | egg/_gui.py | DataboxPlot.plot | def plot(self):
"""
Sets the internal databox to the supplied value and plots it.
If databox=None, this will plot the internal databox.
"""
# if we're disabled or have no data columns, clear everything!
if not self.button_enabled.is_checked() or len(self) == 0:
... | python | def plot(self):
"""
Sets the internal databox to the supplied value and plots it.
If databox=None, this will plot the internal databox.
"""
# if we're disabled or have no data columns, clear everything!
if not self.button_enabled.is_checked() or len(self) == 0:
... | [
"def",
"plot",
"(",
"self",
")",
":",
"# if we're disabled or have no data columns, clear everything!",
"if",
"not",
"self",
".",
"button_enabled",
".",
"is_checked",
"(",
")",
"or",
"len",
"(",
"self",
")",
"==",
"0",
":",
"self",
".",
"_set_number_of_plots",
"... | Sets the internal databox to the supplied value and plots it.
If databox=None, this will plot the internal databox. | [
"Sets",
"the",
"internal",
"databox",
"to",
"the",
"supplied",
"value",
"and",
"plots",
"it",
".",
"If",
"databox",
"=",
"None",
"this",
"will",
"plot",
"the",
"internal",
"databox",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2756-L2840 |
Spinmob/spinmob | egg/_gui.py | DataboxPlot.autosave | def autosave(self):
"""
Autosaves the currently stored data, but only if autosave is checked!
"""
# make sure we're suppoed to
if self.button_autosave.is_checked():
# save the file
self.save_file(_os.path.join(self._autosave_directory, "%04d " % (self.num... | python | def autosave(self):
"""
Autosaves the currently stored data, but only if autosave is checked!
"""
# make sure we're suppoed to
if self.button_autosave.is_checked():
# save the file
self.save_file(_os.path.join(self._autosave_directory, "%04d " % (self.num... | [
"def",
"autosave",
"(",
"self",
")",
":",
"# make sure we're suppoed to",
"if",
"self",
".",
"button_autosave",
".",
"is_checked",
"(",
")",
":",
"# save the file",
"self",
".",
"save_file",
"(",
"_os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_autosave_... | Autosaves the currently stored data, but only if autosave is checked! | [
"Autosaves",
"the",
"currently",
"stored",
"data",
"but",
"only",
"if",
"autosave",
"is",
"checked!"
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2842-L2853 |
Spinmob/spinmob | egg/_gui.py | DataboxPlot.autozoom | def autozoom(self, n=None):
"""
Auto-scales the axes to fit all the data in plot index n. If n == None,
auto-scale everyone.
"""
if n==None:
for p in self.plot_widgets: p.autoRange()
else: self.plot_widgets[n].autoRange()
return self | python | def autozoom(self, n=None):
"""
Auto-scales the axes to fit all the data in plot index n. If n == None,
auto-scale everyone.
"""
if n==None:
for p in self.plot_widgets: p.autoRange()
else: self.plot_widgets[n].autoRange()
return self | [
"def",
"autozoom",
"(",
"self",
",",
"n",
"=",
"None",
")",
":",
"if",
"n",
"==",
"None",
":",
"for",
"p",
"in",
"self",
".",
"plot_widgets",
":",
"p",
".",
"autoRange",
"(",
")",
"else",
":",
"self",
".",
"plot_widgets",
"[",
"n",
"]",
".",
"a... | Auto-scales the axes to fit all the data in plot index n. If n == None,
auto-scale everyone. | [
"Auto",
"-",
"scales",
"the",
"axes",
"to",
"fit",
"all",
"the",
"data",
"in",
"plot",
"index",
"n",
".",
"If",
"n",
"==",
"None",
"auto",
"-",
"scale",
"everyone",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2855-L2864 |
Spinmob/spinmob | egg/_gui.py | DataboxPlot._synchronize_controls | def _synchronize_controls(self):
"""
Updates the gui based on button configs.
"""
# whether the script is visible
self.grid_script._widget.setVisible(self.button_script.get_value())
# whether we should be able to edit it.
if not self.combo_autoscript.get_index()... | python | def _synchronize_controls(self):
"""
Updates the gui based on button configs.
"""
# whether the script is visible
self.grid_script._widget.setVisible(self.button_script.get_value())
# whether we should be able to edit it.
if not self.combo_autoscript.get_index()... | [
"def",
"_synchronize_controls",
"(",
"self",
")",
":",
"# whether the script is visible",
"self",
".",
"grid_script",
".",
"_widget",
".",
"setVisible",
"(",
"self",
".",
"button_script",
".",
"get_value",
"(",
")",
")",
"# whether we should be able to edit it.",
"if"... | Updates the gui based on button configs. | [
"Updates",
"the",
"gui",
"based",
"on",
"button",
"configs",
"."
] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2866-L2876 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.