Browse Source

Fall back to text interface if UI is not initializable; Closes: #534876

suites/jessie-proposed-backports
Luca Bruno 13 years ago
parent
commit
2aa6d15c84
  1. 14
      bin/reportbug
  2. 5
      debian/changelog
  3. 3
      reportbug/ui/__init__.py
  4. 6
      reportbug/ui/gtk2_ui.py
  5. 2
      reportbug/ui/text_ui.py
  6. 2
      reportbug/ui/urwid_ui.py

14
bin/reportbug

@ -486,7 +486,7 @@ def offer_configuration(options):
if options.configure or not options.interface:
interface = ui.menu(
'Please choose the default interface for reportbug.', AVAILABLE_UIS,
'Select interface: ', options.interface, order=['text'])
'Select interface: ', options.interface, order=['text', 'urwid', 'gtk2'])
else:
interface = options.interface
@ -928,15 +928,21 @@ def main():
try:
lib_package = __import__('reportbug.ui', fromlist=[iface])
ui = getattr(lib_package, iface)
newui = getattr(lib_package, iface)
except UINotImportable, msg:
ui.long_message('*** Unable to import %s interface: %s '
'Falling back to text interface.\n',
interface, msg)
ewrite('\n')
ui.initialize ()
submit.ui = ui
if newui.initialize ():
ui = newui
submit.ui = ui
else:
ui.long_message('*** Unable to initialize %s interface. '
'Falling back to text interface.\n',
interface)
# Add INTERFACE as an environment variable to access it from the
# script gathering the special information for reportbug, when
# a new bug should be filed against it.

5
debian/changelog

@ -22,8 +22,11 @@ reportbug (4.7) UNRELEASED; urgency=low
* reportbug/ui/gtk_ui.py
- wrap words when editing bug reports
- workaround possible GTK+ regression to show the intro page
* bin/reportbug
- fallback to text interface if UI can't be initialized; Closes: #534876
- set UI order to text, urwid, gtk2
-- Luca Bruno <lethalman88@gmail.com> Mon, 31 Aug 2009 11:39:04 +0200
-- Luca Bruno <lethalman88@gmail.com> Mon, 31 Aug 2009 12:11:33 +0200
reportbug (4.6) unstable; urgency=low

3
reportbug/ui/__init__.py

@ -28,7 +28,7 @@ __all__ = ['text_ui', 'urwid_ui', 'gtk2_ui']
UIS = {'text': 'A text-oriented console user interface',
'urwid': 'A menu-based console user interface',
'gtk2': 'A graphical (GTK+) user interface'}
'gtk2': 'A graphical (GTK+) user interface. Requires python-vte package to work.'}
# Only the available UIs
AVAILABLE_UIS = {}
@ -49,7 +49,6 @@ for uis in UIS.keys():
# we can't import uis, so just skip it
pass
def getUI(ui):
"""Returns the requested UI, or default to text if not available"""

6
reportbug/ui/gtk2_ui.py

@ -1438,7 +1438,8 @@ def initialize ():
try:
vte = __import__ ("vte")
except ImportError:
message = "Please install the %s package to use the gtk2 interface."
message = """Please install the %s package to use the gtk2 interface.
Falling back to text interface."""
dialog = gtk.MessageDialog (None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, None)
dialog.set_markup (message % "<b>python-vte</b>")
@ -1446,7 +1447,7 @@ def initialize ():
dialog.destroy ()
while gtk.events_pending ():
gtk.main_iteration ()
sys.exit (1)
return False
# Exception hook
oldhook = sys.excepthook
@ -1464,6 +1465,7 @@ def initialize ():
forward_operations (application, dialogs)
application.start ()
return True
def test ():
# Write some tests here

2
reportbug/ui/text_ui.py

@ -1013,4 +1013,4 @@ def spawn_editor(message, filename, editor, charset='utf-8'):
return (newmessage, newmessage != message)
def initialize ():
pass
return True

2
reportbug/ui/urwid_ui.py

@ -649,7 +649,7 @@ palette = [
]
def initialize ():
pass
return True
def test():
import time

Loading…
Cancel
Save