execsql2 2.37.0__py3-none-any.whl → 2.39.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. execsql/api.py +95 -45
  2. execsql/cli/commands/run.py +2 -2
  3. execsql/cli/lint.py +46 -9
  4. execsql/cli/run.py +128 -56
  5. execsql/config.py +7 -0
  6. execsql/data/execsql.conf.template +26 -2
  7. execsql/db/base.py +61 -24
  8. execsql/db/dsn.py +2 -3
  9. execsql/db/duckdb.py +43 -4
  10. execsql/db/firebird.py +39 -22
  11. execsql/db/mysql.py +22 -23
  12. execsql/db/oracle.py +11 -4
  13. execsql/db/postgres.py +15 -20
  14. execsql/db/sqlite.py +117 -10
  15. execsql/db/sqlserver.py +11 -7
  16. execsql/db/target_types.py +151 -4
  17. execsql/debug/repl.py +2 -1
  18. execsql/exceptions.py +19 -0
  19. execsql/exporters/html.py +26 -42
  20. execsql/exporters/ods.py +93 -21
  21. execsql/exporters/sqlite.py +82 -47
  22. execsql/format.py +12 -4
  23. execsql/gui/__init__.py +13 -10
  24. execsql/gui/base.py +131 -8
  25. execsql/gui/console.py +77 -30
  26. execsql/gui/desktop.py +290 -119
  27. execsql/gui/tui.py +384 -129
  28. execsql/importers/base.py +15 -19
  29. execsql/importers/csv.py +3 -5
  30. execsql/importers/json.py +37 -13
  31. execsql/importers/ods.py +22 -2
  32. execsql/lsp/document.py +6 -1
  33. execsql/lsp/hover.py +2 -1
  34. execsql/metacommands/conditions.py +3 -1
  35. execsql/metacommands/connect.py +18 -3
  36. execsql/metacommands/control.py +20 -5
  37. execsql/metacommands/data.py +11 -9
  38. execsql/metacommands/dispatch.py +10 -0
  39. execsql/metacommands/io.py +1 -0
  40. execsql/metacommands/io_export.py +1 -2
  41. execsql/metacommands/io_fileops.py +27 -91
  42. execsql/metacommands/io_import.py +26 -8
  43. execsql/metacommands/io_write.py +0 -9
  44. execsql/metacommands/prompt.py +94 -42
  45. execsql/metacommands/reference.py +7 -0
  46. execsql/metacommands/system.py +0 -2
  47. execsql/parser.py +132 -45
  48. execsql/script/control.py +17 -7
  49. execsql/script/engine.py +1 -1
  50. execsql/script/executor.py +184 -37
  51. execsql/script/preparation.py +42 -0
  52. execsql/types.py +6 -5
  53. execsql/utils/auth.py +11 -6
  54. execsql/utils/errors.py +2 -2
  55. execsql/utils/fileio.py +342 -134
  56. execsql/utils/gui.py +162 -53
  57. execsql/utils/spreadsheet.py +74 -0
  58. execsql/utils/strings.py +13 -7
  59. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/README.md +5 -5
  60. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/example_config_prompt.sql +2 -2
  61. {execsql2-2.37.0.dist-info → execsql2-2.39.1.dist-info}/METADATA +32 -119
  62. {execsql2-2.37.0.dist-info → execsql2-2.39.1.dist-info}/RECORD +77 -75
  63. {execsql2-2.37.0.dist-info → execsql2-2.39.1.dist-info}/WHEEL +1 -1
  64. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/config_settings.sqlite +0 -0
  65. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/make_config_db.sql +0 -0
  66. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/md_compare.sql +0 -0
  67. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/md_glossary.sql +0 -0
  68. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/md_upsert.sql +0 -0
  69. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/pg_compare.sql +0 -0
  70. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/pg_glossary.sql +0 -0
  71. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/script_template.sql +0 -0
  72. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/ss_compare.sql +0 -0
  73. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/ss_glossary.sql +0 -0
  74. {execsql2-2.37.0.data → execsql2-2.39.1.data}/data/execsql2_extras/ss_upsert.sql +0 -0
  75. {execsql2-2.37.0.dist-info → execsql2-2.39.1.dist-info}/entry_points.txt +0 -0
  76. {execsql2-2.37.0.dist-info → execsql2-2.39.1.dist-info}/licenses/LICENSE.txt +0 -0
  77. {execsql2-2.37.0.dist-info → execsql2-2.39.1.dist-info}/licenses/NOTICE +0 -0
