repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
codelv/enaml-native | src/enamlnative/android/android_utils.py | InputMethodManager.hide_keyboard | def hide_keyboard(cls):
""" Hide keyboard if it's open
Returns
--------
result: future
Resolves when the hide is complete
"""
app = AndroidApplication.instance()
f = app.create_future()
def on_ready(ims):
... | python | def hide_keyboard(cls):
""" Hide keyboard if it's open
Returns
--------
result: future
Resolves when the hide is complete
"""
app = AndroidApplication.instance()
f = app.create_future()
def on_ready(ims):
... | [
"def",
"hide_keyboard",
"(",
"cls",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"def",
"on_ready",
"(",
"ims",
")",
":",
"view",
"=",
"app",
".",
"view",
".",
"proxy",
".",
... | Hide keyboard if it's open
Returns
--------
result: future
Resolves when the hide is complete | [
"Hide",
"keyboard",
"if",
"it",
"s",
"open",
"Returns",
"--------",
"result",
":",
"future",
"Resolves",
"when",
"the",
"hide",
"is",
"complete"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_utils.py#L81-L102 |
codelv/enaml-native | src/enamlnative/android/android_notification.py | NotificationManager.get | def get(cls):
""" Acquires the NotificationManager service async. """
app = AndroidApplication.instance()
f = app.create_future()
if cls._instance:
f.set_result(cls._instance)
return f
def on_service(obj_id):
#: Create the manager
... | python | def get(cls):
""" Acquires the NotificationManager service async. """
app = AndroidApplication.instance()
f = app.create_future()
if cls._instance:
f.set_result(cls._instance)
return f
def on_service(obj_id):
#: Create the manager
... | [
"def",
"get",
"(",
"cls",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"if",
"cls",
".",
"_instance",
":",
"f",
".",
"set_result",
"(",
"cls",
".",
"_instance",
")",
"return",... | Acquires the NotificationManager service async. | [
"Acquires",
"the",
"NotificationManager",
"service",
"async",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_notification.py#L85-L104 |
codelv/enaml-native | src/enamlnative/android/android_notification.py | NotificationManager.create_channel | def create_channel(cls, channel_id, name, importance=IMPORTANCE_DEFAULT,
description=""):
""" Before you can deliver the notification on Android 8.0 and higher,
you must register your app's notification channel with the system by
passing an instance of NotificationChanne... | python | def create_channel(cls, channel_id, name, importance=IMPORTANCE_DEFAULT,
description=""):
""" Before you can deliver the notification on Android 8.0 and higher,
you must register your app's notification channel with the system by
passing an instance of NotificationChanne... | [
"def",
"create_channel",
"(",
"cls",
",",
"channel_id",
",",
"name",
",",
"importance",
"=",
"IMPORTANCE_DEFAULT",
",",
"description",
"=",
"\"\"",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"if",
"app",
".",
"api_level",
">=",
... | Before you can deliver the notification on Android 8.0 and higher,
you must register your app's notification channel with the system by
passing an instance of NotificationChannel
to createNotificationChannel().
Parameters
----------
channel_id: String-
... | [
"Before",
"you",
"can",
"deliver",
"the",
"notification",
"on",
"Android",
"8",
".",
"0",
"and",
"higher",
"you",
"must",
"register",
"your",
"app",
"s",
"notification",
"channel",
"with",
"the",
"system",
"by",
"passing",
"an",
"instance",
"of",
"Notificati... | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_notification.py#L118-L150 |
codelv/enaml-native | src/enamlnative/android/android_notification.py | NotificationManager.show_notification | def show_notification(cls, channel_id, *args, **kwargs):
""" Create and show a Notification. See `Notification.Builder.update`
for a list of accepted parameters.
"""
app = AndroidApplication.instance()
builder = Notification.Builder(app, channel_id)
builder.updat... | python | def show_notification(cls, channel_id, *args, **kwargs):
""" Create and show a Notification. See `Notification.Builder.update`
for a list of accepted parameters.
"""
app = AndroidApplication.instance()
builder = Notification.Builder(app, channel_id)
builder.updat... | [
"def",
"show_notification",
"(",
"cls",
",",
"channel_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"builder",
"=",
"Notification",
".",
"Builder",
"(",
"app",
",",
"channel_id",
")... | Create and show a Notification. See `Notification.Builder.update`
for a list of accepted parameters. | [
"Create",
"and",
"show",
"a",
"Notification",
".",
"See",
"Notification",
".",
"Builder",
".",
"update",
"for",
"a",
"list",
"of",
"accepted",
"parameters",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_notification.py#L153-L161 |
codelv/enaml-native | src/enamlnative/android/android_notification.py | NotificationManager.cancel_notification | def cancel_notification(cls, notification_or_id, tag=None):
""" Cancel the notification.
Parameters
----------
notification_or_id: Notification.Builder or int
The notification or id of a notification to clear
tag: String
The tag of the notificati... | python | def cancel_notification(cls, notification_or_id, tag=None):
""" Cancel the notification.
Parameters
----------
notification_or_id: Notification.Builder or int
The notification or id of a notification to clear
tag: String
The tag of the notificati... | [
"def",
"cancel_notification",
"(",
"cls",
",",
"notification_or_id",
",",
"tag",
"=",
"None",
")",
":",
"def",
"on_ready",
"(",
"mgr",
")",
":",
"if",
"isinstance",
"(",
"notification_or_id",
",",
"JavaBridgeObject",
")",
":",
"nid",
"=",
"notification_or_id",... | Cancel the notification.
Parameters
----------
notification_or_id: Notification.Builder or int
The notification or id of a notification to clear
tag: String
The tag of the notification to clear | [
"Cancel",
"the",
"notification",
".",
"Parameters",
"----------",
"notification_or_id",
":",
"Notification",
".",
"Builder",
"or",
"int",
"The",
"notification",
"or",
"id",
"of",
"a",
"notification",
"to",
"clear",
"tag",
":",
"String",
"The",
"tag",
"of",
"th... | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_notification.py#L164-L184 |
codelv/enaml-native | src/enamlnative/android/android_notification.py | AndroidNotification.init_layout | def init_layout(self):
""" Create the notification in the top down pass if show = True
"""
d = self.declaration
self.create_notification()
if d.show:
self.set_show(d.show) | python | def init_layout(self):
""" Create the notification in the top down pass if show = True
"""
d = self.declaration
self.create_notification()
if d.show:
self.set_show(d.show) | [
"def",
"init_layout",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"create_notification",
"(",
")",
"if",
"d",
".",
"show",
":",
"self",
".",
"set_show",
"(",
"d",
".",
"show",
")"
] | Create the notification in the top down pass if show = True | [
"Create",
"the",
"notification",
"in",
"the",
"top",
"down",
"pass",
"if",
"show",
"=",
"True"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_notification.py#L548-L554 |
codelv/enaml-native | src/enamlnative/android/android_notification.py | AndroidNotification.destroy | def destroy(self):
""" A reimplemented destructor that cancels
the notification before destroying.
"""
builder = self.builder
NotificationManager.cancel_notification(builder)
del self.builder
super(AndroidNotification, self).destroy() | python | def destroy(self):
""" A reimplemented destructor that cancels
the notification before destroying.
"""
builder = self.builder
NotificationManager.cancel_notification(builder)
del self.builder
super(AndroidNotification, self).destroy() | [
"def",
"destroy",
"(",
"self",
")",
":",
"builder",
"=",
"self",
".",
"builder",
"NotificationManager",
".",
"cancel_notification",
"(",
"builder",
")",
"del",
"self",
".",
"builder",
"super",
"(",
"AndroidNotification",
",",
"self",
")",
".",
"destroy",
"("... | A reimplemented destructor that cancels
the notification before destroying. | [
"A",
"reimplemented",
"destructor",
"that",
"cancels",
"the",
"notification",
"before",
"destroying",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_notification.py#L556-L564 |
codelv/enaml-native | src/enamlnative/android/android_notification.py | AndroidNotification.create_notification | def create_notification(self):
""" Instead of the typical create_widget we use `create_notification`
because after it's closed it needs created again.
"""
d = self.declaration
builder = self.builder = Notification.Builder(self.get_context(),
... | python | def create_notification(self):
""" Instead of the typical create_widget we use `create_notification`
because after it's closed it needs created again.
"""
d = self.declaration
builder = self.builder = Notification.Builder(self.get_context(),
... | [
"def",
"create_notification",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"builder",
"=",
"self",
".",
"builder",
"=",
"Notification",
".",
"Builder",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"d",
".",
"channel_id",
")",
"d",
"=... | Instead of the typical create_widget we use `create_notification`
because after it's closed it needs created again. | [
"Instead",
"of",
"the",
"typical",
"create_widget",
"we",
"use",
"create_notification",
"because",
"after",
"it",
"s",
"closed",
"it",
"needs",
"created",
"again",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_notification.py#L569-L595 |
codelv/enaml-native | src/enamlnative/ios/uikit_button.py | UiKitButton.create_widget | def create_widget(self):
""" Create the toolkit widget for the proxy object.
"""
d = self.declaration
button_type = UIButton.UIButtonTypeSystem if d.flat else UIButton.UIButtonTypeRoundedRect
self.widget = UIButton(buttonWithType=button_type) | python | def create_widget(self):
""" Create the toolkit widget for the proxy object.
"""
d = self.declaration
button_type = UIButton.UIButtonTypeSystem if d.flat else UIButton.UIButtonTypeRoundedRect
self.widget = UIButton(buttonWithType=button_type) | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"button_type",
"=",
"UIButton",
".",
"UIButtonTypeSystem",
"if",
"d",
".",
"flat",
"else",
"UIButton",
".",
"UIButtonTypeRoundedRect",
"self",
".",
"widget",
"=",
"UIButton",
... | Create the toolkit widget for the proxy object. | [
"Create",
"the",
"toolkit",
"widget",
"for",
"the",
"proxy",
"object",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/uikit_button.py#L56-L61 |
codelv/enaml-native | src/enamlnative/core/block.py | Block.initialize | def initialize(self):
""" A reimplemented initializer.
This method will add the include objects to the parent of the
include and ensure that they are initialized.
"""
super(Block, self).initialize()
block = self.block
if block: #: This block is setting the con... | python | def initialize(self):
""" A reimplemented initializer.
This method will add the include objects to the parent of the
include and ensure that they are initialized.
"""
super(Block, self).initialize()
block = self.block
if block: #: This block is setting the con... | [
"def",
"initialize",
"(",
"self",
")",
":",
"super",
"(",
"Block",
",",
"self",
")",
".",
"initialize",
"(",
")",
"block",
"=",
"self",
".",
"block",
"if",
"block",
":",
"#: This block is setting the content of another block",
"#: Remove the existing blocks children... | A reimplemented initializer.
This method will add the include objects to the parent of the
include and ensure that they are initialized. | [
"A",
"reimplemented",
"initializer",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/block.py#L34-L55 |
codelv/enaml-native | src/enamlnative/core/block.py | Block._observe_block | def _observe_block(self, change):
""" A change handler for the 'objects' list of the Include.
If the object is initialized objects which are removed will be
unparented and objects which are added will be reparented. Old
objects will be destroyed if the 'destroy_old' flag is True.
... | python | def _observe_block(self, change):
""" A change handler for the 'objects' list of the Include.
If the object is initialized objects which are removed will be
unparented and objects which are added will be reparented. Old
objects will be destroyed if the 'destroy_old' flag is True.
... | [
"def",
"_observe_block",
"(",
"self",
",",
"change",
")",
":",
"if",
"self",
".",
"is_initialized",
":",
"if",
"change",
"[",
"'type'",
"]",
"==",
"'update'",
":",
"old_block",
"=",
"change",
"[",
"'oldvalue'",
"]",
"old_parent",
"=",
"old_block",
".",
"... | A change handler for the 'objects' list of the Include.
If the object is initialized objects which are removed will be
unparented and objects which are added will be reparented. Old
objects will be destroyed if the 'destroy_old' flag is True. | [
"A",
"change",
"handler",
"for",
"the",
"objects",
"list",
"of",
"the",
"Include",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/block.py#L57-L72 |
codelv/enaml-native | src/enamlnative/ios/uikit_text_view.py | UiKitTextView.init_text | def init_text(self):
""" Init text properties for this widget """
d = self.declaration
if d.text:
self.set_text(d.text)
if d.text_color:
self.set_text_color(d.text_color)
if d.text_alignment:
self.set_text_alignment(d.text_alignment)
if... | python | def init_text(self):
""" Init text properties for this widget """
d = self.declaration
if d.text:
self.set_text(d.text)
if d.text_color:
self.set_text_color(d.text_color)
if d.text_alignment:
self.set_text_alignment(d.text_alignment)
if... | [
"def",
"init_text",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"if",
"d",
".",
"text",
":",
"self",
".",
"set_text",
"(",
"d",
".",
"text",
")",
"if",
"d",
".",
"text_color",
":",
"self",
".",
"set_text_color",
"(",
"d",
".",
"t... | Init text properties for this widget | [
"Init",
"text",
"properties",
"for",
"this",
"widget"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/uikit_text_view.py#L74-L86 |
codelv/enaml-native | src/enamlnative/android/android_view_group.py | AndroidViewGroup.init_layout | def init_layout(self):
""" Add all child widgets to the view
"""
super(AndroidViewGroup, self).init_layout()
widget = self.widget
i = 0
for child in self.children():
child_widget = child.widget
if child_widget:
if child.layout_param... | python | def init_layout(self):
""" Add all child widgets to the view
"""
super(AndroidViewGroup, self).init_layout()
widget = self.widget
i = 0
for child in self.children():
child_widget = child.widget
if child_widget:
if child.layout_param... | [
"def",
"init_layout",
"(",
"self",
")",
":",
"super",
"(",
"AndroidViewGroup",
",",
"self",
")",
".",
"init_layout",
"(",
")",
"widget",
"=",
"self",
".",
"widget",
"i",
"=",
"0",
"for",
"child",
"in",
"self",
".",
"children",
"(",
")",
":",
"child_w... | Add all child widgets to the view | [
"Add",
"all",
"child",
"widgets",
"to",
"the",
"view"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view_group.py#L67-L85 |
codelv/enaml-native | src/enamlnative/android/android_view_group.py | AndroidViewGroup.child_added | def child_added(self, child):
""" Handle the child added event from the declaration.
This handler will unparent the child toolkit widget. Subclasses
which need more control should reimplement this method.
"""
super(AndroidViewGroup, self).child_added(child)
widget = se... | python | def child_added(self, child):
""" Handle the child added event from the declaration.
This handler will unparent the child toolkit widget. Subclasses
which need more control should reimplement this method.
"""
super(AndroidViewGroup, self).child_added(child)
widget = se... | [
"def",
"child_added",
"(",
"self",
",",
"child",
")",
":",
"super",
"(",
"AndroidViewGroup",
",",
"self",
")",
".",
"child_added",
"(",
"child",
")",
"widget",
"=",
"self",
".",
"widget",
"#: TODO: Should index be cached?",
"for",
"i",
",",
"child_widget",
"... | Handle the child added event from the declaration.
This handler will unparent the child toolkit widget. Subclasses
which need more control should reimplement this method. | [
"Handle",
"the",
"child",
"added",
"event",
"from",
"the",
"declaration",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view_group.py#L87-L104 |
codelv/enaml-native | src/enamlnative/android/android_view_group.py | AndroidViewGroup.child_moved | def child_moved(self, child):
""" Handle the child moved event from the declaration.
"""
super(AndroidViewGroup, self).child_moved(child)
#: Remove and re-add in correct spot
self.child_removed(child)
self.child_added(child) | python | def child_moved(self, child):
""" Handle the child moved event from the declaration.
"""
super(AndroidViewGroup, self).child_moved(child)
#: Remove and re-add in correct spot
self.child_removed(child)
self.child_added(child) | [
"def",
"child_moved",
"(",
"self",
",",
"child",
")",
":",
"super",
"(",
"AndroidViewGroup",
",",
"self",
")",
".",
"child_moved",
"(",
"child",
")",
"#: Remove and re-add in correct spot",
"self",
".",
"child_removed",
"(",
"child",
")",
"self",
".",
"child_a... | Handle the child moved event from the declaration. | [
"Handle",
"the",
"child",
"moved",
"event",
"from",
"the",
"declaration",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view_group.py#L106-L113 |
codelv/enaml-native | src/enamlnative/android/android_view_group.py | AndroidViewGroup.child_removed | def child_removed(self, child):
""" Handle the child removed event from the declaration.
This handler will unparent the child toolkit widget. Subclasses
which need more control should reimplement this method.
"""
super(AndroidViewGroup, self).child_removed(child)
if chi... | python | def child_removed(self, child):
""" Handle the child removed event from the declaration.
This handler will unparent the child toolkit widget. Subclasses
which need more control should reimplement this method.
"""
super(AndroidViewGroup, self).child_removed(child)
if chi... | [
"def",
"child_removed",
"(",
"self",
",",
"child",
")",
":",
"super",
"(",
"AndroidViewGroup",
",",
"self",
")",
".",
"child_removed",
"(",
"child",
")",
"if",
"child",
".",
"widget",
"is",
"not",
"None",
":",
"self",
".",
"widget",
".",
"removeView",
... | Handle the child removed event from the declaration.
This handler will unparent the child toolkit widget. Subclasses
which need more control should reimplement this method. | [
"Handle",
"the",
"child",
"removed",
"event",
"from",
"the",
"declaration",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view_group.py#L115-L124 |
codelv/enaml-native | src/enamlnative/android/android_time_picker.py | AndroidTimePicker.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = TimePicker(self.get_context(), None,
d.style or '@attr/timePickerStyle') | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = TimePicker(self.get_context(), None,
d.style or '@attr/timePickerStyle') | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"TimePicker",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
"or",
"'@attr/timePickerStyle'",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_time_picker.py#L43-L49 |
codelv/enaml-native | src/enamlnative/android/android_time_picker.py | AndroidTimePicker.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidTimePicker, self).init_widget()
d = self.declaration
w = self.widget
self.set_hour(d.hour)
self.set_minute(d.minute)
self.set_hour_mode(d.hour_mode)
w.setOnTimeChangedL... | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidTimePicker, self).init_widget()
d = self.declaration
w = self.widget
self.set_hour(d.hour)
self.set_minute(d.minute)
self.set_hour_mode(d.hour_mode)
w.setOnTimeChangedL... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidTimePicker",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"w",
"=",
"self",
".",
"widget",
"self",
".",
"set_hour",
"(",
"d",
".",
"hour",
")"... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_time_picker.py#L51-L63 |
codelv/enaml-native | src/enamlnative/android/android_toolkit_object.py | AndroidToolkitObject.destroy | def destroy(self):
""" A reimplemented destructor.
This destructor will clear the reference to the toolkit widget
and set its parent to None.
"""
widget = self.widget
if widget is not None:
parent = self.parent_widget()
if parent is not None:
... | python | def destroy(self):
""" A reimplemented destructor.
This destructor will clear the reference to the toolkit widget
and set its parent to None.
"""
widget = self.widget
if widget is not None:
parent = self.parent_widget()
if parent is not None:
... | [
"def",
"destroy",
"(",
"self",
")",
":",
"widget",
"=",
"self",
".",
"widget",
"if",
"widget",
"is",
"not",
"None",
":",
"parent",
"=",
"self",
".",
"parent_widget",
"(",
")",
"if",
"parent",
"is",
"not",
"None",
":",
"parent",
".",
"removeView",
"("... | A reimplemented destructor.
This destructor will clear the reference to the toolkit widget
and set its parent to None. | [
"A",
"reimplemented",
"destructor",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_toolkit_object.py#L82-L95 |
codelv/enaml-native | src/enamlnative/android/android_toggle_button.py | AndroidToggleButton.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = ToggleButton(self.get_context(), None,
d.style or "@attr/buttonStyleToggle") | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = ToggleButton(self.get_context(), None,
d.style or "@attr/buttonStyleToggle") | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"ToggleButton",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
"or",
"\"@attr/buttonStyleToggle\"",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_toggle_button.py#L36-L42 |
codelv/enaml-native | src/enamlnative/ios/uikit_switch.py | UiKitSwitch.init_widget | def init_widget(self):
""" Bind the on property to the checked state """
super(UiKitSwitch, self).init_widget()
d = self.declaration
if d.checked:
self.set_checked(d.checked)
#: Watch the on property for change
#: So apparently UISwitch is not KVO compliant.... | python | def init_widget(self):
""" Bind the on property to the checked state """
super(UiKitSwitch, self).init_widget()
d = self.declaration
if d.checked:
self.set_checked(d.checked)
#: Watch the on property for change
#: So apparently UISwitch is not KVO compliant.... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"UiKitSwitch",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"if",
"d",
".",
"checked",
":",
"self",
".",
"set_checked",
"(",
"d",
".",
"checked",
")",... | Bind the on property to the checked state | [
"Bind",
"the",
"on",
"property",
"to",
"the",
"checked",
"state"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/uikit_switch.py#L55-L82 |
codelv/enaml-native | src/enamlnative/ios/uikit_switch.py | UiKitSwitch.on_checked_changed | def on_checked_changed(self, on):
""" See https://stackoverflow.com/questions/19628310/ """
#: Since iOS decides to call this like 100 times for each defer it
d = self.declaration
with self.widget.setOn.suppressed():
d.checked = on | python | def on_checked_changed(self, on):
""" See https://stackoverflow.com/questions/19628310/ """
#: Since iOS decides to call this like 100 times for each defer it
d = self.declaration
with self.widget.setOn.suppressed():
d.checked = on | [
"def",
"on_checked_changed",
"(",
"self",
",",
"on",
")",
":",
"#: Since iOS decides to call this like 100 times for each defer it",
"d",
"=",
"self",
".",
"declaration",
"with",
"self",
".",
"widget",
".",
"setOn",
".",
"suppressed",
"(",
")",
":",
"d",
".",
"c... | See https://stackoverflow.com/questions/19628310/ | [
"See",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"19628310",
"/"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/uikit_switch.py#L84-L89 |
codelv/enaml-native | src/enamlnative/android/android_chronometer.py | AndroidChronometer.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = Chronometer(self.get_context(), None, d.style) | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = Chronometer(self.get_context(), None, d.style) | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"Chronometer",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_chronometer.py#L47-L52 |
codelv/enaml-native | src/enamlnative/android/android_chronometer.py | AndroidChronometer.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidChronometer, self).init_widget()
w = self.widget
w.setOnChronometerTickListener(w.getId())
w.onChronometerTick.connect(self.on_chronometer_tick) | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidChronometer, self).init_widget()
w = self.widget
w.setOnChronometerTickListener(w.getId())
w.onChronometerTick.connect(self.on_chronometer_tick) | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidChronometer",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"w",
"=",
"self",
".",
"widget",
"w",
".",
"setOnChronometerTickListener",
"(",
"w",
".",
"getId",
"(",
")",
")",
"w",
".",... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_chronometer.py#L54-L61 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | update_function | def update_function(old, new):
"""Upgrade the code object of a function"""
for name in func_attrs:
try:
setattr(old, name, getattr(new, name))
except (AttributeError, TypeError):
pass | python | def update_function(old, new):
"""Upgrade the code object of a function"""
for name in func_attrs:
try:
setattr(old, name, getattr(new, name))
except (AttributeError, TypeError):
pass | [
"def",
"update_function",
"(",
"old",
",",
"new",
")",
":",
"for",
"name",
"in",
"func_attrs",
":",
"try",
":",
"setattr",
"(",
"old",
",",
"name",
",",
"getattr",
"(",
"new",
",",
"name",
")",
")",
"except",
"(",
"AttributeError",
",",
"TypeError",
... | Upgrade the code object of a function | [
"Upgrade",
"the",
"code",
"object",
"of",
"a",
"function"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L290-L296 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | update_property | def update_property(old, new):
"""Replace get/set/del functions of a property"""
update_generic(old.fdel, new.fdel)
update_generic(old.fget, new.fget)
update_generic(old.fset, new.fset) | python | def update_property(old, new):
"""Replace get/set/del functions of a property"""
update_generic(old.fdel, new.fdel)
update_generic(old.fget, new.fget)
update_generic(old.fset, new.fset) | [
"def",
"update_property",
"(",
"old",
",",
"new",
")",
":",
"update_generic",
"(",
"old",
".",
"fdel",
",",
"new",
".",
"fdel",
")",
"update_generic",
"(",
"old",
".",
"fget",
",",
"new",
".",
"fget",
")",
"update_generic",
"(",
"old",
".",
"fset",
"... | Replace get/set/del functions of a property | [
"Replace",
"get",
"/",
"set",
"/",
"del",
"functions",
"of",
"a",
"property"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L324-L328 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | superreload | def superreload(module, reload=reload, old_objects={}):
"""Enhanced version of the builtin reload function.
superreload remembers objects previously in the module, and
- upgrades the class dictionary of every old class in the module
- upgrades the code object of every old function and method
- cle... | python | def superreload(module, reload=reload, old_objects={}):
"""Enhanced version of the builtin reload function.
superreload remembers objects previously in the module, and
- upgrades the class dictionary of every old class in the module
- upgrades the code object of every old function and method
- cle... | [
"def",
"superreload",
"(",
"module",
",",
"reload",
"=",
"reload",
",",
"old_objects",
"=",
"{",
"}",
")",
":",
"# collect old objects in the module",
"for",
"name",
",",
"obj",
"in",
"list",
"(",
"module",
".",
"__dict__",
".",
"items",
"(",
")",
")",
"... | Enhanced version of the builtin reload function.
superreload remembers objects previously in the module, and
- upgrades the class dictionary of every old class in the module
- upgrades the code object of every old function and method
- clears the module's namespace before reloading | [
"Enhanced",
"version",
"of",
"the",
"builtin",
"reload",
"function",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L363-L419 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | ModuleReloader.mark_module_skipped | def mark_module_skipped(self, module_name):
"""Skip reloading the named module in the future"""
try:
del self.modules[module_name]
except KeyError:
pass
self.skip_modules[module_name] = True | python | def mark_module_skipped(self, module_name):
"""Skip reloading the named module in the future"""
try:
del self.modules[module_name]
except KeyError:
pass
self.skip_modules[module_name] = True | [
"def",
"mark_module_skipped",
"(",
"self",
",",
"module_name",
")",
":",
"try",
":",
"del",
"self",
".",
"modules",
"[",
"module_name",
"]",
"except",
"KeyError",
":",
"pass",
"self",
".",
"skip_modules",
"[",
"module_name",
"]",
"=",
"True"
] | Skip reloading the named module in the future | [
"Skip",
"reloading",
"the",
"named",
"module",
"in",
"the",
"future"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L175-L181 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | ModuleReloader.mark_module_reloadable | def mark_module_reloadable(self, module_name):
"""Reload the named module in the future (if it is imported)"""
try:
del self.skip_modules[module_name]
except KeyError:
pass
self.modules[module_name] = True | python | def mark_module_reloadable(self, module_name):
"""Reload the named module in the future (if it is imported)"""
try:
del self.skip_modules[module_name]
except KeyError:
pass
self.modules[module_name] = True | [
"def",
"mark_module_reloadable",
"(",
"self",
",",
"module_name",
")",
":",
"try",
":",
"del",
"self",
".",
"skip_modules",
"[",
"module_name",
"]",
"except",
"KeyError",
":",
"pass",
"self",
".",
"modules",
"[",
"module_name",
"]",
"=",
"True"
] | Reload the named module in the future (if it is imported) | [
"Reload",
"the",
"named",
"module",
"in",
"the",
"future",
"(",
"if",
"it",
"is",
"imported",
")"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L183-L189 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | ModuleReloader.aimport_module | def aimport_module(self, module_name):
"""Import a module, and mark it reloadable
Returns
-------
top_module : module
The imported module if it is top-level, or the top-level
top_name : module
Name of top_module
"""
self.mark_module_reloa... | python | def aimport_module(self, module_name):
"""Import a module, and mark it reloadable
Returns
-------
top_module : module
The imported module if it is top-level, or the top-level
top_name : module
Name of top_module
"""
self.mark_module_reloa... | [
"def",
"aimport_module",
"(",
"self",
",",
"module_name",
")",
":",
"self",
".",
"mark_module_reloadable",
"(",
"module_name",
")",
"import_module",
"(",
"module_name",
")",
"top_name",
"=",
"module_name",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
"top_m... | Import a module, and mark it reloadable
Returns
-------
top_module : module
The imported module if it is top-level, or the top-level
top_name : module
Name of top_module | [
"Import",
"a",
"module",
"and",
"mark",
"it",
"reloadable"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L191-L207 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | ModuleReloader.check | def check(self, check_all=False, do_reload=True):
"""Check whether some modules need to be reloaded."""
if not self.enabled and not check_all:
return
if check_all or self.check_all:
modules = list(sys.modules.keys())
else:
modules = list(self.modules... | python | def check(self, check_all=False, do_reload=True):
"""Check whether some modules need to be reloaded."""
if not self.enabled and not check_all:
return
if check_all or self.check_all:
modules = list(sys.modules.keys())
else:
modules = list(self.modules... | [
"def",
"check",
"(",
"self",
",",
"check_all",
"=",
"False",
",",
"do_reload",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"enabled",
"and",
"not",
"check_all",
":",
"return",
"if",
"check_all",
"or",
"self",
".",
"check_all",
":",
"modules",
"=",... | Check whether some modules need to be reloaded. | [
"Check",
"whether",
"some",
"modules",
"need",
"to",
"be",
"reloaded",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L235-L279 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | Autoreloader.autoreload | def autoreload(self, parameter_s=''):
r"""%autoreload => Reload modules automatically
%autoreload
Reload all modules (except those excluded by %aimport) automatically
now.
%autoreload 0
Disable automatic reloading.
%autoreload 1
Reload all modules impor... | python | def autoreload(self, parameter_s=''):
r"""%autoreload => Reload modules automatically
%autoreload
Reload all modules (except those excluded by %aimport) automatically
now.
%autoreload 0
Disable automatic reloading.
%autoreload 1
Reload all modules impor... | [
"def",
"autoreload",
"(",
"self",
",",
"parameter_s",
"=",
"''",
")",
":",
"if",
"parameter_s",
"==",
"''",
":",
"self",
".",
"_reloader",
".",
"check",
"(",
"True",
")",
"elif",
"parameter_s",
"==",
"'0'",
":",
"self",
".",
"_reloader",
".",
"enabled"... | r"""%autoreload => Reload modules automatically
%autoreload
Reload all modules (except those excluded by %aimport) automatically
now.
%autoreload 0
Disable automatic reloading.
%autoreload 1
Reload all modules imported with %aimport every time before executing
... | [
"r",
"%autoreload",
"=",
">",
"Reload",
"modules",
"automatically"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L439-L492 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | Autoreloader.aimport | def aimport(self, parameter_s='', stream=None):
"""%aimport => Import modules for automatic reloading.
%aimport
List modules to automatically import and not to import.
%aimport foo
Import module 'foo' and mark it to be autoreloaded for %autoreload 1
%aimport foo, bar
... | python | def aimport(self, parameter_s='', stream=None):
"""%aimport => Import modules for automatic reloading.
%aimport
List modules to automatically import and not to import.
%aimport foo
Import module 'foo' and mark it to be autoreloaded for %autoreload 1
%aimport foo, bar
... | [
"def",
"aimport",
"(",
"self",
",",
"parameter_s",
"=",
"''",
",",
"stream",
"=",
"None",
")",
":",
"modname",
"=",
"parameter_s",
"if",
"not",
"modname",
":",
"to_reload",
"=",
"sorted",
"(",
"self",
".",
"_reloader",
".",
"modules",
".",
"keys",
"(",... | %aimport => Import modules for automatic reloading.
%aimport
List modules to automatically import and not to import.
%aimport foo
Import module 'foo' and mark it to be autoreloaded for %autoreload 1
%aimport foo, bar
Import modules 'foo', 'bar' and mark them to be auto... | [
"%aimport",
"=",
">",
"Import",
"modules",
"for",
"automatic",
"reloading",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L494-L528 |
codelv/enaml-native | src/enamlnative/core/hotswap/autoreload.py | Autoreloader.post_execute | def post_execute(self):
"""Cache the modification times of any modules imported in this execution
"""
newly_loaded_modules = set(sys.modules) - self.loaded_modules
for modname in newly_loaded_modules:
_, pymtime = self._reloader.filename_and_mtime(sys.modules[modname])
... | python | def post_execute(self):
"""Cache the modification times of any modules imported in this execution
"""
newly_loaded_modules = set(sys.modules) - self.loaded_modules
for modname in newly_loaded_modules:
_, pymtime = self._reloader.filename_and_mtime(sys.modules[modname])
... | [
"def",
"post_execute",
"(",
"self",
")",
":",
"newly_loaded_modules",
"=",
"set",
"(",
"sys",
".",
"modules",
")",
"-",
"self",
".",
"loaded_modules",
"for",
"modname",
"in",
"newly_loaded_modules",
":",
"_",
",",
"pymtime",
"=",
"self",
".",
"_reloader",
... | Cache the modification times of any modules imported in this execution | [
"Cache",
"the",
"modification",
"times",
"of",
"any",
"modules",
"imported",
"in",
"this",
"execution"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/autoreload.py#L537-L546 |
codelv/enaml-native | src/enamlnative/android/android_edit_text.py | AndroidEditText.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = EditText(self.get_context(), None,
d.style or "@attr/editTextStyle") | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = EditText(self.get_context(), None,
d.style or "@attr/editTextStyle") | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"EditText",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
"or",
"\"@attr/editTextStyle\"",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_edit_text.py#L38-L44 |
codelv/enaml-native | src/enamlnative/android/android_button.py | AndroidButton.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
style = d.style if d.style else (
'@attr/borderlessButtonStyle' if d.flat else '@attr/buttonStyle')
self.widget = Button(self.get_context(), None, style) | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
style = d.style if d.style else (
'@attr/borderlessButtonStyle' if d.flat else '@attr/buttonStyle')
self.widget = Button(self.get_context(), None, style) | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"style",
"=",
"d",
".",
"style",
"if",
"d",
".",
"style",
"else",
"(",
"'@attr/borderlessButtonStyle'",
"if",
"d",
".",
"flat",
"else",
"'@attr/buttonStyle'",
")",
"self",... | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_button.py#L73-L80 |
codelv/enaml-native | src/enamlnative/android/android_button.py | AndroidFloatingActionButton.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = FloatingActionButton(self.get_context(), None, d.style) | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = FloatingActionButton(self.get_context(), None, d.style) | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"FloatingActionButton",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_button.py#L131-L136 |
codelv/enaml-native | src/enamlnative/android/android_picker.py | AndroidPicker.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = Picker(self.get_context(), None,
d.style or '@attr/numberPickerStyle') | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = Picker(self.get_context(), None,
d.style or '@attr/numberPickerStyle') | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"Picker",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
"or",
"'@attr/numberPickerStyle'",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_picker.py#L45-L51 |
codelv/enaml-native | src/enamlnative/android/android_picker.py | AndroidPicker.init_widget | def init_widget(self):
""" Set the checked state after all children have
been populated.
"""
super(AndroidPicker, self).init_widget()
d = self.declaration
w = self.widget
if d.items:
self.set_items(d.items)
else:
if d.max_v... | python | def init_widget(self):
""" Set the checked state after all children have
been populated.
"""
super(AndroidPicker, self).init_widget()
d = self.declaration
w = self.widget
if d.items:
self.set_items(d.items)
else:
if d.max_v... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidPicker",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"w",
"=",
"self",
".",
"widget",
"if",
"d",
".",
"items",
":",
"self",
".",
"set_items",... | Set the checked state after all children have
been populated. | [
"Set",
"the",
"checked",
"state",
"after",
"all",
"children",
"have",
"been",
"populated",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_picker.py#L53-L76 |
codelv/enaml-native | src/enamlnative/android/android_picker.py | AndroidPicker.on_value_change | def on_value_change(self, picker, old, new):
""" Set the checked property based on the checked state
of all the children
"""
d = self.declaration
with self.widget.setValue.suppressed():
d.value = new | python | def on_value_change(self, picker, old, new):
""" Set the checked property based on the checked state
of all the children
"""
d = self.declaration
with self.widget.setValue.suppressed():
d.value = new | [
"def",
"on_value_change",
"(",
"self",
",",
"picker",
",",
"old",
",",
"new",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"with",
"self",
".",
"widget",
".",
"setValue",
".",
"suppressed",
"(",
")",
":",
"d",
".",
"value",
"=",
"new"
] | Set the checked property based on the checked state
of all the children | [
"Set",
"the",
"checked",
"property",
"based",
"on",
"the",
"checked",
"state",
"of",
"all",
"the",
"children"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_picker.py#L81-L88 |
codelv/enaml-native | src/enamlnative/android/android_spinner.py | AndroidSpinner.create_widget | def create_widget(self):
""" Create the underlying label widget.
"""
d = self.declaration
mode = 1 if d.mode == 'dropdown' else 0
self.widget = Spinner(self.get_context(), mode)
# Create the adapter simple_spinner_item = 0x01090008
self.adapter = ArrayAdapter(se... | python | def create_widget(self):
""" Create the underlying label widget.
"""
d = self.declaration
mode = 1 if d.mode == 'dropdown' else 0
self.widget = Spinner(self.get_context(), mode)
# Create the adapter simple_spinner_item = 0x01090008
self.adapter = ArrayAdapter(se... | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"mode",
"=",
"1",
"if",
"d",
".",
"mode",
"==",
"'dropdown'",
"else",
"0",
"self",
".",
"widget",
"=",
"Spinner",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"... | Create the underlying label widget. | [
"Create",
"the",
"underlying",
"label",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_spinner.py#L53-L63 |
codelv/enaml-native | src/enamlnative/android/android_spinner.py | AndroidSpinner.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
w = self.widget
# Selection listener
w.setAdapter(self.adapter)
w.setOnItemSelectedListener(w.getId())
w.onItemSelected.connect(self.on_item_selected)
w.onNothingSelected.connect(self.on_not... | python | def init_widget(self):
""" Initialize the underlying widget.
"""
w = self.widget
# Selection listener
w.setAdapter(self.adapter)
w.setOnItemSelectedListener(w.getId())
w.onItemSelected.connect(self.on_item_selected)
w.onNothingSelected.connect(self.on_not... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"w",
"=",
"self",
".",
"widget",
"# Selection listener",
"w",
".",
"setAdapter",
"(",
"self",
".",
"adapter",
")",
"w",
".",
"setOnItemSelectedListener",
"(",
"w",
".",
"getId",
"(",
")",
")",
"w",
".",
"onI... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_spinner.py#L65-L75 |
codelv/enaml-native | src/enamlnative/android/android_spinner.py | AndroidSpinner.set_items | def set_items(self, items):
""" Generate the view cache
"""
self.adapter.clear()
self.adapter.addAll(items) | python | def set_items(self, items):
""" Generate the view cache
"""
self.adapter.clear()
self.adapter.addAll(items) | [
"def",
"set_items",
"(",
"self",
",",
"items",
")",
":",
"self",
".",
"adapter",
".",
"clear",
"(",
")",
"self",
".",
"adapter",
".",
"addAll",
"(",
"items",
")"
] | Generate the view cache | [
"Generate",
"the",
"view",
"cache"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_spinner.py#L115-L120 |
codelv/enaml-native | src/enamlnative/ios/app.py | ENBridge._default_objc | def _default_objc(self):
""" Load the objc library using ctypes. """
objc = ctypes.cdll.LoadLibrary(find_library('objc'))
objc.objc_getClass.restype = ctypes.c_void_p
objc.sel_registerName.restype = ctypes.c_void_p
objc.objc_msgSend.restype = ctypes.c_void_p
objc.objc_msg... | python | def _default_objc(self):
""" Load the objc library using ctypes. """
objc = ctypes.cdll.LoadLibrary(find_library('objc'))
objc.objc_getClass.restype = ctypes.c_void_p
objc.sel_registerName.restype = ctypes.c_void_p
objc.objc_msgSend.restype = ctypes.c_void_p
objc.objc_msg... | [
"def",
"_default_objc",
"(",
"self",
")",
":",
"objc",
"=",
"ctypes",
".",
"cdll",
".",
"LoadLibrary",
"(",
"find_library",
"(",
"'objc'",
")",
")",
"objc",
".",
"objc_getClass",
".",
"restype",
"=",
"ctypes",
".",
"c_void_p",
"objc",
".",
"sel_registerNam... | Load the objc library using ctypes. | [
"Load",
"the",
"objc",
"library",
"using",
"ctypes",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/app.py#L34-L41 |
codelv/enaml-native | src/enamlnative/ios/app.py | ENBridge._default_bridge | def _default_bridge(self):
""" Get an instance of the ENBridge object using ctypes. """
objc = self.objc
ENBridge = objc.objc_getClass('ENBridge')
return objc.objc_msgSend(ENBridge, objc.sel_registerName('instance')) | python | def _default_bridge(self):
""" Get an instance of the ENBridge object using ctypes. """
objc = self.objc
ENBridge = objc.objc_getClass('ENBridge')
return objc.objc_msgSend(ENBridge, objc.sel_registerName('instance')) | [
"def",
"_default_bridge",
"(",
"self",
")",
":",
"objc",
"=",
"self",
".",
"objc",
"ENBridge",
"=",
"objc",
".",
"objc_getClass",
"(",
"'ENBridge'",
")",
"return",
"objc",
".",
"objc_msgSend",
"(",
"ENBridge",
",",
"objc",
".",
"sel_registerName",
"(",
"'i... | Get an instance of the ENBridge object using ctypes. | [
"Get",
"an",
"instance",
"of",
"the",
"ENBridge",
"object",
"using",
"ctypes",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/app.py#L43-L47 |
codelv/enaml-native | src/enamlnative/ios/app.py | ENBridge.processEvents | def processEvents(self, data):
""" Sends msgpack data to the ENBridge instance
by calling the processEvents method via ctypes. """
objc = self.objc
bridge = self.bridge
#: This must come after the above as it changes the arguments!
objc.objc_msgSend.argtypes = [ctypes... | python | def processEvents(self, data):
""" Sends msgpack data to the ENBridge instance
by calling the processEvents method via ctypes. """
objc = self.objc
bridge = self.bridge
#: This must come after the above as it changes the arguments!
objc.objc_msgSend.argtypes = [ctypes... | [
"def",
"processEvents",
"(",
"self",
",",
"data",
")",
":",
"objc",
"=",
"self",
".",
"objc",
"bridge",
"=",
"self",
".",
"bridge",
"#: This must come after the above as it changes the arguments!",
"objc",
".",
"objc_msgSend",
".",
"argtypes",
"=",
"[",
"ctypes",
... | Sends msgpack data to the ENBridge instance
by calling the processEvents method via ctypes. | [
"Sends",
"msgpack",
"data",
"to",
"the",
"ENBridge",
"instance",
"by",
"calling",
"the",
"processEvents",
"method",
"via",
"ctypes",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/app.py#L49-L59 |
codelv/enaml-native | src/enamlnative/widgets/action_menu_view.py | ActionMenuView._update_proxy | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] == 'event' and self.proxy_is_active:
self.proxy.set_opened(change['name'] == 'show')
else:
super(ActionMenuView, self)._update_proxy(change) | python | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] == 'event' and self.proxy_is_active:
self.proxy.set_opened(change['name'] == 'show')
else:
super(ActionMenuView, self)._update_proxy(change) | [
"def",
"_update_proxy",
"(",
"self",
",",
"change",
")",
":",
"if",
"change",
"[",
"'type'",
"]",
"==",
"'event'",
"and",
"self",
".",
"proxy_is_active",
":",
"self",
".",
"proxy",
".",
"set_opened",
"(",
"change",
"[",
"'name'",
"]",
"==",
"'show'",
"... | An observer which sends the state change to the proxy. | [
"An",
"observer",
"which",
"sends",
"the",
"state",
"change",
"to",
"the",
"proxy",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/widgets/action_menu_view.py#L58-L65 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.current | def current(instance=True):
"""Returns the current thread's `IOLoop`.
If an `IOLoop` is currently running or has been marked as
current by `make_current`, returns that instance. If there is
no current `IOLoop` and ``instance`` is true, creates one.
.. versionchanged:: 4.1
... | python | def current(instance=True):
"""Returns the current thread's `IOLoop`.
If an `IOLoop` is currently running or has been marked as
current by `make_current`, returns that instance. If there is
no current `IOLoop` and ``instance`` is true, creates one.
.. versionchanged:: 4.1
... | [
"def",
"current",
"(",
"instance",
"=",
"True",
")",
":",
"current",
"=",
"getattr",
"(",
"IOLoop",
".",
"_current",
",",
"\"instance\"",
",",
"None",
")",
"if",
"current",
"is",
"None",
"and",
"instance",
":",
"current",
"=",
"None",
"#if asyncio is not N... | Returns the current thread's `IOLoop`.
If an `IOLoop` is currently running or has been marked as
current by `make_current`, returns that instance. If there is
no current `IOLoop` and ``instance`` is true, creates one.
.. versionchanged:: 4.1
Added ``instance`` argument to c... | [
"Returns",
"the",
"current",
"thread",
"s",
"IOLoop",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L228-L262 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.log_stack | def log_stack(self, signal, frame):
"""Signal handler to log the stack trace of the current thread.
For use with `set_blocking_signal_threshold`.
"""
gen_log.warning('IOLoop blocked for %f seconds in\n%s',
self._blocking_signal_threshold,
... | python | def log_stack(self, signal, frame):
"""Signal handler to log the stack trace of the current thread.
For use with `set_blocking_signal_threshold`.
"""
gen_log.warning('IOLoop blocked for %f seconds in\n%s',
self._blocking_signal_threshold,
... | [
"def",
"log_stack",
"(",
"self",
",",
"signal",
",",
"frame",
")",
":",
"gen_log",
".",
"warning",
"(",
"'IOLoop blocked for %f seconds in\\n%s'",
",",
"self",
".",
"_blocking_signal_threshold",
",",
"''",
".",
"join",
"(",
"traceback",
".",
"format_stack",
"(",... | Signal handler to log the stack trace of the current thread.
For use with `set_blocking_signal_threshold`. | [
"Signal",
"handler",
"to",
"log",
"the",
"stack",
"trace",
"of",
"the",
"current",
"thread",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L394-L401 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.run_sync | def run_sync(self, func, timeout=None):
"""Starts the `IOLoop`, runs the given function, and stops the loop.
The function must return either a yieldable object or
``None``. If the function returns a yieldable object, the
`IOLoop` will run until the yieldable is resolved (and
`ru... | python | def run_sync(self, func, timeout=None):
"""Starts the `IOLoop`, runs the given function, and stops the loop.
The function must return either a yieldable object or
``None``. If the function returns a yieldable object, the
`IOLoop` will run until the yieldable is resolved (and
`ru... | [
"def",
"run_sync",
"(",
"self",
",",
"func",
",",
"timeout",
"=",
"None",
")",
":",
"future_cell",
"=",
"[",
"None",
"]",
"def",
"run",
"(",
")",
":",
"try",
":",
"result",
"=",
"func",
"(",
")",
"if",
"result",
"is",
"not",
"None",
":",
"from",
... | Starts the `IOLoop`, runs the given function, and stops the loop.
The function must return either a yieldable object or
``None``. If the function returns a yieldable object, the
`IOLoop` will run until the yieldable is resolved (and
`run_sync()` will return the yieldable's result). If i... | [
"Starts",
"the",
"IOLoop",
"runs",
"the",
"given",
"function",
"and",
"stops",
"the",
"loop",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L452-L505 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.add_timeout | def add_timeout(self, deadline, callback, *args, **kwargs):
"""Runs the ``callback`` at the time ``deadline`` from the I/O loop.
Returns an opaque handle that may be passed to
`remove_timeout` to cancel.
``deadline`` may be a number denoting a time (on the same
scale as `IOLoop... | python | def add_timeout(self, deadline, callback, *args, **kwargs):
"""Runs the ``callback`` at the time ``deadline`` from the I/O loop.
Returns an opaque handle that may be passed to
`remove_timeout` to cancel.
``deadline`` may be a number denoting a time (on the same
scale as `IOLoop... | [
"def",
"add_timeout",
"(",
"self",
",",
"deadline",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"deadline",
",",
"numbers",
".",
"Real",
")",
":",
"return",
"self",
".",
"call_at",
"(",
"deadline",
"... | Runs the ``callback`` at the time ``deadline`` from the I/O loop.
Returns an opaque handle that may be passed to
`remove_timeout` to cancel.
``deadline`` may be a number denoting a time (on the same
scale as `IOLoop.time`, normally `time.time`), or a
`datetime.timedelta` object... | [
"Runs",
"the",
"callback",
"at",
"the",
"time",
"deadline",
"from",
"the",
"I",
"/",
"O",
"loop",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L522-L554 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.call_later | def call_later(self, delay, callback, *args, **kwargs):
"""Runs the ``callback`` after ``delay`` seconds have passed.
Returns an opaque handle that may be passed to `remove_timeout`
to cancel. Note that unlike the `asyncio` method of the same
name, the returned object does not have a `... | python | def call_later(self, delay, callback, *args, **kwargs):
"""Runs the ``callback`` after ``delay`` seconds have passed.
Returns an opaque handle that may be passed to `remove_timeout`
to cancel. Note that unlike the `asyncio` method of the same
name, the returned object does not have a `... | [
"def",
"call_later",
"(",
"self",
",",
"delay",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"call_at",
"(",
"self",
".",
"time",
"(",
")",
"+",
"delay",
",",
"callback",
",",
"*",
"args",
",",
"*",... | Runs the ``callback`` after ``delay`` seconds have passed.
Returns an opaque handle that may be passed to `remove_timeout`
to cancel. Note that unlike the `asyncio` method of the same
name, the returned object does not have a ``cancel()`` method.
See `add_timeout` for comments on thre... | [
"Runs",
"the",
"callback",
"after",
"delay",
"seconds",
"have",
"passed",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L556-L567 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.call_at | def call_at(self, when, callback, *args, **kwargs):
"""Runs the ``callback`` at the absolute time designated by ``when``.
``when`` must be a number using the same reference point as
`IOLoop.time`.
Returns an opaque handle that may be passed to `remove_timeout`
to cancel. Note ... | python | def call_at(self, when, callback, *args, **kwargs):
"""Runs the ``callback`` at the absolute time designated by ``when``.
``when`` must be a number using the same reference point as
`IOLoop.time`.
Returns an opaque handle that may be passed to `remove_timeout`
to cancel. Note ... | [
"def",
"call_at",
"(",
"self",
",",
"when",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"add_timeout",
"(",
"when",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Runs the ``callback`` at the absolute time designated by ``when``.
``when`` must be a number using the same reference point as
`IOLoop.time`.
Returns an opaque handle that may be passed to `remove_timeout`
to cancel. Note that unlike the `asyncio` method of the same
name, the ... | [
"Runs",
"the",
"callback",
"at",
"the",
"absolute",
"time",
"designated",
"by",
"when",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L569-L583 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.spawn_callback | def spawn_callback(self, callback, *args, **kwargs):
"""Calls the given callback on the next IOLoop iteration.
Unlike all other callback-related methods on IOLoop,
``spawn_callback`` does not associate the callback with its caller's
``stack_context``, so it is suitable for fire-and-forg... | python | def spawn_callback(self, callback, *args, **kwargs):
"""Calls the given callback on the next IOLoop iteration.
Unlike all other callback-related methods on IOLoop,
``spawn_callback`` does not associate the callback with its caller's
``stack_context``, so it is suitable for fire-and-forg... | [
"def",
"spawn_callback",
"(",
"self",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"stack_context",
".",
"NullContext",
"(",
")",
":",
"self",
".",
"add_callback",
"(",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kw... | Calls the given callback on the next IOLoop iteration.
Unlike all other callback-related methods on IOLoop,
``spawn_callback`` does not associate the callback with its caller's
``stack_context``, so it is suitable for fire-and-forget callbacks
that should not interfere with the caller.
... | [
"Calls",
"the",
"given",
"callback",
"on",
"the",
"next",
"IOLoop",
"iteration",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L621-L632 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.add_future | def add_future(self, future, callback):
"""Schedules a callback on the ``IOLoop`` when the given
`.Future` is finished.
The callback is invoked with one argument, the
`.Future`.
"""
assert is_future(future)
callback = stack_context.wrap(callback)
future.a... | python | def add_future(self, future, callback):
"""Schedules a callback on the ``IOLoop`` when the given
`.Future` is finished.
The callback is invoked with one argument, the
`.Future`.
"""
assert is_future(future)
callback = stack_context.wrap(callback)
future.a... | [
"def",
"add_future",
"(",
"self",
",",
"future",
",",
"callback",
")",
":",
"assert",
"is_future",
"(",
"future",
")",
"callback",
"=",
"stack_context",
".",
"wrap",
"(",
"callback",
")",
"future",
".",
"add_done_callback",
"(",
"lambda",
"future",
":",
"s... | Schedules a callback on the ``IOLoop`` when the given
`.Future` is finished.
The callback is invoked with one argument, the
`.Future`. | [
"Schedules",
"a",
"callback",
"on",
"the",
"IOLoop",
"when",
"the",
"given",
".",
"Future",
"is",
"finished",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L634-L644 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop._run_callback | def _run_callback(self, callback):
"""Runs a callback with error handling.
For use in subclasses.
"""
try:
ret = callback()
if ret is not None:
from . import gen
# Functions that return Futures typically swallow all
... | python | def _run_callback(self, callback):
"""Runs a callback with error handling.
For use in subclasses.
"""
try:
ret = callback()
if ret is not None:
from . import gen
# Functions that return Futures typically swallow all
... | [
"def",
"_run_callback",
"(",
"self",
",",
"callback",
")",
":",
"try",
":",
"ret",
"=",
"callback",
"(",
")",
"if",
"ret",
"is",
"not",
"None",
":",
"from",
".",
"import",
"gen",
"# Functions that return Futures typically swallow all",
"# exceptions and store them... | Runs a callback with error handling.
For use in subclasses. | [
"Runs",
"a",
"callback",
"with",
"error",
"handling",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L646-L669 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.handle_callback_exception | def handle_callback_exception(self, callback):
"""This method is called whenever a callback run by the `IOLoop`
throws an exception.
By default simply logs the exception as an error. Subclasses
may override this method to customize reporting of exceptions.
The exception itself... | python | def handle_callback_exception(self, callback):
"""This method is called whenever a callback run by the `IOLoop`
throws an exception.
By default simply logs the exception as an error. Subclasses
may override this method to customize reporting of exceptions.
The exception itself... | [
"def",
"handle_callback_exception",
"(",
"self",
",",
"callback",
")",
":",
"if",
"self",
".",
"_error_handler",
":",
"self",
".",
"_error_handler",
"(",
"callback",
")",
"else",
":",
"app_log",
".",
"error",
"(",
"\"Exception in callback %r\"",
",",
"callback",... | This method is called whenever a callback run by the `IOLoop`
throws an exception.
By default simply logs the exception as an error. Subclasses
may override this method to customize reporting of exceptions.
The exception itself is not passed explicitly, but is available
in `sy... | [
"This",
"method",
"is",
"called",
"whenever",
"a",
"callback",
"run",
"by",
"the",
"IOLoop",
"throws",
"an",
"exception",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L679-L692 |
codelv/enaml-native | src/enamlnative/core/eventloop/ioloop.py | IOLoop.close_fd | def close_fd(self, fd):
"""Utility method to close an ``fd``.
If ``fd`` is a file-like object, we close it directly; otherwise
we use `os.close`.
This method is provided for use by `IOLoop` subclasses (in
implementations of ``IOLoop.close(all_fds=True)`` and should
not ... | python | def close_fd(self, fd):
"""Utility method to close an ``fd``.
If ``fd`` is a file-like object, we close it directly; otherwise
we use `os.close`.
This method is provided for use by `IOLoop` subclasses (in
implementations of ``IOLoop.close(all_fds=True)`` and should
not ... | [
"def",
"close_fd",
"(",
"self",
",",
"fd",
")",
":",
"try",
":",
"try",
":",
"fd",
".",
"close",
"(",
")",
"except",
"AttributeError",
":",
"os",
".",
"close",
"(",
"fd",
")",
"except",
"OSError",
":",
"pass"
] | Utility method to close an ``fd``.
If ``fd`` is a file-like object, we close it directly; otherwise
we use `os.close`.
This method is provided for use by `IOLoop` subclasses (in
implementations of ``IOLoop.close(all_fds=True)`` and should
not generally be used by application co... | [
"Utility",
"method",
"to",
"close",
"an",
"fd",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/ioloop.py#L715-L733 |
codelv/enaml-native | src/enamlnative/ios/uikit_control.py | UiKitControl.init_widget | def init_widget(self):
""" Initialize the state of the toolkit widget.
This method is called during the top-down pass, just after the
'create_widget()' method is called. This method should init the
state of the widget. The child widgets will not yet be created.
Note: This does ... | python | def init_widget(self):
""" Initialize the state of the toolkit widget.
This method is called during the top-down pass, just after the
'create_widget()' method is called. This method should init the
state of the widget. The child widgets will not yet be created.
Note: This does ... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"UiKitControl",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"if",
"d",
".",
"clickable",
":",
"#: A really ugly way to add the target",
"#: would be nice if we c... | Initialize the state of the toolkit widget.
This method is called during the top-down pass, just after the
'create_widget()' method is called. This method should init the
state of the widget. The child widgets will not yet be created.
Note: This does NOT initialize text properties by d... | [
"Initialize",
"the",
"state",
"of",
"the",
"toolkit",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/uikit_control.py#L87-L111 |
codelv/enaml-native | src/enamlnative/android/android_snackbar.py | AndroidSnackbar.create_widget | def create_widget(self):
""" Create the underlying widget.
A toast is not a subclass of view, hence we don't set name as widget
or children will try to use it as their parent (which crashes).
"""
d = self.declaration
Snackbar.make(self.parent_widget(), d.text,
... | python | def create_widget(self):
""" Create the underlying widget.
A toast is not a subclass of view, hence we don't set name as widget
or children will try to use it as their parent (which crashes).
"""
d = self.declaration
Snackbar.make(self.parent_widget(), d.text,
... | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"Snackbar",
".",
"make",
"(",
"self",
".",
"parent_widget",
"(",
")",
",",
"d",
".",
"text",
",",
"0",
"if",
"d",
".",
"duration",
"else",
"-",
"2",
")",
".",
"t... | Create the underlying widget.
A toast is not a subclass of view, hence we don't set name as widget
or children will try to use it as their parent (which crashes). | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_snackbar.py#L75-L84 |
codelv/enaml-native | src/enamlnative/android/android_snackbar.py | AndroidSnackbar.init_widget | def init_widget(self):
""" Our widget may not exist yet so we have to diverge from the normal
way of doing initialization. See `update_widget`
"""
if not self.widget:
return
super(AndroidSnackbar, self).init_widget()
d = self.declaration
#:... | python | def init_widget(self):
""" Our widget may not exist yet so we have to diverge from the normal
way of doing initialization. See `update_widget`
"""
if not self.widget:
return
super(AndroidSnackbar, self).init_widget()
d = self.declaration
#:... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"widget",
":",
"return",
"super",
"(",
"AndroidSnackbar",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"#: Bind events",
"self",
".",
"widget"... | Our widget may not exist yet so we have to diverge from the normal
way of doing initialization. See `update_widget` | [
"Our",
"widget",
"may",
"not",
"exist",
"yet",
"so",
"we",
"have",
"to",
"diverge",
"from",
"the",
"normal",
"way",
"of",
"doing",
"initialization",
".",
"See",
"update_widget"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_snackbar.py#L86-L115 |
codelv/enaml-native | src/enamlnative/android/android_snackbar.py | AndroidSnackbar.on_widget_created | def on_widget_created(self, ref):
""" Using Snackbar.make returns async so we have to
initialize it later.
"""
d = self.declaration
self.widget = Snackbar(__id__=ref)
self.init_widget() | python | def on_widget_created(self, ref):
""" Using Snackbar.make returns async so we have to
initialize it later.
"""
d = self.declaration
self.widget = Snackbar(__id__=ref)
self.init_widget() | [
"def",
"on_widget_created",
"(",
"self",
",",
"ref",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"Snackbar",
"(",
"__id__",
"=",
"ref",
")",
"self",
".",
"init_widget",
"(",
")"
] | Using Snackbar.make returns async so we have to
initialize it later. | [
"Using",
"Snackbar",
".",
"make",
"returns",
"async",
"so",
"we",
"have",
"to",
"initialize",
"it",
"later",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_snackbar.py#L117-L124 |
codelv/enaml-native | src/enamlnative/android/android_snackbar.py | AndroidSnackbar.set_duration | def set_duration(self, duration):
""" Android for whatever stupid reason doesn't let you set the time
it only allows 1-long or 0-short. So we have to repeatedly call show
until the duration expires, hence this method does nothing see
`set_show`.
"""
if duration ... | python | def set_duration(self, duration):
""" Android for whatever stupid reason doesn't let you set the time
it only allows 1-long or 0-short. So we have to repeatedly call show
until the duration expires, hence this method does nothing see
`set_show`.
"""
if duration ... | [
"def",
"set_duration",
"(",
"self",
",",
"duration",
")",
":",
"if",
"duration",
"==",
"0",
":",
"self",
".",
"widget",
".",
"setDuration",
"(",
"-",
"2",
")",
"#: Infinite",
"else",
":",
"self",
".",
"widget",
".",
"setDuration",
"(",
"0",
")"
] | Android for whatever stupid reason doesn't let you set the time
it only allows 1-long or 0-short. So we have to repeatedly call show
until the duration expires, hence this method does nothing see
`set_show`. | [
"Android",
"for",
"whatever",
"stupid",
"reason",
"doesn",
"t",
"let",
"you",
"set",
"the",
"time",
"it",
"only",
"allows",
"1",
"-",
"long",
"or",
"0",
"-",
"short",
".",
"So",
"we",
"have",
"to",
"repeatedly",
"call",
"show",
"until",
"the",
"duratio... | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_snackbar.py#L181-L191 |
codelv/enaml-native | src/enamlnative/android/android_seek_bar.py | AndroidSeekBar.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = SeekBar(self.get_context(), None,
d.style or '@attr/seekBarStyle') | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = SeekBar(self.get_context(), None,
d.style or '@attr/seekBarStyle') | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"SeekBar",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
"or",
"'@attr/seekBarStyle'",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_seek_bar.py#L50-L56 |
codelv/enaml-native | src/enamlnative/android/android_seek_bar.py | AndroidSeekBar.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidSeekBar, self).init_widget()
w = self.widget
#: Setup listener
w.setOnSeekBarChangeListener(w.getId())
w.onProgressChanged.connect(self.on_progress_changed) | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidSeekBar, self).init_widget()
w = self.widget
#: Setup listener
w.setOnSeekBarChangeListener(w.getId())
w.onProgressChanged.connect(self.on_progress_changed) | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidSeekBar",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"w",
"=",
"self",
".",
"widget",
"#: Setup listener",
"w",
".",
"setOnSeekBarChangeListener",
"(",
"w",
".",
"getId",
"(",
")",
"... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_seek_bar.py#L58-L67 |
codelv/enaml-native | src/enamlnative/android/android_text_view.py | AndroidTextView.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = TextView(self.get_context(), None,
d.style or '@attr/textViewStyle') | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = TextView(self.get_context(), None,
d.style or '@attr/textViewStyle') | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"TextView",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
"or",
"'@attr/textViewStyle'",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_text_view.py#L136-L142 |
codelv/enaml-native | src/enamlnative/android/android_text_view.py | AndroidTextView.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidTextView, self).init_widget()
d = self.declaration
w = self.widget
if d.input_type:
self.set_input_type(d.input_type)
w.addTextChangedListener(w.getId())
w.o... | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidTextView, self).init_widget()
d = self.declaration
w = self.widget
if d.input_type:
self.set_input_type(d.input_type)
w.addTextChangedListener(w.getId())
w.o... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidTextView",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"w",
"=",
"self",
".",
"widget",
"if",
"d",
".",
"input_type",
":",
"self",
".",
"set_... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_text_view.py#L144-L154 |
codelv/enaml-native | src/enamlnative/android/android_text_view.py | AndroidTextView.set_text | def set_text(self, text):
""" Set the text in the widget.
"""
d = self.declaration
if d.input_type == 'html':
text = Spanned(__id__=Html.fromHtml(text))
self.widget.setTextKeepState(text) | python | def set_text(self, text):
""" Set the text in the widget.
"""
d = self.declaration
if d.input_type == 'html':
text = Spanned(__id__=Html.fromHtml(text))
self.widget.setTextKeepState(text) | [
"def",
"set_text",
"(",
"self",
",",
"text",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"if",
"d",
".",
"input_type",
"==",
"'html'",
":",
"text",
"=",
"Spanned",
"(",
"__id__",
"=",
"Html",
".",
"fromHtml",
"(",
"text",
")",
")",
"self",
".",... | Set the text in the widget. | [
"Set",
"the",
"text",
"in",
"the",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_text_view.py#L209-L216 |
codelv/enaml-native | src/enamlnative/android/android_bottom_sheet_dialog.py | AndroidBottomSheetDialog.create_widget | def create_widget(self):
""" Create the underlying widget.
A dialog is not a subclass of view, hence we don't set name as widget
or children will try to use it as their parent.
"""
d = self.declaration
self.dialog = BottomSheetDialog(self.get_context(), d.style) | python | def create_widget(self):
""" Create the underlying widget.
A dialog is not a subclass of view, hence we don't set name as widget
or children will try to use it as their parent.
"""
d = self.declaration
self.dialog = BottomSheetDialog(self.get_context(), d.style) | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"dialog",
"=",
"BottomSheetDialog",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"d",
".",
"style",
")"
] | Create the underlying widget.
A dialog is not a subclass of view, hence we don't set name as widget
or children will try to use it as their parent. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_bottom_sheet_dialog.py#L34-L42 |
codelv/enaml-native | src/enamlnative/core/bridge.py | encode | def encode(obj):
""" Encode an object for proper decoding by Java or ObjC
"""
if hasattr(obj, '__id__'):
return msgpack.ExtType(ExtType.REF, msgpack.packb(obj.__id__))
return obj | python | def encode(obj):
""" Encode an object for proper decoding by Java or ObjC
"""
if hasattr(obj, '__id__'):
return msgpack.ExtType(ExtType.REF, msgpack.packb(obj.__id__))
return obj | [
"def",
"encode",
"(",
"obj",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'__id__'",
")",
":",
"return",
"msgpack",
".",
"ExtType",
"(",
"ExtType",
".",
"REF",
",",
"msgpack",
".",
"packb",
"(",
"obj",
".",
"__id__",
")",
")",
"return",
"obj"
] | Encode an object for proper decoding by Java or ObjC | [
"Encode",
"an",
"object",
"for",
"proper",
"decoding",
"by",
"Java",
"or",
"ObjC"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/bridge.py#L84-L89 |
codelv/enaml-native | src/enamlnative/core/bridge.py | get_handler | def get_handler(ptr, method):
""" Dereference the pointer and return the handler method. """
obj = CACHE.get(ptr, None)
if obj is None:
raise BridgeReferenceError(
"Reference id={} never existed or has already been destroyed"
.format(ptr))
elif not hasattr(obj, method):
... | python | def get_handler(ptr, method):
""" Dereference the pointer and return the handler method. """
obj = CACHE.get(ptr, None)
if obj is None:
raise BridgeReferenceError(
"Reference id={} never existed or has already been destroyed"
.format(ptr))
elif not hasattr(obj, method):
... | [
"def",
"get_handler",
"(",
"ptr",
",",
"method",
")",
":",
"obj",
"=",
"CACHE",
".",
"get",
"(",
"ptr",
",",
"None",
")",
"if",
"obj",
"is",
"None",
":",
"raise",
"BridgeReferenceError",
"(",
"\"Reference id={} never existed or has already been destroyed\"",
"."... | Dereference the pointer and return the handler method. | [
"Dereference",
"the",
"pointer",
"and",
"return",
"the",
"handler",
"method",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/bridge.py#L119-L129 |
codelv/enaml-native | src/enamlnative/core/bridge.py | BridgeMethod.suppressed | def suppressed(self, obj):
""" Suppress calls within this context to avoid feedback loops"""
obj.__suppressed__[self.name] = True
yield
obj.__suppressed__[self.name] = False | python | def suppressed(self, obj):
""" Suppress calls within this context to avoid feedback loops"""
obj.__suppressed__[self.name] = True
yield
obj.__suppressed__[self.name] = False | [
"def",
"suppressed",
"(",
"self",
",",
"obj",
")",
":",
"obj",
".",
"__suppressed__",
"[",
"self",
".",
"name",
"]",
"=",
"True",
"yield",
"obj",
".",
"__suppressed__",
"[",
"self",
".",
"name",
"]",
"=",
"False"
] | Suppress calls within this context to avoid feedback loops | [
"Suppress",
"calls",
"within",
"this",
"context",
"to",
"avoid",
"feedback",
"loops"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/bridge.py#L159-L163 |
codelv/enaml-native | src/enamlnative/ios/uikit_activity_indicator.py | UiKitActivityIndicator.init_widget | def init_widget(self):
""" Initialize the state of the toolkit widget.
This method is called during the top-down pass, just after the
'create_widget()' method is called. This method should init the
state of the widget. The child widgets will not yet be created.
"""
supe... | python | def init_widget(self):
""" Initialize the state of the toolkit widget.
This method is called during the top-down pass, just after the
'create_widget()' method is called. This method should init the
state of the widget. The child widgets will not yet be created.
"""
supe... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"UiKitActivityIndicator",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"if",
"d",
".",
"size",
"!=",
"'normal'",
":",
"self",
".",
"set_size",
"(",
"d",... | Initialize the state of the toolkit widget.
This method is called during the top-down pass, just after the
'create_widget()' method is called. This method should init the
state of the widget. The child widgets will not yet be created. | [
"Initialize",
"the",
"state",
"of",
"the",
"toolkit",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/uikit_activity_indicator.py#L44-L61 |
codelv/enaml-native | src/enamlnative/android/android_wifi.py | WifiManager.is_wifi_enabled | def is_wifi_enabled(cls):
""" Check if wifi is currently enabled.
Returns
--------
result: future
A future that resolves with the value.
"""
app = AndroidApplication.instance()
f = app.create_future()
def on_permission_result(r... | python | def is_wifi_enabled(cls):
""" Check if wifi is currently enabled.
Returns
--------
result: future
A future that resolves with the value.
"""
app = AndroidApplication.instance()
f = app.create_future()
def on_permission_result(r... | [
"def",
"is_wifi_enabled",
"(",
"cls",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"def",
"on_permission_result",
"(",
"result",
")",
":",
"if",
"not",
"result",
":",
"f",
".",
... | Check if wifi is currently enabled.
Returns
--------
result: future
A future that resolves with the value. | [
"Check",
"if",
"wifi",
"is",
"currently",
"enabled",
".",
"Returns",
"--------",
"result",
":",
"future",
"A",
"future",
"that",
"resolves",
"with",
"the",
"value",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_wifi.py#L99-L125 |
codelv/enaml-native | src/enamlnative/android/android_wifi.py | WifiManager.set_wifi_enabled | def set_wifi_enabled(cls, state=True):
""" Set the wifi enabled state.
Returns
--------
result: future
A future that resolves with whether the operation succeeded.
"""
app = AndroidApplication.instance()
f = app.create_future()
... | python | def set_wifi_enabled(cls, state=True):
""" Set the wifi enabled state.
Returns
--------
result: future
A future that resolves with whether the operation succeeded.
"""
app = AndroidApplication.instance()
f = app.create_future()
... | [
"def",
"set_wifi_enabled",
"(",
"cls",
",",
"state",
"=",
"True",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"def",
"on_permission_result",
"(",
"result",
")",
":",
"if",
"not",... | Set the wifi enabled state.
Returns
--------
result: future
A future that resolves with whether the operation succeeded. | [
"Set",
"the",
"wifi",
"enabled",
"state",
".",
"Returns",
"--------",
"result",
":",
"future",
"A",
"future",
"that",
"resolves",
"with",
"whether",
"the",
"operation",
"succeeded",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_wifi.py#L128-L155 |
codelv/enaml-native | src/enamlnative/android/android_wifi.py | WifiManager.get_networks | def get_networks(cls):
""" Get the wifi networks currently available.
Returns
--------
result: future
A future that resolves with the list of networks available
or None if wifi could not be enabled (permission denied,
etc...)
... | python | def get_networks(cls):
""" Get the wifi networks currently available.
Returns
--------
result: future
A future that resolves with the list of networks available
or None if wifi could not be enabled (permission denied,
etc...)
... | [
"def",
"get_networks",
"(",
"cls",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"activity",
"=",
"app",
".",
"widget",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"def",
"on_permission_result",
"(",
"result",
")",
":",
"if"... | Get the wifi networks currently available.
Returns
--------
result: future
A future that resolves with the list of networks available
or None if wifi could not be enabled (permission denied,
etc...) | [
"Get",
"the",
"wifi",
"networks",
"currently",
"available",
".",
"Returns",
"--------",
"result",
":",
"future",
"A",
"future",
"that",
"resolves",
"with",
"the",
"list",
"of",
"networks",
"available",
"or",
"None",
"if",
"wifi",
"could",
"not",
"be",
"enabl... | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_wifi.py#L158-L229 |
codelv/enaml-native | src/enamlnative/android/android_wifi.py | WifiManager.disconnect | def disconnect(cls):
""" Disconnect from the current network (if connected).
Returns
--------
result: future
A future that resolves to true if the disconnect was
successful. Will be set to None if the change network
pe... | python | def disconnect(cls):
""" Disconnect from the current network (if connected).
Returns
--------
result: future
A future that resolves to true if the disconnect was
successful. Will be set to None if the change network
pe... | [
"def",
"disconnect",
"(",
"cls",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"def",
"on_permission_result",
"(",
"result",
")",
":",
"if",
"not",
"result",
":",
"f",
".",
"set_... | Disconnect from the current network (if connected).
Returns
--------
result: future
A future that resolves to true if the disconnect was
successful. Will be set to None if the change network
permission is denied. | [
"Disconnect",
"from",
"the",
"current",
"network",
"(",
"if",
"connected",
")",
".",
"Returns",
"--------",
"result",
":",
"future",
"A",
"future",
"that",
"resolves",
"to",
"true",
"if",
"the",
"disconnect",
"was",
"successful",
".",
"Will",
"be",
"set",
... | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_wifi.py#L232-L262 |
codelv/enaml-native | src/enamlnative/android/android_wifi.py | WifiManager.connect | def connect(cls, ssid, key=None, **kwargs):
""" Connect to the given ssid using the key (if given).
Returns
--------
result: future
A future that resolves with the result of the connect
"""
app = AndroidApplication.instance()
f = app.... | python | def connect(cls, ssid, key=None, **kwargs):
""" Connect to the given ssid using the key (if given).
Returns
--------
result: future
A future that resolves with the result of the connect
"""
app = AndroidApplication.instance()
f = app.... | [
"def",
"connect",
"(",
"cls",
",",
"ssid",
",",
"key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"config",
"=",
"WifiConfiguration",
"... | Connect to the given ssid using the key (if given).
Returns
--------
result: future
A future that resolves with the result of the connect | [
"Connect",
"to",
"the",
"given",
"ssid",
"using",
"the",
"key",
"(",
"if",
"given",
")",
".",
"Returns",
"--------",
"result",
":",
"future",
"A",
"future",
"that",
"resolves",
"with",
"the",
"result",
"of",
"the",
"connect"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_wifi.py#L265-L332 |
codelv/enaml-native | src/enamlnative/android/android_wifi.py | WifiManager.get_connection_info | def get_connection_info(cls):
""" Get info about current wifi connection (if any). Returns
info such as the IP address, BSSID, link speed, signal, etc..
Returns
--------
result: future
A future that resolves with a dict of the connection info
... | python | def get_connection_info(cls):
""" Get info about current wifi connection (if any). Returns
info such as the IP address, BSSID, link speed, signal, etc..
Returns
--------
result: future
A future that resolves with a dict of the connection info
... | [
"def",
"get_connection_info",
"(",
"cls",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"def",
"on_permission_result",
"(",
"result",
")",
":",
"if",
"not",
"result",
":",
"f",
"."... | Get info about current wifi connection (if any). Returns
info such as the IP address, BSSID, link speed, signal, etc..
Returns
--------
result: future
A future that resolves with a dict of the connection info
or None if an error occurre... | [
"Get",
"info",
"about",
"current",
"wifi",
"connection",
"(",
"if",
"any",
")",
".",
"Returns",
"info",
"such",
"as",
"the",
"IP",
"address",
"BSSID",
"link",
"speed",
"signal",
"etc",
"..",
"Returns",
"--------",
"result",
":",
"future",
"A",
"future",
... | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_wifi.py#L335-L365 |
codelv/enaml-native | src/enamlnative/android/android_wifi.py | WifiManager.request_permission | def request_permission(cls, permissions):
""" Requests permission and returns an future result that returns a
boolean indicating if all the given permission were granted or denied.
"""
app = AndroidApplication.instance()
f = app.create_future()
def on_result(p... | python | def request_permission(cls, permissions):
""" Requests permission and returns an future result that returns a
boolean indicating if all the given permission were granted or denied.
"""
app = AndroidApplication.instance()
f = app.create_future()
def on_result(p... | [
"def",
"request_permission",
"(",
"cls",
",",
"permissions",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"f",
"=",
"app",
".",
"create_future",
"(",
")",
"def",
"on_result",
"(",
"perms",
")",
":",
"allowed",
"=",
"True",
"for"... | Requests permission and returns an future result that returns a
boolean indicating if all the given permission were granted or denied. | [
"Requests",
"permission",
"and",
"returns",
"an",
"future",
"result",
"that",
"returns",
"a",
"boolean",
"indicating",
"if",
"all",
"the",
"given",
"permission",
"were",
"granted",
"or",
"denied",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_wifi.py#L401-L417 |
codelv/enaml-native | src/enamlnative/android/android_action_menu_view.py | AndroidActionMenuView.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidActionMenuView, self).init_widget()
d = self.declaration
w = self.widget
#: Kinda hackish, but when we get the menu back, load it
w.getMenu().then(self.on_menu)
w.setOnMenuItem... | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidActionMenuView, self).init_widget()
d = self.declaration
w = self.widget
#: Kinda hackish, but when we get the menu back, load it
w.getMenu().then(self.on_menu)
w.setOnMenuItem... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidActionMenuView",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"w",
"=",
"self",
".",
"widget",
"#: Kinda hackish, but when we get the menu back, load it",
... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_action_menu_view.py#L60-L71 |
codelv/enaml-native | src/enamlnative/widgets/swipe_refresh_layout.py | SwipeRefreshLayout._update_proxy | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] == 'event':
self.proxy.set_refreshed(True)
else:
super(SwipeRefreshLayout, self)._update_proxy(change) | python | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] == 'event':
self.proxy.set_refreshed(True)
else:
super(SwipeRefreshLayout, self)._update_proxy(change) | [
"def",
"_update_proxy",
"(",
"self",
",",
"change",
")",
":",
"if",
"change",
"[",
"'type'",
"]",
"==",
"'event'",
":",
"self",
".",
"proxy",
".",
"set_refreshed",
"(",
"True",
")",
"else",
":",
"super",
"(",
"SwipeRefreshLayout",
",",
"self",
")",
"."... | An observer which sends the state change to the proxy. | [
"An",
"observer",
"which",
"sends",
"the",
"state",
"change",
"to",
"the",
"proxy",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/widgets/swipe_refresh_layout.py#L69-L76 |
codelv/enaml-native | src/enamlnative/widgets/scroll_view.py | ScrollView._update_proxy | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] in ['event', 'update'] and self.proxy_is_active:
handler = getattr(self.proxy, 'set_' + change['name'], None)
if handler is not None:
handler... | python | def _update_proxy(self, change):
""" An observer which sends the state change to the proxy.
"""
if change['type'] in ['event', 'update'] and self.proxy_is_active:
handler = getattr(self.proxy, 'set_' + change['name'], None)
if handler is not None:
handler... | [
"def",
"_update_proxy",
"(",
"self",
",",
"change",
")",
":",
"if",
"change",
"[",
"'type'",
"]",
"in",
"[",
"'event'",
",",
"'update'",
"]",
"and",
"self",
".",
"proxy_is_active",
":",
"handler",
"=",
"getattr",
"(",
"self",
".",
"proxy",
",",
"'set_'... | An observer which sends the state change to the proxy. | [
"An",
"observer",
"which",
"sends",
"the",
"state",
"change",
"to",
"the",
"proxy",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/widgets/scroll_view.py#L65-L72 |
codelv/enaml-native | src/enamlnative/core/eventloop/concurrent.py | run_on_executor | def run_on_executor(*args, **kwargs):
"""Decorator to run a synchronous method asynchronously on an executor.
The decorated method may be called with a ``callback`` keyword
argument and returns a future.
The executor to be used is determined by the ``executor``
attributes of ``self``. To use a dif... | python | def run_on_executor(*args, **kwargs):
"""Decorator to run a synchronous method asynchronously on an executor.
The decorated method may be called with a ``callback`` keyword
argument and returns a future.
The executor to be used is determined by the ``executor``
attributes of ``self``. To use a dif... | [
"def",
"run_on_executor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"run_on_executor_decorator",
"(",
"fn",
")",
":",
"executor",
"=",
"kwargs",
".",
"get",
"(",
"\"executor\"",
",",
"\"executor\"",
")",
"@",
"functools",
".",
"wraps",
... | Decorator to run a synchronous method asynchronously on an executor.
The decorated method may be called with a ``callback`` keyword
argument and returns a future.
The executor to be used is determined by the ``executor``
attributes of ``self``. To use a different attribute name, pass a
keyword arg... | [
"Decorator",
"to",
"run",
"a",
"synchronous",
"method",
"asynchronously",
"on",
"an",
"executor",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/concurrent.py#L374-L413 |
codelv/enaml-native | src/enamlnative/core/eventloop/concurrent.py | return_future | def return_future(f):
"""Decorator to make a function that returns via callback return a
`Future`.
The wrapped function should take a ``callback`` keyword argument
and invoke it with one argument when it has finished. To signal failure,
the function can simply raise an exception (which will be
... | python | def return_future(f):
"""Decorator to make a function that returns via callback return a
`Future`.
The wrapped function should take a ``callback`` keyword argument
and invoke it with one argument when it has finished. To signal failure,
the function can simply raise an exception (which will be
... | [
"def",
"return_future",
"(",
"f",
")",
":",
"replacer",
"=",
"ArgReplacer",
"(",
"f",
",",
"'callback'",
")",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"future",
"=",
"Trac... | Decorator to make a function that returns via callback return a
`Future`.
The wrapped function should take a ``callback`` keyword argument
and invoke it with one argument when it has finished. To signal failure,
the function can simply raise an exception (which will be
captured by the `.StackConte... | [
"Decorator",
"to",
"make",
"a",
"function",
"that",
"returns",
"via",
"callback",
"return",
"a",
"Future",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/concurrent.py#L419-L502 |
codelv/enaml-native | src/enamlnative/core/eventloop/concurrent.py | chain_future | def chain_future(a, b):
"""Chain two futures together so that when one completes, so does the other.
The result (success or failure) of ``a`` will be copied to ``b``, unless
``b`` has already been completed or cancelled by the time ``a`` finishes.
"""
def copy(future):
assert future is a
... | python | def chain_future(a, b):
"""Chain two futures together so that when one completes, so does the other.
The result (success or failure) of ``a`` will be copied to ``b``, unless
``b`` has already been completed or cancelled by the time ``a`` finishes.
"""
def copy(future):
assert future is a
... | [
"def",
"chain_future",
"(",
"a",
",",
"b",
")",
":",
"def",
"copy",
"(",
"future",
")",
":",
"assert",
"future",
"is",
"a",
"if",
"b",
".",
"done",
"(",
")",
":",
"return",
"if",
"(",
"isinstance",
"(",
"a",
",",
"TracebackFuture",
")",
"and",
"i... | Chain two futures together so that when one completes, so does the other.
The result (success or failure) of ``a`` will be copied to ``b``, unless
``b`` has already been completed or cancelled by the time ``a`` finishes. | [
"Chain",
"two",
"futures",
"together",
"so",
"that",
"when",
"one",
"completes",
"so",
"does",
"the",
"other",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/concurrent.py#L505-L523 |
codelv/enaml-native | src/enamlnative/core/eventloop/concurrent.py | Future.result | def result(self, timeout=None):
"""If the operation succeeded, return its result. If it failed,
re-raise its exception.
This method takes a ``timeout`` argument for compatibility with
`concurrent.futures.Future` but it is an error to call it
before the `Future` is done, so the ... | python | def result(self, timeout=None):
"""If the operation succeeded, return its result. If it failed,
re-raise its exception.
This method takes a ``timeout`` argument for compatibility with
`concurrent.futures.Future` but it is an error to call it
before the `Future` is done, so the ... | [
"def",
"result",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"_clear_tb_log",
"(",
")",
"if",
"self",
".",
"_result",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_result",
"if",
"self",
".",
"_exc_info",
"is",
"not",
"None"... | If the operation succeeded, return its result. If it failed,
re-raise its exception.
This method takes a ``timeout`` argument for compatibility with
`concurrent.futures.Future` but it is an error to call it
before the `Future` is done, so the ``timeout`` is never used. | [
"If",
"the",
"operation",
"succeeded",
"return",
"its",
"result",
".",
"If",
"it",
"failed",
"re",
"-",
"raise",
"its",
"exception",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/concurrent.py#L224-L241 |
codelv/enaml-native | src/enamlnative/core/eventloop/concurrent.py | Future.exception | def exception(self, timeout=None):
"""If the operation raised an exception, return the `Exception`
object. Otherwise returns None.
This method takes a ``timeout`` argument for compatibility with
`concurrent.futures.Future` but it is an error to call it
before the `Future` is do... | python | def exception(self, timeout=None):
"""If the operation raised an exception, return the `Exception`
object. Otherwise returns None.
This method takes a ``timeout`` argument for compatibility with
`concurrent.futures.Future` but it is an error to call it
before the `Future` is do... | [
"def",
"exception",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"_clear_tb_log",
"(",
")",
"if",
"self",
".",
"_exc_info",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_exc_info",
"[",
"1",
"]",
"else",
":",
"self",
".",
"... | If the operation raised an exception, return the `Exception`
object. Otherwise returns None.
This method takes a ``timeout`` argument for compatibility with
`concurrent.futures.Future` but it is an error to call it
before the `Future` is done, so the ``timeout`` is never used. | [
"If",
"the",
"operation",
"raised",
"an",
"exception",
"return",
"the",
"Exception",
"object",
".",
"Otherwise",
"returns",
"None",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/concurrent.py#L243-L256 |
codelv/enaml-native | src/enamlnative/core/eventloop/concurrent.py | Future.add_done_callback | def add_done_callback(self, fn):
"""Attaches the given callback to the `Future`.
It will be invoked with the `Future` as its argument when the Future
has finished running and its result is available. In Tornado
consider using `.IOLoop.add_future` instead of calling
`add_done_ca... | python | def add_done_callback(self, fn):
"""Attaches the given callback to the `Future`.
It will be invoked with the `Future` as its argument when the Future
has finished running and its result is available. In Tornado
consider using `.IOLoop.add_future` instead of calling
`add_done_ca... | [
"def",
"add_done_callback",
"(",
"self",
",",
"fn",
")",
":",
"if",
"self",
".",
"_done",
":",
"fn",
"(",
"self",
")",
"else",
":",
"self",
".",
"_callbacks",
".",
"append",
"(",
"fn",
")"
] | Attaches the given callback to the `Future`.
It will be invoked with the `Future` as its argument when the Future
has finished running and its result is available. In Tornado
consider using `.IOLoop.add_future` instead of calling
`add_done_callback` directly. | [
"Attaches",
"the",
"given",
"callback",
"to",
"the",
"Future",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/concurrent.py#L258-L269 |
codelv/enaml-native | src/enamlnative/core/eventloop/concurrent.py | Future.set_exception | def set_exception(self, exception):
"""Sets the exception of a ``Future.``"""
self.set_exc_info(
(exception.__class__,
exception,
getattr(exception, '__traceback__', None))) | python | def set_exception(self, exception):
"""Sets the exception of a ``Future.``"""
self.set_exc_info(
(exception.__class__,
exception,
getattr(exception, '__traceback__', None))) | [
"def",
"set_exception",
"(",
"self",
",",
"exception",
")",
":",
"self",
".",
"set_exc_info",
"(",
"(",
"exception",
".",
"__class__",
",",
"exception",
",",
"getattr",
"(",
"exception",
",",
"'__traceback__'",
",",
"None",
")",
")",
")"
] | Sets the exception of a ``Future.`` | [
"Sets",
"the",
"exception",
"of",
"a",
"Future",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/concurrent.py#L280-L285 |
codelv/enaml-native | src/enamlnative/core/eventloop/concurrent.py | Future.set_exc_info | def set_exc_info(self, exc_info):
"""Sets the exception information of a ``Future.``
Preserves tracebacks on Python 2.
.. versionadded:: 4.0
"""
self._exc_info = exc_info
self._log_traceback = True
if not _GC_CYCLE_FINALIZERS:
self._tb_logger = _Trac... | python | def set_exc_info(self, exc_info):
"""Sets the exception information of a ``Future.``
Preserves tracebacks on Python 2.
.. versionadded:: 4.0
"""
self._exc_info = exc_info
self._log_traceback = True
if not _GC_CYCLE_FINALIZERS:
self._tb_logger = _Trac... | [
"def",
"set_exc_info",
"(",
"self",
",",
"exc_info",
")",
":",
"self",
".",
"_exc_info",
"=",
"exc_info",
"self",
".",
"_log_traceback",
"=",
"True",
"if",
"not",
"_GC_CYCLE_FINALIZERS",
":",
"self",
".",
"_tb_logger",
"=",
"_TracebackLogger",
"(",
"exc_info",... | Sets the exception information of a ``Future.``
Preserves tracebacks on Python 2.
.. versionadded:: 4.0 | [
"Sets",
"the",
"exception",
"information",
"of",
"a",
"Future",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/concurrent.py#L295-L314 |
codelv/enaml-native | src/enamlnative/android/android_coordinator_layout.py | AndroidCoordinatorLayout.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = CoordinatorLayout(self.get_context(), None, d.style) | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = CoordinatorLayout(self.get_context(), None, d.style) | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"CoordinatorLayout",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_coordinator_layout.py#L35-L40 |
codelv/enaml-native | src/enamlnative/android/android_compound_button.py | AndroidCompoundButton.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidCompoundButton, self).init_widget()
w = self.widget
w.setOnCheckedChangeListener(w.getId())
w.onCheckedChanged.connect(self.on_checked) | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidCompoundButton, self).init_widget()
w = self.widget
w.setOnCheckedChangeListener(w.getId())
w.onCheckedChanged.connect(self.on_checked) | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidCompoundButton",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"w",
"=",
"self",
".",
"widget",
"w",
".",
"setOnCheckedChangeListener",
"(",
"w",
".",
"getId",
"(",
")",
")",
"w",
"."... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_compound_button.py#L44-L51 |
codelv/enaml-native | src/enamlnative/android/android_relative_layout.py | AndroidRelativeLayout.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = RelativeLayout(self.get_context(), None, d.style) | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = RelativeLayout(self.get_context(), None, d.style) | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"RelativeLayout",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_relative_layout.py#L36-L41 |
codelv/enaml-native | src/enamlnative/android/android_relative_layout.py | AndroidRelativeLayout.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidRelativeLayout, self).init_widget()
d = self.declaration
if d.gravity:
self.set_gravity(d.gravity)
if d.horizontal_gravity:
self.set_horizontal_gravity(d.horizontal_grav... | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidRelativeLayout, self).init_widget()
d = self.declaration
if d.gravity:
self.set_gravity(d.gravity)
if d.horizontal_gravity:
self.set_horizontal_gravity(d.horizontal_grav... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidRelativeLayout",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"if",
"d",
".",
"gravity",
":",
"self",
".",
"set_gravity",
"(",
"d",
".",
"gravit... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_relative_layout.py#L43-L54 |
codelv/enaml-native | src/enamlnative/android/android_texture_view.py | AndroidTextureView.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidTextureView, self).__init__(self)
w = self.widget
w.setSurfaceTextureListener(w.getId())
w.onSurfaceTextureAvailable.connect(self.on_surface_texture_available)
w.onSurfaceTextureDestroy... | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidTextureView, self).__init__(self)
w = self.widget
w.setSurfaceTextureListener(w.getId())
w.onSurfaceTextureAvailable.connect(self.on_surface_texture_available)
w.onSurfaceTextureDestroy... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidTextureView",
",",
"self",
")",
".",
"__init__",
"(",
"self",
")",
"w",
"=",
"self",
".",
"widget",
"w",
".",
"setSurfaceTextureListener",
"(",
"w",
".",
"getId",
"(",
")",
")",
"w",
... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_texture_view.py#L71-L81 |
codelv/enaml-native | src/enamlnative/android/android_texture_view.py | AndroidTextureView.init_layout | def init_layout(self):
""" Add all child widgets to the view
"""
super(AndroidTextureView, self).init_layout()
# Force layout using the default params
if not self.layout_params:
self.set_layout({}) | python | def init_layout(self):
""" Add all child widgets to the view
"""
super(AndroidTextureView, self).init_layout()
# Force layout using the default params
if not self.layout_params:
self.set_layout({}) | [
"def",
"init_layout",
"(",
"self",
")",
":",
"super",
"(",
"AndroidTextureView",
",",
"self",
")",
".",
"init_layout",
"(",
")",
"# Force layout using the default params",
"if",
"not",
"self",
".",
"layout_params",
":",
"self",
".",
"set_layout",
"(",
"{",
"}"... | Add all child widgets to the view | [
"Add",
"all",
"child",
"widgets",
"to",
"the",
"view"
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_texture_view.py#L83-L90 |
codelv/enaml-native | src/enamlnative/android/android_drawer_layout.py | AndroidDrawerLayout.create_widget | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = DrawerLayout(self.get_context(), None, d.style) | python | def create_widget(self):
""" Create the underlying widget.
"""
d = self.declaration
self.widget = DrawerLayout(self.get_context(), None, d.style) | [
"def",
"create_widget",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"declaration",
"self",
".",
"widget",
"=",
"DrawerLayout",
"(",
"self",
".",
"get_context",
"(",
")",
",",
"None",
",",
"d",
".",
"style",
")"
] | Create the underlying widget. | [
"Create",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_drawer_layout.py#L68-L73 |
codelv/enaml-native | src/enamlnative/android/android_drawer_layout.py | AndroidDrawerLayout.init_widget | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidDrawerLayout, self).init_widget()
d = self.declaration
if d.title:
self.set_title(d.title)
if d.drawer_elevation:
self.set_drawer_elevation(d.drawer_elevation)
i... | python | def init_widget(self):
""" Initialize the underlying widget.
"""
super(AndroidDrawerLayout, self).init_widget()
d = self.declaration
if d.title:
self.set_title(d.title)
if d.drawer_elevation:
self.set_drawer_elevation(d.drawer_elevation)
i... | [
"def",
"init_widget",
"(",
"self",
")",
":",
"super",
"(",
"AndroidDrawerLayout",
",",
"self",
")",
".",
"init_widget",
"(",
")",
"d",
"=",
"self",
".",
"declaration",
"if",
"d",
".",
"title",
":",
"self",
".",
"set_title",
"(",
"d",
".",
"title",
")... | Initialize the underlying widget. | [
"Initialize",
"the",
"underlying",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_drawer_layout.py#L75-L90 |
codelv/enaml-native | src/enamlnative/ios/uikit_view_group.py | UiKitViewGroup.init_layout | def init_layout(self):
""" Initialize the layout of the toolkit widget.
This method is called during the bottom-up pass. This method
should initialize the layout of the widget. The child widgets
will be fully initialized and layed out when this is called.
This
"""... | python | def init_layout(self):
""" Initialize the layout of the toolkit widget.
This method is called during the bottom-up pass. This method
should initialize the layout of the widget. The child widgets
will be fully initialized and layed out when this is called.
This
"""... | [
"def",
"init_layout",
"(",
"self",
")",
":",
"layout",
"=",
"self",
".",
"layout",
"#: Add the layout as a subview",
"self",
".",
"widget",
".",
"addSubview",
"(",
"layout",
")",
"#: Add all child widgets to the layout",
"for",
"child_widget",
"in",
"self",
".",
"... | Initialize the layout of the toolkit widget.
This method is called during the bottom-up pass. This method
should initialize the layout of the widget. The child widgets
will be fully initialized and layed out when this is called.
This | [
"Initialize",
"the",
"layout",
"of",
"the",
"toolkit",
"widget",
"."
] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/uikit_view_group.py#L51-L67 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.