knjrbfw 0.0.65 → 0.0.66
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/knjrbfw.gemspec +2 -1
- data/lib/knj/datarow.rb +9 -0
- data/lib/knj/datarow_custom.rb +1 -1
- data/lib/knj/gtk2.rb +12 -3
- data/lib/knj/gtk2_msgbox.rb +26 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.66
|
data/knjrbfw.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{knjrbfw}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.66"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kasper Johansen"]
|
@@ -91,6 +91,7 @@ Gem::Specification.new do |s|
|
|
91
91
|
"lib/knj/gtk2.rb",
|
92
92
|
"lib/knj/gtk2_cb.rb",
|
93
93
|
"lib/knj/gtk2_menu.rb",
|
94
|
+
"lib/knj/gtk2_msgbox.rb",
|
94
95
|
"lib/knj/gtk2_statuswindow.rb",
|
95
96
|
"lib/knj/gtk2_tv.rb",
|
96
97
|
"lib/knj/gtk2_window.rb",
|
data/lib/knj/datarow.rb
CHANGED
@@ -619,6 +619,15 @@ class Knj::Datarow
|
|
619
619
|
# print "That user is deleted." if user.deleted?
|
620
620
|
def deleted?
|
621
621
|
return true if !@ob and !@data and !@id
|
622
|
+
|
623
|
+
#Try to reload data. Destroy object and return true if the row is gone from the database.
|
624
|
+
begin
|
625
|
+
self.reload
|
626
|
+
rescue Errno::ENOENT
|
627
|
+
self.destroy
|
628
|
+
return true
|
629
|
+
end
|
630
|
+
|
622
631
|
return false
|
623
632
|
end
|
624
633
|
|
data/lib/knj/datarow_custom.rb
CHANGED
data/lib/knj/gtk2.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
#Contains various methods for doing stuff quick using the Gtk2-extension.
|
2
|
-
|
2
|
+
class Knj::Gtk2
|
3
3
|
#Autoloader.
|
4
4
|
def self.const_missing(name)
|
5
5
|
require "#{$knjpath}gtk2_#{name.to_s.downcase}"
|
6
|
-
return Knj::Gtk2.const_get(name)
|
6
|
+
return Knj::Gtk2.const_get(name) if Knj::Gtk2.const_defined?(name)
|
7
|
+
raise "Could not load constant: '#{name}'."
|
7
8
|
end
|
8
9
|
|
9
10
|
#Alias for self.msgbox.
|
10
|
-
def msgbox(*args, &block)
|
11
|
+
def self.msgbox(*args, &block)
|
11
12
|
return Knj::Gtk2.msgbox(*args, &block)
|
12
13
|
end
|
13
14
|
|
@@ -16,6 +17,8 @@ module Knj::Gtk2
|
|
16
17
|
# Knj::Gtk2.msgbox("Message", "Title", "info")
|
17
18
|
# Knj::Gtk2.msgbox("Question", "Title", "yesno") #=> "yes"|"no"|"cancel"|"close"
|
18
19
|
def self.msgbox(paras, type = "warning", title = nil)
|
20
|
+
raise "A message-box is already shown." if Knj::Gtk2::Msgbox.shown?
|
21
|
+
|
19
22
|
if paras.is_a?(Array)
|
20
23
|
msg = paras[0]
|
21
24
|
title = paras[2]
|
@@ -118,6 +121,12 @@ module Knj::Gtk2
|
|
118
121
|
dialog.has_separator = false
|
119
122
|
dialog.show_all
|
120
123
|
|
124
|
+
#Make the current-functionality work.
|
125
|
+
Knj::Gtk2::Msgbox::DATA[:current] = dialog
|
126
|
+
dialog.signal_connect(:destroy) do
|
127
|
+
Knj::Gtk2::Msgbox::DATA[:current] = nil if Knj::Gtk2::Msgbox::DATA[:current].__id__ == dialog.__id__
|
128
|
+
end
|
129
|
+
|
121
130
|
if type == "list"
|
122
131
|
dialog.set_size_request(250, 370)
|
123
132
|
tv.grab_focus
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#This class holds various methods for message-box-functionality and debugging.
|
2
|
+
class Knj::Gtk2::Msgbox
|
3
|
+
#This hash contains various data like the currently shown message-box.
|
4
|
+
DATA = {}
|
5
|
+
|
6
|
+
#Returns the label of the currently shown message-box.
|
7
|
+
def self.cur_label
|
8
|
+
raise "No message-box currentl shown." if !Knj::Gtk2::Msgbox::DATA[:current]
|
9
|
+
return Knj::Gtk2::Msgbox::DATA[:current].children.first.children.first.children.last.label
|
10
|
+
end
|
11
|
+
|
12
|
+
#Send a response to the currently shown message-box.
|
13
|
+
def self.cur_respond(response)
|
14
|
+
raise "No message-box currentl shown." if !Knj::Gtk2::Msgbox::DATA[:current]
|
15
|
+
id = Knj::Gtk2::Msgbox::DATA[:current].__id__
|
16
|
+
Knj::Gtk2::Msgbox::DATA[:current].response(response)
|
17
|
+
Thread.pass while Knj::Gtk2::Msgbox::DATA[:current] and Knj::Gtk2::Msgbox::DATA[:current].__id__ == id
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
#Returns true if a message-box is currently shown.
|
22
|
+
def self.shown?
|
23
|
+
return true if Knj::Gtk2::Msgbox::DATA[:current]
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: knjrbfw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.66
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kasper Johansen
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- lib/knj/gtk2.rb
|
208
208
|
- lib/knj/gtk2_cb.rb
|
209
209
|
- lib/knj/gtk2_menu.rb
|
210
|
+
- lib/knj/gtk2_msgbox.rb
|
210
211
|
- lib/knj/gtk2_statuswindow.rb
|
211
212
|
- lib/knj/gtk2_tv.rb
|
212
213
|
- lib/knj/gtk2_window.rb
|
@@ -398,7 +399,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
398
399
|
requirements:
|
399
400
|
- - ">="
|
400
401
|
- !ruby/object:Gem::Version
|
401
|
-
hash:
|
402
|
+
hash: 2724841403555632511
|
402
403
|
segments:
|
403
404
|
- 0
|
404
405
|
version: "0"
|