summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-10 21:13:11 +0100
committerhut <hut@lavabit.com>2013-02-10 21:13:11 +0100
commitf2cc491647fa0cb2cd37488d007d549a5c80ebc2 (patch)
treee13d855a867c45376765ab6f2c7983600356b674
parent2fc163162cb450e78a7b5f557da27eb8dc778141 (diff)
downloadranger-f2cc491647fa0cb2cd37488d007d549a5c80ebc2.tar.gz
ext.img_display: don't draw image when fonth/fontw is 0
-rw-r--r--ranger/ext/img_display.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 191f5aa4..a89f6d8b 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -48,6 +48,8 @@ def draw(path, start_x, start_y, max_width, max_height):
     They are expressed in number of characters.
     """
     fontw, fonth = _get_font_dimensions()
+    if fontw == 0 or fonth == 0:
+      return
 
     max_width_pixels = max_width * fontw
     max_height_pixels = max_height * fonth
umber.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/usr/bin/python3
"""Generate pydoc documentation and move it to the doc directory.
THIS WILL DELETE ALL EXISTING HTML FILES IN THAT DIRECTORY, so don't
store important content there."""

import pydoc, os, sys
if __name__ == '__main__':
	docdir = 'doc/pydoc'
	os.chdir(sys.path[0])
	try: os.mkdir(docdir)
	except: pass


	for fname in os.listdir(docdir):
		if fname.endswith('.html'):
			os.remove(os.path.join(docdir, fname))

	pydoc.writedocs('.')
	pydoc.writedoc('curses')
	pydoc.writedoc('curses.ascii')
	pydoc.writedoc('os')
	pydoc.writedoc('os.path')
	pydoc.writedoc('sys')

	for fname in os.listdir('.'):
		if fname.endswith('.html'):
			os.rename(fname, os.path.join(docdir, fname))