@@ -1,11 +1,11 @@
1
1
  """Import metacommand handlers.
2
2
 
3
- - ``x_import`` — IMPORT (delimited text / CSV; dispatches by extension
4
- for .ods/.xls/.xlsx in the same handler).
3
+ - ``x_import`` — IMPORT (delimited text / CSV; spreadsheet forms have separate handlers).
5
4
  - ``x_import_file`` — IMPORT_FILE (insert a binary file blob as a row).
6
- - ``x_import_ods`` / ``x_import_ods_pattern`` — IMPORT … FROM ODS,
7
- single-sheet and SHEETS MATCHING <pattern>.
8
- - ``x_import_xls`` / ``x_import_xls_pattern`` — same for XLS/XLSX.
5
+ - ``x_import_ods`` / ``x_import_ods_pattern`` — IMPORT … FROM <file>
6
+ SHEET <name> / SHEETS MATCHING <pattern> (ODS).
7
+ - ``x_import_xls`` / ``x_import_xls_pattern`` — IMPORT … FROM EXCEL <file>
8
+ SHEET <name> / SHEETS MATCHING <pattern> (XLS/XLSX).
9
9
  - ``x_import_parquet`` — IMPORT … FROM PARQUET (via polars).
10
10
  - ``x_import_feather`` — IMPORT … FROM FEATHER (via polars).
11
11
  - ``x_import_json`` — IMPORT … FROM JSON (array of objects or JSON Lines).
@@ -22,9 +22,10 @@ from typing import Any
22
22
  import execsql.state as _state
23
23
  from execsql.exceptions import ErrInfo
24
24
  from execsql.importers.csv import importfile, importtable
25
+ from execsql.utils.spreadsheet import INPUT_LIMIT_DEFAULTS, SheetBudget
25
26
  from execsql.importers.feather import import_feather, import_parquet
26
27
  from execsql.importers.json import import_json
27
- from execsql.importers.ods import OdsFile, importods
28
+ from execsql.importers.ods import OdsFile, check_ods_archive, importods
28
29
  from execsql.exporters.xls import XlsFile, XlsxFile
29
30
  from execsql.importers.xls import importxls
30
31
  from execsql.utils.errors import exception_desc
@@ -185,13 +186,21 @@ def x_import_ods_pattern(**kwargs: Any) -> None:
185
186
  command_text=kwargs["metacommandline"],
186
187
  other_msg="Input file does not exist",
187
188
  )
189
+ check_ods_archive(filename)
188
190
  wbk = OdsFile()
189
191
  try:
190
192
  wbk.open(filename)
191
193
  except Exception as e:
192
194
  raise ErrInfo(type="cmd", other_msg=f"{filename} is not a valid OpenDocument spreadsheet.") from e
193
- sheets = wbk.sheetnames()
194
- impsheets = [s for s in sheets if rx.search(s)]
195
+ try:
196
+ sheets = wbk.sheetnames()
197
+ impsheets = [s for s in sheets if rx.search(s)]
198
+ # Validate each selected sheet before the first target can be changed;
199
+ # discard the rows between sheets instead of retaining their expansion.
200
+ for sheet in impsheets:
201
+ wbk.sheet_data(sheet, hdr_rows, budget=SheetBudget(_state.conf, filename, sheet))
202
+ finally:
203
+ wbk.close()
195
204
  tables = list(impsheets)
196
205
  if _state.conf.clean_col_hdrs:
197
206
  tables = clean_words(tables)
@@ -461,3 +470,12 @@ def x_import_row_buffer(**kwargs: Any) -> None:
461
470
  def x_show_progress(**kwargs: Any) -> None:
462
471
  setting = kwargs["setting"].lower()
463
472
  _state.conf.show_progress = setting in ("yes", "on", "true", "1")
473
+
474
+
475
+ def x_input_limit(**kwargs: Any) -> None:
476
+ """Set a non-negative spreadsheet input budget for subsequent imports."""
477
+ name = kwargs["name"].lower()
478
+ value = int(kwargs["value"])
479
+ if name not in INPUT_LIMIT_DEFAULTS or value < 0:
480
+ raise ErrInfo(type="cmd", other_msg=f"Invalid spreadsheet input limit: {name}={value}.")
481
+ setattr(_state.conf, name, value)
@@ -182,15 +182,6 @@ def x_write_create_table_alias(**kwargs: Any) -> None:
182
182
  )
183
183
  db = _state.dbs.aliased_as(alias)
184
184
  tbl = db.schema_qualified_table_name(schema, table)
185
- try:
186
- if not db.table_exists(table, schema):
187
- raise ErrInfo(
188
- type="cmd",
189
- command_text=kwargs["metacommandline"],
190
- other_msg=f"Table {tbl} does not exist",
191
- )
192
- except Exception:
193
- pass # Best-effort check; some adapters lack information_schema.
194
185
  select_stmt = f"select * from {tbl};"
195
186
  try:
196
187
  hdrs, rows = db.select_rowsource(select_stmt)
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
  from execsql.exceptions import ErrInfo
3
+ from execsql.gui.base import normalize_text_entry
3
4
 
4
5
  """
