summaryrefslogtreecommitdiff
path: root/ql
diff options
context:
space:
mode:
Diffstat (limited to 'ql')
-rw-r--r--ql/completer.py10
-rwxr-xr-xql/console.py8
-rw-r--r--ql/lineup.py6
3 files changed, 19 insertions, 5 deletions
diff --git a/ql/completer.py b/ql/completer.py
index a9b7d8d..89920d4 100644
--- a/ql/completer.py
+++ b/ql/completer.py
@@ -1,4 +1,5 @@
import readline
+import sys
class Completer(object):
@@ -10,8 +11,15 @@ class Completer(object):
readline.set_completer_delims('') # allow options with whitespace
readline.parse_and_bind('tab: complete')
+ def __encode_completion_string(self, s):
+ try:
+ return s.encode(sys.stdin.encoding) if isinstance(s, unicode) else s
+ except NameError: # Python 3.x does not have a 'unicode' type
+ pass
+ return s
+
def __init__(self, options):
- self.options = options
+ self.options = [self.__encode_completion_string(s) for s in options]
def complete(self, text, state):
text = text.lower()
diff --git a/ql/console.py b/ql/console.py
index 0c741ca..6751b83 100755
--- a/ql/console.py
+++ b/ql/console.py
@@ -21,7 +21,13 @@ class Console(object):
def process_table(self, table):
lineup = self.get_lineup(table)
print(lineup.info)
- print()
+ print('')
+ # Python 2.x workaround
+ global input
+ try:
+ input = raw_input
+ except NameError:
+ pass # if raw_input is not defined (Python 3.x), ignore it
for team in lineup.teams:
Completer.install_new_completer(team.player_names)
for pair in team.pairs:
diff --git a/ql/lineup.py b/ql/lineup.py
index b0d5847..688825b 100644
--- a/ql/lineup.py
+++ b/ql/lineup.py
@@ -38,7 +38,7 @@ class TeamInSegment(object):
class HomeTeamInSegment(TeamInSegment):
def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
+ super(HomeTeamInSegment, self).__init__(*args, **kwargs)
def get_paired_players_fields(self):
return [
@@ -56,7 +56,7 @@ class HomeTeamInSegment(TeamInSegment):
class AwayTeamInSegment(TeamInSegment):
def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
+ super(AwayTeamInSegment, self).__init__(*args, **kwargs)
def get_paired_players_fields(self):
return [
@@ -95,7 +95,7 @@ class Pair(object):
return 'Team: %s - %s - %s' % (
self.team.name,
self.label,
- [ p.info if p is not None else '<blank>' for p in self.players ]
+ ', '.join([ p.info if p is not None else '<blank>' for p in self.players ])
)
def set_player(self, name):