chemql-python 1.6.9__tar.gz → 1.6.10__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.9/src/chemql_python.egg-info → chemql_python-1.6.10}/PKG-INFO +29 -6
- chemql_python-1.6.9/PKG-INFO → chemql_python-1.6.10/README.md +28 -19
- {chemql_python-1.6.9 → chemql_python-1.6.10}/pyproject.toml +2 -2
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/__init__.py +1 -1
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/codecqlx.py +156 -42
- chemql_python-1.6.9/README.md → chemql_python-1.6.10/src/chemql_python.egg-info/PKG-INFO +42 -5
- {chemql_python-1.6.9 → chemql_python-1.6.10}/LICENSE +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/setup.cfg +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/__main__.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/build.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/codecql.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/codecql_gui_core.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/colors.json +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/data/BondEnergies.json +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/data/MoleculeBonds.json +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/data/Molecules.json +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/data/PeriodicTableJSON.json +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/data/Reactions.json +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/highlighting.json +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/highlighting.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/html/periodic_table.html +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/logo64.png +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/README.md +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/collections.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/datetime.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/decimal.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/fractions.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/json.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/math/statistics.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/math.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/pathlib.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/random.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql/stdlib/text.cql +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql_python.egg-info/SOURCES.txt +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql_python.egg-info/dependency_links.txt +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql_python.egg-info/entry_points.txt +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql_python.egg-info/requires.txt +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/src/chemql_python.egg-info/top_level.txt +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/tests/test_codecql.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/tests/test_external_molecule_lookup.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/tests/test_public_api.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/tests/test_reactions.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/tests/test_stdlib.py +0 -0
- {chemql_python-1.6.9 → chemql_python-1.6.10}/tests/test_structured_types.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.10
|
|
4
4
|
Summary: A chemistry-focused query language and REPL
|
|
5
5
|
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Dist: prompt_toolkit>=3.0
|
|
@@ -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.
|
|
23
|
+
- **Language version:** `1.6.10` (per `chemql.__version__`)
|
|
24
24
|
- **Editor version:** `codecql 0.1.1`
|
|
25
|
-
- **GUI Editor version:** `CodecQLX 1.
|
|
25
|
+
- **GUI Editor version:** `CodecQLX 1.1.0`
|
|
26
26
|
- **Python import / CLI name:** `chemql`
|
|
27
27
|
- **Author:** Mohammad Rakibul Islam
|
|
28
28
|
- **Minimum Python:** **3.12+** (verified with `vermin`)
|
|
@@ -44,6 +44,15 @@ Verify:
|
|
|
44
44
|
chemql --version
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
If the `chemql` command is unavailable or fails to start, use
|
|
48
|
+
`python -m chemql` with the same arguments instead:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m chemql --version
|
|
52
|
+
python -m chemql -c 'search elements symbol = "Fe" return name symbol number'
|
|
53
|
+
python -m chemql -f script.cql
|
|
54
|
+
```
|
|
55
|
+
|
|
47
56
|
Python **3.12+** is required. The project's minimum version is checked with [`vermin`](https://github.com/netromdk/vermin).
|
|
48
57
|
|
|
49
58
|
---
|
|
@@ -481,7 +490,9 @@ chemql edit --local-highlighting # edit ./highlighting.json (created as {}
|
|
|
481
490
|
chemql edit --version
|
|
482
491
|
```
|
|
483
492
|
|
|
484
|
-
If
|
|
493
|
+
If the `codecql` command is unavailable or fails to start, run
|
|
494
|
+
`python -m chemql.codecql FILE` instead. It accepts the same options as
|
|
495
|
+
`chemql edit`, including the highlighting configuration options.
|
|
485
496
|
|
|
486
497
|
Opening a path that does not exist starts an empty buffer; it is created on the first save.
|
|
487
498
|
|
|
@@ -834,6 +845,14 @@ python -m chemql.codecqlx FILE_OR_FOLDER ...
|
|
|
834
845
|
codecqlx --version
|
|
835
846
|
```
|
|
836
847
|
|
|
848
|
+
If the `codecqlx` command is unavailable or fails to start, use
|
|
849
|
+
`python -m chemql.codecqlx` with the same arguments:
|
|
850
|
+
|
|
851
|
+
```bash
|
|
852
|
+
python -m chemql.codecqlx FILE_OR_FOLDER ...
|
|
853
|
+
python -m chemql.codecqlx --version
|
|
854
|
+
```
|
|
855
|
+
|
|
837
856
|
Paths are optional. A new empty file is opened when no path is supplied;
|
|
838
857
|
files and folders passed on the command line are opened in the editor. The
|
|
839
858
|
`codecqlx` command is installed with `chemql-python`.
|
|
@@ -847,7 +866,8 @@ the `chemql` package cannot be imported.
|
|
|
847
866
|
|
|
848
867
|
- Syntax highlighting and context-aware autocomplete for `.cql` files
|
|
849
868
|
- Hoverable diagnostics, gutter markers, a Problems panel, and an overview ruler
|
|
850
|
-
- File tree sidebar
|
|
869
|
+
- File tree sidebar, recent files, and multiple editor tabs
|
|
870
|
+
- Side-by-side editor panes for working with different files
|
|
851
871
|
- Query Console that executes ChemQL in-process and displays table or card results
|
|
852
872
|
- Interactive Periodic Table lookup
|
|
853
873
|
- Balance Equation panel
|
|
@@ -856,6 +876,9 @@ the `chemql` package cannot be imported.
|
|
|
856
876
|
per-token color preferences
|
|
857
877
|
|
|
858
878
|
Use **View** to toggle the file tree, Chemistry panel, and bottom panels.
|
|
879
|
+
Enable **View > Split Editor**, then choose **File > Open File in Other Pane**
|
|
880
|
+
to work with a second file side by side. Close all tabs in the second pane
|
|
881
|
+
before turning split view off.
|
|
859
882
|
CodecQLX stores its preferences in `.codecql_gui/settings.json` under the
|
|
860
883
|
user profile (`%APPDATA%` on Windows).
|
|
861
884
|
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: chemql-python
|
|
3
|
-
Version: 1.6.9
|
|
4
|
-
Summary: A chemistry-focused query language and REPL
|
|
5
|
-
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
|
-
Requires-Python: >=3.10
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: prompt_toolkit>=3.0
|
|
10
|
-
Requires-Dist: rich>=13.7
|
|
11
|
-
Provides-Extra: test
|
|
12
|
-
Requires-Dist: pytest>=8.0; extra == "test"
|
|
13
|
-
Dynamic: license-file
|
|
14
|
-
|
|
15
1
|
# ChemQL & CodecQL
|
|
16
2
|
|
|
17
3
|
> A Python-embedded query language and terminal toolchain for chemistry data — with a purpose-built editor, package manager, and standard library.
|
|
@@ -20,9 +6,9 @@ ChemQL is a small language for querying, computing with, and simulating chemistr
|
|
|
20
6
|
|
|
21
7
|
- **Distribution name:** `chemql-python`
|
|
22
8
|
- **Import / CLI name:** `chemql`
|
|
23
|
-
- **Language version:** `1.6.
|
|
9
|
+
- **Language version:** `1.6.10` (per `chemql.__version__`)
|
|
24
10
|
- **Editor version:** `codecql 0.1.1`
|
|
25
|
-
- **GUI Editor version:** `CodecQLX 1.
|
|
11
|
+
- **GUI Editor version:** `CodecQLX 1.1.0`
|
|
26
12
|
- **Python import / CLI name:** `chemql`
|
|
27
13
|
- **Author:** Mohammad Rakibul Islam
|
|
28
14
|
- **Minimum Python:** **3.12+** (verified with `vermin`)
|
|
@@ -44,6 +30,15 @@ Verify:
|
|
|
44
30
|
chemql --version
|
|
45
31
|
```
|
|
46
32
|
|
|
33
|
+
If the `chemql` command is unavailable or fails to start, use
|
|
34
|
+
`python -m chemql` with the same arguments instead:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python -m chemql --version
|
|
38
|
+
python -m chemql -c 'search elements symbol = "Fe" return name symbol number'
|
|
39
|
+
python -m chemql -f script.cql
|
|
40
|
+
```
|
|
41
|
+
|
|
47
42
|
Python **3.12+** is required. The project's minimum version is checked with [`vermin`](https://github.com/netromdk/vermin).
|
|
48
43
|
|
|
49
44
|
---
|
|
@@ -481,7 +476,9 @@ chemql edit --local-highlighting # edit ./highlighting.json (created as {}
|
|
|
481
476
|
chemql edit --version
|
|
482
477
|
```
|
|
483
478
|
|
|
484
|
-
If
|
|
479
|
+
If the `codecql` command is unavailable or fails to start, run
|
|
480
|
+
`python -m chemql.codecql FILE` instead. It accepts the same options as
|
|
481
|
+
`chemql edit`, including the highlighting configuration options.
|
|
485
482
|
|
|
486
483
|
Opening a path that does not exist starts an empty buffer; it is created on the first save.
|
|
487
484
|
|
|
@@ -834,6 +831,14 @@ python -m chemql.codecqlx FILE_OR_FOLDER ...
|
|
|
834
831
|
codecqlx --version
|
|
835
832
|
```
|
|
836
833
|
|
|
834
|
+
If the `codecqlx` command is unavailable or fails to start, use
|
|
835
|
+
`python -m chemql.codecqlx` with the same arguments:
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
python -m chemql.codecqlx FILE_OR_FOLDER ...
|
|
839
|
+
python -m chemql.codecqlx --version
|
|
840
|
+
```
|
|
841
|
+
|
|
837
842
|
Paths are optional. A new empty file is opened when no path is supplied;
|
|
838
843
|
files and folders passed on the command line are opened in the editor. The
|
|
839
844
|
`codecqlx` command is installed with `chemql-python`.
|
|
@@ -847,7 +852,8 @@ the `chemql` package cannot be imported.
|
|
|
847
852
|
|
|
848
853
|
- Syntax highlighting and context-aware autocomplete for `.cql` files
|
|
849
854
|
- Hoverable diagnostics, gutter markers, a Problems panel, and an overview ruler
|
|
850
|
-
- File tree sidebar
|
|
855
|
+
- File tree sidebar, recent files, and multiple editor tabs
|
|
856
|
+
- Side-by-side editor panes for working with different files
|
|
851
857
|
- Query Console that executes ChemQL in-process and displays table or card results
|
|
852
858
|
- Interactive Periodic Table lookup
|
|
853
859
|
- Balance Equation panel
|
|
@@ -856,6 +862,9 @@ the `chemql` package cannot be imported.
|
|
|
856
862
|
per-token color preferences
|
|
857
863
|
|
|
858
864
|
Use **View** to toggle the file tree, Chemistry panel, and bottom panels.
|
|
865
|
+
Enable **View > Split Editor**, then choose **File > Open File in Other Pane**
|
|
866
|
+
to work with a second file side by side. Close all tabs in the second pane
|
|
867
|
+
before turning split view off.
|
|
859
868
|
CodecQLX stores its preferences in `.codecql_gui/settings.json` under the
|
|
860
869
|
user profile (`%APPDATA%` on Windows).
|
|
861
870
|
|
|
@@ -940,4 +949,4 @@ Source code: [rakibulofficial1017/ChemQL](https://github.com/rakibulofficial1017
|
|
|
940
949
|
|
|
941
950
|
For the command reference that matches your installed build, type `help`
|
|
942
951
|
inside ChemQL. Use `list all` to inspect fields available in your
|
|
943
|
-
bundled datasets.
|
|
952
|
+
bundled datasets.
|
|
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "chemql-python"
|
|
7
|
-
version = "1.6.
|
|
7
|
+
version = "1.6.10"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "Mohammad Rakibul Islam", email = "rakibulofficial1017@gmail.com" }
|
|
10
10
|
]
|
|
11
11
|
description = "A chemistry-focused query language and REPL"
|
|
12
12
|
readme = "README.md"
|
|
13
|
-
requires-python = ">=3.
|
|
13
|
+
requires-python = ">=3.12"
|
|
14
14
|
dependencies = [
|
|
15
15
|
"prompt_toolkit>=3.0",
|
|
16
16
|
"rich>=13.7",
|
|
@@ -20,8 +20,9 @@ structurally cannot do:
|
|
|
20
20
|
of hand-editing JSON.
|
|
21
21
|
- An overview ruler (a mini error/warning map down the scrollbar) and
|
|
22
22
|
bookmarks for fast navigation in long files.
|
|
23
|
+
- Recent files and side-by-side panes for working across multiple files.
|
|
23
24
|
|
|
24
|
-
Run with: python
|
|
25
|
+
Run with: python -m chemql.codecqlx [file_or_folder ...]
|
|
25
26
|
Needs only the standard library; chemql-specific panels disable
|
|
26
27
|
themselves gracefully if the `chemql` package isn't installed.
|
|
27
28
|
"""
|
|
@@ -296,6 +297,11 @@ class EditorTab(ttk.Frame):
|
|
|
296
297
|
self.text.bind("<Button-4>", self._on_mousewheel) # Linux scroll up
|
|
297
298
|
self.text.bind("<Button-5>", self._on_mousewheel) # Linux scroll down
|
|
298
299
|
self.text.bind("<Control-MouseWheel>", self._on_ctrl_mousewheel)
|
|
300
|
+
self.text.bind(
|
|
301
|
+
"<FocusIn>",
|
|
302
|
+
lambda _event: self.app.set_active_notebook(self.master),
|
|
303
|
+
add="+",
|
|
304
|
+
)
|
|
299
305
|
self.gutter.bind("<Button-1>", self._on_gutter_click)
|
|
300
306
|
self.ruler.bind("<Button-1>", self._on_ruler_click)
|
|
301
307
|
self.gutter.bind("<Configure>", lambda _e: self._redraw_gutter())
|
|
@@ -611,6 +617,12 @@ class EditorTab(ttk.Frame):
|
|
|
611
617
|
target = filedialog.asksaveasfilename(defaultextension=".cql", filetypes=[("ChemQL", "*.cql"), ("All files", "*.*")])
|
|
612
618
|
if not target:
|
|
613
619
|
return False
|
|
620
|
+
if any(
|
|
621
|
+
tab is not self and tab.path and os.path.abspath(tab.path) == os.path.abspath(target)
|
|
622
|
+
for tab in self.app._iter_tabs()
|
|
623
|
+
):
|
|
624
|
+
messagebox.showerror(APP_TITLE, "That file is already open in another tab.")
|
|
625
|
+
return False
|
|
614
626
|
try:
|
|
615
627
|
Path(target).write_text(self.text.get("1.0", "end-1c"), encoding="utf-8")
|
|
616
628
|
except OSError as error:
|
|
@@ -619,6 +631,7 @@ class EditorTab(ttk.Frame):
|
|
|
619
631
|
self.path = target
|
|
620
632
|
self.mark_clean()
|
|
621
633
|
self.app.settings.remember_file(target)
|
|
634
|
+
self.app.refresh_recent_files()
|
|
622
635
|
self._schedule_diagnostics()
|
|
623
636
|
return True
|
|
624
637
|
|
|
@@ -1121,7 +1134,7 @@ class App(tk.Tk):
|
|
|
1121
1134
|
self.open_folder(path)
|
|
1122
1135
|
elif os.path.isfile(path):
|
|
1123
1136
|
self.open_file(path)
|
|
1124
|
-
if not self.
|
|
1137
|
+
if not self._iter_tabs():
|
|
1125
1138
|
self.new_file()
|
|
1126
1139
|
|
|
1127
1140
|
self.protocol("WM_DELETE_WINDOW", self.on_close)
|
|
@@ -1136,7 +1149,11 @@ class App(tk.Tk):
|
|
|
1136
1149
|
file_menu = tk.Menu(menubar, tearoff=False)
|
|
1137
1150
|
file_menu.add_command(label="New File", command=self.new_file, accelerator="Ctrl+N")
|
|
1138
1151
|
file_menu.add_command(label="Open File...", command=self.open_file_dialog, accelerator="Ctrl+O")
|
|
1152
|
+
file_menu.add_command(label="Open File in Other Pane...", command=self.open_file_in_other_pane)
|
|
1139
1153
|
file_menu.add_command(label="Open Folder...", command=self.open_folder_dialog, accelerator="Ctrl+Shift+O")
|
|
1154
|
+
self.recent_files_menu = tk.Menu(file_menu, tearoff=False)
|
|
1155
|
+
self.recent_files_menu.configure(postcommand=self.refresh_recent_files)
|
|
1156
|
+
file_menu.add_cascade(label="Recent Files", menu=self.recent_files_menu)
|
|
1140
1157
|
file_menu.add_separator()
|
|
1141
1158
|
file_menu.add_command(label="Save", command=self.save_current, accelerator="Ctrl+S")
|
|
1142
1159
|
file_menu.add_command(label="Save As...", command=self.save_current_as, accelerator="Ctrl+Shift+S")
|
|
@@ -1165,9 +1182,11 @@ class App(tk.Tk):
|
|
|
1165
1182
|
self.show_sidebar_var = tk.BooleanVar(value=True)
|
|
1166
1183
|
self.show_right_var = tk.BooleanVar(value=True)
|
|
1167
1184
|
self.show_bottom_var = tk.BooleanVar(value=True)
|
|
1185
|
+
self.split_editor_var = tk.BooleanVar(value=False)
|
|
1168
1186
|
view_menu.add_checkbutton(label="File Tree", variable=self.show_sidebar_var, command=self._toggle_sidebar)
|
|
1169
1187
|
view_menu.add_checkbutton(label="Chemistry Panel", variable=self.show_right_var, command=self._toggle_right_panel)
|
|
1170
1188
|
view_menu.add_checkbutton(label="Bottom Panel", variable=self.show_bottom_var, command=self._toggle_bottom_panel)
|
|
1189
|
+
view_menu.add_checkbutton(label="Split Editor", variable=self.split_editor_var, command=self._toggle_split_editor)
|
|
1171
1190
|
view_menu.add_separator()
|
|
1172
1191
|
view_menu.add_command(label="Zoom In", command=lambda: self.zoom(1), accelerator="Ctrl+=")
|
|
1173
1192
|
view_menu.add_command(label="Zoom Out", command=lambda: self.zoom(-1), accelerator="Ctrl+-")
|
|
@@ -1197,9 +1216,14 @@ class App(tk.Tk):
|
|
|
1197
1216
|
self.center_pane = ttk.PanedWindow(center, orient="vertical")
|
|
1198
1217
|
self.center_pane.pack(fill="both", expand=True)
|
|
1199
1218
|
|
|
1200
|
-
self.
|
|
1201
|
-
self.
|
|
1202
|
-
self.
|
|
1219
|
+
self.editor_pane = ttk.PanedWindow(self.center_pane, orient="horizontal")
|
|
1220
|
+
self.center_pane.add(self.editor_pane, weight=4)
|
|
1221
|
+
self.notebook = ttk.Notebook(self.editor_pane)
|
|
1222
|
+
self.secondary_notebook = ttk.Notebook(self.editor_pane)
|
|
1223
|
+
self._active_notebook = self.notebook
|
|
1224
|
+
self._bind_editor_notebook(self.notebook)
|
|
1225
|
+
self._bind_editor_notebook(self.secondary_notebook)
|
|
1226
|
+
self.editor_pane.add(self.notebook, weight=1)
|
|
1203
1227
|
|
|
1204
1228
|
self.bottom_notebook = ttk.Notebook(self.center_pane)
|
|
1205
1229
|
self.center_pane.add(self.bottom_notebook, weight=1)
|
|
@@ -1248,29 +1272,94 @@ class App(tk.Tk):
|
|
|
1248
1272
|
|
|
1249
1273
|
# -- tab management -----------------------------------------------------
|
|
1250
1274
|
|
|
1275
|
+
def _bind_editor_notebook(self, notebook: ttk.Notebook) -> None:
|
|
1276
|
+
notebook.bind(
|
|
1277
|
+
"<<NotebookTabChanged>>",
|
|
1278
|
+
lambda _event, pane=notebook: self.set_active_notebook(pane),
|
|
1279
|
+
)
|
|
1280
|
+
notebook.bind(
|
|
1281
|
+
"<Button-1>",
|
|
1282
|
+
lambda _event, pane=notebook: self.set_active_notebook(pane),
|
|
1283
|
+
add="+",
|
|
1284
|
+
)
|
|
1285
|
+
|
|
1286
|
+
def set_active_notebook(self, notebook: ttk.Notebook) -> None:
|
|
1287
|
+
self._active_notebook = notebook
|
|
1288
|
+
self.update_status_bar()
|
|
1289
|
+
self.refresh_problems_panel()
|
|
1290
|
+
|
|
1291
|
+
def _iter_tabs(self):
|
|
1292
|
+
for notebook in (self.notebook, self.secondary_notebook):
|
|
1293
|
+
for tab_id in notebook.tabs():
|
|
1294
|
+
yield notebook.nametowidget(tab_id)
|
|
1295
|
+
|
|
1251
1296
|
def current_tab(self) -> Optional[EditorTab]:
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
return
|
|
1257
|
-
|
|
1258
|
-
def new_file(self) -> None:
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1297
|
+
for notebook in (self._active_notebook, self.notebook, self.secondary_notebook):
|
|
1298
|
+
selected = notebook.select()
|
|
1299
|
+
if selected:
|
|
1300
|
+
return notebook.nametowidget(selected)
|
|
1301
|
+
return None
|
|
1302
|
+
|
|
1303
|
+
def new_file(self, in_other_pane: bool = False) -> None:
|
|
1304
|
+
notebook = self.secondary_notebook if in_other_pane else self._active_notebook
|
|
1305
|
+
if in_other_pane:
|
|
1306
|
+
self.split_editor_var.set(True)
|
|
1307
|
+
self._toggle_split_editor()
|
|
1308
|
+
tab = EditorTab(notebook, self, None)
|
|
1309
|
+
notebook.add(tab, text=tab.display_name)
|
|
1310
|
+
notebook.select(tab)
|
|
1311
|
+
self.set_active_notebook(notebook)
|
|
1312
|
+
|
|
1313
|
+
def open_file(self, path: str, in_other_pane: bool = False) -> None:
|
|
1264
1314
|
path = os.path.abspath(path)
|
|
1265
|
-
for
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
self.
|
|
1315
|
+
for notebook in (self.notebook, self.secondary_notebook):
|
|
1316
|
+
for tab_id in notebook.tabs():
|
|
1317
|
+
tab = notebook.nametowidget(tab_id)
|
|
1318
|
+
if tab.path and os.path.abspath(tab.path) == path:
|
|
1319
|
+
notebook.select(tab)
|
|
1320
|
+
self.set_active_notebook(notebook)
|
|
1321
|
+
return
|
|
1322
|
+
notebook = self.secondary_notebook if in_other_pane else self._active_notebook
|
|
1323
|
+
if in_other_pane:
|
|
1324
|
+
self.split_editor_var.set(True)
|
|
1325
|
+
self._toggle_split_editor()
|
|
1326
|
+
tab = EditorTab(notebook, self, path)
|
|
1327
|
+
notebook.add(tab, text=tab.display_name)
|
|
1328
|
+
notebook.select(tab)
|
|
1329
|
+
self.set_active_notebook(notebook)
|
|
1273
1330
|
self.settings.remember_file(path)
|
|
1331
|
+
self.refresh_recent_files()
|
|
1332
|
+
|
|
1333
|
+
def open_file_in_other_pane(self) -> None:
|
|
1334
|
+
path = filedialog.askopenfilename(filetypes=[("ChemQL", "*.cql"), ("All files", "*.*")])
|
|
1335
|
+
if path:
|
|
1336
|
+
self.open_file(path, in_other_pane=True)
|
|
1337
|
+
|
|
1338
|
+
def open_recent_file(self, path: str) -> None:
|
|
1339
|
+
if not os.path.isfile(path):
|
|
1340
|
+
recent_files = self.settings.data.get("recent_files", [])
|
|
1341
|
+
if not isinstance(recent_files, list):
|
|
1342
|
+
recent_files = []
|
|
1343
|
+
self.settings.data["recent_files"] = [item for item in recent_files if item != path]
|
|
1344
|
+
self.settings.save()
|
|
1345
|
+
self.refresh_recent_files()
|
|
1346
|
+
messagebox.showerror(APP_TITLE, f"Recent file no longer exists:\n{path}")
|
|
1347
|
+
return
|
|
1348
|
+
self.open_file(path)
|
|
1349
|
+
|
|
1350
|
+
def refresh_recent_files(self) -> None:
|
|
1351
|
+
menu = self.recent_files_menu
|
|
1352
|
+
menu.delete(0, "end")
|
|
1353
|
+
recent_files = self.settings.data.get("recent_files", [])
|
|
1354
|
+
if not isinstance(recent_files, list):
|
|
1355
|
+
recent_files = []
|
|
1356
|
+
valid_files = [path for path in recent_files if isinstance(path, str)]
|
|
1357
|
+
if not valid_files:
|
|
1358
|
+
menu.add_command(label="No recent files", state="disabled")
|
|
1359
|
+
return
|
|
1360
|
+
for path in valid_files[:12]:
|
|
1361
|
+
label = f"{Path(path).name} - {Path(path).parent}"
|
|
1362
|
+
menu.add_command(label=label, command=lambda item=path: self.open_recent_file(item))
|
|
1274
1363
|
|
|
1275
1364
|
def open_file_dialog(self) -> None:
|
|
1276
1365
|
path = filedialog.askopenfilename(filetypes=[("ChemQL", "*.cql"), ("All files", "*.*")])
|
|
@@ -1292,20 +1381,28 @@ class App(tk.Tk):
|
|
|
1292
1381
|
tab = self.current_tab()
|
|
1293
1382
|
if tab is None:
|
|
1294
1383
|
return
|
|
1384
|
+
notebook = tab.master
|
|
1295
1385
|
if tab.dirty:
|
|
1296
1386
|
answer = messagebox.askyesnocancel(APP_TITLE, f"Save changes to {tab.display_name.lstrip('* ')}?")
|
|
1297
1387
|
if answer is None:
|
|
1298
1388
|
return
|
|
1299
1389
|
if answer and not tab.save():
|
|
1300
1390
|
return
|
|
1301
|
-
|
|
1302
|
-
if
|
|
1391
|
+
notebook.forget(tab)
|
|
1392
|
+
if notebook is self.secondary_notebook and not notebook.tabs():
|
|
1393
|
+
self.split_editor_var.set(False)
|
|
1394
|
+
self._toggle_split_editor()
|
|
1395
|
+
self.set_active_notebook(self.notebook)
|
|
1396
|
+
if not self.notebook.tabs():
|
|
1397
|
+
self.new_file()
|
|
1398
|
+
elif notebook is self.notebook and not notebook.tabs() and not self.secondary_notebook.tabs():
|
|
1303
1399
|
self.new_file()
|
|
1304
1400
|
|
|
1305
1401
|
def refresh_tab_titles(self) -> None:
|
|
1306
|
-
for
|
|
1307
|
-
|
|
1308
|
-
|
|
1402
|
+
for notebook in (self.notebook, self.secondary_notebook):
|
|
1403
|
+
for tab_id in notebook.tabs():
|
|
1404
|
+
tab = notebook.nametowidget(tab_id)
|
|
1405
|
+
notebook.tab(tab_id, text=tab.display_name)
|
|
1309
1406
|
|
|
1310
1407
|
def save_current(self) -> None:
|
|
1311
1408
|
tab = self.current_tab()
|
|
@@ -1328,24 +1425,26 @@ class App(tk.Tk):
|
|
|
1328
1425
|
tab.save(as_path=new_path)
|
|
1329
1426
|
|
|
1330
1427
|
def on_close(self) -> None:
|
|
1331
|
-
for
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1428
|
+
for notebook in (self.notebook, self.secondary_notebook):
|
|
1429
|
+
for tab_id in notebook.tabs():
|
|
1430
|
+
tab = notebook.nametowidget(tab_id)
|
|
1431
|
+
if tab.dirty:
|
|
1432
|
+
notebook.select(tab)
|
|
1433
|
+
self.set_active_notebook(notebook)
|
|
1434
|
+
answer = messagebox.askyesnocancel(APP_TITLE, f"Save changes to {tab.display_name.lstrip('* ')}?")
|
|
1435
|
+
if answer is None:
|
|
1436
|
+
return
|
|
1437
|
+
if answer and not tab.save():
|
|
1438
|
+
return
|
|
1340
1439
|
self.settings.save()
|
|
1341
1440
|
self.destroy()
|
|
1342
1441
|
|
|
1442
|
+
|
|
1343
1443
|
# -- theming -----------------------------------------------------------
|
|
1344
1444
|
|
|
1345
1445
|
def apply_theme(self) -> None:
|
|
1346
1446
|
self.editor_font = (_pick_font_family(self.settings.data["font_family"]), self.settings.data["font_size"])
|
|
1347
|
-
for
|
|
1348
|
-
tab = self.notebook.nametowidget(tab_id)
|
|
1447
|
+
for tab in self._iter_tabs():
|
|
1349
1448
|
tab._configure_tags()
|
|
1350
1449
|
tab.rehighlight_all()
|
|
1351
1450
|
|
|
@@ -1386,6 +1485,21 @@ class App(tk.Tk):
|
|
|
1386
1485
|
if str(self.bottom_notebook) in panes:
|
|
1387
1486
|
self.center_pane.forget(self.bottom_notebook)
|
|
1388
1487
|
|
|
1488
|
+
def _toggle_split_editor(self) -> None:
|
|
1489
|
+
panes = self.editor_pane.panes()
|
|
1490
|
+
if self.split_editor_var.get():
|
|
1491
|
+
if str(self.secondary_notebook) not in panes:
|
|
1492
|
+
self.editor_pane.add(self.secondary_notebook, weight=1)
|
|
1493
|
+
elif self.secondary_notebook.tabs():
|
|
1494
|
+
self.split_editor_var.set(True)
|
|
1495
|
+
messagebox.showinfo(
|
|
1496
|
+
APP_TITLE,
|
|
1497
|
+
"Close the tabs in the other pane before turning split view off.",
|
|
1498
|
+
)
|
|
1499
|
+
elif str(self.secondary_notebook) in panes:
|
|
1500
|
+
self.editor_pane.forget(self.secondary_notebook)
|
|
1501
|
+
self.set_active_notebook(self.notebook)
|
|
1502
|
+
|
|
1389
1503
|
# -- status bar / problems ----------------------------------------------
|
|
1390
1504
|
|
|
1391
1505
|
def update_status_bar(self) -> None:
|
|
@@ -1531,7 +1645,7 @@ def main() -> None:
|
|
|
1531
1645
|
import ctypes
|
|
1532
1646
|
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('chemql.codecqlx.1.0.0')
|
|
1533
1647
|
if len(sys.argv) > 1 and sys.argv[1] in ("--version", "-v"):
|
|
1534
|
-
print("CodecQLX 1.
|
|
1648
|
+
print("CodecQLX 1.1.0")
|
|
1535
1649
|
else:
|
|
1536
1650
|
app = App(sys.argv[1:])
|
|
1537
1651
|
app.mainloop()
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chemql-python
|
|
3
|
+
Version: 1.6.10
|
|
4
|
+
Summary: A chemistry-focused query language and REPL
|
|
5
|
+
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: prompt_toolkit>=3.0
|
|
10
|
+
Requires-Dist: rich>=13.7
|
|
11
|
+
Provides-Extra: test
|
|
12
|
+
Requires-Dist: pytest>=8.0; extra == "test"
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
1
15
|
# ChemQL & CodecQL
|
|
2
16
|
|
|
3
17
|
> A Python-embedded query language and terminal toolchain for chemistry data — with a purpose-built editor, package manager, and standard library.
|
|
@@ -6,9 +20,9 @@ ChemQL is a small language for querying, computing with, and simulating chemistr
|
|
|
6
20
|
|
|
7
21
|
- **Distribution name:** `chemql-python`
|
|
8
22
|
- **Import / CLI name:** `chemql`
|
|
9
|
-
- **Language version:** `1.6.
|
|
23
|
+
- **Language version:** `1.6.10` (per `chemql.__version__`)
|
|
10
24
|
- **Editor version:** `codecql 0.1.1`
|
|
11
|
-
- **GUI Editor version:** `CodecQLX 1.
|
|
25
|
+
- **GUI Editor version:** `CodecQLX 1.1.0`
|
|
12
26
|
- **Python import / CLI name:** `chemql`
|
|
13
27
|
- **Author:** Mohammad Rakibul Islam
|
|
14
28
|
- **Minimum Python:** **3.12+** (verified with `vermin`)
|
|
@@ -30,6 +44,15 @@ Verify:
|
|
|
30
44
|
chemql --version
|
|
31
45
|
```
|
|
32
46
|
|
|
47
|
+
If the `chemql` command is unavailable or fails to start, use
|
|
48
|
+
`python -m chemql` with the same arguments instead:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m chemql --version
|
|
52
|
+
python -m chemql -c 'search elements symbol = "Fe" return name symbol number'
|
|
53
|
+
python -m chemql -f script.cql
|
|
54
|
+
```
|
|
55
|
+
|
|
33
56
|
Python **3.12+** is required. The project's minimum version is checked with [`vermin`](https://github.com/netromdk/vermin).
|
|
34
57
|
|
|
35
58
|
---
|
|
@@ -467,7 +490,9 @@ chemql edit --local-highlighting # edit ./highlighting.json (created as {}
|
|
|
467
490
|
chemql edit --version
|
|
468
491
|
```
|
|
469
492
|
|
|
470
|
-
If
|
|
493
|
+
If the `codecql` command is unavailable or fails to start, run
|
|
494
|
+
`python -m chemql.codecql FILE` instead. It accepts the same options as
|
|
495
|
+
`chemql edit`, including the highlighting configuration options.
|
|
471
496
|
|
|
472
497
|
Opening a path that does not exist starts an empty buffer; it is created on the first save.
|
|
473
498
|
|
|
@@ -820,6 +845,14 @@ python -m chemql.codecqlx FILE_OR_FOLDER ...
|
|
|
820
845
|
codecqlx --version
|
|
821
846
|
```
|
|
822
847
|
|
|
848
|
+
If the `codecqlx` command is unavailable or fails to start, use
|
|
849
|
+
`python -m chemql.codecqlx` with the same arguments:
|
|
850
|
+
|
|
851
|
+
```bash
|
|
852
|
+
python -m chemql.codecqlx FILE_OR_FOLDER ...
|
|
853
|
+
python -m chemql.codecqlx --version
|
|
854
|
+
```
|
|
855
|
+
|
|
823
856
|
Paths are optional. A new empty file is opened when no path is supplied;
|
|
824
857
|
files and folders passed on the command line are opened in the editor. The
|
|
825
858
|
`codecqlx` command is installed with `chemql-python`.
|
|
@@ -833,7 +866,8 @@ the `chemql` package cannot be imported.
|
|
|
833
866
|
|
|
834
867
|
- Syntax highlighting and context-aware autocomplete for `.cql` files
|
|
835
868
|
- Hoverable diagnostics, gutter markers, a Problems panel, and an overview ruler
|
|
836
|
-
- File tree sidebar
|
|
869
|
+
- File tree sidebar, recent files, and multiple editor tabs
|
|
870
|
+
- Side-by-side editor panes for working with different files
|
|
837
871
|
- Query Console that executes ChemQL in-process and displays table or card results
|
|
838
872
|
- Interactive Periodic Table lookup
|
|
839
873
|
- Balance Equation panel
|
|
@@ -842,6 +876,9 @@ the `chemql` package cannot be imported.
|
|
|
842
876
|
per-token color preferences
|
|
843
877
|
|
|
844
878
|
Use **View** to toggle the file tree, Chemistry panel, and bottom panels.
|
|
879
|
+
Enable **View > Split Editor**, then choose **File > Open File in Other Pane**
|
|
880
|
+
to work with a second file side by side. Close all tabs in the second pane
|
|
881
|
+
before turning split view off.
|
|
845
882
|
CodecQLX stores its preferences in `.codecql_gui/settings.json` under the
|
|
846
883
|
user profile (`%APPDATA%` on Windows).
|
|
847
884
|
|
|
@@ -926,4 +963,4 @@ Source code: [rakibulofficial1017/ChemQL](https://github.com/rakibulofficial1017
|
|
|
926
963
|
|
|
927
964
|
For the command reference that matches your installed build, type `help`
|
|
928
965
|
inside ChemQL. Use `list all` to inspect fields available in your
|
|
929
|
-
bundled datasets.
|
|
966
|
+
bundled datasets.
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chemql_python-1.6.9 → chemql_python-1.6.10}/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
|
|
File without changes
|
|
File without changes
|