5
6
  Interactive user prompt metacommand handlers for execsql.
@@ -60,6 +61,7 @@ from execsql.utils.gui import (
60
61
  GuiSpec,
61
62
  QUERY_CONSOLE,
62
63
  enable_gui,
64
+ get_gui_response,
63
65
  get_yn,
64
66
  get_yn_win,
65
67
  gui_connect,
@@ -92,7 +94,7 @@ def x_prompt(**kwargs: Any) -> None:
92
94
  "help_url": help_url,
93
95
  }
94
96
  _state.gui_manager_queue.put(GuiSpec(GUI_DISPLAY, gui_args, return_queue))
95
- user_response = return_queue.get(block=True)
97
+ user_response = get_gui_response(return_queue, GUI_DISPLAY)
96
98
  btn = user_response["button"]
97
99
  if not btn and _state.status.cancel_halt:
98
100
  msg = f"Halted from display of {sq_name}"
@@ -133,7 +135,7 @@ def x_prompt_enter(**kwargs: Any) -> None:
133
135
  "help_url": help_url,
134
136
  }
135
137
  _state.gui_manager_queue.put(GuiSpec(GUI_DISPLAY, gui_args, return_queue))
136
- user_response = return_queue.get(block=True)
138
+ user_response = get_gui_response(return_queue, GUI_DISPLAY)
137
139
  btnval = user_response["button"]
138
140
  txtval = user_response["return_value"]
139
141
  if btnval is None:
@@ -141,6 +143,7 @@ def x_prompt_enter(**kwargs: Any) -> None:
141
143
  _state.exec_log.log_exit_halt(*current_script_line(), msg="Quit from prompt to enter a SUB value.")
142
144
  exit_now(2, None)
143
145
  else:
146
+ txtval = normalize_text_entry(txtval, texttype, textcase)
144
147
  subvarset = _state.subvars if sub_var[0] != "~" else _state.current_localvars()
145
148
  subvarset.add_substitution(sub_var, txtval)
146
149
  script_name, lno = current_script_line()
@@ -162,15 +165,6 @@ def x_prompt_entryform(**kwargs: Any) -> None:
162
165
  message = kwargs["message"]
163
166
  help_url = unquoted(kwargs["help"])
164
167
  tbl1 = _state.dbs.current().schema_qualified_table_name(spec_schema, spec_table)
