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

Package Project for pip install #1

Merged
merged 2 commits into from
Jul 17, 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
4 changes: 2 additions & 2 deletions examples/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import matplotlib
matplotlib.use('module://kivy.garden.matplotlib.backend_kivy')
matplotlib.use('module://kivy_garden.matplotlib.backend_kivy')
from matplotlib.figure import Figure
from numpy import arange, sin, pi
from kivy.app import App

import numpy as np
from kivy.garden.matplotlib.backend_kivyagg import FigureCanvas,\
from kivy_garden.matplotlib.backend_kivyagg import FigureCanvas,\
NavigationToolbar2Kivy
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
Expand Down
2 changes: 1 addition & 1 deletion examples/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np
import matplotlib.pyplot as plt
from kivy.garden.matplotlib.backend_kivyagg import FigureCanvas
from kivy_garden.matplotlib.backend_kivyagg import FigureCanvas


def enter_axes(event):
Expand Down
2 changes: 1 addition & 1 deletion examples/test_plt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# a bar plot with errorbars
import matplotlib
matplotlib.use('module://kivy.garden.matplotlib.backend_kivy')
matplotlib.use('module://kivy_garden.matplotlib.backend_kivy')
#matplotlib.use('Gtk')

import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions __init__.py → kivy_garden/matplotlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from kivy.garden.matplotlib.backend_kivy import FigureCanvasKivy,\
from .backend_kivy import FigureCanvasKivy,\
FigureManagerKivy, RendererKivy,\
GraphicsContextKivy, NavigationToolbar2Kivy,\
MPLKivyApp
from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
from .backend_kivyagg import FigureCanvasKivyAgg

__all__ = (FigureCanvasKivy.__name__, FigureManagerKivy.__name__,
RendererKivy.__name__, GraphicsContextKivy.__name__,
Expand Down
5 changes: 3 additions & 2 deletions backend_kivy.py → kivy_garden/matplotlib/backend_kivy.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ class Show(ShowBase):
'''mainloop needs to be overwritten to define the show() behavior for kivy
framework.
'''
def mainloop(self):
@classmethod
def mainloop(cls):
app = App.get_running_app()
if app is None:
app = MPLKivyApp(figure=my_canvas, toolbar=toolbar)
Expand Down Expand Up @@ -401,7 +402,7 @@ def __init__(self, widget):
self.dpi = widget.figure.dpi
self._markers = {}
# Can be enhanced by using TextToPath matplotlib, textpath.py
self.mathtext_parser = MathTextParser("Bitmap")
self.mathtext_parser = MathTextParser("path")
self.list_goraud_triangles = []
self.clip_rectangles = []
self.labels_inside_plot = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def my_callback(event):
from kivy.base import EventLoop
from kivy.uix.floatlayout import FloatLayout
from kivy.core.image import Image
from kivy.garden.matplotlib.backend_kivy import FigureCanvasKivy,\
from .backend_kivy import FigureCanvasKivy,\
FigureManagerKivy, show, new_figure_manager,\
NavigationToolbar2Kivy

Expand Down Expand Up @@ -152,7 +152,8 @@ class Show(ShowBase):
'''mainloop needs to be overwritten to define the show() behavior for kivy
framework.
'''
def mainloop(self):
@classmethod
def mainloop(cls):
global my_canvas
global toolbar
app = App.get_running_app()
Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[build-system]
requires = ["setuptools >= 40.6.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "kivy_garden.matplotlib"
authors = [ {name = "Kivy", email = "[email protected]"} ]
version = "0.1.0"
description = "Matplotlib backends using kivy"
readme = "README.md"
requires-python = ">=3.8"
keywords = ["Kivy", "kivy-garden"]
license = {text = "MIT"}
classifiers = [
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3",
]

dependencies = ["matplotlib >= 3.0.0"]

[tool.setuptools]
packages = ["kivy_garden.matplotlib"]