OSDN Git Service

updates
authorshy <shy>
Sat, 26 Aug 2006 16:01:17 +0000 (16:01 +0000)
committershy <shy>
Sat, 26 Aug 2006 16:01:17 +0000 (16:01 +0000)
14 files changed:
ChangeLog
lib/ninix-install.py
lib/ninix-update.py
lib/ninix/balloon.py
lib/ninix/dll/aya5.py
lib/ninix/dll/kawari.py
lib/ninix/home.py
lib/ninix/main.py
lib/ninix/ngm.py
lib/ninix/sakura.py
lib/ninix/script.py
lib/ninix/surface.py
lib/ninix/update.py
lib/ninix/version.py

index 8a30d14..259da06 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,19 @@
+Sun August 27 2006   Shyouzou Sugitani <shy@users.sourceforge.jp>
+       * バージョン3.8.9リリース.
+
+Sat August 26 2006   Shyouzou Sugitani <shy@users.sourceforge.jp>
+       * lib/ninix/script.py, lib/ninix/sakura.py, lib/ninix/balloon.py:
+       下線と字消し線のフォントタグ(\f[underline,], \f[strike,])を実装.
+       * lib/ninix/script.py: 括弧の無い(\p0のような)\pタグに対応.
+       * sys.exit()を"raise SystemExit"で置き換えた.
+
 Tue July 18 2006   Shyouzou Sugitani <shy@users.sourceforge.jp>
        * バージョン3.8.8リリース.
 
 Mon July 17 2006   Shyouzou Sugitani <shy@users.sourceforge.jp>
        * lib/ninix/balloon.py: SSTPの送信元表示のフォントサイズ計算を修正.
        * lib/ninix/script.py, lib/ninix/sakura.py, lib/ninix/balloon.py:
-       上付きと下付きのフォントタグ(\f[sup,true], \f[sub,true])を実装.
+       上付きと下付きのフォントタグ(\f[sup,], \f[sub,])を実装.
 
 Sun June 11 2006   Shyouzou Sugitani <shy@users.sourceforge.jp>
        * バージョン3.8.7リリース.
index 7ac6729..2bf20d6 100755 (executable)
@@ -14,7 +14,7 @@
 #  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for more details.
 #
-#  $Id: ninix-install.py,v 1.39 2006/02/02 14:06:31 shy Exp $
+#  $Id: ninix-install.py,v 1.40 2006/08/26 16:01:17 shy Exp $
 #
 
 # env.var: NINIX_HOME, NINIX_USER, NINIX_ARCHIVE, TMPDIR
@@ -66,8 +66,7 @@ Options:
 '''
 
 def usage():
-    sys.stderr.write(USAGE % PROGRAM_NAME)
-    sys.exit(1)
+    raise SystemExit, USAGE % PROGRAM_NAME
 
 
 class InstallError(Exception):
@@ -403,7 +402,7 @@ def confirm_overwrite(path):
     except EOFError:
         answer = None
     except KeyboardInterrupt:
-        sys.exit(1)
+        raise SystemExit
     if not answer:
         return 0
     return answer.lower().startswith('y')
@@ -417,7 +416,7 @@ def confirm_removal(path):
     except EOFError:
         answer = None
     except KeyboardInterrupt:
-        sys.exit(1)
+        raise SystemExit
     if not answer:
         return 0
     return answer.lower().startswith('y')
index 135a860..337881b 100755 (executable)
@@ -13,7 +13,7 @@
 #  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for more details.
 #
-#  $Id: ninix-update.py,v 1.16 2005/09/26 04:18:33 shy Exp $
+#  $Id: ninix-update.py,v 1.17 2006/08/26 16:01:17 shy Exp $
 #
 
 import getopt
@@ -47,8 +47,7 @@ Options:
 '''
 
 def usage():
-    sys.stderr.write(USAGE % os.path.basename(PROGRAM_NAME))
-    sys.exit(1)
+    raise SystemExit, USAGE % os.path.basename(PROGRAM_NAME)
 
 def main():
     try:
@@ -89,8 +88,7 @@ def list_ghosts(script):
     sys.stderr.write('Searching ghosts...\n')
     config = ninix.home.load_config()
     if config is None:
-        sys.stderr.write('Error: ninix home not found\n')
-        sys.exit(1)
+        raise SystemExit, 'Error: ninix home not found\n'
     ghosts, shells, balloons, plugins, nekoninni, katochan, kinoko = config
     found = 0
     default_path = os.path.join(sys.path[0], 'ninix', 'dll')
@@ -162,8 +160,7 @@ def get_value(response):
 
 def update_ghost(homeurl, ghostdir, quiet):
     if not os.path.exists(os.path.expanduser(ghostdir)):
-        sys.stderr.write('Error: %s not found\n' % ghostdir)
-        sys.exit(1)
+        raise SystemExit, 'Error: %s not found\n' % ghostdir
     updateman = ninix.update.NetworkUpdate(None)
     updateman.start(homeurl, ghostdir, timeout=60)
     while 1:
index e091ad5..779b5bc 100644 (file)
@@ -798,8 +798,10 @@ class BalloonWindow:
         cr.paint_with_alpha(self.__alpha_channel)
 
     def set_markup(self, index, text):
-        sup_ = 0 # XXX
-        sub_ = 0 # XXX
+        tags_ = ('sup', 'sub', 's', 'u')
+        count_ = {}
+        for tag_ in tags_:
+            count_[tag_] = 0
         markup_list = []
         for sl, sn, tag in self.meta_buffer:
             if sl == index:
@@ -807,28 +809,21 @@ class BalloonWindow:
         markup_list.sort()
         markup_list.reverse()
         for sn, tag in markup_list:
-            # XXX
-            if tag == '<sup>':
-                sup_ += 1
-            if tag == '</sup>':
-                sup_ -= 1
-            if tag == '<sub>':
-                sub_ += 1
-            if tag == '</sub>':
-                sub_ -= 1
             text = ''.join((text[:sn], tag, text[sn:]))
-        if sup_ > 0:
-            for x in range(sup_):
-                text = ''.join((text, '</sup>'))
-        if sup_ < 0:
-            for x in range(-sup_):
-                text = ''.join(('<sup>', text))
-        if sub_ > 0:
-            for x in range(sub_):
-                text = ''.join((text, '</sub>'))
-        if sub_ < 0:
-            for x in range(-sub_):
-                text = ''.join(('<sub>', text))
+            if tag[1] == '/':
+                tag_ = tag[2:-1]
+                assert tag_ in tags_
+                count_[tag_] -= 1
+                if count_[tag_] < 0:
+                    text = ''.join(('<', tag_, '>', text))
+                    count_[tag_] += 1
+            else:
+                tag_ = tag[1:-1]
+                assert tag_ in tags_
+                count_[tag_] += 1
+                if count_[tag_] > 0:
+                    text = ''.join((text, '</', tag_, '>'))
+                    count_[tag_] -= 1
         return text
 
     def redraw(self, darea=None, event=None):
index 4401ad0..1686479 100644 (file)
@@ -3185,7 +3185,7 @@ class AyaStatement:
             elif c == '"':
                 position = line.find('"', i + 1)
                 if position < 0: ## FIXME
-                    sys.exit(1)
+                    raise SystemExit
                 i = position
                 self.tokens.append(line[token_startpoint:position + 1])
                 token_startpoint = position + 1
@@ -3193,7 +3193,7 @@ class AyaStatement:
             elif c == "'":
                 position = line.find("'", i + 1)
                 if position < 0: ## FIXME
-                    sys.exit(1)
+                    raise SystemExit
                 i = position
                 self.tokens.append(line[token_startpoint:position + 1])
                 token_startpoint = position + 1
index 0a0577c..5921721 100644 (file)
@@ -13,7 +13,7 @@
 #  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for more details.
 #
-#  $Id: kawari.py,v 1.30 2005/10/06 02:59:13 shy Exp $
+#  $Id: kawari.py,v 1.31 2006/08/26 16:01:18 shy Exp $
 #
 
 import __builtin__
@@ -1961,8 +1961,7 @@ def test():
     try:
         options, argv = getopt.getopt(sys.argv[1:], 'd:', ['debug='])
     except getopt.error, e:
