moleditpy 5.2.3__tar.gz → 5.3.0__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.
- {moleditpy-5.2.3 → moleditpy-5.3.0}/PKG-INFO +1 -1
- {moleditpy-5.2.3 → moleditpy-5.3.0}/pyproject.toml +1 -1
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/MoleditPy.egg-info/PKG-INFO +1 -1
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/MoleditPy.egg-info/SOURCES.txt +1 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/main.py +60 -2
- moleditpy-5.3.0/src/moleditpy/plugins/plugin_runner.py +180 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/COPYING +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/DISTRIBUTION.md +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/LICENSE +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/LICENSING.md +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/README.md +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/THIRD_PARTY_NOTICES.md +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/setup.cfg +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/MoleditPy.egg-info/dependency_links.txt +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/MoleditPy.egg-info/entry_points.txt +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/MoleditPy.egg-info/requires.txt +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/MoleditPy.egg-info/top_level.txt +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/__init__.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/__main__.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/assets/file_icon.ico +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/assets/icon.icns +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/assets/icon.ico +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/assets/icon.png +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/core/__init__.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/core/formal_charge.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/core/mol_geometry.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/core/molecular_data.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/core/project_validation.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/core/stereo_check.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/plugins/__init__.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/plugins/plugin_interface.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/plugins/plugin_manager.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/plugins/plugin_manager_window.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/__init__.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/about_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/align_plane_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/alignment_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/analysis_window.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/angle_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/app_state.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/atom_item.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/atom_picking.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/base_picking_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/bond_item.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/bond_length_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/calculation_worker.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/chain_mixin.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/chirality_warning_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/color_settings_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/compute_logic.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/constrained_optimization_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/custom_interactor_style.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/custom_qt_interactor.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/dialog_3d_picking_mixin.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/dialog_logic.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/dihedral_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/edit_3d_logic.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/edit_actions_logic.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/export_logic.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/geometry_base_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/io_logic.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/main_window.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/main_window_init.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/menu_utils.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/mirror_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/molecular_scene_handler.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/molecule_scene.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/move_dialog_mixin.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/move_group_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/move_selected_atoms_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/periodic_table_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/planarize_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/plugin_menu_manager.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/preview_molecule.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/sdf_record_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_tabs/__init__.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_tabs/settings_2d_cleanup_tab.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_tabs/settings_2d_tab.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_tabs/settings_3d_tabs.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_tabs/settings_labels_tab.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_tabs/settings_other_tab.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_tabs/settings_tab_base.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/string_importers.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/template_preview_item.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/template_preview_view.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/translation_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/ui_manager.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/user_template_dialog.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/view_3d_logic.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/zoomable_view.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/__init__.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/constants.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/default_settings.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/finite_float.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/hit_radius.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/label_style.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/sdf_records.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/sip_isdeleted_safe.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/suppress_log.py +0 -0
- {moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/utils/system_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MoleditPy
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.3.0
|
|
4
4
|
Summary: A cross-platform, simple, and intuitive molecular structure editor built in Python. It allows 2D molecular drawing and 3D structure visualization. It supports exporting structure files for input to DFT calculation software.
|
|
5
5
|
Author-email: HiroYokoyama <titech.yoko.hiro@gmail.com>
|
|
6
6
|
License-Expression: LGPL-3.0-or-later
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MoleditPy
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.3.0
|
|
4
4
|
Summary: A cross-platform, simple, and intuitive molecular structure editor built in Python. It allows 2D molecular drawing and 3D structure visualization. It supports exporting structure files for input to DFT calculation software.
|
|
5
5
|
Author-email: HiroYokoyama <titech.yoko.hiro@gmail.com>
|
|
6
6
|
License-Expression: LGPL-3.0-or-later
|
|
@@ -28,6 +28,7 @@ src/moleditpy/plugins/__init__.py
|
|
|
28
28
|
src/moleditpy/plugins/plugin_interface.py
|
|
29
29
|
src/moleditpy/plugins/plugin_manager.py
|
|
30
30
|
src/moleditpy/plugins/plugin_manager_window.py
|
|
31
|
+
src/moleditpy/plugins/plugin_runner.py
|
|
31
32
|
src/moleditpy/ui/__init__.py
|
|
32
33
|
src/moleditpy/ui/about_dialog.py
|
|
33
34
|
src/moleditpy/ui/align_plane_dialog.py
|
|
@@ -20,7 +20,7 @@ import sys
|
|
|
20
20
|
import argparse
|
|
21
21
|
import time
|
|
22
22
|
import traceback
|
|
23
|
-
from typing import Any, Dict, Optional, Set
|
|
23
|
+
from typing import Any, Dict, List, Optional, Set, Tuple
|
|
24
24
|
|
|
25
25
|
from .utils.constants import VERSION
|
|
26
26
|
|
|
@@ -241,6 +241,40 @@ def setup_logging() -> None:
|
|
|
241
241
|
sys.excepthook = handle_exception
|
|
242
242
|
|
|
243
243
|
|
|
244
|
+
# Qt options argparse would read as "-r" plus an attached value.
|
|
245
|
+
_QT_OPTIONS_STARTING_WITH_R = ("-reverse",)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def _split_qt_options(argv: List[str]) -> Tuple[List[str], List[str]]:
|
|
249
|
+
"""Set aside Qt options that collide with ``-r``, up to ``-r`` itself.
|
|
250
|
+
|
|
251
|
+
After ``-r NAME`` every argument belongs to the plugin, ``-reverse`` too.
|
|
252
|
+
"""
|
|
253
|
+
ours: List[str] = []
|
|
254
|
+
qt: List[str] = []
|
|
255
|
+
for index, arg in enumerate(argv):
|
|
256
|
+
if arg in ("-r", "--run-plugin"):
|
|
257
|
+
ours.extend(argv[index:])
|
|
258
|
+
break
|
|
259
|
+
(qt if arg in _QT_OPTIONS_STARTING_WITH_R else ours).append(arg)
|
|
260
|
+
return ours, qt
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def _run_plugin_command(args: argparse.Namespace) -> int:
|
|
264
|
+
"""Handle --run-plugin / --list-plugins; no window or QApplication."""
|
|
265
|
+
from .plugins.plugin_runner import list_plugins, run_plugin
|
|
266
|
+
|
|
267
|
+
if args.list_plugins:
|
|
268
|
+
return list_plugins()
|
|
269
|
+
if args.safe:
|
|
270
|
+
print("Error: --safe loads no plugins, so it cannot run one.", file=sys.stderr)
|
|
271
|
+
return 2
|
|
272
|
+
if not args.run_plugin:
|
|
273
|
+
print("Error: --run-plugin needs a plugin name.", file=sys.stderr)
|
|
274
|
+
return 2
|
|
275
|
+
return run_plugin(args.run_plugin[0], args.run_plugin[1:])
|
|
276
|
+
|
|
277
|
+
|
|
244
278
|
def main() -> None:
|
|
245
279
|
"""Parse CLI arguments, configure logging, and launch the GUI."""
|
|
246
280
|
setup_logging()
|
|
@@ -268,13 +302,37 @@ def main() -> None:
|
|
|
268
302
|
metavar="PATH",
|
|
269
303
|
help="Install a plugin from a .py file, .zip, or folder (Headless)",
|
|
270
304
|
)
|
|
305
|
+
parser.add_argument(
|
|
306
|
+
"-r",
|
|
307
|
+
"--run-plugin",
|
|
308
|
+
nargs=argparse.REMAINDER,
|
|
309
|
+
metavar="NAME [ARGS]",
|
|
310
|
+
help="Run a plugin's command line without opening the editor, like "
|
|
311
|
+
"'python -m NAME ARGS'; everything after NAME goes to the plugin",
|
|
312
|
+
)
|
|
313
|
+
parser.add_argument(
|
|
314
|
+
"--list-plugins",
|
|
315
|
+
action="store_true",
|
|
316
|
+
help="List the installed plugins, marking those --run-plugin can run, "
|
|
317
|
+
"then exit",
|
|
318
|
+
)
|
|
271
319
|
# parse_known_args so Qt's own argv flags (e.g. -platform) are passed through
|
|
272
|
-
|
|
320
|
+
argv, qt_options = _split_qt_options(sys.argv[1:])
|
|
321
|
+
args, remaining = parser.parse_known_args(argv)
|
|
322
|
+
remaining += qt_options
|
|
323
|
+
|
|
324
|
+
# Before the banner: a plugin's output may be read by another program
|
|
325
|
+
# (`moleditpy -r job_server status | jq`), so nothing else goes to stdout.
|
|
326
|
+
if args.run_plugin is not None and not args.list_plugins:
|
|
327
|
+
sys.exit(_run_plugin_command(args))
|
|
273
328
|
|
|
274
329
|
print("-----------------------------------------------------")
|
|
275
330
|
print("MoleditPy - A Python-based molecular editing software")
|
|
276
331
|
print("-----------------------------------------------------\n", flush=True)
|
|
277
332
|
|
|
333
|
+
if args.list_plugins:
|
|
334
|
+
sys.exit(_run_plugin_command(args))
|
|
335
|
+
|
|
278
336
|
if args.install_plugin:
|
|
279
337
|
plugin_path = os.path.abspath(args.install_plugin)
|
|
280
338
|
if not os.path.exists(plugin_path):
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
MoleditPy — A Python-based molecular editing software
|
|
6
|
+
|
|
7
|
+
Author: Hiromichi Yokoyama
|
|
8
|
+
License: LGPL-3.0-or-later
|
|
9
|
+
Repo: https://github.com/HiroYokoyama/python_molecular_editor
|
|
10
|
+
DOI: 10.5281/zenodo.17268532
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
# Run a plugin package's ``__main__`` from the command line, without the editor.
|
|
14
|
+
#
|
|
15
|
+
# ``moleditpy --run-plugin NAME ARGS...`` behaves like ``python -m NAME ARGS...``
|
|
16
|
+
# with the plugin's parent folder put on sys.path; the working directory is left
|
|
17
|
+
# alone, so relative paths in ARGS mean what they meant to the caller. A package
|
|
18
|
+
# plugin opts in by shipping a ``__main__.py``. No QApplication or main window
|
|
19
|
+
# is created; the plugin builds whatever it needs, and its exit status becomes
|
|
20
|
+
# the process's.
|
|
21
|
+
|
|
22
|
+
import os
|
|
23
|
+
import runpy
|
|
24
|
+
import sys
|
|
25
|
+
from dataclasses import dataclass
|
|
26
|
+
from typing import Dict, List, Optional, Sequence, TextIO
|
|
27
|
+
|
|
28
|
+
from .plugin_manager import PluginManager
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True)
|
|
32
|
+
class InstalledPlugin:
|
|
33
|
+
"""One plugin found in the plugin folder, read without importing it."""
|
|
34
|
+
|
|
35
|
+
name: str
|
|
36
|
+
path: str
|
|
37
|
+
display_name: str
|
|
38
|
+
version: str
|
|
39
|
+
package: bool
|
|
40
|
+
enabled: bool
|
|
41
|
+
has_main: bool
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def runnable(self) -> bool:
|
|
45
|
+
"""Whether ``--run-plugin`` can run this plugin."""
|
|
46
|
+
return (
|
|
47
|
+
self.package
|
|
48
|
+
and self.enabled
|
|
49
|
+
and self.has_main
|
|
50
|
+
and (self.name.isidentifier())
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def installed_plugins(manager: Optional[PluginManager] = None) -> List[InstalledPlugin]:
|
|
55
|
+
"""Return every installed plugin, the way the editor discovers them.
|
|
56
|
+
|
|
57
|
+
Package plugins (folders with ``__init__.py``) and single-file plugins are
|
|
58
|
+
both included, in and below category folders, enabled or not. Metadata is
|
|
59
|
+
read by parsing, so no plugin code runs.
|
|
60
|
+
"""
|
|
61
|
+
manager = manager or PluginManager()
|
|
62
|
+
found: List[InstalledPlugin] = []
|
|
63
|
+
if not os.path.isdir(manager.plugin_dir):
|
|
64
|
+
return found
|
|
65
|
+
|
|
66
|
+
def add(entry: str, name: str, path: str, package: bool, has_main: bool) -> None:
|
|
67
|
+
info = manager.get_plugin_info_safe(entry, fallback_name=name)
|
|
68
|
+
found.append(
|
|
69
|
+
InstalledPlugin(
|
|
70
|
+
name=name,
|
|
71
|
+
path=path,
|
|
72
|
+
display_name=str(info.get("name", name)),
|
|
73
|
+
version=str(info.get("version", "Unknown")),
|
|
74
|
+
package=package,
|
|
75
|
+
enabled=not manager.is_plugin_disabled(entry),
|
|
76
|
+
has_main=has_main,
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
for root, dirs, files in os.walk(manager.plugin_dir):
|
|
81
|
+
dirs[:] = sorted(
|
|
82
|
+
d for d in dirs if not d.startswith("__") and not d.startswith(".")
|
|
83
|
+
)
|
|
84
|
+
if "__init__.py" in files:
|
|
85
|
+
dirs[:] = []
|
|
86
|
+
add(
|
|
87
|
+
os.path.join(root, "__init__.py"),
|
|
88
|
+
os.path.basename(root),
|
|
89
|
+
root,
|
|
90
|
+
True,
|
|
91
|
+
"__main__.py" in files,
|
|
92
|
+
)
|
|
93
|
+
continue
|
|
94
|
+
for filename in sorted(files):
|
|
95
|
+
if filename.endswith(".py") and not filename.startswith("__"):
|
|
96
|
+
path = os.path.join(root, filename)
|
|
97
|
+
add(path, os.path.splitext(filename)[0], path, False, False)
|
|
98
|
+
return found
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def runnable_plugins(manager: Optional[PluginManager] = None) -> Dict[str, List[str]]:
|
|
102
|
+
"""Map each runnable plugin name to the package folders that provide it.
|
|
103
|
+
|
|
104
|
+
More than one folder under one name is reported, not resolved.
|
|
105
|
+
"""
|
|
106
|
+
runnable: Dict[str, List[str]] = {}
|
|
107
|
+
for plugin in installed_plugins(manager):
|
|
108
|
+
if plugin.runnable:
|
|
109
|
+
runnable.setdefault(plugin.name, []).append(plugin.path)
|
|
110
|
+
return runnable
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def list_plugins(
|
|
114
|
+
manager: Optional[PluginManager] = None, out: Optional[TextIO] = None
|
|
115
|
+
) -> int:
|
|
116
|
+
"""Print every installed plugin and whether it can be run; return 0."""
|
|
117
|
+
manager = manager or PluginManager()
|
|
118
|
+
out = out or sys.stdout
|
|
119
|
+
plugins = installed_plugins(manager)
|
|
120
|
+
print(f"Plugin folder: {manager.plugin_dir}", file=out)
|
|
121
|
+
if not plugins:
|
|
122
|
+
print("No plugins are installed.", file=out)
|
|
123
|
+
return 0
|
|
124
|
+
print("(run: can be started with --run-plugin NAME)\n", file=out)
|
|
125
|
+
for plugin in sorted(plugins, key=lambda p: (p.name.lower(), p.path)):
|
|
126
|
+
flags = []
|
|
127
|
+
if plugin.runnable:
|
|
128
|
+
flags.append("run")
|
|
129
|
+
if not plugin.enabled:
|
|
130
|
+
flags.append("disabled")
|
|
131
|
+
label = f"[{', '.join(flags)}]" if flags else ""
|
|
132
|
+
where = os.path.relpath(plugin.path, manager.plugin_dir)
|
|
133
|
+
print(
|
|
134
|
+
f" {plugin.name:<28} {label:<16} {plugin.display_name} "
|
|
135
|
+
f"{plugin.version} ({where})",
|
|
136
|
+
file=out,
|
|
137
|
+
)
|
|
138
|
+
return 0
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _exit_status(code: object) -> int:
|
|
142
|
+
if code is None:
|
|
143
|
+
return 0
|
|
144
|
+
if isinstance(code, int):
|
|
145
|
+
return code
|
|
146
|
+
print(code, file=sys.stderr)
|
|
147
|
+
return 1
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def run_plugin(
|
|
151
|
+
name: str, argv: Sequence[str], manager: Optional[PluginManager] = None
|
|
152
|
+
) -> int:
|
|
153
|
+
"""Run plugin *name*'s ``__main__`` with *argv* and return its exit status."""
|
|
154
|
+
folders = runnable_plugins(manager).get(name, [])
|
|
155
|
+
if not folders:
|
|
156
|
+
print(
|
|
157
|
+
f"Error: no runnable plugin named '{name}'. A plugin can be run when "
|
|
158
|
+
"it is an enabled package with a __main__.py; see --list-plugins.",
|
|
159
|
+
file=sys.stderr,
|
|
160
|
+
)
|
|
161
|
+
return 2
|
|
162
|
+
if len(folders) > 1:
|
|
163
|
+
print(
|
|
164
|
+
f"Error: more than one plugin is named '{name}':\n "
|
|
165
|
+
+ "\n ".join(folders),
|
|
166
|
+
file=sys.stderr,
|
|
167
|
+
)
|
|
168
|
+
return 2
|
|
169
|
+
|
|
170
|
+
parent = os.path.dirname(folders[0])
|
|
171
|
+
saved_argv, saved_path = sys.argv[:], sys.path[:]
|
|
172
|
+
sys.argv = [name, *argv]
|
|
173
|
+
sys.path.insert(0, parent)
|
|
174
|
+
try:
|
|
175
|
+
runpy.run_module(name, run_name="__main__", alter_sys=True)
|
|
176
|
+
except SystemExit as exit_request:
|
|
177
|
+
return _exit_status(exit_request.code)
|
|
178
|
+
finally:
|
|
179
|
+
sys.argv, sys.path[:] = saved_argv, saved_path
|
|
180
|
+
return 0
|
|
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
|
|
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
|
|
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
|
{moleditpy-5.2.3 → moleditpy-5.3.0}/src/moleditpy/ui/settings_tabs/settings_2d_cleanup_tab.py
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
|
|
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
|