green_shoes 1.0.273 → 1.0.282

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.273
1
+ 1.0.282
@@ -61,5 +61,4 @@ require_relative 'plugins/treeview'
61
61
  autoload :ChipMunk, File.join(Shoes::DIR, 'ext/chipmunk')
62
62
  autoload :Bloops, File.join(Shoes::DIR, 'ext/bloops')
63
63
  autoload :Projector, File.join(Shoes::DIR, 'ext/projector')
64
- autoload :Hpricot, File.join(Shoes::DIR, 'ext/hpricot')
65
64
  autoload :HH, File.join(Shoes::DIR, 'ext/highlighter')
@@ -10,7 +10,7 @@ class Shoes
10
10
  win_title = @owner.instance_variable_get('@title')
11
11
  class << @owner; self end.
12
12
  class_eval do
13
- define_method :to_s do
13
+ define_method :inspect do
14
14
  win_title or 'green shoes'
15
15
  end
16
16
  end if @owner
@@ -92,10 +92,8 @@ class Shoes
92
92
  @app.cslot.contents.delete self
93
93
  remove
94
94
  @real = nil
95
- when TextBlock
96
- @real.clear if @real
97
95
  else
98
- (@real.clear; @real.destroy) if @real
96
+ @real.clear if @real
99
97
  end
100
98
  end
101
99
 
@@ -1,3 +1,11 @@
1
+ begin
2
+ require 'hpricot'
3
+ rescue LoadError
4
+ require File.join(Shoes::DIR, 'ext/hpricot')
5
+ end
6
+
7
+ require 'nkf'
8
+
1
9
  class Manual < Shoes
2
10
  url '/', :index
3
11
  url '/manual/(\d+)', :index
@@ -206,6 +214,7 @@ class Manual < Shoes
206
214
 
207
215
  def self.load_docs path
208
216
  str = IO.read(path).force_encoding("UTF-8")
217
+ str = NKF.nkf('-wLu', str) unless RUBY_PLATFORM =~ /mingw/
209
218
  (str.split(/^= (.+?) =/)[1..-1]/2).map do |k, v|
210
219
  sparts = v.split(/^== (.+?) ==/)
211
220
  sections = (sparts[1..-1]/2).map do |k2, v2|
@@ -225,7 +225,7 @@ class Shoes
225
225
 
226
226
  def self.mouse_click_control app
227
227
  app.mccs.each do |e|
228
- e.click_proc[*app.mouse] if mouse_on? e
228
+ e.click_proc[*app.mouse] if mouse_on?(e) && !$dde
229
229
  end
230
230
  end
231
231
 
@@ -263,7 +263,7 @@ class Shoes
263
263
  app.mlcs.each do |tb|
264
264
  next if tb.hided
265
265
  link_proc, = mouse_on_link(tb, app)
266
- link_proc.call if link_proc
266
+ link_proc.call if link_proc && !$dde
267
267
  end
268
268
  end
269
269
 
@@ -48,6 +48,7 @@ class Shoes
48
48
  app.mouse_pos = app.win.pointer
49
49
  mouse_click_control app
50
50
  mouse_link_control app
51
+ $dde = false
51
52
  end
52
53
 
53
54
  win.signal_connect "button_release_event" do
@@ -1,5 +1,5 @@
1
1
  class Shoes
2
- def self.show_manual lang
2
+ def self.show_manual lang='English'
3
3
  $lang = lang
4
4
  load File.join(DIR, 'shoes/help.rb')
5
5
  end
@@ -7,7 +7,8 @@ end
7
7
 
8
8
  class Object
9
9
  include Types
10
- def alert msg
10
+ def alert msg, options={:block => true}
11
+ $dde = true
11
12
  dialog = Gtk::MessageDialog.new(
12
13
  get_win,
13
14
  Gtk::Dialog::MODAL,
@@ -16,11 +17,17 @@ class Object
16
17
  msg.to_s
17
18
  )
18
19
  dialog.title = "Green Shoes says:"
