class Plugin::Extract::EditWindow

Public Class Methods

new(extract, plugin) click to toggle source
Calls superclass method
# File core/plugin/extract/edit_window.rb, line 9
def initialize(extract, plugin)
  @plugin = plugin
  @extract = extract.dup.freeze
  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
    Plugin.call :extract_tab_update, self.to_h 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 95
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 91
def condition_widget
  @condition_widget ||= Gtk::VBox.new().
    add(condition_form) end
generate_modifier(method) click to toggle source
# File core/plugin/extract/edit_window.rb, line 100
def generate_modifier(method)
  Plugin::Settings::Listener.new.get {
    __send__(method)
  }.set { |v|
    modify_value method => v } end
icon() click to toggle source
# File core/plugin/extract/edit_window.rb, line 47
def icon
  @extract[:icon] end
id() click to toggle source
# File core/plugin/extract/edit_window.rb, line 32
def id
  @extract[:id] end
name() click to toggle source
# File core/plugin/extract/edit_window.rb, line 26
def name
  @extract[:name] || "".freeze end
name_entry() click to toggle source

名前入力ボックス

Return

Gtk::Entry

# File core/plugin/extract/edit_window.rb, line 74
def name_entry
  @name_entry ||= Gtk::Entry.new().tap { |name_entry|
    name_entry.set_text name
    name_entry.ssc(:changed){ |widget|

      false } } end
name_widget() click to toggle source

名前入力ウィジェットを返す

Return

Gtk::HBox.new

# File core/plugin/extract/edit_window.rb, line 66
def name_widget
  @name_widget ||= Gtk::HBox.new().
    closeup(Gtk::Label.new(_('名前'))).
    add(name_entry) end
ok_button() click to toggle source
# File core/plugin/extract/edit_window.rb, line 118
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 106
def option_widget
  name_modifier = generate_modifier :name
  icon_modifier = generate_modifier :icon
  sound_modifier = generate_modifier :sound
  popup_modifier = generate_modifier :popup
  Plugin::Settings.new(Plugin[:extract]) do
    input _('名前'), name_modifier
    fileselect _('アイコン'), icon_modifier, Skin.path
    settings _('通知') do
      fileselect _('サウンド'), sound_modifier
      boolean _('ポップアップ'), popup_modifier end end end
popup() click to toggle source
sexp() click to toggle source
# File core/plugin/extract/edit_window.rb, line 29
def sexp
  @extract[:sexp] end
slug() click to toggle source
# File core/plugin/extract/edit_window.rb, line 38
def slug
  @extract[:slug] end
sound() click to toggle source
# File core/plugin/extract/edit_window.rb, line 41
def sound
  @extract[:sound] end
source_widget() click to toggle source
# File core/plugin/extract/edit_window.rb, line 81
def source_widget
  datasources = (Plugin.filtering(:extract_datasources, {}) || [{}]).first.map do |id, name|
    [id, name.is_a?(String) ? name.split('/'.freeze) : name] end
  datasources_box = Gtk::HierarchycalSelectBox.new(datasources, sources.map(&:to_sym)){
    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 35
def sources
  @extract[:sources] || [] end
to_h() click to toggle source

extract の内容を返す

Return

@extract の内容(Hash)

# File core/plugin/extract/edit_window.rb, line 53
def to_h
  { name: name,
    sexp: sexp,
    id: id,
    slug: slug,
    sources: sources,
    sound: sound,
    popup: popup,
    icon: icon }.freeze end