about summary refs log tree commit diff stats
path: root/html/070table.mu.html
Commit message (Expand)AuthorAgeFilesLines
* 3830 - crosslink shape-shifting containers in htmlKartik K. Agaram2017-04-181-15/+15
* 3764 - better colors for cross-linksKartik K. Agaram2017-03-081-3/+4
* 3761Kartik K. Agaram2017-03-071-14/+15
* 3716Kartik K. Agaram2016-12-261-0/+2
* 3713 - cross-link calls with definitions in htmlKartik K. Agaram2016-12-261-16/+16
* 3710Kartik K. Agaram2016-12-261-109/+109
* 3709 - line numbers in htmlKartik K. Agaram2016-12-261-112/+136
* 3688Kartik K. Agaram2016-11-251-0/+4
* 3621Kartik K. Agaram2016-11-041-2/+2
* 3619Kartik K. Agaram2016-10-311-6/+25
* 3618Kartik K. Agaram2016-10-311-2/+2
* 3617Kartik K. Agaram2016-10-311-21/+21
* 3613Kartik K. Agaram2016-10-311-6/+5
* 3569Kartik K. Agaram2016-10-231-34/+34
* 3431Kartik K. Agaram2016-09-301-6/+6
* 3430Kartik K. Agaram2016-09-281-7/+7
* 3395Kartik K. Agaram2016-09-171-22/+22
* 3355Kartik K. Agaram2016-09-151-2/+2
* 3158Kartik K. Agaram2016-07-271-0/+125
.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 */
from os import devnull
null = open(devnull, 'a')

class FM():
	def __init__(self, environment, ui):
		self.env = environment
		self.ui = ui

	def run(self):
		import time

		self.env.enter_dir(self.env.path)

		while 1:
			try:
				self.ui.draw()
				key = self.ui.get_next_key()
				self.ui.press(key, self)
			except KeyboardInterrupt:
				self.env.key_clear()
				time.sleep(0.2)
			except:
				raise

	def resize(self):
		self.ui.resize()

	def exit(self):
		raise SystemExit()

	def enter_dir(self, path):
		self.env.enter_dir(path)

	def move_left(self):
		self.env.enter_dir('..')

	def move_right(self):
		try:
			path = self.env.cf.path
			if not self.env.enter_dir(path):
				self.execute_file(path)
		except AttributeError:
			pass
	
	def handle_mouse(self):
		self.ui.handle_mouse(self)

	def execute_file(self, path):
		from subprocess import Popen
		Popen(('mplayer', '-fs', path), stdout = null, stderr = null)

	def edit_file(self):
		from subprocess import Popen
		import os
		if self.env.cf is None: return

		self.ui.exit()

		p = Popen(('vim', self.env.cf.path))
		os.waitpid(p.pid, 0)

		self.ui.initialize()

	def move_pointer(self, relative = 0, absolute = None):
		self.env.cf = self.env.pwd.move_pointer(relative, absolute)

	def move_pointer_by_pages(self, relative = 0):
		self.env.cf = self.env.pwd.move_pointer(
				relative = int(relative * self.env.termsize[0]))

	def redraw(self):
		self.ui.redraw()

	def reset(self):
		old_path = self.env.pwd.path
		self.env.directories = {}
		self.enter_dir(old_path)

	def toggle_boolean_option(self, string):
		if isinstance(self.env.opt[string], bool):
			self.env.opt[string] ^= True