Skip to content

Commit

Permalink
Using absolute imports and fixing a bug, so closes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
mapio committed Oct 3, 2017
1 parent 775bc68 commit 0d65822
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
6 changes: 4 additions & 2 deletions gvanim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@
# You should have received a copy of the GNU General Public License along with
# "GraphvizAnim". If not, see <http://www.gnu.org/licenses/>.

from .animation import Animation
from .render import render, gif
from __future__ import absolute_import

from gvanim.animation import Animation
from gvanim.render import render, gif
8 changes: 5 additions & 3 deletions gvanim/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
# You should have received a copy of the GNU General Public License along with
# "GraphvizAnim". If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import

from argparse import ArgumentParser, FileType
from sys import stdin

from . import animation, render
from gvanim import Animation, render, gif

def main():

Expand All @@ -28,9 +30,9 @@ def main():
parser.add_argument( 'basename', help = 'The basename of the generated file' )
args = parser.parse_args()

ga = animation.Animation()
ga = Animation()
ga.parse( args.animation )
render.gif( render.render( ga.graphs(), args.basename, 'png' ), args.basename, args.delay )
gif( render( ga.graphs(), args.basename, 'png' ), args.basename, args.delay )

if __name__ == '__main__':
main()
5 changes: 2 additions & 3 deletions gvanim/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class NextStep( object ):
def __init__( self, clean = False ):
self.clean = clean
def __call__( self, steps ):
from . import animation
steps.append( animation.Step( None if self.clean else steps[ -1 ] ) )
from gvanim.animation import Step
steps.append( Step( None if self.clean else steps[ -1 ] ) )

class AddNode( object ):
def __init__( self, v ):
Expand Down Expand Up @@ -103,4 +103,3 @@ def __call__( self, steps ):
del steps[ -1 ].hE[ ( self.u, self.v ) ]
except KeyError:
pass

4 changes: 3 additions & 1 deletion gvanim/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
# You should have received a copy of the GNU General Public License along with
# "GraphvizAnim". If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import

from email.utils import quote
import shlex

from . import action
from gvanim import action

class ParseException( Exception ):
pass
Expand Down
4 changes: 3 additions & 1 deletion gvanim/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
# You should have received a copy of the GNU General Public License along with
# "GraphvizAnim". If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import

from os.path import join
from tempfile import mkdtemp
from shutil import rmtree

from IPython.display import Image
import ipywidgets as widgets

from .render import render
from gvanim import render

def interactive( animation, size = 320 ):
basedir = mkdtemp()
Expand Down
2 changes: 2 additions & 0 deletions gvanim/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License along with
# "GraphvizAnim". If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import

from subprocess import Popen, PIPE, STDOUT, call
from multiprocessing import Pool, cpu_count

Expand Down
Binary file added tests/action.pyc
Binary file not shown.

0 comments on commit 0d65822

Please sign in to comment.