-        sys.stderr.write(''.join((str(e), '\n')))
-        sys.exit(1)
+        raise SystemExit, ''.join((str(e), '\n'))
     if argv:
         kawari_dir = argv[0]
     else:
index 6ff38a7..b55c8f7 100644 (file)
@@ -11,7 +11,7 @@
 #  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for more details.
 #
-# $Id: home.py,v 1.31 2006/02/02 14:06:31 shy Exp $
+# $Id: home.py,v 1.32 2006/08/26 16:01:18 shy Exp $
 #
 
 import os
@@ -641,8 +641,7 @@ def test():
         pass
     config = load_config()
     if config is None:
-        sys.stderr.write('Home directory not found.\n')
-        sys.exit(1)
+        raise SystemExit, 'Home directory not found.\n'
     ghosts, shells, balloons, plugins, nekoninni, katochan, kinoko = config ## FIXME
     # ghosts
     for desc, shiori_dir, use_makoto, surface_set, balloon, prefix, shiori_dll, shiori_name in ghosts: ## FIXME
index ef2d6c0..b261379 100755 (executable)
@@ -13,7 +13,7 @@
 #  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for more details.
 #
-# $Id: main.py,v 1.135 2006/03/25 08:07:09 shy Exp $
+# $Id: main.py,v 1.136 2006/08/26 16:01:18 shy Exp $
 #
 
 import getopt
