PyWebView window calls not returning data
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
Línea de trabajo
Comienza en pywebview_window_call y _monitor_action_requests; después, sigue cómo _action_queue distribuye las acciones y cómo se registra server on_message. Revisa el flujo existente menu:open_file_dialog y determina dónde podría observarse el resultado de una llamada. Se considera terminado cuando el resultado de create_file_dialog llega a la aplicación sin bloquear la UI y el flujo de apertura de archivos puede consumirlo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The pywebview window calls aren't returning data from fn
my code
# Instead of directly opening the dialog, send a request to the UI process
def open_file_dialog(self):
state, ctrl = GLOBAL_APP.server.state, GLOBAL_APP.server.controller
# Send the action to the UI process
result = ctrl.pywebview_window_call(
"create_file_dialog",
webview.FileDialog.OPEN,
file_types = ('PVD Files (*.pvd)', 'All Files (*.*)'),
allow_multiple = False
)
logging.info(f"File dialog result: {result}")
result never comes back, should probably be async anyway ... so I cant hook it up to the on_message on the server or a client state or anything else
# Register a handler for messages from the UI process
def on_message(msg):
# Check for file dialog result
logging.info(f"Received file dialog result: {msg}")
if isinstance(msg, dict) and msg.get("action") == "file_dialog_result":
logging.info(f"Received file dialog result: {msg} {dict}")
result = msg["result"]
# Set the result in the trame state
app.server.state.file_to_open = result
# ...existing message handling...
app.server.on_message = on_message
menu = [
("File", [
("Open...", "open_file_dialog"),
]),
# ("Help", [("About", app.show_about)]),
]
def on_message(msg):
logging.info(f"Message {msg}")
if msg == "menu:open_file_dialog":
app.open_file_dialog()
app.server.start(exec_mode="desktop",
maximized=True,
menu=menu,
on_message=on_message
)
Trame code
async def _monitor_action_requests(self):
while self._monitoring:
await asyncio.sleep(0.5)
if not self._action_queue.empty():
msg = self._action_queue.get_nowait()
action = msg.get("action")
args = msg.get("args", [])
kwargs = msg.get("kwargs", {})
fn = getattr(self._main_window, action)
if action == "destroy":
self.exit()
fn(*args, **kwargs)
This prevents me from being able to user pywebview menu to do a file->open in trame web view. I'd prefer not having to get rust just for file open, if we could have a return queue for pywebview that would help a ton.
- Lenguaje dominante
- Python
- Estrellas
- 17
- Forks
- 16
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Kitware/trame-server
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
Kitware/trame-server#103 · 1 reacción ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
Kitware/trame-server#30 · 2 comentarios ·
Todos los issues de Kitware/trame-server
Issues similares
-
ChatBedrockConverse changes the keys of JSON tool results to camelCase (`order_id` becomes `orderId`)Posiblemente ocupada @geyazheng la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
langchain-ai/langchain-aws#1469 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
EESSI/docs#949 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
b4b usability
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
fix(schedule): align list_tasks since cursor filter boundary from strict > to >=Posiblemente ocupada @bfs2021 la tomó hoy. Abiertoagent-ready bug p2 schedule
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
allenporter/supernote#540 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
frazane/scoringrules#164 ·
Los mantenedores suelen responder en 1 día