[tui] warn about urwid<1.0.0 bug using the "curses" interface (closes #119019)

authorAlain Leufroy <alain.leufroy@logilab.fr>
changeset67bf01870819
branchstable
phasepublic
hiddenno
parent revision#2b76a860ac92 [tui] fix source position (closes #119019)
child revision#642c7ed402f7 fix silly typo
files modified by this revision
README
hgviewlib/curses/application.py
# HG changeset patch
# User Alain Leufroy <alain.leufroy@logilab.fr>
# Date 1359474347 -3600
# Tue Jan 29 16:45:47 2013 +0100
# Branch stable
# Node ID 67bf01870819bd7c4e7c314d31338c3b7e0cffc0
# Parent 2b76a860ac92fc4ce699e5eb7a65e6902c7ac033
[tui] warn about urwid<1.0.0 bug using the "curses" interface (closes #119019)

diff --git a/README b/README
@@ -20,11 +20,13 @@
1  hgview can be used either as a hg extension, or as a standalone
2  application.
3 
4  The Common library depends on: mercurial (1.0 minimum)
5  The Qt4 interface depends on PyQt4, QScintilla and PyQScintilla, DocUtils
6 -The Text interface depends on urwid, pygments and pyinotify
7 +The Text interfaces depend on urwid (>=0.9.1 for "raw", >=1.0.0 for "curses"),
8 +pygments and pyinotify
9 +
10 
11  Run from the hg repository
12  --------------------------
13 
14  You can run ``hgview`` without installing it.
diff --git a/hgviewlib/curses/application.py b/hgviewlib/curses/application.py
@@ -19,13 +19,13 @@
15  """
16  import threading
17  import logging
18  import sys
19 
20 -from urwid import AttrWrap, MainLoop
21 +from urwid import AttrWrap, MainLoop, __version__ as URWID_VERSION
22 
23 -from hgviewlib.application import HgViewApplication
24 +from hgviewlib.application import HgViewApplication, ApplicationError
25  from hgviewlib.curses.hgrepoviewer import RepoViewer
26  from hgviewlib.curses import MainFrame, emit_command, activate_delayed_signals
27 
28  try:
29      import pygments
@@ -56,10 +56,16 @@
30 
31  #        register_command('alarm', 'process callback in a given seconds',
32 
33      def get_screen(self):
34          """return the screen instance to use"""
35 +        if self.opts.interface == 'curses' and \
36 +            map(int, URWID_VERSION.split('.')) < (1,0,0):
37 +            raise ApplicationError('The "curses" interface could not be use '
38 +                                   'with old urwid version ()%s < 1.0.0.'
39 +                                   'Use the"raw" interface' %
40 +                                   URWID_VERSION)
41          if self.opts.interface == 'raw':
42              from urwid.raw_display import Screen
43          elif self.opts.interface == 'curses':
44              from urwid.curses_display import Screen
45