miga-base 0.2.0.7 → 0.2.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01b3728971a5d407f85578447d4a66dc4c8ab8a8
4
- data.tar.gz: 656535155e0316681f2d7aa9bcc8b501caed9d96
3
+ metadata.gz: 8d5b65b148f8dcf02c72cb2f639dc5e9489e6c48
4
+ data.tar.gz: 9a622a92c91d26a9bb9e0c95c113fa2c3e37e115
5
5
  SHA512:
6
- metadata.gz: 5daf2a27f6a6119e18e5eda94dbda72be91ad7b46f4f8bea401f111ce95d907c88930b08d85543c1694a82aeac54c42dff5d0c3586c0846123d1e1881ad23885
7
- data.tar.gz: 0a75b0152ad7374729c1cb09b02b539b70429902850c81cdb086f64e9b616cc66f5ba032469be85505c103dc05d15b9469b2c26689b8b4dee2b0c3ef6636ad61
6
+ metadata.gz: 5d6fde30f68fa1b4c011ad48de229fde75b01d3113028f169e4e6fa951328db7ae4b78f16366772900d65eb8b5047cca6464f6b9ea0428f406d1a85d0ddfb7d7
7
+ data.tar.gz: 286a9b45b54bb400ca772cec6c8dc9c9c2ed62de170dd28a1b715af590e726a6544a1a127495062b41764de6e4f3ddfa92566196fdbd84febc6041056cf566af
data/README.md CHANGED
@@ -3,19 +3,20 @@
3
3
  [![Build Status](https://travis-ci.org/bio-miga/miga.svg?branch=master)](https://travis-ci.org/bio-miga/miga)
4
4
  [![Gem Version](https://badge.fury.io/rb/miga-base.svg)](https://badge.fury.io/rb/miga-base)
5
5
  [![Inch docs](http://inch-ci.org/github/bio-miga/miga.svg)](http://inch-ci.org/github/bio-miga/miga)
6
- [![Yard docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/github/bio-miga/miga)
7
6
 
8
7
 
9
8
  # MiGA: Microbial Genomes Atlas
10
9
 
11
- **Important**: The MiGA code is under active development, and we currently
12
- cannot ensure any stability on the different interfaces. We'll be launching a
13
- Beta Testing program soon, with dedicated support for a small number of
14
- laboratories. If you're interested, please [contact us][contact].
10
+ **Important**: MiGA is under active development, and we currently cannot ensure
11
+ any stability on the different interfaces. We'll be launching a Beta Testing
12
+ program soon, with dedicated support for a small number of laboratories. If
13
+ you're interested, please [contact us][contact].
15
14
 
16
- For additional information on the MiGA system, please refer to the
17
- [MiGA manual][gitbook]. For additional information on the MiGA API
18
- (and Ruby gem), please refer to the [miga docs][rubydoc].
15
+ For additional information on MiGA, visit:
16
+ * [MiGA manual][gitbook]: The definitive guide to MiGA.
17
+ * [MiGA API docs][rubydoc]: Inner-workings of the `miga-base` gem.
18
+ * [MiGA Web][miga-web]: MiGA on Rails!
19
+ * [MiGA GUI][miga-gui]: MiGA on Shoes!
19
20
 
20
21
 
21
22
  # Authors
@@ -31,3 +32,5 @@ See [LICENSE](LICENSE).
31
32
  [gitbook]: https://miga.gitbooks.io/miga/content/
32
33
  [rubydoc]: http://www.rubydoc.info/github/bio-miga/miga
33
34
  [contact]: http://enve-omics.gatech.edu/node/7
35
+ [miga-web]: https://github.com/bio-miga/miga-web
36
+ [miga-gui]: https://github.com/bio-miga/miga-gui
data/Rakefile CHANGED
@@ -3,29 +3,13 @@ require "rake/testtask"
3
3
  SOURCES = FileList["lib/**/*.rb"]
4
4
 
5
5
  desc "Default Task"
6
- task :default => "test:base"
7
-
8
- desc "Base Tests"
9
- Rake::TestTask.new("test:base") do |t|
10
- t.libs << "test"
11
- t.pattern = "test/[^j]*_test.rb"
12
- t.verbose = true
13
- end
14
-
15
- desc "GUI Tests"
16
- Rake::TestTask.new("test:gui") do |t|
17
- ENV["GUI_TESTS"] = "true"
18
- t.libs << "test"
19
- t.libs << "test"
20
- t.pattern = "test/j*_test.rb"
21
- t.verbose = true
22
- end
23
-
24
- desc "All the tests"
25
- Rake::TestTask.new("test:all") do |t|
26
- ENV["GUI_TESTS"] = "true"
27
- t.libs << "test"
28
- t.libs << "test"
29
- t.pattern = "test/*_test.rb"
30
- t.verbose = true
6
+ task :default => "test:all"
7
+
8
+ namespace :test do
9
+ desc "All tests"
10
+ Rake::TestTask.new(:all) do |t|
11
+ t.libs << "test"
12
+ t.pattern = "test/*_test.rb"
13
+ t.verbose = true
14
+ end
31
15
  end
data/lib/miga/version.rb CHANGED
@@ -10,7 +10,7 @@ module MiGA
10
10
  # - Float representing the major.minor version.
11
11
  # - Integer representing gem releases of the current version.
12
12
  # - Integer representing minor changes that require new version number.
13
- VERSION = [0.2, 0, 7]
13
+ VERSION = [0.2, 0, 8]
14
14
 
15
15
  ##
16
16
  # Nickname for the current major.minor version.
data/test/common_test.rb CHANGED
@@ -3,7 +3,7 @@ require "test_helper"
3
3
  class CommonTest < Test::Unit::TestCase
4
4
 
5
5
  def setup
6
- $gui_tests = !ENV["GUI_TESTS"].nil?
6
+ $jruby_tests = !ENV["JRUBY_TESTS"].nil?
7
7
  end
8
8
 
9
9
  def test_debug
@@ -28,7 +28,7 @@ class CommonTest < Test::Unit::TestCase
28
28
  assert_respond_to(MiGA::MiGA, :DEBUG)
29
29
  assert_respond_to(MiGA::MiGA, :DEBUG_ON)
30
30
  assert_respond_to(MiGA::MiGA, :DEBUG_OFF)
31
- omit_if($gui_tests, "JRuby doesn't like interceptions.")
31
+ omit_if($jruby_tests, "JRuby doesn't like interceptions.")
32
32
  MiGA::MiGA.DEBUG_TRACE_ON
33
33
  err = capture_stderr do
34
34
  MiGA::MiGA.DEBUG "Dandadi"
@@ -5,7 +5,7 @@ class MetadataTest < Test::Unit::TestCase
5
5
 
6
6
  def setup
7
7
  $tmp = Dir.mktmpdir
8
- $gui_tests = !ENV["GUI_TESTS"].nil?
8
+ $jruby_tests = !ENV["JRUBY_TESTS"].nil?
9
9
  end
10
10
 
11
11
  def teardown
@@ -13,7 +13,7 @@ class MetadataTest < Test::Unit::TestCase
13
13
  end
14
14
 
15
15
  def test_save
16
- omit_if($gui_tests, "JRuby doesn't implement fork.")
16
+ omit_if($jruby_tests, "JRuby doesn't implement fork.")
17
17
  md1 = MiGA::Metadata.new(File.expand_path("md_save.json", $tmp))
18
18
  FileUtils.touch(md1.lock_file)
19
19
  fork do
@@ -30,7 +30,7 @@ class MetadataTest < Test::Unit::TestCase
30
30
  def test_load
31
31
  md1 = MiGA::Metadata.new(File.expand_path("md_load.json", $tmp), {:t=>1})
32
32
  assert_equal(1, md1[:t])
33
- omit_if($gui_tests, "JRuby doesn't implement fork.")
33
+ omit_if($jruby_tests, "JRuby doesn't implement fork.")
34
34
  FileUtils.touch(md1.lock_file)
35
35
  fork do
36
36
  sleep(1)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.7
4
+ version: 0.2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
@@ -14,84 +14,70 @@ dependencies:
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
- - !ruby/object:Gem::Dependency
28
- name: sqlite3
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.3'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.3'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: daemons
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - "~>"
31
+ - - ~>
46
32
  - !ruby/object:Gem::Version
47
33
  version: '1.2'
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - "~>"
38
+ - - ~>
53
39
  - !ruby/object:Gem::Version
54
40
  version: '1.2'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: json
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ~>
60
46
  - !ruby/object:Gem::Version
61
47
  version: '1.8'
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ~>
67
53
  - !ruby/object:Gem::Version
68
54
  version: '1.8'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ~>
74
60
  - !ruby/object:Gem::Version
75
61
  version: '11'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - "~>"
66
+ - - ~>
81
67
  - !ruby/object:Gem::Version
82
68
  version: '11'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: test-unit
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
73
+ - - ~>
88
74
  - !ruby/object:Gem::Version
89
75
  version: '3'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - "~>"
80
+ - - ~>
95
81
  - !ruby/object:Gem::Version
96
82
  version: '3'
97
83
  description: Microbial Genomes Atlas
@@ -102,28 +88,9 @@ extensions: []
102
88
  extra_rdoc_files:
103
89
  - README.md
104
90
  files:
105
- - Gemfile
106
- - LICENSE
107
- - README.md
108
- - Rakefile
109
- - actions/add_result
110
- - actions/add_taxonomy
111
- - actions/create_dataset
112
- - actions/create_project
113
- - actions/daemon
114
- - actions/download_dataset
115
- - actions/find_datasets
116
- - actions/import_datasets
117
- - actions/index_taxonomy
118
- - actions/list_datasets
119
- - actions/list_files
120
- - actions/unlink_dataset
121
- - bin/miga
122
- - lib/miga.rb
123
91
  - lib/miga/common.rb
124
92
  - lib/miga/daemon.rb
125
93
  - lib/miga/dataset.rb
126
- - lib/miga/gui.rb
127
94
  - lib/miga/metadata.rb
128
95
  - lib/miga/project.rb
129
96
  - lib/miga/remote_dataset.rb
@@ -131,6 +98,16 @@ files:
131
98
  - lib/miga/tax_index.rb
132
99
  - lib/miga/taxonomy.rb
133
100
  - lib/miga/version.rb
101
+ - lib/miga.rb
102
+ - test/common_test.rb
103
+ - test/daemon_test.rb
104
+ - test/dataset_test.rb
105
+ - test/metadata_test.rb
106
+ - test/project_test.rb
107
+ - test/remote_dataset_test.rb
108
+ - test/tax_index_test.rb
109
+ - test/taxonomy_test.rb
110
+ - test/test_helper.rb
134
111
  - scripts/_distances_noref_nomulti.bash
135
112
  - scripts/_distances_ref_nomulti.bash
136
113
  - scripts/aai_distances.bash
@@ -151,22 +128,29 @@ files:
151
128
  - scripts/subclades.bash
152
129
  - scripts/trimmed_fasta.bash
153
130
  - scripts/trimmed_reads.bash
154
- - test/common_test.rb
155
- - test/daemon_test.rb
156
- - test/dataset_test.rb
157
- - test/jruby_gui_test.rb
158
- - test/metadata_test.rb
159
- - test/project_test.rb
160
- - test/remote_dataset_test.rb
161
- - test/tax_index_test.rb
162
- - test/taxonomy_test.rb
163
- - test/test_helper.rb
164
131
  - utils/adapters.fa
165
132
  - utils/mytaxa_scan.R
166
133
  - utils/mytaxa_scan.rb
167
134
  - utils/requirements.txt
168
135
  - utils/subclades-compile.rb
169
136
  - utils/subclades.R
137
+ - bin/miga
138
+ - actions/add_result
139
+ - actions/add_taxonomy
140
+ - actions/create_dataset
141
+ - actions/create_project
142
+ - actions/daemon
143
+ - actions/download_dataset
144
+ - actions/find_datasets
145
+ - actions/import_datasets
146
+ - actions/index_taxonomy
147
+ - actions/list_datasets
148
+ - actions/list_files
149
+ - actions/unlink_dataset
150
+ - Gemfile
151
+ - Rakefile
152
+ - README.md
153
+ - LICENSE
170
154
  homepage: http://enve-omics.ce.gatech.edu/miga
171
155
  licenses:
172
156
  - Artistic-2.0
@@ -175,25 +159,25 @@ post_install_message:
175
159
  rdoc_options:
176
160
  - lib
177
161
  - README.md
178
- - "--main"
162
+ - --main
179
163
  - README.md
180
- - "--title"
164
+ - --title
181
165
  - MiGA
182
166
  require_paths:
183
167
  - lib
184
168
  required_ruby_version: !ruby/object:Gem::Requirement
185
169
  requirements:
186
- - - "~>"
170
+ - - ~>
187
171
  - !ruby/object:Gem::Version
188
172
  version: '2.0'
189
173
  required_rubygems_version: !ruby/object:Gem::Requirement
190
174
  requirements:
191
- - - ">="
175
+ - - '>='
192
176
  - !ruby/object:Gem::Version
193
177
  version: '0'
194
178
  requirements: []
195
179
  rubyforge_project:
196
- rubygems_version: 2.5.1
180
+ rubygems_version: 2.0.14
197
181
  signing_key:
198
182
  specification_version: 4
199
183
  summary: MiGA
data/lib/miga/gui.rb DELETED
@@ -1,366 +0,0 @@
1
- # @package MiGA
2
- # @license Artistic-2.0
3
-
4
- require "miga/common"
5
- require "miga/project"
6
- require "shoes"
7
- require "shoes/swt"
8
-
9
- Shoes::Swt.initialize_backend
10
-
11
- ##
12
- # Graphical User Interface for MiGA using Shoes.
13
- class MiGA::GUI < Shoes
14
-
15
- # Class-level
16
-
17
- ##
18
- # Set system status for MiGA::GUI.
19
- def self.status=(status) @@STATUS = status ; end
20
-
21
- ##
22
- # System status for MiGA::GUI.
23
- def self.status() @@STATUS; end
24
- @@STATUS = "Initializing MiGA..."
25
-
26
- ##
27
- # Reset the system status for MiGA::GUI.
28
- def self.reset_status() @@STATUS="MiGA is ready to go!" ; end
29
-
30
- url "/", :index
31
- url "/project", :project
32
- url "/datasets", :datasets
33
- url "/dataset-(.*)", :dataset
34
- url "/report", :report
35
- $miga_gui_path = File.expand_path("../../../gui", __FILE__)
36
-
37
- ##
38
- # Initialize GUI.
39
- def self.init (&block)
40
- Shoes.app title: "MiGA | Microbial Genomes Atlas",
41
- width: 750, height: 400, &block
42
- end
43
-
44
- # =====================[ View : Windows ]
45
-
46
- ##
47
- # Main window.
48
- def index
49
- header("Microbial Genomes Atlas")
50
- stack(margin:40) do
51
- menu_bar [:open_project, :new_project, :help]
52
- box alpha: 0.0 do
53
- para "Welcome to the MiGA GUI. If you use MiGA in your research, ",
54
- "please consider citing:\n", MiGA::MiGA.CITATION
55
- end
56
- end
57
- MiGA::GUI.reset_status
58
- status_bar
59
- end
60
-
61
- ##
62
- # Project window.
63
- def project
64
- header("» " + $project.name.unmiga_name)
65
- stack(margin:40) do
66
- menu_bar [:list_datasets, :new_dataset, :progress_report, :help]
67
- stack(margin_top:10) do
68
- para strong("Path"), ": ", $project.path
69
- para strong("Datasets"), ": ", $project.metadata[:datasets].size
70
- $project.metadata.each do |k,v|
71
- para(strong(k.to_s.capitalize), ": ", v) unless k==:datasets
72
- end
73
- end
74
- end
75
- MiGA::GUI.reset_status
76
- end
77
-
78
- ##
79
- # Datasets list window.
80
- def datasets
81
- header("» " + $project.name.unmiga_name)
82
- stack(margin:40) do
83
- para "#{$project.metadata[:datasets].size} datasets:"
84
- para ""
85
- flow(width: 1.0) do
86
- $project.metadata[:datasets].each do |name|
87
- stack(width:150) do
88
- para "> ", link(name.unmiga_name){ show_dataset(name) }
89
- end
90
- end
91
- end
92
- end
93
- MiGA::GUI.reset_status
94
- end
95
-
96
- ##
97
- # Dataset details window.
98
- def dataset(name)
99
- header("» " + $project.name.unmiga_name + " » " + name.unmiga_name)
100
- stack(margin:40) do
101
- ds = $project.dataset(name)
102
- stack do
103
- ds.metadata.each { |k,v| para strong(k.to_s.capitalize), ": ", v }
104
- end
105
- flow(margin_top:10) do
106
- w = 40+30*MiGA::Dataset.PREPROCESSING_TASKS.size
107
- stack(width:w) do
108
- subtitle "Advance"
109
- done = graphic_advance(ds)
110
- para sprintf("%.1f%% Complete", done*100)
111
- end
112
- stack(width:-w) do
113
- subtitle "Task"
114
- $task_name_field = stack { para "" }
115
- animate do
116
- $task_name_field.clear{ para $task }
117
- end
118
- end
119
- end
120
- MiGA::GUI.reset_status
121
- end
122
- end
123
-
124
- ##
125
- # Project report window.
126
- def report
127
- header("» " + $project.name.unmiga_name)
128
- stack(margin:40) do
129
- $done_para = subtitle "Dataset tasks advance: "
130
- $done = 0.0
131
- w = 40+30*MiGA::Dataset.PREPROCESSING_TASKS.size
132
- stack(width:w) do
133
- stack(margin_top:10) do
134
- $done = $project.datasets.map{ |ds| graphic_advance(ds, 7) }.inject(:+)
135
- motion { |_,y| show_report_hover(w, y) }
136
- click { show_dataset($dataset) }
137
- end
138
- $done /= $project.metadata[:datasets].size
139
- $done_para.text += sprintf("%.1f%% Complete.", $done*100)
140
- end
141
- $task_ds_box = stack(width:-w)
142
- stack(margin_top:10) do
143
- subtitle "Project-wide tasks:"
144
- tasks = MiGA::Project.DISTANCE_TASKS
145
- tasks += MiGA::Project.INCLADE_TASK if $project.metadata[:type]==:clade
146
- tasks.each do |t|
147
- para strong(t), ": ",
148
- ($project.add_result(t, false).nil? ? "Pending" : "Done")
149
- end
150
- end if $done==1.0
151
- end
152
- end
153
-
154
- private
155
-
156
- ##
157
- # The MiGA GUI's blue.
158
- def miga_blue(alpha=1.0)
159
- rgb(0,121,166,alpha)
160
- end
161
-
162
- ##
163
- # The MIGA GUI's red.
164
- def miga_red(alpha=1.0)
165
- rgb(179,0,3,alpha)
166
- end
167
-
168
- # =====================[ View : Elements ]
169
-
170
- ##
171
- # Header in all windows
172
- def header(msg="")
173
- # workaround to shoes/shoes4#1212:
174
- $clicky ||= []
175
- $clicky.each{ |i| i.hide }
176
- $clicky = []
177
- # Keyboard support
178
- key_shortcuts = {
179
- :control_o => :open_project, :super_o => :open_project,
180
- :control_n => :new_project, :super_n => :new_project,
181
- :control_l => :list_datasets, :super_l => :list_datasets,
182
- :control_r => :progress_report, :super_r => :progress_report
183
- }
184
- keypress do |key|
185
- funct = key_shortcuts[key]
186
- send(funct) unless funct.nil?
187
- end
188
- # Graphical header
189
- flow(margin:[40,10,40,0]) do
190
- image $miga_gui_path + "/img/MiGA-sm.png", width: 120, height: 50
191
- title msg, margin_top: 5, margin_left: 5
192
- end
193
- end
194
-
195
- ##
196
- # General-purpose box
197
- def box(opts={}, &blk)
198
- flow(margin_bottom:5) do
199
- opts[:alpha] ||= 0.2
200
- opts[:side_line] ||= miga_blue
201
- opts[:background] ||= miga_blue(opts[:alpha])
202
- stack(width: 5, height: 1.0) do
203
- background opts[:side_line]
204
- end unless opts[:right]
205
- stack(width: -5) do
206
- background opts[:background]
207
- stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190
208
- s = stack(margin:5, &blk)
209
- unless opts[:click].nil?
210
- s.click{ visit opts[:click] }
211
- end
212
- end
213
- stack(width: 5, height: 1.0) do
214
- background opts[:side_line]
215
- end if opts[:right]
216
- end
217
- end
218
-
219
- ##
220
- # Menu bar.
221
- def menu_bar actions
222
- box do
223
- flow do
224
- img = {
225
- open_project: "iconmonstr-archive-5-icon-40",
226
- new_project: "iconmonstr-plus-5-icon-40",
227
- list_datasets: "iconmonstr-note-10-icon-40",
228
- new_dataset: "iconmonstr-note-25-icon-40",
229
- progress_report: "iconmonstr-bar-chart-2-icon-40",
230
- help: "iconmonstr-help-3-icon-40"}
231
- actions.each do |k|
232
- flow(margin:0, width:200) do
233
- image $miga_gui_path + "/img/#{img[k]}.png", margin: 2
234
- button(k.to_s.unmiga_name.capitalize, top:5){ send(k) }
235
- end
236
- end
237
- end
238
- end
239
- end
240
-
241
- ##
242
- # Status bar.
243
- def status_bar
244
- stack(bottom:0) do
245
- flow bottom:0, height:20, margin:0 do
246
- background "#CCC"
247
- $status_cont = stack(width:-300, height:1.0, margin_left:45)
248
- every do
249
- $status_cont.clear { inscription MiGA::GUI.status, margin:5 }
250
- end
251
- stack(width:250, height:1.0, right: 5) do
252
- inscription MiGA::MiGA.LONG_VERSION, align:"right", margin:5
253
- end
254
- end
255
- image "#{$miga_gui_path}/img/MiGA-sq.png",
256
- left:10, bottom:5, width:30, height:32
257
- end
258
- end
259
-
260
- ##
261
- # Display processing status of a dataset as a horizontal bar, as reported
262
- # by MiGA::Dataset#profile_advance.
263
- def graphic_advance(ds, h=10)
264
- ds_adv = ds.profile_advance
265
- flow(width:30*MiGA::Dataset.PREPROCESSING_TASKS.size) do
266
- nostroke
267
- col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
268
- ds_adv.each_index do |i|
269
- stack(width:28,margin:0,top:0,left:i*30,height:h) do
270
- background col[ ds_adv[i] ]
271
- t = MiGA::Dataset.PREPROCESSING_TASKS[i]
272
- hover do
273
- $task = t
274
- $dataset = ds.name.unmiga_name
275
- end
276
- leave do
277
- $task = nil
278
- $dataset = nil
279
- $task_ds_box.hide unless $task_ds_box.nil?
280
- end
281
- end
282
- end
283
- nofill
284
- end
285
- return 0.0 if ds_adv.count{|i| i>0} <= 1
286
- (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
287
- end
288
-
289
- ##
290
- # Show floating window with additional information on report cells.
291
- def show_report_hover(w, y)
292
- unless $task.nil?
293
- $task_ds_box.clear do
294
- para strong("Task: "), $task, "\n", strong("Dataset: "), $dataset
295
- end
296
- $task_ds_box.show
297
- $task_ds_box.move(w-20, y-115)
298
- end
299
- end
300
-
301
- # =====================[ Controller : Projects ]
302
-
303
- ##
304
- # Load a project.
305
- def open_project
306
- open_window("Opening project...") do
307
- folder = ask_open_folder
308
- if folder.nil? or not MiGA::Project.exist?(folder)
309
- alert "Cannot find a MiGA project at #{folder}!" unless folder.nil?
310
- else
311
- $project = MiGA::Project.new(folder)
312
- visit "/project"
313
- end
314
- end
315
- end
316
-
317
- ##
318
- # Create a project.
319
- def new_project
320
- open_window("Creating project...") do
321
- if MiGA::MiGA.initialized?
322
- folder = ask_save_folder
323
- if folder.nil? or MiGA::Project.exist?(folder)
324
- alert "Cannot overwrite existent MiGA project at #{folder}!" unless
325
- folder.nil?
326
- else
327
- $project = MiGA::Project.new(folder)
328
- visit "/project"
329
- end
330
- else
331
- # FIXME Add a way to initialize MiGA from the GUI
332
- alert "MiGA is currently uninitialized, no projects can be created."
333
- end
334
- end
335
- end
336
-
337
- ##
338
- # Open a window on #datasets.
339
- def list_datasets
340
- open_window("Listing all datasets..."){
341
- visit "/datasets" } unless $project.nil?
342
- end
343
-
344
- ##
345
- # Open a window on #dataset +name+.
346
- def show_dataset(name)
347
- open_window("Showing dataset details..."){
348
- visit "/dataset-#{name}" } unless name.nil?
349
- end
350
-
351
- ##
352
- # Open a window on #report.
353
- def progress_report
354
- open_window("Creating progress report..."){
355
- visit "/report" } unless $project.nil?
356
- end
357
-
358
- ##
359
- # Open a window sending +msg+ to the status, the yields +blk+.
360
- def open_window(msg, &blk)
361
- MiGA::GUI.status = msg
362
- MiGA::GUI.init(&blk)
363
- MiGA::GUI.reset_status
364
- end
365
-
366
- end
@@ -1,20 +0,0 @@
1
- require "test_helper"
2
- require "miga/gui"
3
-
4
- class GUITest < Test::Unit::TestCase
5
-
6
- def setup
7
- $app = MiGA::GUI.new
8
- end
9
-
10
- def test_status
11
- assert_respond_to(MiGA::GUI, :status)
12
- assert_equal("Initializing MiGA...", MiGA::GUI.status)
13
- assert_equal(MiGA::GUI, $app.class)
14
- MiGA::GUI.status = "Well well well..."
15
- assert_equal("Well well well...", MiGA::GUI.status)
16
- MiGA::GUI.reset_status
17
- assert_equal("MiGA is ready to go!", MiGA::GUI.status)
18
- end
19
-
20
- end