diff --git a/share/tryton/tryton.glade b/share/tryton/tryton.glade index 78304b49db..dcbd5f7efc 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 @@ -1891,6 +1891,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 @@ -1958,130 +2082,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 @@ -3234,86 +3234,6 @@ Please retry - - 600 - Tryton - Preferences - True - GTK_WIN_POS_CENTER_ON_PARENT - GDK_WINDOW_TYPE_HINT_DIALOG - - - True - - - True - - - True - <b>Edit resource preferences</b> - True - True - GTK_JUSTIFY_CENTER - - - False - False - - - - - True - - - False - 5 - 1 - - - - - - - - 2 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - gtk-cancel - True - -6 - - - - - True - True - True - True - gtk-ok - True - -5 - - - 1 - - - - - False - GTK_PACK_END - - - - - Tip of the Day GTK_WIN_POS_CENTER_ON_PARENT @@ -3705,6 +3625,31 @@ Each version is given a distinguishing version number. If the Program specifies True 2 2 + + + True + 0 + 9 + Search ID: + + + 1 + 2 + GTK_FILL + + + + + + True + gtk-index + 5 + + + 2 + GTK_FILL + + 49 @@ -3726,31 +3671,6 @@ Each version is given a distinguishing version number. If the Program specifies 7 - - - True - gtk-index - 5 - - - 2 - GTK_FILL - - - - - True - 0 - 9 - Search ID: - - - 1 - 2 - GTK_FILL - - - 2 @@ -3906,185 +3826,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 @@ -4107,12 +4035,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 @@ -4120,184 +4050,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 @@ -4319,203 +4239,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 @@ -4532,25 +4293,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 @@ -4558,14 +4308,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 @@ -4983,78 +4903,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 @@ -5075,12 +4942,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 @@ -5088,16 +4984,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 + + @@ -5314,45 +5234,31 @@ Latin1 2 6 - - True - - - - 1 - 2 - 2 - 3 - GTK_FILL - GTK_FILL - - - - - 170 + True 1 - 0 3 - Server: + 3 + Port: + 1 + 2 GTK_FILL - + True - 1 - 3 - 3 - Protocol connection: + True + True + 16 + localhost - 2 - 3 - GTK_FILL + 1 + 2 @@ -5374,34 +5280,48 @@ Latin1 - - True - True - True - 16 - localhost - - - 1 - 2 - - - - - + True 1 3 3 - Port: + Protocol connection: - 1 - 2 + 2 + 3 GTK_FILL + + + 170 + True + 1 + 0 + 3 + Server: + + + GTK_FILL + + + + + + True + + + + 1 + 2 + 2 + 3 + GTK_FILL + GTK_FILL + + False @@ -5487,93 +5407,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 @@ -5628,17 +5472,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 @@ -5734,90 +5654,31 @@ Latin1 - - True - - - 3 - 2 - 3 - GTK_FILL - - - - - True - 0 - (must not contain any special char) - - - 1 - 3 - 4 - 5 - GTK_FILL - - - - - - 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 @@ -5872,34 +5733,93 @@ 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 + ● + 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 @@ -6001,193 +5921,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 - 7 - 8 - 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 - True - Check this box if you want demo data to be installed on your new database. - True - 0 - True - - - 1 - 3 - 6 - 7 - GTK_FILL - - - - - - True - 1 - Load demonstration data: - - - 6 - 7 - GTK_FILL - - - - - - True - 1 - Default language: - - - 7 - 8 - 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 @@ -6239,31 +6001,189 @@ 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: + + + 7 + 8 + GTK_FILL + + + + + + True + 1 + Load demonstration data: + + + 6 + 7 + GTK_FILL + + + + + + True + True + Check this box if you want demo data to be installed on your new database. + True + 0 + True + + + 1 + 3 + 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 + 7 + 8 + GTK_SHRINK | GTK_FILL + + + + + True + 0 + (must not contain any special character) + True + + + 1 + 3 + 5 + 6 GTK_FILL @@ -6356,47 +6276,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 @@ -6451,70 +6394,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/gui/main.py b/tryton/gui/main.py index 66e4469d05..705bcd4ec7 100644 --- a/tryton/gui/main.py +++ b/tryton/gui/main.py @@ -554,20 +554,16 @@ class Main(object): self.notebook.set_current_page(page - 1) def sig_user_preferences(self, widget): - try: - actions = rpc.session.rpc_exec_auth('/object', 'execute', - 'ir.values', 'get', 'meta', False, [('res.user',False)], - True, rpc.session.context, True) + actions = rpc.session.rpc_exec_auth('/object', 'execute', + 'ir.values', 'get', 'meta', False, [('res.user',False)], + True, rpc.session.context, True) - win = Preference('res.user', rpc.session.user, - actions, parent=self.window) - if win.run(): - rpc.session.context_reload() - self.window.present() - win.destroy() - return True - except: - return False + win = Preference('res.user', rpc.session.user, + actions, parent=self.window) + if win.run(): + rpc.session.context_reload() + self.window.present() + return True def sig_win_close(self, widget): self._sig_child_call(widget, 'but_close') diff --git a/tryton/gui/window/form.py b/tryton/gui/window/form.py index 49b2da2c0b..9c4c84ba3d 100644 --- a/tryton/gui/window/form.py +++ b/tryton/gui/window/form.py @@ -11,7 +11,7 @@ from tryton.config import GLADE from tryton.action import Action from tryton.config import CONFIG from tryton.gui.window.win_search import WinSearch -#import win_preference +from tryton.gui.window.preference import Preference #import win_export #import win_import @@ -345,7 +345,7 @@ class Form(object): rpc.session.context, True) obj_id = self.screen.id_get() if obj_id and len(actions): - win = win_preference.win_preference(self.model, obj_id, actions) + win = Preference(self.model, obj_id, actions) win.run() elif obj_id: self.message_state(_('No preference available for this resource !')) diff --git a/tryton/gui/window/preference.py b/tryton/gui/window/preference.py index 429f0edfa3..e83416b6fd 100644 --- a/tryton/gui/window/preference.py +++ b/tryton/gui/window/preference.py @@ -1,11 +1,10 @@ "Preference" import gettext import gtk -from gtk import glade import tryton.rpc as rpc import copy -#from tryton.widget.screen import Screen -from tryton.config import TRYTON_ICON, GLADE +from tryton.gui.window.view_form.screen import Screen +from tryton.config import TRYTON_ICON _ = gettext.gettext @@ -14,9 +13,15 @@ class Preference(object): "Preference window" def __init__(self, model, obj_id, preferences, parent): - self.glade = glade.XML(GLADE, 'win_preference', - gettext.textdomain()) - self.win = self.glade.get_widget('win_preference') + self.win = gtk.Dialog(_('Tryton - Preferences'), parent, + gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, + (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_OK, gtk.RESPONSE_OK)) + + self.win.set_default_response(gtk.RESPONSE_OK) + self.win.vbox.pack_start(gtk.Label(_('Edit ressource preferences')), + expand=False, fill=True) + self.win.vbox.pack_start(gtk.HSeparator()) self.win.set_icon(TRYTON_ICON) self.win.set_transient_for(parent) self.parent = parent @@ -48,8 +53,7 @@ class Preference(object): width, height = self.screen.screen_container.size_get() self.screen.widget.set_size_request(width, height) - vbox = self.glade.get_widget('preference_vbox') - vbox.pack_start(self.screen.widget) + self.win.vbox.pack_start(self.screen.widget) self.win.set_title(_('Preference')+' '+model) self.win.show_all() @@ -59,21 +63,23 @@ class Preference(object): final = False while True: res = self.win.run() - if self.screen.current_model.validate(): + if res == gtk.RESPONSE_OK: + if self.screen.current_model.validate(): + final = True + + val = copy.copy(self.screen.get()) + + for key in val: + if val[key]: + rpc.session.rpc_exec_auth('/object', 'execute', + 'ir.values', 'set', 'meta', key, key, + [(self.model, self.obj_id)], val[key]) + elif self.defaults.get(key, False): + rpc.session.rpc_exec_auth('/common', 'ir_del', + self.defaults[key]) + break + else: break - if res == gtk.RESPONSE_OK: - final = True - - val = copy.copy(self.screen.get()) - - for key in val: - if val[key]: - rpc.session.rpc_exec_auth('/object', 'execute', - 'ir.values', 'set', 'meta', key, key, - [(self.model, self.obj_id)], val[key]) - elif self.defaults.get(key, False): - rpc.session.rpc_exec_auth('/common', 'ir_del', - self.defaults[key]) self.parent.present() self.win.destroy() return final