19
- dialog.run
20
- dialog.destroy
20
+ if options[:block]
21
+ dialog.run
22
+ dialog.destroy
23
+ else
24
+ dialog.signal_connect("response"){ dialog.destroy }
25
+ dialog.show
26
+ end
21
27
  end
22
28
 
23
29
  def confirm msg
30
+ $dde = true
24
31
  dialog = Gtk::Dialog.new(
25
32
  "Green Shoes asks:",
26
33
  get_win,
@@ -37,6 +44,7 @@ class Object
37
44
  end
38
45
 
39
46
  def ask msg, args={}
47
+ $dde = true
40
48
  dialog = Gtk::Dialog.new(
41
49
  "Green Shoes asks:",
42
50
  get_win,
@@ -71,6 +79,7 @@ class Object
71
79
  end
72
80
 
73
81
  def dialog_chooser title, action, button
82
+ $dde = true
74
83
  dialog = Gtk::FileChooserDialog.new(
75
84
  title,
76
85
  get_win,
@@ -85,6 +94,7 @@ class Object
85
94
  end
86
95
 
87
96
  def ask_color title = 'Pick a color...'
97
+ $dde = true
88
98
  dialog = Gtk::ColorSelectionDialog.new title
89
99
  dialog.icon = Gdk::Pixbuf.new File.join(DIR, '../static/gshoes-icon.png')
90
100
  dialog.run
@@ -148,6 +158,11 @@ class Array
148
158
  def clear_all
149
159
  self.each &:clear_all
150
160
  end
161
+
162
+ alias :_to_s :to_s
163
+ def to_s
164
+ self.map(&:to_s)._to_s
165
+ end
151
166
  end
152
167
 
153
168
  class NilClass
@@ -638,7 +638,7 @@ are trying to sniff out what release of Green Shoes is running.
638
638
  end
639
639
  }}}
640
640
 
641
- === alert(message: a string) » nil ===
641
+ === alert(message: a string, :block => true or false) » nil ===
642
642
 
643
643
  Pops up a window containing a short message.
644
644
 
@@ -651,6 +651,8 @@ Please use alerts sparingly, as they are incredibly annoying! If you are using
651
651
  alerts to show messages to help you debug your program, try checking out the
652
652
  standard Ruby method `puts` or `p` methods.
653
653
 
654
+ If you want to make alert() thread safe, i.e. unblock main thread, use `:block => false` option.
655
+
654
656
  === ask(message: a string) » a string ===
655
657
 
656
658
  Pops up a window and asks a question. For example, you may want to ask someone
@@ -2209,6 +2211,11 @@ colors with a #06E (blue) colored stroke.
2209
2211
 
2210
2212
  The default LinkHover style is also single-underlined with a #039 (dark blue) stroke.
2211
2213
 
2214
+ === link(text){ ... } » Shoes::Link ===
2215
+
2216
+ Creates a Link text block. You can also write with this style. When user clicks the link text,
2217
+ the block will be launched.
2218
+
2212
2219
  === list_box(:items => [strings, ...]) » Shoes::ListBox ===
2213
2220
 
2214
2221
  Adds a drop-down list box containing entries for everything in the `items`
@@ -2328,11 +2335,11 @@ window. This way the child window can call the parent.
2328
2335
  {{{
2329
2336
  #!ruby
2330
2337
  Shoes.app title: "The Owner" do
2331
- button "Pop up?" do
2332
- window do
2333
- para "Okay, popped up from [#{owner}]."
2334
- end
2338
+ button "Pop up?" do
2339
+ window do
2340
+ para "Okay, popped up from [#{owner.inspect}]."
2335
2341
  end
2342
+ end
2336
2343
  end
2337
2344
  }}}
2338
2345
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: green_shoes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.273
4
+ version: 1.0.282
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-18 00:00:00.000000000Z
12
+ date: 2011-09-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gtk2
16
- requirement: &16045188 !ruby/object:Gem::Requirement
16
+ requirement: &16049412 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16045188
24
+ version_requirements: *16049412
25
25
  description: Green Shoes is one of colorful Shoes, written in pure Ruby with Ruby/GTK2.
26
26
  email: ashbbb@gmail.com
27
27
  executables: []