kentaroi-okayu 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -1,10 +1,11 @@
1
1
  module Okayu
2
2
  ID_NOTEBOOK = 1000
3
3
 
4
- NEW_TAB = 100
5
- NEW_URL = 101
6
- CLOSE_TAB = 102
7
- LOGIN = 200
4
+ NEW_TAB = 100
5
+ NEW_URL = 101
6
+ CLOSE_TAB = 102
7
+ STAY_ON_TOP = 110
8
+ LOGIN = 120
8
9
 
9
10
  class AppFrame < Wx::Frame
10
11
  def initialize(title, left=nil, top=nil, width=nil, height=nil)
@@ -27,11 +28,15 @@ module Okayu
27
28
  file_menu.append(CLOSE_TAB, "タブを閉じる(&C)\tCtrl+W", "現在のタブを閉じます")
28
29
  file_menu.append(Wx::ID_EXIT, "終了(&X)", "おかゆを終了します")
29
30
 
31
+ @view_menu = Wx::Menu.new
32
+ @view_menu.append_check_item(STAY_ON_TOP, "最前面に表示(&T)", "最前面に表示します")
33
+
30
34
  connection_menu = Wx::Menu.new
31
35
  connection_menu.append(LOGIN, "ログイン(&L)", "ログインします")
32
36
 
33
37
  menu_bar = Wx::MenuBar.new
34
38
  menu_bar.append(file_menu, "ファイル(&F)")
39
+ menu_bar.append(@view_menu, "表示(&V)")
35
40
  menu_bar.append(connection_menu, "接続(&C)")
36
41
 
37
42
  set_menu_bar(menu_bar)
@@ -45,6 +50,7 @@ module Okayu
45
50
  evt_menu(NEW_TAB){on_new_tab}
46
51
  evt_menu(NEW_URL){on_new_url}
47
52
  evt_menu(CLOSE_TAB){on_close_tab}
53
+ evt_menu(STAY_ON_TOP){|event|on_stay_on_top(event)}
48
54
  evt_menu(LOGIN){on_connect}
49
55
  evt_menu(Wx::ID_EXIT){|event| on_quit(event)}
50
56
 
@@ -64,6 +70,16 @@ module Okayu
64
70
  @panel.get_current_page.on_new_url
65
71
  end
66
72
 
73
+ def on_stay_on_top event
74
+ if (current_style = get_window_style_flag) & Wx::STAY_ON_TOP > 0
75
+ set_window_style_flag (current_style - Wx::STAY_ON_TOP)
76
+ @view_menu.check STAY_ON_TOP, false
77
+ else
78
+ set_window_style_flag current_style | Wx::STAY_ON_TOP
79
+ @view_menu.check STAY_ON_TOP, true
80
+ end
81
+ end
82
+
67
83
  def on_connect
68
84
  login_dialog = LoginDialog.new(self)
69
85
  login_dialog.show_modal
@@ -60,105 +60,116 @@ module Okayu
60
60
  end
61
61
 
62
62
  def insert_comment comment
63
- item = Wx::ListItem.new
64
- item.set_data({:id => comment.id,
65
- :message => comment.message,
66
- :visitor_id => comment.visitor_id,
67
- :listener_id => comment.visitor.listener_id})
68
- item.set_id 0
69
- item.set_column COLUMNS[:no]
70
- item.set_text comment.number.to_s
71
-
72
- if comment.visitor.listener
73
- if color_index = comment.visitor.listener.color_index
74
- item.color COLORS[color_index]
75
- end
76
- elsif comment.visitor
77
- if color_index = comment.visitor.color_index
78
- item.color COLORS[color_index]
63
+ begin
64
+ item = Wx::ListItem.new
65
+ item.set_data({:id => comment.id,
66
+ :message => comment.message,
67
+ :visitor_id => comment.visitor_id,
68
+ :listener_id => comment.visitor.listener_id})
69
+ item.set_id 0
70
+ item.set_column COLUMNS[:no]
71
+ item.set_text comment.number.to_s
72
+
73
+ if comment.visitor.listener
74
+ if color_index = comment.visitor.listener.color_index
75
+ item.color COLORS[color_index]
76
+ end
77
+ elsif comment.visitor
78
+ if color_index = comment.visitor.color_index
79
+ item.color COLORS[color_index]
80
+ end
79
81
  end
80
- end
81
82
 
82
- insert_item(item)
83
-
84
- item.set_column COLUMNS[:message]
85
- item.set_text comment.message
86
- set_item(item)
87
-
88
- item.set_column COLUMNS[:mail]
89
- item.set_text comment.mail
90
- set_item(item)
83
+ insert_item(item)
84
+
85
+ item.set_column COLUMNS[:message]
86
+ item.set_text comment.message
87
+ set_item(item)
91
88
 
92
- item.set_column COLUMNS[:time]
93
- item.set_text Time.at(comment.commented_at - @base_time).strftime("%M:%S")
94
- set_item(item)
89
+ item.set_column COLUMNS[:mail]
90
+ item.set_text comment.mail
91
+ set_item(item)
95
92
 
