4 new revisions:
Revision: 76afca8a0df1
Branch: default
Author: gbtami
Date: Wed Dec 31 10:57:48 2014 UTC
Log: Fixed NameError: global name 'gtk' is not defined
https://code.google.com/p/pychess/source/detail?r=76afca8a0df1
Revision: 1763e72c8013
Branch: default
Author: gbtami
Date: Wed Dec 31 11:19:08 2014 UTC
Log: Python3 compatible open() with encoding support
https://code.google.com/p/pychess/source/detail?r=1763e72c8013
Revision: 5a35015ac7b7
Branch: default
Author: gbtami
Date: Wed Dec 31 11:54:58 2014 UTC
Log: Simpler and more compatible open()
https://code.google.com/p/pychess/source/detail?r=5a35015ac7b7
Revision: fcccf6667534
Branch: default
Author: gbtami
Date: Wed Dec 31 11:55:52 2014 UTC
Log: Misc annotation panel bug fixes
https://code.google.com/p/pychess/source/detail?r=fcccf6667534
==============================================================================
Revision: 76afca8a0df1
Branch: default
Author: gbtami
Date: Wed Dec 31 10:57:48 2014 UTC
Log: Fixed NameError: global name 'gtk' is not defined
https://code.google.com/p/pychess/source/detail?r=76afca8a0df1
Modified:
/sidepanel/annotationPanel.py
=======================================
--- /sidepanel/annotationPanel.py Tue Dec 30 23:25:10 2014 UTC
+++ /sidepanel/annotationPanel.py Wed Dec 31 10:57:48 2014 UTC
@@ -149,7 +149,7 @@
""" Calls variation remover when clicking on remove marker """
tag_name = tag.get_property("name")
- if event.type == gtk.gdk.BUTTON_PRESS and tag_name
== "remove-variation":
+ if event.type == gdk.EventType.BUTTON_PRESS and tag_name
== "remove-variation":
offset = iter.get_offset()
node = None
for n in self.nodelist:
==============================================================================
Revision: 1763e72c8013
Branch: default
Author: gbtami
Date: Wed Dec 31 11:19:08 2014 UTC
Log: Python3 compatible open() with encoding support
https://code.google.com/p/pychess/source/detail?r=1763e72c8013
Modified:
/lib/pychess/Database/PgnImport.py
/lib/pychess/Savers/pgnbase.py
/lib/pychess/System/protoopen.py
/lib/pychess/compat.py
/lib/pychess/widgets/gamenanny.py
=======================================
--- /lib/pychess/Database/PgnImport.py Tue Dec 30 23:25:10 2014 UTC
+++ /lib/pychess/Database/PgnImport.py Wed Dec 31 11:19:08 2014 UTC
@@ -363,7 +363,7 @@
player_data.append({
"fideid": int(line[:8]),
- "name": line[10:42].rstrip().decode('latin_1'),
+ "name": line[10:42].rstrip(),
"title": title,
"fed": line[48:51],
"elo": elo,
=======================================
--- /lib/pychess/Savers/pgnbase.py Tue Dec 30 16:36:34 2014 UTC
+++ /lib/pychess/Savers/pgnbase.py Wed Dec 31 11:19:08 2014 UTC
@@ -268,10 +268,10 @@
if not inTags:
files.append(["",""])
inTags = True
- files[-1][0] += line.decode("latin_1")
+ files[-1][0] += line
else:
if not inTags:
- files[-1][1] += line.decode('latin_1')
+ files[-1][1] += line
else:
print("Warning: ignored invalid tag pair %s" % line)
else:
@@ -280,7 +280,7 @@
# In rare cases there might not be any tags at all. It's
not
# legal, but we support it anyways.
files.append(["",""])
- files[-1][1] += line.decode('latin_1')
+ files[-1][1] += line
return klass(files)
=======================================
--- /lib/pychess/System/protoopen.py Wed Dec 31 09:59:14 2014 UTC
+++ /lib/pychess/System/protoopen.py Wed Dec 31 11:19:08 2014 UTC
@@ -1,6 +1,8 @@
import os
-from pychess.compat import urlopen, url2pathname
+from pychess.compat import open, urlopen, url2pathname
+
+PGN_ENCODING = "latin_1"
def splitUri (uri):
uri = url2pathname(uri) # escape special chars
@@ -11,7 +13,7 @@
""" Function for opening many things """
try:
- return open(uri, "rU")
+ return open(uri, "rU", encoding=PGN_ENCODING)
except (IOError, OSError):
pass
@@ -29,12 +31,12 @@
if splitted[0] == "file":
if append:
- return open(splitted[1], "a")
+ return open(splitted[1], "a", encoding=PGN_ENCODING)
return open(splitted[1], "w")
elif len(splitted) == 1:
if append:
- return open(splitted[0], "a")
- return open(splitted[0], "w")
+ return open(splitted[0], "a", encoding=PGN_ENCODING)
+ return open(splitted[0], "w", encoding=PGN_ENCODING)
raise IOError("PyChess doesn't support writing to protocol")
=======================================
--- /lib/pychess/compat.py Tue Dec 30 23:25:10 2014 UTC
+++ /lib/pychess/compat.py Wed Dec 31 11:19:08 2014 UTC
@@ -8,6 +8,7 @@
if PY3:
basestring = str
memoryview = memoryview
+ open = open
unichr = chr
unicode = lambda x: x
raw_input = input
@@ -35,3 +36,17 @@
from ConfigParser import SafeConfigParser
from Queue import Queue, Empty, Full
from urllib import urlopen, urlencode, url2pathname
+
+ import codecs
+ import warnings
+ def open(file, mode='r', buffering=-1, encoding=None,
+ errors=None, newline=None, closefd=True, opener=None):
+ if newline is not None:
+ warnings.warn('newline is not supported in py2')
+ if not closefd:
+ warnings.warn('closefd is not supported in py2')
+ if opener is not None:
+ warnings.warn('opener is not supported in py2')
+ return codecs.open(filename=file, mode=mode, encoding=encoding,
+ errors=errors, buffering=buffering)
+
=======================================
--- /lib/pychess/widgets/gamenanny.py Wed Dec 31 10:05:22 2014 UTC
+++ /lib/pychess/widgets/gamenanny.py Wed Dec 31 11:19:08 2014 UTC
@@ -6,6 +6,7 @@
import math
from gi.repository import Gtk
+from pychess.compat import unicode
from pychess.ic.FICSObjects import make_sensitive_if_available,
make_sensitive_if_playing
from pychess.ic.ICGameModel import ICGameModel
from pychess.Utils.Offer import Offer
==============================================================================
Revision: 5a35015ac7b7
Branch: default
Author: gbtami
Date: Wed Dec 31 11:54:58 2014 UTC
Log: Simpler and more compatible open()
https://code.google.com/p/pychess/source/detail?r=5a35015ac7b7
Modified:
/lib/pychess/compat.py
=======================================
--- /lib/pychess/compat.py Wed Dec 31 11:19:08 2014 UTC
+++ /lib/pychess/compat.py Wed Dec 31 11:54:58 2014 UTC
@@ -37,16 +37,5 @@
from Queue import Queue, Empty, Full
from urllib import urlopen, urlencode, url2pathname
- import codecs
- import warnings
- def open(file, mode='r', buffering=-1, encoding=None,
- errors=None, newline=None, closefd=True, opener=None):
- if newline is not None:
- warnings.warn('newline is not supported in py2')
- if not closefd:
- warnings.warn('closefd is not supported in py2')
- if opener is not None:
- warnings.warn('opener is not supported in py2')
- return codecs.open(filename=file, mode=mode, encoding=encoding,
- errors=errors, buffering=buffering)
+ from io import open
==============================================================================
Revision: fcccf6667534
Branch: default
Author: gbtami
Date: Wed Dec 31 11:55:52 2014 UTC
Log: Misc annotation panel bug fixes
https://code.google.com/p/pychess/source/detail?r=fcccf6667534
Modified:
/sidepanel/annotationPanel.py
=======================================
--- /sidepanel/annotationPanel.py Wed Dec 31 10:57:48 2014 UTC
+++ /sidepanel/annotationPanel.py Wed Dec 31 11:55:52 2014 UTC
@@ -149,7 +149,7 @@
""" Calls variation remover when clicking on remove marker """
tag_name = tag.get_property("name")
- if event.type == gdk.EventType.BUTTON_PRESS and tag_name
== "remove-variation":
+ if event.type == Gdk.EventType.BUTTON_PRESS and tag_name
== "remove-variation":
offset = iter.get_offset()
node = None
for n in self.nodelist:
@@ -322,7 +322,7 @@
if response == Gtk.ResponseType.ACCEPT:
dialog.destroy()
(iter_first, iter_last) = textbuffer.get_bounds()
- comment = textbuffer.get_text(iter_first, iter_last)
+ comment = textbuffer.get_text(iter_first, iter_last, False)
if board.children[index] != comment:
board.children[index] = comment
self.gamemodel.needsSave = True