From 41fddc99de7878ff7d90fafcb120003d0dc2c0d9 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 11 Jun 2009 21:32:40 +0200 Subject: mooo --- code/directory.rb | 4 ++-- code/draw.rb | 2 +- code/extensions/basic.rb | 8 ++++---- code/keys.rb | 4 ++-- code/scheduler.rb | 41 ++++++++++++++++++++++++----------------- code/types.rb | 4 ++-- 6 files changed, 35 insertions(+), 28 deletions(-) (limited to 'code') diff --git a/code/directory.rb b/code/directory.rb index 0b1e4e60..d3c4382b 100644 --- a/code/directory.rb +++ b/code/directory.rb @@ -34,10 +34,10 @@ class Directory @marked = false end - attr_reader *%w( + attr_reader(*%w{ basename mtime rights type path ext infostring readlink basename size ctime name - ) + }) attr_accessor(:marked) diff --git a/code/draw.rb b/code/draw.rb index 175a9a1a..8e032199 100644 --- a/code/draw.rb +++ b/code/draw.rb @@ -284,7 +284,7 @@ module Fm end bold false - color -1, -1 + color(-1, -1) btm = lines - 1 case @buffer diff --git a/code/extensions/basic.rb b/code/extensions/basic.rb index c822e9f6..520dac42 100644 --- a/code/extensions/basic.rb +++ b/code/extensions/basic.rb @@ -72,7 +72,7 @@ class Numeric self < min ? min : (self > max ? max : self) end - def bytes space = true, n_round = 2 + def bytes(space = true, n_round = 2) n = 1024 a = %w(B K M G T Y) @@ -135,9 +135,9 @@ class File end s = ("%o" % File.stat(f).mode)[-3..-1] - for m in s.each_char - result << MODES_HASH[m] - end +# s.each_char do |m| +# result << MODES_HASH[m] +# end result end diff --git a/code/keys.rb b/code/keys.rb index f3fcdbee..bca4f4cd 100644 --- a/code/keys.rb +++ b/code/keys.rb @@ -108,9 +108,9 @@ module Fm elsif @buffer == 'F' descend elsif @buffer[-1] == ?> - @buffer.slice! /(<.*)?>$/ + @buffer.slice!(/(<.*)?>$/) else - @buffer.slice! -1 + @buffer.slice!(-1) end elsif key == '' @buffer = '' diff --git a/code/scheduler.rb b/code/scheduler.rb index 3644f681..9b716d2f 100644 --- a/code/scheduler.rb +++ b/code/scheduler.rb @@ -12,22 +12,24 @@ module Scheduler @active = false @thread ||= Thread.new do -# Thread.current.priority = PRIORITY - while true - sleep 0.1 - if @active and not @scheduled.empty? - while dir = @scheduled.shift - dir.refresh(true) - dir.resize - force_update - end + if EVIL + Thread.current.priority = PRIORITY + while true + Thread.stop + manage unless @scheduled.empty? or !@active + end + + else + while true + sleep 0.1 + manage unless @scheduled.empty? or !@active end end end end def run - @active = true +# @active = true end def stop @@ -36,20 +38,25 @@ module Scheduler def <<(dir) dir.scheduled = true - unless include? dir + unless @scheduled.include? dir @scheduled << dir + if EVIL + @thread.run + end end end - def include?(dir) - @scheduled.include?(dir) + private + def manage + while dir = @scheduled.shift + dir.refresh(true) + dir.resize + force_update + end end def force_update Process.kill( UPDATE_SIGNAL, PID ) end - -# def priority() @thread.priority end -# def priority=(x) @thread.priority=(x) end - end + diff --git a/code/types.rb b/code/types.rb index 6d3999c7..2c21c214 100644 --- a/code/types.rb +++ b/code/types.rb @@ -75,9 +75,9 @@ module Fm end end - module_function *%w* + module_function(*%w{ mplayer zsnes evince image - * + }) end def self.getfilehandler_frompath(*files) -- cgit 1.4.1-2-gfad0