• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Ruby GTK3移行後のメインリポジトリ


コミットメタ情報

リビジョン8848b96c209616ab197818cbd66dfb23e0c544f2 (tree)
日時2015-05-05 01:15:54
作者Shyouzou Sugitani <shy@user...>
コミッターShyouzou Sugitani

ログメッセージ

assorted fixes(8)

変更サマリ

差分

--- a/lib/ninix/menu.rb
+++ b/lib/ninix/menu.rb
@@ -281,12 +281,12 @@ module Menu
281281
282282 def create_mayuna_menu(mayuna_menu)
283283 @__mayuna_menu = []
284- for side in mayuna_menu
284+ for side in mayuna_menu.keys
285285 if side == 'sakura'
286286 index = 0
287287 elsif side == 'kero'
288288 index = 1
289- elsif side.startswith('char')
289+ elsif side.start_with?('char')
290290 begin
291291 index = side[4, side.length].to_i
292292 rescue #except:
--- a/lib/ninix/sakura.rb
+++ b/lib/ninix/sakura.rb
@@ -213,7 +213,7 @@ module Sakura
213213
214214 def get_shell_menu()
215215 current_key = get_current_shell()
216- for key in @shells
216+ for key in @shells.keys
217217 menuitem = @shells[key].menuitem
218218 menuitem.set_sensitive(key != current_key) # not working
219219 end
@@ -669,9 +669,9 @@ module Sakura
669669 end
670670
671671 def is_URL(s)
672- return (s.startswith('http://') or \
673- s.startswith('ftp://') or \
674- s.startswith('file:/'))
672+ return (s.start_with?('http://') or \
673+ s.start_with?('ftp://') or \
674+ s.start_with?('file:/'))
675675 end
676676
677677 def is_anchor(link_id)
@@ -1184,8 +1184,8 @@ module Sakura
11841184 RESET_EVENT = ['OnVanishSelecting', 'OnVanishCancel'] ## FIXME
11851185
11861186 def notify_event(event, *arglist, event_type: 'GET', default: nil)
1187- if @time_critical_session and event.startswith('OnMouse')
1188- return 0
1187+ if @time_critical_session and event.start_with?('OnMouse')
1188+ return false
11891189 end
11901190 if RESET_EVENT.include?(event)
11911191 reset_script(true)
@@ -1233,7 +1233,7 @@ module Sakura
12331233 start_script(script)
12341234 @balloon.hide_sstp_message()
12351235 end
1236- return 1
1236+ return true
12371237 end
12381238 if event == 'OnClose' and arglist[0] == 'shutdown' # XXX
12391239 @force_quit = true
@@ -1253,7 +1253,7 @@ module Sakura
12531253 get_current_shell_name(),
12541254 false, communication,
12551255 nil, false, script, arglist)
1256- return 0
1256+ return false
12571257 end
12581258 #logging.debug('=> "{0}"'.format(script))
12591259 if @__temp_mode == 2
@@ -1262,7 +1262,7 @@ module Sakura
12621262 end
12631263 if @passivemode and \
12641264 (event == 'OnSecondChange' or event == 'OnMinuteChange')
1265- return 0
1265+ return false
12661266 end
12671267 start_script(script)
12681268 @balloon.hide_sstp_message()
@@ -1279,7 +1279,7 @@ module Sakura
12791279 nil, false, script, arglist)
12801280 end
12811281 @script_finally << proc
1282- return 1
1282+ return true
12831283 end
12841284
12851285 def get_prefix()
@@ -1340,7 +1340,7 @@ module Sakura
13401340 if not ['lefttop', 'righttop', 'centertop'].include?(align_background)
13411341 align_background = 'lefttop'
13421342 end
1343- align_background = align_background[0..-3].encode('ascii') # XXX
1343+ align_background = align_background[0..-4].encode('ascii') # XXX
13441344 align = getstring('menu.sidebar.alignment')
13451345 if not align.empty?
13461346 align_sidebar = align
@@ -1356,7 +1356,7 @@ module Sakura
13561356 if not ['lefttop', 'righttop', 'centertop'].include?(align_foreground)
13571357 align_foreground = 'lefttop'
13581358 end
1359- align_foreground = align_foreground[0..-3].encode('ascii') # XXX
1359+ align_foreground = align_foreground[0..-4].encode('ascii') # XXX
13601360 return path_background, path_sidebar, path_foreground, \
13611361 align_background, align_sidebar, align_foreground
13621362 end
@@ -1920,22 +1920,23 @@ module Sakura
19201920 return
19211921 end
19221922 @last_script = script
1923- @script_origin = origin or self.FROM_GHOST
1923+ @script_origin = origin or FROM_GHOST
19241924 reset_script(true)
19251925 @__current_script = script
1926- if not script.rstrip().endswith('\e')
1926+ if not script.rstrip().end_with?('\e')
19271927 script = ''.join([script, '\e'])
19281928 end
19291929 @processed_script = []
19301930 @script_position = 0
19311931 while 1
19321932 begin
1933- @processed_script.extend(@script_parser.parse(script))
1933+ #@processed_script.extend(@script_parser.parse(script))
1934+ @processed_script << @script_parser.parse(script)
19341935 rescue #except ninix.script.ParserError as e:
19351936 #logging.error('-' * 50)
19361937 #logging.error('{0}'.format(e)) # 'UTF-8'
1937- done, script = e
1938- @processed_script.extend(done)
1938+ #done, script = e
1939+ #@processed_script.extend(done)
19391940 else
19401941 break
19411942 end
@@ -1948,14 +1949,14 @@ module Sakura
19481949 set_synchronized_session([], reset=true)
19491950 @balloon.hide_all()
19501951 node = @processed_script[0]
1951- if node[0] == Script.SCRIPT_TAG and node[1] == '\C'
1952+ if node[0] == Script::SCRIPT_TAG and node[1] == '\C'
19521953 @processed_script.pop(0)
19531954 @script_position = node[-1]
19541955 else
19551956 @balloon.clear_text_all()
19561957 end
19571958 @balloon.set_balloon_default()
1958- @current_time = time.localtime(time.time())
1959+ @current_time = Time.new.to_a
19591960 reset_idle_time()
19601961 if @parent.handle_request('GET', 'get_preference', 'raise_before_talk')
19611962 raise_all()
@@ -2381,7 +2382,7 @@ module Sakura
23812382 select_balloon(key, desc, balloon)
23822383 end
23832384 elsif args[0, 2] == ['change', 'shell'] and argc > 2
2384- for key in @shells
2385+ for key in @shells.keys
23852386 shell_name = @shells[key].baseinfo[0]
23862387 if shell_name == args[2]
23872388 select_shell(key)
@@ -2637,7 +2638,7 @@ module Sakura
26372638 flag = args[3]
26382639 end
26392640 bind = @surface.window[@script_side].bind # XXX
2640- for key in bind
2641+ for key in bind.keys
26412642 group = bind[key][0].split(',')
26422643 if category != group[0]
26432644 next
@@ -2784,7 +2785,7 @@ module Sakura
27842785 end
27852786 node = @processed_script.pop(0)
27862787 @script_position = node[-1]
2787- if node[0] == Script.SCRIPT_TAG
2788+ if node[0] == Script::SCRIPT_TAG
27882789 name, args = node[1], node[2..-1]
27892790 if @__script_tag.include?(name) and \
27902791 Sakura.method_defined?(@__script_tag[name])
@@ -2792,7 +2793,7 @@ module Sakura
27922793 else
27932794 #pass ## FIMXE
27942795 end
2795- elsif node[0] == Script.SCRIPT_TEXT
2796+ elsif node[0] == Script::SCRIPT_TEXT
27962797 text = expand_meta(node[1])
27972798 if @anchor
27982799 @anchor[1] = ''.join([@anchor[1], text])
@@ -2851,15 +2852,15 @@ module Sakura
28512852 if chunk[0] == Script.TEXT_STRING
28522853 buf << chunk[1]
28532854 elsif chunk[1] == '%month'
2854- buf << @current_time[1].to_s
2855+ buf << @current_time[4].to_s
28552856 elsif chunk[1] == '%day'
2856- buf << @current_time[2].to_s
2857- elsif chunk[1] == '%hour'
28582857 buf << @current_time[3].to_s
2858+ elsif chunk[1] == '%hour'
2859+ buf << @current_time[2].to_s
28592860 elsif chunk[1] == '%minute'
2860- buf << @current_time[4].to_s
2861+ buf << @current_time[1].to_s
28612862 elsif chunk[1] == '%second'
2862- buf << @current_time[5].to_s
2863+ buf << @current_time[0].to_s
28632864 elsif ['%username', '%c'].include?(chunk[1])
28642865 buf << get_username()
28652866 elsif chunk[1] == '%selfname'
@@ -2877,7 +2878,7 @@ module Sakura
28772878 left, top, scrn_w, scrn_h = Pix.get_workarea()
28782879 buf << scrn_h.to_s
28792880 elsif chunk[1] == '%et'
2880- buf << '{0:d}万年'.format(@current_time[7])
2881+ buf << '{0:d}万年'.format(@current_time[5])
28812882 elsif chunk[1] == '%wronghour'
28822883 wrongtime = time.time() + random.choice([-2, -1, 1, 2]) * 3600
28832884 buf << time.localtime(wrongtime)[3].to_s
--- a/lib/ninix/surface.rb
+++ b/lib/ninix/surface.rb
@@ -22,7 +22,7 @@ require "ninix/seriko"
2222 module Surface
2323
2424 class Surface
25- attr_reader :name
25+ attr_reader :name, :prefix
2626
2727 def initialize
2828 @window = []
@@ -367,21 +367,21 @@ module Surface
367367 top_dir = @prefix
368368 name = @desc.get('menu.background.bitmap.filename')
369369 if name
370- name = name.replace('\\', '/')
370+ name = name.gsub('\\', '/')
371371 path_background = File.join(top_dir, name)
372372 else
373373 path_background = nil
374374 end
375375 name = @desc.get('menu.sidebar.bitmap.filename')
376376 if name
377- name = name.replace('\\', '/')
377+ name = name.gsub('\\', '/')
378378 path_sidebar = File.join(top_dir, name)
379379 else
380380 path_sidebar = nil
381381 end
382382 name = @desc.get('menu.foreground.bitmap.filename')
383383 if name
384- name = name.replace('\\', '/')
384+ name = name.gsub('\\', '/')
385385 path_foreground = File.join(top_dir, name)
386386 else
387387 path_foreground = nil
@@ -749,13 +749,13 @@ module Surface
749749
750750 def raise_all
751751 for side in 0..@window.length-1
752- @window[side].raise_()
752+ @window[side].raise
753753 end
754754 end
755755
756- def raise_(side)
756+ def raise(side)
757757 if @window.length > side
758- @window[side].raise_()
758+ @window[side].raise
759759 end
760760 end
761761
@@ -1635,8 +1635,8 @@ module Surface
16351635 end
16361636 end
16371637
1638- def raise_
1639- @window.window.raise_()
1638+ def raise
1639+ @window.window.raise
16401640 @parent.handle_request('NOTIFY', 'notify_observer', 'raise', (@side))
16411641 end
16421642
--- a/lib/ninix_main.rb
+++ b/lib/ninix_main.rb
@@ -462,7 +462,7 @@ module Ninix_Main
462462 f = open(path, 'r', encoding='utf-8')
463463 line = f.readline()
464464 line = line.rstrip('\r\n')
465- if not line.startswith('#plugin:')
465+ if not line.start_with('#plugin:')
466466 return {}
467467 end
468468 begin
@@ -506,7 +506,7 @@ module Ninix_Main
506506 data = @queue[plugin_dir].get()
507507 @queue[plugin_dir].task_done()
508508 if isinstance(data, str)
509- if data.startswith('DIALOG:')
509+ if data.start_with('DIALOG:')
510510 message = data[7..-1]
511511 open_dialog(plugin_dir, message)
512512 next
@@ -1025,9 +1025,12 @@ module Ninix_Main
10251025 end
10261026
10271027 def get_ghost_menus
1028+ menus = []
10281029 for value in @ghosts.values()
1029- yield value.menuitem
1030+ #yield value.menuitem
1031+ menus << value.menuitem
10301032 end
1033+ return menus
10311034 end
10321035
10331036 def get_shell_menu
@@ -1036,7 +1039,7 @@ module Ninix_Main
10361039
10371040 def get_balloon_menu
10381041 current_key = get_current_balloon_directory()
1039- for key in @balloons
1042+ for key in @balloons.keys
10401043 menuitem = @balloons[key].menuitem
10411044 menuitem.set_sensitive(key != current_key) # not working
10421045 end
@@ -1050,7 +1053,7 @@ module Ninix_Main
10501053
10511054 def create_balloon_menu
10521055 balloon_menuitems = {} # OrderedDict()
1053- for key in @balloons.keys()
1056+ for key in @balloons.keys
10541057 balloon_menuitems[key] = @balloons[key].menuitem
10551058 end
10561059 return @__menu.create_meme_menu(balloon_menuitems)
@@ -1103,7 +1106,7 @@ module Ninix_Main
11031106
11041107 def get_balloon_list ## FIXME
11051108 balloon_list = []
1106- for key in @balloons.keys()
1109+ for key in @balloons.keys
11071110 desc, balloon = @balloons[key].baseinfo
11081111 subdir = balloon['balloon_dir'][0]
11091112 name = desc.get('name', :default => subdir)
@@ -1114,6 +1117,7 @@ module Ninix_Main
11141117
11151118 def get_plugin_list ## FIXME
11161119 plugin_list = []
1120+ return plugin_list ## FIXME
11171121 for i, plugin in enumerate(@plugins)
11181122 plugin_name = plugin[0]
11191123 menu_items = plugin[3]
@@ -1180,7 +1184,7 @@ module Ninix_Main
11801184 end
11811185
11821186 def find_ghost_by_name(name)
1183- for key in @ghosts
1187+ for key in @ghosts.keys
11841188 sakura = @ghosts[key].instance
11851189 begin
11861190 if sakura.get_name(default=nil) == name
@@ -1198,7 +1202,7 @@ module Ninix_Main
11981202 end
11991203
12001204 def find_balloon_by_name(name)
1201- for key in @balloons
1205+ for key in @balloons.keys
12021206 desc, balloon = @balloons[key].baseinfo
12031207 begin
12041208 if desc.get('name') == name
@@ -1645,7 +1649,7 @@ module Ninix_Main
16451649 sakura.save_history()
16461650 end
16471651 history = {}
1648- for key in @ghosts
1652+ for key in @ghosts.keys
16491653 sakura = @ghosts[key].instance
16501654 name = sakura.get_name(default=key)
16511655 ghost_time = 0