Sha256: d8153947a62279fa7ab4ca056f8dc4c71d61182ad80c99cb084feb889ddfe6bb

Contents?: true

Size: 1.71 KB

Versions: 10

Compression:

Stored size: 1.71 KB

Contents

#!/usr/bin/env ruby

require 'bundler/setup'
require 'vedeu'

# If you have cloned this repository from GitHub, you can run this example:
#
#     bundle exec ./examples/demo_groups.rb
#
class DemoGroupsApp

  Vedeu.bind(:_initialize_) {
    Vedeu.trigger(:_show_group_, :fruit)
    Vedeu.trigger(:_refresh_group_, :fruit)
  }

  Vedeu.configure do
    log '/tmp/demo_groups.log'
  end

  Vedeu.interface :apple do
    border!
    foreground '#ffffff'
    geometry do
      width  10
      height 4
      x  3
      y  3

    end
    group :fruit
  end

  Vedeu.interface :banana do
    border!
    foreground '#ffffff'
    geometry do
      width  10
      height 4
      x  15
      y  3
    end
    group :fruit
  end

  Vedeu.interface :carrot do
    border!
    foreground '#ffffff'
    geometry do
      width  10
      height 4
      x  4
      y  4
    end
    group :vegetable
  end

  Vedeu.interface :dill do
    border!
    foreground '#ffffff'
    geometry do
      width  10
      height 4
      x  16
      y  4
    end
    group :vegetable
  end

  Vedeu.keymap '_global_' do
    key('f') {
      Vedeu.trigger(:_hide_group_, :vegetable)
      Vedeu.trigger(:_show_group_, :fruit)
    }
    key('q') { Vedeu.exit }
    key('v') {
      Vedeu.trigger(:_hide_group_, :fruit)
      Vedeu.trigger(:_show_group_, :vegetable)
    }
    key(:tab) { Vedeu.focus_next }
    key(:shift_tab) { Vedeu.focus_previous }
  end

  Vedeu.views do
    view(:apple) do
      line 'apple'
    end
    view(:banana) do
      line 'banana'
    end
    view(:carrot) do
      line 'carrot'
    end
    view(:dill) do
      line 'dill'
    end
  end

  def self.start(argv = ARGV)
    Vedeu::Launcher.execute!(argv)
  end

end # DemoGroupsApp

DemoGroupsApp.start

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vedeu-0.6.36 examples/dsl_demo_groups.rb
vedeu-0.6.35 examples/demo_groups.rb
vedeu-0.6.34 examples/demo_groups.rb
vedeu-0.6.33 examples/demo_groups.rb
vedeu-0.6.32 examples/demo_groups.rb
vedeu-0.6.31 examples/demo_groups.rb
vedeu-0.6.30 examples/demo_groups.rb
vedeu-0.6.29 examples/demo_groups.rb
vedeu-0.6.28 examples/demo_groups.rb
vedeu-0.6.27 examples/demo_groups.rb