Class: JLDrill::Gtk::FileProgress

Inherits:
FileProgressContext::FileProgress show all
Defined in:
lib/jldrill/views/gtk/FileProgress.rb

Instance Attribute Summary collapse

Attributes inherited from Context::View

#context

Instance Method Summary collapse

Methods inherited from Context::View

#addView, #removeView, #removingViewFrom, #viewAddedTo

Constructor Details

#initialize(context) ⇒ FileProgress

Returns a new instance of FileProgress.



12
13
14
15
16
17
18
# File 'lib/jldrill/views/gtk/FileProgress.rb', line 12

def initialize(context)
  super(context)
  @progressBar = ProgressBar.new(self)
          @progressBar.expandWidgetWidth
  @block = nil
  @id = nil
end

Instance Attribute Details

#progressWindowObject (readonly)

Returns the value of attribute progressWindow.



10
11
12
# File 'lib/jldrill/views/gtk/FileProgress.rb', line 10

def progressWindow
  @progressWindow
end

Instance Method Details

#filenameObject



24
25
26
# File 'lib/jldrill/views/gtk/FileProgress.rb', line 24

def filename
  return File.basename(@context.getFilename)
end

#getWidgetObject



20
21
22
# File 'lib/jldrill/views/gtk/FileProgress.rb', line 20

def getWidget
  @progressBar
end

#idle_add(&block) ⇒ Object



47
48
49
50
51
52
# File 'lib/jldrill/views/gtk/FileProgress.rb', line 47

def idle_add(&block)
    if @block.nil? && @id.nil?
        @block = block
        @id = Gtk.idle_add do run end
    end
end

#runObject



32
33
34
35
36
37
# File 'lib/jldrill/views/gtk/FileProgress.rb', line 32

def run
    if @block.call
              stop
    end
          return true
end

#stopObject



39
40
41
42
43
44
45
# File 'lib/jldrill/views/gtk/FileProgress.rb', line 39

def stop
    if !@id.nil?
        Gtk.idle_remove(@id)
        @id = nil
        @block = nil
    end
end

#update(fraction) ⇒ Object



28
29
30
# File 'lib/jldrill/views/gtk/FileProgress.rb', line 28

def update(fraction)
    @progressBar.update(fraction)
end