[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 4.0-22-ge53e415
Luca Bruno
lethalman88 at gmail.com
Wed Mar 25 22:56:45 UTC 2009
The following commit has been merged in the master branch:
commit 934e1eacc8c8aaf1616b2bcbe779dea7201319ca
Author: Luca Bruno <lethalman88 at gmail.com>
Date: Tue Mar 24 20:13:12 2009 +0100
Delegate system to ui.system. Added VTE for gtk ui
diff --git a/bin/reportbug b/bin/reportbug
index ae83365..9b80f51 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -95,14 +95,6 @@ def stopmsg(filename):
'it as bug report body, please take a look at the "-i FILE, '
'--include=FILE" option.\n', filename)
-# Obscene hack :)
-def system(cmdline):
- try:
- x = os.getcwd()
- except OSError:
- os.chdir('/')
- os.system(cmdline)
-
def include_file_in_report(message, message_filename,
attachment_filenames, package_name,
include_filename, charset, inline=False):
@@ -1481,7 +1473,7 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
break
elif x == 'd':
PAGER = os.environ.get('PAGER', '/usr/bin/sensible-pager')
- system(PAGER+' '+' '.join(changed))
+ ui.system(PAGER+' '+' '.join(changed))
else:
break
@@ -1696,7 +1688,7 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
fh, filename = TempFile(prefix=tfprefix)
fh.close()
- system('%s %s %s' % (handler, commands.mkarg(bugexec),
+ ui.system('%s %s %s' % (handler, commands.mkarg(bugexec),
commands.mkarg(filename)))
addinfo = None
diff --git a/debian/control b/debian/control
index fdc22d6..2693d50 100644
--- a/debian/control
+++ b/debian/control
@@ -14,7 +14,7 @@ Homepage: http://alioth.debian.org/projects/reportbug/
Package: reportbug
Architecture: all
Depends: ${python:Depends}, apt, python-reportbug
-Suggests: postfix | exim4 | mail-transport-agent, gnupg | pgp, debconf-utils (>> 1.1.0), debsums, file (>> 1.30), dlocate, python-urwid, python-gtk2
+Suggests: postfix | exim4 | mail-transport-agent, gnupg | pgp, debconf-utils (>> 1.1.0), debsums, file (>> 1.30), dlocate, python-urwid, python-gtk2, python-vte
Conflicts: python-urwid (<< 0.9.8-1), python-central (<< 0.5.13)
XB-Python-Version: ${python:Versions}
Description: reports bugs in the Debian distribution
diff --git a/reportbug/submit.py b/reportbug/submit.py
index 2b22431..a66bc97 100644
--- a/reportbug/submit.py
+++ b/reportbug/submit.py
@@ -51,14 +51,6 @@ from utils import get_email_addr
quietly = False
-# Obscene hack :)
-def system(cmdline):
- try:
- x = os.getcwd()
- except OSError:
- os.chdir('/')
- os.system(cmdline)
-
ascii_range = ''.join([chr(ai) for ai in range(32,127)])
notascii = re.compile(r'[^'+re.escape(ascii_range)+']')
notascii2 = re.compile(r'[^'+re.escape(ascii_range)+r'\s]')
@@ -433,7 +425,7 @@ def send_report(body, attachments, mua, fromaddr, sendto, ccaddr, bccaddr,
ewrite("Spawning %s...\n", bit or mua)
if '%s' not in mua:
mua += ' %s'
- system(mua % commands.mkarg(filename)[1:])
+ ui.system(mua % commands.mkarg(filename)[1:])
elif not failed and (using_sendmail or smtphost):
if kudos:
ewrite('\nMessage sent to: %s\n', sendto)
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index eb34a4a..ac41672 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -29,6 +29,11 @@ try:
except ImportError:
raise UINotImportable, 'Please install the python-gtk2 package to use this interface.'
+try:
+ import vte
+except ImportError:
+ raise UINotImportable, 'Please install the python-vte package to use this interface.'
+
gdk.threads_init ()
import sys
@@ -1068,6 +1073,31 @@ class SelectOptionsPage (Page):
self.vbox.show_all ()
+class SystemPage (Page):
+ default_complete = False
+
+ def create_widget (self):
+ hbox = gtk.HBox ()
+
+ self.terminal = vte.Terminal ()
+ self.terminal.set_cursor_blinks (True)
+ self.terminal.set_emulation ("xterm")
+ self.terminal.connect ('child-exited', self.on_child_exited)
+ hbox.pack_start (self.terminal)
+
+ scrollbar = gtk.VScrollbar ()
+ scrollbar.set_adjustment (self.terminal.get_adjustment ())
+ hbox.pack_start (scrollbar)
+
+ return hbox
+
+ def on_child_exited (self, terminal):
+ self.set_page_complete (True)
+
+ def execute (self, cmdline):
+ print cmdline
+ self.terminal.fork_command ('/bin/bash', ['/bin/bash', '-c', cmdline])
+
class ProgressPage (Page):
page_type = gtk.ASSISTANT_PAGE_PROGRESS
@@ -1237,7 +1267,8 @@ pages = { 'get_string': GetStringPage,
'final_message': FinalMessagePage,
'spawn_editor': EditorPage,
'select_options': SelectOptionsPage,
- 'get_list': GetListPage }
+ 'get_list': GetListPage,
+ 'system': SystemPage }
dialogs = { 'yes_no': YesNoDialog,
'get_filename': GetFilenameDialog,
'display_failure': DisplayFailureDialog, }
@@ -1281,6 +1312,7 @@ def test ():
print select_options ('test', 'A', {'a': 'A test'})
print get_multiline ('ENTER', empty_ok=True)
print get_string ("test")
+ print system ("yes")
page = HandleBTSQueryPage (assistant)
application.run_once_in_main_thread (page.execute_operation, [('test', (Bug ('#123 [test] [we] we we Reported by: test;' ), Bug ('#123 [test] [we] we we Reported by: test;')))], 'test')
return application.get_last_value ()
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index 4df59a7..dd3670a 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -69,6 +69,13 @@ def ewrite(message, *args):
log_message = ewrite
display_failure = ewrite
+def system(cmdline):
+ try:
+ x = os.getcwd()
+ except OSError:
+ os.chdir('/')
+ os.system(cmdline)
+
def indent_wrap_text(text, starttext='', indent=0, linelen=None):
"""Wrapper for textwrap.fill to the existing API."""
if not linelen:
diff --git a/reportbug/ui/urwid_ui.py b/reportbug/ui/urwid_ui.py
index 3c2dd3a..f69c179 100644
--- a/reportbug/ui/urwid_ui.py
+++ b/reportbug/ui/urwid_ui.py
@@ -36,6 +36,7 @@ from reportbug.urlutils import launch_browser
from text_ui import (
ewrite,
spawn_editor,
+ system
)
from reportbug import VERSION
--
Reportbug - reports bugs in the Debian distribution
More information about the Reportbug-commits
mailing list