class Widgets::Widget
Attributes
Interval with which to update this widget
The options this widget was created with
Public Class Methods
Source
# File src/widgets.rb, line 61 def self.from_options widget class_name = widget[:type].to_s.camelize if Widgets.const_defined? class_name klass = Widgets.const_get class_name kwidget = klass.new widget kwidget.add_css_class widget[:type] return kwidget end end
Create a Widgets::Widget
from a hash with options
Source
# File src/widgets.rb, line 15 def initialize options={} @options = options @interval = options[:interval] || DEFAULT_INTERVAL super :horizontal, @options[:padding] || 0 add_css_class "barwidget" add_css_class @options[:class] if @options[:class] self.name = @options[:name] if @options[:name] @click_controller = Gtk::GestureClick.new @click_controller.button = Gdk::BUTTON_PRIMARY add_controller(@click_controller) if options.include? :on_click and not @noclick @click_controller.signal_connect("pressed") { options[:on_click].call } set_cursor Gdk::Cursor.new(:pointer) # https://docs.gtk.org/gdk4/ctor.Cursor.new_from_name.html end if options.include? :cursor set_cursor Gdk::Cursor.new options[:cursor] end end
Calls superclass method
Public Instance Methods
Source
# File src/widgets.rb, line 38 def update # nothing end
Update method for this widget
Source
# File src/widgets.rb, line 43 def update_safe update # no error handling yet whoops end
Like update but with error handling