mirror of
https://github.com/libratbag/piper.git
synced 2026-02-20 07:33:50 -05:00
Add setup.py, use pkg_resources for loading data files
Also converted piper.py from a standalone module into a package, so that we have somewhere for setuptools to put the data files and load them from. Signed-off-by: Dan Callaghan <dcallagh@redhat.com>
This commit is contained in:
committed by
Peter Hutterer
parent
033a4a89a1
commit
7a579f701f
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/piper.egg-info
|
||||
/build
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -2,8 +2,8 @@
|
||||
# vim: set expandtab shiftwidth=4 tabstop=4
|
||||
|
||||
from ratbagd import *
|
||||
import sysconfig
|
||||
import os
|
||||
import pkg_resources
|
||||
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
@@ -70,7 +70,7 @@ class Piper(Gtk.Window):
|
||||
def __init__(self):
|
||||
Gtk.Window.__init__(self, title="Piper")
|
||||
main_window = Gtk.Builder()
|
||||
main_window.add_from_file("piper.ui")
|
||||
main_window.add_from_file(pkg_resources.resource_filename("piper", "piper.ui"))
|
||||
self._builder = main_window;
|
||||
self._signal_ids = []
|
||||
self._initialized = False
|
||||
@@ -90,7 +90,7 @@ class Piper(Gtk.Window):
|
||||
# load the right image
|
||||
svg = self._ratbag_device.svg_path
|
||||
if not os.path.isfile(svg):
|
||||
svg = "404.svg"
|
||||
svg = pkg_resources.resource_filename("piper", "404.svg")
|
||||
img = main_window.get_object("piper-image-device")
|
||||
img.set_from_file(svg)
|
||||
|
||||
30
setup.py
Normal file
30
setup.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name='piper',
|
||||
description='Piper is a GUI interface to ratbagd, the system daemon for configurable mice',
|
||||
version='0.0.1',
|
||||
url='https://github.com/libratbag/piper',
|
||||
license='License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Topic :: Utilities',
|
||||
'Programming Language :: Python :: 3',
|
||||
],
|
||||
keywords='mouse configuration',
|
||||
packages=['piper'],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'piper=piper:main',
|
||||
],
|
||||
},
|
||||
# We require the ratgbagd python bindings but they're currently
|
||||
# installed by autotools and that setuptools unable to find the
|
||||
# dependencies. Once they're installed by setuptools too we can add
|
||||
# the real dependency here, for now you'll need to rely on your
|
||||
# packaging system.
|
||||
#
|
||||
# install_requires=['ratbagd'],
|
||||
package_data={'piper': ['piper.ui', '404.svg']},
|
||||
zip_safe=False,
|
||||
)
|
||||
Reference in New Issue
Block a user