Class: JLDrill::FileProgressContext
Defined Under Namespace
Classes: FileProgress
Instance Attribute Summary
#mainView, #parent, #viewBridge
Instance Method Summary
collapse
#addView, #isEntered?, #onExit, #peekAtView, #setupViews
Constructor Details
Returns a new instance of FileProgressContext.
28
29
30
|
# File 'lib/jldrill/contexts/FileProgressContext.rb', line 28
def initialize(viewBridge)
super(viewBridge)
end
|
Instance Method Details
#createViews ⇒ Object
32
33
34
|
# File 'lib/jldrill/contexts/FileProgressContext.rb', line 32
def createViews
@mainView = @viewBridge.FileProgress.new(self)
end
|
#destroyViews ⇒ Object
36
37
38
|
# File 'lib/jldrill/contexts/FileProgressContext.rb', line 36
def destroyViews
@mainView = nil
end
|
#enter(parent) ⇒ Object
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/jldrill/contexts/FileProgressContext.rb', line 74
def enter(parent)
if isValid?(parent)
super(parent)
readFile
end
end
|
#exit ⇒ Object
85
86
87
|
# File 'lib/jldrill/contexts/FileProgressContext.rb', line 85
def exit
super
end
|
#exitFileProgressContext ⇒ Object
40
41
42
|
# File 'lib/jldrill/contexts/FileProgressContext.rb', line 40
def exitFileProgressContext
self.exit
end
|
#isValid?(parent) ⇒ Boolean
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/jldrill/contexts/FileProgressContext.rb', line 63
def isValid?(parent)
retVal = false
if !parent.nil?
if (!getFilename.nil?) &&
(!getFile.loaded? || (getFile.file != getFilename))
retVal = true
end
end
return retVal
end
|
#readFile ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/jldrill/contexts/FileProgressContext.rb', line 44
def readFile
eof = false
filename = getFilename()
if !filename.nil? && !getFile.nil?
@parent.startLongEvent()
getFile.load(filename)
@parent.stopLongEvent()
@mainView.idle_add do
eof = getFile.parseChunk(getFile.stepSize)
@mainView.update(getFile.fraction)
fraction = getFile.fraction
if eof
exitFileProgressContext
end
eof
end
end
end
|