From ab4760c1d166f04f17d39a98f872967efcbdd365 Mon Sep 17 00:00:00 2001 From: "ced@b2ck.com" Date: Thu, 3 Jan 2008 00:01:54 +0100 Subject: [PATCH] Add remove predefined export --- share/tryton/tryton.glade | 2687 ++++++++++++++++--------------- tryton/gui/window/win_export.py | 52 +- 2 files changed, 1407 insertions(+), 1332 deletions(-) diff --git a/share/tryton/tryton.glade b/share/tryton/tryton.glade index dcbd5f7efc..17aae0e852 100644 --- a/share/tryton/tryton.glade +++ b/share/tryton/tryton.glade @@ -36,128 +36,6 @@ 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 @@ -189,6 +67,128 @@ 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,130 +1891,6 @@ 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 @@ -2082,6 +1958,130 @@ 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 @@ -2424,6 +2424,55 @@ 4 + + + True + True + 0 + + + + True + 0 + 0 + + + True + 2 + + + True + gtk-remove + + + False + False + + + + + True + Remove List + True + GTK_JUSTIFY_CENTER + + + False + False + 1 + + + + + + + + + False + False + 5 + + False @@ -3625,31 +3674,6 @@ 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 @@ -3671,6 +3695,31 @@ 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 @@ -3826,337 +3875,43 @@ Each version is given a distinguishing version number. If the Program specifies 15 2 - + True - 0 - <Ctrl> + O + 2 + <b>Shortcuts for Tryton</b> + True + GTK_JUSTIFY_CENTER - 1 - 2 - GTK_FILL + 2 + 5 - + True 0 - Connect + Close window without saving 1 2 - 1 - 2 + 14 + 15 GTK_FILL - + True 0 - <Ctrl> + F + <Ctrl> + <Esc> - 5 - 6 - GTK_FILL - - - - - - True - 0 - Find / Search - - - 1 - 2 - 5 - 6 - GTK_FILL - - - - - - True - 0 - <Ctrl> + D - - - 4 - 5 - GTK_FILL - - - - - - True - 0 - Delete - - - 1 - 2 - 4 - 5 - GTK_FILL - - - - - - True - 0 - <Ctrl> + N - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - New - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - - True - 0 - <Ctrl> + <PgUp> - - - 9 - 10 - GTK_FILL - - - - - - True - 0 - Previous tab - - - 1 - 2 - 9 - 10 - GTK_FILL - - - - - - True - 0 - <Ctrl> + <PgDn> - - - 10 - 11 - GTK_FILL - - - - - - True - 0 - Next Tab - - - 1 - 2 - 10 - 11 - GTK_FILL - - - - - - True - 0 - <Ctrl> + S - - - 3 - 4 - GTK_FILL - - - - - - True - 0 - <Ctrl> + W - - - 11 - 12 - GTK_FILL - - - - - - True - 0 - Save - - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - - True - 0 - Close Tab - - - 1 - 2 - 11 - 12 - GTK_FILL - - - - - - True - 0 - <PgUp> - - - 6 - 7 - GTK_FILL - - - - - - True - 0 - <PgDn> - - - 7 - 8 - GTK_FILL - - - - - - True - 0 - Previous record - - - 1 - 2 - 6 - 7 - GTK_FILL - - - - - - True - 0 - Next record - - - 1 - 2 - 7 - 8 - GTK_FILL - - - - - - True - 0 - <Ctrl> + L - - - 8 - 9 - GTK_FILL - - - - - - True - 0 - Switch view mode - - - 1 - 2 - 8 - 9 - GTK_FILL - - - - - - True - 0 - <Ctrl> + <Enter> - - - 13 - 14 - GTK_FILL - - - - - - True - 0 - Save and Close window - - - 1 - 2 - 13 - 14 + 14 + 15 GTK_FILL @@ -4179,45 +3934,339 @@ Each version is given a distinguishing version number. If the Program specifies - + True 0 - <Ctrl> + <Esc> - - - 14 - 15 - GTK_FILL - - - - - - True - 0 - Close window without saving + Save and Close window 1 2 - 14 - 15 + 13 + 14 GTK_FILL - + True - 2 - <b>Shortcuts for Tryton</b> - True - GTK_JUSTIFY_CENTER + 0 + <Ctrl> + <Enter> + 13 + 14 + GTK_FILL + + + + + + True + 0 + Switch view mode + + + 1 2 + 8 + 9 + GTK_FILL + + + + + + True + 0 + <Ctrl> + L + + + 8 + 9 + GTK_FILL + + + + + + True + 0 + Next record + + + 1 + 2 + 7 + 8 + GTK_FILL + + + + + + True + 0 + Previous record + + + 1 + 2 + 6 + 7 + GTK_FILL + + + + + + True + 0 + <PgDn> + + + 7 + 8 + GTK_FILL + + + + + + True + 0 + <PgUp> + + + 6 + 7 + GTK_FILL + + + + + + True + 0 + Close Tab + + + 1 + 2 + 11 + 12 + GTK_FILL + + + + + + True + 0 + Save + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + + True + 0 + <Ctrl> + W + + + 11 + 12 + GTK_FILL + + + + + + True + 0 + <Ctrl> + S + + + 3 + 4 + GTK_FILL + + + + + + True + 0 + Next Tab + + + 1 + 2 + 10 + 11 + GTK_FILL + + + + + + True + 0 + <Ctrl> + <PgDn> + + + 10 + 11 + GTK_FILL + + + + + + True + 0 + Previous tab + + + 1 + 2 + 9 + 10 + GTK_FILL + + + + + + True + 0 + <Ctrl> + <PgUp> + + + 9 + 10 + GTK_FILL + + + + + + True + 0 + New + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + + True + 0 + <Ctrl> + N + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Delete + + + 1 + 2 + 4 + 5 + GTK_FILL + + + + + + True + 0 + <Ctrl> + D + + + 4 + 5 + GTK_FILL + + + + + + True + 0 + Find / Search + + + 1 + 2 + 5 + 6 + GTK_FILL + + + + + + True + 0 + <Ctrl> + F + + + 5 + 6 + GTK_FILL + + + + + + True + 0 + Connect + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + + True + 0 + <Ctrl> + O + + + 1 + 2 + GTK_FILL - 5 @@ -4239,182 +4288,57 @@ Each version is given a distinguishing version number. If the Program specifies 10 2 - + True 0 - <Ctrl> + X + F2 + GTK_JUSTIFY_CENTER - 1 - 2 + 9 + 10 GTK_FILL - + True - 0 - <Ctrl> + C + <b>Shortcuts in relation fields</b> + True - 2 - 3 + 2 + 7 + 8 GTK_FILL + 5 - + True - 0 - <Ctrl> + V + <b>Shortcuts in text entries</b> + True - 3 - 4 - GTK_FILL + 2 + 5 - + True 0 - Cut selected text + Open current field 1 2 - 1 - 2 - GTK_FILL - - - - - - True - 0 - Copy selected text - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - - True - 0 - Paste selected text - - - 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 + 9 + 10 GTK_FILL @@ -4435,57 +4359,182 @@ Each version is given a distinguishing version number. If the Program specifies - + True 0 - Open current field + F1 + + + 8 + 9 + GTK_FILL + + + + + + True + 0 + Auto-Complete text field 1 2 - 9 - 10 + 6 + 7 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 + <Enter> - 9 - 10 + 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 + Cut selected text + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + + True + 0 + <Ctrl> + V + + + 3 + 4 + GTK_FILL + + + + + + True + 0 + <Ctrl> + C + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + <Ctrl> + X + + + 1 + 2 GTK_FILL @@ -4903,67 +4952,36 @@ Each version is given a distinguishing version number. If the Program specifies 8 9 - + True - 1 - Field Separater: - - - GTK_FILL - - - - - - True - 1 - Encoding: - - - 1 - 2 - GTK_FILL - - - - - - True - True - 1 - 1 - , + UTF-8 +Latin1 + + + + 1 2 + 1 + 2 GTK_FILL - + GTK_FILL - - True - 1 - Text Delimiter: - - - 2 - 3 - GTK_FILL - - - - - + True True - 1 - " + 0 0 100 1 10 10 + 1 3 4 + 1 + 2 GTK_FILL @@ -4984,15 +5002,54 @@ Each version is given a distinguishing version number. If the Program specifies - + True True - 0 0 100 1 10 10 - 1 + 1 + " 3 4 + GTK_FILL + + + + + + True + 1 + Text Delimiter: + + + 2 + 3 + GTK_FILL + + + + + + True + True + 1 + 1 + , + + + 1 + 2 + GTK_FILL + + + + + + True + 1 + Encoding: + + 1 2 GTK_FILL @@ -5000,22 +5057,14 @@ Each version is given a distinguishing version number. If the Program specifies - + True - UTF-8 -Latin1 - - - - + 1 + Field Separater: - 1 - 2 - 1 - 2 GTK_FILL - GTK_FILL + @@ -5234,31 +5283,45 @@ Latin1 2 6 - + True + + + + 1 + 2 + 2 + 3 + GTK_FILL + GTK_FILL + + + + + 170 + True 1 + 0 3 - 3 - Port: + Server: - 1 - 2 GTK_FILL - + True - True - True - 16 - localhost + 1 + 3 + 3 + Protocol connection: - 1 - 2 + 2 + 3 + GTK_FILL @@ -5280,46 +5343,32 @@ Latin1 - + True - 1 - 3 - 3 - Protocol connection: - - - 2 - 3 - GTK_FILL - - - - - - 170 - True - 1 - 0 - 3 - Server: - - - GTK_FILL - - - - - - True - + True + True + 16 + localhost 1 2 - 2 - 3 + + + + + + True + 1 + 3 + 3 + Port: + + + 1 + 2 GTK_FILL - GTK_FILL + @@ -5407,17 +5456,93 @@ Latin1 3 3 - + True - False - False - True - 16 - http://localhost:8069 + 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 - 2 + 3 + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + True + True + 16 + False + True + 16 + + + 1 + 3 + 1 + 2 + + + + + + 117 + True + 1 + 3 + 3 + Server: + + + GTK_FILL @@ -5472,93 +5597,17 @@ Latin1 - - 117 + True - 1 - 3 - 3 - Server: - - - GTK_FILL - - - - - - True - True - True - 16 - False + False + False True 16 + http://localhost:8069 1 - 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 + 2 @@ -5654,31 +5703,90 @@ Latin1 - - 117 + True - 1 - 3 - 3 - Server: + 3 + 2 + 3 + GTK_FILL + + + + + True + 0 + (must not contain any special char) + + + 1 + 3 + 4 + 5 GTK_FILL - + True - False - False - True + True + ● 16 - http://localhost:8069 1 - 2 + 3 + 3 + 4 + + + + + + True + 0 + New database name: + + + 3 + 4 + GTK_FILL + + + + + + True + 1 + 3 + 3 + Password: + GTK_JUSTIFY_RIGHT + + + 1 + 2 + GTK_FILL + + + + + + True + True + True + 16 + False + True + 16 + + + 1 + 3 + 1 + 2 @@ -5733,93 +5841,34 @@ Latin1 - + True - True - True - 16 - False + False + False True 16 + http://localhost:8069 1 - 3 - 1 - 2 + 2 - + + 117 True 1 3 3 - Password: - GTK_JUSTIFY_RIGHT + Server: - 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 @@ -5921,32 +5970,190 @@ Latin1 - - 117 + True - 1 - 3 - 3 - Tryton server: + 0 + (must not contain any special character) + True + 1 + 3 + 5 + 6 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 + 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 + + + + + + True + 1 + 3 + 3 + Super admin password: + GTK_JUSTIFY_RIGHT + + + 1 + 2 + GTK_FILL @@ -6001,189 +6208,31 @@ Latin1 - + True - 1 - 3 - 3 - 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 - ● + 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 - - - 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 - - - + http://localhost:8069 1 2 - 7 - 8 - GTK_SHRINK | GTK_FILL + - + + 117 True - 0 - (must not contain any special character) - True + 1 + 3 + 3 + Tryton server: - 1 - 3 - 5 - 6 GTK_FILL @@ -6276,70 +6325,47 @@ Latin1 3 3 - + True - 1 - New password confirmation: - - - 3 - 4 - GTK_FILL - - - - - - True - 1 - New password: - - - 2 - 3 - GTK_FILL - - - - - - True - 1 - Old password: - - - 1 - 2 - GTK_FILL - - - - - - 117 - True - 1 - 3 - 3 - Server: - - - GTK_FILL - - - - - - True - False - False - True - 16 - http://localhost:8069 + True + 16 + False 1 - 2 + 3 + 3 + 4 + + + + + + True + True + 16 + False + + + 1 + 3 + 2 + 3 + + + + + + True + True + 16 + False + + + 1 + 3 + 1 + 2 @@ -6394,47 +6420,70 @@ Latin1 - + True - True - 16 - False + False + False + True + 16 + http://localhost:8069 1 - 3 + 2 + + + + + + 117 + True + 1 + 3 + 3 + Server: + + + GTK_FILL + + + + + + True + 1 + Old password: + + 1 2 + GTK_FILL - + True - True - 16 - False + 1 + New password: - 1 - 3 2 3 + GTK_FILL - + True - True - 16 - False + 1 + New password confirmation: - 1 - 3 3 4 + GTK_FILL diff --git a/tryton/gui/window/win_export.py b/tryton/gui/window/win_export.py index 5952b46a0a..4de61f051d 100644 --- a/tryton/gui/window/win_export.py +++ b/tryton/gui/window/win_export.py @@ -94,22 +94,27 @@ class WinExport(object): self.glade.signal_connect('on_but_select_clicked', self.sig_sel) self.glade.signal_connect('on_but_unselect_clicked', self.sig_unsel) self.glade.signal_connect('on_but_predefined_clicked', self.add_predef) + self.glade.signal_connect('on_but_remove_predefined_clicked', + self.remove_predef) # Creating the predefined export view self.pref_export = gtk.TreeView() self.pref_export.append_column(gtk.TreeViewColumn('Export name', - gtk.CellRendererText(), text=1)) - self.pref_export.append_column(gtk.TreeViewColumn('Exported fields', gtk.CellRendererText(), text=2)) + self.pref_export.append_column(gtk.TreeViewColumn('Exported fields', + gtk.CellRendererText(), text=3)) self.glade.get_widget('predefined_exports').add(self.pref_export) self.pref_export.connect("row-activated", self.sel_predef) # Fill the predefined export tree view and show everything + self.predef_model = gtk.ListStore( + gobject.TYPE_INT, + gobject.TYPE_PYOBJECT, + gobject.TYPE_STRING, + gobject.TYPE_STRING) self.fill_predefwin() self.pref_export.show_all() - self.predef_model = gtk.ListStore(gobject.TYPE_PYOBJECT, - gobject.TYPE_STRING, gobject.TYPE_STRING) def sig_sel_all(self, widget=None): self.model2.clear() @@ -139,23 +144,24 @@ class WinExport(object): self.model2.clear() def fill_predefwin(self): - self.predef_model = gtk.ListStore(gobject.TYPE_PYOBJECT, - gobject.TYPE_STRING, gobject.TYPE_STRING) ir_export = rpc.RPCProxy('ir.exports') ir_export_line = rpc.RPCProxy('ir.exports.line') export_ids = ir_export.search([('resource', '=', self.model)]) for export in ir_export.read(export_ids): fields = ir_export_line.read(export['export_fields']) - self.predef_model.append(([f['name'] for f in fields], + self.predef_model.append(( + export['id'], + [f['name'] for f in fields], export['name'], ', '.join([self.fields_data[f['name']]['string'] \ - for f in fields]))) + for f in fields]), + )) self.pref_export.set_model(self.predef_model) def add_predef(self, widget): - name = common.ask('What is the name of this export ?', self.parent) + name = common.ask('What is the name of this export?', self.parent) if not name: - return + return ir_export = rpc.RPCProxy('ir.exports') iter = self.model2.get_iter_root() fields = [] @@ -163,14 +169,34 @@ class WinExport(object): field_name = self.model2.get_value(iter, 1) fields.append(field_name) iter = self.model2.iter_next(iter) - ir_export.create({'name' : name, 'resource' : self.model, + new_id = ir_export.create({'name' : name, 'resource' : self.model, 'export_fields' : [(0, 0, {'name' : f}) for f in fields]}) - self.predef_model.append((fields, name, + self.predef_model.append(( + new_id, + fields, + name, ','.join([self.fields_data[f]['string'] for f in fields]))) + self.pref_export.set_model(self.predef_model) + + def remove_predef(self, widget): + sel = self.pref_export.get_selection().get_selected() + if sel == None: + return None + (model, i) = sel + if not i: + return None + ir_export = rpc.RPCProxy('ir.exports') + export_id = model.get_value(i, 0) + ir_export.unlink(export_id) + for i in range(len(self.predef_model)): + if self.predef_model[i][0] == export_id: + del self.predef_model[i] + break + self.pref_export.set_model(self.predef_model) def sel_predef(self, widget, path, column): self.model2.clear() - for field in self.predef_model[path[0]][0]: + for field in self.predef_model[path[0]][1]: self.model2.append((self.fields_data[field]['string'], field)) def run(self):