Skip to content

Commit 85fcb2e

Browse files
authored
README image + version check issues (#32)
1 parent ae77762 commit 85fcb2e

16 files changed

+44
-37
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ instance/
7878

7979
# Sphinx documentation
8080
doc/_build/
81+
doc/source/images
8182

8283
# PyBuilder
8384
.pybuilder/

.pre-commit-config.yaml

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
fail_fast: True
2-
31
repos:
42

53
- repo: https://github.com/pycqa/isort
@@ -18,7 +16,7 @@ repos:
1816
rev: 1.13.0
1917
hooks:
2018
- id: blacken-docs
21-
additional_dependencies: [black==22.12.0]
19+
additional_dependencies: [black==23.1.0]
2220

2321
- repo: https://github.com/PyCQA/flake8
2422
rev: 6.0.0
@@ -32,12 +30,12 @@ repos:
3230
args: ["--toml", "pyproject.toml"]
3331
additional_dependencies: ["tomli"]
3432

35-
# - repo: https://github.com/pycqa/pydocstyle
36-
# rev: 6.1.1
37-
# hooks:
38-
# - id: pydocstyle
39-
# additional_dependencies: [toml]
40-
# exclude: "tests/"
33+
- repo: https://github.com/pycqa/pydocstyle
34+
rev: 6.3.0
35+
hooks:
36+
- id: pydocstyle
37+
additional_dependencies: [toml]
38+
exclude: "tests/"
4139

4240
- repo: https://github.com/pre-commit/pre-commit-hooks
4341
rev: v4.4.0

README.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Ansys Python Installer (QT)
44
This is a simple cross-platform `QT <https://www.qt.io/>`_ application
55
you can use to install Python and (optional) PyAnsys packages.
66

7+
.. image:: images/app-image.png
8+
:alt: Screenshot of Python Installer application
79

810
Installation
911
~~~~~~~~~~~~

doc/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ help:
2323
clean:
2424
rm -rf $(BUILDDIR)/*
2525
rm -rf $(SOURCEDIR)/examples
26+
rm -rf $(SOURCEDIR)/images
2627
find . -type d -name "_autosummary" -exec rm -rf {} +
2728

2829
# Create PDF

doc/make.bat

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ goto end
3232

3333
:clean
3434
rmdir /s /q %BUILDDIR% > /NUL 2>&1
35+
rmdir /s /q %SOURCEDIR%\examples > /NUL 2>&1
36+
rmdir /s /q %SOURCEDIR%\images > /NUL 2>&1
3537
for /d /r %SOURCEDIR% %%d in (_autosummary) do @if exist "%%d" rmdir /s /q "%%d"
3638
goto end
3739

doc/source/conf.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Sphinx documentation configuration file."""
22
from datetime import datetime
3+
import shutil
34

45
from ansys_sphinx_theme import pyansys_logo_black as logo
56

@@ -48,7 +49,7 @@
4849
}
4950

5051
# static path
51-
html_static_path = ["_static"]
52+
html_static_path = ["_static", "images"]
5253

5354
# Add any paths that contain templates here, relative to this directory.
5455
templates_path = ["_templates"]
@@ -58,3 +59,6 @@
5859

5960
# The master toctree document.
6061
master_doc = "index"
62+
63+
# Copying README images
64+
shutil.copytree("../../images", "images", dirs_exist_ok=True)

images/app-image.png

81.1 KB
Loading

src/ansys/tools/installer/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
"""
2-
Ansys Python Manager
3-
"""
1+
"""Ansys Python Manager."""
2+
43
import os
54
import sys
65
import warnings

src/ansys/tools/installer/auto_updater.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Check for updates.
3-
"""
1+
"""Check for updates."""
42

53
from github import Github
64
from packaging import version

src/ansys/tools/installer/common.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Common module for Ansys Python Manager."""
2+
13
from functools import wraps
24
import logging
35
import sys
@@ -9,7 +11,7 @@
911

1012

1113
def threaded(fn):
12-
"""Call a function using a thread"""
14+
"""Call a function using a thread."""
1315

1416
def wrapper(*args, **kwargs):
1517
thread = Thread(target=fn, args=args, kwargs=kwargs)
@@ -20,7 +22,7 @@ def wrapper(*args, **kwargs):
2022

2123

2224
def protected(fn):
23-
"""Captures any exceptions from a function and passes it to the gui.
25+
"""Capture any exceptions from a function and pass it to the GUI.
2426
2527
Attempts to display the error using ``show_error`` and protects
2628
the main application from segmentation faulting.

src/ansys/tools/installer/find_python.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
"""
2-
Search for Python or miniforge installations within the Windows registry.
1+
"""Search for Python or miniforge installations within the Windows registry."""
32

4-
"""
53
import logging
64
import os
75

@@ -76,7 +74,6 @@ def _find_miniforge(admin=False):
7674

7775
def _find_installed_python(admin=False):
7876
"""Check the registry for any installed instances of Python."""
79-
8077
if admin:
8178
root_key = winreg.HKEY_LOCAL_MACHINE
8279
else:

src/ansys/tools/installer/installed_table.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Installed Python versions table module for Ansys Python Manager."""
2+
13
import logging
24
import os
35
import subprocess

src/ansys/tools/installer/installer.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
"""
1+
"""Installer module for Ansys Python Manager."""
22

3-
"""
43
import logging
54
import subprocess
65

src/ansys/tools/installer/main.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Main installer window."""
2+
23
import logging
34
from math import floor
45
import os
@@ -51,6 +52,8 @@
5152

5253

5354
class AnsysPythonInstaller(QtWidgets.QMainWindow):
55+
"""Main Ansys Python Manager class."""
56+
5457
signal_error = QtCore.Signal(str)
5558
signal_open_pbar = QtCore.Signal(int, str)
5659
signal_increment_pbar = QtCore.Signal()
@@ -59,6 +62,7 @@ class AnsysPythonInstaller(QtWidgets.QMainWindow):
5962
signal_close = QtCore.Signal()
6063

6164
def __init__(self, show=True):
65+
"""Instantiate Ansys Python Manager main class."""
6266
super().__init__()
6367
self.setWindowTitle("Ansys Python Manager")
6468
self.setGeometry(50, 50, 500, 700) # width should auto-update
@@ -179,11 +183,6 @@ def __init__(self, show=True):
179183
python_version_layout.setContentsMargins(0, 0, 0, 0)
180184
python_version.setLayout(python_version_layout)
181185

182-
# python_version_title = QtWidgets.QLabel("Python Version")
183-
# python_version_layout.addWidget(python_version_title)
184-
185-
# python_version_text = QtWidgets.QLabel("Select one")
186-
187186
self.python_version_select = QtWidgets.QComboBox()
188187
self.python_version_select.addItem("Python 3.7", "3.7.9")
189188
self.python_version_select.addItem("Python 3.8", "3.8.10")
@@ -249,19 +248,19 @@ def _close(self):
249248

250249
@protected
251250
def check_for_updates(self):
251+
"""Check for Ansys Python Manager application updates."""
252252
LOG.debug("Checking for updates")
253253
(
254254
ver,
255255
url,
256256
) = query_gh_latest_release()
257257
cur_ver = version.parse(__version__)
258-
# if ver > cur_ver:
259-
if True:
258+
if ver > cur_ver:
260259
LOG.debug("Update available.")
261260
reply = QtWidgets.QMessageBox.question(
262261
None,
263262
"Update",
264-
f"A new version {ver} is available. You are currently running version {cur_ver}. Do you want to update?",
263+
f"The latest version available is {ver}. You are currently running version {cur_ver}. Do you want to update?",
265264
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
266265
QtWidgets.QMessageBox.Yes,
267266
)
@@ -282,12 +281,14 @@ def check_for_updates(self):
282281
).exec_()
283282

284283
def visit_website(self):
284+
"""Access the Ansys Python Manager documentation."""
285285
url = QtCore.QUrl(
286286
"https://installer.docs.pyansys.com/version/dev/installer.html"
287287
)
288288
QtGui.QDesktopServices.openUrl(url)
289289

290290
def show_about_dialog(self):
291+
"""Display the Ansys Python Manager 'About' information."""
291292
mbox = QtWidgets.QMessageBox.about(self, "About", ABOUT_TEXT)
292293

293294
def _install_type_changed(self, *args):
@@ -316,7 +317,6 @@ def _pbar_increment(self):
316317
def pbar_open(self, nticks=5, label=""):
317318
"""Open the progress bar.
318319
319-
320320
Parameters
321321
----------
322322
nticks : int, default: 5
@@ -535,7 +535,6 @@ def _run_exe(self, filename):
535535

536536
def open_gui():
537537
"""Start the installer as a QT Application."""
538-
539538
import argparse
540539
import ctypes
541540
import msvcrt

src/ansys/tools/installer/misc.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Contains miscellaneous functionalities this library.
3-
"""
1+
"""Contains miscellaneous functionalities this library."""
42

53
import logging
64
import sys

src/ansys/tools/installer/progress_bar.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
"""Progress bar module for Ansys Python Manager."""
2+
13
from PySide6 import QtCore, QtWidgets
24

35

46
class ProgressBar(QtWidgets.QDialog):
7+
"""ProgressBar class."""
8+
59
def __init__(self, parent, nticks, title="Progress Bar", label=None, show=True):
10+
"""Instantiate a ProgressBar object."""
611
super().__init__(parent)
712
self._pbar = QtWidgets.QProgressBar(self)
813
self._pbar.setValue(0)

0 commit comments

Comments
 (0)