-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dependency on deephaven-plugin (#2)
- Loading branch information
1 parent
3121f91
commit 3b54869
Showing
5 changed files
with
21 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
__version__ = "0.0.1.dev2" | ||
from deephaven.plugin import Registration | ||
|
||
def register_into(callback): | ||
register_object_types_into(callback) | ||
__version__ = "0.0.1.dev4" | ||
|
||
def register_object_types_into(callback): | ||
from . import figure_type | ||
callback.register_object_type(figure_type.FigureType()) | ||
class MatplotlibRegistration(Registration): | ||
@classmethod | ||
def register_into(cls, callback: Registration.Callback) -> None: | ||
from . import figure_type | ||
callback.register(figure_type.FigureType) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
from io import BytesIO | ||
from matplotlib.figure import Figure | ||
from deephaven.plugin.object import Exporter, ObjectType | ||
|
||
NAME = "matplotlib.figure.Figure" | ||
|
||
class FigureType: | ||
class FigureType(ObjectType): | ||
@property | ||
def name(self) -> str: | ||
return NAME | ||
|
||
def is_type(self, object) -> bool: | ||
return isinstance(object, Figure) | ||
|
||
def to_bytes(self, exporter, figure: Figure) -> bytes: | ||
def to_bytes(self, exporter: Exporter, figure: Figure) -> bytes: | ||
buf = BytesIO() | ||
figure.savefig(buf, format='PNG') | ||
return buf.getvalue() |