diff --git a/CMakeLists.txt b/CMakeLists.txt index 48bbb8c..e10cce9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ PROJECT ( gttk ) ## Package version information. SET ( PKG_NAME ${PROJECT_NAME} ) SET ( PKG_MAJOR_VERSION 0 ) -SET ( PKG_MINOR_VERSION 5 ) +SET ( PKG_MINOR_VERSION 6 ) SET ( PKG_BUILD_VERSION 0 ) SET ( PKG_VERSION "${PKG_MAJOR_VERSION}.${PKG_MINOR_VERSION}" ) SET ( PKG_NAME_VERSION ${PKG_NAME}-${PKG_VERSION} ) diff --git a/README.md b/README.md index 77c79dd..f1a8817 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,18 @@ usage with Python. Simply follow the installation instructions and all required files are installed to the site package directory. ## Installation +Currently, a build process for Linux and Windows is available. If you +would like to use the package on OS X, please let me know so we can +work on a build system. + +### Wheels +Currently, wheels are provided for Windows. The Linux wheels are built +with Travis-CI and are thus not `manylinux` wheels. Therefore, building +yourself is recommended when using Linux (either from the source dist +from PyPI or this repository). Feel free to open an issue if you +encounter any problems building! + +### Linux These instructions are for Ubuntu, Python 3.5 or higher. Any lower version may work, but is not supported. On other distributions, package names may be different. @@ -25,16 +37,47 @@ python -m pip install scikit-build python setup.py install ``` +### Windows (64-bit only) +These instructions assume you have [MSYS2](https://www.msys2.org/) +installed, with the MinGW toolchain. The `setup.py` script will check +the additional build dependencies and install them when required. + +Both the MSYS `bin` directory as well as the MinGW `bin` directory must +be on the `PATH` to run the `setup.py` script. Usually, these folders +are `C:\msys64\usr\bin` and `C:\msys64\mingw64\bin`, but they may differ +for your installation. + +In addition to this, the `setup.py` script expects the `Dependencies` +program found [here](https://github.com/lucasg/Dependencies) to be +installed under `deps/Dependencies.exe` by default. This tool is used +to find all DLL-files necessary to run `gttk` without any external files. + +If you have satisfied all requirements, assuming you want to install +the package *outside* of your MSYS installation: +```bash +# Replace C:\Python with the path to your Python setup +# The MSYS version of Python is on PATH and thus you should use an abspath! +C:\Python\python.exe setup.py install +``` + +The binary distribution of `gttk` will come with all DLL-files known to +be required to run it. These DLL-files are generally available under +their own specific licenses, as covered in the files that are found in +the MSYS directory `/share/licenses`. + ## Usage -Simply import the package, and the theme is loaded automatically. +Simply import the package and instantiate the `GTTK` class. Then the +theme will become available for usage in a `ttk.Style`. ```python import tkinter as tk from tkinter import ttk -import gttk +from gttk import GTTK window = tk.Tk() +gttk = GTTK(window) style = ttk.Style() style.theme_use("gttk") +print(gttk.get_current_theme()) # Prints the active GTK theme ttk.Button(window, text="Destroy", command=window.destroy).pack() window.mainloop() @@ -49,6 +92,30 @@ sys.path = sys.path[2:] import gttk ``` +## Applying themes +Themes are applied in the standard GTK+-2.0 manner: By reading a +resource file. On **Linux**, the GTK libraries that are installed will point +`gttk` in the direction of the globally enabled GTK theme. Currently, +no method for overriding this behaviour is available. + +On **Windows**, the behaviour is a little different. GTK will look for +for the configuration files that point it towards the theme to be loaded +in the files reported by +```python +GTTK.get_default_files() +``` +and themes should be placed in the folder +```python +GTTK.get_themes_directory() +``` + +A method for reliably loading user themes is being researched, but for +now this is the way to go. A `gtkrc` file may for example simply be +```gtkrc +gtk-theme-name = "Yaru" +``` +where `some_path_here/share/themes/Yaru` is a valid GTK theme folder. + ## Screenshots `gttk` should work with any GTK theme you can throw at it, but below are the themes Yaru and Adwaita as examples. @@ -66,7 +133,7 @@ is available only under GNU GPLv3. python-gttk Copyright (c) 2008-2012 Georgios Petasis Copyright (c) 2012 Cheer Xiao -Copyright (c) 2019-2020 Geballin +Copyright (c) 2019-2020 Géballin Copyright (c) 2020 RedFantom This program is free software: you can redistribute it and/or modify diff --git a/setup.py b/setup.py index b956f17..77b4d5e 100644 --- a/setup.py +++ b/setup.py @@ -172,7 +172,7 @@ def copy_to_target(self, target: str): setup( name="gttk", - version="0.1.0", + version="v0.6.0", packages=["gttk"], description="GTK theme for Tkinter/ttk", author="The gttk/tile-gtk/gttk authors",