mirror of
https://github.com/ModOrganizer2/pystubs-generation.git
synced 2026-07-27 14:07:13 -07:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f390a4748 | ||
|
|
afd3751266 | ||
|
|
c813d6e86a | ||
|
|
822dfc161e | ||
|
|
c61c13e469 | ||
|
|
5d99ba470b | ||
|
|
6d48f0504b | ||
|
|
c60d1ac92f | ||
|
|
3f0da6f9a9 | ||
|
|
6e9912d1ef | ||
|
|
2a06eab0a6 | ||
|
|
d477f0849c | ||
|
|
9ca265736f | ||
|
|
3a5afaf690 |
@@ -20,23 +20,15 @@ jobs:
|
||||
pre-build-command: "apt-get update -y && apt-get install -y libgl1-mesa-glx && cp stubs/2.3.0/mobase.pyi docs/mobase.py"
|
||||
docs-folder: "docs/"
|
||||
|
||||
# Publish built docs to gh-pages branch.
|
||||
# ===============================
|
||||
- name: Commit documentation changes
|
||||
run: |
|
||||
git clone https://github.com/Holt59/mo2-pystubs-generation.git --branch gh-pages --single-branch gh-pages
|
||||
cp -r docs/build/html/* gh-pages/
|
||||
cd gh-pages
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add .
|
||||
git commit -m "Update documentation." -a || true
|
||||
# The above command will fail if no changes were present, so we ignore
|
||||
# that.
|
||||
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
- name: Install SSH Client 🔑
|
||||
uses: webfactory/ssh-agent@v0.2.0
|
||||
with:
|
||||
branch: gh-pages
|
||||
directory: gh-pages
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
|
||||
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@3.6.1
|
||||
with:
|
||||
SSH: true
|
||||
REPOSITORY_NAME: ModOrganizer2/python-plugins-doc
|
||||
BRANCH: master
|
||||
FOLDER: docs/build/html
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# This workflows will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
||||
|
||||
name: Upload Python Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Replace string
|
||||
uses: frabert/replace-string-action@v1.1
|
||||
id: version
|
||||
with:
|
||||
string: ${{ github.event.release.tag_name }}
|
||||
pattern: "v?([0-9][.][0-9][.][0-9]).*"
|
||||
replace-with: "$1"
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
- name: Build and publish
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
||||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
||||
run: |
|
||||
cd stubs/setup
|
||||
cp ../${{ steps.version.outputs.replaced }}/mobase.pyi mobase-stubs/__init__.pyi
|
||||
python setup.py sdist bdist_wheel
|
||||
twine upload dist/*
|
||||
+406
-86
File diff suppressed because it is too large
Load Diff
@@ -64,7 +64,10 @@ html_sidebars = {
|
||||
"**": ["globaltoc.html", "relations.html", "sourcelink.html", "searchbox.html"]
|
||||
}
|
||||
|
||||
html_favicon = "mo2.ico"
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ["_static"]
|
||||
html_extra_path = [".nojekyll"]
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -185,7 +185,7 @@ Most of these are pretty simple to understand:
|
||||
enable the plugin. You can also use a plugin setting to allow users to disable
|
||||
your plugins.
|
||||
- ``settings``: Returns the list of settings (that user can modify) for this plugin.
|
||||
Settings can be ``int```, ``bool``, ``str`` or list of ``str``. Here we indicate
|
||||
Settings can be ``int``, ``bool``, ``str`` or list of ``str``. Here we indicate
|
||||
that we have a "enabled" setting that user could use to disable the plugin (and
|
||||
we use it in ``isActive``).
|
||||
|
||||
@@ -198,4 +198,60 @@ a "bug" in ``boost.python``).
|
||||
The ``init`` method is called by MO2 to initialize the plugin. The given argument, ``organizer``,
|
||||
is an instance of :class:`IOrganizer<mobase.IOrganizer>` which is the class used to interface with MO2.
|
||||
Here, we use it in the ``isActive()`` method to retrieve the "enabled" setting for our plugin.
|
||||
See :class:`IOrganizer<mobase.IOrganizer>` for more details.
|
||||
See :class:`IOrganizer<mobase.IOrganizer>` for more details.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
This section contains (links to) examples of MO2 Python plugins.
|
||||
Some of these plugins have been created for educational purpose and are thus very detailed and
|
||||
easy to understand or get started from.
|
||||
|
||||
Tutorial Plugins
|
||||
................
|
||||
|
||||
`This repository <https://github.com/Holt59/modorganizer-python_plugins>`_ contains examples of Python
|
||||
plugins that were written only to help users write their own plugins.
|
||||
If you want to start somewhere, this is the place to go.
|
||||
|
||||
Official Plugins
|
||||
................
|
||||
|
||||
These plugins are (or will be) included in MO2 releases and are usually maintain by some members of
|
||||
the MO2 development teams.
|
||||
These plugins are not as well documented as the ones in the repository above.
|
||||
|
||||
- `Basic Games <https://github.com/ModOrganizer2/modorganizer-basic_games>`_ [``IPluginGame``]
|
||||
This is the meta-plugin for "basic" games. It is a complex
|
||||
plugins and should mostly be investigated if you want to add a game to it.
|
||||
- `FNIS Tool <https://github.com/ModOrganizer2/modorganizer-fnistool>`_ [``IPluginTool``]:
|
||||
Plugin to integrate FNIS into MO2.
|
||||
- `Preview DDS <https://github.com/ModOrganizer2/modorganizer-preview_dds>`_ [``IPluginPreview``]:
|
||||
Plugin to preview DDS files. Quite complex due to the use
|
||||
of OpenGL for display.
|
||||
- `Form 43 Checker <https://github.com/ModOrganizer2/modorganizer-form43_checker>`_ [``IPluginDiagnose``]:
|
||||
Plugin that warn users if there are form 43 ESPs (Skyrim ESPs)
|
||||
enabled when managing a Skyrim SE instance.
|
||||
- `Tool Configurator <https://github.com/ModOrganizer2/modorganizer-tool_configurator>`_ [``IPluginTool``]:
|
||||
Plugin that allows easier modifications of game settings.
|
||||
Mostly contains a complex GUI for managing INI files.
|
||||
- `Script Extender Plugin Checker <https://github.com/ModOrganizer2/modorganizer-script_extender_plugin_checker>`_ [``IPluginDiagnose``]:
|
||||
Plugin that checks Script Extender logs to see
|
||||
if some plugins have failed to load and display information to the user if possible.
|
||||
|
||||
|
||||
Unofficial Plugins
|
||||
..................
|
||||
|
||||
These plugins have been created by developpers for MO2 and are usually distributed on Nexus.
|
||||
|
||||
- `Merge Plugins Hide <https://github.com/deorder/mo2-plugins>`_ [``IPluginTool``]:
|
||||
Hide / unhide plugins that were merged using ``Merge Plugins`` or ``zMerge``.
|
||||
- `OpenMW Exporter <https://github.com/AnyOldName3/ModOrganizer-to-OpenMW>`_ [``IPluginTool``]:
|
||||
A Mod Organizer plugin to export your VFS, plugin selection and load order to OpenMW.
|
||||
- `Orphaned Script Extender Save Deleter <https://github.com/AnyOldName3/modorganizer-orphaned_script_extender_save_deleter>`_ [``IPluginTool``]:
|
||||
Mod Organizer plugin to delete orphaned script extender co-saves.
|
||||
- `Sync Mod Order <https://github.com/deorder/mo2-plugins>`_ [``IPluginTool``]:
|
||||
Synchronize mod order from current profile to another while keeping the (enabled/disabled) state intact.
|
||||
|
||||
*Feel free to open an issue or a pull-request if you want to add your own plugin to the list.*
|
||||
+11
-11
@@ -369,17 +369,6 @@ class Arg:
|
||||
if value is not None and value.startswith("mobase."):
|
||||
value = value[7:]
|
||||
|
||||
# I have issues with inner classes, so we need to prepend manually...
|
||||
# if value.find(".") != -1:
|
||||
# print(value)
|
||||
# parts = value.split(".")
|
||||
# tvalue = ".".join(parts[:-1])
|
||||
# print(" " + tvalue)
|
||||
# for k in MOBASE_REGISTER.objects:
|
||||
# if k != tvalue and k.endswith(tvalue) and k[-len(tvalue) - 1] == ".":
|
||||
# value = "{}.{}".format(k, parts[-1])
|
||||
# print(" " + value)
|
||||
|
||||
return value
|
||||
|
||||
def has_default_value(self) -> bool:
|
||||
@@ -582,6 +571,17 @@ class Class:
|
||||
|
||||
return name
|
||||
|
||||
@property
|
||||
def all_bases(self):
|
||||
"""
|
||||
Returns:
|
||||
All the bases of this class, including bases of bases and so on.
|
||||
"""
|
||||
bases = set(self.bases)
|
||||
for b in self.bases:
|
||||
bases = bases.union(b.all_bases)
|
||||
return bases
|
||||
|
||||
def is_deprecated(self):
|
||||
return self.deprecated
|
||||
|
||||
|
||||
+23
-7
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
from collections import OrderedDict, defaultdict
|
||||
from typing import List, Dict, Any, Tuple, TextIO, Optional, Union, NamedTuple
|
||||
from typing import List, Dict, Any, Tuple, TextIO, Optional, Union, NamedTuple, Set
|
||||
|
||||
from . import logger
|
||||
from . import register
|
||||
@@ -289,6 +289,8 @@ class Settings:
|
||||
else:
|
||||
sname = m.name
|
||||
|
||||
missing_settings: Set[str] = set()
|
||||
|
||||
# If the name is in the settings:
|
||||
if sname in csettings:
|
||||
keys[sname] = True
|
||||
@@ -346,16 +348,22 @@ class Settings:
|
||||
|
||||
# Only warn for "normal" methods:
|
||||
elif not m.name.startswith("__"):
|
||||
logger.warn(
|
||||
"Missing settings for method {}.{}.".format(
|
||||
cls.canonical_name, sname
|
||||
)
|
||||
)
|
||||
missing_settings.add(sname)
|
||||
|
||||
# Remove the deprecated methods:
|
||||
noverloads = 0
|
||||
for m in ms:
|
||||
if m.is_deprecated():
|
||||
overriden: bool = False
|
||||
for bc in cls.all_bases:
|
||||
for bm in bc.methods:
|
||||
if bm.name == "__init__" or bm.name != m.name:
|
||||
continue
|
||||
if len(bm.args) == len(m.args) and all(
|
||||
ba.type == ma.type
|
||||
for ba, ma in zip(bm.args[1:], m.args[1:])
|
||||
):
|
||||
overriden = True
|
||||
if m.is_deprecated() or overriden:
|
||||
cls.methods.remove(m)
|
||||
else:
|
||||
noverloads += 1
|
||||
@@ -363,6 +371,14 @@ class Settings:
|
||||
for m in ms:
|
||||
m.overloads = noverloads > 1
|
||||
|
||||
if noverloads > 0 and missing_settings:
|
||||
for sname in missing_settings:
|
||||
logger.warn(
|
||||
"Missing settings for method {}.{}.".format(
|
||||
cls.canonical_name, sname
|
||||
)
|
||||
)
|
||||
|
||||
# Patch inner classes:
|
||||
for ic in cls.inner_classes:
|
||||
keys[ic.name] = True
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user