partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | RecordDumpLoader.create_file | Create a single file with all versions. | invenio_migrator/records.py | def create_file(self, bucket, key, file_versions):
"""Create a single file with all versions."""
objs = []
for file_ver in file_versions:
f = FileInstance.create().set_uri(
file_ver['full_path'],
file_ver['size'],
'md5:{0}'.format(file_... | def create_file(self, bucket, key, file_versions):
"""Create a single file with all versions."""
objs = []
for file_ver in file_versions:
f = FileInstance.create().set_uri(
file_ver['full_path'],
file_ver['size'],
'md5:{0}'.format(file_... | [
"Create",
"a",
"single",
"file",
"with",
"all",
"versions",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L197-L213 | [
"def",
"create_file",
"(",
"self",
",",
"bucket",
",",
"key",
",",
"file_versions",
")",
":",
"objs",
"=",
"[",
"]",
"for",
"file_ver",
"in",
"file_versions",
":",
"f",
"=",
"FileInstance",
".",
"create",
"(",
")",
".",
"set_uri",
"(",
"file_ver",
"[",... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | RecordDumpLoader.delete_buckets | Delete the bucket. | invenio_migrator/records.py | def delete_buckets(cls, record):
"""Delete the bucket."""
files = record.get('_files', [])
buckets = set()
for f in files:
buckets.add(f.get('bucket'))
for b_id in buckets:
b = Bucket.get(b_id)
b.deleted = True | def delete_buckets(cls, record):
"""Delete the bucket."""
files = record.get('_files', [])
buckets = set()
for f in files:
buckets.add(f.get('bucket'))
for b_id in buckets:
b = Bucket.get(b_id)
b.deleted = True | [
"Delete",
"the",
"bucket",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L216-L224 | [
"def",
"delete_buckets",
"(",
"cls",
",",
"record",
")",
":",
"files",
"=",
"record",
".",
"get",
"(",
"'_files'",
",",
"[",
"]",
")",
"buckets",
"=",
"set",
"(",
")",
"for",
"f",
"in",
"files",
":",
"buckets",
".",
"add",
"(",
"f",
".",
"get",
... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | RecordDump.missing_pids | Filter persistent identifiers. | invenio_migrator/records.py | def missing_pids(self):
"""Filter persistent identifiers."""
missing = []
for p in self.pids:
try:
PersistentIdentifier.get(p.pid_type, p.pid_value)
except PIDDoesNotExistError:
missing.append(p)
return missing | def missing_pids(self):
"""Filter persistent identifiers."""
missing = []
for p in self.pids:
try:
PersistentIdentifier.get(p.pid_type, p.pid_value)
except PIDDoesNotExistError:
missing.append(p)
return missing | [
"Filter",
"persistent",
"identifiers",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L260-L268 | [
"def",
"missing_pids",
"(",
"self",
")",
":",
"missing",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"pids",
":",
"try",
":",
"PersistentIdentifier",
".",
"get",
"(",
"p",
".",
"pid_type",
",",
"p",
".",
"pid_value",
")",
"except",
"PIDDoesNotExistEr... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | RecordDump.prepare_revisions | Prepare data. | invenio_migrator/records.py | def prepare_revisions(self):
"""Prepare data."""
# Prepare revisions
self.revisions = []
it = [self.data['record'][0]] if self.latest_only \
else self.data['record']
for i in it:
self.revisions.append(self._prepare_revision(i)) | def prepare_revisions(self):
"""Prepare data."""
# Prepare revisions
self.revisions = []
it = [self.data['record'][0]] if self.latest_only \
else self.data['record']
for i in it:
self.revisions.append(self._prepare_revision(i)) | [
"Prepare",
"data",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L287-L296 | [
"def",
"prepare_revisions",
"(",
"self",
")",
":",
"# Prepare revisions",
"self",
".",
"revisions",
"=",
"[",
"]",
"it",
"=",
"[",
"self",
".",
"data",
"[",
"'record'",
"]",
"[",
"0",
"]",
"]",
"if",
"self",
".",
"latest_only",
"else",
"self",
".",
"... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | RecordDump.prepare_files | Get files from data dump. | invenio_migrator/records.py | def prepare_files(self):
"""Get files from data dump."""
# Prepare files
files = {}
for f in self.data['files']:
k = f['full_name']
if k not in files:
files[k] = []
files[k].append(f)
# Sort versions
for k in files.keys... | def prepare_files(self):
"""Get files from data dump."""
# Prepare files
files = {}
for f in self.data['files']:
k = f['full_name']
if k not in files:
files[k] = []
files[k].append(f)
# Sort versions
for k in files.keys... | [
"Get",
"files",
"from",
"data",
"dump",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L298-L312 | [
"def",
"prepare_files",
"(",
"self",
")",
":",
"# Prepare files",
"files",
"=",
"{",
"}",
"for",
"f",
"in",
"self",
".",
"data",
"[",
"'files'",
"]",
":",
"k",
"=",
"f",
"[",
"'full_name'",
"]",
"if",
"k",
"not",
"in",
"files",
":",
"files",
"[",
... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | RecordDump.prepare_pids | Prepare persistent identifiers. | invenio_migrator/records.py | def prepare_pids(self):
"""Prepare persistent identifiers."""
self.pids = []
for fetcher in self.pid_fetchers:
val = fetcher(None, self.revisions[-1][1])
if val:
self.pids.append(val) | def prepare_pids(self):
"""Prepare persistent identifiers."""
self.pids = []
for fetcher in self.pid_fetchers:
val = fetcher(None, self.revisions[-1][1])
if val:
self.pids.append(val) | [
"Prepare",
"persistent",
"identifiers",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L314-L320 | [
"def",
"prepare_pids",
"(",
"self",
")",
":",
"self",
".",
"pids",
"=",
"[",
"]",
"for",
"fetcher",
"in",
"self",
".",
"pid_fetchers",
":",
"val",
"=",
"fetcher",
"(",
"None",
",",
"self",
".",
"revisions",
"[",
"-",
"1",
"]",
"[",
"1",
"]",
")",... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | RecordDump.is_deleted | Check if record is deleted. | invenio_migrator/records.py | def is_deleted(self, record=None):
"""Check if record is deleted."""
record = record or self.revisions[-1][1]
return any(
col == 'deleted'
for col in record.get('collections', [])
) | def is_deleted(self, record=None):
"""Check if record is deleted."""
record = record or self.revisions[-1][1]
return any(
col == 'deleted'
for col in record.get('collections', [])
) | [
"Check",
"if",
"record",
"is",
"deleted",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L337-L343 | [
"def",
"is_deleted",
"(",
"self",
",",
"record",
"=",
"None",
")",
":",
"record",
"=",
"record",
"or",
"self",
".",
"revisions",
"[",
"-",
"1",
"]",
"[",
"1",
"]",
"return",
"any",
"(",
"col",
"==",
"'deleted'",
"for",
"col",
"in",
"record",
".",
... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | load_community | Load community from data dump.
:param data: Dictionary containing community data.
:type data: dict
:param logos_dir: Path to a local directory with community logos.
:type logos_dir: str | invenio_migrator/tasks/communities.py | def load_community(data, logos_dir):
"""Load community from data dump.
:param data: Dictionary containing community data.
:type data: dict
:param logos_dir: Path to a local directory with community logos.
:type logos_dir: str
"""
from invenio_communities.models import Community
from inv... | def load_community(data, logos_dir):
"""Load community from data dump.
:param data: Dictionary containing community data.
:type data: dict
:param logos_dir: Path to a local directory with community logos.
:type logos_dir: str
"""
from invenio_communities.models import Community
from inv... | [
"Load",
"community",
"from",
"data",
"dump",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/tasks/communities.py#L39-L69 | [
"def",
"load_community",
"(",
"data",
",",
"logos_dir",
")",
":",
"from",
"invenio_communities",
".",
"models",
"import",
"Community",
"from",
"invenio_communities",
".",
"utils",
"import",
"save_and_validate_logo",
"logo_ext_washed",
"=",
"logo_ext_wash",
"(",
"data"... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | load_featured | Load community featuring from data dump.
:param data: Dictionary containing community featuring data.
:type data: dict | invenio_migrator/tasks/communities.py | def load_featured(data):
"""Load community featuring from data dump.
:param data: Dictionary containing community featuring data.
:type data: dict
"""
from invenio_communities.models import FeaturedCommunity
obj = FeaturedCommunity(id=data['id'],
id_community=data['i... | def load_featured(data):
"""Load community featuring from data dump.
:param data: Dictionary containing community featuring data.
:type data: dict
"""
from invenio_communities.models import FeaturedCommunity
obj = FeaturedCommunity(id=data['id'],
id_community=data['i... | [
"Load",
"community",
"featuring",
"from",
"data",
"dump",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/tasks/communities.py#L73-L84 | [
"def",
"load_featured",
"(",
"data",
")",
":",
"from",
"invenio_communities",
".",
"models",
"import",
"FeaturedCommunity",
"obj",
"=",
"FeaturedCommunity",
"(",
"id",
"=",
"data",
"[",
"'id'",
"]",
",",
"id_community",
"=",
"data",
"[",
"'id_community'",
"]",... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | dump | Dump data from Invenio legacy. | invenio_migrator/legacy/cli.py | def dump(thing, query, from_date, file_prefix, chunk_size, limit, thing_flags):
"""Dump data from Invenio legacy."""
init_app_context()
file_prefix = file_prefix if file_prefix else '{0}_dump'.format(thing)
kwargs = dict((f.strip('-').replace('-', '_'), True) for f in thing_flags)
try:
th... | def dump(thing, query, from_date, file_prefix, chunk_size, limit, thing_flags):
"""Dump data from Invenio legacy."""
init_app_context()
file_prefix = file_prefix if file_prefix else '{0}_dump'.format(thing)
kwargs = dict((f.strip('-').replace('-', '_'), True) for f in thing_flags)
try:
th... | [
"Dump",
"data",
"from",
"Invenio",
"legacy",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/cli.py#L57-L97 | [
"def",
"dump",
"(",
"thing",
",",
"query",
",",
"from_date",
",",
"file_prefix",
",",
"chunk_size",
",",
"limit",
",",
"thing_flags",
")",
":",
"init_app_context",
"(",
")",
"file_prefix",
"=",
"file_prefix",
"if",
"file_prefix",
"else",
"'{0}_dump'",
".",
"... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | check | Check data in Invenio legacy. | invenio_migrator/legacy/cli.py | def check(thing):
"""Check data in Invenio legacy."""
init_app_context()
try:
thing_func = collect_things_entry_points()[thing]
except KeyError:
click.Abort(
'{0} is not in the list of available things to migrate: '
'{1}'.format(thing, collect_things_entry_points... | def check(thing):
"""Check data in Invenio legacy."""
init_app_context()
try:
thing_func = collect_things_entry_points()[thing]
except KeyError:
click.Abort(
'{0} is not in the list of available things to migrate: '
'{1}'.format(thing, collect_things_entry_points... | [
"Check",
"data",
"in",
"Invenio",
"legacy",
"."
] | inveniosoftware/invenio-migrator | python | https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/cli.py#L102-L122 | [
"def",
"check",
"(",
"thing",
")",
":",
"init_app_context",
"(",
")",
"try",
":",
"thing_func",
"=",
"collect_things_entry_points",
"(",
")",
"[",
"thing",
"]",
"except",
"KeyError",
":",
"click",
".",
"Abort",
"(",
"'{0} is not in the list of available things to ... | 6902c6968a39b747d15e32363f43b7dffe2622c2 |
test | BasicWidget.registerEventHandlers | Registers event handlers used by this widget, e.g. mouse click/motion and window resize.
This will allow the widget to redraw itself upon resizing of the window in case the position needs to be adjusted. | peng3d/gui/widgets.py | def registerEventHandlers(self):
"""
Registers event handlers used by this widget, e.g. mouse click/motion and window resize.
This will allow the widget to redraw itself upon resizing of the window in case the position needs to be adjusted.
"""
self.peng.registerEventHan... | def registerEventHandlers(self):
"""
Registers event handlers used by this widget, e.g. mouse click/motion and window resize.
This will allow the widget to redraw itself upon resizing of the window in case the position needs to be adjusted.
"""
self.peng.registerEventHan... | [
"Registers",
"event",
"handlers",
"used",
"by",
"this",
"widget",
"e",
".",
"g",
".",
"mouse",
"click",
"/",
"motion",
"and",
"window",
"resize",
".",
"This",
"will",
"allow",
"the",
"widget",
"to",
"redraw",
"itself",
"upon",
"resizing",
"of",
"the",
"w... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/widgets.py#L173-L183 | [
"def",
"registerEventHandlers",
"(",
"self",
")",
":",
"self",
".",
"peng",
".",
"registerEventHandler",
"(",
"\"on_mouse_press\"",
",",
"self",
".",
"on_mouse_press",
")",
"self",
".",
"peng",
".",
"registerEventHandler",
"(",
"\"on_mouse_release\"",
",",
"self",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | BasicWidget.pos | Property that will always be a 2-tuple representing the position of the widget.
Note that this method may call the method given as ``pos`` in the initializer.
The returned object will actually be an instance of a helper class to allow for setting only the x/y coordinate.
... | peng3d/gui/widgets.py | def pos(self):
"""
Property that will always be a 2-tuple representing the position of the widget.
Note that this method may call the method given as ``pos`` in the initializer.
The returned object will actually be an instance of a helper class to allow for setting only... | def pos(self):
"""
Property that will always be a 2-tuple representing the position of the widget.
Note that this method may call the method given as ``pos`` in the initializer.
The returned object will actually be an instance of a helper class to allow for setting only... | [
"Property",
"that",
"will",
"always",
"be",
"a",
"2",
"-",
"tuple",
"representing",
"the",
"position",
"of",
"the",
"widget",
".",
"Note",
"that",
"this",
"method",
"may",
"call",
"the",
"method",
"given",
"as",
"pos",
"in",
"the",
"initializer",
".",
"T... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/widgets.py#L186-L211 | [
"def",
"pos",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"_pos",
",",
"list",
")",
"or",
"isinstance",
"(",
"self",
".",
"_pos",
",",
"tuple",
")",
":",
"r",
"=",
"self",
".",
"_pos",
"elif",
"callable",
"(",
"self",
".",
"_pos"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | BasicWidget.size | Similar to :py:attr:`pos` but for the size instead. | peng3d/gui/widgets.py | def size(self):
"""
Similar to :py:attr:`pos` but for the size instead.
"""
if isinstance(self._size,list) or isinstance(self._size,tuple):
s = self._size
elif callable(self._size):
w,h = self.submenu.size[:]
s = self._size(w,h)
else:
... | def size(self):
"""
Similar to :py:attr:`pos` but for the size instead.
"""
if isinstance(self._size,list) or isinstance(self._size,tuple):
s = self._size
elif callable(self._size):
w,h = self.submenu.size[:]
s = self._size(w,h)
else:
... | [
"Similar",
"to",
":",
"py",
":",
"attr",
":",
"pos",
"but",
"for",
"the",
"size",
"instead",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/widgets.py#L218-L239 | [
"def",
"size",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"_size",
",",
"list",
")",
"or",
"isinstance",
"(",
"self",
".",
"_size",
",",
"tuple",
")",
":",
"s",
"=",
"self",
".",
"_size",
"elif",
"callable",
"(",
"self",
".",
"_... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | BasicWidget.clickable | Property used for determining if the widget should be clickable by the user.
This is only true if the submenu of this widget is active and this widget is enabled.
The widget may be either disabled by setting this property or the :py:attr:`enabled` attribute. | peng3d/gui/widgets.py | def clickable(self):
"""
Property used for determining if the widget should be clickable by the user.
This is only true if the submenu of this widget is active and this widget is enabled.
The widget may be either disabled by setting this property or the :py:attr:`enable... | def clickable(self):
"""
Property used for determining if the widget should be clickable by the user.
This is only true if the submenu of this widget is active and this widget is enabled.
The widget may be either disabled by setting this property or the :py:attr:`enable... | [
"Property",
"used",
"for",
"determining",
"if",
"the",
"widget",
"should",
"be",
"clickable",
"by",
"the",
"user",
".",
"This",
"is",
"only",
"true",
"if",
"the",
"submenu",
"of",
"this",
"widget",
"is",
"active",
"and",
"this",
"widget",
"is",
"enabled",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/widgets.py#L246-L257 | [
"def",
"clickable",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"submenu",
",",
"Container",
")",
":",
"return",
"self",
".",
"submenu",
".",
"name",
"==",
"self",
".",
"submenu",
".",
"menu",
".",
"activeSubMenu",
"and",
"self"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | BasicWidget.delete | Deletes resources of this widget that require manual cleanup.
Currently removes all actions, event handlers and the background.
The background itself should automatically remove all vertex lists to avoid visual artifacts.
Note that this method is currently experimental... | peng3d/gui/widgets.py | def delete(self):
"""
Deletes resources of this widget that require manual cleanup.
Currently removes all actions, event handlers and the background.
The background itself should automatically remove all vertex lists to avoid visual artifacts.
Note that... | def delete(self):
"""
Deletes resources of this widget that require manual cleanup.
Currently removes all actions, event handlers and the background.
The background itself should automatically remove all vertex lists to avoid visual artifacts.
Note that... | [
"Deletes",
"resources",
"of",
"this",
"widget",
"that",
"require",
"manual",
"cleanup",
".",
"Currently",
"removes",
"all",
"actions",
"event",
"handlers",
"and",
"the",
"background",
".",
"The",
"background",
"itself",
"should",
"automatically",
"remove",
"all",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/widgets.py#L379-L416 | [
"def",
"delete",
"(",
"self",
")",
":",
"# TODO: fix memory leak upon widget deletion",
"del",
"self",
".",
"bg",
".",
"widget",
"del",
"self",
".",
"bg",
"#self.clickable=False",
"del",
"self",
".",
"_pos",
"del",
"self",
".",
"_size",
"self",
".",
"actions",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Widget.on_redraw | Draws the background and the widget itself.
Subclasses should use ``super()`` to call this method, or rendering may glitch out. | peng3d/gui/widgets.py | def on_redraw(self):
"""
Draws the background and the widget itself.
Subclasses should use ``super()`` to call this method, or rendering may glitch out.
"""
if self.bg is not None:
if not self.bg.initialized:
self.bg.init_bg()
... | def on_redraw(self):
"""
Draws the background and the widget itself.
Subclasses should use ``super()`` to call this method, or rendering may glitch out.
"""
if self.bg is not None:
if not self.bg.initialized:
self.bg.init_bg()
... | [
"Draws",
"the",
"background",
"and",
"the",
"widget",
"itself",
".",
"Subclasses",
"should",
"use",
"super",
"()",
"to",
"call",
"this",
"method",
"or",
"rendering",
"may",
"glitch",
"out",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/widgets.py#L456-L467 | [
"def",
"on_redraw",
"(",
"self",
")",
":",
"if",
"self",
".",
"bg",
"is",
"not",
"None",
":",
"if",
"not",
"self",
".",
"bg",
".",
"initialized",
":",
"self",
".",
"bg",
".",
"init_bg",
"(",
")",
"self",
".",
"bg",
".",
"initialized",
"=",
"True"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | calcSphereCoordinates | Calculates the Cartesian coordinates from spherical coordinates.
``pos`` is a simple offset to offset the result with.
``radius`` is the radius of the input.
``rot`` is a 2-tuple of ``(azimuth,polar)`` angles.
Angles are given in degrees. Most directions in this game use the same con... | peng3d/model.py | def calcSphereCoordinates(pos,radius,rot):
"""
Calculates the Cartesian coordinates from spherical coordinates.
``pos`` is a simple offset to offset the result with.
``radius`` is the radius of the input.
``rot`` is a 2-tuple of ``(azimuth,polar)`` angles.
Angles are given in... | def calcSphereCoordinates(pos,radius,rot):
"""
Calculates the Cartesian coordinates from spherical coordinates.
``pos`` is a simple offset to offset the result with.
``radius`` is the radius of the input.
``rot`` is a 2-tuple of ``(azimuth,polar)`` angles.
Angles are given in... | [
"Calculates",
"the",
"Cartesian",
"coordinates",
"from",
"spherical",
"coordinates",
".",
"pos",
"is",
"a",
"simple",
"offset",
"to",
"offset",
"the",
"result",
"with",
".",
"radius",
"is",
"the",
"radius",
"of",
"the",
"input",
".",
"rot",
"is",
"a",
"2",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L73-L133 | [
"def",
"calcSphereCoordinates",
"(",
"pos",
",",
"radius",
",",
"rot",
")",
":",
"# Input angles should be in degrees, as in the rest of the game",
"# E.g. phi=inclination and theta=azimuth",
"# phi is yrad",
"# Look from above ",
"#(Z goes positive towards you) ",
"# ... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | v_magnitude | Simple vector helper function returning the length of a vector.
``v`` may be any vector, with any number of dimensions | peng3d/model.py | def v_magnitude(v):
"""
Simple vector helper function returning the length of a vector.
``v`` may be any vector, with any number of dimensions
"""
return math.sqrt(sum(v[i]*v[i] for i in range(len(v)))) | def v_magnitude(v):
"""
Simple vector helper function returning the length of a vector.
``v`` may be any vector, with any number of dimensions
"""
return math.sqrt(sum(v[i]*v[i] for i in range(len(v)))) | [
"Simple",
"vector",
"helper",
"function",
"returning",
"the",
"length",
"of",
"a",
"vector",
".",
"v",
"may",
"be",
"any",
"vector",
"with",
"any",
"number",
"of",
"dimensions"
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L135-L141 | [
"def",
"v_magnitude",
"(",
"v",
")",
":",
"return",
"math",
".",
"sqrt",
"(",
"sum",
"(",
"v",
"[",
"i",
"]",
"*",
"v",
"[",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"v",
")",
")",
")",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | v_normalize | Normalizes the given vector.
The vector given may have any number of dimensions. | peng3d/model.py | def v_normalize(v):
"""
Normalizes the given vector.
The vector given may have any number of dimensions.
"""
vmag = v_magnitude(v)
return [ v[i]/vmag for i in range(len(v)) ] | def v_normalize(v):
"""
Normalizes the given vector.
The vector given may have any number of dimensions.
"""
vmag = v_magnitude(v)
return [ v[i]/vmag for i in range(len(v)) ] | [
"Normalizes",
"the",
"given",
"vector",
".",
"The",
"vector",
"given",
"may",
"have",
"any",
"number",
"of",
"dimensions",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L143-L150 | [
"def",
"v_normalize",
"(",
"v",
")",
":",
"vmag",
"=",
"v_magnitude",
"(",
"v",
")",
"return",
"[",
"v",
"[",
"i",
"]",
"/",
"vmag",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"v",
")",
")",
"]"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Material.transformTexCoords | Transforms the given texture coordinates using the internal texture coordinates.
Currently, the dimensionality of the input texture coordinates must always be 2 and the output is 3-dimensional with the last coordinate always being zero.
The given texture coordinates are fitted to the i... | peng3d/model.py | def transformTexCoords(self,data,texcoords,dims=2):
"""
Transforms the given texture coordinates using the internal texture coordinates.
Currently, the dimensionality of the input texture coordinates must always be 2 and the output is 3-dimensional with the last coordinate always being ... | def transformTexCoords(self,data,texcoords,dims=2):
"""
Transforms the given texture coordinates using the internal texture coordinates.
Currently, the dimensionality of the input texture coordinates must always be 2 and the output is 3-dimensional with the last coordinate always being ... | [
"Transforms",
"the",
"given",
"texture",
"coordinates",
"using",
"the",
"internal",
"texture",
"coordinates",
".",
"Currently",
"the",
"dimensionality",
"of",
"the",
"input",
"texture",
"coordinates",
"must",
"always",
"be",
"2",
"and",
"the",
"output",
"is",
"3... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L211-L237 | [
"def",
"transformTexCoords",
"(",
"self",
",",
"data",
",",
"texcoords",
",",
"dims",
"=",
"2",
")",
":",
"assert",
"dims",
"==",
"2",
"# TODO",
"out",
"=",
"[",
"]",
"origcoords",
"=",
"self",
".",
"tex_coords",
"min_u",
",",
"min_v",
"=",
"origcoords... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Bone.ensureBones | Helper method ensuring per-entity bone data has been properly initialized.
Should be called at the start of every method accessing per-entity data.
``data`` is the entity to check in dictionary form. | peng3d/model.py | def ensureBones(self,data):
"""
Helper method ensuring per-entity bone data has been properly initialized.
Should be called at the start of every method accessing per-entity data.
``data`` is the entity to check in dictionary form.
"""
if "_bones" not in... | def ensureBones(self,data):
"""
Helper method ensuring per-entity bone data has been properly initialized.
Should be called at the start of every method accessing per-entity data.
``data`` is the entity to check in dictionary form.
"""
if "_bones" not in... | [
"Helper",
"method",
"ensuring",
"per",
"-",
"entity",
"bone",
"data",
"has",
"been",
"properly",
"initialized",
".",
"Should",
"be",
"called",
"at",
"the",
"start",
"of",
"every",
"method",
"accessing",
"per",
"-",
"entity",
"data",
".",
"data",
"is",
"the... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L262-L273 | [
"def",
"ensureBones",
"(",
"self",
",",
"data",
")",
":",
"if",
"\"_bones\"",
"not",
"in",
"data",
":",
"data",
"[",
"\"_bones\"",
"]",
"=",
"{",
"}",
"if",
"self",
".",
"name",
"not",
"in",
"data",
"[",
"\"_bones\"",
"]",
":",
"data",
"[",
"\"_bon... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Bone.setRot | Sets the rotation of this bone on the given entity.
``data`` is the entity to modify in dictionary form.
``rot`` is the rotation of the bone in the format used in :py:func:`calcSphereCoordinates()`\ . | peng3d/model.py | def setRot(self,data,rot):
"""
Sets the rotation of this bone on the given entity.
``data`` is the entity to modify in dictionary form.
``rot`` is the rotation of the bone in the format used in :py:func:`calcSphereCoordinates()`\ .
"""
self.ensureBones(d... | def setRot(self,data,rot):
"""
Sets the rotation of this bone on the given entity.
``data`` is the entity to modify in dictionary form.
``rot`` is the rotation of the bone in the format used in :py:func:`calcSphereCoordinates()`\ .
"""
self.ensureBones(d... | [
"Sets",
"the",
"rotation",
"of",
"this",
"bone",
"on",
"the",
"given",
"entity",
".",
"data",
"is",
"the",
"entity",
"to",
"modify",
"in",
"dictionary",
"form",
".",
"rot",
"is",
"the",
"rotation",
"of",
"the",
"bone",
"in",
"the",
"format",
"used",
"i... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L275-L285 | [
"def",
"setRot",
"(",
"self",
",",
"data",
",",
"rot",
")",
":",
"self",
".",
"ensureBones",
"(",
"data",
")",
"rot",
"=",
"rot",
"[",
"0",
"]",
"%",
"360",
",",
"max",
"(",
"-",
"90",
",",
"min",
"(",
"90",
",",
"rot",
"[",
"1",
"]",
")",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Bone.setLength | Sets the length of this bone on the given entity.
``data`` is the entity to modify in dictionary form.
``blength`` is the new length of the bone. | peng3d/model.py | def setLength(self,data,blength):
"""
Sets the length of this bone on the given entity.
``data`` is the entity to modify in dictionary form.
``blength`` is the new length of the bone.
"""
self.ensureBones(data)
data["_bones"][self.name]["length"]... | def setLength(self,data,blength):
"""
Sets the length of this bone on the given entity.
``data`` is the entity to modify in dictionary form.
``blength`` is the new length of the bone.
"""
self.ensureBones(data)
data["_bones"][self.name]["length"]... | [
"Sets",
"the",
"length",
"of",
"this",
"bone",
"on",
"the",
"given",
"entity",
".",
"data",
"is",
"the",
"entity",
"to",
"modify",
"in",
"dictionary",
"form",
".",
"blength",
"is",
"the",
"new",
"length",
"of",
"the",
"bone",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L295-L304 | [
"def",
"setLength",
"(",
"self",
",",
"data",
",",
"blength",
")",
":",
"self",
".",
"ensureBones",
"(",
"data",
")",
"data",
"[",
"\"_bones\"",
"]",
"[",
"self",
".",
"name",
"]",
"[",
"\"length\"",
"]",
"=",
"blength"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Bone.setParent | Sets the parent of this bone for all entities.
Note that this method must be called before many other methods to ensure internal state has been initialized.
This method also registers this bone as a child of its parent. | peng3d/model.py | def setParent(self,parent):
"""
Sets the parent of this bone for all entities.
Note that this method must be called before many other methods to ensure internal state has been initialized.
This method also registers this bone as a child of its parent.
"""
... | def setParent(self,parent):
"""
Sets the parent of this bone for all entities.
Note that this method must be called before many other methods to ensure internal state has been initialized.
This method also registers this bone as a child of its parent.
"""
... | [
"Sets",
"the",
"parent",
"of",
"this",
"bone",
"for",
"all",
"entities",
".",
"Note",
"that",
"this",
"method",
"must",
"be",
"called",
"before",
"many",
"other",
"methods",
"to",
"ensure",
"internal",
"state",
"has",
"been",
"initialized",
".",
"This",
"m... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L316-L325 | [
"def",
"setParent",
"(",
"self",
",",
"parent",
")",
":",
"self",
".",
"parent",
"=",
"parent",
"self",
".",
"parent",
".",
"child_bones",
"[",
"self",
".",
"name",
"]",
"=",
"self"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Bone.setRotate | Sets the OpenGL state required for proper drawing of the model.
Mostly rotates and translates the camera.
It is important to call :py:meth:`unsetRotate()` after calling this method to properly unset state and avoid OpenGL errors. | peng3d/model.py | def setRotate(self,data):
"""
Sets the OpenGL state required for proper drawing of the model.
Mostly rotates and translates the camera.
It is important to call :py:meth:`unsetRotate()` after calling this method to properly unset state and avoid OpenGL errors.
""... | def setRotate(self,data):
"""
Sets the OpenGL state required for proper drawing of the model.
Mostly rotates and translates the camera.
It is important to call :py:meth:`unsetRotate()` after calling this method to properly unset state and avoid OpenGL errors.
""... | [
"Sets",
"the",
"OpenGL",
"state",
"required",
"for",
"proper",
"drawing",
"of",
"the",
"model",
".",
"Mostly",
"rotates",
"and",
"translates",
"the",
"camera",
".",
"It",
"is",
"important",
"to",
"call",
":",
"py",
":",
"meth",
":",
"unsetRotate",
"()",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L327-L353 | [
"def",
"setRotate",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"parent",
".",
"setRotate",
"(",
"data",
")",
"glPushMatrix",
"(",
")",
"x",
",",
"y",
"=",
"self",
".",
"getRot",
"(",
"data",
")",
"pivot",
"=",
"self",
".",
"getPivotPoint",
"(... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Bone.getPivotPoint | Returns the point this bone pivots around on the given entity.
This method works recursively by calling its parent and then adding its own offset.
The resulting coordinate is relative to the entity, not the world. | peng3d/model.py | def getPivotPoint(self,data):
"""
Returns the point this bone pivots around on the given entity.
This method works recursively by calling its parent and then adding its own offset.
The resulting coordinate is relative to the entity, not the world.
"""
pp... | def getPivotPoint(self,data):
"""
Returns the point this bone pivots around on the given entity.
This method works recursively by calling its parent and then adding its own offset.
The resulting coordinate is relative to the entity, not the world.
"""
pp... | [
"Returns",
"the",
"point",
"this",
"bone",
"pivots",
"around",
"on",
"the",
"given",
"entity",
".",
"This",
"method",
"works",
"recursively",
"by",
"calling",
"its",
"parent",
"and",
"then",
"adding",
"its",
"own",
"offset",
".",
"The",
"resulting",
"coordin... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L363-L375 | [
"def",
"getPivotPoint",
"(",
"self",
",",
"data",
")",
":",
"ppos",
"=",
"self",
".",
"parent",
".",
"getPivotPoint",
"(",
"data",
")",
"rot",
"=",
"self",
".",
"parent",
".",
"getRot",
"(",
"data",
")",
"length",
"=",
"self",
".",
"parent",
".",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Region.getVertices | Returns the vertices of this region already transformed and ready-to-use.
Internally uses :py:meth:`Bone.transformVertices()`\ . | peng3d/model.py | def getVertices(self,data):
"""
Returns the vertices of this region already transformed and ready-to-use.
Internally uses :py:meth:`Bone.transformVertices()`\ .
"""
return self.bone.transformVertices(data,self.vertices,self.dims) | def getVertices(self,data):
"""
Returns the vertices of this region already transformed and ready-to-use.
Internally uses :py:meth:`Bone.transformVertices()`\ .
"""
return self.bone.transformVertices(data,self.vertices,self.dims) | [
"Returns",
"the",
"vertices",
"of",
"this",
"region",
"already",
"transformed",
"and",
"ready",
"-",
"to",
"-",
"use",
".",
"Internally",
"uses",
":",
"py",
":",
"meth",
":",
"Bone",
".",
"transformVertices",
"()",
"\\",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L487-L493 | [
"def",
"getVertices",
"(",
"self",
",",
"data",
")",
":",
"return",
"self",
".",
"bone",
".",
"transformVertices",
"(",
"data",
",",
"self",
".",
"vertices",
",",
"self",
".",
"dims",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Region.getTexCoords | Returns the texture coordinates, if any, to accompany the vertices of this region already transformed.
Note that it is recommended to check the :py:attr:`enable_tex` flag first.
Internally uses :py:meth:`Material.transformTexCoords()`\ . | peng3d/model.py | def getTexCoords(self,data):
"""
Returns the texture coordinates, if any, to accompany the vertices of this region already transformed.
Note that it is recommended to check the :py:attr:`enable_tex` flag first.
Internally uses :py:meth:`Material.transformTexCoords()`\ .... | def getTexCoords(self,data):
"""
Returns the texture coordinates, if any, to accompany the vertices of this region already transformed.
Note that it is recommended to check the :py:attr:`enable_tex` flag first.
Internally uses :py:meth:`Material.transformTexCoords()`\ .... | [
"Returns",
"the",
"texture",
"coordinates",
"if",
"any",
"to",
"accompany",
"the",
"vertices",
"of",
"this",
"region",
"already",
"transformed",
".",
"Note",
"that",
"it",
"is",
"recommended",
"to",
"check",
"the",
":",
"py",
":",
"attr",
":",
"enable_tex",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L501-L509 | [
"def",
"getTexCoords",
"(",
"self",
",",
"data",
")",
":",
"return",
"self",
".",
"material",
".",
"transformTexCoords",
"(",
"data",
",",
"self",
".",
"tex_coords",
",",
"self",
".",
"tex_dims",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Animation.startAnimation | Callback that is called to initialize this animation on a specific actor.
Internally sets the ``_anidata`` key of the given dict ``data``\ .
``jumptype`` is either ``jump`` or ``animate`` to define how to switch to this animation. | peng3d/model.py | def startAnimation(self,data,jumptype):
"""
Callback that is called to initialize this animation on a specific actor.
Internally sets the ``_anidata`` key of the given dict ``data``\ .
``jumptype`` is either ``jump`` or ``animate`` to define how to switch to this animat... | def startAnimation(self,data,jumptype):
"""
Callback that is called to initialize this animation on a specific actor.
Internally sets the ``_anidata`` key of the given dict ``data``\ .
``jumptype`` is either ``jump`` or ``animate`` to define how to switch to this animat... | [
"Callback",
"that",
"is",
"called",
"to",
"initialize",
"this",
"animation",
"on",
"a",
"specific",
"actor",
".",
"Internally",
"sets",
"the",
"_anidata",
"key",
"of",
"the",
"given",
"dict",
"data",
"\\",
".",
"jumptype",
"is",
"either",
"jump",
"or",
"an... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L579-L593 | [
"def",
"startAnimation",
"(",
"self",
",",
"data",
",",
"jumptype",
")",
":",
"data",
"[",
"\"_anidata\"",
"]",
"=",
"{",
"}",
"adata",
"=",
"data",
"[",
"\"_anidata\"",
"]",
"adata",
"[",
"\"keyframe\"",
"]",
"=",
"0",
"adata",
"[",
"\"last_tick\"",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Animation.tickEntity | Callback that should be called regularly to update the animation.
It is recommended to call this method about 60 times a second for smooth animations. Irregular calling of this method will be automatically adjusted.
This method sets all the bones in the given actor to the next state of... | peng3d/model.py | def tickEntity(self,data):
"""
Callback that should be called regularly to update the animation.
It is recommended to call this method about 60 times a second for smooth animations. Irregular calling of this method will be automatically adjusted.
This method sets all th... | def tickEntity(self,data):
"""
Callback that should be called regularly to update the animation.
It is recommended to call this method about 60 times a second for smooth animations. Irregular calling of this method will be automatically adjusted.
This method sets all th... | [
"Callback",
"that",
"should",
"be",
"called",
"regularly",
"to",
"update",
"the",
"animation",
".",
"It",
"is",
"recommended",
"to",
"call",
"this",
"method",
"about",
"60",
"times",
"a",
"second",
"for",
"smooth",
"animations",
".",
"Irregular",
"calling",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L595-L772 | [
"def",
"tickEntity",
"(",
"self",
",",
"data",
")",
":",
"adata",
"=",
"data",
"[",
"\"_anidata\"",
"]",
"if",
"adata",
".",
"get",
"(",
"\"anitype\"",
",",
"self",
".",
"name",
")",
"!=",
"self",
".",
"name",
":",
"return",
"# incorrectly called",
"dt... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | JSONModelGroup.set_state | Sets the state required for this actor.
Currently translates the matrix to the position of the actor. | peng3d/model.py | def set_state(self):
"""
Sets the state required for this actor.
Currently translates the matrix to the position of the actor.
"""
x,y,z = self.obj.pos
glTranslatef(x,y,z) | def set_state(self):
"""
Sets the state required for this actor.
Currently translates the matrix to the position of the actor.
"""
x,y,z = self.obj.pos
glTranslatef(x,y,z) | [
"Sets",
"the",
"state",
"required",
"for",
"this",
"actor",
".",
"Currently",
"translates",
"the",
"matrix",
"to",
"the",
"position",
"of",
"the",
"actor",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L791-L798 | [
"def",
"set_state",
"(",
"self",
")",
":",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"obj",
".",
"pos",
"glTranslatef",
"(",
"x",
",",
"y",
",",
"z",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | JSONModelGroup.unset_state | Resets the state required for this actor to the default state.
Currently resets the matrix to its previous translation. | peng3d/model.py | def unset_state(self):
"""
Resets the state required for this actor to the default state.
Currently resets the matrix to its previous translation.
"""
x,y,z = self.obj.pos
glTranslatef(-x,-y,-z) | def unset_state(self):
"""
Resets the state required for this actor to the default state.
Currently resets the matrix to its previous translation.
"""
x,y,z = self.obj.pos
glTranslatef(-x,-y,-z) | [
"Resets",
"the",
"state",
"required",
"for",
"this",
"actor",
"to",
"the",
"default",
"state",
".",
"Currently",
"resets",
"the",
"matrix",
"to",
"its",
"previous",
"translation",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L800-L807 | [
"def",
"unset_state",
"(",
"self",
")",
":",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"obj",
".",
"pos",
"glTranslatef",
"(",
"-",
"x",
",",
"-",
"y",
",",
"-",
"z",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | JSONRegionGroup.set_state | Sets the state required for this vertex region.
Currently binds and enables the texture of the material of the region. | peng3d/model.py | def set_state(self):
"""
Sets the state required for this vertex region.
Currently binds and enables the texture of the material of the region.
"""
glEnable(self.region.material.target)
glBindTexture(self.region.material.target, self.region.material.id)
s... | def set_state(self):
"""
Sets the state required for this vertex region.
Currently binds and enables the texture of the material of the region.
"""
glEnable(self.region.material.target)
glBindTexture(self.region.material.target, self.region.material.id)
s... | [
"Sets",
"the",
"state",
"required",
"for",
"this",
"vertex",
"region",
".",
"Currently",
"binds",
"and",
"enables",
"the",
"texture",
"of",
"the",
"material",
"of",
"the",
"region",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L834-L842 | [
"def",
"set_state",
"(",
"self",
")",
":",
"glEnable",
"(",
"self",
".",
"region",
".",
"material",
".",
"target",
")",
"glBindTexture",
"(",
"self",
".",
"region",
".",
"material",
".",
"target",
",",
"self",
".",
"region",
".",
"material",
".",
"id",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | JSONRegionGroup.unset_state | Resets the state required for this actor to the default state.
Currently only disables the target of the texture of the material, it may still be bound. | peng3d/model.py | def unset_state(self):
"""
Resets the state required for this actor to the default state.
Currently only disables the target of the texture of the material, it may still be bound.
"""
glDisable(self.region.material.target)
self.region.bone.unsetRotate(self.data) | def unset_state(self):
"""
Resets the state required for this actor to the default state.
Currently only disables the target of the texture of the material, it may still be bound.
"""
glDisable(self.region.material.target)
self.region.bone.unsetRotate(self.data) | [
"Resets",
"the",
"state",
"required",
"for",
"this",
"actor",
"to",
"the",
"default",
"state",
".",
"Currently",
"only",
"disables",
"the",
"target",
"of",
"the",
"texture",
"of",
"the",
"material",
"it",
"may",
"still",
"be",
"bound",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L844-L851 | [
"def",
"unset_state",
"(",
"self",
")",
":",
"glDisable",
"(",
"self",
".",
"region",
".",
"material",
".",
"target",
")",
"self",
".",
"region",
".",
"bone",
".",
"unsetRotate",
"(",
"self",
".",
"data",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Model.ensureModelData | Ensures that the given ``obj`` has been initialized to be used with this model.
If the object is found to not be initialized, it will be initialized. | peng3d/model.py | def ensureModelData(self,obj):
"""
Ensures that the given ``obj`` has been initialized to be used with this model.
If the object is found to not be initialized, it will be initialized.
"""
if not hasattr(obj,"_modeldata"):
self.create(obj,cache=True)
... | def ensureModelData(self,obj):
"""
Ensures that the given ``obj`` has been initialized to be used with this model.
If the object is found to not be initialized, it will be initialized.
"""
if not hasattr(obj,"_modeldata"):
self.create(obj,cache=True)
... | [
"Ensures",
"that",
"the",
"given",
"obj",
"has",
"been",
"initialized",
"to",
"be",
"used",
"with",
"this",
"model",
".",
"If",
"the",
"object",
"is",
"found",
"to",
"not",
"be",
"initialized",
"it",
"will",
"be",
"initialized",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L888-L898 | [
"def",
"ensureModelData",
"(",
"self",
",",
"obj",
")",
":",
"if",
"not",
"hasattr",
"(",
"obj",
",",
"\"_modeldata\"",
")",
":",
"self",
".",
"create",
"(",
"obj",
",",
"cache",
"=",
"True",
")",
"if",
"\"_modelcache\"",
"not",
"in",
"obj",
".",
"_m... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Model.create | Initializes per-actor data on the given object for this model.
If ``cache`` is set to True, the entity will not be redrawn after initialization.
Note that this method may set several attributes on the given object, most of them starting with underscores.
During initial... | peng3d/model.py | def create(self,obj,cache=False):
"""
Initializes per-actor data on the given object for this model.
If ``cache`` is set to True, the entity will not be redrawn after initialization.
Note that this method may set several attributes on the given object, most of them star... | def create(self,obj,cache=False):
"""
Initializes per-actor data on the given object for this model.
If ``cache`` is set to True, the entity will not be redrawn after initialization.
Note that this method may set several attributes on the given object, most of them star... | [
"Initializes",
"per",
"-",
"actor",
"data",
"on",
"the",
"given",
"object",
"for",
"this",
"model",
".",
"If",
"cache",
"is",
"set",
"to",
"True",
"the",
"entity",
"will",
"not",
"be",
"redrawn",
"after",
"initialization",
".",
"Note",
"that",
"this",
"m... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L900-L954 | [
"def",
"create",
"(",
"self",
",",
"obj",
",",
"cache",
"=",
"False",
")",
":",
"obj",
".",
"_modeldata",
"=",
"{",
"}",
"data",
"=",
"obj",
".",
"_modeldata",
"data",
"[",
"\"_model\"",
"]",
"=",
"self",
"data",
"[",
"\"_modelcache\"",
"]",
"=",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Model.cleanup | Cleans up any left over data structures, including vertex lists that reside in GPU memory.
Behaviour is undefined if it is attempted to use this model with the same object without calling :py:meth:`create()` first.
It is very important to call this method manually during deletion as th... | peng3d/model.py | def cleanup(self,obj):
"""
Cleans up any left over data structures, including vertex lists that reside in GPU memory.
Behaviour is undefined if it is attempted to use this model with the same object without calling :py:meth:`create()` first.
It is very important to call... | def cleanup(self,obj):
"""
Cleans up any left over data structures, including vertex lists that reside in GPU memory.
Behaviour is undefined if it is attempted to use this model with the same object without calling :py:meth:`create()` first.
It is very important to call... | [
"Cleans",
"up",
"any",
"left",
"over",
"data",
"structures",
"including",
"vertex",
"lists",
"that",
"reside",
"in",
"GPU",
"memory",
".",
"Behaviour",
"is",
"undefined",
"if",
"it",
"is",
"attempted",
"to",
"use",
"this",
"model",
"with",
"the",
"same",
"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L956-L1000 | [
"def",
"cleanup",
"(",
"self",
",",
"obj",
")",
":",
"if",
"not",
"hasattr",
"(",
"obj",
",",
"\"_modeldata\"",
")",
":",
"return",
"# already not initialized",
"data",
"=",
"obj",
".",
"_modeldata",
"if",
"\"_modelcache\"",
"in",
"data",
":",
"moddata",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Model.redraw | Redraws the model of the given object.
Note that currently this method probably won't change any data since all movement and animation is done through pyglet groups. | peng3d/model.py | def redraw(self,obj):
"""
Redraws the model of the given object.
Note that currently this method probably won't change any data since all movement and animation is done through pyglet groups.
"""
self.ensureModelData(obj)
data = obj._modeldata
vl... | def redraw(self,obj):
"""
Redraws the model of the given object.
Note that currently this method probably won't change any data since all movement and animation is done through pyglet groups.
"""
self.ensureModelData(obj)
data = obj._modeldata
vl... | [
"Redraws",
"the",
"model",
"of",
"the",
"given",
"object",
".",
"Note",
"that",
"currently",
"this",
"method",
"probably",
"won",
"t",
"change",
"any",
"data",
"since",
"all",
"movement",
"and",
"animation",
"is",
"done",
"through",
"pyglet",
"groups",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L1002-L1016 | [
"def",
"redraw",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"ensureModelData",
"(",
"obj",
")",
"data",
"=",
"obj",
".",
"_modeldata",
"vlists",
"=",
"data",
"[",
"\"_modelcache\"",
"]",
"[",
"\"vlists\"",
"]",
"for",
"name",
",",
"region",
"in",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Model.draw | Actually draws the model of the given object to the render target.
Note that if the batch used for this object already existed, drawing will be skipped as the batch should be drawn by the owner of it. | peng3d/model.py | def draw(self,obj):
"""
Actually draws the model of the given object to the render target.
Note that if the batch used for this object already existed, drawing will be skipped as the batch should be drawn by the owner of it.
"""
self.ensureModelData(obj)
... | def draw(self,obj):
"""
Actually draws the model of the given object to the render target.
Note that if the batch used for this object already existed, drawing will be skipped as the batch should be drawn by the owner of it.
"""
self.ensureModelData(obj)
... | [
"Actually",
"draws",
"the",
"model",
"of",
"the",
"given",
"object",
"to",
"the",
"render",
"target",
".",
"Note",
"that",
"if",
"the",
"batch",
"used",
"for",
"this",
"object",
"already",
"existed",
"drawing",
"will",
"be",
"skipped",
"as",
"the",
"batch"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L1018-L1028 | [
"def",
"draw",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"ensureModelData",
"(",
"obj",
")",
"data",
"=",
"obj",
".",
"_modeldata",
"if",
"data",
".",
"get",
"(",
"\"_manual_render\"",
",",
"False",
")",
":",
"obj",
".",
"batch3d",
".",
"draw",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Model.setAnimation | Sets the animation to be used by the object.
See :py:meth:`Actor.setAnimation()` for more information. | peng3d/model.py | def setAnimation(self,obj,animation,transition=None,force=False):
"""
Sets the animation to be used by the object.
See :py:meth:`Actor.setAnimation()` for more information.
"""
self.ensureModelData(obj)
data = obj._modeldata
# Validity check
... | def setAnimation(self,obj,animation,transition=None,force=False):
"""
Sets the animation to be used by the object.
See :py:meth:`Actor.setAnimation()` for more information.
"""
self.ensureModelData(obj)
data = obj._modeldata
# Validity check
... | [
"Sets",
"the",
"animation",
"to",
"be",
"used",
"by",
"the",
"object",
".",
"See",
":",
"py",
":",
"meth",
":",
"Actor",
".",
"setAnimation",
"()",
"for",
"more",
"information",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L1039-L1086 | [
"def",
"setAnimation",
"(",
"self",
",",
"obj",
",",
"animation",
",",
"transition",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"self",
".",
"ensureModelData",
"(",
"obj",
")",
"data",
"=",
"obj",
".",
"_modeldata",
"# Validity check",
"if",
"ani... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Actor.setModel | Sets the model this actor should use when drawing.
This method also automatically initializes the new model and removes the old, if any. | peng3d/actor/__init__.py | def setModel(self,model):
"""
Sets the model this actor should use when drawing.
This method also automatically initializes the new model and removes the old, if any.
"""
if self.model is not None:
self.model.cleanup(self)
self.model = model
m... | def setModel(self,model):
"""
Sets the model this actor should use when drawing.
This method also automatically initializes the new model and removes the old, if any.
"""
if self.model is not None:
self.model.cleanup(self)
self.model = model
m... | [
"Sets",
"the",
"model",
"this",
"actor",
"should",
"use",
"when",
"drawing",
".",
"This",
"method",
"also",
"automatically",
"initializes",
"the",
"new",
"model",
"and",
"removes",
"the",
"old",
"if",
"any",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/__init__.py#L102-L111 | [
"def",
"setModel",
"(",
"self",
",",
"model",
")",
":",
"if",
"self",
".",
"model",
"is",
"not",
"None",
":",
"self",
".",
"model",
".",
"cleanup",
"(",
"self",
")",
"self",
".",
"model",
"=",
"model",
"model",
".",
"create",
"(",
"self",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Actor.setAnimation | Sets the animation the model of this actor should show.
``animation`` is the name of the animation to switch to.
``transition`` can be used to override the transition between the animations.
``force`` can be used to force reset the animation even if it is already runni... | peng3d/actor/__init__.py | def setAnimation(self,animation,transition=None,force=False):
"""
Sets the animation the model of this actor should show.
``animation`` is the name of the animation to switch to.
``transition`` can be used to override the transition between the animations.
... | def setAnimation(self,animation,transition=None,force=False):
"""
Sets the animation the model of this actor should show.
``animation`` is the name of the animation to switch to.
``transition`` can be used to override the transition between the animations.
... | [
"Sets",
"the",
"animation",
"the",
"model",
"of",
"this",
"actor",
"should",
"show",
".",
"animation",
"is",
"the",
"name",
"of",
"the",
"animation",
"to",
"switch",
"to",
".",
"transition",
"can",
"be",
"used",
"to",
"override",
"the",
"transition",
"betw... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/__init__.py#L113-L127 | [
"def",
"setAnimation",
"(",
"self",
",",
"animation",
",",
"transition",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"if",
"self",
".",
"model",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"Can only set animation if a model is set\"",
")",
"self"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | RotatableActor.move | Moves the actor using standard trigonometry along the current rotational vector.
:param float dist: Distance to move
.. todo::
Test this method, also with negative distances | peng3d/actor/__init__.py | def move(self,dist):
"""
Moves the actor using standard trigonometry along the current rotational vector.
:param float dist: Distance to move
.. todo::
Test this method, also with negative distances
"""
x, y = self._rot
y_a... | def move(self,dist):
"""
Moves the actor using standard trigonometry along the current rotational vector.
:param float dist: Distance to move
.. todo::
Test this method, also with negative distances
"""
x, y = self._rot
y_a... | [
"Moves",
"the",
"actor",
"using",
"standard",
"trigonometry",
"along",
"the",
"current",
"rotational",
"vector",
".",
":",
"param",
"float",
"dist",
":",
"Distance",
"to",
"move",
"..",
"todo",
"::",
"Test",
"this",
"method",
"also",
"with",
"negative",
"dis... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/__init__.py#L175-L196 | [
"def",
"move",
"(",
"self",
",",
"dist",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"_rot",
"y_angle",
"=",
"math",
".",
"radians",
"(",
"y",
")",
"x_angle",
"=",
"math",
".",
"radians",
"(",
"x",
")",
"m",
"=",
"math",
".",
"cos",
"(",
"y_an... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | XunitDestination.write_reports | write the collection of reports to the given path | xunitgen/disk_writing.py | def write_reports(self, relative_path, suite_name, reports,
package_name=None):
"""write the collection of reports to the given path"""
dest_path = self.reserve_file(relative_path)
with open(dest_path, 'wb') as outf:
outf.write(toxml(reports, suite_name, packag... | def write_reports(self, relative_path, suite_name, reports,
package_name=None):
"""write the collection of reports to the given path"""
dest_path = self.reserve_file(relative_path)
with open(dest_path, 'wb') as outf:
outf.write(toxml(reports, suite_name, packag... | [
"write",
"the",
"collection",
"of",
"reports",
"to",
"the",
"given",
"path"
] | uucidl/uu.xunitgen | python | https://github.com/uucidl/uu.xunitgen/blob/3c74fe60dfd15a528622195577f2aab3027693f0/xunitgen/disk_writing.py#L13-L20 | [
"def",
"write_reports",
"(",
"self",
",",
"relative_path",
",",
"suite_name",
",",
"reports",
",",
"package_name",
"=",
"None",
")",
":",
"dest_path",
"=",
"self",
".",
"reserve_file",
"(",
"relative_path",
")",
"with",
"open",
"(",
"dest_path",
",",
"'wb'",... | 3c74fe60dfd15a528622195577f2aab3027693f0 |
test | XunitDestination.reserve_file | reserve a XML file for the slice at <relative_path>.xml
- the relative path will be created for you
- not writing anything to that file is an error | xunitgen/disk_writing.py | def reserve_file(self, relative_path):
"""reserve a XML file for the slice at <relative_path>.xml
- the relative path will be created for you
- not writing anything to that file is an error
"""
if os.path.isabs(relative_path):
raise ValueError('%s must be a relative ... | def reserve_file(self, relative_path):
"""reserve a XML file for the slice at <relative_path>.xml
- the relative path will be created for you
- not writing anything to that file is an error
"""
if os.path.isabs(relative_path):
raise ValueError('%s must be a relative ... | [
"reserve",
"a",
"XML",
"file",
"for",
"the",
"slice",
"at",
"<relative_path",
">",
".",
"xml"
] | uucidl/uu.xunitgen | python | https://github.com/uucidl/uu.xunitgen/blob/3c74fe60dfd15a528622195577f2aab3027693f0/xunitgen/disk_writing.py#L23-L46 | [
"def",
"reserve_file",
"(",
"self",
",",
"relative_path",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"relative_path",
")",
":",
"raise",
"ValueError",
"(",
"'%s must be a relative path'",
"%",
"relative_path",
")",
"dest_path",
"=",
"os",
".",
"pa... | 3c74fe60dfd15a528622195577f2aab3027693f0 |
test | toxml | convert test reports into an xml file | xunitgen/main.py | def toxml(test_reports, suite_name,
hostname=gethostname(), package_name="tests"):
"""convert test reports into an xml file"""
testsuites = et.Element("testsuites")
testsuite = et.SubElement(testsuites, "testsuite")
test_count = len(test_reports)
if test_count < 1:
raise ValueErr... | def toxml(test_reports, suite_name,
hostname=gethostname(), package_name="tests"):
"""convert test reports into an xml file"""
testsuites = et.Element("testsuites")
testsuite = et.SubElement(testsuites, "testsuite")
test_count = len(test_reports)
if test_count < 1:
raise ValueErr... | [
"convert",
"test",
"reports",
"into",
"an",
"xml",
"file"
] | uucidl/uu.xunitgen | python | https://github.com/uucidl/uu.xunitgen/blob/3c74fe60dfd15a528622195577f2aab3027693f0/xunitgen/main.py#L88-L150 | [
"def",
"toxml",
"(",
"test_reports",
",",
"suite_name",
",",
"hostname",
"=",
"gethostname",
"(",
")",
",",
"package_name",
"=",
"\"tests\"",
")",
":",
"testsuites",
"=",
"et",
".",
"Element",
"(",
"\"testsuites\"",
")",
"testsuite",
"=",
"et",
".",
"SubEl... | 3c74fe60dfd15a528622195577f2aab3027693f0 |
test | PengWindow.setup | Sets up the OpenGL state.
This method should be called once after the config has been created and before the main loop is started.
You should not need to manually call this method, as it is automatically called by :py:meth:`run()`\ .
Repeatedly calling this method has no effect... | peng3d/window.py | def setup(self):
"""
Sets up the OpenGL state.
This method should be called once after the config has been created and before the main loop is started.
You should not need to manually call this method, as it is automatically called by :py:meth:`run()`\ .
Repeate... | def setup(self):
"""
Sets up the OpenGL state.
This method should be called once after the config has been created and before the main loop is started.
You should not need to manually call this method, as it is automatically called by :py:meth:`run()`\ .
Repeate... | [
"Sets",
"up",
"the",
"OpenGL",
"state",
".",
"This",
"method",
"should",
"be",
"called",
"once",
"after",
"the",
"config",
"has",
"been",
"created",
"and",
"before",
"the",
"main",
"loop",
"is",
"started",
".",
"You",
"should",
"not",
"need",
"to",
"manu... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L71-L104 | [
"def",
"setup",
"(",
"self",
")",
":",
"if",
"self",
".",
"_setup",
":",
"return",
"self",
".",
"_setup",
"=",
"True",
"# Ensures that default values are supplied",
"#self.cleanConfig()",
"# Sets min/max window size, if specified",
"if",
"self",
".",
"cfg",
"[",
"\"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | PengWindow.setupFog | Sets the fog system up.
The specific options available are documented under :confval:`graphics.fogSettings`\ . | peng3d/window.py | def setupFog(self):
"""
Sets the fog system up.
The specific options available are documented under :confval:`graphics.fogSettings`\ .
"""
fogcfg = self.cfg["graphics.fogSettings"]
if not fogcfg["enable"]:
return
glEnable(GL_FOG)
... | def setupFog(self):
"""
Sets the fog system up.
The specific options available are documented under :confval:`graphics.fogSettings`\ .
"""
fogcfg = self.cfg["graphics.fogSettings"]
if not fogcfg["enable"]:
return
glEnable(GL_FOG)
... | [
"Sets",
"the",
"fog",
"system",
"up",
".",
"The",
"specific",
"options",
"available",
"are",
"documented",
"under",
":",
"confval",
":",
"graphics",
".",
"fogSettings",
"\\",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L105-L128 | [
"def",
"setupFog",
"(",
"self",
")",
":",
"fogcfg",
"=",
"self",
".",
"cfg",
"[",
"\"graphics.fogSettings\"",
"]",
"if",
"not",
"fogcfg",
"[",
"\"enable\"",
"]",
":",
"return",
"glEnable",
"(",
"GL_FOG",
")",
"if",
"fogcfg",
"[",
"\"color\"",
"]",
"is",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | PengWindow.run | Runs the application in the current thread.
This method should not be called directly, especially when using multiple windows, use :py:meth:`Peng.run()` instead.
Note that this method is blocking as rendering needs to happen in the main thread.
It is thus recommendable to run y... | peng3d/window.py | def run(self,evloop=None):
"""
Runs the application in the current thread.
This method should not be called directly, especially when using multiple windows, use :py:meth:`Peng.run()` instead.
Note that this method is blocking as rendering needs to happen in the main th... | def run(self,evloop=None):
"""
Runs the application in the current thread.
This method should not be called directly, especially when using multiple windows, use :py:meth:`Peng.run()` instead.
Note that this method is blocking as rendering needs to happen in the main th... | [
"Runs",
"the",
"application",
"in",
"the",
"current",
"thread",
".",
"This",
"method",
"should",
"not",
"be",
"called",
"directly",
"especially",
"when",
"using",
"multiple",
"windows",
"use",
":",
"py",
":",
"meth",
":",
"Peng",
".",
"run",
"()",
"instead... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L140-L154 | [
"def",
"run",
"(",
"self",
",",
"evloop",
"=",
"None",
")",
":",
"self",
".",
"setup",
"(",
")",
"if",
"evloop",
"is",
"not",
"None",
":",
"pyglet",
".",
"app",
".",
"event_loop",
"=",
"evloop",
"pyglet",
".",
"app",
".",
"run",
"(",
")",
"# This... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | PengWindow.changeMenu | Changes to the given menu.
``menu`` must be a valid menu name that is currently known.
.. versionchanged:: 1.2a1
The push/pop handlers have been deprecated in favor of the new :py:meth:`Menu.on_enter() <peng3d.menu.Menu.on_enter>`\ , :py:meth:`Menu.on_exit() <pen... | peng3d/window.py | def changeMenu(self,menu):
"""
Changes to the given menu.
``menu`` must be a valid menu name that is currently known.
.. versionchanged:: 1.2a1
The push/pop handlers have been deprecated in favor of the new :py:meth:`Menu.on_enter() <peng3d.menu.M... | def changeMenu(self,menu):
"""
Changes to the given menu.
``menu`` must be a valid menu name that is currently known.
.. versionchanged:: 1.2a1
The push/pop handlers have been deprecated in favor of the new :py:meth:`Menu.on_enter() <peng3d.menu.M... | [
"Changes",
"to",
"the",
"given",
"menu",
".",
"menu",
"must",
"be",
"a",
"valid",
"menu",
"name",
"that",
"is",
"currently",
"known",
".",
"..",
"versionchanged",
"::",
"1",
".",
"2a1",
"The",
"push",
"/",
"pop",
"handlers",
"have",
"been",
"deprecated",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L191-L213 | [
"def",
"changeMenu",
"(",
"self",
",",
"menu",
")",
":",
"if",
"menu",
"not",
"in",
"self",
".",
"menus",
":",
"raise",
"ValueError",
"(",
"\"Menu %s does not exist!\"",
"%",
"menu",
")",
"elif",
"menu",
"==",
"self",
".",
"activeMenu",
":",
"return",
"#... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | PengWindow.addMenu | Adds a menu to the list of menus. | peng3d/window.py | def addMenu(self,menu):
"""
Adds a menu to the list of menus.
"""
# If there is no menu selected currently, this menu will automatically be made active.
# Add the line above to the docstring if fixed
self.menus[menu.name]=menu
self.peng.sendEvent("peng3d:window.me... | def addMenu(self,menu):
"""
Adds a menu to the list of menus.
"""
# If there is no menu selected currently, this menu will automatically be made active.
# Add the line above to the docstring if fixed
self.menus[menu.name]=menu
self.peng.sendEvent("peng3d:window.me... | [
"Adds",
"a",
"menu",
"to",
"the",
"list",
"of",
"menus",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L215-L222 | [
"def",
"addMenu",
"(",
"self",
",",
"menu",
")",
":",
"# If there is no menu selected currently, this menu will automatically be made active.",
"# Add the line above to the docstring if fixed",
"self",
".",
"menus",
"[",
"menu",
".",
"name",
"]",
"=",
"menu",
"self",
".",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | PengWindow.dispatch_event | Internal event handling method.
This method extends the behavior inherited from :py:meth:`pyglet.window.Window.dispatch_event()` by calling the various :py:meth:`handleEvent()` methods.
By default, :py:meth:`Peng.handleEvent()`\ , :py:meth:`handleEvent()` and :py:meth:`Menu.handleEvent... | peng3d/window.py | def dispatch_event(self,event_type,*args):
"""
Internal event handling method.
This method extends the behavior inherited from :py:meth:`pyglet.window.Window.dispatch_event()` by calling the various :py:meth:`handleEvent()` methods.
By default, :py:meth:`Peng.handleEven... | def dispatch_event(self,event_type,*args):
"""
Internal event handling method.
This method extends the behavior inherited from :py:meth:`pyglet.window.Window.dispatch_event()` by calling the various :py:meth:`handleEvent()` methods.
By default, :py:meth:`Peng.handleEven... | [
"Internal",
"event",
"handling",
"method",
".",
"This",
"method",
"extends",
"the",
"behavior",
"inherited",
"from",
":",
"py",
":",
"meth",
":",
"pyglet",
".",
"window",
".",
"Window",
".",
"dispatch_event",
"()",
"by",
"calling",
"the",
"various",
":",
"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L255-L277 | [
"def",
"dispatch_event",
"(",
"self",
",",
"event_type",
",",
"*",
"args",
")",
":",
"super",
"(",
"PengWindow",
",",
"self",
")",
".",
"dispatch_event",
"(",
"event_type",
",",
"*",
"args",
")",
"try",
":",
"p",
"=",
"self",
".",
"peng",
"m",
"=",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | PengWindow.toggle_exclusivity | Toggles mouse exclusivity via pyglet's :py:meth:`set_exclusive_mouse()` method.
If ``override`` is given, it will be used instead.
You may also read the current exclusivity state via :py:attr:`exclusive`\ . | peng3d/window.py | def toggle_exclusivity(self,override=None):
"""
Toggles mouse exclusivity via pyglet's :py:meth:`set_exclusive_mouse()` method.
If ``override`` is given, it will be used instead.
You may also read the current exclusivity state via :py:attr:`exclusive`\ .
"""
... | def toggle_exclusivity(self,override=None):
"""
Toggles mouse exclusivity via pyglet's :py:meth:`set_exclusive_mouse()` method.
If ``override`` is given, it will be used instead.
You may also read the current exclusivity state via :py:attr:`exclusive`\ .
"""
... | [
"Toggles",
"mouse",
"exclusivity",
"via",
"pyglet",
"s",
":",
"py",
":",
"meth",
":",
"set_exclusive_mouse",
"()",
"method",
".",
"If",
"override",
"is",
"given",
"it",
"will",
"be",
"used",
"instead",
".",
"You",
"may",
"also",
"read",
"the",
"current",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L320-L334 | [
"def",
"toggle_exclusivity",
"(",
"self",
",",
"override",
"=",
"None",
")",
":",
"if",
"override",
"is",
"not",
"None",
":",
"new",
"=",
"override",
"else",
":",
"new",
"=",
"not",
"self",
".",
"exclusive",
"self",
".",
"exclusive",
"=",
"new",
"self"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | PengWindow.set2d | Configures OpenGL to draw in 2D.
Note that wireframe mode is always disabled in 2D-Mode, but can be re-enabled by calling ``glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)``\ . | peng3d/window.py | def set2d(self):
"""
Configures OpenGL to draw in 2D.
Note that wireframe mode is always disabled in 2D-Mode, but can be re-enabled by calling ``glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)``\ .
"""
# Light
glDisable(GL_LIGHTING)
# To avoid... | def set2d(self):
"""
Configures OpenGL to draw in 2D.
Note that wireframe mode is always disabled in 2D-Mode, but can be re-enabled by calling ``glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)``\ .
"""
# Light
glDisable(GL_LIGHTING)
# To avoid... | [
"Configures",
"OpenGL",
"to",
"draw",
"in",
"2D",
".",
"Note",
"that",
"wireframe",
"mode",
"is",
"always",
"disabled",
"in",
"2D",
"-",
"Mode",
"but",
"can",
"be",
"re",
"-",
"enabled",
"by",
"calling",
"glPolygonMode",
"(",
"GL_FRONT_AND_BACK",
"GL_LINE",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L336-L356 | [
"def",
"set2d",
"(",
"self",
")",
":",
"# Light",
"glDisable",
"(",
"GL_LIGHTING",
")",
"# To avoid accidental wireframe GUIs and fonts",
"glPolygonMode",
"(",
"GL_FRONT_AND_BACK",
",",
"GL_FILL",
")",
"width",
",",
"height",
"=",
"self",
".",
"get_size",
"(",
")"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | PengWindow.set3d | Configures OpenGL to draw in 3D.
This method also applies the correct rotation and translation as set in the supplied camera ``cam``\ .
It is discouraged to use :py:func:`glTranslatef()` or :py:func:`glRotatef()` directly as this may cause visual glitches.
If you need to config... | peng3d/window.py | def set3d(self,cam):
"""
Configures OpenGL to draw in 3D.
This method also applies the correct rotation and translation as set in the supplied camera ``cam``\ .
It is discouraged to use :py:func:`glTranslatef()` or :py:func:`glRotatef()` directly as this may cause visual glitche... | def set3d(self,cam):
"""
Configures OpenGL to draw in 3D.
This method also applies the correct rotation and translation as set in the supplied camera ``cam``\ .
It is discouraged to use :py:func:`glTranslatef()` or :py:func:`glRotatef()` directly as this may cause visual glitche... | [
"Configures",
"OpenGL",
"to",
"draw",
"in",
"3D",
".",
"This",
"method",
"also",
"applies",
"the",
"correct",
"rotation",
"and",
"translation",
"as",
"set",
"in",
"the",
"supplied",
"camera",
"cam",
"\\",
".",
"It",
"is",
"discouraged",
"to",
"use",
":",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L357-L390 | [
"def",
"set3d",
"(",
"self",
",",
"cam",
")",
":",
"if",
"not",
"isinstance",
"(",
"cam",
",",
"camera",
".",
"Camera",
")",
":",
"raise",
"TypeError",
"(",
"\"cam is not of type Camera!\"",
")",
"# Light",
"#glEnable(GL_LIGHTING)",
"if",
"self",
".",
"cfg",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Label.redraw_label | Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the label. | peng3d/gui/text.py | def redraw_label(self):
"""
Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the label.
"""
# Convenience variables
sx,sy = self.size
x,y = self.pos
# Label position
sel... | def redraw_label(self):
"""
Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the label.
"""
# Convenience variables
sx,sy = self.size
x,y = self.pos
# Label position
sel... | [
"Re",
"-",
"draws",
"the",
"text",
"by",
"calculating",
"its",
"position",
".",
"Currently",
"the",
"text",
"will",
"always",
"be",
"centered",
"on",
"the",
"position",
"of",
"the",
"label",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/text.py#L104-L123 | [
"def",
"redraw_label",
"(",
"self",
")",
":",
"# Convenience variables",
"sx",
",",
"sy",
"=",
"self",
".",
"size",
"x",
",",
"y",
"=",
"self",
".",
"pos",
"# Label position",
"self",
".",
"_label",
".",
"font_name",
"=",
"self",
".",
"font_name",
"self"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | TextInput.redraw_label | Re-draws the label by calculating its position.
Currently, the label will always be centered on the position of the label. | peng3d/gui/text.py | def redraw_label(self):
"""
Re-draws the label by calculating its position.
Currently, the label will always be centered on the position of the label.
"""
# Convenience variables
sx,sy = self.size
x,y = self.pos
# Label position
x... | def redraw_label(self):
"""
Re-draws the label by calculating its position.
Currently, the label will always be centered on the position of the label.
"""
# Convenience variables
sx,sy = self.size
x,y = self.pos
# Label position
x... | [
"Re",
"-",
"draws",
"the",
"label",
"by",
"calculating",
"its",
"position",
".",
"Currently",
"the",
"label",
"will",
"always",
"be",
"centered",
"on",
"the",
"position",
"of",
"the",
"label",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/text.py#L264-L287 | [
"def",
"redraw_label",
"(",
"self",
")",
":",
"# Convenience variables",
"sx",
",",
"sy",
"=",
"self",
".",
"size",
"x",
",",
"y",
"=",
"self",
".",
"pos",
"# Label position",
"x",
"=",
"x",
"+",
"self",
".",
"bg",
".",
"border",
"[",
"0",
"]",
"y"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | GUIMenu.changeSubMenu | Changes the submenu that is displayed.
:raises ValueError: if the name was not previously registered | peng3d/gui/__init__.py | def changeSubMenu(self,submenu):
"""
Changes the submenu that is displayed.
:raises ValueError: if the name was not previously registered
"""
if submenu not in self.submenus:
raise ValueError("Submenu %s does not exist!"%submenu)
elif submenu == self.... | def changeSubMenu(self,submenu):
"""
Changes the submenu that is displayed.
:raises ValueError: if the name was not previously registered
"""
if submenu not in self.submenus:
raise ValueError("Submenu %s does not exist!"%submenu)
elif submenu == self.... | [
"Changes",
"the",
"submenu",
"that",
"is",
"displayed",
".",
":",
"raises",
"ValueError",
":",
"if",
"the",
"name",
"was",
"not",
"previously",
"registered"
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/__init__.py#L68-L84 | [
"def",
"changeSubMenu",
"(",
"self",
",",
"submenu",
")",
":",
"if",
"submenu",
"not",
"in",
"self",
".",
"submenus",
":",
"raise",
"ValueError",
"(",
"\"Submenu %s does not exist!\"",
"%",
"submenu",
")",
"elif",
"submenu",
"==",
"self",
".",
"activeSubMenu",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | SubMenu.draw | Draws the submenu and its background.
Note that this leaves the OpenGL state set to 2d drawing. | peng3d/gui/__init__.py | def draw(self):
"""
Draws the submenu and its background.
Note that this leaves the OpenGL state set to 2d drawing.
"""
# Sets the OpenGL state for 2D-Drawing
self.window.set2d()
# Draws the background
if isinstance(self.bg,Layer):
... | def draw(self):
"""
Draws the submenu and its background.
Note that this leaves the OpenGL state set to 2d drawing.
"""
# Sets the OpenGL state for 2D-Drawing
self.window.set2d()
# Draws the background
if isinstance(self.bg,Layer):
... | [
"Draws",
"the",
"submenu",
"and",
"its",
"background",
".",
"Note",
"that",
"this",
"leaves",
"the",
"OpenGL",
"state",
"set",
"to",
"2d",
"drawing",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/__init__.py#L132-L175 | [
"def",
"draw",
"(",
"self",
")",
":",
"# Sets the OpenGL state for 2D-Drawing",
"self",
".",
"window",
".",
"set2d",
"(",
")",
"# Draws the background",
"if",
"isinstance",
"(",
"self",
".",
"bg",
",",
"Layer",
")",
":",
"self",
".",
"bg",
".",
"_draw",
"(... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | SubMenu.delWidget | Deletes the widget by the given name.
Note that this feature is currently experimental as there seems to be a memory leak with this method. | peng3d/gui/__init__.py | def delWidget(self,widget):
"""
Deletes the widget by the given name.
Note that this feature is currently experimental as there seems to be a memory leak with this method.
"""
# TODO: fix memory leak upon widget deletion
#print("*"*50)
#print("Start delWi... | def delWidget(self,widget):
"""
Deletes the widget by the given name.
Note that this feature is currently experimental as there seems to be a memory leak with this method.
"""
# TODO: fix memory leak upon widget deletion
#print("*"*50)
#print("Start delWi... | [
"Deletes",
"the",
"widget",
"by",
"the",
"given",
"name",
".",
"Note",
"that",
"this",
"feature",
"is",
"currently",
"experimental",
"as",
"there",
"seems",
"to",
"be",
"a",
"memory",
"leak",
"with",
"this",
"method",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/__init__.py#L188-L230 | [
"def",
"delWidget",
"(",
"self",
",",
"widget",
")",
":",
"# TODO: fix memory leak upon widget deletion",
"#print(\"*\"*50)",
"#print(\"Start delWidget\")",
"if",
"isinstance",
"(",
"widget",
",",
"BasicWidget",
")",
":",
"widget",
"=",
"widget",
".",
"name",
"if",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | SubMenu.setBackground | Sets the background of the submenu.
The background may be a RGB or RGBA color to fill the background with.
Alternatively, a :py:class:`peng3d.layer.Layer` instance or other object with a ``.draw()`` method may be supplied.
It is also possible to supply any other method or funct... | peng3d/gui/__init__.py | def setBackground(self,bg):
"""
Sets the background of the submenu.
The background may be a RGB or RGBA color to fill the background with.
Alternatively, a :py:class:`peng3d.layer.Layer` instance or other object with a ``.draw()`` method may be supplied.
It is a... | def setBackground(self,bg):
"""
Sets the background of the submenu.
The background may be a RGB or RGBA color to fill the background with.
Alternatively, a :py:class:`peng3d.layer.Layer` instance or other object with a ``.draw()`` method may be supplied.
It is a... | [
"Sets",
"the",
"background",
"of",
"the",
"submenu",
".",
"The",
"background",
"may",
"be",
"a",
"RGB",
"or",
"RGBA",
"color",
"to",
"fill",
"the",
"background",
"with",
".",
"Alternatively",
"a",
":",
"py",
":",
"class",
":",
"peng3d",
".",
"layer",
"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/__init__.py#L234-L254 | [
"def",
"setBackground",
"(",
"self",
",",
"bg",
")",
":",
"self",
".",
"bg",
"=",
"bg",
"if",
"isinstance",
"(",
"bg",
",",
"list",
")",
"or",
"isinstance",
"(",
"bg",
",",
"tuple",
")",
":",
"if",
"len",
"(",
"bg",
")",
"==",
"3",
"and",
"isin... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ButtonBackground.getPosSize | Helper function converting the actual widget position and size into a usable and offsetted form.
This function should return a 6-tuple of ``(sx,sy,x,y,bx,by)`` where sx and sy are the size, x and y the position and bx and by are the border size.
All values should be in pixels and alrea... | peng3d/gui/button.py | def getPosSize(self):
"""
Helper function converting the actual widget position and size into a usable and offsetted form.
This function should return a 6-tuple of ``(sx,sy,x,y,bx,by)`` where sx and sy are the size, x and y the position and bx and by are the border size.
... | def getPosSize(self):
"""
Helper function converting the actual widget position and size into a usable and offsetted form.
This function should return a 6-tuple of ``(sx,sy,x,y,bx,by)`` where sx and sy are the size, x and y the position and bx and by are the border size.
... | [
"Helper",
"function",
"converting",
"the",
"actual",
"widget",
"position",
"and",
"size",
"into",
"a",
"usable",
"and",
"offsetted",
"form",
".",
"This",
"function",
"should",
"return",
"a",
"6",
"-",
"tuple",
"of",
"(",
"sx",
"sy",
"x",
"y",
"bx",
"by",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/button.py#L112-L125 | [
"def",
"getPosSize",
"(",
"self",
")",
":",
"sx",
",",
"sy",
"=",
"self",
".",
"widget",
".",
"size",
"x",
",",
"y",
"=",
"self",
".",
"widget",
".",
"pos",
"bx",
",",
"by",
"=",
"self",
".",
"border",
"return",
"sx",
",",
"sy",
",",
"x",
","... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ButtonBackground.getColors | Overrideable function that generates the colors to be used by various borderstyles.
Should return a 5-tuple of ``(bg,o,i,s,h)``\ .
``bg`` is the base color of the background.
``o`` is the outer color, it is usually the same as the background color.
``i... | peng3d/gui/button.py | def getColors(self):
"""
Overrideable function that generates the colors to be used by various borderstyles.
Should return a 5-tuple of ``(bg,o,i,s,h)``\ .
``bg`` is the base color of the background.
``o`` is the outer color, it is usually the same as t... | def getColors(self):
"""
Overrideable function that generates the colors to be used by various borderstyles.
Should return a 5-tuple of ``(bg,o,i,s,h)``\ .
``bg`` is the base color of the background.
``o`` is the outer color, it is usually the same as t... | [
"Overrideable",
"function",
"that",
"generates",
"the",
"colors",
"to",
"be",
"used",
"by",
"various",
"borderstyles",
".",
"Should",
"return",
"a",
"5",
"-",
"tuple",
"of",
"(",
"bg",
"o",
"i",
"s",
"h",
")",
"\\",
".",
"bg",
"is",
"the",
"base",
"c... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/button.py#L126-L146 | [
"def",
"getColors",
"(",
"self",
")",
":",
"bg",
"=",
"self",
".",
"submenu",
".",
"bg",
"[",
":",
"3",
"]",
"if",
"isinstance",
"(",
"self",
".",
"submenu",
".",
"bg",
",",
"list",
")",
"or",
"isinstance",
"(",
"self",
".",
"submenu",
".",
"bg",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | CheckboxBackground.redraw_bg | if not self.widget.pressed:
self.vlist_cross.colors = 6*bg
else:
if self.borderstyle=="flat":
c = [min(bg[0]+8,255),min(bg[1]+8,255),min(bg[2]+8,255)]
elif self.borderstyle=="gradient":
c = h
elif self.borderstyle=="oldshadow":
... | peng3d/gui/button.py | def redraw_bg(self):
# Convenience variables
sx,sy = self.widget.size
x,y = self.widget.pos
bx,by = self.border
# Button background
# Outer vertices
# x y
v1 = x, y+sy
v2 = x+sx, y+sy
v3 = x, ... | def redraw_bg(self):
# Convenience variables
sx,sy = self.widget.size
x,y = self.widget.pos
bx,by = self.border
# Button background
# Outer vertices
# x y
v1 = x, y+sy
v2 = x+sx, y+sy
v3 = x, ... | [
"if",
"not",
"self",
".",
"widget",
".",
"pressed",
":",
"self",
".",
"vlist_cross",
".",
"colors",
"=",
"6",
"*",
"bg",
"else",
":",
"if",
"self",
".",
"borderstyle",
"==",
"flat",
":",
"c",
"=",
"[",
"min",
"(",
"bg",
"[",
"0",
"]",
"+",
"8",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/button.py#L705-L828 | [
"def",
"redraw_bg",
"(",
"self",
")",
":",
"# Convenience variables",
"sx",
",",
"sy",
"=",
"self",
".",
"widget",
".",
"size",
"x",
",",
"y",
"=",
"self",
".",
"widget",
".",
"pos",
"bx",
",",
"by",
"=",
"self",
".",
"border",
"# Button background",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Checkbox.redraw_label | Re-calculates the position of the Label. | peng3d/gui/button.py | def redraw_label(self):
"""
Re-calculates the position of the Label.
"""
# Convenience variables
sx,sy = self.size
x,y = self.pos
# Label position
self._label.anchor_x = "left"
self._label.x = x+sx/2.+sx
self._label.y = y+sy/2.+sy*... | def redraw_label(self):
"""
Re-calculates the position of the Label.
"""
# Convenience variables
sx,sy = self.size
x,y = self.pos
# Label position
self._label.anchor_x = "left"
self._label.x = x+sx/2.+sx
self._label.y = y+sy/2.+sy*... | [
"Re",
"-",
"calculates",
"the",
"position",
"of",
"the",
"Label",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/button.py#L848-L860 | [
"def",
"redraw_label",
"(",
"self",
")",
":",
"# Convenience variables",
"sx",
",",
"sy",
"=",
"self",
".",
"size",
"x",
",",
"y",
"=",
"self",
".",
"pos",
"# Label position",
"self",
".",
"_label",
".",
"anchor_x",
"=",
"\"left\"",
"self",
".",
"_label"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | KeybindHandler.add | Adds a keybind to the internal registry.
Keybind names should be of the format ``namespace:category.subcategory.name``\ e.g. ``peng3d:actor.player.controls.forward`` for the forward key combo for the player actor.
:param str keybind: Keybind string, as described above
:param st... | peng3d/keybind.py | def add(self,keybind,kbname,handler,mod=True):
"""
Adds a keybind to the internal registry.
Keybind names should be of the format ``namespace:category.subcategory.name``\ e.g. ``peng3d:actor.player.controls.forward`` for the forward key combo for the player actor.
:para... | def add(self,keybind,kbname,handler,mod=True):
"""
Adds a keybind to the internal registry.
Keybind names should be of the format ``namespace:category.subcategory.name``\ e.g. ``peng3d:actor.player.controls.forward`` for the forward key combo for the player actor.
:para... | [
"Adds",
"a",
"keybind",
"to",
"the",
"internal",
"registry",
".",
"Keybind",
"names",
"should",
"be",
"of",
"the",
"format",
"namespace",
":",
"category",
".",
"subcategory",
".",
"name",
"\\",
"e",
".",
"g",
".",
"peng3d",
":",
"actor",
".",
"player",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/keybind.py#L107-L128 | [
"def",
"add",
"(",
"self",
",",
"keybind",
",",
"kbname",
",",
"handler",
",",
"mod",
"=",
"True",
")",
":",
"keybind",
"=",
"keybind",
".",
"lower",
"(",
")",
"if",
"mod",
":",
"if",
"keybind",
"not",
"in",
"self",
".",
"keybinds",
":",
"self",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | KeybindHandler.changeKeybind | Changes a keybind of a specific keybindname.
:param str kbname: Same as kbname of :py:meth:`add()`
:param str combo: New key combination | peng3d/keybind.py | def changeKeybind(self,kbname,combo):
"""
Changes a keybind of a specific keybindname.
:param str kbname: Same as kbname of :py:meth:`add()`
:param str combo: New key combination
"""
for key,value in self.keybinds.items():
if kbname in value:
... | def changeKeybind(self,kbname,combo):
"""
Changes a keybind of a specific keybindname.
:param str kbname: Same as kbname of :py:meth:`add()`
:param str combo: New key combination
"""
for key,value in self.keybinds.items():
if kbname in value:
... | [
"Changes",
"a",
"keybind",
"of",
"a",
"specific",
"keybindname",
".",
":",
"param",
"str",
"kbname",
":",
"Same",
"as",
"kbname",
"of",
":",
"py",
":",
"meth",
":",
"add",
"()",
":",
"param",
"str",
"combo",
":",
"New",
"key",
"combination"
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/keybind.py#L129-L143 | [
"def",
"changeKeybind",
"(",
"self",
",",
"kbname",
",",
"combo",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"keybinds",
".",
"items",
"(",
")",
":",
"if",
"kbname",
"in",
"value",
":",
"del",
"value",
"[",
"value",
".",
"index",
"(",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | KeybindHandler.mod_is_held | Helper method to simplify checking if a modifier is held.
:param str modname: Name of the modifier, see :py:data:`MODNAME2MODIFIER`
:param int modifiers: Bitmask to check in, same as the modifiers argument of the on_key_press etc. handlers | peng3d/keybind.py | def mod_is_held(self,modname,modifiers):
"""
Helper method to simplify checking if a modifier is held.
:param str modname: Name of the modifier, see :py:data:`MODNAME2MODIFIER`
:param int modifiers: Bitmask to check in, same as the modifiers argument of the on_key_press etc. han... | def mod_is_held(self,modname,modifiers):
"""
Helper method to simplify checking if a modifier is held.
:param str modname: Name of the modifier, see :py:data:`MODNAME2MODIFIER`
:param int modifiers: Bitmask to check in, same as the modifiers argument of the on_key_press etc. han... | [
"Helper",
"method",
"to",
"simplify",
"checking",
"if",
"a",
"modifier",
"is",
"held",
".",
":",
"param",
"str",
"modname",
":",
"Name",
"of",
"the",
"modifier",
"see",
":",
"py",
":",
"data",
":",
"MODNAME2MODIFIER",
":",
"param",
"int",
"modifiers",
":... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/keybind.py#L144-L152 | [
"def",
"mod_is_held",
"(",
"self",
",",
"modname",
",",
"modifiers",
")",
":",
"modifier",
"=",
"MODNAME2MODIFIER",
"[",
"modname",
".",
"lower",
"(",
")",
"]",
"return",
"modifiers",
"&",
"modifier"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | KeybindHandler.handle_combo | Handles a key combination and dispatches associated events.
First, all keybind handlers registered via :py:meth:`add` will be handled,
then the pyglet event :peng3d:pgevent:`on_key_combo` with params ``(combo,symbol,modifiers,release,mod)`` is sent to the :py:class:`Peng()` instance.
... | peng3d/keybind.py | def handle_combo(self,combo,symbol,modifiers,release=False,mod=True):
"""
Handles a key combination and dispatches associated events.
First, all keybind handlers registered via :py:meth:`add` will be handled,
then the pyglet event :peng3d:pgevent:`on_key_combo` with params ``(co... | def handle_combo(self,combo,symbol,modifiers,release=False,mod=True):
"""
Handles a key combination and dispatches associated events.
First, all keybind handlers registered via :py:meth:`add` will be handled,
then the pyglet event :peng3d:pgevent:`on_key_combo` with params ``(co... | [
"Handles",
"a",
"key",
"combination",
"and",
"dispatches",
"associated",
"events",
".",
"First",
"all",
"keybind",
"handlers",
"registered",
"via",
":",
"py",
":",
"meth",
":",
"add",
"will",
"be",
"handled",
"then",
"the",
"pyglet",
"event",
":",
"peng3d",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/keybind.py#L173-L201 | [
"def",
"handle_combo",
"(",
"self",
",",
"combo",
",",
"symbol",
",",
"modifiers",
",",
"release",
"=",
"False",
",",
"mod",
"=",
"True",
")",
":",
"if",
"self",
".",
"peng",
".",
"cfg",
"[",
"\"controls.keybinds.debug\"",
"]",
":",
"print",
"(",
"\"co... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | FourDirectionalMoveController.registerEventHandlers | Registers needed keybinds and schedules the :py:meth:`update` Method.
You can control what keybinds are used via the :confval:`controls.controls.forward` etc. Configuration Values. | peng3d/actor/player.py | def registerEventHandlers(self):
"""
Registers needed keybinds and schedules the :py:meth:`update` Method.
You can control what keybinds are used via the :confval:`controls.controls.forward` etc. Configuration Values.
"""
# Forward
self.peng.keybinds.add(self.pen... | def registerEventHandlers(self):
"""
Registers needed keybinds and schedules the :py:meth:`update` Method.
You can control what keybinds are used via the :confval:`controls.controls.forward` etc. Configuration Values.
"""
# Forward
self.peng.keybinds.add(self.pen... | [
"Registers",
"needed",
"keybinds",
"and",
"schedules",
"the",
":",
"py",
":",
"meth",
":",
"update",
"Method",
".",
"You",
"can",
"control",
"what",
"keybinds",
"are",
"used",
"via",
"the",
":",
"confval",
":",
"controls",
".",
"controls",
".",
"forward",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/player.py#L51-L65 | [
"def",
"registerEventHandlers",
"(",
"self",
")",
":",
"# Forward",
"self",
".",
"peng",
".",
"keybinds",
".",
"add",
"(",
"self",
".",
"peng",
".",
"cfg",
"[",
"\"controls.controls.forward\"",
"]",
",",
"\"peng3d:actor.%s.player.controls.forward\"",
"%",
"self",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | FourDirectionalMoveController.get_motion_vector | Returns the movement vector according to held buttons and the rotation.
:return: 3-Tuple of ``(dx,dy,dz)``
:rtype: tuple | peng3d/actor/player.py | def get_motion_vector(self):
"""
Returns the movement vector according to held buttons and the rotation.
:return: 3-Tuple of ``(dx,dy,dz)``
:rtype: tuple
"""
if any(self.move):
x, y = self.actor._rot
strafe = math.degrees(math.atan2(*self.... | def get_motion_vector(self):
"""
Returns the movement vector according to held buttons and the rotation.
:return: 3-Tuple of ``(dx,dy,dz)``
:rtype: tuple
"""
if any(self.move):
x, y = self.actor._rot
strafe = math.degrees(math.atan2(*self.... | [
"Returns",
"the",
"movement",
"vector",
"according",
"to",
"held",
"buttons",
"and",
"the",
"rotation",
".",
":",
"return",
":",
"3",
"-",
"Tuple",
"of",
"(",
"dx",
"dy",
"dz",
")",
":",
"rtype",
":",
"tuple"
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/player.py#L85-L104 | [
"def",
"get_motion_vector",
"(",
"self",
")",
":",
"if",
"any",
"(",
"self",
".",
"move",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"actor",
".",
"_rot",
"strafe",
"=",
"math",
".",
"degrees",
"(",
"math",
".",
"atan2",
"(",
"*",
"self",
".",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | EgoMouseRotationalController.registerEventHandlers | Registers the motion and drag handlers.
Note that because of the way pyglet treats mouse dragging, there is also an handler registered to the on_mouse_drag event. | peng3d/actor/player.py | def registerEventHandlers(self):
"""
Registers the motion and drag handlers.
Note that because of the way pyglet treats mouse dragging, there is also an handler registered to the on_mouse_drag event.
"""
self.world.registerEventHandler("on_mouse_motion",self.on_mouse_mot... | def registerEventHandlers(self):
"""
Registers the motion and drag handlers.
Note that because of the way pyglet treats mouse dragging, there is also an handler registered to the on_mouse_drag event.
"""
self.world.registerEventHandler("on_mouse_motion",self.on_mouse_mot... | [
"Registers",
"the",
"motion",
"and",
"drag",
"handlers",
".",
"Note",
"that",
"because",
"of",
"the",
"way",
"pyglet",
"treats",
"mouse",
"dragging",
"there",
"is",
"also",
"an",
"handler",
"registered",
"to",
"the",
"on_mouse_drag",
"event",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/player.py#L123-L130 | [
"def",
"registerEventHandlers",
"(",
"self",
")",
":",
"self",
".",
"world",
".",
"registerEventHandler",
"(",
"\"on_mouse_motion\"",
",",
"self",
".",
"on_mouse_motion",
")",
"self",
".",
"world",
".",
"registerEventHandler",
"(",
"\"on_mouse_drag\"",
",",
"self"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | BasicFlightController.registerEventHandlers | Registers the up and down handlers.
Also registers a scheduled function every 60th of a second, causing pyglet to redraw your window with 60fps. | peng3d/actor/player.py | def registerEventHandlers(self):
"""
Registers the up and down handlers.
Also registers a scheduled function every 60th of a second, causing pyglet to redraw your window with 60fps.
"""
# Crouch/fly down
self.peng.keybinds.add(self.peng.cfg["controls.controls.cro... | def registerEventHandlers(self):
"""
Registers the up and down handlers.
Also registers a scheduled function every 60th of a second, causing pyglet to redraw your window with 60fps.
"""
# Crouch/fly down
self.peng.keybinds.add(self.peng.cfg["controls.controls.cro... | [
"Registers",
"the",
"up",
"and",
"down",
"handlers",
".",
"Also",
"registers",
"a",
"scheduled",
"function",
"every",
"60th",
"of",
"a",
"second",
"causing",
"pyglet",
"to",
"redraw",
"your",
"window",
"with",
"60fps",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/player.py#L155-L165 | [
"def",
"registerEventHandlers",
"(",
"self",
")",
":",
"# Crouch/fly down",
"self",
".",
"peng",
".",
"keybinds",
".",
"add",
"(",
"self",
".",
"peng",
".",
"cfg",
"[",
"\"controls.controls.crouch\"",
"]",
",",
"\"peng3d:actor.%s.player.controls.crouch\"",
"%",
"s... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | BasicFlightController.update | Should be called regularly to move the actor.
This method does nothing if the :py:attr:`enabled` property is set to False.
This method is called automatically and should not be called manually. | peng3d/actor/player.py | def update(self,dt):
"""
Should be called regularly to move the actor.
This method does nothing if the :py:attr:`enabled` property is set to False.
This method is called automatically and should not be called manually.
"""
if not self.enabled:
... | def update(self,dt):
"""
Should be called regularly to move the actor.
This method does nothing if the :py:attr:`enabled` property is set to False.
This method is called automatically and should not be called manually.
"""
if not self.enabled:
... | [
"Should",
"be",
"called",
"regularly",
"to",
"move",
"the",
"actor",
".",
"This",
"method",
"does",
"nothing",
"if",
"the",
":",
"py",
":",
"attr",
":",
"enabled",
"property",
"is",
"set",
"to",
"False",
".",
"This",
"method",
"is",
"called",
"automatica... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/player.py#L166-L179 | [
"def",
"update",
"(",
"self",
",",
"dt",
")",
":",
"if",
"not",
"self",
".",
"enabled",
":",
"return",
"dy",
"=",
"self",
".",
"speed",
"*",
"dt",
"*",
"self",
".",
"move",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"actor",
".",
"_pos",
"new... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | FirstPersonPlayer.update | Internal method used for moving the player.
:param float dt: Time delta since the last call to this method | peng3d/actor/player.py | def update(self,dt):
"""
Internal method used for moving the player.
:param float dt: Time delta since the last call to this method
"""
speed = self.movespeed
d = dt * speed # distance covered this tick.
dx, dy, dz = self.get_motion_vector()
# New... | def update(self,dt):
"""
Internal method used for moving the player.
:param float dt: Time delta since the last call to this method
"""
speed = self.movespeed
d = dt * speed # distance covered this tick.
dx, dy, dz = self.get_motion_vector()
# New... | [
"Internal",
"method",
"used",
"for",
"moving",
"the",
"player",
".",
":",
"param",
"float",
"dt",
":",
"Time",
"delta",
"since",
"the",
"last",
"call",
"to",
"this",
"method"
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/actor/player.py#L223-L237 | [
"def",
"update",
"(",
"self",
",",
"dt",
")",
":",
"speed",
"=",
"self",
".",
"movespeed",
"d",
"=",
"dt",
"*",
"speed",
"# distance covered this tick.",
"dx",
",",
"dy",
",",
"dz",
"=",
"self",
".",
"get_motion_vector",
"(",
")",
"# New position in space,... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | DialogSubMenu.add_widgets | Called by the initializer to add all widgets.
Widgets are discovered by searching through the :py:attr:`WIDGETS` class attribute.
If a key in :py:attr:`WIDGETS` is also found in the keyword arguments and
not none, the function with the name given in the value of the key will
be ... | peng3d/gui/menus.py | def add_widgets(self,**kwargs):
"""
Called by the initializer to add all widgets.
Widgets are discovered by searching through the :py:attr:`WIDGETS` class attribute.
If a key in :py:attr:`WIDGETS` is also found in the keyword arguments and
not none, the function with the... | def add_widgets(self,**kwargs):
"""
Called by the initializer to add all widgets.
Widgets are discovered by searching through the :py:attr:`WIDGETS` class attribute.
If a key in :py:attr:`WIDGETS` is also found in the keyword arguments and
not none, the function with the... | [
"Called",
"by",
"the",
"initializer",
"to",
"add",
"all",
"widgets",
".",
"Widgets",
"are",
"discovered",
"by",
"searching",
"through",
"the",
":",
"py",
":",
"attr",
":",
"WIDGETS",
"class",
"attribute",
".",
"If",
"a",
"key",
"in",
":",
"py",
":",
"a... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L132-L149 | [
"def",
"add_widgets",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"fname",
"in",
"self",
".",
"WIDGETS",
".",
"items",
"(",
")",
":",
"if",
"name",
"in",
"kwargs",
"and",
"kwargs",
"[",
"name",
"]",
"is",
"not",
"None",
":... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | DialogSubMenu.add_label_main | Adds the main label of the dialog.
This widget can be triggered by setting the label ``label_main`` to a string.
This widget will be centered on the screen. | peng3d/gui/menus.py | def add_label_main(self,label_main):
"""
Adds the main label of the dialog.
This widget can be triggered by setting the label ``label_main`` to a string.
This widget will be centered on the screen.
"""
# Main Label
self.wlabel_main = text.Label("... | def add_label_main(self,label_main):
"""
Adds the main label of the dialog.
This widget can be triggered by setting the label ``label_main`` to a string.
This widget will be centered on the screen.
"""
# Main Label
self.wlabel_main = text.Label("... | [
"Adds",
"the",
"main",
"label",
"of",
"the",
"dialog",
".",
"This",
"widget",
"can",
"be",
"triggered",
"by",
"setting",
"the",
"label",
"label_main",
"to",
"a",
"string",
".",
"This",
"widget",
"will",
"be",
"centered",
"on",
"the",
"screen",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L151-L167 | [
"def",
"add_label_main",
"(",
"self",
",",
"label_main",
")",
":",
"# Main Label",
"self",
".",
"wlabel_main",
"=",
"text",
".",
"Label",
"(",
"\"label_main\"",
",",
"self",
",",
"self",
".",
"window",
",",
"self",
".",
"peng",
",",
"pos",
"=",
"lambda",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | DialogSubMenu.add_btn_ok | Adds an OK button to allow the user to exit the dialog.
This widget can be triggered by setting the label ``label_ok`` to a string.
This widget will be mostly centered on the screen, but below the main label
by the double of its height. | peng3d/gui/menus.py | def add_btn_ok(self,label_ok):
"""
Adds an OK button to allow the user to exit the dialog.
This widget can be triggered by setting the label ``label_ok`` to a string.
This widget will be mostly centered on the screen, but below the main label
by the double of it... | def add_btn_ok(self,label_ok):
"""
Adds an OK button to allow the user to exit the dialog.
This widget can be triggered by setting the label ``label_ok`` to a string.
This widget will be mostly centered on the screen, but below the main label
by the double of it... | [
"Adds",
"an",
"OK",
"button",
"to",
"allow",
"the",
"user",
"to",
"exit",
"the",
"dialog",
".",
"This",
"widget",
"can",
"be",
"triggered",
"by",
"setting",
"the",
"label",
"label_ok",
"to",
"a",
"string",
".",
"This",
"widget",
"will",
"be",
"mostly",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L169-L191 | [
"def",
"add_btn_ok",
"(",
"self",
",",
"label_ok",
")",
":",
"# OK Button",
"self",
".",
"wbtn_ok",
"=",
"button",
".",
"Button",
"(",
"\"btn_ok\"",
",",
"self",
",",
"self",
".",
"window",
",",
"self",
".",
"peng",
",",
"pos",
"=",
"lambda",
"sw",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | DialogSubMenu.exitDialog | Helper method that exits the dialog.
This method will cause the previously active submenu to activate. | peng3d/gui/menus.py | def exitDialog(self):
"""
Helper method that exits the dialog.
This method will cause the previously active submenu to activate.
"""
if self.prev_submenu is not None:
# change back to the previous submenu
# could in theory form a stack if one dial... | def exitDialog(self):
"""
Helper method that exits the dialog.
This method will cause the previously active submenu to activate.
"""
if self.prev_submenu is not None:
# change back to the previous submenu
# could in theory form a stack if one dial... | [
"Helper",
"method",
"that",
"exits",
"the",
"dialog",
".",
"This",
"method",
"will",
"cause",
"the",
"previously",
"active",
"submenu",
"to",
"activate",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L231-L241 | [
"def",
"exitDialog",
"(",
"self",
")",
":",
"if",
"self",
".",
"prev_submenu",
"is",
"not",
"None",
":",
"# change back to the previous submenu",
"# could in theory form a stack if one dialog opens another",
"self",
".",
"menu",
".",
"changeSubMenu",
"(",
"self",
".",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ConfirmSubMenu.add_btn_confirm | Adds a confirm button to let the user confirm whatever action they were presented with.
This widget can be triggered by setting the label ``label_confirm`` to a string.
This widget will be positioned slightly below the main label and to the left
of the cancel button. | peng3d/gui/menus.py | def add_btn_confirm(self,label_confirm):
"""
Adds a confirm button to let the user confirm whatever action they were presented with.
This widget can be triggered by setting the label ``label_confirm`` to a string.
This widget will be positioned slightly below the main l... | def add_btn_confirm(self,label_confirm):
"""
Adds a confirm button to let the user confirm whatever action they were presented with.
This widget can be triggered by setting the label ``label_confirm`` to a string.
This widget will be positioned slightly below the main l... | [
"Adds",
"a",
"confirm",
"button",
"to",
"let",
"the",
"user",
"confirm",
"whatever",
"action",
"they",
"were",
"presented",
"with",
".",
"This",
"widget",
"can",
"be",
"triggered",
"by",
"setting",
"the",
"label",
"label_confirm",
"to",
"a",
"string",
".",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L278-L300 | [
"def",
"add_btn_confirm",
"(",
"self",
",",
"label_confirm",
")",
":",
"# Confirm Button",
"self",
".",
"wbtn_confirm",
"=",
"button",
".",
"Button",
"(",
"\"btn_confirm\"",
",",
"self",
",",
"self",
".",
"window",
",",
"self",
".",
"peng",
",",
"pos",
"="... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ConfirmSubMenu.add_btn_cancel | Adds a cancel button to let the user cancel whatever choice they were given.
This widget can be triggered by setting the label ``label_cancel`` to a string.
This widget will be positioned slightly below the main label and to the right
of the confirm button. | peng3d/gui/menus.py | def add_btn_cancel(self,label_cancel):
"""
Adds a cancel button to let the user cancel whatever choice they were given.
This widget can be triggered by setting the label ``label_cancel`` to a string.
This widget will be positioned slightly below the main label and to th... | def add_btn_cancel(self,label_cancel):
"""
Adds a cancel button to let the user cancel whatever choice they were given.
This widget can be triggered by setting the label ``label_cancel`` to a string.
This widget will be positioned slightly below the main label and to th... | [
"Adds",
"a",
"cancel",
"button",
"to",
"let",
"the",
"user",
"cancel",
"whatever",
"choice",
"they",
"were",
"given",
".",
"This",
"widget",
"can",
"be",
"triggered",
"by",
"setting",
"the",
"label",
"label_cancel",
"to",
"a",
"string",
".",
"This",
"widge... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L302-L324 | [
"def",
"add_btn_cancel",
"(",
"self",
",",
"label_cancel",
")",
":",
"# Cancel Button",
"self",
".",
"wbtn_cancel",
"=",
"button",
".",
"Button",
"(",
"\"btn_cancel\"",
",",
"self",
",",
"self",
".",
"window",
",",
"self",
".",
"peng",
",",
"pos",
"=",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ProgressSubMenu.update_progressbar | Updates the progressbar by re-calculating the label.
It is not required to manually call this method since setting any of the
properties of this class will automatically trigger a re-calculation. | peng3d/gui/menus.py | def update_progressbar(self):
"""
Updates the progressbar by re-calculating the label.
It is not required to manually call this method since setting any of the
properties of this class will automatically trigger a re-calculation.
"""
n,nmin,nmax = self.wprogressb... | def update_progressbar(self):
"""
Updates the progressbar by re-calculating the label.
It is not required to manually call this method since setting any of the
properties of this class will automatically trigger a re-calculation.
"""
n,nmin,nmax = self.wprogressb... | [
"Updates",
"the",
"progressbar",
"by",
"re",
"-",
"calculating",
"the",
"label",
".",
"It",
"is",
"not",
"required",
"to",
"manually",
"call",
"this",
"method",
"since",
"setting",
"any",
"of",
"the",
"properties",
"of",
"this",
"class",
"will",
"automatical... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L473-L487 | [
"def",
"update_progressbar",
"(",
"self",
")",
":",
"n",
",",
"nmin",
",",
"nmax",
"=",
"self",
".",
"wprogressbar",
".",
"n",
",",
"self",
".",
"wprogressbar",
".",
"nmin",
",",
"self",
".",
"wprogressbar",
".",
"nmax",
"if",
"(",
"nmax",
"-",
"nmin... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | AdvancedProgressSubMenu.add_progressbar | Adds a progressbar and label displaying the progress within a certain task.
This widget can be triggered by setting the label ``label_progressbar`` to
a string.
The progressbar will be displayed centered and below the main label.
The progress label will be displayed wit... | peng3d/gui/menus.py | def add_progressbar(self,label_progressbar):
"""
Adds a progressbar and label displaying the progress within a certain task.
This widget can be triggered by setting the label ``label_progressbar`` to
a string.
The progressbar will be displayed centered and below... | def add_progressbar(self,label_progressbar):
"""
Adds a progressbar and label displaying the progress within a certain task.
This widget can be triggered by setting the label ``label_progressbar`` to
a string.
The progressbar will be displayed centered and below... | [
"Adds",
"a",
"progressbar",
"and",
"label",
"displaying",
"the",
"progress",
"within",
"a",
"certain",
"task",
".",
"This",
"widget",
"can",
"be",
"triggered",
"by",
"setting",
"the",
"label",
"label_progressbar",
"to",
"a",
"string",
".",
"The",
"progressbar"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/menus.py#L558-L614 | [
"def",
"add_progressbar",
"(",
"self",
",",
"label_progressbar",
")",
":",
"# Progressbar",
"self",
".",
"wprogressbar",
"=",
"slider",
".",
"AdvancedProgressbar",
"(",
"\"progressbar\"",
",",
"self",
",",
"self",
".",
"window",
",",
"self",
".",
"peng",
",",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Peng.createWindow | createWindow(cls=window.PengWindow, *args, **kwargs)
Creates a new window using the supplied ``cls``\ .
If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
Any other positional or keyword arguments are passed to the class constructor.
... | peng3d/peng.py | def createWindow(self,cls=None,caption_t=None,*args,**kwargs):
"""
createWindow(cls=window.PengWindow, *args, **kwargs)
Creates a new window using the supplied ``cls``\ .
If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
Any ... | def createWindow(self,cls=None,caption_t=None,*args,**kwargs):
"""
createWindow(cls=window.PengWindow, *args, **kwargs)
Creates a new window using the supplied ``cls``\ .
If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
Any ... | [
"createWindow",
"(",
"cls",
"=",
"window",
".",
"PengWindow",
"*",
"args",
"**",
"kwargs",
")",
"Creates",
"a",
"new",
"window",
"using",
"the",
"supplied",
"cls",
"\\",
".",
"If",
"cls",
"is",
"not",
"given",
":",
"py",
":",
"class",
":",
"peng3d",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/peng.py#L77-L119 | [
"def",
"createWindow",
"(",
"self",
",",
"cls",
"=",
"None",
",",
"caption_t",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"cls",
"is",
"None",
":",
"from",
".",
"import",
"window",
"cls",
"=",
"window",
".",
"PengWindow... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Peng.run | Runs the application main loop.
This method is blocking and needs to be called from the main thread to avoid OpenGL bugs that can occur.
``evloop`` may optionally be a subclass of :py:class:`pyglet.app.base.EventLoop` to replace the default event loop. | peng3d/peng.py | def run(self,evloop=None):
"""
Runs the application main loop.
This method is blocking and needs to be called from the main thread to avoid OpenGL bugs that can occur.
``evloop`` may optionally be a subclass of :py:class:`pyglet.app.base.EventLoop` to replace the defaul... | def run(self,evloop=None):
"""
Runs the application main loop.
This method is blocking and needs to be called from the main thread to avoid OpenGL bugs that can occur.
``evloop`` may optionally be a subclass of :py:class:`pyglet.app.base.EventLoop` to replace the defaul... | [
"Runs",
"the",
"application",
"main",
"loop",
".",
"This",
"method",
"is",
"blocking",
"and",
"needs",
"to",
"be",
"called",
"from",
"the",
"main",
"thread",
"to",
"avoid",
"OpenGL",
"bugs",
"that",
"can",
"occur",
".",
"evloop",
"may",
"optionally",
"be",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/peng.py#L121-L131 | [
"def",
"run",
"(",
"self",
",",
"evloop",
"=",
"None",
")",
":",
"self",
".",
"sendEvent",
"(",
"\"peng3d:peng.run\"",
",",
"{",
"\"peng\"",
":",
"self",
",",
"\"window\"",
":",
"self",
".",
"window",
",",
"\"evloop\"",
":",
"evloop",
"}",
")",
"self",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Peng.sendPygletEvent | Handles a pyglet event.
This method is called by :py:meth:`PengWindow.dispatch_event()` and handles all events.
See :py:meth:`registerEventHandler()` for how to listen to these events.
This method should be used to send pyglet events.
For new code, it is recomm... | peng3d/peng.py | def sendPygletEvent(self,event_type,args,window=None):
"""
Handles a pyglet event.
This method is called by :py:meth:`PengWindow.dispatch_event()` and handles all events.
See :py:meth:`registerEventHandler()` for how to listen to these events.
This meth... | def sendPygletEvent(self,event_type,args,window=None):
"""
Handles a pyglet event.
This method is called by :py:meth:`PengWindow.dispatch_event()` and handles all events.
See :py:meth:`registerEventHandler()` for how to listen to these events.
This meth... | [
"Handles",
"a",
"pyglet",
"event",
".",
"This",
"method",
"is",
"called",
"by",
":",
"py",
":",
"meth",
":",
"PengWindow",
".",
"dispatch_event",
"()",
"and",
"handles",
"all",
"events",
".",
"See",
":",
"py",
":",
"meth",
":",
"registerEventHandler",
"(... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/peng.py#L133-L163 | [
"def",
"sendPygletEvent",
"(",
"self",
",",
"event_type",
",",
"args",
",",
"window",
"=",
"None",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"self",
".",
"sendEvent",
"(",
"\"pyglet:%s\"",
"%",
"event_type",
",",
"{",
"\"peng\"",
":",
"self",
",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Peng.addPygletListener | Registers an event handler.
The specified callable handler will be called every time an event with the same ``event_type`` is encountered.
All event arguments are passed as positional arguments.
This method should be used to listen for pyglet events.
For new co... | peng3d/peng.py | def addPygletListener(self,event_type,handler):
"""
Registers an event handler.
The specified callable handler will be called every time an event with the same ``event_type`` is encountered.
All event arguments are passed as positional arguments.
This m... | def addPygletListener(self,event_type,handler):
"""
Registers an event handler.
The specified callable handler will be called every time an event with the same ``event_type`` is encountered.
All event arguments are passed as positional arguments.
This m... | [
"Registers",
"an",
"event",
"handler",
".",
"The",
"specified",
"callable",
"handler",
"will",
"be",
"called",
"every",
"time",
"an",
"event",
"with",
"the",
"same",
"event_type",
"is",
"encountered",
".",
"All",
"event",
"arguments",
"are",
"passed",
"as",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/peng.py#L164-L188 | [
"def",
"addPygletListener",
"(",
"self",
",",
"event_type",
",",
"handler",
")",
":",
"if",
"self",
".",
"cfg",
"[",
"\"debug.events.register\"",
"]",
":",
"print",
"(",
"\"Registered Event: %s Handler: %s\"",
"%",
"(",
"event_type",
",",
"handler",
")",
")",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Peng.sendEvent | Sends an event with attached data.
``event`` should be a string of format ``<namespace>:<category1>.<subcategory2>.<name>``\ .
There may be an arbitrary amount of subcategories. Also note that this
format is not strictly enforced, but rather recommended by convention.
`... | peng3d/peng.py | def sendEvent(self,event,data=None):
"""
Sends an event with attached data.
``event`` should be a string of format ``<namespace>:<category1>.<subcategory2>.<name>``\ .
There may be an arbitrary amount of subcategories. Also note that this
format is not strictly enforced,... | def sendEvent(self,event,data=None):
"""
Sends an event with attached data.
``event`` should be a string of format ``<namespace>:<category1>.<subcategory2>.<name>``\ .
There may be an arbitrary amount of subcategories. Also note that this
format is not strictly enforced,... | [
"Sends",
"an",
"event",
"with",
"attached",
"data",
".",
"event",
"should",
"be",
"a",
"string",
"of",
"format",
"<namespace",
">",
":",
"<category1",
">",
".",
"<subcategory2",
">",
".",
"<name",
">",
"\\",
".",
"There",
"may",
"be",
"an",
"arbitrary",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/peng.py#L194-L229 | [
"def",
"sendEvent",
"(",
"self",
",",
"event",
",",
"data",
"=",
"None",
")",
":",
"if",
"self",
".",
"cfg",
"[",
"\"debug.events.dumpfile\"",
"]",
"!=",
"\"\"",
"and",
"event",
"not",
"in",
"self",
".",
"event_list",
":",
"self",
".",
"event_list",
".... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Peng.addEventListener | Adds a handler to the given event.
A event may have an arbitrary amount of handlers, though assigning too
many handlers may slow down event processing.
For the format of ``event``\ , see :py:meth:`sendEvent()`\ .
``func`` is the handler which will be executed w... | peng3d/peng.py | def addEventListener(self,event,func,raiseErrors=False):
"""
Adds a handler to the given event.
A event may have an arbitrary amount of handlers, though assigning too
many handlers may slow down event processing.
For the format of ``event``\ , see :py:meth:`send... | def addEventListener(self,event,func,raiseErrors=False):
"""
Adds a handler to the given event.
A event may have an arbitrary amount of handlers, though assigning too
many handlers may slow down event processing.
For the format of ``event``\ , see :py:meth:`send... | [
"Adds",
"a",
"handler",
"to",
"the",
"given",
"event",
".",
"A",
"event",
"may",
"have",
"an",
"arbitrary",
"amount",
"of",
"handlers",
"though",
"assigning",
"too",
"many",
"handlers",
"may",
"slow",
"down",
"event",
"processing",
".",
"For",
"the",
"form... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/peng.py#L231-L250 | [
"def",
"addEventListener",
"(",
"self",
",",
"event",
",",
"func",
",",
"raiseErrors",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"event",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"Event types must always be strings\"",
")",
"if",
"eve... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Peng.delEventListener | Removes the given handler from the given event.
If the event does not exist, a :py:exc:`NameError` is thrown.
If the handler has not been registered previously, also a :py:exc:`NameError` will be thrown. | peng3d/peng.py | def delEventListener(self,event,func):
"""
Removes the given handler from the given event.
If the event does not exist, a :py:exc:`NameError` is thrown.
If the handler has not been registered previously, also a :py:exc:`NameError` will be thrown.
"""
if ... | def delEventListener(self,event,func):
"""
Removes the given handler from the given event.
If the event does not exist, a :py:exc:`NameError` is thrown.
If the handler has not been registered previously, also a :py:exc:`NameError` will be thrown.
"""
if ... | [
"Removes",
"the",
"given",
"handler",
"from",
"the",
"given",
"event",
".",
"If",
"the",
"event",
"does",
"not",
"exist",
"a",
":",
"py",
":",
"exc",
":",
"NameError",
"is",
"thrown",
".",
"If",
"the",
"handler",
"has",
"not",
"been",
"registered",
"pr... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/peng.py#L251-L268 | [
"def",
"delEventListener",
"(",
"self",
",",
"event",
",",
"func",
")",
":",
"if",
"event",
"not",
"in",
"self",
".",
"eventHandlers",
":",
"raise",
"NameError",
"(",
"\"No handlers exist for event %s\"",
"%",
"event",
")",
"if",
"[",
"func",
",",
"True",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | TranslationManager.setLang | Sets the default language for all domains.
For recommendations regarding the format of the language code, see
:py:class:`TranslationManager`\ .
Note that the ``lang`` parameter of both :py:meth:`translate()` and
:py:meth:`translate_lazy()` will override this setting.
... | peng3d/i18n.py | def setLang(self,lang):
"""
Sets the default language for all domains.
For recommendations regarding the format of the language code, see
:py:class:`TranslationManager`\ .
Note that the ``lang`` parameter of both :py:meth:`translate()` and
:py:meth:`tran... | def setLang(self,lang):
"""
Sets the default language for all domains.
For recommendations regarding the format of the language code, see
:py:class:`TranslationManager`\ .
Note that the ``lang`` parameter of both :py:meth:`translate()` and
:py:meth:`tran... | [
"Sets",
"the",
"default",
"language",
"for",
"all",
"domains",
".",
"For",
"recommendations",
"regarding",
"the",
"format",
"of",
"the",
"language",
"code",
"see",
":",
"py",
":",
"class",
":",
"TranslationManager",
"\\",
".",
"Note",
"that",
"the",
"lang",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/i18n.py#L75-L102 | [
"def",
"setLang",
"(",
"self",
",",
"lang",
")",
":",
"self",
".",
"lang",
"=",
"lang",
"self",
".",
"peng",
".",
"cfg",
"[",
"\"i18n.lang\"",
"]",
"=",
"lang",
"if",
"lang",
"not",
"in",
"self",
".",
"cache",
":",
"self",
".",
"cache",
"[",
"lan... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | TranslationManager.discoverLangs | Generates a list of languages based on files found on disk.
The optional ``domain`` argument may specify a domain to use when checking
for files. By default, all domains are checked.
This internally uses the :py:mod:`glob` built-in module and the
:confval:`i18n.lang.for... | peng3d/i18n.py | def discoverLangs(self,domain="*"):
"""
Generates a list of languages based on files found on disk.
The optional ``domain`` argument may specify a domain to use when checking
for files. By default, all domains are checked.
This internally uses the :py:mod:`glob`... | def discoverLangs(self,domain="*"):
"""
Generates a list of languages based on files found on disk.
The optional ``domain`` argument may specify a domain to use when checking
for files. By default, all domains are checked.
This internally uses the :py:mod:`glob`... | [
"Generates",
"a",
"list",
"of",
"languages",
"based",
"on",
"files",
"found",
"on",
"disk",
".",
"The",
"optional",
"domain",
"argument",
"may",
"specify",
"a",
"domain",
"to",
"use",
"when",
"checking",
"for",
"files",
".",
"By",
"default",
"all",
"domain... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/i18n.py#L104-L128 | [
"def",
"discoverLangs",
"(",
"self",
",",
"domain",
"=",
"\"*\"",
")",
":",
"rsrc",
"=",
"self",
".",
"peng",
".",
"cfg",
"[",
"\"i18n.lang.format\"",
"]",
".",
"format",
"(",
"domain",
"=",
"domain",
",",
"lang",
"=",
"\"*\"",
")",
"pattern",
"=",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | World.addCamera | Add the camera to the internal registry.
Each camera name must be unique, or else only the most recent version will be used. This behavior should not be relied on because some objects may cache objects.
Additionally, only instances of :py:class:`Camera() <peng3d.camera.Camera>` may be ... | peng3d/world.py | def addCamera(self,camera):
"""
Add the camera to the internal registry.
Each camera name must be unique, or else only the most recent version will be used. This behavior should not be relied on because some objects may cache objects.
Additionally, only instances of :py... | def addCamera(self,camera):
"""
Add the camera to the internal registry.
Each camera name must be unique, or else only the most recent version will be used. This behavior should not be relied on because some objects may cache objects.
Additionally, only instances of :py... | [
"Add",
"the",
"camera",
"to",
"the",
"internal",
"registry",
".",
"Each",
"camera",
"name",
"must",
"be",
"unique",
"or",
"else",
"only",
"the",
"most",
"recent",
"version",
"will",
"be",
"used",
".",
"This",
"behavior",
"should",
"not",
"be",
"relied",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L58-L68 | [
"def",
"addCamera",
"(",
"self",
",",
"camera",
")",
":",
"if",
"not",
"isinstance",
"(",
"camera",
",",
"Camera",
")",
":",
"raise",
"TypeError",
"(",
"\"camera is not of type Camera!\"",
")",
"self",
".",
"cameras",
"[",
"camera",
".",
"name",
"]",
"=",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | World.addView | Adds the supplied :py:class:`WorldView()` object to the internal registry.
The same restrictions as for cameras apply, e.g. no duplicate names.
Additionally, only instances of :py:class:`WorldView()` may be used, everything else raises a :py:exc:`TypeError`\ . | peng3d/world.py | def addView(self,view):
"""
Adds the supplied :py:class:`WorldView()` object to the internal registry.
The same restrictions as for cameras apply, e.g. no duplicate names.
Additionally, only instances of :py:class:`WorldView()` may be used, everything else raises a :py:... | def addView(self,view):
"""
Adds the supplied :py:class:`WorldView()` object to the internal registry.
The same restrictions as for cameras apply, e.g. no duplicate names.
Additionally, only instances of :py:class:`WorldView()` may be used, everything else raises a :py:... | [
"Adds",
"the",
"supplied",
":",
"py",
":",
"class",
":",
"WorldView",
"()",
"object",
"to",
"the",
"internal",
"registry",
".",
"The",
"same",
"restrictions",
"as",
"for",
"cameras",
"apply",
"e",
".",
"g",
".",
"no",
"duplicate",
"names",
".",
"Addition... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L69-L79 | [
"def",
"addView",
"(",
"self",
",",
"view",
")",
":",
"if",
"not",
"isinstance",
"(",
"view",
",",
"WorldView",
")",
":",
"raise",
"TypeError",
"(",
"\"view is not of type WorldView!\"",
")",
"self",
".",
"views",
"[",
"view",
".",
"name",
"]",
"=",
"vie... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | World.getView | Returns the view with name ``name``\ .
Raises a :py:exc:`ValueError` if the view does not exist. | peng3d/world.py | def getView(self,name):
"""
Returns the view with name ``name``\ .
Raises a :py:exc:`ValueError` if the view does not exist.
"""
if name not in self.views:
raise ValueError("Unknown world view")
return self.views[name] | def getView(self,name):
"""
Returns the view with name ``name``\ .
Raises a :py:exc:`ValueError` if the view does not exist.
"""
if name not in self.views:
raise ValueError("Unknown world view")
return self.views[name] | [
"Returns",
"the",
"view",
"with",
"name",
"name",
"\\",
".",
"Raises",
"a",
":",
"py",
":",
"exc",
":",
"ValueError",
"if",
"the",
"view",
"does",
"not",
"exist",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L88-L96 | [
"def",
"getView",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"views",
":",
"raise",
"ValueError",
"(",
"\"Unknown world view\"",
")",
"return",
"self",
".",
"views",
"[",
"name",
"]"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | World.render3d | Renders the world in 3d-mode.
If you want to render custom terrain, you may override this method. Be careful that you still call the original method or else actors may not be rendered. | peng3d/world.py | def render3d(self,view=None):
"""
Renders the world in 3d-mode.
If you want to render custom terrain, you may override this method. Be careful that you still call the original method or else actors may not be rendered.
"""
for actor in self.actors.values():
a... | def render3d(self,view=None):
"""
Renders the world in 3d-mode.
If you want to render custom terrain, you may override this method. Be careful that you still call the original method or else actors may not be rendered.
"""
for actor in self.actors.values():
a... | [
"Renders",
"the",
"world",
"in",
"3d",
"-",
"mode",
".",
"If",
"you",
"want",
"to",
"render",
"custom",
"terrain",
"you",
"may",
"override",
"this",
"method",
".",
"Be",
"careful",
"that",
"you",
"still",
"call",
"the",
"original",
"method",
"or",
"else"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L98-L105 | [
"def",
"render3d",
"(",
"self",
",",
"view",
"=",
"None",
")",
":",
"for",
"actor",
"in",
"self",
".",
"actors",
".",
"values",
"(",
")",
":",
"actor",
".",
"render",
"(",
"view",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | StaticWorld.render3d | Renders the world. | peng3d/world.py | def render3d(self,view=None):
"""
Renders the world.
"""
super(StaticWorld,self).render3d(view)
self.batch3d.draw() | def render3d(self,view=None):
"""
Renders the world.
"""
super(StaticWorld,self).render3d(view)
self.batch3d.draw() | [
"Renders",
"the",
"world",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L158-L163 | [
"def",
"render3d",
"(",
"self",
",",
"view",
"=",
"None",
")",
":",
"super",
"(",
"StaticWorld",
",",
"self",
")",
".",
"render3d",
"(",
"view",
")",
"self",
".",
"batch3d",
".",
"draw",
"(",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WorldView.setActiveCamera | Sets the active camera.
This method also calls the :py:meth:`Camera.on_activate() <peng3d.camera.Camera.on_activate>` event handler if the camera is not already active. | peng3d/world.py | def setActiveCamera(self,name):
"""
Sets the active camera.
This method also calls the :py:meth:`Camera.on_activate() <peng3d.camera.Camera.on_activate>` event handler if the camera is not already active.
"""
if name == self.activeCamera:
return # Cam is alre... | def setActiveCamera(self,name):
"""
Sets the active camera.
This method also calls the :py:meth:`Camera.on_activate() <peng3d.camera.Camera.on_activate>` event handler if the camera is not already active.
"""
if name == self.activeCamera:
return # Cam is alre... | [
"Sets",
"the",
"active",
"camera",
".",
"This",
"method",
"also",
"calls",
"the",
":",
"py",
":",
"meth",
":",
"Camera",
".",
"on_activate",
"()",
"<peng3d",
".",
"camera",
".",
"Camera",
".",
"on_activate",
">",
"event",
"handler",
"if",
"the",
"camera"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L179-L191 | [
"def",
"setActiveCamera",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"==",
"self",
".",
"activeCamera",
":",
"return",
"# Cam is already active",
"if",
"name",
"not",
"in",
"self",
".",
"world",
".",
"cameras",
":",
"raise",
"ValueError",
"(",
"\"Un... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WorldViewMouseRotatable.on_menu_enter | Fake event handler, same as :py:meth:`WorldView.on_menu_enter()` but forces mouse exclusivity. | peng3d/world.py | def on_menu_enter(self,old):
"""
Fake event handler, same as :py:meth:`WorldView.on_menu_enter()` but forces mouse exclusivity.
"""
super(WorldViewMouseRotatable,self).on_menu_enter(old)
self.world.peng.window.toggle_exclusivity(True) | def on_menu_enter(self,old):
"""
Fake event handler, same as :py:meth:`WorldView.on_menu_enter()` but forces mouse exclusivity.
"""
super(WorldViewMouseRotatable,self).on_menu_enter(old)
self.world.peng.window.toggle_exclusivity(True) | [
"Fake",
"event",
"handler",
"same",
"as",
":",
"py",
":",
"meth",
":",
"WorldView",
".",
"on_menu_enter",
"()",
"but",
"forces",
"mouse",
"exclusivity",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L258-L263 | [
"def",
"on_menu_enter",
"(",
"self",
",",
"old",
")",
":",
"super",
"(",
"WorldViewMouseRotatable",
",",
"self",
")",
".",
"on_menu_enter",
"(",
"old",
")",
"self",
".",
"world",
".",
"peng",
".",
"window",
".",
"toggle_exclusivity",
"(",
"True",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.