96
- if comment.visitor.listener
97
- item.set_column COLUMNS[:name]
98
- item.set_text comment.visitor.listener.name
93
+ item.set_column COLUMNS[:time]
94
+ item.set_text Time.at(comment.commented_at - @base_time).strftime("%M:%S")
99
95
  set_item(item)
100
- end
101
96
 
102
- item.set_column COLUMNS[:id]
103
- item.set_text comment.user_id || comment.visitor.user_id
104
- set_item(item)
97
+ if comment.visitor.listener
98
+ item.set_column COLUMNS[:name]
99
+ item.set_text comment.visitor.listener.name
100
+ set_item(item)
101
+ end
105
102
 
106
- item.set_column COLUMNS[:premium]
107
- if comment.owner
108
- item.set_text '主'
109
- elsif comment.premium
110
- item.set_text 'P'
111
- elsif comment.command
112
- item.set_text 'System'
113
- else
114
- item.set_text ''
115
- end
116
- set_item(item)
103
+ item.set_column COLUMNS[:id]
104
+ item.set_text comment.user_id || comment.visitor.user_id || ''
105
+ set_item(item)
117
106
 
107
+ item.set_column COLUMNS[:premium]
108
+ if comment.owner
109
+ item.set_text '主'
110
+ elsif comment.premium
111
+ item.set_text 'P'
112
+ elsif comment.command
113
+ item.set_text 'System'
114
+ else
115
+ item.set_text ''
116
+ end
117
+ set_item(item)
118
+ rescue
119
+ puts "comment: #{comment.inspect}"
120
+ puts "item: #{item.inspect}"
121
+ raise
122
+ end
118
123
  end
119
124
 
120
125
  def rewrite_item item_index
121
- item = get_item(item_index)
122
- comment = Comment.find item.get_data[:id]
123
-
124
- item.set_id 0
125
- item.set_column COLUMNS[:no]
126
- item.set_text comment.number.to_s
127
- set_item(item)
128
-
129
- item.set_column COLUMNS[:message]
130
- item.set_text comment.message
131
- set_item(item)
126
+ begin
127
+ item = get_item(item_index)
128
+ comment = Comment.find item.get_data[:id]
132
129
 
133
- item.set_column COLUMNS[:mail]
134
- item.set_text comment.mail
135
- set_item(item)
130
+ item.set_id 0
131
+ item.set_column COLUMNS[:no]
132
+ item.set_text comment.number.to_s
133
+ set_item(item)
134
+
135
+ item.set_column COLUMNS[:message]
136
+ item.set_text comment.message
137
+ set_item(item)
136
138
 
137
- item.set_column COLUMNS[:time]
138
- item.set_text Time.at(comment.commented_at - @base_time).strftime("%M:%S")
139
- set_item(item)
139
+ item.set_column COLUMNS[:mail]
140
+ item.set_text comment.mail
141
+ set_item(item)
140
142
 
141
- if comment.visitor.listener
142
- item.set_column COLUMNS[:name]
143
- item.set_text comment.visitor.listener.name
143
+ item.set_column COLUMNS[:time]
144
+ item.set_text Time.at(comment.commented_at - @base_time).strftime("%M:%S")
144
145
  set_item(item)
145
- end
146
146
 
147
- item.set_column COLUMNS[:id]
148
- item.set_text comment.user_id || comment.visitor.user_id
149
- set_item(item)
147
+ if comment.visitor.listener
148
+ item.set_column COLUMNS[:name]
149
+ item.set_text comment.visitor.listener.name
150
+ set_item(item)
151
+ end
150
152
 
151
- item.set_column COLUMNS[:premium]
152
- if comment.owner
153
- item.set_text '主'
154
- elsif comment.premium
155
- item.set_text 'P'
156
- elsif comment.command
157
- item.set_text 'System'
158
- else
159
- item.set_text ''
153
+ item.set_column COLUMNS[:id]
154
+ item.set_text comment.user_id || comment.visitor.user_id || ''
155
+ set_item(item)
156
+
157
+ item.set_column COLUMNS[:premium]
158
+ if comment.owner
159
+ item.set_text ''
160
+ elsif comment.premium
161
+ item.set_text 'P'
162
+ elsif comment.command
163
+ item.set_text 'System'
164
+ else
165
+ item.set_text ''
166
+ end
167
+ set_item(item)
168
+ rescue
169
+ puts "comment: #{comment.inspect}"
170
+ puts "item: #{item.inspect}"
171
+ raise
160
172
  end
161
- set_item(item)
162
173
  end
163
174
 
164
175
  def on_column_resized event
data/okayu.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{okayu}
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kentaro Imai"]
12
- s.date = %q{2009-09-22}
12
+ s.date = %q{2009-09-24}
13
13
  s.default_executable = %q{okayu}
14
14
  s.description = %q{A comment viewer for http://live.nicovideo.jp/}
15
15
  s.email = %q{kentaroi@gmail.com}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kentaroi-okayu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kentaro Imai
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-22 00:00:00 -07:00
12
+ date: 2009-09-24 00:00:00 -07:00
13
13
  default_executable: okayu
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency