Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 63 lines (52 sloc) 1.819 kB
2c14b51 @pithyless adds lib/toolkit.rb
authored
1 require_relative 'lib/toolkit'
799a0a6 @pithyless moves from monocles to lenses
authored
2
3 require_relative 'lib/lens_view'
e25ed3e @pithyless moves lib/monocles.rb to lib/lenses.rb
authored
4 require_relative 'lib/lenses'
36882f8 @pithyless adds main.rb: hello world example
authored
5
803d88e @pithyless main.rb: using autogui
authored
6 RUI::Application.init('hello') do |app|
7 widget = Qt::Widget.new
8 widget.gui = RUI::autogui do
5da8505 @pithyless shows image in scrollable area
authored
9 layout :type => :horizontal do
10 layout :type => :vertical do
799a0a6 @pithyless moves from monocles to lenses
authored
11 graphics_view :name => :graph_view
5da8505 @pithyless shows image in scrollable area
authored
12 label :name => :footer_label, :text => 'Footer'
13 end
14 layout :type => :vertical do
799a0a6 @pithyless moves from monocles to lenses
authored
15 button :name => :crop_btn, :text => 'Crop'
f7a1beb @pithyless adds action buttons to main.rb
authored
16 button :name => :colorize, :text => 'Colorize'
17 button :name => :grayify, :text => 'Grayify'
1482418 @pithyless adds BaseLens and OutlineLens
authored
18 button :name => :outlinify, :text => 'Outline'
5da8505 @pithyless shows image in scrollable area
authored
19 button :name => :quit, :text => 'Quit'
20 end
803d88e @pithyless main.rb: using autogui
authored
21 end
22 end
5829fe0 @pithyless wip: rubberband
authored
23
1691557 @pithyless adds inner and outer coloring - OutlineLens
authored
24 # attache = Attache.new('samples/01-a-100-2.png')
1482418 @pithyless adds BaseLens and OutlineLens
authored
25 # attache = Attache.new('test/test_sample.png')
1691557 @pithyless adds inner and outer coloring - OutlineLens
authored
26 attache = Attache.new('test/test_sample2.png')
27
799a0a6 @pithyless moves from monocles to lenses
authored
28 lv = LensView.new(attache)
29 widget.graph_view.setScene(lv.scene)
1691557 @pithyless adds inner and outer coloring - OutlineLens
authored
30 # widget.graph_view.scale(3.0,3.0)
799a0a6 @pithyless moves from monocles to lenses
authored
31
32 widget.crop_btn.on(:clicked) do
33 # todo: selection
34 # lv.current_lens.new_crop(Qt::Rect.new(20,20, 120, 120))
35 p = lv.current_lens.copy(20, 20, 120, 120)
36 lv.add_lens(p)
37 end
38
39 # widget.graph_scene.addWidget(
40 # MonocleSelectorWidget.new(nil, widget.graph_view))
5829fe0 @pithyless wip: rubberband
authored
41
f7a1beb @pithyless adds action buttons to main.rb
authored
42 widget.colorize.on(:clicked) do
799a0a6 @pithyless moves from monocles to lenses
authored
43 c = attache.current_lens.to_color_lens
44 attache.add_lens(c)
f7a1beb @pithyless adds action buttons to main.rb
authored
45
799a0a6 @pithyless moves from monocles to lenses
authored
46 widget.colorize.enabled = false # todo - should be automagic
f7a1beb @pithyless adds action buttons to main.rb
authored
47 end
48 widget.grayify.on(:clicked) do
799a0a6 @pithyless moves from monocles to lenses
authored
49 c = attache.current_lens.to_gray_lens
50 attache.add_lens(c)
f7a1beb @pithyless adds action buttons to main.rb
authored
51
799a0a6 @pithyless moves from monocles to lenses
authored
52 widget.grayify.enabled = false # todo - should be automagic
f7a1beb @pithyless adds action buttons to main.rb
authored
53 end
1482418 @pithyless adds BaseLens and OutlineLens
authored
54 widget.outlinify.on(:clicked) do
55 c = attache.current_lens.to_outline_lens
56 attache.add_lens(c)
57
58 widget.grayify.enabled = false # todo - should be automagic
59 end
803d88e @pithyless main.rb: using autogui
authored
60 widget.quit.on(:clicked) { app.exit }
61 widget.show
36882f8 @pithyless adds main.rb: hello world example
authored
62 end
Something went wrong with that request. Please try again.