From 292e4548529aebfbcd6c8a78b97131d6cda4962d Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Mon, 19 May 2008 18:23:45 +0200 Subject: [PATCH] Merge --- share/tryton/tryton.glade | 2380 +++++++++++++++++-------------------- tryton/common/common.py | 156 ++- tryton/config.py | 2 + tryton/rpc.py | 2 +- 4 files changed, 1221 insertions(+), 1319 deletions(-) diff --git a/share/tryton/tryton.glade b/share/tryton/tryton.glade index 56d2ec0857..1c5f7f1660 100644 --- a/share/tryton/tryton.glade +++ b/share/tryton/tryton.glade @@ -36,6 +36,128 @@ 3 3 3 + + + True + 1 + 3 + 3 + User: + + + 2 + 3 + GTK_FILL + + + + + + True + 1 + 3 + 3 + Password: + GTK_JUSTIFY_RIGHT + + + 3 + 4 + GTK_FILL + + + + + + True + True + Change + True + 0 + + + + 2 + 3 + GTK_FILL + + + + + + True + False + False + True + 16 + localhost + + + 1 + 2 + + + + + + True + 1 + 3 + 3 + Database: + + + 1 + 2 + GTK_FILL + + + + + + 117 + True + 1 + 3 + 3 + Server: + + + GTK_FILL + + + + + + True + True + True + admin + + + 1 + 3 + 2 + 3 + + + + + + True + True + True + False + True + + + 1 + 3 + 3 + 4 + + + True @@ -67,128 +189,6 @@ GTK_FILL - - - True - True - True - False - True - - - 1 - 3 - 3 - 4 - - - - - - True - True - True - admin - - - 1 - 3 - 2 - 3 - - - - - - 117 - True - 1 - 3 - 3 - Server: - - - GTK_FILL - - - - - - True - 1 - 3 - 3 - Database: - - - 1 - 2 - GTK_FILL - - - - - - True - False - False - True - 16 - localhost - - - 1 - 2 - - - - - - True - True - Change - True - 0 - - - - 2 - 3 - GTK_FILL - - - - - - True - 1 - 3 - 3 - Password: - GTK_JUSTIFY_RIGHT - - - 3 - 4 - GTK_FILL - - - - - - True - 1 - 3 - 3 - User: - - - 2 - 3 - GTK_FILL - - - 1 @@ -1845,6 +1845,130 @@ 2 5 4 + + + True + 1 + Default _value: + True + ent_value + + + 2 + 3 + GTK_FILL + + + + + + True + False + True + False + + + 1 + 2 + 2 + 3 + + + + + + True + False + True + False + + + 1 + 2 + 1 + 2 + + + + + + True + False + True + False + + + 1 + 2 + + + + + + True + 1 + _Domain: + True + GTK_JUSTIFY_RIGHT + ent_domain + + + 1 + 2 + GTK_FILL + + + + + + True + 1 + Field _Name: + True + GTK_JUSTIFY_RIGHT + ent_field + + + GTK_FILL + + + + + + True + 0 + + + True + 12 + + + True + + + + + + + + + + True + <b>Value applicable if:</b> + True + + + label_item + + + + + 2 + 4 + 5 + GTK_FILL + + True @@ -1912,130 +2036,6 @@ GTK_FILL - - - True - 0 - - - True - 12 - - - True - - - - - - - - - - True - <b>Value applicable if:</b> - True - - - label_item - - - - - 2 - 4 - 5 - GTK_FILL - - - - - True - 1 - Field _Name: - True - GTK_JUSTIFY_RIGHT - ent_field - - - GTK_FILL - - - - - - True - 1 - _Domain: - True - GTK_JUSTIFY_RIGHT - ent_domain - - - 1 - 2 - GTK_FILL - - - - - - True - False - True - False - - - 1 - 2 - - - - - - True - False - True - False - - - 1 - 2 - 1 - 2 - - - - - - True - False - True - False - - - 1 - 2 - 2 - 3 - - - - - - True - 1 - Default _value: - True - ent_value - - - 2 - 3 - GTK_FILL - - - 2 @@ -2905,238 +2905,6 @@ Save as CSV - - Tryton - Error - GTK_WIN_POS_CENTER_ON_PARENT - 700 - 580 - GDK_WINDOW_TYPE_HINT_DIALOG - - - True - - - True - - - True - 0.49000000953674316 - Application Error! - - - False - False - - - - - True - - - False - 5 - 1 - - - - - True - True - - - True - - - True - 0.18000000715255737 - gtk-dialog-warning - 6 - - - False - 10 - - - - - True - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - GTK_SHADOW_NONE - - - True - 10 - - - True - 0 - 254 - 14 - <b>Error 404</b> - True - - - False - False - - - - - True - 0 - 0.40999999642372131 - 10 - <b>Error code:</b> - True - True - scrolledwindow45 - - - False - False - 1 - - - - - True - True - 0 - 10 - This Page does not exist ! -Please retry - True - - - False - False - 2 - - - - - - - - - - - True - 1 - 1 - 10 - 10 - <i>Click on the Support Request tab if you need more help !</i> - True - - - False - 1 - - - - - 1 - - - - - - - True - 5 - De_scription - True - - - tab - False - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - GTK_SHADOW_NONE - - - True - True - False - 4 - 4 - False - Error details - - - - - - - 1 - - - - - True - 5 - _Details - True - True - - - tab - 1 - False - - - - - 2 - - - - - 2 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - gtk-close - True - -7 - - - - - - False - GTK_PACK_END - - - - - Tip of the Day GTK_WIN_POS_CENTER_ON_PARENT @@ -3624,185 +3392,193 @@ Each version is given a distinguishing version number. If the Program specifies 15 2 - + True - 2 - <b>Shortcuts for Tryton</b> - True - GTK_JUSTIFY_CENTER + 0 + <Ctrl> + O - 2 + 1 + 2 + GTK_FILL - 5 - + True 0 - Close window without saving + Connect 1 2 - 14 - 15 + 1 + 2 GTK_FILL - + True 0 - <Ctrl> + <Esc> + <Ctrl> + F - 14 - 15 + 5 + 6 GTK_FILL - + True 0 - 10 - <i>When editing a resource in a popup window</i> - True - GTK_JUSTIFY_CENTER - - - 2 - 12 - 13 - GTK_FILL - - - - - - True - 0 - Save and Close window + Find / Search 1 2 - 13 - 14 + 5 + 6 GTK_FILL - + True 0 - <Ctrl> + <Enter> + <Ctrl> + D - 13 - 14 + 4 + 5 GTK_FILL - + True 0 - Switch view mode + Delete 1 2 - 8 - 9 + 4 + 5 GTK_FILL - + True 0 - <Ctrl> + L + <Ctrl> + N - 8 - 9 + 2 + 3 GTK_FILL - + True 0 - Next record + New 1 2 - 7 - 8 + 2 + 3 GTK_FILL - + True 0 - Previous record + <Ctrl> + <PgUp> + + + 9 + 10 + GTK_FILL + + + + + + True + 0 + Previous tab 1 2 - 6 - 7 + 9 + 10 GTK_FILL - + True 0 - <PgDn> + <Ctrl> + <PgDn> - 7 - 8 + 10 + 11 GTK_FILL - + True 0 - <PgUp> - - - 6 - 7 - GTK_FILL - - - - - - True - 0 - Close Tab + Next Tab 1 2 + 10 + 11 + GTK_FILL + + + + + + True + 0 + <Ctrl> + S + + + 3 + 4 + GTK_FILL + + + + + + True + 0 + <Ctrl> + W + + 11 12 GTK_FILL @@ -3825,12 +3601,14 @@ Each version is given a distinguishing version number. If the Program specifies - + True 0 - <Ctrl> + W + Close Tab + 1 + 2 11 12 GTK_FILL @@ -3838,184 +3616,174 @@ Each version is given a distinguishing version number. If the Program specifies - + True 0 - <Ctrl> + S + <PgUp> - 3 - 4 + 6 + 7 GTK_FILL - + True 0 - Next Tab + <PgDn> + + + 7 + 8 + GTK_FILL + + + + + + True + 0 + Previous record 1 2 - 10 - 11 + 6 + 7 GTK_FILL - + True 0 - <Ctrl> + <PgDn> - - - 10 - 11 - GTK_FILL - - - - - - True - 0 - Previous tab + Next record 1 2 - 9 - 10 + 7 + 8 GTK_FILL - + True 0 - <Ctrl> + <PgUp> + <Ctrl> + L - 9 - 10 + 8 + 9 GTK_FILL - + True 0 - New + Switch view mode 1 2 - 2 - 3 + 8 + 9 GTK_FILL - + True 0 - <Ctrl> + N + <Ctrl> + <Enter> - 2 - 3 + 13 + 14 GTK_FILL - + True 0 - Delete + Save and Close window 1 2 - 4 - 5 + 13 + 14 GTK_FILL - + True 0 - <Ctrl> + D + 10 + <i>When editing a resource in a popup window</i> + True + GTK_JUSTIFY_CENTER - 4 - 5 + 2 + 12 + 13 GTK_FILL - + True 0 - Find / Search + <Ctrl> + <Esc> + + + 14 + 15 + GTK_FILL + + + + + + True + 0 + Close window without saving 1 2 - 5 - 6 + 14 + 15 GTK_FILL - + True - 0 - <Ctrl> + F + 2 + <b>Shortcuts for Tryton</b> + True + GTK_JUSTIFY_CENTER - 5 - 6 - GTK_FILL - - - - - - True - 0 - Connect - - - 1 2 - 1 - 2 - GTK_FILL - - - - - - True - 0 - <Ctrl> + O - - - 1 - 2 - GTK_FILL + 5 @@ -4037,203 +3805,44 @@ Each version is given a distinguishing version number. If the Program specifies 10 2 - + True 0 - F2 - GTK_JUSTIFY_CENTER + <Ctrl> + X - 9 - 10 + 1 + 2 GTK_FILL - - True - <b>Shortcuts in relation fields</b> - True - - - 2 - 7 - 8 - GTK_FILL - - 5 - - - - - True - <b>Shortcuts in text entries</b> - True - - - 2 - - 5 - - - - + True 0 - Open current field + <Ctrl> + C - 1 - 2 - 9 - 10 - GTK_FILL - - - - - - True - 0 - Add a new line/field - - - 1 - 2 - 8 - 9 - GTK_FILL - - - - - - True - 0 - F1 - - - 8 - 9 - GTK_FILL - - - - - - True - 0 - Auto-Complete text field - - - 1 - 2 - 6 - 7 - GTK_FILL - - - - - - True - 0 - <Enter> - - - 6 - 7 - GTK_FILL - - - - - - True - 0 - Previous editable widget - - - 1 - 2 - 5 - 6 - GTK_FILL - - - - - - True - 0 - <Shist> + <Tab> - - - 5 - 6 - GTK_FILL - - - - - - True - 0 - Next editable widget - - - 1 - 2 - 4 - 5 - GTK_FILL - - - - - - True - 0 - <Tab> - - - 4 - 5 - GTK_FILL - - - - - - True - 0 - Paste selected text - - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - - True - 0 - Copy selected text - - - 1 - 2 2 3 GTK_FILL + + + True + 0 + <Ctrl> + V + + + 3 + 4 + GTK_FILL + + + True @@ -4250,25 +3859,14 @@ Each version is given a distinguishing version number. If the Program specifies - + True 0 - <Ctrl> + V - - - 3 - 4 - GTK_FILL - - - - - - True - 0 - <Ctrl> + C + Copy selected text + 1 + 2 2 3 GTK_FILL @@ -4276,14 +3874,184 @@ Each version is given a distinguishing version number. If the Program specifies - + True 0 - <Ctrl> + X + Paste selected text - 1 - 2 + 1 + 2 + 3 + 4 + GTK_FILL + + + + + + True + 0 + <Tab> + + + 4 + 5 + GTK_FILL + + + + + + True + 0 + Next editable widget + + + 1 + 2 + 4 + 5 + GTK_FILL + + + + + + True + 0 + <Shist> + <Tab> + + + 5 + 6 + GTK_FILL + + + + + + True + 0 + Previous editable widget + + + 1 + 2 + 5 + 6 + GTK_FILL + + + + + + True + 0 + <Enter> + + + 6 + 7 + GTK_FILL + + + + + + True + 0 + Auto-Complete text field + + + 1 + 2 + 6 + 7 + GTK_FILL + + + + + + True + 0 + F1 + + + 8 + 9 + GTK_FILL + + + + + + True + 0 + Add a new line/field + + + 1 + 2 + 8 + 9 + GTK_FILL + + + + + + True + 0 + Open current field + + + 1 + 2 + 9 + 10 + GTK_FILL + + + + + + True + <b>Shortcuts in text entries</b> + True + + + 2 + + 5 + + + + + True + <b>Shortcuts in relation fields</b> + True + + + 2 + 7 + 8 + GTK_FILL + + 5 + + + + + True + 0 + F2 + GTK_JUSTIFY_CENTER + + + 9 + 10 GTK_FILL @@ -4701,78 +4469,25 @@ Each version is given a distinguishing version number. If the Program specifies 8 9 - - True - UTF-8 -Latin1 - - - - - - - 1 - 2 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - 0 0 100 1 10 10 - 1 - - - 3 - 4 - 1 - 2 - GTK_FILL - - - - - + True 1 - Lines to Skip: + Field Separater: - 2 - 3 - 1 - 2 GTK_FILL - - True - True - 1 - " - - - 3 - 4 - GTK_FILL - - - - - + True 1 - Text Delimiter: + Encoding: - 2 - 3 + 1 + 2 GTK_FILL @@ -4793,12 +4508,41 @@ Latin1 - + True 1 - Encoding: + Text Delimiter: + 2 + 3 + GTK_FILL + + + + + + True + True + 1 + " + + + 3 + 4 + GTK_FILL + + + + + + True + 1 + Lines to Skip: + + + 2 + 3 1 2 GTK_FILL @@ -4806,16 +4550,40 @@ Latin1 - + True - 1 - Field Separater: + True + 0 0 100 1 10 10 + 1 + 3 + 4 + 1 + 2 GTK_FILL + + + True + UTF-8 +Latin1 + + + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + @@ -4934,18 +4702,34 @@ Latin1 2 6 - + True 1 - 0 3 - Server: + 3 + Port: + 1 + 2 GTK_FILL + + + True + True + True + 16 + localhost + + + 1 + 2 + + + True @@ -4964,30 +4748,14 @@ Latin1 - - True - True - True - 16 - localhost - - - 1 - 2 - - - - - + True 1 + 0 3 - 3 - Port: + Server: - 1 - 2 GTK_FILL @@ -5077,93 +4845,17 @@ Latin1 3 3 - + True - 1 - 3 - 3 - Password: - GTK_JUSTIFY_RIGHT - - - 1 - 2 - GTK_FILL - - - - - - True - 1 - Database: - - - 2 - 3 - GTK_FILL - - - - - - True - - - True - - - - - True - 0 - True - - - False - False - 1 - - - - - 1 - 3 - 2 - 3 - GTK_FILL - GTK_FILL - - - - - True - True - True - 16 - False + False + False True 16 + http://localhost:8069 1 - 3 - 1 - 2 - - - - - - 117 - True - 1 - 3 - 3 - Server: - - - GTK_FILL + 2 @@ -5218,17 +4910,93 @@ Latin1 - + + 117 True - False - False + 1 + 3 + 3 + Server: + + + GTK_FILL + + + + + + True + True + True + 16 + False True 16 - http://localhost:8069 1 - 2 + 3 + 1 + 2 + + + + + + True + + + True + + + + + True + 0 + True + + + False + False + 1 + + + + + 1 + 3 + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + 1 + Database: + + + 2 + 3 + GTK_FILL + + + + + + True + 1 + 3 + 3 + Password: + GTK_JUSTIFY_RIGHT + + + 1 + 2 + GTK_FILL @@ -5324,91 +5092,31 @@ Latin1 - - True - - - 3 - 2 - 3 - GTK_FILL - - - - - True - 0 - (must not contain any special char) - - - 1 - 3 - 4 - 5 - GTK_FILL - - - - - - True - True - ● - True - 16 - - - 1 - 3 - 3 - 4 - - - - - - True - 0 - New database name: - - - 3 - 4 - GTK_FILL - - - - - + + 117 True 1 3 3 - Password: - GTK_JUSTIFY_RIGHT + Server: - 1 - 2 GTK_FILL - + True - True - True - 16 - False + False + False True 16 + http://localhost:8069 1 - 3 - 1 - 2 + 2 @@ -5463,34 +5171,94 @@ Latin1 - + True - False - False + True + True + 16 + False True 16 - http://localhost:8069 1 - 2 + 3 + 1 + 2 - - 117 + True 1 3 3 - Server: + Password: + GTK_JUSTIFY_RIGHT + 1 + 2 GTK_FILL + + + True + 0 + New database name: + + + 3 + 4 + GTK_FILL + + + + + + True + True + ● + True + 16 + + + 1 + 3 + 3 + 4 + + + + + + True + 0 + (must not contain any special char) + + + 1 + 3 + 4 + 5 + GTK_FILL + + + + + + True + + + 3 + 2 + 3 + GTK_FILL + + False @@ -5592,162 +5360,35 @@ Latin1 - - True - 0 - (must not contain any special character) - True - - - 1 - 3 - 5 - 6 - GTK_FILL - - - - - - True - Choose the default language that will be installed for this database. You will be able to install new languages after installation through the administration menu. - - - True - - - - - - 1 - 2 - 6 - 7 - GTK_SHRINK | GTK_FILL - - - - - True - Hello World - - - - - - 5 - 6 - GTK_FILL - GTK_FILL - - - - - True - True - True - This is the password of the user that have the rights to administer databases. This is not a Tryton user, just a super administrator. If you did not changed it, the password is 'admin' after installation. - 16 - False - True - 16 - - - 1 - 3 - 1 - 2 - - - - - - True - 0 - (use 'admin', if you did not changed it) - True - - - 1 - 3 - 2 - 3 - GTK_FILL - - - - - - True - - - 3 - 3 - 4 - GTK_FILL - - - - - True - True - Choose the name of the database that will be created. The name must not contain any special character. Exemple: 'terp'. - 16 - ● - True - 16 - - - 1 - 3 - 4 - 5 - GTK_FILL - - - - - - True - 1 - New database name: - - - 4 - 5 - GTK_FILL - - - - - - True - 1 - Default language: - - - 6 - 7 - GTK_FILL - - - - - + + 117 True 1 3 3 - Super admin password: - GTK_JUSTIFY_RIGHT + Tryton server: - 1 - 2 GTK_FILL + + + True + False + This is the URL of the Tryton server. Use 'localhost' if the server is installed on this computer. Click on 'Change' to change the address. + False + True + 16 + http://localhost:8069 + + + 1 + 2 + + + True @@ -5799,31 +5440,158 @@ Latin1 - - True - False - This is the URL of the Tryton server. Use 'localhost' if the server is installed on this computer. Click on 'Change' to change the address. - False - True - 16 - http://localhost:8069 - - - 1 - 2 - - - - - - 117 + True 1 3 3 - Tryton server: + Super admin password: + GTK_JUSTIFY_RIGHT + 1 + 2 + GTK_FILL + + + + + + True + 1 + Default language: + + + 6 + 7 + GTK_FILL + + + + + + True + 1 + New database name: + + + 4 + 5 + GTK_FILL + + + + + + True + True + Choose the name of the database that will be created. The name must not contain any special character. Exemple: 'terp'. + 16 + ● + True + 16 + + + 1 + 3 + 4 + 5 + GTK_FILL + + + + + + True + + + 3 + 3 + 4 + GTK_FILL + + + + + True + 0 + (use 'admin', if you did not changed it) + True + + + 1 + 3 + 2 + 3 + GTK_FILL + + + + + + True + True + True + This is the password of the user that have the rights to administer databases. This is not a Tryton user, just a super administrator. If you did not changed it, the password is 'admin' after installation. + 16 + False + True + 16 + + + 1 + 3 + 1 + 2 + + + + + + True + Hello World + + + + + + 5 + 6 + GTK_FILL + GTK_FILL + + + + + True + Choose the default language that will be installed for this database. You will be able to install new languages after installation through the administration menu. + + + True + + + + + + 1 + 2 + 6 + 7 + GTK_SHRINK | GTK_FILL + + + + + True + 0 + (must not contain any special character) + True + + + 1 + 3 + 5 + 6 GTK_FILL @@ -5916,47 +5684,70 @@ Latin1 3 3 - + True - True - 16 - False + 1 + New password confirmation: - 1 - 3 3 4 + GTK_FILL - + True - True - 16 - False + 1 + New password: - 1 - 3 2 3 + GTK_FILL - + True - True - 16 - False + 1 + Old password: + + + 1 + 2 + GTK_FILL + + + + + + 117 + True + 1 + 3 + 3 + Server: + + + GTK_FILL + + + + + + True + False + False + True + 16 + http://localhost:8069 1 - 3 - 1 - 2 + 2 @@ -6011,70 +5802,47 @@ Latin1 - + True - False - False - True - 16 - http://localhost:8069 + True + 16 + False 1 - 2 - - - - - - 117 - True - 1 - 3 - 3 - Server: - - - GTK_FILL - - - - - - True - 1 - Old password: - - + 3 1 2 - GTK_FILL - + True - 1 - New password: + True + 16 + False + 1 + 3 2 3 - GTK_FILL - + True - 1 - New password confirmation: + True + 16 + False + 1 + 3 3 4 - GTK_FILL diff --git a/tryton/common/common.py b/tryton/common/common.py index 3c0616f34a..ef4350e46f 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -8,6 +8,10 @@ from tryton.config import CONFIG from tryton.config import GLADE, TRYTON_ICON, PIXMAPS_DIR, DATA_DIR import time import sys +import xmlrpclib +import md5 +import webbrowser +import traceback _ = gettext.gettext @@ -227,27 +231,155 @@ def file_open(filename, type, parent, print_p=False): sys.exit(0) os.waitpid(pid, 0) -def error(title, msg, parent, details=''): +def error(title, parent, details): log = logging.getLogger('common.message') - log.error('MSG %s: %s' % (str(msg), details)) + log.error('%s' % details) + dialog = gtk.Dialog(_('Tryton - Error'), parent, + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) + dialog.set_icon(TRYTON_ICON) - xml = glade.XML(GLADE, "win_error", gettext.textdomain()) - win = xml.get_widget('win_error') - win.set_transient_for(parent) - win.set_icon(TRYTON_ICON) - xml.get_widget('error_title').set_text(str(title)) - xml.get_widget('error_info').set_text(str(msg)) + but_send = gtk.Button(_('Report Bug')) + dialog.add_action_widget(but_send, gtk.RESPONSE_OK) + dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CANCEL) + dialog.set_default_response(gtk.RESPONSE_CANCEL) + + vbox = gtk.VBox() + label_title = gtk.Label() + label_title.set_markup('' + _('Application Error!') + '') + label_title.set_padding(-1, 5) + vbox.pack_start(label_title, False, False) + vbox.pack_start(gtk.HSeparator(), False, False) + + hbox = gtk.HBox() + image = gtk.Image() + image.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_DIALOG) + hbox.pack_start(image, False, False) + + scrolledwindow = gtk.ScrolledWindow() + scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + scrolledwindow.set_shadow_type(gtk.SHADOW_NONE) + + viewport = gtk.Viewport() + viewport.set_shadow_type(gtk.SHADOW_NONE) + + box = gtk.VBox() + label_error = gtk.Label() + label_error.set_markup('' + _('Error: ') + '' + title) + label_error.set_alignment(0, 0.5) + label_error.set_padding(-1, 14) + box.pack_start(label_error, False, False) + textview = gtk.TextView() buf = gtk.TextBuffer() buf.set_text(unicode(details,'latin1').encode('utf-8')) - xml.get_widget('error_details').set_buffer(buf) + textview.set_buffer(buf) + box.pack_start(textview, False, False) - xml.signal_connect('on_closebutton_clicked', lambda x : win.destroy()) + viewport.add(box) + scrolledwindow.add(viewport) + hbox.pack_start(scrolledwindow) - win.run() + vbox.pack_start(hbox) + + button_roundup = gtk.Button() + button_roundup.set_relief(gtk.RELIEF_NONE) + label_roundup = gtk.Label() + label_roundup.set_markup(_('To report bug you must have a user on ') \ + + '' + CONFIG['roundup.url'] + '') + label_roundup.set_alignment(1, 0.5) + label_roundup.set_padding(20, 5) + + button_roundup.connect('clicked', + lambda widget: webbrowser.open(CONFIG['roundup.url'], new=2)) + button_roundup.add(label_roundup) + vbox.pack_start(button_roundup, False, False) + + dialog.vbox.pack_start(vbox) + dialog.set_size_request(600, 400) + + dialog.show_all() + response = dialog.run() parent.present() - win.destroy() + dialog.destroy() + if response == gtk.RESPONSE_OK: + send_bugtracker(details, parent) return True +def send_bugtracker(msg, parent): + from tryton import rpc + win = gtk.Dialog(_('Tryton - Bug Tracker'), parent, + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, + (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_OK, gtk.RESPONSE_OK)) + win.set_icon(TRYTON_ICON) + win.set_default_response(gtk.RESPONSE_OK) + + hbox = gtk.HBox() + image = gtk.Image() + image.set_from_stock(gtk.STOCK_DIALOG_QUESTION, + gtk.ICON_SIZE_DIALOG) + hbox.pack_start(image, False, False) + + table = gtk.Table(2, 2) + table.set_col_spacings(3) + table.set_row_spacings(3) + table.set_border_width(1) + label_user = gtk.Label(_('User:')) + label_user.set_alignment(1.0, 0.5) + table.attach(label_user, 0, 1, 0, 1, yoptions=False, + xoptions=gtk.FILL) + entry_user = gtk.Entry() + entry_user.set_activates_default(True) + table.attach(entry_user, 1, 2, 0, 1, yoptions=False, + xoptions=gtk.FILL) + label_password = gtk.Label(_('Password:')) + label_password.set_alignment(1.0, 0.5) + table.attach(label_password, 0, 1, 1, 2, yoptions=False, + xoptions=gtk.FILL) + entry_password = gtk.Entry() + entry_password.set_activates_default(True) + entry_password.set_visibility(False) + table.attach(entry_password, 1, 2, 1, 2, yoptions=False, + xoptions=gtk.FILL) + hbox.pack_start(table) + + win.vbox.pack_start(hbox) + win.show_all() + entry_password.grab_focus() + entry_user.set_text(rpc._USERNAME) + + response = win.run() + parent.present() + user = entry_user.get_text() + password = entry_password.get_text() + win.destroy() + if response == gtk.RESPONSE_OK: + try: + server = xmlrpclib.Server(('https://%s:%s@' + CONFIG['roundup.xmlrpc']) + % (user, password), allow_none=True) + msg_md5 = md5.new(msg).hexdigest() + title = '[no title]' + for line in msg.split('\n'): + if line: + title = line + msg_ids = server.filter('msg', None, {'summary': str(msg_md5)}) + issue_id = None + if msg_ids: + issue_ids = server.filter('issue', None, {'messages': msg_ids}) + if issue_ids: + issue_id = issue_ids[0] + server.set('issue' + str(issue_id), *['nosy=+' + str(user)]) + if not issue_id: + msg_id = server.create('msg', *['content=' + str(msg), + 'author=' + str(user), 'summary=' + str(msg_md5)]) + issue_id = server.create('issue', *['messages=' + str(msg_id), + 'nosy=' + str(user), 'title=' + str(title), 'priority=bug']) + except Exception, exception: + tb_s = reduce(lambda x, y: x + y, + traceback.format_exception(sys.exc_type, + sys.exc_value, sys.exc_traceback)) + message(_('Exception:') + '\n' + tb_s, parent, + msg_type=gtk.MESSAGE_ERROR) + def message(msg, parent, msg_type=gtk.MESSAGE_INFO): dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, diff --git a/tryton/config.py b/tryton/config.py index 04cf09016e..8f21014e60 100644 --- a/tryton/config.py +++ b/tryton/config.py @@ -82,6 +82,8 @@ class ConfigManager(object): 'png': {0: find_path(['display', 'qiv', 'eye', 'mspaint.exe'], '%s'), 1: ''}, }, + 'roundup.url': 'http://bugs.tryton.org/', + 'roundup.xmlrpc': 'roundup-xmlrpc.tryton.org', } parser = optparse.OptionParser(version=_("Tryton %s" % VERSION)) parser.add_option("-c", "--config", dest="config", diff --git a/tryton/rpc.py b/tryton/rpc.py index 9cc8d36bdb..7e9205289f 100644 --- a/tryton/rpc.py +++ b/tryton/rpc.py @@ -211,7 +211,7 @@ def process_exception(exception, parent, obj='', method='', *args): else: common.warning(details, parent, description) else: - common.error(type, description, parent, details) + common.error(type, parent, details) class RPCProxy(object):