class Plugin::Extract::EditWindow

Attributes

extract[R]

Public Class Methods

new(extract, plugin) click to toggle source

Args

extract

抽出タブ設定 (Plugin::Extract::Setting)

plugin

プラグインのインスタンス (Plugin)

Calls superclass method
# File core/plugin/extract/edit_window.rb, line 15
def initialize(extract, plugin)
  @plugin = plugin
  @extract = extract
  super(_('%{name} - 抽出タブ - %{application_name}') % {name: name, application_name: Environment::NAME})
  add(Gtk::VBox.new().
      add(Gtk::Notebook.new.
          append_page(source_widget, Gtk::Label.new(_('データソース'))).
          append_page(condition_widget, Gtk::Label.new(_('絞り込み条件'))).
          append_page(option_widget, Gtk::Label.new(_('オプション')))).
      closeup(Gtk::EventBox.new().
              add(Gtk::HBox.new().
                  closeup(ok_button).right)))
  ssc(:destroy) do
    @extract.notify_update
    false
  end
  set_size_request 480, 320
  show_all end

Public Instance Methods

condition_form() click to toggle source
# File core/plugin/extract/edit_window.rb, line 75
def condition_form
  @condition_form = Gtk::MessagePicker.new(sexp.freeze){
    modify_value sexp: @condition_form.to_a
  } end
condition_widget() click to toggle source
# File core/plugin/extract/edit_window.rb, line 71
def condition_widget
  @condition_widget ||= Gtk::VBox.new().
    add(condition_form) end
icon() click to toggle source
# File core/plugin/extract/edit_window.rb, line 58
def icon
  @extract.icon end
id() click to toggle source
# File core/plugin/extract/edit_window.rb, line 40
def id
  @extract.id end
name() click to toggle source
# File core/plugin/extract/edit_window.rb, line 34
def name
  @extract.name end
ok_button() click to toggle source
# File core/plugin/extract/edit_window.rb, line 92
def ok_button
  Gtk::Button.new(_('閉じる')).tap{ |button|
    button.ssc(:clicked){
      self.destroy } } end
option_widget() click to toggle source
# File core/plugin/extract/edit_window.rb, line 80
def option_widget
  Plugin::Extract::OptionWidget.new(@plugin, @extract) do
    input _('名前'), :name
    fileselect _('アイコン'), :icon, Skin.path
    settings _('通知') do
      fileselect _('サウンド'), :sound
      boolean _('ポップアップ'), :popup
    end
    select(_('並び順'), :order, Hash[Plugin.filtering(:extract_order, []).first.map{|o| [o.slug.to_s, o.name] }])
  end
end
order() click to toggle source
# File core/plugin/extract/edit_window.rb, line 55
def order
  @extract.order end
popup() click to toggle source
refresh_title() click to toggle source
# File core/plugin/extract/edit_window.rb, line 97
def refresh_title
  set_title _('%{name} - 抽出タブ - %{application_name}') % {name: name, application_name: Environment::NAME}
end
sexp() click to toggle source
# File core/plugin/extract/edit_window.rb, line 37
def sexp
  @extract.sexp end
slug() click to toggle source
# File core/plugin/extract/edit_window.rb, line 46
def slug
  @extract.slug end
sound() click to toggle source
# File core/plugin/extract/edit_window.rb, line 49
def sound
  @extract.sound end
source_widget() click to toggle source
# File core/plugin/extract/edit_window.rb, line 61
def source_widget
  datasources = (Plugin.filtering(:extract_datasources, {}) || [{}]).first.map do |id, source_name|
    [id, source_name.is_a?(String) ? source_name.split('/'.freeze) : source_name] end
  datasources_box = Gtk::HierarchycalSelectBox.new(datasources, sources){
    modify_value sources: datasources_box.selected.to_a }
  scrollbar = ::Gtk::VScrollbar.new(datasources_box.vadjustment)
  @source_widget ||= Gtk::HBox.new().
    add(datasources_box).
    closeup(scrollbar) end
sources() click to toggle source
# File core/plugin/extract/edit_window.rb, line 43
def sources
  @extract.sources end