165
- try:
166
- if not _state.dbs.current().table_exists(spec_table, spec_schema):
167
- raise ErrInfo(
168
- type="cmd",
169
- command_text=kwargs["metacommandline"],
170
- other_msg=f"Table {spec_table} does not exist",
171
- )
172
- except Exception:
173
- pass # Best-effort check; some adapters lack information_schema.
174
168
  curs = _state.dbs.current().cursor()
175
169
  cmd = f"select * from {tbl1};"
176
170
  curs.execute(cmd)
@@ -301,23 +295,23 @@ def x_prompt_entryform(**kwargs: Any) -> None:
301
295
  "help_url": help_url,
302
296
  }
303
297
  _state.gui_manager_queue.put(GuiSpec(GUI_ENTRY, gui_args, return_queue))
304
- user_response = return_queue.get(block=True)
298
+ user_response = get_gui_response(return_queue, GUI_ENTRY)
305
299
  btn = user_response["button"]
306
300
  entries = user_response["return_value"]
307
301
  script, line_no = current_script_line()
308
302
  if btn:
309
303
  assert entries is not None
310
- assert subvar is not None
311
304
  for entry in entries:
305
+ subvarset = _state.subvars if entry.name[0] != "~" else _state.current_localvars()
312
306
  if entry.value:
313
307
  value = str(entry.value)
314
- subvarset = _state.subvars if subvar[0] != "~" else _state.current_localvars()
315
308
  subvarset.add_substitution(entry.name, value)
316
309
  _state.exec_log.log_status_info(
317
310
  f"Substitution variable {entry.name} set to {{{value}}} on line {line_no} of {script}",
318
311
  )
319
312
  else:
320
- if _state.subvars.sub_exists(entry.name):
313
+ if subvarset.sub_exists(entry.name):
314
+ subvarset.remove_substitution(entry.name)
321
315
  _state.exec_log.log_status_info(
322
316
  f"Substitution variable {entry.name} removed on line {line_no} of {script}",
323
317
  )
@@ -351,7 +345,7 @@ def x_prompt_pause(**kwargs: Any) -> None:
351
345
  "countdown": maxtime_secs,
352
346
  }
353
347
  _state.gui_manager_queue.put(GuiSpec(GUI_PAUSE, gui_args, return_queue))
354
- user_response = return_queue.get(block=True)
348
+ user_response = get_gui_response(return_queue, GUI_PAUSE)
355
349
  quit = user_response["quit"]
356
350
  return_queue.task_done()
357
351
  if quit and _state.status.cancel_halt:
@@ -419,7 +413,7 @@ def prompt_compare(button_list: list, **kwargs: Any) -> Any:
419
413
  "help_url": help_url,
420
414
  }
421
415
  _state.gui_manager_queue.put(GuiSpec(GUI_COMPARE, gui_args, return_queue))
422
- user_response = return_queue.get(block=True)
416
+ user_response = get_gui_response(return_queue, GUI_COMPARE)
423
417
  btn = user_response["button"]
424
418
  if btn is None and _state.status.cancel_halt:
425
419
  script, line_no = current_script_line()
@@ -472,7 +466,7 @@ def x_prompt_ask(**kwargs: Any) -> None:
472
466
  "help_url": help_url,
473
467
  }
474
468
  _state.gui_manager_queue.put(GuiSpec(GUI_DISPLAY, gui_args, return_queue))
475
- user_response = return_queue.get(block=True)
469
+ user_response = get_gui_response(return_queue, GUI_DISPLAY)
476
470
  btn = user_response["button"]
477
471
  if btn is None:
478
472
  if _state.status.cancel_halt:
@@ -517,7 +511,7 @@ def x_prompt_map(**kwargs: Any) -> None:
517
511
  "color_col": color_col,
518
512
  }
519
513
  _state.gui_manager_queue.put(GuiSpec(GUI_MAP, gui_args, return_queue))
520
- user_response = return_queue.get(block=True)
514
+ user_response = get_gui_response(return_queue, GUI_MAP)
521
515
  btn = user_response["button"]
522
516
  if not btn and _state.status.cancel_halt:
523
517
  msg = f"Halted from map of {sq_name}"
