Ruby GTK3移行後のメインリポジトリ
Revisión | f77cbf30c83925083b08a7f3054cae4690e8cf1e (tree) |
---|---|
Tiempo | 2015-04-07 23:36:01 |
Autor | Shyouzou Sugitani <shy@user...> |
Commiter | Shyouzou Sugitani |
assorted fixes(5)
@@ -76,7 +76,7 @@ module Home | ||
76 | 76 | if ['.rb'].include?(ext) |
77 | 77 | name = basename |
78 | 78 | end |
79 | - if !name.empty? and not table.include?(name) | |
79 | + if name and not table.include?(name) | |
80 | 80 | shiori = shiori_lib.request(['', name]) |
81 | 81 | if shiori |
82 | 82 | table[name] = shiori |
@@ -122,7 +122,7 @@ module Home | ||
122 | 122 | } |
123 | 123 | # SHIORI compatible modules |
124 | 124 | for name, shiori in shiori_table.each_entry |
125 | - score = int(shiori.find(ghost_dir, shiori_dll)) | |
125 | + score = shiori.find(ghost_dir, shiori_dll).to_i | |
126 | 126 | if score > candidate['score'] |
127 | 127 | candidate['name'] = name |
128 | 128 | candidate['score'] = score |
@@ -155,16 +155,20 @@ module Sakura | ||
155 | 155 | @parent = parent |
156 | 156 | end |
157 | 157 | |
158 | - def handle_request(event_type, event, *arglist, **argdict) | |
158 | + def handle_request(event_type, event, *arglist) | |
159 | 159 | #assert ['GET', 'NOTIFY'].include?(event_type) |
160 | 160 | handlers = { |
161 | 161 | 'lock_repaint' => "get_lock_repaint" |
162 | 162 | } |
163 | 163 | if not handlers.include?(event) |
164 | - result = @parent.handle_request( | |
165 | - event_type, event, *arglist, **argdict) | |
164 | + if Sakura.method_defined?(event) | |
165 | + result = method(event).call(*arglist) | |
166 | + else | |
167 | + result = @parent.handle_request( | |
168 | + event_type, event, *arglist) | |
169 | + end | |
166 | 170 | else |
167 | - result = method(handlers[event]).call(*arglist, **argdict) | |
171 | + result = method(handlers[event]).call(*arglist) | |
168 | 172 | end |
169 | 173 | if event_type == 'GET' |
170 | 174 | return result |
@@ -634,15 +634,15 @@ module Ninix_Main | ||
634 | 634 | end |
635 | 635 | |
636 | 636 | def create_menuitem(data) |
637 | - return self.request_parent('GET', 'create_menuitem', @key, data) | |
637 | + return @parent.handle_request('GET', 'create_menuitem', @key, data) | |
638 | 638 | end |
639 | 639 | |
640 | 640 | def delete_by_myself |
641 | - self.request_parent('NOTIFY', 'delete_ghost', @key) | |
641 | + @parent.handle_request('NOTIFY', 'delete_ghost', @key) | |
642 | 642 | end |
643 | 643 | |
644 | 644 | def create_instance(data) |
645 | - return self.request_parent('GET', 'create_ghost', data) | |
645 | + return @parent.handle_request('GET', 'create_ghost', data) | |
646 | 646 | end |
647 | 647 | end |
648 | 648 |
@@ -805,13 +805,13 @@ module Ninix_Main | ||
805 | 805 | if target_dirs |
806 | 806 | if filetype == 'ghost' |
807 | 807 | add_sakura(target_dirs[0]) |
808 | - Sakura.ReadmeDialog().show( | |
808 | + Sakura::ReadmeDialog.new.show( | |
809 | 809 | target_dirs[0], |
810 | 810 | File.join(Home.get_ninix_home(), |
811 | 811 | 'ghost', target_dirs[0])) |
812 | 812 | if target_dirs[1] |
813 | 813 | add_balloon(target_dirs[1]) |
814 | - Sakura.ReadmeDialog().show( | |
814 | + Sakura::ReadmeDialog.new.show( | |
815 | 815 | target_dirs[1], |
816 | 816 | File.join(Home.get_ninix_home(), |
817 | 817 | 'balloon', target_dirs[1])) |
@@ -820,7 +820,7 @@ module Ninix_Main | ||
820 | 820 | add_sakura(target_dirs) # XXX: reload |
821 | 821 | elsif filetype == 'balloon' |
822 | 822 | add_balloon(target_dirs) |
823 | - Sakura.ReadmeDialog().show( | |
823 | + Sakura::ReadmeDialog.new.show( | |
824 | 824 | target_dirs, |
825 | 825 | File.join(Home.get_ninix_home(), |
826 | 826 | 'balloon', target_dirs)) |
@@ -1495,14 +1495,14 @@ module Ninix_Main | ||
1495 | 1495 | |
1496 | 1496 | def add_sakura(ghost_dir) |
1497 | 1497 | if @ghosts.include?(ghost_dir) |
1498 | - exists = 1 | |
1498 | + exists = true | |
1499 | 1499 | #logging.warning('INSTALLED GHOST CHANGED: {0}'.format(ghost_dir)) |
1500 | 1500 | else |
1501 | - exists = 0 | |
1501 | + exists = false | |
1502 | 1502 | #logging.info('NEW GHOST INSTALLED: {0}'.format(ghost_dir)) |
1503 | 1503 | end |
1504 | 1504 | ghost_conf = Home.search_ghosts([ghost_dir]) |
1505 | - if ghost_conf | |
1505 | + if not ghost_conf.empty? | |
1506 | 1506 | if exists |
1507 | 1507 | sakura = @ghosts[ghost_dir].instance |
1508 | 1508 | if sakura.is_running() # restart if working |
@@ -1541,14 +1541,14 @@ module Ninix_Main | ||
1541 | 1541 | |
1542 | 1542 | def add_balloon(balloon_dir) |
1543 | 1543 | if @balloons.include?(balloon_dir) |
1544 | - exists = 1 | |
1544 | + exists = true | |
1545 | 1545 | #logging.warning('INSTALLED BALLOON CHANGED: {0}'.format(balloon_dir)) |
1546 | 1546 | else |
1547 | - exists = 0 | |
1547 | + exists = false | |
1548 | 1548 | #logging.info('NEW BALLOON INSTALLED: {0}'.format(balloon_dir)) |
1549 | 1549 | end |
1550 | 1550 | balloon_conf = Home.search_balloons([balloon_dir]) |
1551 | - if balloon_conf | |
1551 | + if not balloon_conf.empty? | |
1552 | 1552 | if exists |
1553 | 1553 | @balloons[balloon_dir].baseinfo = balloon_conf[balloon_dir] |
1554 | 1554 | else |
@@ -1656,7 +1656,7 @@ module Ninix_Main | ||
1656 | 1656 | key = key.strip() |
1657 | 1657 | if key == 'time' |
1658 | 1658 | begin |
1659 | - ghost_time = int(value.strip()) | |
1659 | + ghost_time = value.strip().to_i | |
1660 | 1660 | rescue # except: |
1661 | 1661 | #pass |
1662 | 1662 | end |