glimmer-dsl-libui 0.2.14 → 0.2.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fc5e2f1b4c01af406703b74785af4a3469d604ff06a798a3577895e0850645c
4
- data.tar.gz: 307dda9b6070a9c01a26a76590172f3a04c73f48998a462b5e334fc8cf2bde6d
3
+ metadata.gz: f23b1189d1941feb73e4bb46e1dde90c491815f3f0900aea06f43a05ceae56ff
4
+ data.tar.gz: 0243b5a6b58772596b0ca0ea6211376ee864654933ceedcd726543f88a49d364
5
5
  SHA512:
6
- metadata.gz: 232c835f1aa07097e7e190053adbc5f3572c4a9e77f94ad17d2b01fe47ff092c2722ad7236669bbff8a231dc5ba9908498173f4ad949e321f942f0d037ce4fc6
7
- data.tar.gz: 250349d677f9e5bcadb961747707370d9d67bb6d3bdd48a8990887eda2ee7db22905c2898d63bef4fc40b958ec1c8d25541af625991e36ab5c6b49d7766398fa
6
+ metadata.gz: ac7d1713123d01d73c40a7b8bef6e952cb6347247d53769a6f1c2592891c9889b38840d86bfe42d256116d8d70df3bd704a25114491c0b54ec9b155543b358ea
7
+ data.tar.gz: 887830207088df1a8380e558c42a5fd2b2c448c963da5018f81938767392954a73f37a2984fa831e43a4db22d5d6402980bac9dc0bfff96788cd6967aa643305
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.2.15
4
+
5
+ - Make examples/meta_example.rb output catch up more quickly with event puts statements
6
+ - Fix examples/color_the_circles.rb on Windows (it was crashing upon losing)
7
+
3
8
  ## 0.2.14
4
9
 
5
10
  - Revise examples/meta_example.rb to avoid blocking upon launching examples, thus permitting launching multiple examples at the same time
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.2.14
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.2.15
2
2
  ## Prerequisite-Free Ruby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