@@ -540,15 +534,6 @@ def x_prompt_action(**kwargs: Any) -> None:
540
534
  if do_continue is not None:
541
535
  do_continue = bool(do_continue)
542
536
  tbl1 = _state.dbs.current().schema_qualified_table_name(spec_schema, spec_table)
543
- try:
544
- if not _state.dbs.current().table_exists(spec_table, spec_schema):
545
- raise ErrInfo(
546
- type="cmd",
547
- command_text=kwargs["metacommandline"],
548
- other_msg=f"Table {spec_table} does not exist",
549
- )
550
- except Exception:
551
- pass # Best-effort check; some adapters lack information_schema.
552
537
  curs = _state.dbs.current().cursor()
553
538
  cmd = f"select * from {tbl1};"
554
539
  curs.execute(cmd)
@@ -606,13 +591,56 @@ def x_prompt_action(**kwargs: Any) -> None:
606
591
  "rowset": rows,
607
592
  }
608
593
  _state.gui_manager_queue.put(GuiSpec(GUI_ACTION, gui_args, return_queue))
609
- user_response = return_queue.get(block=True)
594
+ user_response = get_gui_response(return_queue, GUI_ACTION)
610
595
  btn = user_response["button"]
611
596
  script, line_no = current_script_line()
612
- if not btn and _state.status.cancel_halt:
613
- msg = f"Halted from entry form {tbl1}"
614
- _state.exec_log.log_exit_halt(script, line_no, msg)
615
- exit_now(2, None)
597
+ if btn is None:
598
+ if _state.status.cancel_halt:
599
+ msg = f"Halted from action form {tbl1}"
600
+ _state.exec_log.log_exit_halt(script, line_no, msg)
601
+ exit_now(2, None)
602
+ return
603
+ if btn == 0 and do_continue:
604
+ return
605
+ if not isinstance(btn, int) or not 1 <= btn <= len(action_list):
606
+ raise ErrInfo(type="cmd", other_msg="The action dialog returned an invalid action.")
607
+ action = action_list[btn - 1]
608
+ selected_row = user_response.get("row")
609
+ if action.data_required and (
610
+ not colnames or not isinstance(selected_row, (list, tuple)) or len(selected_row) != len(colnames)
611
+ ):
612
+ raise ErrInfo(type="cmd", other_msg="The selected action requires a selected data row.")
613
+
614
+ from execsql.metacommands.script_ext import _get_ast_script
615
+ from execsql.script.ast import IncludeDirective, SourceSpan
616
+ from execsql.script.executor import _ScriptExecutionError, _execute_script_native, _script_args
617
+ from execsql.state import get_context
618
+
619
+ if not isinstance(action.script, str) or not action.script.strip():
620
+ raise ErrInfo(type="cmd", other_msg="A script name is required for the selected action.")
621
+ script_name = action.script.strip()
622
+ block = _get_ast_script(script_name)
623
+ node = IncludeDirective(
624
+ span=SourceSpan(script, line_no or 0),
625
+ target=script_name,
626
+ is_execute_script=True,
627
+ command=f"EXECUTE SCRIPT {script_name}",
628
+ )
629
+ arguments = _script_args(node, block)
630
+ if action.data_required:
631
+ assert colnames is not None and selected_row is not None
632
+ for name, item in zip(colnames, selected_row):
633
+ name = "@" + name
634
+ value = "" if item is None else str(item)
635
+ _state.subvars.add_substitution(name, value)
636
+ if _state.conf.log_datavars:
637
+ _state.exec_log.log_status_info(
638
+ f"Substitution string {name} set to {{{value}}} on line {line_no} of {script}",
639
+ )
640
+ try:
641
+ _execute_script_native(get_context(), node, block, arguments)
642
+ except Exception as error:
643
+ raise _ScriptExecutionError(error) from error
616
644
 
617
645
 
618
646
  def x_prompt_savefile(**kwargs: Any) -> None:
@@ -631,7 +659,7 @@ def x_prompt_savefile(**kwargs: Any) -> None:
631
659
  return_queue: _queue.Queue[Any] = _queue.Queue()
632
660
  gui_args = {"working_dir": working_dir, "script": script}
633
661
  _state.gui_manager_queue.put(GuiSpec(GUI_SAVEFILE, gui_args, return_queue))
634
- user_response = return_queue.get(block=True)
662
+ user_response = get_gui_response(return_queue, GUI_SAVEFILE)
635
663
  fn = user_response["filename"]
636
664
  if not fn:
637
665
  if _state.status.cancel_halt:
@@ -704,7 +732,7 @@ def x_prompt_openfile(**kwargs: Any) -> None:
704
732
  return_queue: _queue.Queue[Any] = _queue.Queue()
705
733
  gui_args = {"working_dir": working_dir, "script": script}
706
734
  _state.gui_manager_queue.put(GuiSpec(GUI_OPENFILE, gui_args, return_queue))
707
- user_response = return_queue.get(block=True)
735
+ user_response = get_gui_response(return_queue, GUI_OPENFILE)
708
736
  fn = user_response["filename"]
709
737
  if not fn:
710
738
  if _state.status.cancel_halt:
@@ -763,7 +791,7 @@ def x_prompt_directory(**kwargs: Any) -> None:
763
791
  return_queue: _queue.Queue[Any] = _queue.Queue()
764
792
  gui_args = {"working_dir": working_dir, "script": script}
765
793
  _state.gui_manager_queue.put(GuiSpec(GUI_DIRECTORY, gui_args, return_queue))
766
- user_response = return_queue.get(block=True)
794
+ user_response = get_gui_response(return_queue, GUI_DIRECTORY)
767
795
  dirname = user_response["directory"]
768
796
  if not dirname:
769
797
  if _state.status.cancel_halt:
@@ -836,13 +864,33 @@ def prompt_select_rows(button_list: list, **kwargs: Any) -> Any:
836
864
  "help_url": help_url,
837
865
  }
838
866
  _state.gui_manager_queue.put(GuiSpec(GUI_SELECTROWS, gui_args, return_queue))
839
- user_response = return_queue.get(block=True)
867
+ user_response = get_gui_response(return_queue, GUI_SELECTROWS)
840
868
  btn = user_response["button"]
841
869
  if btn is None and _state.status.cancel_halt:
842
870
  script, line_no = current_script_line()
843
871
  msg = f"Halted from selection of rows from {sq_name1} into {sq_name2}"
844
872
  _state.exec_log.log_exit_halt(script, line_no, msg)
845
873
  exit_now(2, None)
874
+ if btn is None:
875
+ return btn
876
+ if "rows" not in user_response:
877
+ raise ErrInfo("error", other_msg="The row-selection dialog did not return its selections.")
878
+ selections = user_response["rows"]
879
+ if selections is None: # The console can display the source but cannot select rows.
880
+ return btn
881
+ if not isinstance(selections, list) or any(
882
+ not isinstance(row, (list, tuple)) or len(row) != len(hdrs1) for row in selections
883
+ ):
884
+ raise ErrInfo("error", other_msg="The row-selection dialog returned invalid rows.")
885
+ if selections:
886
+ columns = ",".join(db2.quote_identifier(header) for header in hdrs1)
887
+ sql = f"insert into {sq_name2} ({columns}) values ({db2.paramsubs(len(hdrs1))});"
888
+ _state.status.batch.using_db(db2)
889
+ db2.begin_transaction()
890
+ for row in selections:
891
+ db2.execute(sql, list(row))
892
+ if not db2.holding():
893
+ db2.commit()
846
894
  return btn
847
895
 
848
896
 
@@ -878,12 +926,13 @@ def x_ask(**kwargs: Any) -> None:
878
926
  "button_list": [("Yes", 1, "y"), ("No", 0, "n")],
879
927
  }
880
928
  _state.gui_manager_queue.put(GuiSpec(GUI_DISPLAY, gui_args, return_queue))
881
- user_response = return_queue.get(block=True)
929
+ user_response = get_gui_response(return_queue, GUI_DISPLAY)
882
930
  btn = user_response["button"]
883
931
  if btn is None:
