Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update project documentation #46

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/core-project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Project Class

::: staticwordpress.core.project.Project
53 changes: 26 additions & 27 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# staticwordpress
# static-wordpress

Python Package for Converting WordPress Installation to a Static Website.

[![build_Tests](https://github.com/serpwings/static-wordpress/actions/workflows/tests.yml/badge.svg)](https://github.com/serpwings/static-wordpress/actions/workflows/tests.yml)
[![license](https://img.shields.io/pypi/l/staticwordpress.svg?style=flat-square "Project License: GPLv3+")](https://github.com/pleiszenburg/staticwordpress/blob/master/LICENSE)
[![status](https://img.shields.io/pypi/status/staticwordpress.svg?style=flat-square "Project Development Status")](https://github.com/pleiszenburg/staticwordpress/milestone/1)
[![pypi_version](https://img.shields.io/pypi/v/staticwordpress.svg?style=flat-square "Available on PyPi - the Python Package Index")](https://pypi.python.org/pypi/staticwordpress)
[![supported_python_versions](https://img.shields.io/pypi/pyversions/staticwordpress.svg?style=flat-square "Supported Python Version")](https://pypi.python.org/pypi/staticwordpress)

## How to Install staticwordpress?
## How to Install static-wordpress?

### Windows Installer

We provide an ``exe`` file of ``staticwordpress`` for the convenice of users. Please download the latest version from [release section](https://github.com/serpwings/static-wordpress/releases).


### Source Code

- Clone or download this repository to your computer.
Expand All @@ -23,18 +29,27 @@ This package is available at ``pypi`` and you can install it with ``pip install
Once installed, you can implement customized workflows. Here is an example of post processing simply-static-zip file.

```python
import logging

from staticwordpress.core.workflow import Workflow
from staticwordpress.core.constants import SOURCE, HOST

# enable logging for all functions.
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(message)s",
level=logging.DEBUG,
stream=sys.stdout,
)

swp = Workflow()
swp.create_project(
project_name_="simply-static-zip-deploy",
wp_user_=env_wp_user, # your wordpress username
wp_api_token_=env_wp_api_token, # wordpress xml api token
src_url_=env_src_url, # source url where WordPress is hosted
dst_url_=env_dst_url, # destination url where you want to host Static version
output_folder_=env_output, # Output folder location, where all post processed files will be saved
src_type_=SOURCE.ZIP, # Data Source, ZIP works perfectly right with Simply Static WordPress Plugin
output_folder_=env_output, # Output folder location, where processed files will be saved
src_type_=SOURCE.ZIP, # Data Source e.g. ZIP file from Simply Static WordPress Plugin
host_type_=HOST.NETLIFY, # Host, where you want to deplyo your website.
)

Expand All @@ -48,32 +63,16 @@ swp.add_search()

## Documentation

Detailed documentation of all features is available at [staticwordpress documentation](https://serpwings.com/static-wordpress/).

## TODO:

Following tasks need attention. This list is without any priority.

- Base Package
- Translations
- Redirects
- Vercel
- Cloudflare Pages
- others.
- 3rd Party Crawlers
- Process Folder data e.g. Simply Static
- Search
- Use Builint Interace
- Results for paramterized urls
- Dcoumentation
- GUI
- Recent Projects
- Improve Progressbar

Detailed documentation of all features is available at [staticwordpress documentation](https://static-wordpress-docs.netlify.app/).

## Contribute

Pull Requests, Feature Suggestions, and collaborations are welcome.

## ICONS

Icons used in this project are obtained from Google [Fonts Material Symbols](https://fonts.google.com/icons?selected=Material+Symbols+Outlined:search:FILL@0;wght@400;GRAD@0;opsz@24)

## About Us

This work is a collaborative effort of [seowings](https://www.seowings.org/), and [serpwings](https://serpwings.com/).
This work is a collaborative effort of [seowings](https://www.seowings.org/), and [serpwings](https://serpwings.com/).
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ edit_uri: blob/main/docs/
nav:
- Home: index.md
- Tutorial: tutorial.md
- Core:
- Project Class: core-project.md

plugins:
- search
Expand Down
18 changes: 15 additions & 3 deletions src/staticwordpress/gui/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,21 @@ def show_project(self):
pdialog = ProjectDialog(self, self._project, title_="Current Project")
if pdialog.exec_():
self._project = pdialog._project

self._project.save()
self.update_widgets()
self._project.save()
self.update_widgets()
else:
msgBox = QMessageBox(parent=self)
msgBox.setText(f"No Project Available.")
msgBox.addButton(QMessageBox.Ok).setIcon(
QIcon(f"{SHARE_FOLDER_PATH}/icons/ok.svg")
)
msgBox.setWindowIcon(
QIcon(f"{SHARE_FOLDER_PATH}/icons/static-wordpress.svg")
)
msgBox.setTextFormat(Qt.RichText)
msgBox.setWindowTitle("Project Settings")
msgBox.exec()
logging.info("No New Project found.")

@is_project_open
@logging_decorator
Expand Down
18 changes: 15 additions & 3 deletions src/staticwordpress/gui/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
specific language governing rights and limitations under the License.
</LICENSE_BLOCK>
"""

# +++++++++++++++++++++++++++++++++++++++++++++++++++++
# STANDARD LIBARY IMPORTS
# +++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down Expand Up @@ -52,7 +53,6 @@
QMessageBox,
QFileDialog,
QPushButton,
QAction,
)
from PyQt5.QtCore import Qt, QSettings, QSize, QThread
from PyQt5.QtGui import QIcon
Expand All @@ -70,6 +70,7 @@
HOST,
)

from ..core.project import Project
from ..core.utils import is_url_valid
from ..gui.workflow import WorkflowGUI

Expand All @@ -85,10 +86,10 @@ def __init__(self, parent, project_, title_="Project Settings"):
CONFIGS["APPLICATION_NAME"], CONFIGS["APPLICATION_NAME"]
)

self._project = project_
self._bg_thread = QThread(parent=self)
self._bg_worker = WorkflowGUI()

self._project = project_
vertical_layout_project = QVBoxLayout()
groupbox_general_settings = QGroupBox("General Settings")
form_layout_general_settings = QFormLayout()
Expand Down Expand Up @@ -458,7 +459,16 @@ def accept(self) -> None:
Path(self.lineedit_output.text()).is_dir(),
]
):
self._project.create()
logging.info(f"Current Project: {self.lineedit_output.text()} is valid")
logging.info(f"Current Url: {self.lineedit_src_url.text()} is valid")
logging.info(
f"Current Project Path: {self.lineedit_output.text()} is valid"
)

if not self._project.is_open():
self._project = Project()
self._project.create()

self._project.output = Path(self.lineedit_output.text())
self._project.path = Path(f"{self._project.output}/._data/.project.json")
self._project.name = self.lineedit_project_name.text()
Expand Down Expand Up @@ -486,6 +496,8 @@ def accept(self) -> None:
)
return super().accept()
else:
logging.info(f"Current Project Settings are not valid.")

msgBox = QMessageBox(parent=self)
msgBox.setText(
"Cannot start this project.<br>Please check project settings."
Expand Down
Loading