Module sqlite_pycalcar
[hide private]
[frames] | no frames]

Source Code for Module sqlite_pycalcar

  1  #!/usr/bin/env python
 
  2  # -*-coding:utf-8 -*
 
  3  
 
  4  #       Pycalcar
 
  5  #       Copyright (C) 2013 GALODE A.
 
  6  #
 
  7  #       This file is part of Pycalcar.
 
  8  # 
 
  9  #       Pycalcar is free software: you can redistribute it and/or modify
 
 10  #       it under the terms of the GNU General Public License as published by
 
 11  #       the Free Software Foundation, either version 3 of the License, or
 
 12  #       (at your option) any later version.
 
 13  # 
 
 14  #       Pycalcar is distributed in the hope that it will be useful,
 
 15  #       but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 16  #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 17  #       GNU General Public License for more details.
 
 18  #
 
 19  #       You should have received a copy of the GNU General Public License
 
 20  #       along with Pycalcar.  If not, see <http://www.gnu.org/licenses/>
 
 21  
 
 22  import sqlite3 
 23  
 
 24  """
 
 25          :
 
 26          
 
 27          G{importgraph Demo}
 
 28  """ 
 29  
 
30 -class SqlitePycalcar:
31 """ 32 : 33 34 G{classtree} 35 36 DESCRIPTION 37 =========== 38 Allow to access to the DataBase of PYCALCAR 39 40 FUNCTIONS 41 ========= 42 p_ins_money 43 ----------- 44 Creation of a new money 45 p_ins_rate 46 ---------- 47 Creation of a new rate between devise 48 p_upd_money 49 ----------- 50 Update of a money's DATA 51 p_upd_rate 52 ---------- 53 Update of money's rate 54 p_del_money 55 ----------- 56 Delete a Money 57 p_del_rate 58 ---------- 59 Delete all rate attach to a devise which has been delete 60 f_read_money_name 61 ----------------- 62 Allow to read a money's DATA 63 f_read_money_rate 64 ----------------- 65 Allow to read a money's DATA internal rate conversion 66 f_read_lang 67 ----------- 68 Allow to read the different language available for Pycalcar 69 f_config_get_language 70 --------------------- 71 Allow to know the active language 72 p_config_set_language 73 --------------------- 74 Allow to set the selected language for Pycalcar 75 f_read_rate 76 ----------- 77 Allow to read money's rate conversion 78 f_read_conv_combox 79 ------------------ 80 Allow to know the available money for convertion end the rate to apply 81 f_read_message 82 -------------- 83 Allow to get the different messages in the selected language 84 f_read_menu_text 85 ---------------- 86 Allow to extract text of IHM 87 88 TABLE 89 ===== 90 ABOUT 91 ----- 92 Contains the different information for about windows 93 Columns: Action, Message 94 95 CONFIG 96 ------ 97 Contains the parameters for the software 98 Columns: Lang, Screen, Action, Message 99 100 MONEY 101 ----- 102 Contains the data of every money 103 Columns: Name, Year, Nation, Nb_unit, Unit0, Unit1, Unit2, Unit3, Unit4, Unit5, Unit6, 104 Unit7, unit8, Unit9, Unit1_to_0, Unit2_to_1, unit3_to_2, unit4_to_3, Unit5_to_4, 105 Unit6_to_5, unit7_to_6, Unit8_to_7, Unit9_to_8 106 107 RATE 108 ---- 109 Contains the rate to convert form money1 to money2 110 Columns: Name1, Year1, Nation1, Name2, Year2, Nation2, Rate1_to_2 111 112 """ 113 114 115 #===================================================# 116 # Init # 117 #===================================================#
118 - def __init__(self) :
119 bdd_path = './../01 - BDD/PYCALCAR.sqlite' 120 121 self.bdd_pycalcar = sqlite3.connect(bdd_path) 122 self.bdd_pycalcar.text_factory = str 123 self.bdd_pycalcar.row_factory = sqlite3.Row
124 125 126 127 #===================================================# 128 # Creation d'une nouvelle monnaie # 129 #===================================================#
130 - def p_ins_money(self,name,year,nation,nb_unit,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9, \ 131 tx0,tx1,tx2,tx3,tx4,tx5,tx6,tx7,tx8):
132 """ 133 : 134 135 DESCRIPTION 136 =========== 137 Creation of a new money 138 139 PARAMETERS 140 ========== 141 name 142 ---- 143 Money's name 144 year 145 ---- 146 Money's year creation 147 nation 148 ------ 149 Nation of the money 150 nb_unit 151 ------- 152 Number of unit in the money 153 u0 => u9 154 -------- 155 Name of the different units of the money 156 tx0 => tx8 157 ---------- 158 Rate between the different units of the money 159 160 RETURNS 161 ======= 162 None 163 """ 164 bdd_cursor = self.bdd_pycalcar.cursor() 165 bdd_cursor.execute("INSERT INTO MONEY \ 166 ( \ 167 NAME, YEAR,\ 168 NATION, NB_UNIT, UNIT0,\ 169 UNIT1, UNIT2,\ 170 UNIT3, UNIT4,\ 171 UNIT5, UNIT6,\ 172 UNIT7, UNIT8,\ 173 UNIT9, UNIT1_TO_0,\ 174 UNIT2_TO_1, UNIT3_TO_2,\ 175 UNIT4_TO_3, UNIT5_TO_4,\ 176 UNIT6_TO_5, UNIT7_TO_6,\ 177 UNIT8_TO_7, UNIT9_TO_8 \ 178 ) \ 179 VALUES \ 180 ( \ 181 ?,?,\ 182 ?,?,?,\ 183 ?,?,\ 184 ?,?,\ 185 ?,?,\ 186 ?,?,\ 187 ?,?,\ 188 ?,?,\ 189 ?,?,\ 190 ?,?,\ 191 ?,?\ 192 )", \ 193 (name,year,nation,nb_unit,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,\ 194 tx0,tx1,tx2,tx3,tx4,tx5,tx6,tx7,tx8)) 195 bdd_cursor.close() 196 self.bdd_pycalcar.commit()
197 198 199 200 #===================================================# 201 # Creation de nouveaux taux de conversion # 202 #===================================================#
203 - def p_ins_rate(self,name1,year1,nation1,name2,year2,nation2,rate):
204 """ 205 : 206 207 DESCRIPTION 208 =========== 209 Creation of a new rate between devise 210 211 PARAMETERS 212 ========== 213 name1 214 ----- 215 Name of the first money 216 year1 217 ----- 218 Year of creation of the first money 219 nation1 220 ------- 221 Nation of the first money 222 name2 223 ----- 224 Name of the second money 225 year2 226 ----- 227 Year of creation of the second money 228 nation2 229 ------- 230 Nation of the second money 231 rate 232 ---- 233 Rate to convert money 1 into money 2 234 235 RETURNS 236 ======= 237 None 238 """ 239 bdd_cursor = self.bdd_pycalcar.cursor() 240 bdd_cursor.execute("INSERT INTO RATE \ 241 ( \ 242 NAME1, YEAR1,\ 243 NATION1, NAME2,\ 244 YEAR2, NATION2,\ 245 RATE1_TO_2\ 246 ) \ 247 VALUES \ 248 ( \ 249 ?,?,\ 250 ?,?,\ 251 ?,?,\ 252 ?\ 253 )", \ 254 (name1,year1,nation1,name2,year2,nation2,rate)) 255 bdd_cursor.close() 256 self.bdd_pycalcar.commit()
257 258 259 260 #===================================================# 261 # MAJ d'une monnaie # 262 #===================================================#
263 - def p_upd_money(self,old_name,old_year,old_nation,name,year,nation, \ 264 nb_unit,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9, \ 265 tx0,tx1,tx2,tx3,tx4,tx5,tx6,tx7,tx8):
266 """ 267 : 268 269 DESCRIPTION 270 =========== 271 Update of a money's DATA 272 273 PARAMETERS 274 ========== 275 old_name 276 -------- 277 Old name of the money 278 old_year 279 -------- 280 Old year of creation of the money 281 old_nation 282 ---------- 283 Old nation of the money 284 name 285 ---- 286 New name for the money 287 year 288 ---- 289 New year of creation for the money 290 nation 291 ------ 292 New nation for the money 293 nb_unit 294 ------- 295 Number of units in the money 296 u0 => u9 297 -------- 298 Name of the different units of the money 299 tx0 => tx8 300 ---------- 301 Rate between the different units of the money 302 303 RETURNS 304 ======= 305 None 306 """ 307 bdd_cursor = self.bdd_pycalcar.cursor() 308 bdd_cursor.execute("UPDATE MONEY \ 309 SET NAME = ?, YEAR = ?, \ 310 NATION = ?, UNIT0 = ?, \ 311 UNIT1 = ?, UNIT2 = ?, \ 312 UNIT3 = ?, UNIT4 = ?, \ 313 UNIT5 = ?, UNIT6 = ?, \ 314 UNIT7 = ?, UNIT8 = ?, \ 315 UNIT9 = ?, UNIT1_TO_0 = ?, \ 316 UNIT2_TO_1 = ?, UNIT3_TO_2 = ?, \ 317 UNIT4_TO_3 = ?, UNIT5_TO_4 = ?, \ 318 UNIT6_TO_5 = ?, UNIT7_TO_6 = ?, \ 319 UNIT8_TO_7 = ?, UNIT9_TO_8 = ? \ 320 WHERE NAME = ? AND \ 321 YEAR = ? AND \ 322 NATION = ?", \ 323 (name,year,nation,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,\ 324 tx0,tx1,tx2,tx3,tx4,tx5,tx6,tx7,tx8,old_name,old_year,old_nation)) 325 bdd_cursor.close() 326 self.bdd_pycalcar.commit() 327 328 bdd_cursor = self.bdd_pycalcar.cursor() 329 bdd_cursor.execute("UPDATE RATE \ 330 SET NAME1 = ?, YEAR1 = ?, \ 331 NATION1 = ?\ 332 WHERE NAME1 = ? AND \ 333 YEAR1 = ? AND \ 334 NATION1 = ?", \ 335 (name,year,nation,old_name,old_year,old_nation)) 336 bdd_cursor.close() 337 self.bdd_pycalcar.commit() 338 339 bdd_cursor = self.bdd_pycalcar.cursor() 340 bdd_cursor.execute("UPDATE RATE \ 341 SET NAME2 = ?, YEAR2 = ?, \ 342 NATION2 = ?\ 343 WHERE NAME2 = ? AND \ 344 YEAR2 = ? AND \ 345 NATION2 = ?", \ 346 (name,year,nation,old_name,old_year,old_nation)) 347 bdd_cursor.close() 348 self.bdd_pycalcar.commit()
349 350 351 352 353 354 #===================================================# 355 # MAJ de taux de conversion entre monnaies # 356 #===================================================#
357 - def p_upd_rate(self, name1, year1, nation1, name2, year2, nation2, rate):
358 """ 359 : 360 361 DESCRIPTION 362 =========== 363 Update of money's rate 364 365 PARAMETERS 366 ========== 367 name1 368 ----- 369 Name of the first money 370 year1 371 ----- 372 Year of creation of the first money 373 nation1 374 ------- 375 Nation of the first money 376 name2 377 ----- 378 Name of the second money 379 year2 380 ----- 381 Year of creation of the second money 382 nation2 383 ------- 384 Nation of the second money 385 rate 386 ---- 387 Rate to convert money 1 into money 2 388 RETURNS 389 ======= 390 None 391 """ 392 bdd_cursor = self.bdd_pycalcar.cursor() 393 bdd_cursor.execute("UPDATE RATE \ 394 SET RATE1_TO_2 = ? \ 395 WHERE NAME1 = ? AND \ 396 YEAR1 = ? AND \ 397 NATION1 = ? AND \ 398 NAME2 = ? AND \ 399 YEAR2 = ? AND \ 400 NATION2 = ?", \ 401 (rate,name1,year1,nation1,name2,year2,nation2)) 402 bdd_cursor.close() 403 self.bdd_pycalcar.commit()
404 405 406 407 #===================================================# 408 # Effacement dune monnaie # 409 #===================================================#
410 - def p_del_money(self, name, year, nation):
411 """ 412 : 413 414 DESCRIPTION 415 =========== 416 Delete a Money 417 418 PARAMETERS 419 ========== 420 name 421 ---- 422 New name for the money 423 year 424 ---- 425 New year of creation for the money 426 nation 427 ------ 428 New nation for the money 429 430 RETURNS 431 ======= 432 None 433 """ 434 bdd_cursor = self.bdd_pycalcar.cursor() 435 bdd_cursor.execute("DELETE FROM MONEY \ 436 WHERE NAME = ? AND \ 437 YEAR = ? AND \ 438 NATION = ?", \ 439 (name,year,nation)) 440 441 bdd_cursor.execute("DELETE FROM RATE \ 442 WHERE (NAME1 = ? AND \ 443 YEAR1 = ? AND \ 444 NATION1 = ?)", \ 445 (name,year,nation)) 446 447 bdd_cursor.execute("DELETE FROM RATE \ 448 WHERE (NAME2 = ? AND \ 449 YEAR2 = ? AND \ 450 NATION2 = ?)", \ 451 (name,year,nation)) 452 453 bdd_cursor.close() 454 self.bdd_pycalcar.commit()
455 456 457 458 459 #===================================================# 460 # Effacement des taux lies a une monnaie # 461 #===================================================#
462 - def p_del_rate(self,name1,year1,nation1,name2='',year2='',nation2=''):
463 """ 464 : 465 466 DESCRIPTION 467 =========== 468 Delete all rate attach to a devise which has been delete 469 470 PARAMETERS 471 ========== 472 name1 473 ----- 474 Name of the first money 475 year1 476 ----- 477 Year of creation of the first money 478 nation1 479 ------- 480 Nation of the first money 481 name2 482 ----- 483 Name of the second money 484 year2 485 ----- 486 Year of creation of the second money 487 nation2 488 ------- 489 Nation of the second money 490 rate 491 ---- 492 Rate to convert money 1 into money 2 493 494 RETURNS 495 ======= 496 None 497 """ 498 bdd_cursor = self.bdd_pycalcar.cursor() 499 bdd_cursor.execute("DELETE FROM RATE \ 500 WHERE (NAME1 = ? AND \ 501 YEAR1 = ? AND \ 502 NATION1 = ? AND\ 503 NAME2 = ? AND \ 504 YEAR2 = ? AND \ 505 NATION2 = ?)", \ 506 (name1,year1,nation1,name2,year2,nation2)) 507 508 bdd_cursor.execute("DELETE FROM RATE \ 509 WHERE (NAME1 = ? AND \ 510 YEAR1 = ? AND \ 511 NATION1 = ? AND\ 512 NAME2 = ? AND \ 513 YEAR2 = ? AND \ 514 NATION2 = ?)", \ 515 (name2,year2,nation2,name1,year1,nation1)) 516 517 bdd_cursor.close() 518 self.bdd_pycalcar.commit()
519 520 521 522 #===================================================# 523 # Recuperation des unites d'une monnaie # 524 #===================================================#
525 - def f_read_money_name(self):
526 """ 527 : 528 529 DESCRIPTION 530 =========== 531 Allow to read a money's DATA 532 533 PARAMETERS 534 ========== 535 None 536 537 RETURNS 538 ======= 539 A list that contains the moneys's data 540 -------------------------------------- 541 name, year, nation, number of unit, 542 unit0, unit1, unit2, unit3, unit4, 543 unit5, unit6, unit7, unit8, unit9 544 545 """ 546 bdd_cursor = self.bdd_pycalcar.cursor() 547 bdd_cursor.execute("SELECT NAME, \ 548 YEAR, \ 549 NATION, \ 550 NB_UNIT, \ 551 ifnull(UNIT0,''),\ 552 ifnull(UNIT1,''),\ 553 ifnull(UNIT2,''),\ 554 ifnull(UNIT3,''),\ 555 ifnull(UNIT4,''),\ 556 ifnull(UNIT5,''),\ 557 ifnull(UNIT6,''),\ 558 ifnull(UNIT7,''),\ 559 ifnull(UNIT8,''),\ 560 ifnull(UNIT9,'')\ 561 FROM MONEY") 562 money_list = [] 563 for r in bdd_cursor: 564 money_list.append(r) 565 566 bdd_cursor.close() 567 568 return money_list
569 570 571 572 573 #===================================================# 574 # Recuperation des taux interne dune monnaie # 575 #===================================================#
576 - def f_read_money_rate(self, name, year, nation):
577 """ 578 : 579 580 DESCRIPTION 581 =========== 582 Allow to read a money's DATA internal rate conversion 583 584 PARAMETERS 585 ========== 586 name 587 ---- 588 New name for the money 589 year 590 ---- 591 New year of creation for the money 592 nation 593 ------ 594 New nation for the money 595 596 RETURNS 597 ======= 598 A list that contains the rate between unit of a money 599 ----------------------------------------------------- 600 unit1_to_0,unit2_to_1,unit3_to_2,unit4_to_3, 601 unit5_to_4,unit6_to_5,unit7_to_6,unit8_to_7, 602 unit9_to_8 603 """ 604 bdd_cursor = self.bdd_pycalcar.cursor() 605 bdd_cursor.execute("SELECT ifnull(UNIT1_TO_0,0), \ 606 ifnull(UNIT2_TO_1,0), \ 607 ifnull(UNIT3_TO_2,0), \ 608 ifnull(UNIT4_TO_3,0), \ 609 ifnull(UNIT5_TO_4,0), \ 610 ifnull(UNIT6_TO_5,0), \ 611 ifnull(UNIT7_TO_6,0), \ 612 ifnull(UNIT8_TO_7,0), \ 613 ifnull(UNIT9_TO_8,0) \ 614 FROM MONEY \ 615 WHERE NAME = ? AND \ 616 YEAR = ? AND \ 617 NATION = ?", \ 618 (name,year,nation)) 619 rate_list = [] 620 for r in bdd_cursor: 621 rate_list.append(r) 622 623 bdd_cursor.close() 624 625 return rate_list
626 627 628 629 630 #===================================================# 631 # Read the allow languages # 632 #===================================================#
633 - def f_read_lang(self):
634 """ 635 : 636 637 DESCRIPTION 638 =========== 639 Allow to read the different language available for Pycalcar 640 641 PARAMETERS 642 ========== 643 None 644 645 RETURNS 646 ======= 647 A list that contains the different language available 648 """ 649 bdd_cursor = self.bdd_pycalcar.cursor() 650 bdd_cursor.execute("SELECT DISTINCT LANG \ 651 FROM CONFIG") 652 lang_list = [] 653 for r in bdd_cursor: 654 lang_list.append(r) 655 656 bdd_cursor.close() 657 658 return lang_list
659 660 661 662 663 #===================================================# 664 # Read the selected language # 665 #===================================================#
666 - def f_config_get_language(self):
667 """ 668 : 669 670 DESCRIPTION 671 =========== 672 Allow to read the selected language for Pycalcar 673 674 PARAMETERS 675 ========== 676 None 677 678 RETURNS 679 ======= 680 The selected language for software 681 """ 682 bdd_cursor = self.bdd_pycalcar.cursor() 683 bdd_cursor.execute("SELECT MESSAGE \ 684 FROM CONFIG \ 685 WHERE LANG = 'ALL' AND \ 686 SCREEN = 'ALL' AND\ 687 ACTION = 'LANGUAGE'") 688 lang = [] 689 for r in bdd_cursor: 690 lang.append(r) 691 692 bdd_cursor.close() 693 694 return lang[0][0]
695 696 697 698 699 #===================================================# 700 # Set the software language # 701 #===================================================#
702 - def p_config_set_language(self, language):
703 """ 704 : 705 706 DESCRIPTION 707 =========== 708 Allow to set the selected language for Pycalcar 709 710 PARAMETERS 711 ========== 712 language 713 -------- 714 The selected language by user 715 716 RETURNS 717 ======= 718 None 719 """ 720 bdd_cursor = self.bdd_pycalcar.cursor() 721 bdd_cursor.execute("UPDATE CONFIG \ 722 SET MESSAGE = ?\ 723 WHERE LANG = 'ALL' AND \ 724 SCREEN = 'ALL' AND\ 725 ACTION = 'LANGUAGE'", (language,)) 726 727 bdd_cursor.close() 728 self.bdd_pycalcar.commit()
729 730 731 732 733 #===================================================# 734 # Recuperation des taux de conversion entre monnaie # 735 #===================================================#
736 - def f_read_rate(self,name1,year1,nation1,name2,year2,nation2):
737 """ 738 : 739 740 DESCRIPTION 741 =========== 742 Allow to read money's rate conversion 743 744 PARAMETERS 745 ========== 746 name1 747 ----- 748 Name of the first money 749 year1 750 ----- 751 Year of creation of the first money 752 nation1 753 ------- 754 Nation of the first money 755 name2 756 ----- 757 Name of the second money 758 year2 759 ----- 760 Year of creation of the second money 761 nation2 762 ------- 763 Nation of the second money 764 rate 765 ---- 766 Rate to convert money 1 into money 2 767 768 RETURNS 769 ======= 770 A list that contains the rate for conversion between the selected moneys 771 772 """ 773 bdd_cursor = self.bdd_pycalcar.cursor() 774 bdd_cursor.execute("SELECT rate1_to_2 \ 775 FROM RATE \ 776 WHERE NAME1 = ? AND \ 777 YEAR1 = ? AND \ 778 NATION1 = ? AND \ 779 NAME2 = ? AND \ 780 YEAR2 = ? AND \ 781 NATION2 = ?", \ 782 (name1,year1,nation1,name2,year2,nation2)) 783 rate_list = [] 784 for r in bdd_cursor: 785 rate_list.append(r) 786 787 bdd_cursor.close() 788 789 try: 790 return float(rate_list[0][0]) 791 except: 792 return 0
793 794 795 #===================================================# 796 # Donnees pour alimenter les combobox # 797 #===================================================#
798 - def f_read_conv_combox(self,name,year,nation):
799 """ 800 : 801 802 DESCRIPTION 803 =========== 804 Allow to know the available money for convertion end the rate to apply 805 806 PARAMETERS 807 ========== 808 name 809 ---- 810 The name of source money 811 year 812 ---- 813 The year of creation of the source money 814 nation 815 ------ 816 The nation of the source money 817 818 RETURNS 819 ======= 820 A list that contains the name, the year, the nation and the rate of available money 821 822 """ 823 bdd_cursor = self.bdd_pycalcar.cursor() 824 bdd_cursor.execute("SELECT DISTINCT NAME2,YEAR2,NATION2,rate1_to_2 \ 825 FROM RATE \ 826 WHERE NAME1 = ? AND \ 827 YEAR1 = ? AND \ 828 NATION1 = ?", (name,year,nation)) 829 combobox_list = [] 830 for r in bdd_cursor: 831 combobox_list.append(r) 832 833 bdd_cursor.close() 834 835 836 return combobox_list
837 838 839 840 #===================================================# 841 # Recuperation des messages # 842 #===================================================#
843 - def f_read_message(self, language):
844 """ 845 : 846 847 DESCRIPTION 848 =========== 849 Allow to get the different messages in the selected language 850 851 PARAMETERS 852 ========== 853 language 854 -------- 855 The language selected by user 856 857 RETURNS 858 ======= 859 A list that contains the different messages by tuples 860 861 """ 862 bdd_cursor = self.bdd_pycalcar.cursor() 863 bdd_cursor.execute("SELECT ACTION, MESSAGE \ 864 FROM CONFIG \ 865 WHERE LANG = ? AND \ 866 SCREEN = 'ALL' AND \ 867 ACTION LIKE 'MESSAGE%'", (language,)) 868 message_list = [] 869 for r in bdd_cursor: 870 message_list.append(r) 871 872 bdd_cursor.close() 873 874 875 return message_list
876 877 878 879 880 #===================================================# 881 # Texte pour l'IHM # 882 #===================================================#
883 - def f_read_menu_text(self, language = "Francais"):
884 """ 885 : 886 887 DESCRIPTION 888 =========== 889 Allow to extract text of IHM 890 891 PARAMETERS 892 ========== 893 language 894 -------- 895 The language selected by user 896 897 RETURNS 898 ======= 899 Different lists that contains the interface's text 900 901 """ 902 bdd_cursor = self.bdd_pycalcar.cursor() 903 bdd_cursor.execute("SELECT ACTION, MESSAGE \ 904 FROM CONFIG \ 905 WHERE LANG = ? AND \ 906 Screen = 'Toolbar'", (language,)) 907 toolbar_list = [] 908 for r in bdd_cursor: 909 toolbar_list.append(r) 910 911 912 bdd_cursor.execute("SELECT ACTION, MESSAGE \ 913 FROM CONFIG \ 914 WHERE LANG = ? AND \ 915 Screen = 'CALC'", (language,)) 916 calc_list = [] 917 for r in bdd_cursor: 918 calc_list.append(r) 919 920 921 bdd_cursor.execute("SELECT ACTION, MESSAGE \ 922 FROM CONFIG \ 923 WHERE LANG = ? AND Screen = 'CONV'", (language,)) 924 conv_list = [] 925 for r in bdd_cursor: 926 conv_list.append(r) 927 928 929 bdd_cursor.execute("SELECT ACTION, MESSAGE \ 930 FROM CONFIG \ 931 WHERE LANG = ? AND \ 932 Screen = 'PARAM'", (language,)) 933 param_list = [] 934 for r in bdd_cursor: 935 param_list.append(r) 936 937 938 bdd_cursor.execute("SELECT ACTION, MESSAGE \ 939 FROM ABOUT") 940 about_list = [] 941 for r in bdd_cursor: 942 about_list.append(r) 943 944 bdd_cursor.close() 945 946 return toolbar_list, calc_list, conv_list, param_list, about_list
947 948 949 950 951 952 #===================================================# 953 # Main de la classe # 954 #===================================================# 955 if __name__ == '__main__': 956 None 957