Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added -f option to giframe (not the default); preparing to add gtutor

  • Loading branch information...
commit 8d7144ab2913f0b89e72a8e140a2908213dd98f4 1 parent 2f851d8
R. Saravanan authored
View
1  COPYING
@@ -10,4 +10,5 @@ as indicated in the respective files. These include:
CKEditor: MPL
jQuery and plugins: MIT-type licenses
Landslide: Apache
+ OnlinePythonTutorial: MIT
Tango icons: Public Domain
View
2  docs/UsingGraphicalFeatures.rst
@@ -124,7 +124,7 @@ drop-down menu to send special characters like TAB and ESCAPE.
Viewing HTML inline
==========================================================================
-Use the ``giframe filename|URL`` command to render inline HTML
+Use the ``giframe [-f] filename|URL`` command to render inline HTML
from a file or URL (or ``command | giframe`` to render HTML generated by ``command``).
View
16 graphterm/bin/giframe
@@ -21,6 +21,10 @@ parser = OptionParser(usage=usage)
parser.add_option("", "--opacity", dest="opacity", default=1.0,
help="Feed opacity (default: 1.0)")
+parser.add_option("-f", "--fullscreen",
+ action="store_true", dest="fullscreen", default=False,
+ help="Fullscreen display")
+
parser.add_option("-n", "--nofooter", action="store_true", dest="nofooter", default=False,
help="Suppress footer")
@@ -50,16 +54,20 @@ else:
iframe_url = gtermapi.create_blob(content, content_type="text/html")
headers = {"opacity": options.opacity}
+if not options.fullscreen:
+ headers["autosize"] = True
+
+frameId = "giframe%09d" % random.randrange(0, 10**9)
+frameHeight = 'height="%d%%%%"' % (100 if options.nofooter else 95,) if options.fullscreen else ''
-frameId = "giframe%09d" % random.randrange(0, 10**9)
-IFRAMEFORMAT = '<iframe id="'+frameId+'" class="gterm-iframe" src="%s" width="100%%" height="'+str(100 if options.nofooter else 95)+'%%"></iframe>'
+IFRAMEFORMAT = '<iframe id="'+frameId+'" class="gterm-iframe" src="%s" width="100%%" '+frameHeight+'"></iframe>'
if not options.nofooter:
IFRAMEFORMAT = '<span class="gterm-iframeclose gterm-iframeheader">&#215;</span>' + IFRAMEFORMAT
-gtermapi.write_html(IFRAMEFORMAT % iframe_url, display="fullscreen", add_headers=headers)
+gtermapi.write_html(IFRAMEFORMAT % iframe_url, display=("fullscreen" if options.fullscreen else "block"), add_headers=headers)
try:
- while True:
+ while options.fullscreen:
time.sleep(1)
except KeyboardInterrupt:
gtermapi.write_blank()
View
13 graphterm/bin/gmatplot.py
@@ -7,17 +7,6 @@
import time
import gtermapi
-def display_blockimg(url, overwrite=False):
- """Display block image in a sequence.
- New image display causes previous images to be hidden.
- Display of hidden images can be toggled by clicking.
- """
- IMGFORMAT = '<span class="gterm-blockseqlink"><em>&lt;image&gt;</em></span><img class="gterm-blockimg gterm-blockseqlink" src="%s"></img><br>'
- add_headers={"classes": "gterm-blockseq"}
- if overwrite:
- add_headers["block"] = "overwrite"
- gtermapi.write_html(IMGFORMAT % url, add_headers=add_headers)
-
def gplot_setup():
import matplotlib
matplotlib.use("Agg")
@@ -31,7 +20,7 @@ def gplot_savefig(format="png", overwrite=False):
outbuf = gtermapi.BlobStringIO(content_type)
plt.savefig(outbuf, format=format)
blob_url = outbuf.close()
- display_blockimg(blob_url, overwrite=overwrite)
+ gtermapi.display_blockimg(blob_url, overwrite=overwrite)
def demo():
"""gterm-aware matplotlib demo"""
View
11 graphterm/bin/gtermapi.py
@@ -97,6 +97,17 @@ def write_blank(display="fullpage"):
"""Write blank pagelet to stdout"""
write_html("", display=display)
+def display_blockimg(url, overwrite=False):
+ """Display block image in a sequence.
+ New image display causes previous images to be hidden.
+ Display of hidden images can be toggled by clicking.
+ """
+ IMGFORMAT = '<span class="gterm-blockseqlink"><em>&lt;image&gt;</em></span><img class="gterm-blockimg gterm-blockseqlink" src="%s"></img><br>'
+ add_headers={"classes": "gterm-blockseq"}
+ if overwrite:
+ add_headers["block"] = "overwrite"
+ write_html(IMGFORMAT % url, add_headers=add_headers)
+
def open_url(url, target="_blank"):
"""Open url in new window"""
url_headers = {"x_gterm_response": "open_url",
View
2  graphterm/www/graphterm.js
@@ -596,7 +596,7 @@ GTWebSocket.prototype.onopen = function(evt) {
function GTAutosizeIFrame(elem) {
// After a delay, adjust size of all iframe child elements to match actual size
setTimeout( function() { $(elem).find("iframe").each( function() {
- $(this).height($(this).contents().find('body').height() + 20);} ) }, 500 );
+ $(this).height($(this).contents().find('body').height() + 25);} ) }, 500 );
}
function GTRepeatCommand() {
View
1  setup.py
@@ -34,6 +34,7 @@ def run(self):
"gterm_setup = graphterm.gterm_setup:main",
"gotrace = graphterm.gotrace:main",
"glandslide = graphterm.bin.landslide.main:main",
+ "gtutor = graphterm.bin.pytutor.gtutor:main",
]},
install_requires=requires,
include_package_data=True,
Please sign in to comment.
Something went wrong with that request. Please try again.