chemql-python 1.6.10__tar.gz → 1.6.11__tar.gz
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.
- {chemql_python-1.6.10 → chemql_python-1.6.11}/PKG-INFO +16 -7
- {chemql_python-1.6.10 → chemql_python-1.6.11}/README.md +15 -6
- {chemql_python-1.6.10 → chemql_python-1.6.11}/pyproject.toml +2 -1
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/__init__.py +21 -1
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/codecql.py +38 -13
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/codecql_gui_core.py +0 -4
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/codecqlx.py +34 -20
- chemql_python-1.6.11/src/chemql/logo64-macos.png +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql_python.egg-info/PKG-INFO +16 -7
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql_python.egg-info/SOURCES.txt +3 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/tests/test_codecql.py +30 -7
- chemql_python-1.6.11/tests/test_codecqlx_fonts.py +27 -0
- chemql_python-1.6.11/tests/test_codecqlx_icon.py +15 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/tests/test_public_api.py +6 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/LICENSE +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/setup.cfg +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/__main__.py +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/build.py +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/colors.json +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/data/BondEnergies.json +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/data/MoleculeBonds.json +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/data/Molecules.json +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/data/PeriodicTableJSON.json +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/data/Reactions.json +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/highlighting.json +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/highlighting.py +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/html/periodic_table.html +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/logo64.png +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/README.md +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/collections.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/datetime.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/decimal.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/fractions.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/json.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/math/statistics.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/math.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/pathlib.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/random.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql/stdlib/text.cql +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql_python.egg-info/dependency_links.txt +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql_python.egg-info/entry_points.txt +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql_python.egg-info/requires.txt +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql_python.egg-info/top_level.txt +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/tests/test_external_molecule_lookup.py +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/tests/test_reactions.py +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/tests/test_stdlib.py +0 -0
- {chemql_python-1.6.10 → chemql_python-1.6.11}/tests/test_structured_types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.11
|
|
4
4
|
Summary: A chemistry-focused query language and REPL
|
|
5
5
|
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
6
|
Requires-Python: >=3.12
|
|
@@ -20,9 +20,9 @@ ChemQL is a small language for querying, computing with, and simulating chemistr
|
|
|
20
20
|
|
|
21
21
|
- **Distribution name:** `chemql-python`
|
|
22
22
|
- **Import / CLI name:** `chemql`
|
|
23
|
-
- **Language version:** `1.6.
|
|
24
|
-
- **Editor version:** `codecql 0.1.
|
|
25
|
-
- **GUI Editor version:** `CodecQLX 1.1.
|
|
23
|
+
- **Language version:** `1.6.11` (per `chemql.__version__`)
|
|
24
|
+
- **Editor version:** `codecql 0.1.2`
|
|
25
|
+
- **GUI Editor version:** `CodecQLX 1.1.1`
|
|
26
26
|
- **Python import / CLI name:** `chemql`
|
|
27
27
|
- **Author:** Mohammad Rakibul Islam
|
|
28
28
|
- **Minimum Python:** **3.12+** (verified with `vermin`)
|
|
@@ -476,7 +476,7 @@ ls
|
|
|
476
476
|
|
|
477
477
|
| | |
|
|
478
478
|
|---|---|
|
|
479
|
-
| Version | 0.1.
|
|
479
|
+
| Version | 0.1.2 |
|
|
480
480
|
| Ships with | `chemql-python` |
|
|
481
481
|
| Files | `.cql` (ChemQL), `.py`, `cqlpackage.json` / `cqlpackage.toml`, and any plain-text file |
|
|
482
482
|
|
|
@@ -516,12 +516,16 @@ Opening a path that does not exist starts an empty buffer; it is created on the
|
|
|
516
516
|
| `Ctrl` + `↑` `↓` | Scroll the view without moving the text |
|
|
517
517
|
| `Backspace`, `Delete` | Delete a character, or the selection |
|
|
518
518
|
| `Ctrl+Backspace` / `Alt+Backspace` | Delete the word to the left |
|
|
519
|
+
| `Command+Backspace` (macOS, when sent as CSI-u) | Delete to the start of the line |
|
|
519
520
|
| `Ctrl+Delete` / `Alt+Delete` | Delete the word to the right |
|
|
520
521
|
| `Ctrl+C` / `Ctrl+Insert` | Copy the selection (editor + system clipboard when available). It does **not** quit |
|
|
521
522
|
| `Ctrl+X` | Cut the selection |
|
|
522
523
|
| `Ctrl+V` / `Shift+Insert` | Paste the editor's clipboard |
|
|
523
524
|
|
|
524
|
-
Pasting from your terminal or OS clipboard also works: CodecQL enables bracketed paste, so
|
|
525
|
+
Pasting from your terminal or OS clipboard also works: CodecQL enables bracketed paste, so
|
|
526
|
+
multi-line pastes arrive as a single insertion. The terminal must forward macOS Command-key
|
|
527
|
+
combinations using the CSI-u keyboard protocol; otherwise it may consume or remap them before
|
|
528
|
+
CodecQL receives them.
|
|
525
529
|
|
|
526
530
|
**Auto-indent.** After a line that opens a block (`func`, `define NAME{}`, `struct`, `record`, `enum`, `namespace`, `if`, `elif`, `else`, `for`, `while`) or ends in a `\` continuation, the next line is indented with a tab. Pressing Enter after `endnamespace` removes one level of indentation. Other `end...` keywords do not dedent automatically.
|
|
527
531
|
|
|
@@ -829,7 +833,6 @@ Each entry needs an `ansi256` number from 0 to 255, and an optional `channel` of
|
|
|
829
833
|
- Auto-dedent applies only after `endnamespace`.
|
|
830
834
|
- One file per session: there are no tabs or split editors.
|
|
831
835
|
- Tabs are drawn four columns wide.
|
|
832
|
-
- CodecQL's Windows Backspace / Ctrl+Backspace are intentionally inverted relative to POSIX.
|
|
833
836
|
|
|
834
837
|
## CodecQLX — the desktop editor
|
|
835
838
|
|
|
@@ -875,6 +878,12 @@ the `chemql` package cannot be imported.
|
|
|
875
878
|
- Dark and light themes, font settings, autocomplete/minimap toggles, and
|
|
876
879
|
per-token color preferences
|
|
877
880
|
|
|
881
|
+
When enabled, CodecQLX prefers an installed programming font with ligature
|
|
882
|
+
support (such as Fira Code, JetBrains Mono, or Cascadia Code) over its default
|
|
883
|
+
monospace font. Install a ligature font on your system; the native Tk text
|
|
884
|
+
renderer and font must support shaping for ligature glyphs to appear. A custom
|
|
885
|
+
font family selected in **Preferences > General** is kept as-is.
|
|
886
|
+
|
|
878
887
|
Use **View** to toggle the file tree, Chemistry panel, and bottom panels.
|
|
879
888
|
Enable **View > Split Editor**, then choose **File > Open File in Other Pane**
|
|
880
889
|
to work with a second file side by side. Close all tabs in the second pane
|
|
@@ -6,9 +6,9 @@ ChemQL is a small language for querying, computing with, and simulating chemistr
|
|
|
6
6
|
|
|
7
7
|
- **Distribution name:** `chemql-python`
|
|
8
8
|
- **Import / CLI name:** `chemql`
|
|
9
|
-
- **Language version:** `1.6.
|
|
10
|
-
- **Editor version:** `codecql 0.1.
|
|
11
|
-
- **GUI Editor version:** `CodecQLX 1.1.
|
|
9
|
+
- **Language version:** `1.6.11` (per `chemql.__version__`)
|
|
10
|
+
- **Editor version:** `codecql 0.1.2`
|
|
11
|
+
- **GUI Editor version:** `CodecQLX 1.1.1`
|
|
12
12
|
- **Python import / CLI name:** `chemql`
|
|
13
13
|
- **Author:** Mohammad Rakibul Islam
|
|
14
14
|
- **Minimum Python:** **3.12+** (verified with `vermin`)
|
|
@@ -462,7 +462,7 @@ ls
|
|
|
462
462
|
|
|
463
463
|
| | |
|
|
464
464
|
|---|---|
|
|
465
|
-
| Version | 0.1.
|
|
465
|
+
| Version | 0.1.2 |
|
|
466
466
|
| Ships with | `chemql-python` |
|
|
467
467
|
| Files | `.cql` (ChemQL), `.py`, `cqlpackage.json` / `cqlpackage.toml`, and any plain-text file |
|
|
468
468
|
|
|
@@ -502,12 +502,16 @@ Opening a path that does not exist starts an empty buffer; it is created on the
|
|
|
502
502
|
| `Ctrl` + `↑` `↓` | Scroll the view without moving the text |
|
|
503
503
|
| `Backspace`, `Delete` | Delete a character, or the selection |
|
|
504
504
|
| `Ctrl+Backspace` / `Alt+Backspace` | Delete the word to the left |
|
|
505
|
+
| `Command+Backspace` (macOS, when sent as CSI-u) | Delete to the start of the line |
|
|
505
506
|
| `Ctrl+Delete` / `Alt+Delete` | Delete the word to the right |
|
|
506
507
|
| `Ctrl+C` / `Ctrl+Insert` | Copy the selection (editor + system clipboard when available). It does **not** quit |
|
|
507
508
|
| `Ctrl+X` | Cut the selection |
|
|
508
509
|
| `Ctrl+V` / `Shift+Insert` | Paste the editor's clipboard |
|
|
509
510
|
|
|
510
|
-
Pasting from your terminal or OS clipboard also works: CodecQL enables bracketed paste, so
|
|
511
|
+
Pasting from your terminal or OS clipboard also works: CodecQL enables bracketed paste, so
|
|
512
|
+
multi-line pastes arrive as a single insertion. The terminal must forward macOS Command-key
|
|
513
|
+
combinations using the CSI-u keyboard protocol; otherwise it may consume or remap them before
|
|
514
|
+
CodecQL receives them.
|
|
511
515
|
|
|
512
516
|
**Auto-indent.** After a line that opens a block (`func`, `define NAME{}`, `struct`, `record`, `enum`, `namespace`, `if`, `elif`, `else`, `for`, `while`) or ends in a `\` continuation, the next line is indented with a tab. Pressing Enter after `endnamespace` removes one level of indentation. Other `end...` keywords do not dedent automatically.
|
|
513
517
|
|
|
@@ -815,7 +819,6 @@ Each entry needs an `ansi256` number from 0 to 255, and an optional `channel` of
|
|
|
815
819
|
- Auto-dedent applies only after `endnamespace`.
|
|
816
820
|
- One file per session: there are no tabs or split editors.
|
|
817
821
|
- Tabs are drawn four columns wide.
|
|
818
|
-
- CodecQL's Windows Backspace / Ctrl+Backspace are intentionally inverted relative to POSIX.
|
|
819
822
|
|
|
820
823
|
## CodecQLX — the desktop editor
|
|
821
824
|
|
|
@@ -861,6 +864,12 @@ the `chemql` package cannot be imported.
|
|
|
861
864
|
- Dark and light themes, font settings, autocomplete/minimap toggles, and
|
|
862
865
|
per-token color preferences
|
|
863
866
|
|
|
867
|
+
When enabled, CodecQLX prefers an installed programming font with ligature
|
|
868
|
+
support (such as Fira Code, JetBrains Mono, or Cascadia Code) over its default
|
|
869
|
+
monospace font. Install a ligature font on your system; the native Tk text
|
|
870
|
+
renderer and font must support shaping for ligature glyphs to appear. A custom
|
|
871
|
+
font family selected in **Preferences > General** is kept as-is.
|
|
872
|
+
|
|
864
873
|
Use **View** to toggle the file tree, Chemistry panel, and bottom panels.
|
|
865
874
|
Enable **View > Split Editor**, then choose **File > Open File in Other Pane**
|
|
866
875
|
to work with a second file side by side. Close all tabs in the second pane
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "chemql-python"
|
|
7
|
-
version = "1.6.
|
|
7
|
+
version = "1.6.11"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "Mohammad Rakibul Islam", email = "rakibulofficial1017@gmail.com" }
|
|
10
10
|
]
|
|
@@ -34,6 +34,7 @@ where = ["src"]
|
|
|
34
34
|
chemql = [
|
|
35
35
|
"colors.json",
|
|
36
36
|
"logo64.png",
|
|
37
|
+
"logo64-macos.png",
|
|
37
38
|
"highlighting.json",
|
|
38
39
|
"data/*.json",
|
|
39
40
|
"data/THIRD_PARTY_LICENSES/*.txt",
|
|
@@ -69,7 +69,7 @@ __all__ = [
|
|
|
69
69
|
"__version__"
|
|
70
70
|
]
|
|
71
71
|
|
|
72
|
-
__version__ = "1.6.
|
|
72
|
+
__version__ = "1.6.11"
|
|
73
73
|
|
|
74
74
|
# Persistent preprocessor/function state for the current ChemQL session.
|
|
75
75
|
DEFINITIONS = {}
|
|
@@ -3985,8 +3985,28 @@ def interpolate_query(text):
|
|
|
3985
3985
|
"""Evaluate [Python] expressions inside a query."""
|
|
3986
3986
|
result = []
|
|
3987
3987
|
i = 0
|
|
3988
|
+
quote = None
|
|
3989
|
+
escaped = False
|
|
3988
3990
|
|
|
3989
3991
|
while i < len(text):
|
|
3992
|
+
if quote is not None:
|
|
3993
|
+
char = text[i]
|
|
3994
|
+
result.append(char)
|
|
3995
|
+
if escaped:
|
|
3996
|
+
escaped = False
|
|
3997
|
+
elif char == "\\":
|
|
3998
|
+
escaped = True
|
|
3999
|
+
elif char == quote:
|
|
4000
|
+
quote = None
|
|
4001
|
+
i += 1
|
|
4002
|
+
continue
|
|
4003
|
+
|
|
4004
|
+
if text[i] in ("'", '"'):
|
|
4005
|
+
quote = text[i]
|
|
4006
|
+
result.append(text[i])
|
|
4007
|
+
i += 1
|
|
4008
|
+
continue
|
|
4009
|
+
|
|
3990
4010
|
if text[i] == "[":
|
|
3991
4011
|
end = find_matching(text, i, "[", "]")
|
|
3992
4012
|
code = text[i + 1:end]
|
|
@@ -11,7 +11,7 @@ import subprocess
|
|
|
11
11
|
import time
|
|
12
12
|
from .highlighting import HighlightProfiles
|
|
13
13
|
|
|
14
|
-
VERSION = "0.1.
|
|
14
|
+
VERSION = "0.1.2"
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def _write_system_clipboard(text):
|
|
@@ -134,6 +134,8 @@ def _decode_escape_sequence(sequence):
|
|
|
134
134
|
modifiers.append("alt")
|
|
135
135
|
if modifier_bits & 1:
|
|
136
136
|
modifiers.append("shift")
|
|
137
|
+
if modifier_bits & 8:
|
|
138
|
+
modifiers.append("super")
|
|
137
139
|
|
|
138
140
|
arrow_keys = {
|
|
139
141
|
b"A": "arrow_up", b"B": "arrow_down",
|
|
@@ -175,6 +177,15 @@ def _decode_escape_sequence(sequence):
|
|
|
175
177
|
return "\x1b"
|
|
176
178
|
|
|
177
179
|
|
|
180
|
+
def _decode_backspace_byte(key_byte, erase_char):
|
|
181
|
+
"""Distinguish plain Backspace from Ctrl+Backspace using the tty erase key."""
|
|
182
|
+
if isinstance(erase_char, int):
|
|
183
|
+
erase_char = bytes((erase_char,))
|
|
184
|
+
if erase_char not in (b"\x08", b"\x7f"):
|
|
185
|
+
erase_char = b"\x7f"
|
|
186
|
+
return "backspace" if key_byte == erase_char else "ctrl+backspace"
|
|
187
|
+
|
|
188
|
+
|
|
178
189
|
def _parse_search_query(query):
|
|
179
190
|
flags = ""
|
|
180
191
|
pattern = query
|
|
@@ -295,6 +306,9 @@ else:
|
|
|
295
306
|
return "alt+" + char
|
|
296
307
|
return "\x1b"
|
|
297
308
|
return "\x1b"
|
|
309
|
+
if first in (b"\x08", b"\x7f"):
|
|
310
|
+
erase_char = old_settings[6][termios.VERASE]
|
|
311
|
+
return _decode_backspace_byte(first, erase_char)
|
|
298
312
|
if not first:
|
|
299
313
|
return ""
|
|
300
314
|
char_length = (
|
|
@@ -1126,18 +1140,18 @@ class Editor:
|
|
|
1126
1140
|
self._scroll_view(-1 if base_key == "arrow_up" else 1)
|
|
1127
1141
|
else:
|
|
1128
1142
|
self._move_cursor(base_key, shift=shift, wordwise=wordwise)
|
|
1129
|
-
elif key in ("\x08", "ctrl+backspace", "alt+backspace"):
|
|
1130
|
-
if
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1143
|
+
elif os.name == "nt" and key in ("\x08", "ctrl+backspace", "alt+backspace"):
|
|
1144
|
+
if not self._delete_selection():
|
|
1145
|
+
self._backspace()
|
|
1146
|
+
elif os.name == "nt" and key == "\x7f":
|
|
1147
|
+
self._delete_word("left")
|
|
1148
|
+
elif key in ("backspace", "\x08", "\x7f"):
|
|
1149
|
+
if not self._delete_selection():
|
|
1150
|
+
self._backspace()
|
|
1151
|
+
elif key in ("ctrl+backspace", "alt+backspace"):
|
|
1152
|
+
self._delete_word("left")
|
|
1153
|
+
elif key in ("super+backspace", "cmd+backspace", "command+backspace"):
|
|
1154
|
+
self._delete_to_line_start()
|
|
1141
1155
|
elif key in ("ctrl+delete", "alt+delete"):
|
|
1142
1156
|
self._delete_word("right")
|
|
1143
1157
|
elif key in ("delete", "\x1b[3~"):
|
|
@@ -1604,6 +1618,17 @@ class Editor:
|
|
|
1604
1618
|
self.dirty = True
|
|
1605
1619
|
self._refresh_search_matches()
|
|
1606
1620
|
|
|
1621
|
+
def _delete_to_line_start(self):
|
|
1622
|
+
if self._delete_selection():
|
|
1623
|
+
return
|
|
1624
|
+
if self.cursor_x == 0:
|
|
1625
|
+
return
|
|
1626
|
+
self._record_history()
|
|
1627
|
+
self.lines[self.cursor_y] = self.lines[self.cursor_y][self.cursor_x:]
|
|
1628
|
+
self.cursor_x = 0
|
|
1629
|
+
self.dirty = True
|
|
1630
|
+
self._refresh_search_matches()
|
|
1631
|
+
|
|
1607
1632
|
def _move_cursor(self, direction, shift=False, wordwise=False):
|
|
1608
1633
|
if shift and self.selection_anchor is None:
|
|
1609
1634
|
self.selection_anchor = (self.cursor_x, self.cursor_y)
|
|
@@ -562,10 +562,6 @@ class DiagnosticsEngine:
|
|
|
562
562
|
# colors.json, which the CLI editor owns and which this app must not alter)
|
|
563
563
|
# --------------------------------------------------------------------------
|
|
564
564
|
|
|
565
|
-
DEFAULT_LIGATURES = {
|
|
566
|
-
"<->": "\u21cc", "->": "\u2192", ">=": "\u2265", "<=": "\u2264", "!=": "\u2260",
|
|
567
|
-
}
|
|
568
|
-
|
|
569
565
|
DARK_THEME = {
|
|
570
566
|
"background": "#1e1e1e", "foreground": "#d4d4d4", "gutter": "#858585",
|
|
571
567
|
"gutter_bg": "#252526", "selection": "#264f78", "current_line": "#2a2d2e",
|
|
@@ -41,17 +41,32 @@ from typing import Optional
|
|
|
41
41
|
from . import codecql_gui_core as core
|
|
42
42
|
|
|
43
43
|
APP_TITLE = "CodecQLX"
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _app_icon_path(platform: str) -> Path:
|
|
47
|
+
filename = "logo64-macos.png" if platform == "darwin" else "logo64.png"
|
|
48
|
+
return Path(__file__).resolve().parent / filename
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
APP_ICON = _app_icon_path(sys.platform)
|
|
45
52
|
FONT_MONO_FALLBACKS = ["Consolas", "Menlo", "DejaVu Sans Mono", "Courier New", "monospace"]
|
|
53
|
+
FONT_LIGATURE_FAMILIES = (
|
|
54
|
+
"Fira Code", "JetBrains Mono", "Cascadia Code", "Iosevka",
|
|
55
|
+
"Victor Mono", "Monaspace Neon",
|
|
56
|
+
)
|
|
57
|
+
DEFAULT_FONT_FAMILIES = {"Consolas", "Menlo", "DejaVu Sans Mono"}
|
|
46
58
|
|
|
47
59
|
|
|
48
|
-
def _pick_font_family(preferred: str) -> str:
|
|
60
|
+
def _pick_font_family(preferred: str, ligatures_enabled: bool = True) -> str:
|
|
49
61
|
try:
|
|
50
62
|
import tkinter.font as tkfont
|
|
51
63
|
available = set(tkfont.families())
|
|
52
64
|
except Exception:
|
|
53
65
|
return preferred
|
|
54
|
-
|
|
66
|
+
candidates = [preferred, *FONT_MONO_FALLBACKS]
|
|
67
|
+
if ligatures_enabled and preferred in DEFAULT_FONT_FAMILIES:
|
|
68
|
+
candidates = [*FONT_LIGATURE_FAMILIES, *candidates]
|
|
69
|
+
for candidate in dict.fromkeys(candidates):
|
|
55
70
|
if candidate in available:
|
|
56
71
|
return candidate
|
|
57
72
|
return preferred
|
|
@@ -465,13 +480,11 @@ class EditorTab(ttk.Frame):
|
|
|
465
480
|
for tag in self._all_syntax_tags():
|
|
466
481
|
self.text.tag_remove(tag, "1.0", "end")
|
|
467
482
|
lines = self.get_lines()
|
|
468
|
-
ligatures = self.app.active_ligatures()
|
|
469
483
|
for line_index, line in enumerate(lines, start=1):
|
|
470
484
|
for token in self.app.tokenizer.tokenize_line(line):
|
|
471
485
|
start = f"{line_index}.{token.start}"
|
|
472
486
|
end = f"{line_index}.{token.end}"
|
|
473
487
|
self.text.tag_add(token.tag, start, end)
|
|
474
|
-
self._apply_ligature_display(ligatures)
|
|
475
488
|
self._redraw_gutter()
|
|
476
489
|
self._redraw_ruler()
|
|
477
490
|
|
|
@@ -483,14 +496,6 @@ class EditorTab(ttk.Frame):
|
|
|
483
496
|
for token in self.app.tokenizer.tokenize_line(line):
|
|
484
497
|
self.text.tag_add(token.tag, f"{line_no}.{token.start}", f"{line_no}.{token.end}")
|
|
485
498
|
|
|
486
|
-
def _apply_ligature_display(self, ligatures: dict[str, str]) -> None:
|
|
487
|
-
"""Visual-only: Tkinter can't substitute display glyphs without
|
|
488
|
-
changing the buffer, so ligatures are shown as a highlighted span
|
|
489
|
-
with a tooltip-free hint via the 'operator' tag's own color; a true
|
|
490
|
-
glyph swap would require editing the stored text, which must never
|
|
491
|
-
happen (see settings: ligatures only affect color emphasis here)."""
|
|
492
|
-
return # intentionally a no-op placeholder; see docstring
|
|
493
|
-
|
|
494
499
|
# -- gutter / overview ruler --------------------------------------------
|
|
495
500
|
|
|
496
501
|
def _visible_line_range(self) -> tuple[int, int]:
|
|
@@ -951,7 +956,7 @@ class PreferencesDialog(tk.Toplevel):
|
|
|
951
956
|
ttk.Spinbox(general, from_=8, to=32, textvariable=self.font_size_var, width=5).grid(row=2, column=1, sticky="w")
|
|
952
957
|
|
|
953
958
|
self.ligatures_var = tk.BooleanVar(value=settings.data.get("ligatures_enabled", True))
|
|
954
|
-
ttk.Checkbutton(general, text="
|
|
959
|
+
ttk.Checkbutton(general, text="Prefer a programming font with ligatures when available",
|
|
955
960
|
variable=self.ligatures_var).grid(row=3, column=0, columnspan=3, sticky="w", padx=6, pady=(10, 2))
|
|
956
961
|
self.autocomplete_var = tk.BooleanVar(value=settings.data.get("autocomplete_enabled", True))
|
|
957
962
|
ttk.Checkbutton(general, text="Autocomplete suggestions", variable=self.autocomplete_var).grid(
|
|
@@ -1119,7 +1124,13 @@ class App(tk.Tk):
|
|
|
1119
1124
|
self.suggestion_engine = core.default_suggestion_engine()
|
|
1120
1125
|
self.tokenizer = core.tokenizer_for(self.suggestion_engine, ".cql")
|
|
1121
1126
|
self.bridge = core.ChemQLBridge()
|
|
1122
|
-
self.editor_font = (
|
|
1127
|
+
self.editor_font = (
|
|
1128
|
+
_pick_font_family(
|
|
1129
|
+
self.settings.data["font_family"],
|
|
1130
|
+
self.settings.data.get("ligatures_enabled", True),
|
|
1131
|
+
),
|
|
1132
|
+
self.settings.data["font_size"],
|
|
1133
|
+
)
|
|
1123
1134
|
|
|
1124
1135
|
self._run_proc = None
|
|
1125
1136
|
self._run_queue: "queue.Queue[tuple[str, str]]" = queue.Queue()
|
|
@@ -1443,14 +1454,17 @@ class App(tk.Tk):
|
|
|
1443
1454
|
# -- theming -----------------------------------------------------------
|
|
1444
1455
|
|
|
1445
1456
|
def apply_theme(self) -> None:
|
|
1446
|
-
self.editor_font = (
|
|
1457
|
+
self.editor_font = (
|
|
1458
|
+
_pick_font_family(
|
|
1459
|
+
self.settings.data["font_family"],
|
|
1460
|
+
self.settings.data.get("ligatures_enabled", True),
|
|
1461
|
+
),
|
|
1462
|
+
self.settings.data["font_size"],
|
|
1463
|
+
)
|
|
1447
1464
|
for tab in self._iter_tabs():
|
|
1448
1465
|
tab._configure_tags()
|
|
1449
1466
|
tab.rehighlight_all()
|
|
1450
1467
|
|
|
1451
|
-
def active_ligatures(self) -> dict[str, str]:
|
|
1452
|
-
return core.DEFAULT_LIGATURES if self.settings.data.get("ligatures_enabled", True) else {}
|
|
1453
|
-
|
|
1454
1468
|
def zoom(self, delta: int, reset: bool = False) -> None:
|
|
1455
1469
|
size = 13 if reset else max(8, min(32, self.settings.data["font_size"] + delta))
|
|
1456
1470
|
self.settings.data["font_size"] = size
|
|
@@ -1645,7 +1659,7 @@ def main() -> None:
|
|
|
1645
1659
|
import ctypes
|
|
1646
1660
|
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('chemql.codecqlx.1.0.0')
|
|
1647
1661
|
if len(sys.argv) > 1 and sys.argv[1] in ("--version", "-v"):
|
|
1648
|
-
print("CodecQLX 1.1.
|
|
1662
|
+
print("CodecQLX 1.1.1")
|
|
1649
1663
|
else:
|
|
1650
1664
|
app = App(sys.argv[1:])
|
|
1651
1665
|
app.mainloop()
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.11
|
|
4
4
|
Summary: A chemistry-focused query language and REPL
|
|
5
5
|
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
6
|
Requires-Python: >=3.12
|
|
@@ -20,9 +20,9 @@ ChemQL is a small language for querying, computing with, and simulating chemistr
|
|
|
20
20
|
|
|
21
21
|
- **Distribution name:** `chemql-python`
|
|
22
22
|
- **Import / CLI name:** `chemql`
|
|
23
|
-
- **Language version:** `1.6.
|
|
24
|
-
- **Editor version:** `codecql 0.1.
|
|
25
|
-
- **GUI Editor version:** `CodecQLX 1.1.
|
|
23
|
+
- **Language version:** `1.6.11` (per `chemql.__version__`)
|
|
24
|
+
- **Editor version:** `codecql 0.1.2`
|
|
25
|
+
- **GUI Editor version:** `CodecQLX 1.1.1`
|
|
26
26
|
- **Python import / CLI name:** `chemql`
|
|
27
27
|
- **Author:** Mohammad Rakibul Islam
|
|
28
28
|
- **Minimum Python:** **3.12+** (verified with `vermin`)
|
|
@@ -476,7 +476,7 @@ ls
|
|
|
476
476
|
|
|
477
477
|
| | |
|
|
478
478
|
|---|---|
|
|
479
|
-
| Version | 0.1.
|
|
479
|
+
| Version | 0.1.2 |
|
|
480
480
|
| Ships with | `chemql-python` |
|
|
481
481
|
| Files | `.cql` (ChemQL), `.py`, `cqlpackage.json` / `cqlpackage.toml`, and any plain-text file |
|
|
482
482
|
|
|
@@ -516,12 +516,16 @@ Opening a path that does not exist starts an empty buffer; it is created on the
|
|
|
516
516
|
| `Ctrl` + `↑` `↓` | Scroll the view without moving the text |
|
|
517
517
|
| `Backspace`, `Delete` | Delete a character, or the selection |
|
|
518
518
|
| `Ctrl+Backspace` / `Alt+Backspace` | Delete the word to the left |
|
|
519
|
+
| `Command+Backspace` (macOS, when sent as CSI-u) | Delete to the start of the line |
|
|
519
520
|
| `Ctrl+Delete` / `Alt+Delete` | Delete the word to the right |
|
|
520
521
|
| `Ctrl+C` / `Ctrl+Insert` | Copy the selection (editor + system clipboard when available). It does **not** quit |
|
|
521
522
|
| `Ctrl+X` | Cut the selection |
|
|
522
523
|
| `Ctrl+V` / `Shift+Insert` | Paste the editor's clipboard |
|
|
523
524
|
|
|
524
|
-
Pasting from your terminal or OS clipboard also works: CodecQL enables bracketed paste, so
|
|
525
|
+
Pasting from your terminal or OS clipboard also works: CodecQL enables bracketed paste, so
|
|
526
|
+
multi-line pastes arrive as a single insertion. The terminal must forward macOS Command-key
|
|
527
|
+
combinations using the CSI-u keyboard protocol; otherwise it may consume or remap them before
|
|
528
|
+
CodecQL receives them.
|
|
525
529
|
|
|
526
530
|
**Auto-indent.** After a line that opens a block (`func`, `define NAME{}`, `struct`, `record`, `enum`, `namespace`, `if`, `elif`, `else`, `for`, `while`) or ends in a `\` continuation, the next line is indented with a tab. Pressing Enter after `endnamespace` removes one level of indentation. Other `end...` keywords do not dedent automatically.
|
|
527
531
|
|
|
@@ -829,7 +833,6 @@ Each entry needs an `ansi256` number from 0 to 255, and an optional `channel` of
|
|
|
829
833
|
- Auto-dedent applies only after `endnamespace`.
|
|
830
834
|
- One file per session: there are no tabs or split editors.
|
|
831
835
|
- Tabs are drawn four columns wide.
|
|
832
|
-
- CodecQL's Windows Backspace / Ctrl+Backspace are intentionally inverted relative to POSIX.
|
|
833
836
|
|
|
834
837
|
## CodecQLX — the desktop editor
|
|
835
838
|
|
|
@@ -875,6 +878,12 @@ the `chemql` package cannot be imported.
|
|
|
875
878
|
- Dark and light themes, font settings, autocomplete/minimap toggles, and
|
|
876
879
|
per-token color preferences
|
|
877
880
|
|
|
881
|
+
When enabled, CodecQLX prefers an installed programming font with ligature
|
|
882
|
+
support (such as Fira Code, JetBrains Mono, or Cascadia Code) over its default
|
|
883
|
+
monospace font. Install a ligature font on your system; the native Tk text
|
|
884
|
+
renderer and font must support shaping for ligature glyphs to appear. A custom
|
|
885
|
+
font family selected in **Preferences > General** is kept as-is.
|
|
886
|
+
|
|
878
887
|
Use **View** to toggle the file tree, Chemistry panel, and bottom panels.
|
|
879
888
|
Enable **View > Split Editor**, then choose **File > Open File in Other Pane**
|
|
880
889
|
to work with a second file side by side. Close all tabs in the second pane
|
|
@@ -10,6 +10,7 @@ src/chemql/codecqlx.py
|
|
|
10
10
|
src/chemql/colors.json
|
|
11
11
|
src/chemql/highlighting.json
|
|
12
12
|
src/chemql/highlighting.py
|
|
13
|
+
src/chemql/logo64-macos.png
|
|
13
14
|
src/chemql/logo64.png
|
|
14
15
|
src/chemql/data/BondEnergies.json
|
|
15
16
|
src/chemql/data/MoleculeBonds.json
|
|
@@ -37,6 +38,8 @@ src/chemql_python.egg-info/entry_points.txt
|
|
|
37
38
|
src/chemql_python.egg-info/requires.txt
|
|
38
39
|
src/chemql_python.egg-info/top_level.txt
|
|
39
40
|
tests/test_codecql.py
|
|
41
|
+
tests/test_codecqlx_fonts.py
|
|
42
|
+
tests/test_codecqlx_icon.py
|
|
40
43
|
tests/test_external_molecule_lookup.py
|
|
41
44
|
tests/test_public_api.py
|
|
42
45
|
tests/test_reactions.py
|
|
@@ -103,11 +103,31 @@ def test_ctrl_scroll_clamps_at_document_ends(monkeypatch):
|
|
|
103
103
|
assert editor.cursor_y == 25
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
def
|
|
106
|
+
def test_backspace_variants_have_distinct_delete_behavior():
|
|
107
107
|
editor = codecql.Editor(None)
|
|
108
108
|
editor.lines = ["one two"]
|
|
109
|
-
editor.cursor_x = 0
|
|
109
|
+
editor.cursor_x = len(editor.lines[0])
|
|
110
|
+
|
|
111
|
+
editor.handle_key("backspace")
|
|
112
|
+
assert editor.lines == ["one tw"]
|
|
113
|
+
|
|
114
|
+
editor.lines = ["one two"]
|
|
115
|
+
editor.cursor_x = len(editor.lines[0])
|
|
116
|
+
editor.handle_key("ctrl+backspace")
|
|
117
|
+
assert editor.lines == ["one "]
|
|
118
|
+
|
|
119
|
+
editor.lines = ["one two"]
|
|
120
|
+
editor.cursor_x = len(editor.lines[0])
|
|
121
|
+
editor.handle_key("alt+backspace")
|
|
122
|
+
assert editor.lines == ["one "]
|
|
110
123
|
|
|
124
|
+
editor.lines = ["one two"]
|
|
125
|
+
editor.cursor_x = 4
|
|
126
|
+
editor.handle_key("super+backspace")
|
|
127
|
+
assert editor.lines == ["two"]
|
|
128
|
+
|
|
129
|
+
editor.lines = ["one two"]
|
|
130
|
+
editor.cursor_x = 0
|
|
111
131
|
editor.handle_key("ctrl+delete")
|
|
112
132
|
|
|
113
133
|
assert editor.lines == ["two"]
|
|
@@ -117,16 +137,19 @@ def test_ctrl_backspace_and_delete_remove_words():
|
|
|
117
137
|
|
|
118
138
|
assert editor.lines == ["two"]
|
|
119
139
|
|
|
120
|
-
editor.cursor_x = len(editor.lines[0])
|
|
121
|
-
editor.handle_key("\x08")
|
|
122
|
-
|
|
123
|
-
assert editor.lines == [""]
|
|
124
|
-
|
|
125
140
|
|
|
126
141
|
def test_ctrl_delete_terminal_sequences_are_decoded():
|
|
127
142
|
assert codecql._decode_escape_sequence(b"[3;5~") == "ctrl+delete"
|
|
128
143
|
assert codecql._decode_escape_sequence(b"[27;5;127~") == "ctrl+backspace"
|
|
129
144
|
assert codecql._decode_escape_sequence(b"[127;5u") == "ctrl+backspace"
|
|
145
|
+
assert codecql._decode_escape_sequence(b"[127;9u") == "super+backspace"
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def test_backspace_byte_uses_terminal_erase_setting():
|
|
149
|
+
assert codecql._decode_backspace_byte(b"\x08", b"\x08") == "backspace"
|
|
150
|
+
assert codecql._decode_backspace_byte(b"\x7f", b"\x08") == "ctrl+backspace"
|
|
151
|
+
assert codecql._decode_backspace_byte(b"\x08", b"\x7f") == "ctrl+backspace"
|
|
152
|
+
assert codecql._decode_backspace_byte(b"\x7f", b"\x7f") == "backspace"
|
|
130
153
|
|
|
131
154
|
|
|
132
155
|
def test_search_query_flags_select_regex_case_and_whole_word():
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from tkinter import font
|
|
2
|
+
|
|
3
|
+
from chemql import codecqlx
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_default_font_prefers_ligature_font_when_enabled(monkeypatch):
|
|
7
|
+
monkeypatch.setattr(font, "families", lambda: ("Menlo", "Fira Code"))
|
|
8
|
+
|
|
9
|
+
assert codecqlx._pick_font_family("Menlo", ligatures_enabled=True) == "Fira Code"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_default_font_is_kept_when_ligatures_are_disabled(monkeypatch):
|
|
13
|
+
monkeypatch.setattr(font, "families", lambda: ("Menlo", "Fira Code"))
|
|
14
|
+
|
|
15
|
+
assert codecqlx._pick_font_family("Menlo", ligatures_enabled=False) == "Menlo"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_custom_font_preference_is_not_overridden(monkeypatch):
|
|
19
|
+
monkeypatch.setattr(font, "families", lambda: ("Custom Mono", "Fira Code"))
|
|
20
|
+
|
|
21
|
+
assert codecqlx._pick_font_family("Custom Mono", ligatures_enabled=True) == "Custom Mono"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_missing_ligature_font_falls_back_to_default(monkeypatch):
|
|
25
|
+
monkeypatch.setattr(font, "families", lambda: ("Menlo", "Courier New"))
|
|
26
|
+
|
|
27
|
+
assert codecqlx._pick_font_family("Menlo", ligatures_enabled=True) == "Menlo"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from chemql import codecqlx
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_macos_icon_uses_opaque_png():
|
|
5
|
+
icon = codecqlx._app_icon_path("darwin")
|
|
6
|
+
png = icon.read_bytes()
|
|
7
|
+
|
|
8
|
+
assert icon.name == "logo64-macos.png"
|
|
9
|
+
assert png[:8] == b"\x89PNG\r\n\x1a\n"
|
|
10
|
+
assert png[25] == 2
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_other_platforms_keep_original_icon():
|
|
14
|
+
assert codecqlx._app_icon_path("linux").name == "logo64.png"
|
|
15
|
+
assert codecqlx._app_icon_path("win32").name == "logo64.png"
|
|
@@ -19,6 +19,12 @@ def test_adjacent_function_calls_compose_as_an_expression():
|
|
|
19
19
|
assert chemql.process_inline("int{1}+int{1}") == 2
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def test_python_call_can_print_a_string_containing_an_opening_bracket(capsys):
|
|
23
|
+
chemql.process_inline('print("[")')
|
|
24
|
+
|
|
25
|
+
assert capsys.readouterr().out == "[\n"
|
|
26
|
+
|
|
27
|
+
|
|
22
28
|
def test_function_positional_parameters_interpolate_in_strings(monkeypatch):
|
|
23
29
|
monkeypatch.delitem(chemql.FUNCTIONS, "greet", raising=False)
|
|
24
30
|
monkeypatch.delitem(chemql.python_globals, "greet", raising=False)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chemql_python-1.6.10 → chemql_python-1.6.11}/src/chemql_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|