884
932
  if _state.status.cancel_halt:
885
933
  _state.exec_log.log_exit_halt(script, lno, msg="Quit from ASK metacommand")
886
934
  exit_now(2, None)
935
+ return None
887
936
  else:
888
937
  respstr = "Yes" if btn == 1 else "No"
889
938
  else:
@@ -925,7 +974,7 @@ def x_pause(**kwargs: Any) -> None:
925
974
  if _state.gui_manager_thread:
926
975
  return_queue: _queue.Queue[Any] = _queue.Queue()
927
976
  _state.gui_manager_queue.put(GuiSpec(QUERY_CONSOLE, {}, return_queue))
928
- user_response = return_queue.get(block=True)
977
+ user_response = get_gui_response(return_queue, QUERY_CONSOLE)
929
978
  use_gui = user_response["console_running"]
930
979
  if use_gui or _state.conf.gui_level > 0:
931
980
  enable_gui()
@@ -936,7 +985,7 @@ def x_pause(**kwargs: Any) -> None:
936
985
  "countdown": maxtime_secs,
937
986
  }
938
987
  _state.gui_manager_queue.put(GuiSpec(GUI_PAUSE, gui_args, return_queue))
939
- user_response = return_queue.get(block=True)
988
+ user_response = get_gui_response(return_queue, GUI_PAUSE)
940
989
  quit = user_response["quit"]
941
990
  return_queue.task_done()
942
991
  else:
@@ -955,12 +1004,15 @@ def x_pause(**kwargs: Any) -> None:
955
1004
 
956
1005
  def x_msg(**kwargs: Any) -> None:
957
1006
  message = kwargs["message"]
958
- current_script_line()
1007
+ script, line_no = current_script_line()
959
1008
  enable_gui()
960
1009
  return_queue: _queue.Queue[Any] = _queue.Queue()
961
1010
  gui_args = {"title": "Message", "message": message}
962
1011
  _state.gui_manager_queue.put(GuiSpec(GUI_MSG, gui_args, return_queue))
963
- return_queue.get(block=True)
1012
+ response = get_gui_response(return_queue, GUI_MSG)
1013
+ if response["button"] is None and _state.status.cancel_halt:
1014
+ _state.exec_log.log_exit_halt(script, line_no, msg="Quit from PROMPT MESSAGE metacommand")
1015
+ exit_now(2, None)
964
1016
  return None
965
1017
 
966
1018
 
@@ -260,6 +260,13 @@ _METACOMMANDS: tuple[Metacommand, ...] = (
260
260
  "CONFIG GUI_LEVEL <n>",
261
261
  "CONFIG HDF5_TEXT_LEN <n>",
262
262
  "CONFIG IMPORT_ROW_BUFFER <n>",
263
+ "CONFIG ODS_MAX_XML_MB <n>",
264
+ "CONFIG ODS_MAX_COMPRESSION_RATIO <n>",
265
+ "CONFIG IMPORT_MAX_ROWS <n>",
266
+ "CONFIG IMPORT_MAX_COLUMNS <n>",
267
+ "CONFIG IMPORT_MAX_CELLS <n>",
268
+ "CONFIG IMPORT_MAX_CELL_CHARS <n>",
269
+ "CONFIG IMPORT_MAX_TEXT_CHARS <n>",
263
270
  "CONFIG LOG_DATAVARS YES|NO",
264
271
  "CONFIG LOG_SQL YES|NO",
265
272
  "CONFIG LOG_WRITE_MESSAGES YES|NO",
@@ -157,13 +157,11 @@ def x_console_hideshow(**kwargs: Any) -> None:
157
157
 
158
158
  def x_consolewidth(**kwargs: Any) -> None:
159
159
  width = kwargs["width"]
160
- _state.conf.gui_console_width = int(width)
161
160
  gui_console_width(width)
162
161
 
163
162
 
164
163
  def x_consoleheight(**kwargs: Any) -> None:
165
164
  height = kwargs["height"]
166
- _state.conf.gui_console_height = int(height)
167
165
  gui_console_height(height)
168
166
 
169
167