class ProgressBar::KDE
Attributes
bus[R]
service[R]
view[R]
Public Class Methods
new(max, text = nil, title: nil, app_name: nil, app_icon_name: nil, unit: nil, is_cancable: nil, is_suspendable: nil, **_options)
click to toggle source
Calls superclass method
ProgressBar::Base::new
# File lib/progress-bar.rb, line 113 def initialize max, text = nil, title: nil, app_name: nil, app_icon_name: nil, unit: nil, is_cancable: nil, is_suspendable: nil, **_options super max, text text = @text text = nil if text.nil? or text.empty? title = nil if title.nil? or title.empty? unit = '' if unit.nil? or unit.empty? @title, @text, @unit, @app_name, @app_icon_name, @is_cancable, @is_suspendable = title, text, unit, app_name || $0, app_icon_name || '', is_cancable, is_suspendable @errors = [] end
Public Instance Methods
change_progress()
click to toggle source
# File lib/progress-bar.rb, line 154 def change_progress @view.setProcessedAmount i, @unit @view.setPercent done_rel end
change_text()
click to toggle source
# File lib/progress-bar.rb, line 150 def change_text @view.setInfoMessage text end
error(text)
click to toggle source
# File lib/progress-bar.rb, line 159 def error text #STDERR.puts @view.object.introspect #@view.setError text @view.setDescriptionField 0, "Error", text #@view.setInfoMessage "#{text}\nError: #{error}" end
finish()
click to toggle source
# File lib/progress-bar.rb, line 166 def finish return if @finished @view.terminate '' @finished = true end
max=(value)
click to toggle source
Calls superclass method
ProgressBar::Base#max=
# File lib/progress-bar.rb, line 172 def max= value super value @view.setTotalAmount value, @unit end
possible?()
click to toggle source
# File lib/progress-bar.rb, line 131 def possible? 'KDE' == ENV['XDG_CURRENT_DESKTOP'] end
start()
click to toggle source
Calls superclass method
ProgressBar::Base#start
# File lib/progress-bar.rb, line 135 def start @finished = false @bus = DBus::SessionBus.instance @service = @bus['org.kde.JobViewServer'] jvs = @service['/JobViewServer']['org.kde.JobViewServer'] jvs.introspect flags = (@is_cancable ? 0x1 : 0) | (@is_suspendable ? 0x2 : 0) view_path = jvs.requestView @app_name, @app_icon_name, flags @view = @service[view_path] #['org.kde.JobViewV2'] @view.introspect super @view.setTotalAmount @max, @unit self end