4
4
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -260,13 +260,15 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
260
260
  - [Applications](#applications)
261
261
  - [Manga2PDF](#manga2pdf)
262
262
  - [Befunge98 GUI](#befunge98-gui)
263
- - [Contributing to glimmer-dsl-libui](#contributing-to-glimmer-dsl-libui)
263
+ - [i3off Gtk Ruby](#i3off-gtk-ruby)
264
+ - [Process](#process)
265
+ - [Resources](#resources)
264
266
  - [Help](#help)
265
267
  - [Issues](#issues)
266
268
  - [Chat](#chat)
267
- - [Process](#process)
268
269
  - [Planned Features and Feature Suggestions](#planned-features-and-feature-suggestions)
269
270
  - [Change Log](#change-log)
271
+ - [Contributing](#contributing)
270
272
  - [Contributors](#contributors)
271
273
  - [License](#license)
272
274
 
@@ -347,7 +349,7 @@ gem install glimmer-dsl-libui
347
349
  Or install via Bundler `Gemfile`:
348
350
 
349
351
  ```ruby
350
- gem 'glimmer-dsl-libui', '~> 0.2.14'
352
+ gem 'glimmer-dsl-libui', '~> 0.2.15'
351
353
  ```
352
354
 
353
355
  Add `require 'glimmer-dsl-libui'` at the top, and then `include Glimmer` into the top-level main object for testing or into an actual class for serious usage.
@@ -1149,15 +1151,20 @@ class MetaExample
1149
1151
  end
1150
1152
 
1151
1153
  def run_example(example)
1152
- command = "ruby -r #{glimmer_dsl_libui_file} #{example} 2>&1"
1153
- result = ''
1154
- IO.popen(command) do |f|
1155
- f.each_line do |line|
1156
- result << line
1157
- puts line
1154
+ Thread.new do
1155
+ command = "ruby -r #{glimmer_dsl_libui_file} #{example} 2>&1"
1156
+ result = ''
1157
+ IO.popen(command) do |f|
1158
+ sleep(0.0001) # yield to main thread
1159
+ f.each_line do |line|
1160
+ result << line
1161
+ puts line
1162
+ $stdout.flush # for Windows
1163
+ sleep(0.0001) # yield to main thread
1164
+ end
1158
1165
  end
1166
+ Glimmer::LibUI.queue_main { msg_box('Error Running Example', result) } if result.downcase.include?('error')
1159
1167
  end
1160
- msg_box('Error Running Example', result) if result.downcase.include?('error')
1161
1168
  end
1162
1169
 
1163
1170
  def launch
@@ -6029,38 +6036,30 @@ https://github.com/AndyObtiva/befunge98/tree/gui
6029
6036
 
6030
6037
  ![befunge98 gui screenshot](https://raw.githubusercontent.com/AndyObtiva/befunge98/master/gui/glimmer-dsl-libui/befunge98_gui_glimmer_dsl_libui/screenshots/befunge98_gui_glimmer_dsl_libui_example.png)
6031
6038
 
6032
- ## Contributing to glimmer-dsl-libui
6039
+ ### i3off Gtk Ruby
6033
6040
 
6034
- - Check out the latest master to make sure the feature hasn't been
6035
- implemented or the bug hasn't been fixed yet.
6036
- - Check out the issue tracker to make sure someone already hasn't
6037
- requested it and/or contributed it.
6038
- - Fork the project.
6039
- - Start a feature/bugfix branch.
6040
- - Commit and push until you are happy with your contribution.
6041
- - Make sure to add tests for it. This is important so I don't break it
6042
- in a future version unintentionally.
6043
- - Please try not to mess with the Rakefile, version, or history. If
6044
- you want to have your own version, or is otherwise necessary, that
6045
- is fine, but please isolate to its own commit so I can cherry-pick
6046
- around it.
6041
+ https://github.com/iraamaro/i3off-gtk-ruby
6042
+
6043
+ ## Process
6044
+
6045
+ [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
6046
+
6047
+ ## Resources
6048
+
6049
+ - [libui C Library](https://github.com/andlabs/libui)
6050
+ - [LibUI Ruby Bindings](https://github.com/kojix2/LibUI)
6051
+ - [Code Master Blog](https://andymaleh.blogspot.com/search/label/LibUI)
6047
6052
 
6048
6053
  ## Help
6049
6054
 
6050
6055
  ### Issues
6051
6056
 
6052
- You may submit [issues](https://github.com/AndyObtiva/glimmer/issues) on [GitHub](https://github.com/AndyObtiva/glimmer/issues).
6053
-
6054
- [Click here to submit an issue.](https://github.com/AndyObtiva/glimmer/issues)
6057
+ If you encounter [issues](https://github.com/AndyObtiva/glimmer-dsl-libui/issues) that are not reported, discover missing features that are not mentioned in [TODO.md](TODO.md), or think up better ways to use [libui](https://github.com/andlabs/libui) than what is possible with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui), you may submit an [issue](https://github.com/AndyObtiva/glimmer-dsl-libui/issues/new) or [pull request](https://github.com/AndyObtiva/glimmer-dsl-libui/compare) on [GitHub](https://github.com).
6055
6058
 
6056
6059
  ### Chat
6057
6060
 
6058
6061
  If you need live help, try to [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6059
6062
 
6060
- ## Process
6061
-
6062
- [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
6063
-
6064
6063
  ## Planned Features and Feature Suggestions
6065
6064
 
6066
6065
  These features have been planned or suggested. You might see them in a future version of [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui). You are welcome to contribute more feature suggestions.
@@ -6071,6 +6070,22 @@ These features have been planned or suggested. You might see them in a future ve
6071
6070
 
6072
6071
  [CHANGELOG.md](CHANGELOG.md)
6073
6072
 
6073
+ ## Contributing
6074
+
6075
+ - Check out the latest master to make sure the feature hasn't been
6076
+ implemented or the bug hasn't been fixed yet.
6077
+ - Check out the issue tracker to make sure someone already hasn't
6078
+ requested it and/or contributed it.
6079
+ - Fork the project.
6080
+ - Start a feature/bugfix branch.
6081
+ - Commit and push until you are happy with your contribution.
6082
+ - Make sure to add tests for it. This is important so I don't break it
6083
+ in a future version unintentionally.
6084
+ - Please try not to mess with the Rakefile, version, or history. If
6085
+ you want to have your own version, or is otherwise necessary, that
6086
+ is fine, but please isolate to its own commit so I can cherry-pick
6087
+ around it.
6088
+
6074
6089
  ## Contributors
6075
6090
 
6076
6091
  * [Andy Maleh](https://github.com/AndyObtiva) (Founder)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.14
1
+ 0.2.15
@@ -27,15 +27,17 @@ class ColorTheCircles
27
27
 
28
28
  def register_observers
29
29
  observer = Glimmer::DataBinding::Observer.proc do |new_score|
30
- @score_label.text = new_score.to_s
31
- if new_score == -20
32
- @game_over = true
33
- msg_box('You Lost!', 'Sorry! Your score reached -20')
34
- restart_game
35
- elsif new_score == 0
36
- @game_over = true
37
- msg_box('You Won!', 'Congratulations! Your score reached 0')
38
- restart_game
30
+ Glimmer::LibUI.queue_main do
31
+ @score_label.text = new_score.to_s
32
+ if new_score == -20
33
+ @game_over = true
34
+ msg_box('You Lost!', 'Sorry! Your score reached -20')
35
+ restart_game
36
+ elsif new_score == 0
37
+ @game_over = true
38
+ msg_box('You Won!', 'Congratulations! Your score reached 0')
39
+ restart_game
40
+ end
39
41
  end
40
42
  end
41
43
  observer.observe(self, :score) # automatically enhances self to become Glimmer::DataBinding::ObservableModel and notify observer on score attribute changes
@@ -46,12 +46,12 @@ class MetaExample
46
46
  command = "ruby -r #{glimmer_dsl_libui_file} #{example} 2>&1"
47
47
  result = ''
48
48
  IO.popen(command) do |f|
49
- sleep(0.01) # yield to main thread
49
+ sleep(0.0001) # yield to main thread
50
50
  f.each_line do |line|
51
51
  result << line
52
52
  puts line
53
53
  $stdout.flush # for Windows
54
- sleep(0.01) # yield to main thread
54
+ sleep(0.0001) # yield to main thread
55
55
  end
56
56
  end
57
57
  Glimmer::LibUI.queue_main { msg_box('Error Running Example', result) } if result.downcase.include?('error')
Binary file
data/lib/glimmer/libui.rb CHANGED
@@ -27,11 +27,11 @@ module Glimmer
27
27
  include Glimmer::FiddleConsumer
28
28
 
29
29
  def integer_to_boolean(int, allow_nil: true)
30
- int.nil? ? (allow_nil ? nil : false) : ((int.is_a?(TrueClass) || int.is_a?(FalseClass)) ? int : int == 1)
30
+ int.nil? ? (allow_nil ? nil : false) : ((int.is_a?(TrueClass) || int.is_a?(FalseClass)) ? int : (int.is_a?(Integer) ? int == 1 : (allow_nil ? nil : false)))
31
31
  end
32
32
 
33
33
  def boolean_to_integer(bool, allow_nil: true)
34
- bool.nil? ? (allow_nil ? nil : 0) : (bool.is_a?(Integer) ? bool : (bool == true ? 1 : 0))
34
+ bool.nil? ? (allow_nil ? nil : 0) : (bool.is_a?(Integer) ? bool : (bool.is_a?(TrueClass) || bool.is_a?(FalseClass) ? (bool == true ? 1 : 0) : (allow_nil ? nil : 0)))
35
35
  end
36
36
 
37
37
  def degrees_to_radians(degrees)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-24 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer