gimdb 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -1
- data/VERSION +1 -1
- data/data/gimdb.glade +5 -52
- data/data/locale/it/LC_MESSAGES/gimdb.mo +0 -0
- data/gimdb.gemspec +3 -2
- data/po/gimdb.pot +12 -7
- data/po/it/gimdb.po +12 -7
- data/src/gimdb.rb +41 -45
- data/src/manager_box.rb +106 -0
- data/src/model.rb +2 -0
- metadata +3 -2
data/README.rdoc
CHANGED
@@ -55,7 +55,7 @@ Avaiable options are:
|
|
55
55
|
* activerecord
|
56
56
|
* sqlite3-ruby[http://github.com/jamis/sqlite3-ruby]
|
57
57
|
* nokogiri[http://github.com/tenderlove/nokogiri]
|
58
|
-
*
|
58
|
+
* libgtk2 <tt>(sudo apt-get install libgtk2-ruby)</tt>
|
59
59
|
* libglade2 <tt>(sudo apt-get install libglade2-ruby)</tt>
|
60
60
|
|
61
61
|
== Install
|
@@ -67,6 +67,11 @@ Avaiable options are:
|
|
67
67
|
* sudo apt-get install rubygems
|
68
68
|
* sudo gem install gimdb
|
69
69
|
|
70
|
+
Remember also to add rubygems bin path to your PATH env variable.
|
71
|
+
Edit <tt>~/.bashrc</tt> and add the follow line:
|
72
|
+
|
73
|
+
PATH=$PATH:/var/lib/gems/1.8/bin
|
74
|
+
|
70
75
|
== Support
|
71
76
|
|
72
77
|
You can use this email address for any questions or help: mailto:enrico@megiston.it.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/data/gimdb.glade
CHANGED
@@ -193,6 +193,7 @@
|
|
193
193
|
<child>
|
194
194
|
<widget class="GtkMenu" id="menu3">
|
195
195
|
<property name="visible">True</property>
|
196
|
+
<signal name="button_press_event" handler="on_about_clicked"/>
|
196
197
|
<child>
|
197
198
|
<widget class="GtkImageMenuItem" id="imagemenuitem10">
|
198
199
|
<property name="label">gtk-about</property>
|
@@ -1017,62 +1018,15 @@ Year</property>
|
|
1017
1018
|
<property name="visible">True</property>
|
1018
1019
|
<property name="spacing">2</property>
|
1019
1020
|
<child>
|
1020
|
-
<widget class="GtkVBox" id="
|
1021
|
+
<widget class="GtkVBox" id="dialog_users_box">
|
1021
1022
|
<property name="visible">True</property>
|
1022
1023
|
<child>
|
1023
|
-
<
|
1024
|
-
<property name="visible">True</property>
|
1025
|
-
<property name="n_rows">2</property>
|
1026
|
-
<property name="n_columns">2</property>
|
1027
|
-
<child>
|
1028
|
-
<widget class="GtkEntry" id="entry_user">
|
1029
|
-
<property name="visible">True</property>
|
1030
|
-
<property name="can_focus">True</property>
|
1031
|
-
<property name="invisible_char">●</property>
|
1032
|
-
</widget>
|
1033
|
-
</child>
|
1034
|
-
<child>
|
1035
|
-
<widget class="GtkButton" id="add_user">
|
1036
|
-
<property name="label">gtk-add</property>
|
1037
|
-
<property name="visible">True</property>
|
1038
|
-
<property name="can_focus">True</property>
|
1039
|
-
<property name="receives_default">True</property>
|
1040
|
-
<property name="use_stock">True</property>
|
1041
|
-
<signal name="clicked" handler="on_add_users_clicked"/>
|
1042
|
-
</widget>
|
1043
|
-
<packing>
|
1044
|
-
<property name="left_attach">1</property>
|
1045
|
-
<property name="right_attach">2</property>
|
1046
|
-
</packing>
|
1047
|
-
</child>
|
1048
|
-
<child>
|
1049
|
-
<widget class="GtkButton" id="del_user">
|
1050
|
-
<property name="label">gtk-delete</property>
|
1051
|
-
<property name="visible">True</property>
|
1052
|
-
<property name="can_focus">True</property>
|
1053
|
-
<property name="receives_default">True</property>
|
1054
|
-
<property name="use_stock">True</property>
|
1055
|
-
<signal name="clicked" handler="on_del_users_clicked"/>
|
1056
|
-
</widget>
|
1057
|
-
<packing>
|
1058
|
-
<property name="left_attach">1</property>
|
1059
|
-
<property name="right_attach">2</property>
|
1060
|
-
<property name="top_attach">1</property>
|
1061
|
-
<property name="bottom_attach">2</property>
|
1062
|
-
</packing>
|
1063
|
-
</child>
|
1064
|
-
<child>
|
1065
|
-
<placeholder/>
|
1066
|
-
</child>
|
1067
|
-
</widget>
|
1068
|
-
<packing>
|
1069
|
-
<property name="expand">False</property>
|
1070
|
-
<property name="fill">False</property>
|
1071
|
-
<property name="position">0</property>
|
1072
|
-
</packing>
|
1024
|
+
<placeholder/>
|
1073
1025
|
</child>
|
1074
1026
|
</widget>
|
1075
1027
|
<packing>
|
1028
|
+
<property name="expand">False</property>
|
1029
|
+
<property name="fill">False</property>
|
1076
1030
|
<property name="position">1</property>
|
1077
1031
|
</packing>
|
1078
1032
|
</child>
|
@@ -1111,7 +1065,6 @@ Year</property>
|
|
1111
1065
|
</child>
|
1112
1066
|
</widget>
|
1113
1067
|
<packing>
|
1114
|
-
<property name="expand">False</property>
|
1115
1068
|
<property name="pack_type">end</property>
|
1116
1069
|
<property name="position">0</property>
|
1117
1070
|
</packing>
|
Binary file
|
data/gimdb.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gimdb}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Enrico Pilotto"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-13}
|
13
13
|
s.default_executable = %q{gimdb}
|
14
14
|
s.description = %q{GTK graphical interface for Internet Movie DataBase. You can create users and save for each of them the movies to see, movies seen and favourites movies in a sqlite3 database.}
|
15
15
|
s.email = %q{enrico@megiston.it}
|
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
"po/it/gimdb.po",
|
43
43
|
"src/controller.rb",
|
44
44
|
"src/gimdb.rb",
|
45
|
+
"src/manager_box.rb",
|
45
46
|
"src/model.rb",
|
46
47
|
"src/movie_box.rb"
|
47
48
|
]
|
data/po/gimdb.pot
CHANGED
@@ -16,31 +16,36 @@ msgstr ""
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
17
17
|
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
18
18
|
|
19
|
-
#: movie_box.rb:53
|
20
19
|
msgid "Genres"
|
21
20
|
msgstr ""
|
22
21
|
|
23
|
-
#: movie_box.rb:75
|
24
22
|
msgid "<b>To see</b>"
|
25
23
|
msgstr ""
|
26
24
|
|
27
|
-
#: movie_box.rb:76
|
28
25
|
msgid "<b>Seen</b>"
|
29
26
|
msgstr ""
|
30
27
|
|
31
|
-
#: movie_box.rb:77
|
32
28
|
msgid "<b>Favourites</b>"
|
33
29
|
msgstr ""
|
34
30
|
|
35
|
-
#: gimdb.rb:158
|
36
31
|
msgid "Searching"
|
37
32
|
msgstr ""
|
38
33
|
|
39
|
-
|
34
|
+
msgid "Add"
|
35
|
+
msgstr ""
|
36
|
+
|
37
|
+
msgid "Edit"
|
38
|
+
msgstr ""
|
39
|
+
|
40
|
+
msgid "Delete"
|
41
|
+
msgstr ""
|
42
|
+
|
40
43
|
msgid "New user added"
|
41
44
|
msgstr ""
|
42
45
|
|
43
|
-
|
46
|
+
msgid "User edited"
|
47
|
+
msgstr ""
|
48
|
+
|
44
49
|
msgid "User deleted"
|
45
50
|
msgstr ""
|
46
51
|
|
data/po/it/gimdb.po
CHANGED
@@ -16,31 +16,36 @@ msgstr ""
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
17
17
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18
18
|
|
19
|
-
#: movie_box.rb:53
|
20
19
|
msgid "Genres"
|
21
20
|
msgstr "Generi"
|
22
21
|
|
23
|
-
#: movie_box.rb:75
|
24
22
|
msgid "<b>To see</b>"
|
25
23
|
msgstr "<b>Da vedere</b>"
|
26
24
|
|
27
|
-
#: movie_box.rb:76
|
28
25
|
msgid "<b>Seen</b>"
|
29
26
|
msgstr "<b>Visto</b>"
|
30
27
|
|
31
|
-
#: movie_box.rb:77
|
32
28
|
msgid "<b>Favourites</b>"
|
33
29
|
msgstr "<b>Preferito</b>"
|
34
30
|
|
35
|
-
#: gimdb.rb:158
|
36
31
|
msgid "Searching"
|
37
32
|
msgstr "Ricerca in corso"
|
38
33
|
|
39
|
-
|
34
|
+
msgid "Add"
|
35
|
+
msgstr "Aggiungi"
|
36
|
+
|
37
|
+
msgid "Edit"
|
38
|
+
msgstr "Modifica"
|
39
|
+
|
40
|
+
msgid "Delete"
|
41
|
+
msgstr "Cancella"
|
42
|
+
|
40
43
|
msgid "New user added"
|
41
44
|
msgstr "Nuovo utente aggiunto"
|
42
45
|
|
43
|
-
|
46
|
+
msgid "User edited"
|
47
|
+
msgstr "Utente modificato"
|
48
|
+
|
44
49
|
msgid "User deleted"
|
45
50
|
msgstr "Utente cancellato"
|
46
51
|
|
data/src/gimdb.rb
CHANGED
@@ -25,6 +25,7 @@ end
|
|
25
25
|
require "#{$GIMDB_PATH}/lib/imdb"
|
26
26
|
require "#{$GIMDB_PATH}/src/controller"
|
27
27
|
require "#{$GIMDB_PATH}/src/movie_box"
|
28
|
+
require "#{$GIMDB_PATH}/src/manager_box"
|
28
29
|
|
29
30
|
|
30
31
|
class GimdbGlade
|
@@ -66,10 +67,12 @@ class GimdbGlade
|
|
66
67
|
@scrolled = @glade.get_widget('scrolled')
|
67
68
|
@vbox_movies = Gtk::VBox.new
|
68
69
|
@dialog_users = @glade.get_widget('dialog_users')
|
69
|
-
@
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
@dialog_users_box = @glade.get_widget('dialog_users_box').pack_start(GtkGimdb::ManagerBox.new(:users, :name) do |t|
|
71
|
+
@label_status.text = _(t)
|
72
|
+
@label_status.show
|
73
|
+
build_users_menu
|
74
|
+
end)
|
75
|
+
@check_genres_all = @glade.get_widget('check_genres_all')
|
73
76
|
|
74
77
|
@genres = [
|
75
78
|
:action,:adventure,:animation,:biography,:comedy,
|
@@ -85,7 +88,6 @@ class GimdbGlade
|
|
85
88
|
|
86
89
|
# Some stuffs
|
87
90
|
@users = User.find(:all, :conditions => 'selected = 1')
|
88
|
-
@all_users = User.all
|
89
91
|
build_users_menu
|
90
92
|
@spin_year_to.value = Time.now.year.to_i
|
91
93
|
@combo_rating_from.active = 0
|
@@ -236,7 +238,7 @@ class GimdbGlade
|
|
236
238
|
|
237
239
|
def build_users_menu
|
238
240
|
submenu = Gtk::Menu.new
|
239
|
-
|
241
|
+
User.all.sort{|x,y| x.name <=> y.name}.each do |u|
|
240
242
|
m = Gtk::CheckMenuItem.new(u.name)
|
241
243
|
m.active = true if @users.include?(u)
|
242
244
|
submenu.append(m)
|
@@ -322,53 +324,15 @@ class GimdbGlade
|
|
322
324
|
end
|
323
325
|
|
324
326
|
def on_manage_users_clicked(widget, arg = nil)
|
325
|
-
@combo_del_users = Gtk::ComboBox.new
|
326
|
-
@table_combo.attach(@combo_del_users, 0,1, 1,2)
|
327
|
-
@all_users.sort{|x,y| x.name <=> y.name}.each do |u|
|
328
|
-
@combo_del_users.append_text(u.name)
|
329
|
-
end
|
330
|
-
@combo_del_users.active = 0
|
331
327
|
@dialog_users.show_all
|
332
328
|
end
|
333
329
|
|
334
|
-
def on_add_users_clicked(widget, arg = nil)
|
335
|
-
unless @entry_user.text.empty?
|
336
|
-
u = User.new(:name => @entry_user.text)
|
337
|
-
begin
|
338
|
-
u.save
|
339
|
-
@all_users << u
|
340
|
-
build_users_menu
|
341
|
-
@combo_del_users.append_text(u.name)
|
342
|
-
@combo_del_users.active = 0
|
343
|
-
@entry_user.text = ''
|
344
|
-
@label_status.text = _('New user added')
|
345
|
-
@label_status.show
|
346
|
-
# @dialog_users.hide
|
347
|
-
rescue
|
348
|
-
nil
|
349
|
-
end
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
def on_del_users_clicked(widget, arg = nil)
|
354
|
-
name = @combo_del_users.active_text
|
355
|
-
u = User.find_by_name(name)
|
356
|
-
unless u.nil?
|
357
|
-
u.destroy
|
358
|
-
@all_users.delete(u)
|
359
|
-
build_users_menu
|
360
|
-
@combo_del_users.remove_text(@combo_del_users.active)
|
361
|
-
@label_status.text = _('User deleted')
|
362
|
-
@label_status.show
|
363
|
-
# @combo_del_users.active = 0
|
364
|
-
end
|
365
|
-
end
|
366
|
-
|
367
330
|
def on_select_all_users_clicked(widget, arg = nil)
|
368
331
|
@users_menu_item.submenu.children.each do |c|
|
369
332
|
c.active = !c.active?
|
370
333
|
end
|
371
334
|
@dialog_users.hide
|
335
|
+
@label_status.hide
|
372
336
|
end
|
373
337
|
|
374
338
|
def on_close_manage_users_clicked(widget, arg = nil)
|
@@ -376,4 +340,36 @@ class GimdbGlade
|
|
376
340
|
@label_status.hide
|
377
341
|
end
|
378
342
|
|
343
|
+
def on_about_clicked(widget, arg = nil)
|
344
|
+
@dialog_about = Gtk::AboutDialog.new
|
345
|
+
begin
|
346
|
+
f = File.open("#{$GIMDB_PATH}/VERSION", 'r')
|
347
|
+
version = ''
|
348
|
+
f.each_line { |line| version += line }
|
349
|
+
@dialog_about.version = version
|
350
|
+
rescue
|
351
|
+
nil
|
352
|
+
end
|
353
|
+
begin
|
354
|
+
f = File.open("#{$GIMDB_PATH}/LICENSE", 'r')
|
355
|
+
license = ''
|
356
|
+
f.each_line { |line| license += line }
|
357
|
+
@dialog_about.license = license
|
358
|
+
rescue
|
359
|
+
nil
|
360
|
+
end
|
361
|
+
@dialog_about.program_name = 'GIMDB'
|
362
|
+
@dialog_about.logo = Gdk::Pixbuf.new("#{$GIMDB_PATH}/data/icons/imdb.png")
|
363
|
+
@dialog_about.comments = 'GTK graphical interface for the Internet Movie DataBase.'
|
364
|
+
@dialog_about.copyright = "Copyright © #{Time.now.year} Enrico Pilotto"
|
365
|
+
@dialog_about.website = 'http://github.com/pioz/gimdb'
|
366
|
+
@dialog_about.website_label = 'Website'
|
367
|
+
@dialog_about.authors = ['Enrico Pilotto <enrico@megiston.it>']
|
368
|
+
@dialog_about.translator_credits = 'Italian: Enrico Pilotto <enrico@megiston.it>'
|
369
|
+
@dialog_about.modal = true
|
370
|
+
@dialog_about.skip_taskbar_hint = true
|
371
|
+
@dialog_about.signal_connect('response') { @dialog_about.hide }
|
372
|
+
@dialog_about.run
|
373
|
+
end
|
374
|
+
|
379
375
|
end
|
data/src/manager_box.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
#require "#{$GIMDB_PATH}/src/model"
|
2
|
+
|
3
|
+
|
4
|
+
module GtkGimdb
|
5
|
+
|
6
|
+
class ManagerBox < Gtk::HBox
|
7
|
+
include GetText
|
8
|
+
|
9
|
+
|
10
|
+
def initialize(klass, field)
|
11
|
+
bindtextdomain($DOMAIN, $LOCALEDIR, nil, 'UTF-8')
|
12
|
+
super()
|
13
|
+
@comboboxentry = Gtk::ComboBoxEntry.new
|
14
|
+
@image_add = Gtk::Image.new(Gtk::Stock::ADD, Gtk::IconSize::BUTTON)
|
15
|
+
@image_edit = Gtk::Image.new(Gtk::Stock::EDIT, Gtk::IconSize::BUTTON)
|
16
|
+
@image_del = Gtk::Image.new(Gtk::Stock::DELETE, Gtk::IconSize::BUTTON)
|
17
|
+
@button = Gtk::Button.new(_('Add'))
|
18
|
+
@button.image = @image_add
|
19
|
+
@button.image.show
|
20
|
+
@klass = klass.to_s.classify.constantize
|
21
|
+
@field = field
|
22
|
+
@objs = @klass.all.collect{|o| o.send(@field)}
|
23
|
+
@status = :add
|
24
|
+
@pos = 0
|
25
|
+
setting_up { |t| yield(t) }
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
|
32
|
+
def setting_up
|
33
|
+
reorder
|
34
|
+
|
35
|
+
@button.signal_connect('clicked') do
|
36
|
+
if @status == :add
|
37
|
+
o = @klass.new(@field.to_sym => @comboboxentry.active_text)
|
38
|
+
if o.save
|
39
|
+
@objs << @comboboxentry.active_text
|
40
|
+
yield("New #{@klass.to_s.downcase} added") if block_given?
|
41
|
+
end
|
42
|
+
reorder
|
43
|
+
elsif @status == :edit
|
44
|
+
o = @klass.send("find_by_#{@field}", @obj_to_edit)
|
45
|
+
unless o.nil?
|
46
|
+
o.send("#{@field}=", @comboboxentry.active_text)
|
47
|
+
if o.save
|
48
|
+
@objs.delete(@obj_to_edit)
|
49
|
+
@objs << @comboboxentry.active_text
|
50
|
+
yield("#{@klass} edited") if block_given?
|
51
|
+
end
|
52
|
+
end
|
53
|
+
reorder
|
54
|
+
elsif @status == :del
|
55
|
+
o = @klass.send("find_by_#{@field}", @comboboxentry.active_text)
|
56
|
+
unless o.nil?
|
57
|
+
o.destroy
|
58
|
+
@objs.delete(@comboboxentry.active_text)
|
59
|
+
yield("#{@klass} deleted") if block_given?
|
60
|
+
end
|
61
|
+
reorder
|
62
|
+
else
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
@comboboxentry.signal_connect('changed') do
|
68
|
+
@pos = @comboboxentry.active if @comboboxentry.active > -1
|
69
|
+
if @pos == 0
|
70
|
+
@status = :add
|
71
|
+
@button.label = _('Add')
|
72
|
+
@button.image = @image_add
|
73
|
+
elsif @objs.include?(@comboboxentry.active_text)
|
74
|
+
@status = :del
|
75
|
+
@obj_to_edit = @comboboxentry.active_text
|
76
|
+
@button.label = _('Delete')
|
77
|
+
@button.image = @image_del
|
78
|
+
else
|
79
|
+
@status = :edit
|
80
|
+
@button.label = _('Edit')
|
81
|
+
@button.image = @image_edit
|
82
|
+
end
|
83
|
+
@button.image.show
|
84
|
+
end
|
85
|
+
|
86
|
+
table = Gtk::Table.new(1, 2)
|
87
|
+
table.attach(@comboboxentry, 0,1, 0,1)
|
88
|
+
table.attach(@button, 1,2, 0,1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL)
|
89
|
+
self.pack_start(table)
|
90
|
+
self.show_all
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
def reorder
|
95
|
+
@objs.sort!
|
96
|
+
(@objs.size + 2).times { @comboboxentry.remove_text(0) }
|
97
|
+
@comboboxentry.append_text('')
|
98
|
+
@objs.each do |o|
|
99
|
+
@comboboxentry.append_text(o)
|
100
|
+
end
|
101
|
+
@comboboxentry.active = 0
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
data/src/model.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gimdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrico Pilotto
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-05-
|
12
|
+
date: 2010-05-13 00:00:00 +02:00
|
13
13
|
default_executable: gimdb
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- po/it/gimdb.po
|
76
76
|
- src/controller.rb
|
77
77
|
- src/gimdb.rb
|
78
|
+
- src/manager_box.rb
|
78
79
|
- src/model.rb
|
79
80
|
- src/movie_box.rb
|
80
81
|
has_rdoc: true
|