Merge branch 'main' into release_0.12
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug Report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: "[BUG]"
|
||||||
|
labels: bug
|
||||||
|
assignees: vkbo
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the Bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behaviour:
|
||||||
|
|
||||||
|
**Expected Behaviour**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
If the error dialog popped up, copy/paste the content here.
|
||||||
|
|
||||||
|
**Additional Context**
|
||||||
|
Add any other context about the problem here.
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
name: Feature Request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: "[FEATURE]"
|
||||||
|
labels: enhancement
|
||||||
|
assignees: vkbo
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
@@ -24,4 +24,4 @@ jobs:
|
|||||||
- name: Check for Syntax Error on Tests
|
- name: Check for Syntax Error on Tests
|
||||||
run: flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics
|
run: flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
- name: Check for Code Style on novelWriter
|
- name: Check for Code Style on novelWriter
|
||||||
run: flake8 nw --count --max-line-length=99 --select E1,E231,E27,E4,E5,E7,E9,W,F --show-source --statistics
|
run: flake8 nw --count --max-line-length=99 --ignore E203,E221,E226,E241,E251,E261,E266,E302,E305 --show-source --statistics
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project leader at issues (at) novelwriter.io. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
When contributing to this repository, please first discuss the change you wish to make via the
|
||||||
|
issue tracker with the owner of this repository before making a change. If you just want to make a
|
||||||
|
minor correction, like fix a typo or similar, feel free to just make a pull request directly.
|
||||||
|
|
||||||
|
There is a code of conduct. Please follow it in all your interactions with the project.
|
||||||
|
|
||||||
|
## Pull Request Process
|
||||||
|
|
||||||
|
1. Make sure your code passes all tests and conforms to the style guide. You can check that the code
|
||||||
|
conforms by running `flake8` from the root of the project folder.
|
||||||
|
2. Please provide a complete description of the changes in the pull request, and a summary that can
|
||||||
|
be copied into the [CHANGELOG](CHANGELOG.md). Remember to reference any issue related by
|
||||||
|
providing the issue number.
|
||||||
|
3. Do not change the version number unless asked to do so. Version numbers are bumped in separate
|
||||||
|
release pull requests by the maintainer.
|
||||||
|
|
||||||
|
## Code of Conduct
|
||||||
|
|
||||||
|
### Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as contributors and maintainers
|
||||||
|
pledge to making participation in our project and our community a harassment-free experience for
|
||||||
|
everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level
|
||||||
|
of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
Please see the [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) file for the full text.
|
||||||
|
|
||||||
|
## Code Style Guide
|
||||||
|
|
||||||
|
The source code of novelWriter broadly follows the [PEP8](https://www.python.org/dev/peps/pep-0008/)
|
||||||
|
style guide , but with a few modifications and exceptions.
|
||||||
|
|
||||||
|
### Linting with flake8
|
||||||
|
|
||||||
|
An excellent tool for checking Python code for errors and coding style is `flake8`.
|
||||||
|
The documentation is available [here](https://flake8.pycqa.org/en/latest/).
|
||||||
|
|
||||||
|
The `setup.cfg` file in the root of this project has the following settings:
|
||||||
|
```conf
|
||||||
|
[flake8]
|
||||||
|
ignore = E203,E221,E226,E241,E251,E261,E266,E302,E305
|
||||||
|
max-line-length = 99
|
||||||
|
exclude = docs/*
|
||||||
|
```
|
||||||
|
|
||||||
|
The command line equivalent, with reporting, is:
|
||||||
|
```bash
|
||||||
|
flake8 . --count --ignore E203,E221,E226,E241,E251,E261,E266,E302,E305 --max-line-length=99 --show-source --statistics
|
||||||
|
```
|
||||||
|
|
||||||
|
Passing this check is required before contributuions are merged into the `main` branch. This is
|
||||||
|
checked automatically when you make a pull request. You can run the `flake8` command locally to
|
||||||
|
check beforehand. The full command will give you a detailed description of the code lines that do
|
||||||
|
not conform to the standard.
|
||||||
|
|
||||||
|
## Ignored Errors
|
||||||
|
|
||||||
|
Some errors are ignored in novelWriter, for various reasons. In addition, novelWriter sues camelCase
|
||||||
|
function and variable names due to this being the standard for the Qt libraries, and also because of
|
||||||
|
the author's personal preferences.
|
||||||
|
|
||||||
|
The reason behind the other ignored error codes are listed below. Many of them are due to PEP8 not
|
||||||
|
permitting column alignment as opposed to many other coding styles. I find them useful in regions of
|
||||||
|
bulk value assignments. There's a reason why tables are more readable than lists. They should be
|
||||||
|
used sparingly though.
|
||||||
|
|
||||||
|
The ignored errors are all `pycodestyle` errors, and they are documented
|
||||||
|
[here](https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes).
|
||||||
|
|
||||||
|
**E203:** whitespace before ‘:’
|
||||||
|
**Reason:** Column alignment. It is natural to align dictionary columns along the `:` character,
|
||||||
|
|
||||||
|
**E221:** multiple spaces before operator
|
||||||
|
**Reason:** Column alignment.
|
||||||
|
|
||||||
|
**E226:** missing whitespace around arithmetic operator
|
||||||
|
**Reason:** This doesn't actually follow the PEP8 recommendation of grouping longer equations by
|
||||||
|
operator precedence like `2*a + 3*b` instead of `a * a + 3 * b`. Generally, don't use spaces around
|
||||||
|
`*`, `/` and `**`, but do use spaces around `+` and `-`. For appending strings, the spaces can be
|
||||||
|
dropped. Don't use the `+` operator for appending multiple strings. Use formatting instead.
|
||||||
|
|
||||||
|
**E241:** multiple spaces after ‘,’
|
||||||
|
**Reason:** Column alignment.
|
||||||
|
|
||||||
|
**E251:** unexpected spaces around keyword / parameter equals
|
||||||
|
**Reason:** Column alignment.
|
||||||
|
|
||||||
|
**E261:** at least two spaces before inline comment
|
||||||
|
**Reason:** With syntax highlighting, this one is meaningless and wastes an extra space.
|
||||||
|
|
||||||
|
**E266:** too many leading ‘#’ for block comment
|
||||||
|
**Reason:** In the source multiple `#`s to indicate importance levels is sometimes used, like
|
||||||
|
markdown headers.
|
||||||
|
|
||||||
|
**E302:** expected 2 blank lines, found 0
|
||||||
|
**Reason:** Applies to classes. Instead, end classes with a comment like `# END Class ClassName` to
|
||||||
|
make it easier to se which class just ended. The double line break is then redundant.
|
||||||
|
|
||||||
|
**E305:** expected 2 blank lines after end of function or class
|
||||||
|
**Reason:** Instead, _always_ end a function with a `return`, preferrably indented at function
|
||||||
|
level. The end of the function is then clear.
|
||||||
@@ -20,6 +20,8 @@ is primarily saved in JSON files.
|
|||||||
|
|
||||||
The full documentation is available at [novelwriter.readthedocs.io](https://novelwriter.readthedocs.io/).
|
The full documentation is available at [novelwriter.readthedocs.io](https://novelwriter.readthedocs.io/).
|
||||||
|
|
||||||
|
The contributing guide is available in [CONTRIBUTING](CONTRIBUTING.md).
|
||||||
|
|
||||||
|
|
||||||
### Note on the Default Branch
|
### Note on the Default Branch
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
# Code Style Guide
|
|
||||||
|
|
||||||
The source code of novelWriter broadly follows the style guide [PEP8](https://www.python.org/dev/peps/pep-0008/), but with a few modifications and exceptions.
|
|
||||||
|
|
||||||
### Source Code Exceptions
|
|
||||||
|
|
||||||
* Methods are camelCase, not underscore based.
|
|
||||||
The reason is partially because of the maintainers personal preference, and partially because that is what Qt5 and PyQt5 uses.
|
|
||||||
The maintainer generally, across multiple programming languages, uses underscores for defining namespaces.
|
|
||||||
* The maximum length of a code line is 99 characters, not 79.
|
|
||||||
The reason for this is that novelWriter is almost entirely made up of classes, meaning nearly all lines of code already have 8 leading spaces.
|
|
||||||
A 79 character limitation is too strict, and causes too many wrapped lines.
|
|
||||||
99 characters is suitable for GitHub diff readability, and therefore the preferred limit.
|
|
||||||
It is also permitted under PEP8 as the maximum.
|
|
||||||
Comments and docstrings should comply with the 72 character limit.
|
|
||||||
* Aligning code with additional spaces is acceptable in those cases where it improves readability.
|
|
||||||
Otherwise, the PEP8 standard should be applied.
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
|
|
||||||
The documentation does not adhere to the 80 character limit either.
|
|
||||||
The standard used in documentation is one line break after each sentence.
|
|
||||||
This is an alternative style that greatly improves readability of diffs as re-wrapping text is not needed when inserting new text in paragraphs.
|
|
||||||
Instead, the diff will show changes to each sentence.
|
|
||||||
@@ -76,6 +76,7 @@ logging.addLevelName(VERBOSE, "VERBOSE")
|
|||||||
def logVerbose(self, message, *args, **kws):
|
def logVerbose(self, message, *args, **kws):
|
||||||
if self.isEnabledFor(VERBOSE):
|
if self.isEnabledFor(VERBOSE):
|
||||||
self._log(VERBOSE, message, args, **kws)
|
self._log(VERBOSE, message, args, **kws)
|
||||||
|
|
||||||
logging.Logger.verbose = logVerbose
|
logging.Logger.verbose = logVerbose
|
||||||
|
|
||||||
# Initiating logging
|
# Initiating logging
|
||||||
|
|||||||
+2
-1
@@ -1402,7 +1402,8 @@ class NWProject():
|
|||||||
try:
|
try:
|
||||||
rmdir(theData)
|
rmdir(theData)
|
||||||
logger.info("Removed folder: %s" % theFolder)
|
logger.info("Removed folder: %s" % theFolder)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
logger.error(str(e))
|
||||||
errList.append("Failed to remove: %s" % theFolder)
|
errList.append("Failed to remove: %s" % theFolder)
|
||||||
|
|
||||||
return errList
|
return errList
|
||||||
|
|||||||
@@ -1068,7 +1068,6 @@ class GuiBuildNovelDocView(QTextBrowser):
|
|||||||
strBuildTime = "Unknown"
|
strBuildTime = "Unknown"
|
||||||
self.theTitle.setText("<b>Build Time:</b> %s" % strBuildTime)
|
self.theTitle.setText("<b>Build Time:</b> %s" % strBuildTime)
|
||||||
|
|
||||||
|
|
||||||
def _updateDocMargins(self):
|
def _updateDocMargins(self):
|
||||||
"""Automatically adjust the header to fill the top of the
|
"""Automatically adjust the header to fill the top of the
|
||||||
document within the viewport.
|
document within the viewport.
|
||||||
|
|||||||
Reference in New Issue
Block a user