Changeset 95
- Timestamp:
- 03/19/04 21:35:03 (4 years ago)
- Files:
-
- 05/devel/doc/tutorial.html (modified) (1 diff)
- 05/devel/kombilo.py (modified) (7 diffs)
- 05/devel/v.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
05/devel/doc/tutorial.html
r93 r95 819 819 Mac OS X users it is available via fink. Otherwise, 820 820 you can get it at 821 <a href="http://cjkpython. berlios.de/">http://cjkpython.berlios.de/</a>.</p>821 <a href="http://cjkpython.i18n.org/">http://cjkpython.i18n.org/</a>.</p> 822 822 823 823 05/devel/kombilo.py
r91 r95 2708 2708 s = sOrig.decode(currentEncoding).encode('utf-8') 2709 2709 cursor = Cursor(s, self.options.sloppySGF.get()) 2710 2710 2711 if encoding1 == 2 and not cursor.encoding: 2712 d = cursor.getRootNode(0) 2713 d['CA'] = ['utf-8'] 2714 cursor.encoding = 'utf-8' 2715 cursor.updateRootNode(d,0) 2711 2716 file = open(f, 'w') 2712 file.write( s)2717 file.write(cursor.output()) 2713 2718 file.close() 2714 2719 except IOError: … … 2719 2724 if cursor.root.numChildren > 1: 2720 2725 collection = 1 2721 messages.insert(END, 'Warning: ' + f +' is a collection; for performance reasons it would be better to' + \2726 messages.insert(END,'Warning: '+f+' is a collection; for performance reasons it would be better to' + \ 2722 2727 ' split it into files with single game records.\n') 2723 2728 elif cursor.root.numChildren == 1: … … 5111 5116 return filename, gameNumber, moveno 5112 5117 5118 def getEncoding(self, no, label): 5119 dbindex, index = self.gamelist.getIndex(int(no[0])) 5120 if dbindex == -1: return 5121 else: return self.gamelist.DBlist[dbindex]['encoding'] 5122 5123 5113 5124 5114 5125 def openViewer_external(self, filename, gameNumber, moveno): … … 5180 5191 5181 5192 5182 def openViewer_internal(self, filename, gameNumber, moveno ):5183 apply(self.openFile, os.path.split(filename) )5193 def openViewer_internal(self, filename, gameNumber, moveno, encoding): 5194 apply(self.openFile, os.path.split(filename) + (encoding,)) 5184 5195 5185 5196 if gameNumber: … … 5212 5223 5213 5224 filename, gameNumber, moveno = self.getFilename(no, label) 5225 encoding = self.getEncoding(no, label) 5214 5226 if not self.options.externalViewer.get(): 5215 5227 self.openViewer_external(filename, gameNumber, moveno) 5216 5228 else: 5217 self.openViewer_internal(filename, gameNumber, moveno )5229 self.openViewer_internal(filename, gameNumber, moveno, encoding) 5218 5230 5219 5231 … … 5222 5234 5223 5235 filename, gameNumber, moveno = self.getFilename(no, label) 5236 encoding = self.getEncoding(no, label) 5224 5237 if self.options.externalViewer.get(): 5225 5238 self.openViewer_external(filename, gameNumber, moveno) 5226 5239 else: # don't open external viewer 5227 self.openViewer_internal(filename, gameNumber, moveno )5240 self.openViewer_internal(filename, gameNumber, moveno, encoding) 5228 5241 5229 5242 … … 5745 5758 self.options.maxLengthSearchesStack.set(i) 5746 5759 5747 def openFile(self, path=None, filename=None ):5760 def openFile(self, path=None, filename=None, encoding = None): 5748 5761 self.board.newPosition() 5749 v.Viewer.openFile(self, path, filename )5762 v.Viewer.openFile(self, path, filename, encoding) 5750 5763 5751 5764 05/devel/v.py
r71 r95 1058 1058 if self.encoding: 1059 1059 try: 1060 s = s.decode(self.encoding.lower()) #.encode('utf-8')1060 s = s.decode(self.encoding.lower()).encode('utf-8') 1061 1061 except: 1062 1062 pass … … 2234 2234 2235 2235 2236 def openFile(self, path = None, filename = None ):2236 def openFile(self, path = None, filename = None, encoding = None): 2237 2237 """ Read an SGF file given by filename (if None, ask 2238 2238 for a filename). """ … … 2272 2272 return 0 2273 2273 2274 if not c.encoding: c.encoding=encoding 2275 2274 2276 self.dataWindow.filelist.insert(0, filename) 2275 2277 self.filelist.insert(0, [filename, os.path.join(path,filename), (), c, {}]) … … 2651 2653 window = Toplevel() 2652 2654 window.transient(self.master) 2655 window.protocol('WM_DELETE_WINDOW', self.gameinfoCancel) 2653 2656 self.gameinfoWindow = window 2654 2657 window.title('Game Info')
