golumn 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -2
- data/exe/golumn +3 -1
- data/lib/golumn.rb +3 -2
- data/lib/golumn/app.rb +12 -34
- data/lib/golumn/array_grid.rb +30 -0
- data/lib/golumn/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb8564b943eb740140136bb19cdb603135aff55c
|
4
|
+
data.tar.gz: b27e55a0cae6e6fa89d988747b70714e57e18e4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee760e697904e34b8c2ba61088701e5bf979dd1d4ad1b361fc0044c171b2085ef6024d0ad90f8c3d3e0d40467779de5613e1631313663e21d75c3dbbad10b985
|
7
|
+
data.tar.gz: c3f387f15ac1bc6df75643d906544dfd5fa36d8a5ee9cbb36e2f8c596b0085ccd84a99400a6b95641fdf418bdccb625d3f3ae8e4babf4bfff95c64d0f3b1d5ab
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/exe/golumn
CHANGED
data/lib/golumn.rb
CHANGED
@@ -3,12 +3,13 @@ require 'rwx'
|
|
3
3
|
|
4
4
|
# internal libs
|
5
5
|
require 'golumn/version'
|
6
|
+
require 'golumn/array_grid'
|
6
7
|
require 'golumn/app'
|
7
8
|
|
8
9
|
# GUI column, get it?!?
|
9
10
|
module Golumn
|
10
11
|
# start main loop
|
11
|
-
def self.main
|
12
|
-
App.new.main_loop
|
12
|
+
def self.main(io: nil)
|
13
|
+
App.new(io: io).main_loop
|
13
14
|
end
|
14
15
|
end
|
data/lib/golumn/app.rb
CHANGED
@@ -1,43 +1,21 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
1
3
|
module Golumn
|
2
|
-
#
|
4
|
+
# Main app window
|
3
5
|
class App < WX::App
|
6
|
+
def initialize(io: ARGF)
|
7
|
+
@io = io
|
8
|
+
end
|
9
|
+
|
4
10
|
def on_init
|
5
11
|
@frame = WX::Frame.new(nil, title: 'widgets demo')
|
12
|
+
@frame.sizer = WX::BoxSizer.new(:vertical) do |box|
|
13
|
+
@grid = WX::Grid.new(@frame)
|
14
|
+
@grid.table = ArrayGrid.new(data: CSV.parse(@io.read))
|
15
|
+
box.add(@grid, expand: true)
|
16
|
+
end
|
6
17
|
@frame.layout
|
7
18
|
@frame.show
|
8
19
|
end
|
9
|
-
|
10
|
-
foo = <<-SQL
|
11
|
-
grid = new wxGrid( this,
|
12
|
-
-1,
|
13
|
-
wxPoint( 0, 0 ),
|
14
|
-
wxSize( 400, 300 ) );
|
15
|
-
// Then we call CreateGrid to set the dimensions of the grid
|
16
|
-
// (100 rows and 10 columns in this example)
|
17
|
-
grid->CreateGrid( 100, 10 );
|
18
|
-
// We can set the sizes of individual rows and columns
|
19
|
-
// in pixels
|
20
|
-
grid->SetRowSize( 0, 60 );
|
21
|
-
grid->SetColSize( 0, 120 );
|
22
|
-
// And set grid cell contents as strings
|
23
|
-
grid->SetCellValue( 0, 0, "wxGrid is good" );
|
24
|
-
// We can specify that some cells are read->only
|
25
|
-
grid->SetCellValue( 0, 3, "This is read->only" );
|
26
|
-
grid->SetReadOnly( 0, 3 );
|
27
|
-
// Colours can be specified for grid cell contents
|
28
|
-
grid->SetCellValue(3, 3, "green on grey");
|
29
|
-
grid->SetCellTextColour(3, 3, *wxGREEN);
|
30
|
-
grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY);
|
31
|
-
// We can specify the some cells will store numeric
|
32
|
-
// values rather than strings. Here we set grid column 5
|
33
|
-
// to hold floating point values displayed with width of 6
|
34
|
-
// and precision of 2
|
35
|
-
grid->SetColFormatFloat(5, 6, 2);
|
36
|
-
grid->SetCellValue(0, 6, "3.1415");
|
37
|
-
SQL
|
38
|
-
|
39
|
-
def build_grid
|
40
|
-
@grid = WX::Grid.new(nil, WX::Point.new(0, 0), WX::Size.new(400, 300))
|
41
|
-
end
|
42
20
|
end
|
43
21
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module Golumn
|
4
|
+
# main app
|
5
|
+
class ArrayGrid < WX::GridTable
|
6
|
+
def initialize(data:)
|
7
|
+
@data = data
|
8
|
+
end
|
9
|
+
|
10
|
+
def rows
|
11
|
+
@data.size
|
12
|
+
end
|
13
|
+
|
14
|
+
def cols
|
15
|
+
@data.first.size
|
16
|
+
end
|
17
|
+
|
18
|
+
def [](i, j)
|
19
|
+
@data[i][j]
|
20
|
+
end
|
21
|
+
|
22
|
+
def []=(i, j, value)
|
23
|
+
@data[i][j] = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def typename(*_)
|
27
|
+
:string
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/golumn/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: golumn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Pierce
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- golumn.gemspec
|
89
89
|
- lib/golumn.rb
|
90
90
|
- lib/golumn/app.rb
|
91
|
+
- lib/golumn/array_grid.rb
|
91
92
|
- lib/golumn/version.rb
|
92
93
|
homepage: https://github.com/ddrscott/golumn
|
93
94
|
licenses:
|