Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-08 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

More patches.
- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjFUeQACgkQw9Qj+8Kak3EwEwCdHFEl6HE25YLPY7l89TiTYVW6
PXcAn3qnI0+1tQQKYkCHueWJ0zDnww+v
=sYtw
-END PGP SIGNATURE-
From 9c54219c9a168ae320d9a5e1e24291020038430b Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Mon, 8 Sep 2008 18:04:29 +0200
Subject: [PATCH] Set swirl icon for the window

---
 reportbug/ui/gtk2_ui.py |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 77c4056..5bfd0af 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -43,6 +43,7 @@ from reportbug import debianbts
 from reportbug.urlutils import launch_browser
 
 ISATTY = True
+DEBIAN_LOGO = /usr/share/pixmaps/debian-logo.png
 
 global application, assistant
 
@@ -443,7 +444,7 @@ class Page (ReportbugConnector):
 next_page_num = 0
 page_type = gtk.ASSISTANT_PAGE_CONTENT
 default_complete = False
-side_image = /usr/share/pixmaps/debian-logo.png
+side_image = DEBIAN_LOGO
 
 def __init__ (self, assistant):
 self.assistant = assistant
@@ -1088,6 +1089,7 @@ class ReportbugAssistant (gtk.Assistant):
 def __init__ (self, application):
 gtk.Assistant.__init__ (self)
 self.set_title ('Reportbug')
+self.set_icon_from_file (DEBIAN_LOGO)
 self.application = application
 self.showing_page = None
 self.requested_page = None
-- 
1.5.6.5

From 57cd3ff3d242342570c8998840b3e6751e5f0d4b Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Mon, 8 Sep 2008 18:22:57 +0200
Subject: [PATCH] Add support for querybts and queryonly

---
 reportbug/ui/gtk2_ui.py |   25 -
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 5bfd0af..c21b72a 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -277,13 +277,14 @@ class BugReport (object):
 # BTS GUI
 
 class BugPage (gtk.EventBox, threading.Thread):
-def __init__ (self, dialog, number, bts, mirrors, http_proxy, archived):
+def __init__ (self, dialog, number, queryonly, bts, mirrors, http_proxy, archived):
 threading.Thread.__init__ (self)
 gtk.EventBox.__init__ (self)
 self.dialog = dialog
 self.assistant = self.dialog.assistant
 self.application = self.assistant.application
 self.number = number
+self.queryonly = queryonly
 self.bts = bts
 self.mirrors = mirrors
 self.http_proxy = http_proxy
@@ -348,10 +349,11 @@ class BugPage (gtk.EventBox, threading.Thread):
 button = gtk.Button (Open in browser)
 button.connect ('clicked', self.on_open_browser)
 bbox.pack_start (button)
-button = gtk.Button (Reply)
-button.set_image (gtk.image_new_from_stock (gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON))
-button.connect ('clicked', self.on_reply)
-bbox.pack_start (button)
+if not self.queryonly:
+button = gtk.Button (Reply)
+button.set_image (gtk.image_new_from_stock (gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON))
+button.connect ('clicked', self.on_reply)
+bbox.pack_start (button)
 vbox.pack_start (bbox, expand=False)
 
 self.add (vbox)
@@ -369,11 +371,12 @@ class BugPage (gtk.EventBox, threading.Thread):
 self.dialog.destroy ()
 
 class BugsDialog (gtk.Dialog):
