Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Shawver committed Oct 5, 2014
1 parent 77d6a4e commit 2f6963d
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 88 deletions.
26 changes: 13 additions & 13 deletions qgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"""
)

class qgrid(object):
class SlickGrid(object):
remote_mode = True
def __init__(self, data_frame):
self.data_frame = data_frame
Expand Down Expand Up @@ -115,8 +115,8 @@ def _ipython_display_(self):
column_types_json = json.dumps(self.column_types)
data_frame_json = self.df_copy.to_json(orient='records', date_format='iso', double_precision=self.precision)

if qgrid.remote_mode:
cdn_base_url = "https://rawgit.com/quantopian/qgrid/master/nbextensions/qgridjs"
if SlickGrid.remote_mode:
cdn_base_url = "https://rawgit.com/quantopian/qgrid/master/qgridjs"
else:
cdn_base_url = "/nbextensions/qgridjs"

Expand All @@ -132,7 +132,10 @@ def _ipython_display_(self):
display_html('ERROR: {}'.format(str(err)), raw=True)

def set_remote_mode(remote_mode=True):
qgrid.remote_mode = remote_mode
SlickGrid.remote_mode = remote_mode

def show_grid(data_frame):
return SlickGrid(data_frame)

def load_ipython_extension(ipython):
"""
Expand All @@ -144,12 +147,9 @@ def load_ipython_extension(ipython):
if js_pkg != None:
qgridjs_path = js_pkg.filename
nb_ext.install_nbextension(qgridjs_path, overwrite=True, symlink=False, verbose=0)
set_remote_mode(False)
else:
set_remote_mode(True)

ipython.push(
{
'qgrid': qgrid
}
)

# ipython.push(
# {
# 'qgrid': qgrid
# }
# )
199 changes: 124 additions & 75 deletions qgrid_demo.ipynb

Large diffs are not rendered by default.

0 comments on commit 2f6963d

Please sign in to comment.