Ruby GTK3移行後のメインリポジトリ
修訂 | 42eb7713b9711e468de385c55048835f2a975c41 (tree) |
---|---|
時間 | 2015-11-08 15:08:58 |
作者 | Shyouzou Sugitani <shy@user...> |
Commiter | Shyouzou Sugitani |
misc fixes
@@ -1,3 +1,6 @@ | ||
1 | +Sun November 8 2015 Shyouzou Sugitani <shy@users.osdn.me> | |
2 | + * Ruby移行以降の修正で漏れがあったもの対応. | |
3 | + | |
1 | 4 | Tue November 3 2015 Shyouzou Sugitani <shy@users.osdn.me> |
2 | 5 | * Ruby移行以降の修正で漏れがあったもの対応. |
3 | 6 |
@@ -558,7 +558,7 @@ module Aya | ||
558 | 558 | "Value: " + result.to_s + "\r\n\r\n".encode('CP932', :invalid => :replace, :undef => :replace) |
559 | 559 | return result |
560 | 560 | else |
561 | - return result.encode('CP932', :invalid => :replace, :undef => :replac) | |
561 | + return result.encode('CP932', :invalid => :replace, :undef => :replace) | |
562 | 562 | end |
563 | 563 | end |
564 | 564 | end |
@@ -101,7 +101,7 @@ module Bln | ||
101 | 101 | for name in @blns.keys |
102 | 102 | data, bln = @blns[name] |
103 | 103 | for bln_id in bln.keys |
104 | - if bln[bln_id] | |
104 | + if bln[bln_id] != nil | |
105 | 105 | bln[bln_id].destroy() |
106 | 106 | bln.delete(bln_id) |
107 | 107 | end |
@@ -117,7 +117,7 @@ module Bln | ||
117 | 117 | for name in @blns.keys |
118 | 118 | data, bln = @blns[name] |
119 | 119 | for bln_id in bln.keys |
120 | - if bln[bln_id] | |
120 | + if bln[bln_id] != nil | |
121 | 121 | bln[bln_id].reset_scale() |
122 | 122 | end |
123 | 123 | end |
@@ -448,7 +448,7 @@ module Bln | ||
448 | 448 | @processed_text = '' |
449 | 449 | @text = '' |
450 | 450 | @script_wait = nil |
451 | - @quick_session = 0 | |
451 | + @quick_session = false | |
452 | 452 | @script_parser = Script::Parser.new(:error => 'loose') |
453 | 453 | begin |
454 | 454 | @processed_script = @script_parser.parse(@script) |
@@ -548,14 +548,14 @@ module Bln | ||
548 | 548 | x = left + ((scrn_w - w) / 2).to_i |
549 | 549 | y = top + scrn_h - h |
550 | 550 | elsif @position == 'sakura' |
551 | - if @direction # right | |
551 | + if @direction == 1 # right | |
552 | 552 | x = s0_x + s0_w |
553 | 553 | else |
554 | 554 | x = s0_x - w |
555 | 555 | end |
556 | 556 | y = s0_y |
557 | 557 | elsif @position == 'kero' |
558 | - if @direction # right | |
558 | + if @direction == 1 # right | |
559 | 559 | x = s1_x + s1_w |
560 | 560 | else |
561 | 561 | x = s1_x - w |
@@ -587,7 +587,7 @@ module Bln | ||
587 | 587 | @processed_text = '' |
588 | 588 | @text = '' |
589 | 589 | @script_wait = nil |
590 | - @quick_session = 0 | |
590 | + @quick_session = false | |
591 | 591 | begin |
592 | 592 | @processed_script = @script_parser.parse(@script) |
593 | 593 | rescue Script::ParserError => e |
@@ -682,7 +682,7 @@ module Bln | ||
682 | 682 | end |
683 | 683 | |
684 | 684 | def do_idle_tasks |
685 | - if not @window | |
685 | + if @window == nil | |
686 | 686 | return nil |
687 | 687 | end |
688 | 688 | s0_shown = get_sakura_status('SurfaceSakura_Shown') |
@@ -710,7 +710,7 @@ module Bln | ||
710 | 710 | (@position == 'kero' and not s1_shown) or \ |
711 | 711 | (@position == 'sakurab' and not b0_shown) or \ |
712 | 712 | (@position == 'kerob' and not b1_shown) or \ |
713 | - (@nooverlap and not @talking and sakura_talking) | |
713 | + (@nooverlap == 1 and not @talking and sakura_talking) | |
714 | 714 | destroy() |
715 | 715 | return nil |
716 | 716 | end |
@@ -723,21 +723,21 @@ module Bln | ||
723 | 723 | end |
724 | 724 | end |
725 | 725 | if @visible |
726 | - if @life_time | |
726 | + if @life_time != nil | |
727 | 727 | if Time.now - @start_time >= @life_time * 0.001 and \ |
728 | 728 | not (not @processed_script.empty? or not @processed_text.empty?) |
729 | 729 | destroy() |
730 | 730 | return nil |
731 | 731 | end |
732 | 732 | end |
733 | - if @action | |
733 | + if @action != nil | |
734 | 734 | if @action['method'] == 'sinwave' |
735 | 735 | offset = @action['ref1'] \ |
736 | 736 | * Math.sin(2.0 * Math::PI \ |
737 | 737 | * (((Time.now - \ |
738 | 738 | @start_time) * 1000).to_i \ |
739 | 739 | % @action['ref2']).to_f / @action['ref2']) |
740 | - if @action['ref0'] | |
740 | + if @action['ref0'] == 1 | |
741 | 741 | @action_y = offset.to_i |
742 | 742 | else |
743 | 743 | @action_x = offset.to_i |
@@ -783,7 +783,7 @@ module Bln | ||
783 | 783 | cr.set_operator(Cairo::OPERATOR_SOURCE) |
784 | 784 | cr.paint() |
785 | 785 | cr.set_operator(Cairo::OPERATOR_OVER) # restore default |
786 | - if @layout | |
786 | + if @layout != nil | |
787 | 787 | cr.set_source_rgb(*@fontcolor) |
788 | 788 | cr.move_to(@left.to_i, @top.to_i) |
789 | 789 | cr.show_pango_layout(@layout) |
@@ -821,7 +821,7 @@ module Bln | ||
821 | 821 | @text = [@text, "\n"].join("") |
822 | 822 | draw_text(@text) |
823 | 823 | elsif name == '\w' |
824 | - if args | |
824 | + if args != nil | |
825 | 825 | begin |
826 | 826 | amount = Integer(args[0]) * 0.05 - 0.01 |
827 | 827 | rescue |
@@ -834,7 +834,7 @@ module Bln | ||
834 | 834 | @script_wait = Time.now + amount |
835 | 835 | end |
836 | 836 | elsif name == '\b' |
837 | - if args | |
837 | + if args != nil | |
838 | 838 | begin |
839 | 839 | amount = Integer(args[0]) |
840 | 840 | rescue |
@@ -905,7 +905,7 @@ module Bln | ||
905 | 905 | @y_root != nil |
906 | 906 | x_delta = (event.x_root - @x_root).to_i |
907 | 907 | y_delta = (event.y_root - @y_root).to_i |
908 | - if event.state & Gdk::ModifierType::BUTTON1_MASK | |
908 | + if event.state & Gdk::ModifierType::BUTTON1_MASK != 0 | |
909 | 909 | if @dragmove_horizontal |
910 | 910 | @x += x_delta |
911 | 911 | end |
@@ -938,11 +938,11 @@ module Bln | ||
938 | 938 | |
939 | 939 | def destroy |
940 | 940 | @visible = false |
941 | - if @window | |
941 | + if @window != nil | |
942 | 942 | @window.destroy() |
943 | 943 | @window = nil |
944 | 944 | end |
945 | - if @timeout_id | |
945 | + if @timeout_id != nil | |
946 | 946 | GLib::Source.remove(@timeout_id) |
947 | 947 | @timeout_id = nil |
948 | 948 | end |
@@ -85,7 +85,7 @@ module Misaka | ||
85 | 85 | open(path) do |f| |
86 | 86 | while true |
87 | 87 | line = f.gets |
88 | - if not line | |
88 | + if line == nil | |
89 | 89 | break |
90 | 90 | end |
91 | 91 | line = line.strip() |
@@ -99,7 +99,7 @@ module Misaka | ||
99 | 99 | end |
100 | 100 | while true |
101 | 101 | line = f.gets |
102 | - if not line | |
102 | + if line == nil | |
103 | 103 | Misaka.syntax_error('unexpected end of file', path) |
104 | 104 | end |
105 | 105 | line = line.strip() |
@@ -198,7 +198,7 @@ module Misaka | ||
198 | 198 | while pos < end_ |
199 | 199 | if column == 0 |
200 | 200 | match = Re_comment.match(data[pos..-1]) |
201 | - if match | |
201 | + if match != nil | |
202 | 202 | column = column + match[0].length |
203 | 203 | pos += match.end(0) |
204 | 204 | next |
@@ -207,7 +207,7 @@ module Misaka | ||
207 | 207 | break_flag = false |
208 | 208 | for token, pattern in Patterns |
209 | 209 | match = pattern.match(data[pos..-1]) |
210 | - if match | |
210 | + if match != nil | |
211 | 211 | lexeme = match[0] |
212 | 212 | if token == TOKEN_TEXT and \ |
213 | 213 | lexeme.start_with?('"') and lexeme.end_with?('"') |
@@ -295,7 +295,7 @@ module Misaka | ||
295 | 295 | end |
296 | 296 | |
297 | 297 | def skip_line |
298 | - while @buffer | |
298 | + while not @buffer.empty? | |
299 | 299 | token, lexeme = pop() |
300 | 300 | if token == TOKEN_NEWLINE |
301 | 301 | break |
@@ -394,7 +394,7 @@ module Misaka | ||
394 | 394 | break |
395 | 395 | end |
396 | 396 | end |
397 | - if not buf | |
397 | + if buf.empty? | |
398 | 398 | Misaka.syntax_error('null identifier', |
399 | 399 | @path, @lexer.get_position()) |
400 | 400 | end |
@@ -446,7 +446,7 @@ module Misaka | ||
446 | 446 | break |
447 | 447 | end |
448 | 448 | sentence = get_sentence() |
449 | - if not sentence | |
449 | + if sentence == nil | |
450 | 450 | next |
451 | 451 | end |
452 | 452 | sentences << sentence |
@@ -536,10 +536,10 @@ module Misaka | ||
536 | 536 | end |
537 | 537 | end |
538 | 538 | # strip whitespace at the beginning and/or end of line |
539 | - if buf and is_whitespace(buf[0]) | |
539 | + if not buf.empty? and is_whitespace(buf[0]) | |
540 | 540 | buf.delete_at(0) |
541 | 541 | end |
542 | - if buf and is_whitespace(buf[-1]) | |
542 | + if not buf.empty? and is_whitespace(buf[-1]) | |
543 | 543 | buf.delete_at(-1) |
544 | 544 | end |
545 | 545 | return buf |
@@ -568,10 +568,10 @@ module Misaka | ||
568 | 568 | end |
569 | 569 | end |
570 | 570 | # strip whitespace at the beginning and/or end of line |
571 | - if buf and is_whitespace(buf[0]) | |
571 | + if not buf.empty? and is_whitespace(buf[0]) | |
572 | 572 | buf.delete_at(0) |
573 | 573 | end |
574 | - if buf and is_whitespace(buf[-1]) | |
574 | + if not buf.empty? and is_whitespace(buf[-1]) | |
575 | 575 | buf.delete_at(-1) |
576 | 576 | end |
577 | 577 | return buf |
@@ -748,10 +748,10 @@ module Misaka | ||
748 | 748 | end |
749 | 749 | end |
750 | 750 | # strip whitespace at the beginning and/or end of line |
751 | - if buf and is_whitespace(buf[0]) | |
751 | + if not buf.empty? and is_whitespace(buf[0]) | |
752 | 752 | buf.delete_at(0) |
753 | 753 | end |
754 | - if buf and is_whitespace(buf[-1]) | |
754 | + if not buf.empty? and is_whitespace(buf[-1]) | |
755 | 755 | buf.delete_at(-1) |
756 | 756 | end |
757 | 757 | return buf |
@@ -1094,7 +1094,7 @@ module Misaka | ||
1094 | 1094 | end |
1095 | 1095 | |
1096 | 1096 | def get |
1097 | - if not @list | |
1097 | + if @list.empty? | |
1098 | 1098 | return nil |
1099 | 1099 | end |
1100 | 1100 | return @list.sample |
@@ -1114,7 +1114,7 @@ module Misaka | ||
1114 | 1114 | end |
1115 | 1115 | |
1116 | 1116 | def get |
1117 | - if not @list | |
1117 | + if @list.empty? | |
1118 | 1118 | return nil |
1119 | 1119 | end |
1120 | 1120 | if @indexes.empty? |
@@ -1136,7 +1136,7 @@ module Misaka | ||
1136 | 1136 | end |
1137 | 1137 | |
1138 | 1138 | def get |
1139 | - if not @list | |
1139 | + if @list.empty? | |
1140 | 1140 | return nil |
1141 | 1141 | end |
1142 | 1142 | if @indexes.empty? |
@@ -1164,7 +1164,7 @@ module Misaka | ||
1164 | 1164 | end |
1165 | 1165 | |
1166 | 1166 | def pop |
1167 | - if not @list | |
1167 | + if @list.empty? | |
1168 | 1168 | return nil |
1169 | 1169 | end |
1170 | 1170 | i = Array(0..@list.length-1).sample |
@@ -1181,7 +1181,7 @@ module Misaka | ||
1181 | 1181 | buf << i |
1182 | 1182 | end |
1183 | 1183 | end |
1184 | - if not buf | |
1184 | + if buf.empty? | |
1185 | 1185 | return nil |
1186 | 1186 | end |
1187 | 1187 | i = buf.sample |
@@ -1351,7 +1351,7 @@ module Misaka | ||
1351 | 1351 | variables = [] |
1352 | 1352 | constants = [] |
1353 | 1353 | for name, parameters, sentences in dic |
1354 | - if not sentences | |
1354 | + if sentences == nil | |
1355 | 1355 | next |
1356 | 1356 | elsif name == '$_Variable' |
1357 | 1357 | variables |= sentences |
@@ -1407,7 +1407,7 @@ module Misaka | ||
1407 | 1407 | 'misaka.rb: malformed database (ignored)') |
1408 | 1408 | break |
1409 | 1409 | end |
1410 | - if not line | |
1410 | + if line == nil | |
1411 | 1411 | break |
1412 | 1412 | end |
1413 | 1413 | header = strip_newline(line).split(nil, -1) |
@@ -1482,7 +1482,7 @@ module Misaka | ||
1482 | 1482 | def request(req_string) |
1483 | 1483 | header = req_string.split(/\r?\n/, 0) |
1484 | 1484 | line = header.shift |
1485 | - if line | |
1485 | + if line != nil | |
1486 | 1486 | line = line.force_encoding(@charset).encode('utf-8', :invalid => :replace, :undef => :replace).strip() |
1487 | 1487 | req_list = line.split(nil, -1) |
1488 | 1488 | if req_list.length >= 2 |
@@ -1524,7 +1524,7 @@ module Misaka | ||
1524 | 1524 | refs = [] |
1525 | 1525 | while true |
1526 | 1526 | ref = get_ref(n) |
1527 | - if ref | |
1527 | + if ref != nil | |
1528 | 1528 | refs << ref |
1529 | 1529 | else |
1530 | 1530 | break |
@@ -1580,7 +1580,7 @@ module Misaka | ||
1580 | 1580 | script.encode(@charset, :invalid => :replace, :undef => :replace), |
1581 | 1581 | "\r\n"].join('') |
1582 | 1582 | to = eval_variable([[NODE_TEXT, '$to']]) |
1583 | - if to | |
1583 | + if to != nil | |
1584 | 1584 | @variable.delete('$to') |
1585 | 1585 | response = [response, |
1586 | 1586 | "Reference0: ", |
@@ -1730,7 +1730,7 @@ module Misaka | ||
1730 | 1730 | elsif name == '$lastsentence' |
1731 | 1731 | result = @communicate[1] |
1732 | 1732 | elsif name == '$otherghostlist' |
1733 | - if @otherghost | |
1733 | + if not @otherghost.empty? | |
1734 | 1734 | ghost = @otherghost.sample |
1735 | 1735 | result = ghost[0] |
1736 | 1736 | else |
@@ -2023,7 +2023,7 @@ module Misaka | ||
2023 | 2023 | end |
2024 | 2024 | |
2025 | 2025 | def exec_choice(args) |
2026 | - if not args | |
2026 | + if args.empty? | |
2027 | 2027 | return '' |
2028 | 2028 | end |
2029 | 2029 | return expand_args(args.sample) |
@@ -2057,7 +2057,7 @@ module Misaka | ||
2057 | 2057 | namelist << name |
2058 | 2058 | end |
2059 | 2059 | end |
2060 | - if not namelist | |
2060 | + if namelist.empty? | |
2061 | 2061 | return '' |
2062 | 2062 | end |
2063 | 2063 | keylist = [] |
@@ -2073,7 +2073,7 @@ module Misaka | ||
2073 | 2073 | keylist << key |
2074 | 2074 | end |
2075 | 2075 | end |
2076 | - if not keylist | |
2076 | + if keylist.empty? | |
2077 | 2077 | return '' |
2078 | 2078 | end |
2079 | 2079 | return eval_variable([[NODE_TEXT, keylist.sample]]) |
@@ -2087,7 +2087,7 @@ module Misaka | ||
2087 | 2087 | end |
2088 | 2088 | |
2089 | 2089 | def exec_backup(args) |
2090 | - if not args | |
2090 | + if args.empty? | |
2091 | 2091 | save_database() |
2092 | 2092 | end |
2093 | 2093 | return '' |
@@ -2192,7 +2192,7 @@ module Misaka | ||
2192 | 2192 | return '' |
2193 | 2193 | end |
2194 | 2194 | buf = expand_args(args[0]) |
2195 | - if not buf | |
2195 | + if buf.empty? | |
2196 | 2196 | return '' |
2197 | 2197 | else |
2198 | 2198 | return buf[0] |
@@ -2204,7 +2204,7 @@ module Misaka | ||
2204 | 2204 | return '' |
2205 | 2205 | end |
2206 | 2206 | buf = expand_args(args[0]) |
2207 | - if not buf | |
2207 | + if buf.empty? | |
2208 | 2208 | return '' |
2209 | 2209 | else |
2210 | 2210 | return buf[-1] |
@@ -2262,7 +2262,7 @@ module Misaka | ||
2262 | 2262 | end |
2263 | 2263 | buf0 = expand_args(args[0]) |
2264 | 2264 | buf1 = expand_args(args[1]) |
2265 | - if buf0 and buf1 and buf0[-1] == buf1[0] | |
2265 | + if not buf0.empty? and not buf1.empty? and buf0[-1] == buf1[0] | |
2266 | 2266 | return 'true' |
2267 | 2267 | else |
2268 | 2268 | return 'false' |
@@ -2272,7 +2272,7 @@ module Misaka | ||
2272 | 2272 | def exec_append(args) |
2273 | 2273 | if args.length == 2 |
2274 | 2274 | name = expand_args(args[0]) |
2275 | - if name and name.start_with?('$') | |
2275 | + if not name.empty? and name.start_with?('$') | |
2276 | 2276 | if @variable.include?(name) |
2277 | 2277 | value_type, value = @variable[name] |
2278 | 2278 | else |
@@ -2321,11 +2321,11 @@ module Misaka | ||
2321 | 2321 | return '' |
2322 | 2322 | end |
2323 | 2323 | src_name = expand_args(args[0]) |
2324 | - if not (src_name and src_name.start_with?('$')) | |
2324 | + if not (not src_name.empty? and src_name.start_with?('$')) | |
2325 | 2325 | return '' |
2326 | 2326 | end |
2327 | 2327 | new_name = expand_args(args[1]) |
2328 | - if not (new_name and new_name.start_with?('$')) | |
2328 | + if not (not new_name.empty? and new_name.start_with?('$')) | |
2329 | 2329 | return '' |
2330 | 2330 | end |
2331 | 2331 | source = nil |
@@ -2390,7 +2390,7 @@ module Misaka | ||
2390 | 2390 | end |
2391 | 2391 | |
2392 | 2392 | def exec_insentence(args) |
2393 | - if not args | |
2393 | + if args.empty? | |
2394 | 2394 | return '' |
2395 | 2395 | end |
2396 | 2396 | s = expand_args(args[0]) |
@@ -2495,7 +2495,7 @@ module Misaka | ||
2495 | 2495 | end |
2496 | 2496 | |
2497 | 2497 | def exec_inlastsentence(args) |
2498 | - if not args | |
2498 | + if args.empty? | |
2499 | 2499 | return '' |
2500 | 2500 | end |
2501 | 2501 | s = @communicate[1] |
@@ -2537,7 +2537,7 @@ module Misaka | ||
2537 | 2537 | end |
2538 | 2538 | for line in header |
2539 | 2539 | line = line.force_encoding(@charset).encode('utf-8', :invalid => :replace, :undef => :replace).strip() |
2540 | - if not line | |
2540 | + if line.empty? | |
2541 | 2541 | next |
2542 | 2542 | end |
2543 | 2543 | if not line.include?(':') |
@@ -2546,7 +2546,7 @@ module Misaka | ||
2546 | 2546 | key, value = line.split(':', 2) |
2547 | 2547 | key.strip! |
2548 | 2548 | value.strip! |
2549 | - if key | |
2549 | + if not key.empty? | |
2550 | 2550 | saori_header << key |
2551 | 2551 | saori_value[key] = value |
2552 | 2552 | end |
@@ -2560,12 +2560,12 @@ module Misaka | ||
2560 | 2560 | end |
2561 | 2561 | |
2562 | 2562 | def load_saori(args) |
2563 | - if not args | |
2563 | + if args.empty? | |
2564 | 2564 | return '' |
2565 | 2565 | end |
2566 | 2566 | result = @saori_library.load(expand_args(args[0]), |
2567 | 2567 | @misaka_dir) |
2568 | - if not result | |
2568 | + if result == 0 | |
2569 | 2569 | return '' |
2570 | 2570 | else |
2571 | 2571 | result.to_s |
@@ -2573,11 +2573,11 @@ module Misaka | ||
2573 | 2573 | end |
2574 | 2574 | |
2575 | 2575 | def unload_saori(args) |
2576 | - if not args | |
2576 | + if args.empty? | |
2577 | 2577 | return '' |
2578 | 2578 | end |
2579 | 2579 | result = @saori_library.unload(expand_args(args[0])) |
2580 | - if not result | |
2580 | + if result == 0 | |
2581 | 2581 | return '' |
2582 | 2582 | else |
2583 | 2583 | return result.to_s |
@@ -2587,7 +2587,7 @@ module Misaka | ||
2587 | 2587 | def exec_isghostexists(args) |
2588 | 2588 | result = 'false' |
2589 | 2589 | if args.length != 1 |
2590 | - if @otherghost.length | |
2590 | + if @otherghost.length > 0 | |
2591 | 2591 | result = 'true' |
2592 | 2592 | @variable['$to'] = [TYPE_SCHOLAR, |
2593 | 2593 | @otherghost.sample[0]] |
@@ -2654,7 +2654,7 @@ module Misaka | ||
2654 | 2654 | top_dir = File.join(top_dir, head) |
2655 | 2655 | if not @saori_list.include?(name) |
2656 | 2656 | module_ = @saori.request(name) |
2657 | - if module_ | |
2657 | + if module_ != nil | |
2658 | 2658 | @saori_list[name] = module_ |
2659 | 2659 | end |
2660 | 2660 | end |
@@ -2665,7 +2665,7 @@ module Misaka | ||
2665 | 2665 | end |
2666 | 2666 | |
2667 | 2667 | def unload(name=nil) |
2668 | - if name | |
2668 | + if name != nil | |
2669 | 2669 | name = File.split(name.gsub('\\', '/'))[-1] # XXX: don't encode here |
2670 | 2670 | if @saori_list.include?(name) |
2671 | 2671 | @saori_list[name].unload() |
@@ -2682,7 +2682,7 @@ module Misaka | ||
2682 | 2682 | def request(name, req) |
2683 | 2683 | result = '' # FIXME |
2684 | 2684 | name = File.split(name.gsub('\\', '/'))[-1] # XXX: don't encode here |
2685 | - if name and @saori_list.include?(name) | |
2685 | + if not name.empty? and @saori_list.include?(name) | |
2686 | 2686 | result = @saori_list[name].request(req) |
2687 | 2687 | end |
2688 | 2688 | return result |
@@ -183,7 +183,7 @@ module Menu | ||
183 | 183 | set_stylecontext(i, *a) |
184 | 184 | end |
185 | 185 | submenu = item.submenu |
186 | - if submenu | |
186 | + if submenu != nil | |
187 | 187 | submenu.signal_connect('realize') do |i, *a| |
188 | 188 | set_stylecontext(i, *a) |
189 | 189 | end |
@@ -293,7 +293,7 @@ module Menu | ||
293 | 293 | for _ in @__mayuna_menu.length..index |
294 | 294 | @__mayuna_menu << nil |
295 | 295 | end |
296 | - if mayuna_menu[side] | |
296 | + if mayuna_menu[side] != nil | |
297 | 297 | @__mayuna_menu[index] = Gtk::Menu.new() |
298 | 298 | item = Gtk::TearoffMenuItem.new() |
299 | 299 | item.show() |
@@ -363,14 +363,14 @@ module Menu | ||
363 | 363 | else |
364 | 364 | name_list = @__ui[key][0][side] |
365 | 365 | end |
366 | - if name_list # caption | |
366 | + if not name_list.empty? # caption | |
367 | 367 | for name in name_list |
368 | 368 | caption = @parent.handle_request('GET', 'getstring', name) |
369 | - if caption | |
369 | + if caption != nil and not caption.empty? | |
370 | 370 | break |
371 | 371 | end |
372 | 372 | end |
373 | - if caption | |
373 | + if caption != nil and not caption.empty? | |
374 | 374 | caption = __modify_shortcut(caption) |
375 | 375 | if caption == __cut_mnemonic(caption) |
376 | 376 | caption = [caption, @__ui[key][1]].join('') |
@@ -384,7 +384,7 @@ module Menu | ||
384 | 384 | else |
385 | 385 | name_list = @__ui[key][2][side] |
386 | 386 | end |
387 | - if name_list and !name_list.empty? # visible | |
387 | + if name_list != nil and not name_list.empty? # visible | |
388 | 388 | for name in name_list |
389 | 389 | visible = @parent.handle_request('GET', 'getstring', name) |
390 | 390 | if visible != nil |
@@ -407,7 +407,7 @@ module Menu | ||
407 | 407 | for key in @__menu_list.keys |
408 | 408 | item = @ui_manager.get_widget(['/popup/', key].join('')) |
409 | 409 | submenu = item.submenu |
410 | - if submenu | |
410 | + if submenu != nil | |
411 | 411 | submenu.unrealize() |
412 | 412 | end |
413 | 413 | end |
@@ -447,7 +447,7 @@ module Menu | ||
447 | 447 | for key in @__menu_list.keys |
448 | 448 | item = @ui_manager.get_widget(['/popup/', key].join('')) |
449 | 449 | visible = @__menu_list[key]['visible'] |
450 | - if item | |
450 | + if item != nil | |
451 | 451 | if visible |
452 | 452 | item.show() |
453 | 453 | else |
@@ -463,7 +463,7 @@ module Menu | ||
463 | 463 | #assert @__menu_list.include?(name) |
464 | 464 | #assert isinstance(caption, str) |
465 | 465 | item = @ui_manager.get_widget(['/popup/', name].join('')) |
466 | - if item | |
466 | + if item != nil | |
467 | 467 | label = item.get_children()[0] |
468 | 468 | label.set_text_with_mnemonic(caption) |
469 | 469 | end |
@@ -479,7 +479,7 @@ module Menu | ||
479 | 479 | if side >= 1 |
480 | 480 | __set_visible('Portal', false) |
481 | 481 | else |
482 | - if portal | |
482 | + if portal != nil and not portal.empty? | |
483 | 483 | menu = Gtk::Menu.new() |
484 | 484 | portal_list = portal.split(2.chr, 0) |
485 | 485 | for site in portal_list |
@@ -503,7 +503,7 @@ module Menu | ||
503 | 503 | 'GET', 'get_prefix') |
504 | 504 | filename = entry[2].downcase |
505 | 505 | tail = File.extname(filename) |
506 | - if not tail | |
506 | + if tail.empty? | |
507 | 507 | for ext in ['.png', '.jpg', '.gif'] |
508 | 508 | filename = [filename, ext].join('') |
509 | 509 | banner = File.join( |
@@ -555,7 +555,7 @@ module Menu | ||
555 | 555 | end |
556 | 556 | |
557 | 557 | def __set_recommend_menu(recommend) |
558 | - if recommend | |
558 | + if recommend != nil and not recommend.empty? | |
559 | 559 | menu = Gtk::Menu.new() |
560 | 560 | recommend_list = recommend.split(2.chr, 0) |
561 | 561 | for site in recommend_list |
@@ -578,7 +578,7 @@ module Menu | ||
578 | 578 | base_path = @parent.handle_request('GET', 'get_prefix') |
579 | 579 | filename = entry[2].downcase |
580 | 580 | tail = File.extname(filename) |
581 | - if not tail | |
581 | + if tail.empty? | |
582 | 582 | for ext in ['.png', '.jpg', '.gif'] |
583 | 583 | filename = [filename, ext].join('') |
584 | 584 | banner = File.join( |
@@ -760,7 +760,7 @@ module Menu | ||
760 | 760 | ghost_menu = Gtk::Menu.new() |
761 | 761 | for items in @parent.handle_request('GET', 'get_ghost_menus') |
762 | 762 | item = items[path] |
763 | - if item.parent | |
763 | + if item.parent != nil | |
764 | 764 | item.reparent(ghost_menu) |
765 | 765 | else |
766 | 766 | ghost_menu << item |
@@ -789,7 +789,7 @@ module Menu | ||
789 | 789 | def create_meme_menu(menuitem) |
790 | 790 | menu = Gtk::Menu.new() |
791 | 791 | for item in menuitem.values() |
792 | - if item.parent | |
792 | + if item.parent != nil | |
793 | 793 | item.reparent(menu) |
794 | 794 | else |
795 | 795 | menu << item |
@@ -626,7 +626,7 @@ module Seriko | ||
626 | 626 | else |
627 | 627 | return [] ## should not reach here |
628 | 628 | end |
629 | - if not match | |
629 | + if match == nil | |
630 | 630 | next |
631 | 631 | end |
632 | 632 | if version == 1 and not re_seriko_interval_value.match(value) |
@@ -691,7 +691,7 @@ module Seriko | ||
691 | 691 | else |
692 | 692 | match = re_seriko2_pattern.match(pattern) |
693 | 693 | end |
694 | - if not match | |
694 | + if match == nil | |
695 | 695 | raise ('unsupported pattern: ' + pattern) |
696 | 696 | end |
697 | 697 | if version == 1 |
@@ -700,12 +700,12 @@ module Seriko | ||
700 | 700 | method = match[3] |
701 | 701 | else |
702 | 702 | method = match[1] |
703 | - if not match[2] | |
703 | + if match[2] == nil | |
704 | 704 | surface = 0 |
705 | 705 | else |
706 | 706 | surface = match[2].to_i.to_s |
707 | 707 | end |
708 | - if not match[3] | |
708 | + if match[3] == nil | |
709 | 709 | interval = 0 |
710 | 710 | else |
711 | 711 | interval = match[3].to_i.abs |
@@ -745,12 +745,12 @@ module Seriko | ||
745 | 745 | x = 0 |
746 | 746 | y = 0 |
747 | 747 | else |
748 | - if not match[4] | |
748 | + if match[4] == nil | |
749 | 749 | x = 0 |
750 | 750 | else |
751 | 751 | x = match[4].to_i |
752 | 752 | end |
753 | - if not match[5] | |
753 | + if match[5] == nil | |
754 | 754 | y = 0 |
755 | 755 | else |
756 | 756 | y = match[5].to_i |
@@ -802,17 +802,17 @@ module Seriko | ||
802 | 802 | else |
803 | 803 | match1 = re_mayuna_interval.match(key) |
804 | 804 | match2 = re_mayuna2_interval.match(key) |
805 | - if match1 | |
805 | + if match1 != nil | |
806 | 806 | version = 1 |
807 | 807 | match = match1 |
808 | - elsif match2 | |
808 | + elsif match2 != nil | |
809 | 809 | version = 2 |
810 | 810 | match = match2 |
811 | 811 | else |
812 | 812 | next |
813 | 813 | end |
814 | 814 | end |
815 | - if not match | |
815 | + if match == nil | |
816 | 816 | next |
817 | 817 | end |
818 | 818 | if version == 1 and not re_mayuna_interval_value.match(value) |
@@ -846,7 +846,7 @@ module Seriko | ||
846 | 846 | else |
847 | 847 | match = re_mayuna2_pattern.match(pattern) |
848 | 848 | end |
849 | - if not match | |
849 | + if match == nil | |
850 | 850 | raise ('unsupported pattern: ' + pattern) |
851 | 851 | end |
852 | 852 | if version == 1 |
@@ -865,12 +865,12 @@ module Seriko | ||
865 | 865 | x = 0 |
866 | 866 | y = 0 |
867 | 867 | else |
868 | - if not match[4] | |
868 | + if match[4] == nil | |
869 | 869 | x = 0 |
870 | 870 | else |
871 | 871 | x = match[4].to_i |
872 | 872 | end |
873 | - if not match[5] | |
873 | + if match[5] == nil | |
874 | 874 | y = 0 |
875 | 875 | else |
876 | 876 | y = match[5].to_i |