Skip to content

Commit

Permalink
Merge pull request #37 from pygae/for-brno
Browse files Browse the repository at this point in the history
Prepare for a 0.0.9 release for Brno
  • Loading branch information
eric-wieser authored Dec 8, 2019
2 parents 478deae + 43da07d commit 31a6551
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions pyganja/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

from .script_api import *
from .color import *
from ._version import __version__
8 changes: 8 additions & 0 deletions pyganja/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Package versioning solution originally found here:
# http://stackoverflow.com/q/458550

# Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module
__version__ = '0.0.9'
18 changes: 14 additions & 4 deletions pyganja/script_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from multiprocessing import Process
import hashlib
import webbrowser
import warnings

from .GanjaScene import GanjaScene

Expand All @@ -14,15 +15,19 @@
from .cefwindow import *
CEFAVAILABLE = True
except:
print('Failed to import cef_gui, cef functions will be unavailable')
warnings.warn(
'Failed to import cef_gui, cef functions will be unavailable',
stacklevel=2)

JUPYTERAVAILABLE = False
try:
from IPython.display import display, Javascript
from IPython import get_ipython
JUPYTERAVAILABLE = True
except:
print('Failed to import ipython, notebook rendering will be unavailable')
warnings.warn(
'Failed to import ipython, notebook rendering will be unavailable',
stacklevel=2)


def html_to_data_uri(html):
Expand All @@ -35,7 +40,7 @@ def html_to_data_uri(html):
def read_ganja():
dir_name = os.path.dirname(os.path.abspath(__file__))
ganja_filename = dir_name + '/static/ganja.js/ganja.js'
with open(ganja_filename, 'r') as ganja_file:
with open(ganja_filename, 'r', encoding='utf8') as ganja_file:
output = ganja_file.read()
return output

Expand Down Expand Up @@ -81,7 +86,8 @@ def generate_notebook_js(script_json, sig=None, grid=True, scale=1.0, gl=True):
data = data.map(x=>x.length==opts.mv_length?new Element(x):x);
// add the graph to the page.
canvas = this.graph(data, {gl: opts.gl, conformal: opts.conformal, grid: opts.grid, scale: opts.scale, useUnnaturalLineDisplayForPointPairs: true});
canvas.options.h = h; canvas.options.p = p;
canvas.options.h = h;
canvas.options.p = p;
// make it big.
canvas.style.width = '100%';
canvas.style.height = '50vh';
Expand All @@ -100,9 +106,13 @@ def generate_notebook_js(script_json, sig=None, grid=True, scale=1.0, gl=True):
window.open(url, '_blank');
});
}
window.addEventListener('resize', function() {
output.update(output.value);
});
a.onclick = screenshot
var butnelem = element.append(a);
});
})(element);
"""
else:
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from distutils.command.install import install
from distutils.command.build import build
from os import path
import os

version_path = os.path.join('pyganja', '_version.py')
exec(open(version_path).read())

class build_with_submodules(build):
def run(self):
Expand All @@ -21,7 +25,7 @@ def run(self):
setup(
cmdclass={"build": build_with_submodules, "install": install_with_submodules},
name='pyganja',
version='0.0.8',
version=__version__,
packages=find_packages(),
url='https://github.com/hugohadfield/pyganja',
license='',
Expand Down

0 comments on commit 31a6551

Please sign in to comment.