本文整理汇总了Python中types.SimpleNamespace.image_tex方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleNamespace.image_tex方法的具体用法?Python SimpleNamespace.image_tex怎么用?Python SimpleNamespace.image_tex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类types.SimpleNamespace
的用法示例。
在下文中一共展示了SimpleNamespace.image_tex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: eye
# 需要导入模块: from types import SimpleNamespace [as 别名]
# 或者: from types.SimpleNamespace import image_tex [as 别名]
#.........这里部分代码省略.........
def toggle_general_settings(collapsed):
# this is the menu toggle logic.
# Only one menu can be open.
# If no menu is open the menubar should collapse.
g_pool.menubar.collapsed = collapsed
for m in g_pool.menubar.elements:
m.collapsed = True
general_settings.collapsed = collapsed
# Initialize glfw
glfw.glfwInit()
title = "Pupil Capture - eye {}".format(eye_id)
width, height = g_pool.capture.frame_size
width *= 2
height *= 2
width += icon_bar_width
width, height = session_settings.get("window_size", (width, height))
main_window = glfw.glfwCreateWindow(width, height, title, None, None)
window_pos = session_settings.get("window_position", window_position_default)
glfw.glfwSetWindowPos(main_window, window_pos[0], window_pos[1])
glfw.glfwMakeContextCurrent(main_window)
cygl.utils.init()
# UI callback functions
def set_scale(new_scale):
g_pool.gui_user_scale = new_scale
on_resize(main_window, *glfw.glfwGetFramebufferSize(main_window))
# gl_state settings
basic_gl_setup()
g_pool.image_tex = Named_Texture()
g_pool.image_tex.update_from_ndarray(np.ones((1, 1), dtype=np.uint8) + 125)
# setup GUI
g_pool.gui = ui.UI()
g_pool.gui_user_scale = session_settings.get("gui_scale", 1.0)
g_pool.menubar = ui.Scrolling_Menu(
"Settings", pos=(-500, 0), size=(-icon_bar_width, 0), header_pos="left"
)
g_pool.iconbar = ui.Scrolling_Menu(
"Icons", pos=(-icon_bar_width, 0), size=(0, 0), header_pos="hidden"
)
g_pool.gui.append(g_pool.menubar)
g_pool.gui.append(g_pool.iconbar)
general_settings = ui.Growing_Menu("General", header_pos="headline")
general_settings.append(
ui.Selector(
"gui_user_scale",
g_pool,
setter=set_scale,
selection=[0.8, 0.9, 1.0, 1.1, 1.2],
label="Interface Size",
)
)
def set_window_size():
f_width, f_height = g_pool.capture.frame_size
f_width *= 2
f_height *= 2
f_width += int(icon_bar_width * g_pool.gui.scale)
glfw.glfwSetWindowSize(main_window, f_width, f_height)
示例2: player
# 需要导入模块: from types import SimpleNamespace [as 别名]
# 或者: from types.SimpleNamespace import image_tex [as 别名]
#.........这里部分代码省略.........
-1,
ui.Text_Input(
"rel_time_trim_section",
getter=g_pool.seek_control.get_rel_time_trim_range_string,
setter=g_pool.seek_control.set_rel_time_trim_range_string,
label="Relative time range to export",
),
)
general_settings.insert(
-1,
ui.Text_Input(
"frame_idx_trim_section",
getter=g_pool.seek_control.get_frame_index_trim_range_string,
setter=g_pool.seek_control.set_frame_index_trim_range_string,
label="Frame index range to export",
),
)
# Register callbacks main_window
glfw.glfwSetFramebufferSizeCallback(main_window, on_resize)
glfw.glfwSetKeyCallback(main_window, on_window_key)
glfw.glfwSetCharCallback(main_window, on_window_char)
glfw.glfwSetMouseButtonCallback(main_window, on_window_mouse_button)
glfw.glfwSetCursorPosCallback(main_window, on_pos)
glfw.glfwSetScrollCallback(main_window, on_scroll)
glfw.glfwSetDropCallback(main_window, on_drop)
toggle_general_settings(True)
g_pool.gui.configuration = session_settings.get("ui_config", {})
# gl_state settings
gl_utils.basic_gl_setup()
g_pool.image_tex = Named_Texture()
# trigger on_resize
on_resize(main_window, *glfw.glfwGetFramebufferSize(main_window))
def handle_notifications(n):
subject = n["subject"]
if subject == "start_plugin":
g_pool.plugins.add(
g_pool.plugin_by_name[n["name"]], args=n.get("args", {})
)
elif subject.startswith("meta.should_doc"):
ipc_pub.notify(
{"subject": "meta.doc", "actor": g_pool.app, "doc": player.__doc__}
)
for p in g_pool.plugins:
if (
p.on_notify.__doc__
and p.__class__.on_notify != Plugin.on_notify
):
ipc_pub.notify(
{
"subject": "meta.doc",
"actor": p.class_name,
"doc": p.on_notify.__doc__,
}
)
while not glfw.glfwWindowShouldClose(main_window):
# fetch newest notifications
new_notifications = []
while notify_sub.new_data:
示例3: world
# 需要导入模块: from types import SimpleNamespace [as 别名]
# 或者: from types.SimpleNamespace import image_tex [as 别名]
#.........这里部分代码省略.........
g_pool.menubar.append(general_settings)
icon = ui.Icon(
"collapsed",
general_settings,
label=chr(0xE8B8),
on_val=False,
off_val=True,
setter=toggle_general_settings,
label_font="pupil_icons",
)
icon.tooltip = "General Settings"
g_pool.iconbar.append(icon)
user_plugin_separator = ui.Separator()
user_plugin_separator.order = 0.35
g_pool.iconbar.append(user_plugin_separator)
# plugins that are loaded based on user settings from previous session
g_pool.plugins = Plugin_List(
g_pool, session_settings.get("loaded_plugins", default_plugins)
)
# Register callbacks main_window
glfw.glfwSetFramebufferSizeCallback(main_window, on_resize)
glfw.glfwSetKeyCallback(main_window, on_window_key)
glfw.glfwSetCharCallback(main_window, on_window_char)
glfw.glfwSetMouseButtonCallback(main_window, on_window_mouse_button)
glfw.glfwSetCursorPosCallback(main_window, on_pos)
glfw.glfwSetScrollCallback(main_window, on_scroll)
glfw.glfwSetDropCallback(main_window, on_drop)
# gl_state settings
gl_utils.basic_gl_setup()
g_pool.image_tex = Named_Texture()
toggle_general_settings(True)
# now that we have a proper window we can load the last gui configuration
g_pool.gui.configuration = session_settings.get("ui_config", {})
# create a timer to control window update frequency
window_update_timer = timer(1 / 60)
def window_should_update():
return next(window_update_timer)
# trigger setup of window and gl sizes
on_resize(main_window, *glfw.glfwGetFramebufferSize(main_window))
if session_settings.get("eye1_process_alive", True):
launch_eye_process(1, delay=0.6)
if session_settings.get("eye0_process_alive", True):
launch_eye_process(0, delay=0.3)
ipc_pub.notify({"subject": "world_process.started"})
logger.warning("Process started.")
# Event loop
while not glfw.glfwWindowShouldClose(main_window):
# fetch newest notifications
new_notifications = []
while notify_sub.new_data:
t, n = notify_sub.recv()
new_notifications.append(n)