summaryrefslogtreecommitdiff
path: root/display/modes.py
diff options
context:
space:
mode:
authorDiego Roversi <diegor@tiscali.it>2019-09-12 21:33:58 +0200
committerDiego Roversi <diegor@tiscali.it>2019-09-12 21:33:58 +0200
commitf2779197b13fdbbd0d42e48215c51d24d86ee91b (patch)
tree968267aa9909470c27b43109029e87d1f126b4e7 /display/modes.py
parentbc2155a93cd15c975881d7ca8f57f0f4b5c4aa27 (diff)
2to3 of display module
Diffstat (limited to 'display/modes.py')
-rw-r--r--display/modes.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/display/modes.py b/display/modes.py
index ad0c1c0..0ac680e 100644
--- a/display/modes.py
+++ b/display/modes.py
@@ -7,7 +7,8 @@ KeyReleased = 3
class BaseDisplay:
__taskbkgnd = None
- def taskbar(self, (x, y, w, h)):
+ def taskbar(self, s):
+ (x, y, w, h) = s
if self.__taskbkgnd is None:
pixel = "\x00\x00\x80"
hole = "\x01\x01\x01"
@@ -56,22 +57,22 @@ class Mode:
state = ' [%s]' % err
else:
state = ''
- print >> f, ' %-8s %s%s' % (self.name, self.descr, state)
+ print(' %-8s %s%s' % (self.name, self.descr, state), file=f)
if self.url:
- print >> f, ' %s' % self.url
+ print(' %s' % self.url, file=f)
for line in self.extraoptsdescr:
- print >> f, ' %s' % line
+ print(' %s' % line, file=f)
def getformaloptions(self):
- return '', [c+'=' for c in self.options.keys()]
+ return '', [c+'=' for c in list(self.options.keys())]
def setoptions(self, options):
- for key in self.options.keys():
- if options.has_key('--'+key):
+ for key in list(self.options.keys()):
+ if '--'+key in options:
self.options[key] = options['--'+key]
def currentdriver(self):
- lst = self.options.items()
+ lst = list(self.options.items())
lst.sort()
lst = ['--%s=%s' % keyvalue for keyvalue in lst]
return ' '.join([self.name] + lst)
@@ -146,22 +147,22 @@ def findmode(name, lst):
return info
if last_chance is not None:
return last_chance
- raise KeyError, 'no driver available!'
+ raise KeyError('no driver available!')
else:
# find mode by name
for info in lst:
if info.name.upper() == name.upper():
err = info.imperror()
if err:
- raise KeyError, '%s: %s' % (info.name, err)
+ raise KeyError('%s: %s' % (info.name, err))
return info
- raise KeyError, '%s: no such driver' % name
+ raise KeyError('%s: no such driver' % name)
def findmode_err(*args):
try:
return findmode(*args)
- except KeyError, e:
- print >> sys.stderr, str(e)
+ except KeyError as e:
+ print(str(e), file=sys.stderr)
sys.exit(1)
def open_dpy(mode, width, height, title):
@@ -169,7 +170,7 @@ def open_dpy(mode, width, height, title):
ginfo = findmode_err(driver, graphicmodeslist())
ginfo.setoptions(extraopts)
dpy = ginfo.getmodule().Display(width, height, title, **ginfo.options)
- print 'graphics driver:', ginfo.currentdriver()
+ print('graphics driver:', ginfo.currentdriver())
return dpy
def open_snd(mode):
@@ -183,7 +184,7 @@ def open_snd(mode):
if (sinfo.options['music'].startswith('n') or
sinfo.options['music'] == 'off'):
snd.has_music = 0
- print 'sound driver:', sinfo.currentdriver()
+ print('sound driver:', sinfo.currentdriver())
return snd
else:
return None