y_support 2.0.15 → 2.0.16

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: 19f2a4354d073554969497236a840bfc627b82c4
4
- data.tar.gz: 16c398767b9bf9fe5f8b47493afc5ce19217ce94
3
+ metadata.gz: 07ba290c9b92be92c62aec9d8915d4b34b27d261
4
+ data.tar.gz: d4f7a4a013178317525dae88b541735fa2da3d3c
5
5
  SHA512:
6
- metadata.gz: 809cbb160095dd65919970d4fcacb3e753a81a8f1a7462889c18737fd2488cd9a74efae8087d3c4c707d3f9ed597ca584220ef86aea97c9ebc89bac1815df411
7
- data.tar.gz: 5fb1edfd61f9634160b32e045e89647924e53d83fc86e9d0bca07e11f956de651affa0f60d0f3f868977396d8af65453462e1d4750228b8357d4b6af73e71cca
6
+ metadata.gz: 262f52903766e4f2b01e61871d7b41ea47237c480544a837c40d4fbea102f1bf6cacd36c47dc32b25e22bfa0eefc3a9a54fbab84e123e358c50b7eadd078dedf
7
+ data.tar.gz: a1f2f08bbd622f5dee4f8454e18f1e2482ff421990118b0fa76bf7647507a05abe41346c5e4fa5b30b5b6d36cd8101012120356314bf45ddf4b4d9aaa30bcb8c
data/lib/y_support/kde.rb CHANGED
@@ -3,9 +3,57 @@ require 'y_support'
3
3
 
4
4
  module YSupport::KDE
5
5
  class << self
6
- # display it with kioclient
6
+ # Open a file with kioclient (using KDE file-viewer associations).
7
+ #
7
8
  def show_file_with_kioclient( fɴ_with_path )
8
9
  system "sleep 0.2; kioclient exec 'file:%s'" % fɴ_with_path
9
10
  end
11
+
12
+ # Dialog box querying for a string.
13
+ #
14
+ def query_box( dialog_text, prompt: '> ', title_bar: 'User input required', &block )
15
+ title_bar_text = title_bar
16
+ prompt_label_text = prompt
17
+
18
+ w = Gtk::Window.new( Gtk::Window::TOPLEVEL )
19
+ w.set_title( title_bar_text )
20
+ w.border_width = 10
21
+ w.signal_connect 'delete_event' do Gtk.main_quit end # cc
22
+
23
+ tlabel_widget = Gtk::Label.new( dialog_text )
24
+ plabel_widget = Gtk::Label.new( prompt_label_text )
25
+ ebox_widget = Gtk::Entry.new
26
+ ebox_widget.visibility = true # cc
27
+
28
+ hbox = Gtk::HBox.new(false, 5) # cc
29
+ hbox.pack_start_defaults( plabel_widget ) # cc
30
+ hbox.pack_start_defaults( ebox_widget )
31
+ vbox = Gtk::VBox.new(false, 5)
32
+ vbox.pack_start_defaults( tlabel_widget )
33
+ vbox.pack_start_defaults( hbox )
34
+ w.add(vbox)
35
+
36
+ ebox_widget.signal_connect("key-release-event") do |sender, event| # cc
37
+ kn = Gdk::Keyval.to_name(k = event.keyval)
38
+ if kn == "Return"
39
+ block.( sender.text )
40
+ Gtk.main_quit
41
+ end
42
+ end
43
+
44
+ w.show_all # cc
45
+ Gtk.main
46
+ end
47
+
48
+ # Message box.
49
+ #
50
+ def message_box( message="Press any key to close this window!" )
51
+ w = Gtk::Window.new
52
+ w.add_events Gdk::Event::KEY_PRESS
53
+ w.add Gtk::Label.new( message )
54
+ w.signal_connect "key-release-event" do Gtk.main_quit end
55
+ w.set_default_size( 600, 120 ).show_all
56
+ Gtk.main
57
+ end
10
58
  end
11
59
  end # module YSupport::KDE
@@ -114,10 +114,9 @@ module NameMagic
114
114
  #
115
115
  def __forget__( instance )
116
116
  return false unless __instances__.keys.include? instance
117
- __instances__.delete instance.tap do |name| # remove @instances entry
118
- __avid_instances__.delete( instance ) # also from here
119
- namespace.send :remove_const, name if name
120
- end
117
+ namespace.send :remove_const, instance.name if instance.name
118
+ __avid_instances__.delete( instance )
119
+ __instances__.delete instance
121
120
  end
122
121
 
123
122
  # Clears namespace-owned references to all the anonymous instances.
@@ -1,3 +1,3 @@
1
1
  module YSupport
2
- VERSION = "2.0.15"
2
+ VERSION = "2.0.16"
3
3
  end
data/test/kde_test.rb CHANGED
@@ -1,17 +1,14 @@
1
1
  #! /usr/bin/ruby
2
2
  #encoding: utf-8
3
3
 
4
- require 'test/unit'
5
- require 'shoulda'
4
+ require 'minitest/spec'
5
+ require 'minitest/autorun'
6
+ require './../lib/y_support/kde'
6
7
 
7
- class KDETest < Test::Unit::TestCase
8
- context "KDE" do
9
- setup do
10
- require 'y_support/kde'
11
- end
12
-
13
- should "have module method #show_file_with_kioclient" do
14
- assert_respond_to YSupport::KDE, :show_file_with_kioclient
15
- end
16
- end # context KDE
17
- end # class KDETest
8
+ describe YSupport::KDE do
9
+ it "should at least respond to certain messages" do
10
+ assert_respond_to YSupport::KDE, :show_file_with_kioclient
11
+ assert_respond_to YSupport::KDE, :query_box
12
+ assert_respond_to YSupport::KDE, :message_box
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.15
4
+ version: 2.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-30 00:00:00.000000000 Z
11
+ date: 2013-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport