Skip to content

Commit

Permalink
Merge pull request #18 from hhannine/dev
Browse files Browse the repository at this point in the history
Merge dev at 1.2.0 to master

- split code into smaller modules
- xdg_config_home compliance for linux
- bezel correction feature rework & bugfix
- KDE scripting improvements
- KDE+XFCE quick switch improvement
- ready package for PyPI + installation with .desktop & icon
- windows installer scripting & release tools
- bug fixes
  • Loading branch information
hhannine authored Dec 20, 2019
2 parents 1f6c390 + 24369ac commit 4486e2f
Show file tree
Hide file tree
Showing 38 changed files with 3,597 additions and 2,694 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__pycache__/
superpaper/__pycache__
build/
dist/
releases/
superpaper.egg-info/
*.spec
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include resources/superpaper.png
include resources/test.png
include profiles/*

83 changes: 58 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,45 +47,78 @@ using the manual offset.

In the above banner photo you can see the PPI and bezel corrections in action. The left one is a 27" 4K display, and the right one is a 25" 1440p display.

## Support
If you find Superpaper useful please consider supporting its development: [Support via PayPal][paypal-superpaper].
### Support
If you find Superpaper useful please consider supporting its development: [Support via PayPal][paypal-superpaper] or [Support via Github Sponsors][github-sponsors]. Github matches your donations done through the sponsorship program!

[paypal-superpaper]: https://www.paypal.me/superpaper/5
[github-sponsors]: https://github.com/sponsors/hhannine

## Installation

### A. Portable releases
For Linux and Windows there are portable stand-alone binary packages available under [releases](https://github.com/hhannine/Superpaper/releases).
These work on a download-and-run basis without additional requirements. Look for the executable "superpaper.exe", or "superpaper" on Linux.

Standalone package for Mac OS X is unfortunately unavailable at this time, but you may look at the alternative way to run Superpaper.
## Installation

### Linux

### B. Run the script
Superpaper is available from PyPI, [here][sp-on-pypi].

You may either clone the repository or download the packaged script under releases. You will need to take care of its dependencies, which are:
[sp-on-pypi]: https://pypi.org/project/superpaper

#### Requirements
- Python 3.5+
- Pillow (or the slower PIL should also work, or on Linux the faster Pillow-SIMD)
- Pillow
- screeninfo
- wxpython (tray applet & slideshow, optional)
- wxpython (tray applet, GUI & slideshow, optional)
- system_hotkey (hotkeys, optional)
- xcffib (dep for system_hotkey)
- xpybutil (dep for system_hotkey)

If you install Superpaper from PyPI, pip will handle everything else other than _wxPython_. It will be easiest to install wxPython from your distribution specific package repository:
#### Arch / Manjaro
```
sudo pacman -S python-wxpython
```
#### Debian / Ubuntu and derivatives
```
sudo apt install python3-wxgtk4.0
```
#### Fedora
```
sudo dnf install python3-wxpython4
```
#### Python wheels (if wxPython4 is not in your standard repositories)
For a few CentOS, Debian, Fedora and Ubuntu flavors there are pre-built wheels so on those you can look at the [instructions](https://wxpython.org/pages/downloads/) to install wxpython through pip, without having to build it as you do when installing directly from PyPI.
#### Installing other dependencies manually:
Install via pip3:
```
pip3 install -U Pillow screeninfo system_hotkey xcffib xpybutil
```
#### Running CLI only
If you are going to run only in CLI mode you will need to install the first two modules in the list:
```
pip3 install -U Pillow screeninfo
```
### Installing Superpaper from PyPI
Once wxPython4 is installed, you can just run:
```
pip3 install -U superpaper
```
This will install an icon and .desktop file for menu entries.

If you are going to run only in CLI mode you will need to install the first three in the list. For full functionality you will of course need to install all of them.
### Windows
For Windows an installer and a portable package are available under [releases](https://github.com/hhannine/superpaper/releases).
These work on a download-and-run basis without additional requirements. In the portable package, look for the executable "superpaper.exe" in the subfolder "superpaper".

One can install these easily via pip3:
If you want to run the cloned repo on Windows, on top of the requirements listed in the Linux section, you will need the "pywin32" module (instead of the xcffib and xpybutil modules). Installation through pip:
```
pip3 install -U Pillow screeninfo wxpython system_hotkey pywin32
```
pip3 install Pillow
pip3 install screeninfo
pip3 install wxpython
pip3 install system_hotkey

### Max OS X
Basic support for OS X has been kept in the script but it has not been tested. If you want to try to run it, best bet would be to install the dependencies through pip:
```
System_hotkey has dependencies: on Linux it needs "xcffib" and "xpybutil" modules, and on Windows it needs "pywin32".
Note that on Linux wxpython needs to be built and even though it is automated via pip, it has its own [dependencies](https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html),
and the build may take some time.
However for a few CentOS, Debian, Fedora and Ubuntu flavors there are pre-built wheels so on those you can look at the [instructions](https://wxpython.org/pages/downloads/) to install wxpython
without having to build it yourself.
pip install -U wxpython Pillow screeninfo
```
and then clone the repository.



## Usage
Expand Down Expand Up @@ -133,8 +166,8 @@ Accepted values and their explanations are:
- offsets
- horizontal,vertical pixel offsets with offsets of different monitors separated by ";"
- bezels
- List of monitor bezel thicknesses in millimeters, floats are accepted, values separated by ";".
- Measure at the edges where monitor sides meet. A possible gap can be included in the values given.
- List of adjacent monitor bezel pairs' thicknesses in millimeters, i.e. "bezel+gap+bezel", floats are accepted, values separated by ";".
- Measure adjacent bezels and add them together with a possible gap to get a combined thickness. One value for 2 monitors, two values for 3 and so on.
- diagonal_inches
- List of monitor diagonals in inches. Used for computing display pixel densities (PPI).
- hotkey
Expand Down
9 changes: 9 additions & 0 deletions pyinstaller_wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
Simple wrapper that makes the module structure of Superpaper
compatible with PyInstaller builds.
"""

from superpaper.superpaper import main

if __name__ == '__main__':
main()
11 changes: 11 additions & 0 deletions readme-setuppy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Some notes on building and uploading PyPI packages

## Building a wheel / sdist
python3 setup.py sdist bdist_wheel

## Checking that twine (pypi tool) passes the built package
twine check dist/*

## Uploading to PyPI
python3 -m twine upload dist/*

2 changes: 2 additions & 0 deletions requirements_cli.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Pillow>=6.0.0
screeninfo>=0.6.1
5 changes: 5 additions & 0 deletions requirements_full_linux.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Pillow>=6.0.0
screeninfo>=0.6.1
system_hotkey>=1.0
xcffib>=0.8.0
xpybutil>=0.0.5
5 changes: 5 additions & 0 deletions requirements_full_windows.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Pillow>=6.0.0
screeninfo>=0.6.1
wxPython>=4.0.4
system_hotkey>=1.0
pywin32
85 changes: 85 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import os
import platform
import sys
from setuptools import setup


def read_version():
with open("superpaper/__version__.py") as verfile:
verlines = verfile.readlines()
for line in verlines:
if "__version__" in line:
ver_str = line.split("=")[1].strip().replace('"',"")
print(ver_str)
return ver_str
print("Version not found, exitting install.")
sys.exit(1)


def test_import(packaname, humanname):
try:
__import__(packaname)
except ImportError:
print("{} import failed; refer to the install instructions.".format(humanname))
sys.exit(1)

if __name__ == "__main__":
test_import("wx", "wxPython")

with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md'),
encoding='utf-8') as f:
long_description = f.read()

setup(
name="superpaper",
version=read_version(),
author="Henri Hänninen",
description="Cross-platform wallpaper manager that focuses on "
"multi-monitor support. Features include ppi corrections, "
"keyboard shortcuts, slideshow.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/hhannine/superpaper",

classifiers=[
# "Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Environment :: X11 Applications",
# "Environment :: Win32",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
# "Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3.5",
"Topic :: Utilities",
],
keywords="dual-monitor multi-monitor wallpaper background manager",
license="MIT",

# python_requires="~=3.5",
install_requires=[
"Pillow>=6.0.0",
"screeninfo>=0.6.1",
"system_hotkey>=1.0.3",
"xcffib>=0.8.0",
"xpybutil>=0.0.5"
],
packages=["superpaper"],
entry_points={
"console_scripts": ["superpaper = superpaper.superpaper:main"]
# "gui_scripts": ["superpaper = superpaper.superpaper:main"] # for possible future windows install support.
},
package_data={
"superpaper": ["resources/superpaper.png",
"resources/test.png",
"profiles/example.profile",
"profiles/example_multi.profile"
]
},
data_files=[
("share/applications", ["superpaper/resources/superpaper.desktop"]),
("share/icons/hicolor/256x256/apps", ["superpaper/resources/superpaper.png"]),
]

)
Loading

0 comments on commit 4486e2f

Please sign in to comment.