Skip to content

Commit

Permalink
updated to use Unicode filenames, and properly close Animation files
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 9e87f6916d17f4657f2de7329bfbebd319bd6496
Author: Adios Automated Script <adios-script@noaa.gov>
Date:   Fri Dec 3 17:24:24 2021 -0800

    updated docstrings and took dev off version number

commit f700aeb
Author: Adios Automated Script <adios-script@noaa.gov>
Date:   Fri Dec 3 17:13:10 2021 -0800

    had cdef function handle exception

commit fe41c41
Author: Adios Automated Script <adios-script@noaa.gov>
Date:   Fri Dec 3 17:01:16 2021 -0800

    added _file_path as a object

commit 0eb67c0
Author: Jay Hennen <jay.hennen@noaa.gov>
Date:   Fri Dec 3 16:42:18 2021 -0800

    added open_file function, file_paths use strings

commit b472b57
Author: Jay Hennen <jay.hennen@noaa.gov>
Date:   Fri Dec 3 11:30:41 2021 -0800

    added conditional compilation, _wfopen

commit dd64edf
Author: Adios Automated Script <adios-script@noaa.gov>
Date:   Wed Nov 17 17:50:15 2021 -0800

    allow Unicode filenames on utf-8 systems (e.g. not Windows)

commit 892d11d
Author: Adios Automated Script <adios-script@noaa.gov>
Date:   Wed Nov 17 14:57:51 2021 -0800

    refactoring of dealloc for animation -- more robust

commit 04f8f18
Author: Adios Automated Script <adios-script@noaa.gov>
Date:   Wed Nov 17 13:51:00 2021 -0800

    cleanup of py2 compatibility code

commit 5f046ea
Author: Adios Automated Script <adios-script@noaa.gov>
Date:   Wed Nov 17 13:41:58 2021 -0800

    cleaned up some file handling -- added tests for multiple animation runs
  • Loading branch information
Adios Automated Script committed Dec 4, 2021
1 parent 4cc0259 commit 7046874
Show file tree
Hide file tree
Showing 16 changed files with 352 additions and 166 deletions.
3 changes: 3 additions & 0 deletions conda_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ libgd
# for development
pytest

# to build the docs
sphinx

1 change: 1 addition & 0 deletions docs/_static/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Just here so that git will keep the dir around
10 changes: 6 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys, os

# If extensions (or modules to document with autodoc) are in another directory,
Expand All @@ -28,7 +25,12 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.mathjax']
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
# 'sphinx.ext.pngmath',
# 'sphinx.ext.mathjax',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Welcome to py_gd's documentation!
Contents:

.. toctree::
:maxdepth: 2
:maxdepth: 2

introduction
installing
Expand Down
2 changes: 2 additions & 0 deletions docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Ideally, it is as simple as::

$ python setup.py build
$ python setup.py install

or::

$ python setup.py develop

(develop mode installs links to the code, rather than copying the code into python's site-packages -- it is helpful if you want to be updating the code, and have the new version run right away.)
Expand Down
26 changes: 20 additions & 6 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,37 @@
``py_gd`` Reference
===========================

``py_gd`` is a python wrapper around teh GD graphics library. For the real detail, see the source and docs of GD itself:
``py_gd`` is a python wrapper around the GD graphics library. For the real detail, see the source and docs of GD itself:

http://libgd.bitbucket.org/
https://github.com/libgd/libgd

This is the documentation for the python inteface -- it more or less mirrors the GD API, but makes it more object oriented and generally uses "pythonic" names and style.

Notes:
------

There is a module attribute: ``MAX_IMAGE_SIZE``. It is currently set 1GB. It can be changed after import, before initializing an Image. On the develoment system, creating images greater than 1GB brings the system to an almost halt before raising a memory error. But your machine may be able to tolerae larger images. Hoever, as of this writting, pixel coordintes are C ``int`` type, so very parge images may have issues anyway

If you want to change it:

from py_gd import py_gd # to get the actual cython module

py_gd.MAX_IMAGE_SIZE = 4 * 1024**3 # 4 GB

Then you can create a larger Image

This is the documentation for teh python inteface -- it more or less mirrors the GD API, but makes it more object oriented and generally used "pythonic" names and style.

Class Reference:
---------------------
----------------

.. automodule:: py_gd
:members:

``py_gd.Image`` -- the gd image class
--------------------------------------------------
-------------------------------------
.. autoclass:: py_gd.Image
:members:

Factory functions
-----------------------------------------------------
-----------------
.. autofunction:: py_gd.from_array
3 changes: 2 additions & 1 deletion docs/tutorials.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.. _tutorials:

Tutorials
=====================
=========

A collection of tutorials and example scripts to get you up and running.

Expand Down
11 changes: 2 additions & 9 deletions py_gd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@
This __init__ does some kludges to load libraries, and then does an
import *
from .py_gd import *
"""

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division

import sys
import os

__version__ = "1.1.2.dev0"

__version__ = "2.0.0"

if sys.platform.startswith('win'):
# This only works for Anaconda / miniconda
Expand Down
4 changes: 4 additions & 0 deletions py_gd/py_gd.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ declarations for the cython wrapper around the gd drawing lib
import cython

from libc.stdio cimport FILE
IF UNAME_SYSNAME == "Windows":
cdef extern from "<windows.h>":
ctypedef Py_UNICODE wchar_t
FILE *_wfopen(const wchar_t *filename,const wchar_t *mode)

## access the gd header files:
cdef extern from "gd.h":
Expand Down
Loading

0 comments on commit 7046874

Please sign in to comment.