@@ -65,8 +65,7 @@ Options:
 '''
 
 def usage():
-    sys.stderr.write(USAGE)
-    sys.exit(1)
+    raise SystemExit, USAGE
 
 def _traceback(exception_type, value, tb):
     response_id = 1
@@ -103,7 +102,7 @@ def _traceback(exception_type, value, tb):
         else: # close button
             break
     dialog.destroy()
-    sys.exit(1)
+    raise SystemExit
 
 if 'DISPLAY' in os.environ:
     if 'gtk' in sys.modules:
@@ -117,8 +116,7 @@ def main():
     sys.stderr = os.fdopen(sys.stderr.fileno(), 'w')
     # check if X is running
     if 'DISPLAY' not in os.environ:
-        sys.stderr.write('Error: cannot open display (abort)\n')
-        sys.exit(1)
+        raise SystemExit, 'Error: cannot open display (abort)\n'
     # parse command line arguments
     try:
         options, rest = getopt.getopt(sys.argv[1:], 'H:U:R:ph',
@@ -173,27 +171,22 @@ def main():
         ninix.home.NINIX_USER = user_dir
     config = ninix.home.load_config()
     if config is None:
-        sys.stderr.write('Home directory not found (abort)\n')
-        sys.exit(1)
+        raise SystemExit, 'Home directory not found (abort)\n'
     # aquire Inter Process Mutex (not Global Mutex)
     lockfile = open(os.path.join(ninix.home.get_ninix_home(), '.lock'), 'w')
     try:
         fcntl.flock(lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
     except:
-        print 'ninix-aya is already running'
-        sys.exit(1)
+        raise SystemExit, 'ninix-aya is already running'
     # check if at least one set of ghost, surface, and balloon
     ghosts, shells, balloons, plugins, nekoninni, katochan, kinoko = config ## FIXME
     if not ghosts:
-        sys.stderr.write('Error: no ghost found\n')
-        sys.exit(1)
+        raise SystemExit, 'Error: no ghost found\n'
     elif not shells and \
          not filter(lambda ghost: ghost[3], ghosts):
-        sys.stderr.write('Error: no shell found\n')
-        sys.exit(1)
+        raise SystemExit, 'Error: no shell found\n'
     elif not balloons:
-        sys.stderr.write('Error: no balloon found\n')
-        sys.exit(1)
+        raise SystemExit, 'Error: no balloon found\n'
     for desc, shiori_dir, use_makoto, surface_set, balloon, prefix, shiori_dll, shiori_name in ghosts:
         print 'ghost:', desc.get('name', '<none>').encode('utf-8', 'ignore')
         for name, surface_dir, surface_desc, surface_alias, surface in \
@@ -1071,8 +1064,7 @@ class Application:
             try:
                 os.execve(argv[0], argv, environ)
             except OSError:
-                sys.stderr.write('Error: %s failed (abort)\n' % argv[0])
-                os._exit(1)
+                raise SystemExit, 'Error: %s failed (abort)\n' % argv[0]
         self.plugin_pids.append(pid)
 
     def open_ghost_manager(self):
index 24fc4ab..da39c11 100644 (file)
@@ -120,8 +120,7 @@ class Catalog_xml:
         try:
             codecs.lookup(encoding)
         except:
-            sys.stderr.write('Unsupported encoding %s' % repr(encoding))
-            sys.exit(-1)
+            raise SystemExit, 'Unsupported encoding %s' % repr(encoding)
         nest = 0
         new_entry = {}
         set_id = None
index 17cfcb6..33c41f9 100644 (file)
@@ -12,7 +12,7 @@
 #  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for more details.
 #
-# $Id: sakura.py,v 1.149 2006/07/18 13:54:33 shy Exp $
+# $Id: sakura.py,v 1.150 2006/08/26 16:01:18 shy Exp $
 #
 
 import os
@@ -1011,6 +1011,18 @@ class Sakura:
                 self.balloon.append_meta(self.script_side, '<sub>')
             else:
                 self.balloon.append_meta(self.script_side, '</sub>')
+        elif args[0] == 'strike':
+            assert len(args) == 2
+            if args[1] in ['true', '1', 1]:
+                self.balloon.append_meta(self.script_side, '<s>')
+            else:
+                self.balloon.append_meta(self.script_side, '</s>')
+        elif args[0] == 'underline':
+            assert len(args) == 2
+            if args[1] in ['true', '1', 1]:
+                self.balloon.append_meta(self.script_side, '<u>')
+            else:
+                self.balloon.append_meta(self.script_side, '</u>')
         else:
             pass ## FIXME
 
index ce6be8c..394c730 100644 (file)
@@ -11,7 +11,7 @@
 #  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for more details.
 #
-# $Id: script.py,v 1.15 2006/07/18 13:54:33 shy Exp $
+# $Id: script.py,v 1.16 2006/08/26 16:01:18 shy Exp $
 #
 
 import re
@@ -204,6 +204,7 @@ class Parser:
                 self.script.append((SCRIPT_TAG, lexeme, argument))
             elif lexeme.startswith('\\s') or \
                  lexeme.startswith('\\b') or \
+                 lexeme.startswith('\\p') or \
                  lexeme.startswith('\\w'):
                 num = lexeme[2]
                 if lexeme.startswith('\\s') and scope == 1:
index dcb8519..8c5e1e0 100644 (file)
@@ -15,7 +15,6 @@
 
 import os
 import re
-import sys
 import urlparse
 import random
 
@@ -237,8 +236,7 @@ class Surface:
         # check if necessary surfaces have been loaded
         for key in ['0', '10']:
             if key not in pixbufs:
-                sys.stderr.write('cannot load surface #%s (abort)\n' % key)
-                sys.exit(1)
+                raise SystemExit, 'cannot load surface #%s (abort)\n' % key
         self.__pixbufs = pixbufs
         # arrange surface configurations
         region = {}
index 2a1a199..8c91892 100644 (file)
@@ -11,7 +11,7 @@
 #  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for more details.
 #
-# $Id: update.py,v 1.14 2005/09/07 05:17:46 shy Exp $
+# $Id: update.py,v 1.15 2006/08/26 16:01:18 shy Exp $
 #
 
 import urlparse
@@ -400,8 +400,7 @@ class NetworkUpdate:
 def test():
     import sys
     if len(sys.argv) != 3:
-        sys.stderr.write('Usage: update.py homeurl ghostdir\n')
-        sys.exit(1)
+        raise SystemExit, 'Usage: update.py homeurl ghostdir\n'
     update = NetworkUpdate(None)
     update.start(sys.argv[1], sys.argv[2], timeout=60)
     while 1:
index 3a8a314..69f1399 100644 (file)
@@ -10,7 +10,7 @@
 #  PURPOSE.  See the GNU General Public License for more details.
 #
 
-NUMBER = '3.8.8'
+NUMBER = '3.8.9'
 CODENAME = 'hacking run'
 
 VERSION = '%s (%s)' % (NUMBER, CODENAME)