Sha256: d156e360e73223a4fb754b4f6aede81615b05741857a0e8cee280d9edc9e79ff

Contents?: true

Size: 1.72 KB

Versions: 13

Compression:

Stored size: 1.72 KB

Contents

#!/usr/bin/env ruby

require 'bundler/setup'
require 'vedeu'

# An example application to demonstrate colours, cursor and interface movement,
# maximising/unmaximising of interfaces and toggling of cursors and interfaces.
#
# If you have cloned this repository from GitHub, you can run this example:
#
#     ./test/support/examples/material_colours_app.rb
#
class VedeuEditorApp

  Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }

  # Be aware that running an application with profiling enabled will affect
  # performance.
  Vedeu.configure do
    debug!
    fake!
    log '/tmp/vedeu_editor_app.log'
    # profile!
    # renderers Vedeu::Renderers::File.new
  end

  Vedeu.interface 'main_interface' do
    border 'main_interface' do
      colour foreground: '#ffffff', background: :default
      title 'Editor'
      caption('Ctrl+C = Quit')
    end
    colour foreground: '#ffffff', background: :default
    cursor!
    geometry 'main_interface' do
      x  columns(1)
      xn columns(11)
      y  rows(1)
      yn rows(1) + 10
    end
    zindex 1
  end

  Vedeu.keymap('_global_') do
    key(:up)    { Vedeu.trigger(:_cursor_up_)    }
    key(:right) { Vedeu.trigger(:_cursor_right_) }
    key(:down)  { Vedeu.trigger(:_cursor_down_)  }
    key(:left)  { Vedeu.trigger(:_cursor_left_)  }

    key('q')        { Vedeu.trigger(:_exit_) }
    key(:escape)    { Vedeu.trigger(:_mode_switch_) }
    key(:shift_tab) { Vedeu.trigger(:_focus_prev_) }
    key(:tab)       { Vedeu.trigger(:_focus_next_) }
  end

  Vedeu.renders do
    view 'main_interface' do
      line { line '' }
    end
  end

  Vedeu.focus_by_name 'main_interface'

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

end # VedeuEditorApp

VedeuEditorApp.start(ARGV)

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
vedeu-0.6.37 test/support/examples/editor_app.rb
vedeu-0.6.36 test/support/examples/editor_app.rb
vedeu-0.6.35 test/support/examples/editor_app.rb
vedeu-0.6.34 test/support/examples/editor_app.rb
vedeu-0.6.33 test/support/examples/editor_app.rb
vedeu-0.6.32 test/support/examples/editor_app.rb
vedeu-0.6.31 test/support/examples/editor_app.rb
vedeu-0.6.30 test/support/examples/editor_app.rb
vedeu-0.6.29 test/support/examples/editor_app.rb
vedeu-0.6.28 test/support/examples/editor_app.rb
vedeu-0.6.27 test/support/examples/editor_app.rb
vedeu-0.6.26 test/support/examples/editor_app.rb
vedeu-0.6.25 test/support/examples/editor_app.rb