-def __init__ (self, assistant):
+def __init__ (self, assistant, queryonly):
 gtk.Dialog.__init__ (self, Reportbug: bug information, assistant,
  gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
  (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
 self.assistant = assistant
+self.queryonly = queryonly
 self.application = assistant.application
 self.notebook = gtk.Notebook ()
 self.vbox.pack_start (self.notebook)
@@ -384,7 +387,7 @@ class BugsDialog (gtk.Dialog):
 self.destroy ()
 
 def show_bug (self, number, *args):
-page = BugPage (self, number, *args)
+page = BugPage (self, number, self.queryonly, *args)
 self.notebook.append_page (page, gtk.Label (number))
 page.start ()
 
@@ -744,12 +747,16 @@ class HandleBTSQueryPage (TreePage):
 value_column = 0
 
 def sync_pre_operation (self, package, bts, mirrors=None, http_proxy=, queryonly=False, screen=None,
-archived='no', source=False, version=None):
+archived='no', source=False, title=None, version=None):
 self.bts = bts
 self.mirrors = mirrors
 self.http_proxy 

Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-08 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Man pages were missing the --ui option, and reportbug.conf.5 is missing both 
urwid and gtk2 interface.
Attached patch.

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjFVbMACgkQw9Qj+8Kak3F01gCfdqlBWJZsOWypdH+rD+rbnTx1
lnEAnRe661nrXEBnm4A1Wa6yew/Ubl0s
=760D
-END PGP SIGNATURE-
From e2f77fda3c55bdc7349e9d51946abe78a85d7fe5 Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Mon, 8 Sep 2008 18:40:17 +0200
Subject: [PATCH] Missing --ui in man pages

---
 man/querybts.1   |5 +
 man/reportbug.1  |5 +
 man/reportbug.conf.5 |2 +-
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/man/querybts.1 b/man/querybts.1
index db2e2a5..2b7e822 100644
--- a/man/querybts.1
+++ b/man/querybts.1
@@ -48,6 +48,11 @@ behind a firewall.
 .B \-s, \-\-source
 Query on source packages, rather than binary packages.
 .TP
+.B \-u, \-\-ui
+Specify the user interface to use.
+Valid options are \fBtext\fP, \fBnewt\fP, \fBurwid\fP, \fBgtk2\fP;
+default is taken from the reportbug configuration files.
+.TP
 .B \-w, \-\-web
 Launch a web browser to view bug reports, instead of using the
 internal interface.  This will also allow you to see all of the
diff --git a/man/reportbug.1 b/man/reportbug.1
index 9f6508b..106c505 100644
--- a/man/reportbug.1
+++ b/man/reportbug.1
@@ -403,6 +403,11 @@ ignore any tags specified on the command line.
 .B \-\-template
 Output a template report to standard output.
 .TP
+.B \-u, \-\-ui
+Specify the user interface to use.
+Valid options are \fBtext\fP, \fBnewt\fP, \fBurwid\fP, \fBgtk2\fP;
+default is taken from the reportbug configuration files.
+.TP
 .B \-v, \-\-verify
 Verify the integrity of the package (if installed) using debsums
 before reporting.
diff --git a/man/reportbug.conf.5 b/man/reportbug.conf.5
index 035c941..243bc98 100644
--- a/man/reportbug.conf.5
+++ b/man/reportbug.conf.5
@@ -235,7 +235,7 @@ Use \fIsubmit\fP as the bug submission address
 Use the template mode, bypasses all prompts and the output it sent to
 stdout
 .TP
-.B ui [\fItext\fP|\fInewt\fP]
+.B ui [\fItext\fP|\fInewt\fP|\fIurwid\fP|\fIgtk2\fP]
 The user interface that
 .B querybts(1)
 and
-- 
1.5.6.5

___
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint


Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-07 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sun, 7 Sep 2008 18:18:05 +0200
Sandro Tosi [EMAIL PROTECTED] wrote:

 All applied as of r650.
 
 Right after inserting bug text:
 
 Traceback (most recent call last):
   File /usr/lib/python2.5/site-packages/reportbug/ui/gtk2_ui.py,
 line 1119, in on_prepare
 self.showing_page.setup_focus ()
   File /usr/lib/python2.5/site-packages/reportbug/ui/gtk2_ui.py,
 line 1034, in setup_focus
 if self.default:
 AttributeError: 'SelectOptionsPage' object has no attribute 'default'
 
 Sandro
 

I've forgotten the patches again, I'm sorry.


- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjEFhgACgkQw9Qj+8Kak3EqZQCeO3JHfKdndN09+PADTnV3Ex7U
6FIAnAv97sEswyya+EV3zqv9FwPvedo+
=bJ0B
-END PGP SIGNATURE-
From 527206e1e97b77ced5bc074283c76ea9dc4db193 Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Sun, 7 Sep 2008 19:51:46 +0200
Subject: [PATCH] Fix handle_bugscript to use the UI.

---
 bin/reportbug   |   70 +-
 handle_bugscript|   54 +---
 reportbug/tempfiles.py  |7 +
 reportbug/ui/gtk2_ui.py |4 +++
 4 files changed, 105 insertions(+), 30 deletions(-)

diff --git a/bin/reportbug b/bin/reportbug
index 2414ce4..2f75646 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -47,6 +47,7 @@ from reportbug.utils import (
 )
 from reportbug.tempfiles import (
 TempFile,
+TempFifo,
 tempfile_prefix,
 cleanup_temp_file,
 )
@@ -286,6 +287,72 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
 
 return open(filename).read()
 
+class BugScript (object):
+def __init__ (self, fifo):
+self.fifo = fifo
+self.message = 
+
+def yes_no (self, arg):
+default = arg.rsplit(' ', 1)[-1]
+prompt = arg[:-len(default)].strip ()
+prompt = re.sub ('\[[yYnN/yYnN]\]', '', prompt).strip ()
+if prompt[-1] == '?':
+prompt = prompt[:-1]
+res = ui.yes_no (prompt, Yes, No, default=default == 'yep')
+if res:
+return 'yep'
+else:
+return 'nop'
+
+def append_message (self, line):
+self.message += line
+
+def long_message (self, arg=None):
+if self.message:
+ui.long_message (self.message)
+self.message = 
+
+def handle_command (self, command):
+op = command.split(' ', 1)[0].strip ()
+arg = command[len(op):].strip ()
+if op == 'end':
+os.unlink (self.fifo)
+return
+if op == 'append_message':
+self.append_message (arg)
+return
+
+# Show the message before each command
+self.long_message ()
+# Run the operation
+result = getattr(self, op)(arg)
+
+if result is not None:
+fifo = os.open (self.fifo, os.O_WRONLY)
+os.write (fifo, result)
+os.close (fifo)
+
+def run (self):
+while True:
+try:
+fifo = os.fdopen (os.open (self.fifo, os.O_RDONLY), r)
+except:
+break
+
+commands = []
+for line in fifo.readlines ():
+commands.append (line)
+
+fifo.close ()
+for command in commands:
+self.handle_command (command)
+
+def handle_bugscript (file, *args):
+# We act as an UI server for the bugscript
+fifo = TempFifo (bugscript)
+os.spawnl (os.P_NOWAIT, file, file, *(args + (fifo,)))
+BugScript(fifo).run ()
+
 def find_package_for(filename, notatty=False, pathonly=False):
 ewrite(Finding package for '%s'...\n, filename)
 (newfilename, packages) = utils.find_package_for(filename, pathonly)
@@ -1684,8 +1751,7 @@ orphaned for a long period of time are often removed from the archive.\n''')
 
 fh, filename = TempFile(prefix=tfprefix)
 fh.close()
-system('%s %s %s' % (handler, commands.mkarg(bugexec),
- commands.mkarg(filename)))
+handle_bugscript(handler, bugexec, filename)
 
 addinfo = None
 if not self.options.noconf:
diff --git a/handle_bugscript b/handle_bugscript
index 66c89cd..c519021 100755
--- a/handle_bugscript
+++ b/handle_bugscript
@@ -14,14 +14,32 @@
 
 set -e
 
+export FIFO=$3
+
+# Replace the original cat for backward compatibility
+cat()
+{
+if [ -n $1 ]; then
+/usr/bin/env cat $@
+return
+fi
+
+while [ $? -eq 0 ]; do
+read -r WE
+if [ -z $WE ]; then
+return
+fi
+echo $WE
+echo append_message $WE  $FIFO
+done
+}
+
+export -f cat
+
 # Wait for a keypress and put it in $KEY
 

Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-06 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sat, 6 Sep 2008 11:54:39 +0200
Sandro Tosi [EMAIL PROTECTED] wrote:

  * window size: I'd choose a window size bigger than the initial one,
  and at least so that it won't change during window navigation.
 
  I do agree. In the patch I have set 800x600 the bugs dialog, but I haven't 
  tried it due to packages.debian.org downtime.
 
 use -O to skip internet tests
 

- -O won't show the BTS query

  Patches attached, they might need the previous 3 patches to be committed.
  Shouldn't be a pain if you don't want to commit the previous 3.
 
 both patches series applied (committed at r647), but:
 

 $ reportbug --ui gtk2 -O --debug checkgmail
 Traceback (most recent call last):
   File /usr/bin/reportbug, line 1821, in module
 main()
   File /usr/bin/reportbug, line 844, in main
 return iface.user_interface()
   File /usr/bin/reportbug, line 1029, in user_interface
 Please change your locale if this is incorrect.\n\n, charset)
   File /usr/bin/reportbug, line 82, in ewrite
 return quietly or ui.log_message(*args)
   File /usr/lib/python2.5/site-packages/reportbug/ui/gtk2_ui.py,
 line 1199, in log_message
 return assistant.set_progress_label (*args, **kwargs)
 NameError: global name 'assistant' is not defined
 

In the second patch a def initialize() has been introduced.
I haven't touched elsewhere in the code but this is what I happened to think:
1) All UIs should have initialize()
2) After the UI has been chosen from /usr/bin/reportbug, ui.initialize() must 
be called

How does it sounds to you? I think it's normal for applications to know when 
they start.

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjCVUMACgkQw9Qj+8Kak3GyWACeM1jlk0jRaCHSEE//vUPbbv95
390An0mMGQv9+NMfS0xcHGV+onuztjMi
=0tGG
-END PGP SIGNATURE-
___
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint


Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-06 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I still couldn't find a solution for the Forward button, I'm asking to GTK+ 
and PyGTK hackers.
I've a attached some patches though:
01 fix the bug you described about the list
02 for select_options() (i.e. at the end of the report) activate the default 
button
03 tests
04 with size_request the user couldn't shrink the window
05 some label layout fixes

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjC/9AACgkQw9Qj+8Kak3Fx9wCeJ0WMycEHCO8mwwnJGT6LzQbZ
3L4AnjPXaM6RjegMmYLWKUhgOqneBhqw
=iZj7
-END PGP SIGNATURE-
From 170bb230c446b982060a3bc2aa7ca70b7714f0df Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Sat, 6 Sep 2008 23:42:16 +0200
Subject: [PATCH] Empty list allowed for get_multiline()

---
 reportbug/ui/gtk2_ui.py |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index b08d591..d1d1721 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -594,6 +594,7 @@ class GetMultilinePage (Page):
 return text.split ('\n')
 
 def execute (self, prompt):
+self.empty_ok = True
 # The result must be iterable for reportbug even if it's empty and not modified
 self.label.set_text (prompt)
 self.buffer.set_text ()
@@ -680,6 +681,8 @@ class GetListPage (TreePage):
 self.model.remove (iter)
 
 def execute (self, prompt):
+self.empty_ok = True
+
 self.label.set_text (prompt)
 
 self.model = gtk.ListStore (str)
-- 
1.5.6.5

From b1de3a8c2e99eb2b4ebb5068625d6c5964353fb7 Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Sat, 6 Sep 2008 23:43:06 +0200
Subject: [PATCH] Fixed 'default' button behavior for select_options()

---
 reportbug/ui/gtk2_ui.py |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index d1d1721..20aabde 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -1028,10 +1028,15 @@ class SelectOptionsPage (Page):
 self.application.set_next_value (menuopt)
 self.assistant.forward_page ()
 
+def setup_focus (self):
+if self.default:
+self.default.set_flags (gtk.CAN_DEFAULT | gtk.HAS_DEFAULT)
+self.default.grab_default ()
+
 def execute (self, prompt, menuopts, options):
 self.label.set_text (prompt)
 
-default = None
+self.default = None
 buttons = []
 for menuopt in menuopts:
 desc = options[menuopt.lower ()]
@@ -1041,7 +1046,7 @@ class SelectOptionsPage (Page):
 button = gtk.Button (options[menuopt.lower ()])
 button.connect ('clicked', self.on_clicked, menuopt.lower ())
 if menuopt.isupper ():
-default = button
+self.default = button
 buttons.insert (0, gtk.HSeparator ())
 buttons.insert (0, button)
 else:
@@ -1050,11 +1055,6 @@ class SelectOptionsPage (Page):
 for button in buttons:
 self.vbox.pack_start (button, expand=False)
 
-if default:
-default.set_flags (gtk.CAN_DEFAULT | gtk.HAS_DEFAULT)
-default.grab_default ()
-default.grab_focus ()
-
 self.vbox.show_all ()
 
 class ProgressPage (Page):
-- 
1.5.6.5

From bb72deb017bdae01ae98846bb7d8961affb466fd Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Sat, 6 Sep 2008 23:43:53 +0200
Subject: [PATCH] More tests

---
 reportbug/ui/gtk2_ui.py |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 6bf2682..b5d6307 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -1262,9 +1262,11 @@ def initialize ():
 
 def test ():
 # Write some tests here
+print select_options ('test', 'A', {'a': 'A test'})
+print get_multiline ('ENTER', empty_ok=True)
 print get_string (test)
 page = HandleBTSQueryPage (assistant)
-application.run_once_in_main_thread (page.execute_operation, [('asd', (Bug ('#123 [asd] [we] we we Reported by: asd;' ), Bug ('#123 [asd] [we] we we Reported by: asd;')))], 'asd')
+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 ()
 
 if __name__ == '__main__':
-- 
1.5.6.5

From 62603440d1cc1fcaa65908e1f56b94261c4233ff Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Sun, 7 Sep 2008 00:00:47 +0200
Subject: [PATCH] Use default size instead of requested size. Shrink bugs dialog to width 600

---
 

Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-05 Thread Sandro Tosi
Hi Luca,

On Thu, Sep 4, 2008 at 19:38, Sandro Tosi [EMAIL PROTECTED] wrote:
 all applied as of r645.

some notes:

* I don't like too much the replace of sys.excephook in gtk2_ui.py:
due to all UIs being imported in ui/__init__.py, all the exception
will be handled by the gtk error handler (even if another ui will be
choosen). Can you use a different method to handle exceptions in GTK+
UI? Alternatively overwrite it only if we're really using GTK+ UI (I
can workaround it in __init__, restoring the default error handler
if we're not using gtk+, but I don't like it either :) ).
* window size: I'd choose a window size bigger than the initial one,
and at least so that it won't change during window navigation.
* set the focus on the input fields: for example when promping for
subject and report text the prompt should be already on the input
field so one can just start writing.

Thanks,
Sandro

-- 
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

___
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint


Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-05 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, 4 Sep 2008 19:38:34 +0200
Sandro Tosi [EMAIL PROTECTED] wrote:

 all applied as of r645.
 
 Sandro
 

3 patches attached.

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjBu/IACgkQw9Qj+8Kak3GXgQCfYXeQ38NZMQrut+KViFFzSBuD
begAnRvdVppGg3dSUVk2hQDuExSOaGoY
=Lx3R
-END PGP SIGNATURE-
___
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint


Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-05 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, 4 Sep 2008 19:38:34 +0200
Sandro Tosi [EMAIL PROTECTED] wrote:

 all applied as of r645.
 
 Sandro
 

3 patches attached (forgot to attach in the previous mail).

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjBvD8ACgkQw9Qj+8Kak3Ge6wCeLeokqwkYDvrzx6Qy49l1wzhK
l3UAmwbRr2oX2nOJn8t4NmbxD5VVCEt3
=eEsH
-END PGP SIGNATURE-
From f03f32542d1cecf024de46940ea7fd5b3d1d34c0 Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Sat, 6 Sep 2008 01:04:59 +0200
Subject: [PATCH] Cleanup empty values code handling

---
 reportbug/ui/gtk2_ui.py |   38 --
 1 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index b4100e2..0ccbce0 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -454,6 +454,7 @@ class Page (ReportbugConnector):
 def execute_operation (self, *args, **kwargs):
 self.switch_in ()
 self.connect_signals ()
+self.empty_ok = kwargs.pop ('empty_ok', False)
 self.execute (*args, **kwargs)
 self.assistant.show ()
 
@@ -485,7 +486,10 @@ class Page (ReportbugConnector):
 pass
 
 def is_valid (self, value):
-return bool (value)
+if self.empty_ok:
+return True
+else:
+return bool (value)
 
 def validate (self, *args, **kwargs):
 value = self.get_value ()
@@ -521,6 +525,10 @@ class GetStringPage (Page):
 return self.entry.get_text ()
 
 def execute (self, prompt, options=None, force_prompt=False, default=''):
+if 'blank OK' in prompt:
+self.empty_ok = True
+else:
+self.empty_ok = False
 self.label.set_text (prompt)
 self.entry.set_text (default)
 
@@ -539,12 +547,6 @@ class GetMultilinePage (Page):
 def connect_signals (self):
 self.buffer.connect ('changed', self.validate)
 
-def is_valid (self, value):
-if self.empty_ok:
-return True
-else:
-return bool (value)
-
 def get_value (self):
 text = self.buffer.get_text (self.buffer.get_start_iter (), self.buffer.get_end_iter ())
 lines = text.split ('\n')
@@ -553,9 +555,8 @@ class GetMultilinePage (Page):
 del lines[-1]
 return text.split ('\n')
 
-def execute (self, prompt, empty_ok=True):
+def execute (self, prompt):
 # The result must be iterable for reportbug even if it's empty and not modified
-self.empty_ok = empty_ok
 self.label.set_text (prompt)
 self.buffer.set_text ()
 self.buffer.emit ('changed')
@@ -618,12 +619,6 @@ class GetListPage (TreePage):
 values.append (row[self.value_column])
 return values
 
-def is_valid (self, value):
-if self.empty_ok:
-return True
-else:
-return bool (value)
-
 def on_add (self, button):
 dialog = InputStringDialog (Add a new item to the list)
 dialog.show_all ()
@@ -643,8 +638,7 @@ class GetListPage (TreePage):
 for iter in iters:
 self.model.remove (iter)
 
-def execute (self, prompt, empty_ok=True):
-self.empty_ok = empty_ok
+def execute (self, prompt):
 self.label.set_text (prompt)
 
 self.model = gtk.ListStore (str)
@@ -670,16 +664,8 @@ class MenuPage (TreePage):
 vbox.show_all ()
 return vbox
 
-def is_valid (self, value):
-if self.empty_ok:
-return True
-else:
-return bool (value)
-
 def execute (self, par, options, prompt, default=None, any_ok=False,
- order=None, extras=None, multiple=False, empty_ok=False):
-self.empty_ok = empty_ok
-
+ order=None, extras=None, multiple=False):
 self.label.set_text (par)
 
 self.model = gtk.ListStore (str, str)
-- 
1.5.6.5

From 8fd7381c62d0a6f0fb567b7613851d7d926b2d0f Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Sat, 6 Sep 2008 01:05:32 +0200
Subject: [PATCH] Added a better intro description

---
 reportbug/ui/gtk2_ui.py |   19 +--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 0ccbce0..efb363e 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -504,8 +504,20 @@ class IntroPage (Page):
 default_complete = True
 
 def create_widget (self):
-vbox = gtk.VBox ()
-vbox.pack_start (gtk.Label (ReportBUG))
+vbox = gtk.VBox (spacing=24)
+
+label = gtk.Label (
+bReportbug/b is a tool designed to make the reporting of bugs in Debian and derived distributions relatively 

Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-04 Thread Sandro Tosi
On Wed, Sep 3, 2008 at 22:34, Luca Bruno [EMAIL PROTECTED] wrote:
 On Wed, 3 Sep 2008 14:09:52 +0200
 Luca Bruno [EMAIL PROTECTED] wrote:
 Fixed in patch 0001.

 0002 patch:
 Uses a list instead of an editor for CC addresses, which is less error prone.
 We can yet specify the mode to get_multiline and use the list for  ADVANCED 
 users and the editor for = ADVANCED users,
 or if you don't like it just drop the patch.

 0003 patch:
 small but important bug fixes


 0001: should be applied because it fixes some bugs
 0002: when listing bugs, you can now filter the results

all applied as of r645.

Sandro

-- 
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

___
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint


Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-03 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tue, 2 Sep 2008 07:44:00 +0200
Sandro Tosi [EMAIL PROTECTED] wrote:

 Merged (at r643): thanks for this contribution!
 
 There is a little problem you might want to fix (as I didn't managed
 yet to debug):
 
 $ reportbug --ui gtk2 -O --debug reportbug
 Traceback (most recent call last):
   File /usr/bin/reportbug, line 1832, in module
 main()
   File /usr/bin/reportbug, line 855, in main
 return iface.user_interface()
   File /usr/bin/reportbug, line 1570, in user_interface
 listcc += ui.get_multiline('Enter any additional addresses this
 report should be sent to; press ENTER after each address.')
 AttributeError: 'module' object has no attribute 'get_multiline'
 
 right after the subject insertion and click on Forward.
 

Fixed in patch 0001.

0002 patch:
Uses a list instead of an editor for CC addresses, which is less error prone.
We can yet specify the mode to get_multiline and use the list for  ADVANCED 
users and the editor for = ADVANCED users,
or if you don't like it just drop the patch.

0003 patch:
small but important bug fixes

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAki+fpAACgkQw9Qj+8Kak3GYYQCfaj1bl+VzSlTrY4vA8GfCZ0Y7
NJAAn3gUdH/rWtilefePj+28gJy61FSV
=/2QJ
-END PGP SIGNATURE-
From 4b29f5e57853235fefb8127c0cbecb175ca031b2 Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Wed, 3 Sep 2008 13:02:30 +0200
Subject: [PATCH] fixed GetMultilinePage implementation and added to the forwarded list

---
 debian/changelog|1 +
 reportbug/ui/gtk2_ui.py |   69 +++---
 2 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 19bde53..d37ea1f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,7 @@ reportbug (3.99.0) UNRELEASED; urgency=low
 [ Luca Bruno ]
 - reportbug/ui/gtk2_ui.py
   + GTK+ interface
+  + fixed GetMultilinePage implementation and added to the forwarded list
 
 [ Sandro Tosi ]
 - debian/control
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 0f307f1..3d412b2 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -469,7 +469,7 @@ class Page (ReportbugConnector):
 def validate (self, *args, **kwargs):
 value = self.get_value ()
 if self.is_valid (value):
-self.assistant.application.set_next_value (value)
+self.application.set_next_value (value)
 self.set_page_complete (True)
 else:
 self.set_page_complete (False)
@@ -503,6 +503,42 @@ class GetStringPage (Page):
 self.label.set_text (prompt)
 self.entry.grab_focus ()
 
+class GetMultilinePage (Page):
+def create_widget (self):
+vbox = gtk.VBox (spacing=12)
+self.label = gtk.Label ()
+vbox.pack_start (self.label, expand=False)
+
+view = gtk.TextView ()
+self.buffer = view.get_buffer ()
+scrolled = create_scrollable (view)
+vbox.pack_start (scrolled)
+return vbox
+
+def connect_signals (self):
+self.buffer.connect ('changed', self.validate)
+
+def is_valid (self, value):
+if self.empty_ok:
+return True
+else:
+return bool (value)
+
+def get_value (self):
+text = self.buffer.get_text (self.buffer.get_start_iter (), self.buffer.get_end_iter ())
+lines = text.split ('\n')
+# Remove the trailing empty line at the end
+if len (lines)  0 and not lines[-1].strip ():
+del lines[-1]
+return text.split ('\n')
+
+def execute (self, prompt, empty_ok=True):
+# The result must be iterable for reportbug even if it's empty and not modified
+self.empty_ok = empty_ok
+self.label.set_text (prompt)
+self.buffer.set_text ()
+self.buffer.emit ('changed')
+
 class TreePage (Page):
 value_column = None
 
@@ -738,32 +774,6 @@ class FinalMessagePage (LongMessagePage):
 LongMessagePage.execute (self, *args, **kwargs)
 self.set_page_title (Thanks for your report)
 
-class GetMultilinePage (Page):
-default_complete = True
-
-def create_widget (self):
-vbox = gtk.VBox (spacing=12)
-self.label = gtk.Label ()
-vbox.pack_start (self.label, expand=False)
-
-view = gtk.TextView ()
-self.buffer = view.get_buffer ()
-scrolled = create_scrollable (view)
-vbox.pack_start (scrolled)
-return vbox
-
-def is_valid (self, value):
-return True
-
-def connect_signals (self):
-self.buffer.connect ('changed', self.validate)
-
-def get_value (self):
-return self.buffer.get_text (self.buffer.get_start_iter 

Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-03 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, 3 Sep 2008 14:09:52 +0200
Luca Bruno [EMAIL PROTECTED] wrote:

 Fixed in patch 0001.
 
 0002 patch:
 Uses a list instead of an editor for CC addresses, which is less error prone.
 We can yet specify the mode to get_multiline and use the list for  ADVANCED 
 users and the editor for = ADVANCED users,
 or if you don't like it just drop the patch.
 
 0003 patch:
 small but important bug fixes
 

0001: should be applied because it fixes some bugs
0002: when listing bugs, you can now filter the results

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAki+9MUACgkQw9Qj+8Kak3FFiwCeK4TaJkRe+GjKa+pELSkKSoaw
DdYAnjyGiH5x7vI7AOu5k9O6q1JcAOQF
=bbA8
-END PGP SIGNATURE-
From 498e772cb8268b46f509f29bf19effab42115ce6 Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Wed, 3 Sep 2008 20:58:51 +0200
Subject: [PATCH] gtk2: fixed SyncReturn and increase Page.next_page_num when really switching the assistant page

---
 debian/changelog|1 +
 reportbug/ui/gtk2_ui.py |   14 +-
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 475ca37..799d4d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -40,6 +40,7 @@ reportbug (3.99.0) UNRELEASED; urgency=low
   + added GetListPage to improve the get_multiline wrapper
   + fixed return value for default entries in select_options wrapper
   + fixed long_message layout
+  + fixed SyncReturn and increase Page.next_page_num when really switching the assistant page
 
 [ Sandro Tosi ]
 - debian/control
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 6eaee17..1e3113a 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -421,7 +421,7 @@ application = ReportbugApplication ()
 
 class SyncReturn (RuntimeError):
 def __init__ (self, result):
-RuntimeError.__init__ (result)
+RuntimeError.__init__ (self, result)
 self.result = result
 
 class ReportbugConnector (object):
@@ -450,7 +450,6 @@ class Page (ReportbugConnector):
 self.widget.set_border_width (6)
 self.widget.show_all ()
 self.page_num = Page.next_page_num
-Page.next_page_num += 1
 
 def execute_operation (self, *args, **kwargs):
 self.switch_in ()
@@ -473,6 +472,7 @@ class Page (ReportbugConnector):
 
 # The user will see this as next page
 def switch_in (self):
+Page.next_page_num += 1
 self.assistant.insert_page (self.widget, self.page_num)
 self.set_page_complete (self.default_complete)
 self.set_page_type (self.page_type)
@@ -735,7 +735,6 @@ class HandleBTSQueryPage (TreePage):
 
 self.application.run_once_in_main_thread (self.assistant.set_progress_label, progress_label)
 
-result = None
 try:
 (count, sectitle, hierarchy) = debianbts.get_reports (
 package, bts, mirrors=mirrors, version=version,
@@ -767,10 +766,7 @@ class HandleBTSQueryPage (TreePage):
 error_dialog ('No record of this package found.')
 raise NoPackage
 
-if result and result  0:
-raise NoReport
-
-raise SyncReturn (result)
+raise SyncReturn (None)
 
 def create_widget (self):
 vbox = gtk.VBox (spacing=12)
@@ -1057,11 +1053,11 @@ class ReportbugAssistant (gtk.Assistant):
 # We insert pages between the intro and the progress, so that we give the user the feedback
 # that the applications is still running when he presses the Forward button
 self.showing_page = IntroPage (self)
-self.progress_page = ProgressPage (self)
-Page.next_page_num = 1
 self.showing_page.switch_in ()
+self.progress_page = ProgressPage (self)
 self.progress_page.switch_in ()
 self.set_current_page (0)
+Page.next_page_num = 1
 
 assistant = ReportbugAssistant (application)
 
-- 
1.5.6.5

From 5f7a7c6252862082969354b83f30191db8176cef Mon Sep 17 00:00:00 2001
From: Luca Bruno [EMAIL PROTECTED]
Date: Wed, 3 Sep 2008 22:31:28 +0200
Subject: [PATCH] gtk2: filter the list of bugs

---
 debian/changelog|1 +
 reportbug/ui/gtk2_ui.py |   76 +++
 2 files changed, 64 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 799d4d1..2cda463 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,7 @@ reportbug (3.99.0) UNRELEASED; urgency=low
   + fixed return value for default entries in select_options wrapper
   + fixed long_message layout
   + fixed SyncReturn and increase Page.next_page_num when really switching the assistant page
+  + filter the list of bugs
 
 [ Sandro 

Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-09-01 Thread Sandro Tosi
Hello Luca,

On Sun, Aug 31, 2008 at 20:48, Luca Bruno [EMAIL PROTECTED] wrote:
 Thanks for you work. As discussed in IRC, the latest changes:
 1. changed description in the header
 2. empty textview on *** Please type
 3. BTS support for browsing the report bodies and replying
 4. A fix in bugreport.py

Merged (at r643): thanks for this contribution!

There is a little problem you might want to fix (as I didn't managed
yet to debug):

$ reportbug --ui gtk2 -O --debug reportbug
Traceback (most recent call last):
  File /usr/bin/reportbug, line 1832, in module
main()
  File /usr/bin/reportbug, line 855, in main
return iface.user_interface()
  File /usr/bin/reportbug, line 1570, in user_interface
listcc += ui.get_multiline('Enter any additional addresses this
report should be sent to; press ENTER after each address.')
AttributeError: 'module' object has no attribute 'get_multiline'

right after the subject insertion and click on Forward.

Kindly,
Sandro

-- 
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

___
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint


Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-08-30 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sat, 30 Aug 2008 01:49:26 +0200
Luca Bruno [EMAIL PROTECTED] wrote:

 Continued the work, as usual I've attached the .py file.
 It's almost complete for basic bug reporting.
 Please let me know what you think about.
 

The frontend is now almost complete. It's missing the wrapper for querying a 
single report and submit more informations.
I've added the copyright.
I'm now trying to get it working in trunk.

Best regards,

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAki5080ACgkQw9Qj+8Kak3FXIgCdEWon06/x62tweYtqxGuXLZUH
Yg4AoJBioO1ds7djAWP4cagUAnejkUmz
=LHID
-END PGP SIGNATURE-
# reportbuglib/reportbug_ui_gnome2.py
# GTK+ user interface for reportbug
#   Written by Luca Bruno [EMAIL PROTECTED]
#   Based on gnome-reportbug work done by Philipp Kern [EMAIL PROTECTED]
#   Copyright (C) 2006 Philipp Kern
#   Copyright (C) 2008 Luca Bruno
#
# This program is freely distributable per the following license:
#
##  Permission to use, copy, modify, and distribute this software and its
##  documentation for any purpose and without fee is hereby granted,
##  provided that the above copyright notice appears in all copies and that
##  both that copyright notice and this permission notice appear in
##  supporting documentation.
##
##  I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
##  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
##  BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
##  DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
##  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
##  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
##  SOFTWARE.
#
# Version ##VERSION##; see changelog for revision history

import gtk
import sys
from gtk import gdk
import gobject
import re
import os

gdk.threads_init ()

from Queue import Queue
import threading

if __name__ == '__main__':
sys.path.append ('..')

from reportbug_ui_text import ewrite
from reportbug_exceptions import NoPackage, NoBugs, NoNetwork, NoReport

ISATTY = True

# Utilities

def highlight (s):
return 'b%s/b' % s

re_markup_free = re.compile (.*?)

def markup_free (s):
return re_markup_free.sub (, s)

def ask_free (s):
s = s.strip ()
if s[-1] in ('?', ':'):
return s[:-1]
return s

def create_scrollable (widget):
scrolled = gtk.ScrolledWindow ()
scrolled.set_shadow_type (gtk.SHADOW_ETCHED_IN)
scrolled.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scrolled.add (widget)
return scrolled

class ErrorDialog (gtk.MessageDialog):
def __init__ (self, application):
gtk.MessageDialog.__init__ (self, assistant, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE)
self.application = application
self.connect ('response', self.on_response)

def on_response (self, dialog, res):
self.destroy ()

def execute_operation (self, msg, yeshelp, nohelp, default=True, nowrap=False, ui=None):
self.set_markup (msg+?)
self.show_all ()

def error_dialog (message):
dialog = gtk.MessageDialog (self, assistant, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, essage)
dialog.connect ('response', lambda *args: dialog.destroy)
dialog.set_title ('Reportbug')
dialog.show_all ()

# BTS

class Bug (object):
def __init__ (self, raw):
# Skip the '#'
raw = raw[1:]
bits = re.split(r'[: ]', raw, 2)
self.id, self.tag, self.data = bits
# Remove [ and ]
self.tag = self.tag[1:-1]
self.data = self.data.strip ()
self.package = self.data.split(']', 1)[0][1:]

self.reporter = self.get_data (Reported by:)
self.date = self.get_data (Date:)
self.severity = self.get_data(Severity:).capitalize ()
self.version = self.get_data (Found in version)
self.filed_date = self.get_data (Filed)
self.modified_date = self.get_data (Modified)

# Get rid of [package] which has been stored in self.package
self.info = self.data.split(']', 1)[1][:self.data.index (Reported by:)].strip ()
if not self.info:
self.info = '(no subject)'   

def get_data (self, token):
info = ''
try:
index = self.data.lower().index (token.lower ())
except:
return '(unknown)'

i = index + len(token)
while True:
c = self.data[i]
if c == ';':
break
info += c
i += 1
return info.strip ()

def __iter__ (self):

Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-08-30 Thread Sandro Tosi
 The frontend is now almost complete. It's missing the wrapper for querying a 
 single report and submit more informations.
 I've added the copyright.
 I'm now trying to get it working in trunk.

Luca, first of all, thanks a lot for your work.

As done in the last days, we keep syncing each other on IRC, and I
hope we will soon be able to merge your code.

Cheers,
-- 
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

___
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint


Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-08-29 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello,
in reply to the discussion: 
http://lists.alioth.debian.org/pipermail/reportbug-maint/2008-August/000338.html
I've been working this day on a GTK+ UI for reportbug.
A first work is attached. I've completely rewritten the code of the previous 
gnome-reportbug to use GtkAssistant and using a more OO approach.
To let gnome2 be imported correctly by reportbug you should apply this patch: 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=497024
Any hints? Can I continue with the work?

Best regards,

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAki4U3EACgkQw9Qj+8Kak3F0BQCfQyYRgOGSCkZZyhKEReifmpPo
4dsAn0T6oWhbps5x10tbobn++okbdCK0
=kukM
-END PGP SIGNATURE-
import gtk
import sys
from gtk import gdk
import gobject

gdk.threads_init ()

from Queue import Queue
from reportbug_ui_text import ewrite
import threading

ISATTY = True
log_message = ewrite
display_failure = ewrite

# Application

class ReportbugApplication (threading.Thread):
def __init__ (self):
threading.Thread.__init__ (self)
self.queue = Queue ()

def run (self):
gtk.main ()

def get_last_value (self):
return self.queue.get ()

def put_next_value (self):
self.queue.put (self.next_value)

def set_next_value (self, value):
self.next_value = value

@staticmethod
def create_idle_callback (func):
def callback (*args, **kwargs):
func ()
return False
return callback

def run_once_in_main_thread (self, func):
gobject.idle_add (self.create_idle_callback (func))

application = ReportbugApplication ()

# Assistant

class Page (object):
next_page_num = 0
page_type = gtk.ASSISTANT_PAGE_CONTENT
default_complete = False

def __init__ (self, assistant):
self.assistant = assistant
self.widget = self.create_widget ()
self.widget.page = self
self.page_num = Page.next_page_num
Page.next_page_num += 1
self.assistant.insert_page (self.widget, self.page_num)
self.set_page_complete (self.default_complete)
self.set_page_type (self.page_type)

def execute_operation (self, *args, **kwargs):
self.execute (*args, **kwargs)
self.switch ()

def set_page_complete (self, complete):
self.assistant.set_page_complete (self.widget, complete)

def set_page_type (self, type):
self.assistant.set_page_type (self.widget, type)

def switch (self):
self.widget.show_all ()
self.assistant.set_next_page (self)

def is_valid (self, value):
return bool (value)

def validate (self, *args, **kwargs):
value = self.get_value ()
if self.is_valid (value):
self.assistant.app.set_next_value (value)
self.set_page_complete (True)
else:
self.set_page_complete (False)

class IntroPage (Page):
page_type = gtk.ASSISTANT_PAGE_INTRO
default_complete = True

def create_widget (self):
return gtk.Label (ReportBUG)

class GetStringPage (Page):
def create_widget (self):
vbox = gtk.VBox (spacing=6)
self.label = gtk.Label ()
self.entry = gtk.Entry ()
self.entry.connect ('focus-out-event', self.validate)
vbox.pack_start (self.label)
vbox.pack_start (self.entry)
return vbox

def get_value (self):
return self.entry.get_text ()

def execute (self, prompt, options=None, title=None, force_prompt=False, default='', ui=None):
self.label.set_text (prompt)
self.assistant.set_title (title)

class MenuPage (Page):
def create_widget (self):
vbox = gtk.VBox ()
self.label = gtk.Label ()
vbox.pack_start (self.label)

self.view = gtk.TreeView ()
scrolled = gtk.ScrolledWindow ()
scrolled.add (self.view)
vbox.pack_start (scrolled)

self.view.append_column (gtk.TreeViewColumn ('Option', gtk.CellRendererText (), text=0))
self.view.append_column (gtk.TreeViewColumn ('Description', gtk.CellRendererText (), text=1))
return vbox

def execute (self, par, options, prompt, default=None, title=None, any_ok=False,
 order=None, extras=None, multiple=False, empty_ok=False, ui=None,
 oklabel='Ok', cancellabel='Cancel', quitlabel=None):
self.label.set_text (par)
self.model = gtk.ListStore (str, str)
self.view.set_model (self.model)
for option in options:
self.model.append (option)
self.assistant.set_title (title)

class ProgressPage (Page):
page_type = gtk.ASSISTANT_PAGE_PROGRESS
default_complete = False

def create_widget (self):
return gtk.Label 

Re: [Reportbug-maint] Reportbug - adding a GTK UI

2008-08-29 Thread Luca Bruno
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, 29 Aug 2008 21:52:17 +0200
Luca Bruno [EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hello,
 in reply to the discussion: 
 http://lists.alioth.debian.org/pipermail/reportbug-maint/2008-August/000338.html
 I've been working this day on a GTK+ UI for reportbug.
 A first work is attached. I've completely rewritten the code of the previous 
 gnome-reportbug to use GtkAssistant and using a more OO approach.
 To let gnome2 be imported correctly by reportbug you should apply this patch: 
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=497024
 Any hints? Can I continue with the work?
 
 Best regards,
 

Continued the work, as usual I've attached the .py file.
It's almost complete for basic bug reporting.
Please let me know what you think about.

- -- 
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAki4iwYACgkQw9Qj+8Kak3H6/ACglHW9upxm4XcCha5yJwaNlqyV
r2AAnj3P/qm64geCq886STjrfrBdo2NN
=vCiy
-END PGP SIGNATURE-
import gtk
import sys
from gtk import gdk
import gobject
import re

gdk.threads_init ()

from Queue import Queue
import threading

from reportbug_ui_text import ewrite
from reportbug_exceptions import NoPackage, NoBugs, NoNetwork, NoReport

ISATTY = True

# Utilities

def highlight (s):
return 'b%s/b' % s

re_markup_free = re.compile (.*?)

def markup_free (s):
return re_markup_free.sub (, s)

def create_scrollable (widget):
scrolled = gtk.ScrolledWindow ()
scrolled.set_shadow_type (gtk.SHADOW_ETCHED_IN)
scrolled.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scrolled.add (widget)
return scrolled

# Application

class ReportbugApplication (threading.Thread):
def __init__ (self):
threading.Thread.__init__ (self)
self.queue = Queue ()

def run (self):
gtk.main ()

def get_last_value (self):
return self.queue.get ()

def put_next_value (self):
self.queue.put (self.next_value)
self.next_value = None

def set_next_value (self, value):
self.next_value = value

@staticmethod
def create_idle_callback (func, *args, **kwargs):
def callback ():
func (*args, **kwargs)
return False
return callback

def run_once_in_main_thread (self, func, *args, **kwargs):
gobject.idle_add (self.create_idle_callback (func, *args, **kwargs))

application = ReportbugApplication ()

# Syncronize pipe with reportbug

class SyncError (RuntimeError):
def __init__ (self, result):
RuntimeError.__init__ ()
self.result = result

# Pipe

class ReportbugConnector (object):
def execute_operation (self, *args, **kwargs):
pass

def sync_pre_operation (cls, *args, **kwargs):
return args, kwargs

# Assistant

class Page (ReportbugConnector):
next_page_num = 0
page_type = gtk.ASSISTANT_PAGE_CONTENT
default_complete = False
side_image = /usr/share/pixmaps/debian-logo.png

def __init__ (self, assistant):
self.assistant = assistant
self.application = assistant.application
self.widget = self.create_widget ()
self.widget.page = self
self.widget.set_border_width (6)
self.widget.show_all ()
self.page_num = Page.next_page_num
Page.next_page_num += 1

def execute_operation (self, *args, **kwargs):
self.switch ()
self.connect_signals ()
self.execute (*args, **kwargs)

def connect_signals (self):
pass

def set_page_complete (self, complete):
self.assistant.set_page_complete (self.widget, complete)

def set_page_type (self, type):
self.assistant.set_page_type (self.widget, type)

def set_page_title (self, title):
if title:
self.assistant.set_page_title (self.widget, title)

def switch (self):
self.assistant.insert_page (self.widget, self.page_num)
self.set_page_complete (self.default_complete)
self.set_page_type (self.page_type)
self.assistant.set_page_side_image (self.widget, gdk.pixbuf_new_from_file (self.side_image))
self.assistant.set_next_page (self)

def is_valid (self, value):
return bool (value)

def validate (self, *args, **kwargs):
value = self.get_value ()
if self.is_valid (value):
self.assistant.application.set_next_value (value)
self.set_page_complete (True)
else:
self.set_page_complete (False)

class IntroPage (Page):
page_type = gtk.ASSISTANT_PAGE_INTRO
default_complete = True

def create_widget (self):
vbox = gtk.VBox ()
vbox.pack_start (gtk.Label (ReportBUG))
return vbox

class GetStringPage (Page):
def