Sha256: e523d29ae5cbb82a5b395c688fc0607f052e3803aa9f44ec8a1f5f6f7aa6534e

Contents?: true

Size: 1.82 KB

Versions: 40

Compression:

Stored size: 1.82 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
      lines do
        line 'apple'
      end
    end
    view(:banana) do
      lines do
        line 'banana'
      end
    end
    view(:carrot) do
      lines do
        line 'carrot'
      end
    end
    view(:dill) do
      lines do
        line 'dill'
      end
    end
  end

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

end # DemoGroupsApp

DemoGroupsApp.start

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
vedeu-0.8.0 examples/dsl_demo_groups.rb
vedeu-0.7.4 examples/dsl_demo_groups.rb
vedeu-0.7.3 examples/dsl_demo_groups.rb
vedeu-0.7.2 examples/dsl_demo_groups.rb
vedeu-0.7.1 examples/dsl_demo_groups.rb
vedeu-0.7.0 examples/dsl_demo_groups.rb
vedeu-0.6.71 examples/dsl_demo_groups.rb
vedeu-0.6.70 examples/dsl_demo_groups.rb
vedeu-0.6.69 examples/dsl_demo_groups.rb
vedeu-0.6.68 examples/dsl_demo_groups.rb
vedeu-0.6.67 examples/dsl_demo_groups.rb
vedeu-0.6.66 examples/dsl_demo_groups.rb
vedeu-0.6.65 examples/dsl_demo_groups.rb
vedeu-0.6.64 examples/dsl_demo_groups.rb
vedeu-0.6.63 examples/dsl_demo_groups.rb
vedeu-0.6.62 examples/dsl_demo_groups.rb
vedeu-0.6.61 examples/dsl_demo_groups.rb
vedeu-0.6.60 examples/dsl_demo_groups.rb
vedeu-0.6.59 examples/dsl_demo_groups.rb
vedeu-0.6.58 examples/dsl_demo_groups.rb