Class: AioMenu

Inherits:
Menu
  • Object
show all
Defined in:
lib/aniview/view/aiomenu.rb

Instance Method Summary collapse

Methods inherited from Menu

#color, #control, #draw, #drawFrom, #expand, #fixCursor, #getLen, #initialize, #moveCursor, #printmf, #resolveSelected, #setFormat, #setName, #setRfunc, #set_screen_size

Constructor Details

This class inherits a constructor from Menu

Instance Method Details

#customControl(key, sel) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/aniview/view/aiomenu.rb', line 40

def customControl(key, sel)
	path = @items.values[sel["out"]][sel["in"]].path

	if key == "space"
		expand(sel["out"])
	elsif key == "r"
		refresh
	elsif key == "enter"
		
		@interface.watch(path)
		@interface.addWatched(path)
		@interface.logWatched(path)

		#@malanime.update(path)
		
		refresh
	elsif key == "Z"
		@interface.addWatched(path)
		refresh
	elsif key == "z"
		@interface.rmWatched()
		refresh
	elsif key == "u"
		@interface.rmWatched(path)
			
	end
end

#getDurationObject



24
25
26
27
28
29
30
# File 'lib/aniview/view/aiomenu.rb', line 24

def getDuration
	dur = 0
	@items.each{ |child| 
		dur += child[0].attributes["d"]
	}
	return dur
end

#getSizeObject



32
33
34
35
36
37
38
# File 'lib/aniview/view/aiomenu.rb', line 32

def getSize
	size = 0
	@items.each{ |child| 
		size += child[0].attributes["s"]
	}
	return size
end

#refreshObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/aniview/view/aiomenu.rb', line 11

def refresh
	@items = @interface.makeHash @interface.send(@refresh_func)

	@attributes = {
		"t" => @attributes["t"],
		"D" => Format.format_duration(getDuration),
		"S" => Format.format_size(getSize)
	}

	@expanded = -1 if @items.values[@expanded] == nil
	fixCursor
end

#setmal(malanime) ⇒ Object



7
8
9
# File 'lib/aniview/view/aiomenu.rb', line 7

def setmal malanime
	@malanime = malanime
end