From 4523e2d8899a00de7ff7b56b56a44fc1afbdd151 Mon Sep 17 00:00:00 2001
From: eficas <>
Date: Tue, 17 May 2005 11:54:51 +0000
Subject: [PATCH] *** empty log message ***
---
Accas/A_AU_PLUS_UN.py | 29 +
Accas/__init__.py | 1 +
Aster/Cata/Macro/__init__.py | 3 +
Aster/Cata/Macro/calc_fonction_ops.py | 322 +++
Aster/Cata/Macro/calc_precont_ops.py | 28 +-
Aster/Cata/Macro/impr_fonction_ops.py | 55 +-
Aster/Cata/Macro/impr_table_ops.py | 21 +-
Aster/Cata/Macro/info_fonction_ops.py | 252 +++
Aster/Cata/Macro/macr_ascouf_calc_ops.py | 43 +-
Aster/Cata/Macro/macr_ascouf_mail_ops.py | 6 +-
Aster/Cata/Macro/macr_aspic_calc_ops.py | 48 +-
Aster/Cata/Macro/macr_cabri_mail_ops.py | 16 +-
Aster/Cata/Macro/macr_fiab_impr_ops.py | 20 +-
Aster/Cata/Macro/macr_lign_coupe_ops.py | 266 ++-
Aster/Cata/Macro/macr_recal_ops.py | 5 +-
Aster/Cata/Macro/macro_cara_poutre_ops.py | 684 ------
Aster/Cata/Macro/macro_matr_asse_ops.py | 69 +-
Aster/Cata/Macro/pre_gmsh_ops.py | 61 -
Aster/Cata/Macro/reca_algo.py | 3 +-
Aster/Cata/Macro/recal.py | 8 +-
Pmw/Alpha_99_9_example/__init__.py | 1 +
Pmw/Alpha_99_9_example/lib/Pmw.def | 9 +
Pmw/Alpha_99_9_example/lib/PmwAlphaExample.py | 24 +
Pmw/Alpha_99_9_example/lib/__init__.py | 1 +
Pmw/Pmw_1_2/__init__.py | 1 +
Pmw/Pmw_1_2/bin/bundlepmw.py | 169 ++
Pmw/Pmw_1_2/contrib/DirBrowser.py | 306 +++
Pmw/Pmw_1_2/contrib/MCListbox.py | 706 ++++++
Pmw/Pmw_1_2/contrib/PmwFileDialog.py | 498 +++++
Pmw/Pmw_1_2/contrib/PmwFullTimeCounter.py | 492 +++++
Pmw/Pmw_1_2/contrib/PmwVerticalGauge.py | 253 +++
Pmw/Pmw_1_2/contrib/README | 10 +
Pmw/Pmw_1_2/contrib/TreeBrowser.py | 732 +++++++
Pmw/Pmw_1_2/demos/AboutDialog.py | 43 +
Pmw/Pmw_1_2/demos/All.py | 310 +++
Pmw/Pmw_1_2/demos/Args.py | 191 ++
Pmw/Pmw_1_2/demos/Balloon.py | 185 ++
Pmw/Pmw_1_2/demos/BltGraph.py | 241 ++
Pmw/Pmw_1_2/demos/BltTabset.py | 101 +
Pmw/Pmw_1_2/demos/ButtonBox.py | 56 +
Pmw/Pmw_1_2/demos/Colors.py | 50 +
Pmw/Pmw_1_2/demos/ComboBox.py | 76 +
Pmw/Pmw_1_2/demos/ComboBoxDialog.py | 44 +
Pmw/Pmw_1_2/demos/ConfigClass.py | 76 +
Pmw/Pmw_1_2/demos/Counter.py | 121 ++
Pmw/Pmw_1_2/demos/CounterDialog.py | 60 +
Pmw/Pmw_1_2/demos/DemoVersion.py | 36 +
Pmw/Pmw_1_2/demos/Dialog.py | 89 +
Pmw/Pmw_1_2/demos/EntryField.py | 98 +
Pmw/Pmw_1_2/demos/ErrorHandling.py | 42 +
Pmw/Pmw_1_2/demos/ExampleDemo.py | 33 +
Pmw/Pmw_1_2/demos/Grid.py | 44 +
Pmw/Pmw_1_2/demos/Group.py | 93 +
Pmw/Pmw_1_2/demos/HistoryText.py | 102 +
Pmw/Pmw_1_2/demos/LabeledWidget.py | 46 +
Pmw/Pmw_1_2/demos/LogicalFont.py | 84 +
Pmw/Pmw_1_2/demos/MainMenuBar.py | 176 ++
Pmw/Pmw_1_2/demos/MenuBar.py | 166 ++
Pmw/Pmw_1_2/demos/MessageBar.py | 85 +
Pmw/Pmw_1_2/demos/MessageDialog.py | 102 +
Pmw/Pmw_1_2/demos/MessageInfo.py | 108 +
Pmw/Pmw_1_2/demos/MultiLineLabel.py | 73 +
Pmw/Pmw_1_2/demos/NestedDialogs.py | 71 +
Pmw/Pmw_1_2/demos/NoteBook.py | 52 +
Pmw/Pmw_1_2/demos/NoteBook_2.py | 224 ++
Pmw/Pmw_1_2/demos/NoteBook_3.py | 26 +
Pmw/Pmw_1_2/demos/OptionMenu.py | 66 +
Pmw/Pmw_1_2/demos/PanedWidget.py | 103 +
Pmw/Pmw_1_2/demos/PanedWidget_2.py | 65 +
Pmw/Pmw_1_2/demos/PromptDialog.py | 62 +
Pmw/Pmw_1_2/demos/RadioSelect.py | 116 +
Pmw/Pmw_1_2/demos/Resources.py | 74 +
Pmw/Pmw_1_2/demos/Resources_Pmw.py | 110 +
Pmw/Pmw_1_2/demos/ScrolledCanvas.py | 124 ++
Pmw/Pmw_1_2/demos/ScrolledField.py | 51 +
Pmw/Pmw_1_2/demos/ScrolledFrame.py | 157 ++
Pmw/Pmw_1_2/demos/ScrolledListBox.py | 118 +
Pmw/Pmw_1_2/demos/ScrolledText.py | 99 +
Pmw/Pmw_1_2/demos/ScrolledText_2.py | 99 +
Pmw/Pmw_1_2/demos/SelectionDialog.py | 47 +
Pmw/Pmw_1_2/demos/ShowBusy.py | 48 +
Pmw/Pmw_1_2/demos/SpecialCounter.py | 68 +
Pmw/Pmw_1_2/demos/SpecialEntry.py | 170 ++
Pmw/Pmw_1_2/demos/Spectrum.py | 166 ++
Pmw/Pmw_1_2/demos/SpeedTest.py | 60 +
Pmw/Pmw_1_2/demos/SubClassing.py | 128 ++
Pmw/Pmw_1_2/demos/TextDialog.py | 75 +
Pmw/Pmw_1_2/demos/TextDisplay.py | 78 +
Pmw/Pmw_1_2/demos/TimeCounter.py | 40 +
Pmw/Pmw_1_2/demos/WidgetDestroy.py | 36 +
Pmw/Pmw_1_2/doc/AboutDialog.gif | Bin 0 -> 4081 bytes
Pmw/Pmw_1_2/doc/AboutDialog.html | 286 +++
Pmw/Pmw_1_2/doc/Balloon.gif | Bin 0 -> 4660 bytes
Pmw/Pmw_1_2/doc/Balloon.html | 429 ++++
Pmw/Pmw_1_2/doc/Blt.html | 135 ++
Pmw/Pmw_1_2/doc/ButtonBox.gif | Bin 0 -> 964 bytes
Pmw/Pmw_1_2/doc/ButtonBox.html | 306 +++
Pmw/Pmw_1_2/doc/Color.html | 326 +++
Pmw/Pmw_1_2/doc/ComboBox.gif | Bin 0 -> 4556 bytes
Pmw/Pmw_1_2/doc/ComboBox.html | 363 ++++
Pmw/Pmw_1_2/doc/ComboBoxDialog.gif | Bin 0 -> 3484 bytes
Pmw/Pmw_1_2/doc/ComboBoxDialog.html | 286 +++
Pmw/Pmw_1_2/doc/Counter.gif | Bin 0 -> 2212 bytes
Pmw/Pmw_1_2/doc/Counter.html | 455 ++++
Pmw/Pmw_1_2/doc/CounterDialog.gif | Bin 0 -> 2769 bytes
Pmw/Pmw_1_2/doc/CounterDialog.html | 299 +++
Pmw/Pmw_1_2/doc/Dialog.gif | Bin 0 -> 2855 bytes
Pmw/Pmw_1_2/doc/Dialog.html | 286 +++
Pmw/Pmw_1_2/doc/EntryField.gif | Bin 0 -> 2228 bytes
Pmw/Pmw_1_2/doc/EntryField.html | 545 +++++
Pmw/Pmw_1_2/doc/ExampleDemo.py | 33 +
Pmw/Pmw_1_2/doc/Group.gif | Bin 0 -> 2155 bytes
Pmw/Pmw_1_2/doc/Group.html | 226 ++
Pmw/Pmw_1_2/doc/HistoryText.gif | Bin 0 -> 2298 bytes
Pmw/Pmw_1_2/doc/HistoryText.html | 427 ++++
Pmw/Pmw_1_2/doc/LabeledWidget.gif | Bin 0 -> 887 bytes
Pmw/Pmw_1_2/doc/LabeledWidget.html | 170 ++
Pmw/Pmw_1_2/doc/MainMenuBar.gif | Bin 0 -> 518 bytes
Pmw/Pmw_1_2/doc/MainMenuBar.html | 421 ++++
Pmw/Pmw_1_2/doc/MegaArchetype.html | 459 ++++
Pmw/Pmw_1_2/doc/MegaToplevel.html | 267 +++
Pmw/Pmw_1_2/doc/MegaWidget.html | 83 +
Pmw/Pmw_1_2/doc/MenuBar.gif | Bin 0 -> 518 bytes
Pmw/Pmw_1_2/doc/MenuBar.html | 399 ++++
Pmw/Pmw_1_2/doc/MessageBar.gif | Bin 0 -> 435 bytes
Pmw/Pmw_1_2/doc/MessageBar.html | 302 +++
Pmw/Pmw_1_2/doc/MessageDialog.gif | Bin 0 -> 3374 bytes
Pmw/Pmw_1_2/doc/MessageDialog.html | 326 +++
Pmw/Pmw_1_2/doc/NoteBook.gif | Bin 0 -> 2585 bytes
Pmw/Pmw_1_2/doc/NoteBook.html | 344 +++
Pmw/Pmw_1_2/doc/OptionMenu.gif | Bin 0 -> 2354 bytes
Pmw/Pmw_1_2/doc/OptionMenu.html | 289 +++
Pmw/Pmw_1_2/doc/PanedWidget.gif | Bin 0 -> 1917 bytes
Pmw/Pmw_1_2/doc/PanedWidget.html | 345 +++
Pmw/Pmw_1_2/doc/PmwFunctions.html | 766 +++++++
Pmw/Pmw_1_2/doc/PromptDialog.gif | Bin 0 -> 1959 bytes
Pmw/Pmw_1_2/doc/PromptDialog.html | 293 +++
Pmw/Pmw_1_2/doc/RadioSelect.gif | Bin 0 -> 4476 bytes
Pmw/Pmw_1_2/doc/RadioSelect.html | 405 ++++
Pmw/Pmw_1_2/doc/ScrolledCanvas.gif | Bin 0 -> 2931 bytes
Pmw/Pmw_1_2/doc/ScrolledCanvas.html | 352 +++
Pmw/Pmw_1_2/doc/ScrolledField.gif | Bin 0 -> 615 bytes
Pmw/Pmw_1_2/doc/ScrolledField.html | 187 ++
Pmw/Pmw_1_2/doc/ScrolledFrame.gif | Bin 0 -> 3926 bytes
Pmw/Pmw_1_2/doc/ScrolledFrame.html | 479 ++++
Pmw/Pmw_1_2/doc/ScrolledListBox.gif | Bin 0 -> 1855 bytes
Pmw/Pmw_1_2/doc/ScrolledListBox.html | 379 ++++
Pmw/Pmw_1_2/doc/ScrolledText.gif | Bin 0 -> 12007 bytes
Pmw/Pmw_1_2/doc/ScrolledText.html | 409 ++++
Pmw/Pmw_1_2/doc/ScrolledText_test.py | 116 +
Pmw/Pmw_1_2/doc/SelectionDialog.gif | Bin 0 -> 3204 bytes
Pmw/Pmw_1_2/doc/SelectionDialog.html | 281 +++
Pmw/Pmw_1_2/doc/TextDialog.gif | Bin 0 -> 4953 bytes
Pmw/Pmw_1_2/doc/TextDialog.html | 301 +++
Pmw/Pmw_1_2/doc/TimeCounter.gif | Bin 0 -> 1077 bytes
Pmw/Pmw_1_2/doc/TimeCounter.html | 363 ++++
Pmw/Pmw_1_2/doc/blue_line.gif | Bin 0 -> 981 bytes
Pmw/Pmw_1_2/doc/blueball.gif | Bin 0 -> 318 bytes
Pmw/Pmw_1_2/doc/bugs.html | 378 ++++
Pmw/Pmw_1_2/doc/changes.html | 1741 +++++++++++++++
Pmw/Pmw_1_2/doc/copyright.html | 57 +
Pmw/Pmw_1_2/doc/counter1.gif | Bin 0 -> 541 bytes
Pmw/Pmw_1_2/doc/counter2.gif | Bin 0 -> 1333 bytes
Pmw/Pmw_1_2/doc/demosandtests.html | 364 ++++
Pmw/Pmw_1_2/doc/dynamicloader.html | 147 ++
Pmw/Pmw_1_2/doc/example.py | 79 +
Pmw/Pmw_1_2/doc/example1.gif | Bin 0 -> 1546 bytes
Pmw/Pmw_1_2/doc/example2.gif | Bin 0 -> 1556 bytes
Pmw/Pmw_1_2/doc/exercises.py | 123 ++
Pmw/Pmw_1_2/doc/features.html | 87 +
Pmw/Pmw_1_2/doc/halfblueball.gif | Bin 0 -> 299 bytes
Pmw/Pmw_1_2/doc/howtobuild.html | 465 ++++
Pmw/Pmw_1_2/doc/howtouse.html | 719 ++++++
Pmw/Pmw_1_2/doc/index.html | 131 ++
Pmw/Pmw_1_2/doc/porting.html | 325 +++
Pmw/Pmw_1_2/doc/refindex.html | 79 +
Pmw/Pmw_1_2/doc/scale1.gif | Bin 0 -> 1016 bytes
Pmw/Pmw_1_2/doc/scale2.gif | Bin 0 -> 1943 bytes
Pmw/Pmw_1_2/doc/starting.html | 382 ++++
Pmw/Pmw_1_2/doc/todo.html | 1111 ++++++++++
Pmw/Pmw_1_2/doc/transdove.gif | Bin 0 -> 438 bytes
Pmw/Pmw_1_2/lib/Pmw.def | 58 +
Pmw/Pmw_1_2/lib/PmwAboutDialog.py | 52 +
Pmw/Pmw_1_2/lib/PmwBalloon.py | 365 ++++
Pmw/Pmw_1_2/lib/PmwBase.py | 1933 +++++++++++++++++
Pmw/Pmw_1_2/lib/PmwBlt.py | 643 ++++++
Pmw/Pmw_1_2/lib/PmwButtonBox.py | 224 ++
Pmw/Pmw_1_2/lib/PmwColor.py | 361 +++
Pmw/Pmw_1_2/lib/PmwComboBox.py | 382 ++++
Pmw/Pmw_1_2/lib/PmwComboBoxDialog.py | 60 +
Pmw/Pmw_1_2/lib/PmwCounter.py | 373 ++++
Pmw/Pmw_1_2/lib/PmwCounterDialog.py | 54 +
Pmw/Pmw_1_2/lib/PmwDialog.py | 184 ++
Pmw/Pmw_1_2/lib/PmwEntryField.py | 458 ++++
Pmw/Pmw_1_2/lib/PmwGroup.py | 113 +
Pmw/Pmw_1_2/lib/PmwHistoryText.py | 145 ++
Pmw/Pmw_1_2/lib/PmwLabeledWidget.py | 34 +
Pmw/Pmw_1_2/lib/PmwLoader.py | 174 ++
Pmw/Pmw_1_2/lib/PmwLogicalFont.py | 191 ++
Pmw/Pmw_1_2/lib/PmwMainMenuBar.py | 225 ++
Pmw/Pmw_1_2/lib/PmwMenuBar.py | 243 +++
Pmw/Pmw_1_2/lib/PmwMessageBar.py | 143 ++
Pmw/Pmw_1_2/lib/PmwMessageDialog.py | 73 +
Pmw/Pmw_1_2/lib/PmwNoteBook.py | 617 ++++++
Pmw/Pmw_1_2/lib/PmwOptionMenu.py | 146 ++
Pmw/Pmw_1_2/lib/PmwPanedWidget.py | 627 ++++++
Pmw/Pmw_1_2/lib/PmwPromptDialog.py | 51 +
Pmw/Pmw_1_2/lib/PmwRadioSelect.py | 234 ++
Pmw/Pmw_1_2/lib/PmwScrolledCanvas.py | 289 +++
Pmw/Pmw_1_2/lib/PmwScrolledField.py | 53 +
Pmw/Pmw_1_2/lib/PmwScrolledFrame.py | 395 ++++
Pmw/Pmw_1_2/lib/PmwScrolledListBox.py | 376 ++++
Pmw/Pmw_1_2/lib/PmwScrolledText.py | 443 ++++
Pmw/Pmw_1_2/lib/PmwSelectionDialog.py | 55 +
Pmw/Pmw_1_2/lib/PmwTextDialog.py | 38 +
Pmw/Pmw_1_2/lib/PmwTimeCounter.py | 381 ++++
Pmw/Pmw_1_2/lib/PmwTimeFuncs.py | 146 ++
Pmw/Pmw_1_2/lib/__init__.py | 1 +
Pmw/Pmw_1_2/tests/AboutDialog_test.py | 59 +
Pmw/Pmw_1_2/tests/All.py | 35 +
Pmw/Pmw_1_2/tests/Blt_test.py | 356 +++
Pmw/Pmw_1_2/tests/ButtonBox_test.py | 71 +
Pmw/Pmw_1_2/tests/Colors_test.py | 46 +
Pmw/Pmw_1_2/tests/ComboBox_test.py | 184 ++
Pmw/Pmw_1_2/tests/CounterDialog_test.py | 98 +
Pmw/Pmw_1_2/tests/Counter_test.py | 188 ++
Pmw/Pmw_1_2/tests/Dialog_test.py | 122 ++
Pmw/Pmw_1_2/tests/EntryField_test.py | 109 +
Pmw/Pmw_1_2/tests/LabeledWidget_test.py | 49 +
Pmw/Pmw_1_2/tests/ManualTests.py | 488 +++++
Pmw/Pmw_1_2/tests/MegaWidget_test.py | 129 ++
Pmw/Pmw_1_2/tests/MessageDialog_test.py | 58 +
Pmw/Pmw_1_2/tests/NoteBook_test.py | 173 ++
Pmw/Pmw_1_2/tests/OptionMenu_test.py | 53 +
Pmw/Pmw_1_2/tests/Options_test.py | 304 +++
Pmw/Pmw_1_2/tests/PanedWidget_test.py | 39 +
Pmw/Pmw_1_2/tests/PmwBase_test.py | 181 ++
Pmw/Pmw_1_2/tests/PromptDialog_test.py | 81 +
Pmw/Pmw_1_2/tests/RadioSelect_test.py | 112 +
Pmw/Pmw_1_2/tests/ScrolledCanvas_test.py | 105 +
Pmw/Pmw_1_2/tests/ScrolledField_test.py | 32 +
Pmw/Pmw_1_2/tests/ScrolledFrame_test.py | 98 +
Pmw/Pmw_1_2/tests/ScrolledListBox_test.py | 151 ++
Pmw/Pmw_1_2/tests/ScrolledText_test.py | 116 +
Pmw/Pmw_1_2/tests/SelectionDialog_test.py | 69 +
Pmw/Pmw_1_2/tests/Test.py | 521 +++++
Pmw/Pmw_1_2/tests/TestVersion.py | 19 +
Pmw/Pmw_1_2/tests/TextDialog_test.py | 53 +
Pmw/Pmw_1_2/tests/Tkinter_test.py | 393 ++++
Pmw/Pmw_1_2/tests/earthris.gif | Bin 0 -> 6343 bytes
Pmw/Pmw_1_2/tests/flagup.bmp | 27 +
Pmw/README | 10 +
Pmw/__init__.py | 40 +
253 files changed, 42861 insertions(+), 980 deletions(-)
create mode 100644 Accas/A_AU_PLUS_UN.py
create mode 100644 Aster/Cata/Macro/calc_fonction_ops.py
create mode 100644 Aster/Cata/Macro/info_fonction_ops.py
delete mode 100644 Aster/Cata/Macro/macro_cara_poutre_ops.py
delete mode 100644 Aster/Cata/Macro/pre_gmsh_ops.py
create mode 100644 Pmw/Alpha_99_9_example/__init__.py
create mode 100644 Pmw/Alpha_99_9_example/lib/Pmw.def
create mode 100644 Pmw/Alpha_99_9_example/lib/PmwAlphaExample.py
create mode 100644 Pmw/Alpha_99_9_example/lib/__init__.py
create mode 100644 Pmw/Pmw_1_2/__init__.py
create mode 100755 Pmw/Pmw_1_2/bin/bundlepmw.py
create mode 100644 Pmw/Pmw_1_2/contrib/DirBrowser.py
create mode 100644 Pmw/Pmw_1_2/contrib/MCListbox.py
create mode 100644 Pmw/Pmw_1_2/contrib/PmwFileDialog.py
create mode 100644 Pmw/Pmw_1_2/contrib/PmwFullTimeCounter.py
create mode 100644 Pmw/Pmw_1_2/contrib/PmwVerticalGauge.py
create mode 100644 Pmw/Pmw_1_2/contrib/README
create mode 100644 Pmw/Pmw_1_2/contrib/TreeBrowser.py
create mode 100644 Pmw/Pmw_1_2/demos/AboutDialog.py
create mode 100755 Pmw/Pmw_1_2/demos/All.py
create mode 100644 Pmw/Pmw_1_2/demos/Args.py
create mode 100644 Pmw/Pmw_1_2/demos/Balloon.py
create mode 100644 Pmw/Pmw_1_2/demos/BltGraph.py
create mode 100644 Pmw/Pmw_1_2/demos/BltTabset.py
create mode 100644 Pmw/Pmw_1_2/demos/ButtonBox.py
create mode 100644 Pmw/Pmw_1_2/demos/Colors.py
create mode 100644 Pmw/Pmw_1_2/demos/ComboBox.py
create mode 100644 Pmw/Pmw_1_2/demos/ComboBoxDialog.py
create mode 100644 Pmw/Pmw_1_2/demos/ConfigClass.py
create mode 100644 Pmw/Pmw_1_2/demos/Counter.py
create mode 100644 Pmw/Pmw_1_2/demos/CounterDialog.py
create mode 100644 Pmw/Pmw_1_2/demos/DemoVersion.py
create mode 100644 Pmw/Pmw_1_2/demos/Dialog.py
create mode 100644 Pmw/Pmw_1_2/demos/EntryField.py
create mode 100644 Pmw/Pmw_1_2/demos/ErrorHandling.py
create mode 100644 Pmw/Pmw_1_2/demos/ExampleDemo.py
create mode 100644 Pmw/Pmw_1_2/demos/Grid.py
create mode 100644 Pmw/Pmw_1_2/demos/Group.py
create mode 100644 Pmw/Pmw_1_2/demos/HistoryText.py
create mode 100644 Pmw/Pmw_1_2/demos/LabeledWidget.py
create mode 100644 Pmw/Pmw_1_2/demos/LogicalFont.py
create mode 100644 Pmw/Pmw_1_2/demos/MainMenuBar.py
create mode 100644 Pmw/Pmw_1_2/demos/MenuBar.py
create mode 100644 Pmw/Pmw_1_2/demos/MessageBar.py
create mode 100644 Pmw/Pmw_1_2/demos/MessageDialog.py
create mode 100644 Pmw/Pmw_1_2/demos/MessageInfo.py
create mode 100644 Pmw/Pmw_1_2/demos/MultiLineLabel.py
create mode 100644 Pmw/Pmw_1_2/demos/NestedDialogs.py
create mode 100644 Pmw/Pmw_1_2/demos/NoteBook.py
create mode 100644 Pmw/Pmw_1_2/demos/NoteBook_2.py
create mode 100644 Pmw/Pmw_1_2/demos/NoteBook_3.py
create mode 100644 Pmw/Pmw_1_2/demos/OptionMenu.py
create mode 100644 Pmw/Pmw_1_2/demos/PanedWidget.py
create mode 100644 Pmw/Pmw_1_2/demos/PanedWidget_2.py
create mode 100644 Pmw/Pmw_1_2/demos/PromptDialog.py
create mode 100644 Pmw/Pmw_1_2/demos/RadioSelect.py
create mode 100644 Pmw/Pmw_1_2/demos/Resources.py
create mode 100644 Pmw/Pmw_1_2/demos/Resources_Pmw.py
create mode 100644 Pmw/Pmw_1_2/demos/ScrolledCanvas.py
create mode 100644 Pmw/Pmw_1_2/demos/ScrolledField.py
create mode 100644 Pmw/Pmw_1_2/demos/ScrolledFrame.py
create mode 100644 Pmw/Pmw_1_2/demos/ScrolledListBox.py
create mode 100644 Pmw/Pmw_1_2/demos/ScrolledText.py
create mode 100644 Pmw/Pmw_1_2/demos/ScrolledText_2.py
create mode 100644 Pmw/Pmw_1_2/demos/SelectionDialog.py
create mode 100644 Pmw/Pmw_1_2/demos/ShowBusy.py
create mode 100644 Pmw/Pmw_1_2/demos/SpecialCounter.py
create mode 100644 Pmw/Pmw_1_2/demos/SpecialEntry.py
create mode 100644 Pmw/Pmw_1_2/demos/Spectrum.py
create mode 100644 Pmw/Pmw_1_2/demos/SpeedTest.py
create mode 100644 Pmw/Pmw_1_2/demos/SubClassing.py
create mode 100644 Pmw/Pmw_1_2/demos/TextDialog.py
create mode 100644 Pmw/Pmw_1_2/demos/TextDisplay.py
create mode 100644 Pmw/Pmw_1_2/demos/TimeCounter.py
create mode 100644 Pmw/Pmw_1_2/demos/WidgetDestroy.py
create mode 100644 Pmw/Pmw_1_2/doc/AboutDialog.gif
create mode 100644 Pmw/Pmw_1_2/doc/AboutDialog.html
create mode 100644 Pmw/Pmw_1_2/doc/Balloon.gif
create mode 100644 Pmw/Pmw_1_2/doc/Balloon.html
create mode 100644 Pmw/Pmw_1_2/doc/Blt.html
create mode 100644 Pmw/Pmw_1_2/doc/ButtonBox.gif
create mode 100644 Pmw/Pmw_1_2/doc/ButtonBox.html
create mode 100644 Pmw/Pmw_1_2/doc/Color.html
create mode 100644 Pmw/Pmw_1_2/doc/ComboBox.gif
create mode 100644 Pmw/Pmw_1_2/doc/ComboBox.html
create mode 100644 Pmw/Pmw_1_2/doc/ComboBoxDialog.gif
create mode 100644 Pmw/Pmw_1_2/doc/ComboBoxDialog.html
create mode 100644 Pmw/Pmw_1_2/doc/Counter.gif
create mode 100644 Pmw/Pmw_1_2/doc/Counter.html
create mode 100644 Pmw/Pmw_1_2/doc/CounterDialog.gif
create mode 100644 Pmw/Pmw_1_2/doc/CounterDialog.html
create mode 100644 Pmw/Pmw_1_2/doc/Dialog.gif
create mode 100644 Pmw/Pmw_1_2/doc/Dialog.html
create mode 100644 Pmw/Pmw_1_2/doc/EntryField.gif
create mode 100644 Pmw/Pmw_1_2/doc/EntryField.html
create mode 100644 Pmw/Pmw_1_2/doc/ExampleDemo.py
create mode 100644 Pmw/Pmw_1_2/doc/Group.gif
create mode 100644 Pmw/Pmw_1_2/doc/Group.html
create mode 100644 Pmw/Pmw_1_2/doc/HistoryText.gif
create mode 100644 Pmw/Pmw_1_2/doc/HistoryText.html
create mode 100644 Pmw/Pmw_1_2/doc/LabeledWidget.gif
create mode 100644 Pmw/Pmw_1_2/doc/LabeledWidget.html
create mode 100644 Pmw/Pmw_1_2/doc/MainMenuBar.gif
create mode 100644 Pmw/Pmw_1_2/doc/MainMenuBar.html
create mode 100644 Pmw/Pmw_1_2/doc/MegaArchetype.html
create mode 100644 Pmw/Pmw_1_2/doc/MegaToplevel.html
create mode 100644 Pmw/Pmw_1_2/doc/MegaWidget.html
create mode 100644 Pmw/Pmw_1_2/doc/MenuBar.gif
create mode 100644 Pmw/Pmw_1_2/doc/MenuBar.html
create mode 100644 Pmw/Pmw_1_2/doc/MessageBar.gif
create mode 100644 Pmw/Pmw_1_2/doc/MessageBar.html
create mode 100644 Pmw/Pmw_1_2/doc/MessageDialog.gif
create mode 100644 Pmw/Pmw_1_2/doc/MessageDialog.html
create mode 100644 Pmw/Pmw_1_2/doc/NoteBook.gif
create mode 100644 Pmw/Pmw_1_2/doc/NoteBook.html
create mode 100644 Pmw/Pmw_1_2/doc/OptionMenu.gif
create mode 100644 Pmw/Pmw_1_2/doc/OptionMenu.html
create mode 100644 Pmw/Pmw_1_2/doc/PanedWidget.gif
create mode 100644 Pmw/Pmw_1_2/doc/PanedWidget.html
create mode 100644 Pmw/Pmw_1_2/doc/PmwFunctions.html
create mode 100644 Pmw/Pmw_1_2/doc/PromptDialog.gif
create mode 100644 Pmw/Pmw_1_2/doc/PromptDialog.html
create mode 100644 Pmw/Pmw_1_2/doc/RadioSelect.gif
create mode 100644 Pmw/Pmw_1_2/doc/RadioSelect.html
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledCanvas.gif
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledCanvas.html
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledField.gif
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledField.html
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledFrame.gif
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledFrame.html
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledListBox.gif
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledListBox.html
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledText.gif
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledText.html
create mode 100644 Pmw/Pmw_1_2/doc/ScrolledText_test.py
create mode 100644 Pmw/Pmw_1_2/doc/SelectionDialog.gif
create mode 100644 Pmw/Pmw_1_2/doc/SelectionDialog.html
create mode 100644 Pmw/Pmw_1_2/doc/TextDialog.gif
create mode 100644 Pmw/Pmw_1_2/doc/TextDialog.html
create mode 100644 Pmw/Pmw_1_2/doc/TimeCounter.gif
create mode 100644 Pmw/Pmw_1_2/doc/TimeCounter.html
create mode 100644 Pmw/Pmw_1_2/doc/blue_line.gif
create mode 100644 Pmw/Pmw_1_2/doc/blueball.gif
create mode 100644 Pmw/Pmw_1_2/doc/bugs.html
create mode 100644 Pmw/Pmw_1_2/doc/changes.html
create mode 100644 Pmw/Pmw_1_2/doc/copyright.html
create mode 100644 Pmw/Pmw_1_2/doc/counter1.gif
create mode 100644 Pmw/Pmw_1_2/doc/counter2.gif
create mode 100644 Pmw/Pmw_1_2/doc/demosandtests.html
create mode 100644 Pmw/Pmw_1_2/doc/dynamicloader.html
create mode 100644 Pmw/Pmw_1_2/doc/example.py
create mode 100644 Pmw/Pmw_1_2/doc/example1.gif
create mode 100644 Pmw/Pmw_1_2/doc/example2.gif
create mode 100644 Pmw/Pmw_1_2/doc/exercises.py
create mode 100644 Pmw/Pmw_1_2/doc/features.html
create mode 100644 Pmw/Pmw_1_2/doc/halfblueball.gif
create mode 100644 Pmw/Pmw_1_2/doc/howtobuild.html
create mode 100644 Pmw/Pmw_1_2/doc/howtouse.html
create mode 100644 Pmw/Pmw_1_2/doc/index.html
create mode 100644 Pmw/Pmw_1_2/doc/porting.html
create mode 100644 Pmw/Pmw_1_2/doc/refindex.html
create mode 100644 Pmw/Pmw_1_2/doc/scale1.gif
create mode 100644 Pmw/Pmw_1_2/doc/scale2.gif
create mode 100644 Pmw/Pmw_1_2/doc/starting.html
create mode 100644 Pmw/Pmw_1_2/doc/todo.html
create mode 100644 Pmw/Pmw_1_2/doc/transdove.gif
create mode 100644 Pmw/Pmw_1_2/lib/Pmw.def
create mode 100644 Pmw/Pmw_1_2/lib/PmwAboutDialog.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwBalloon.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwBase.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwBlt.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwButtonBox.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwColor.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwComboBox.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwComboBoxDialog.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwCounter.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwCounterDialog.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwDialog.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwEntryField.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwGroup.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwHistoryText.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwLabeledWidget.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwLoader.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwLogicalFont.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwMainMenuBar.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwMenuBar.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwMessageBar.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwMessageDialog.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwNoteBook.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwOptionMenu.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwPanedWidget.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwPromptDialog.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwRadioSelect.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwScrolledCanvas.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwScrolledField.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwScrolledFrame.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwScrolledListBox.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwScrolledText.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwSelectionDialog.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwTextDialog.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwTimeCounter.py
create mode 100644 Pmw/Pmw_1_2/lib/PmwTimeFuncs.py
create mode 100644 Pmw/Pmw_1_2/lib/__init__.py
create mode 100644 Pmw/Pmw_1_2/tests/AboutDialog_test.py
create mode 100755 Pmw/Pmw_1_2/tests/All.py
create mode 100644 Pmw/Pmw_1_2/tests/Blt_test.py
create mode 100644 Pmw/Pmw_1_2/tests/ButtonBox_test.py
create mode 100644 Pmw/Pmw_1_2/tests/Colors_test.py
create mode 100644 Pmw/Pmw_1_2/tests/ComboBox_test.py
create mode 100644 Pmw/Pmw_1_2/tests/CounterDialog_test.py
create mode 100644 Pmw/Pmw_1_2/tests/Counter_test.py
create mode 100644 Pmw/Pmw_1_2/tests/Dialog_test.py
create mode 100644 Pmw/Pmw_1_2/tests/EntryField_test.py
create mode 100644 Pmw/Pmw_1_2/tests/LabeledWidget_test.py
create mode 100755 Pmw/Pmw_1_2/tests/ManualTests.py
create mode 100644 Pmw/Pmw_1_2/tests/MegaWidget_test.py
create mode 100644 Pmw/Pmw_1_2/tests/MessageDialog_test.py
create mode 100644 Pmw/Pmw_1_2/tests/NoteBook_test.py
create mode 100644 Pmw/Pmw_1_2/tests/OptionMenu_test.py
create mode 100644 Pmw/Pmw_1_2/tests/Options_test.py
create mode 100644 Pmw/Pmw_1_2/tests/PanedWidget_test.py
create mode 100644 Pmw/Pmw_1_2/tests/PmwBase_test.py
create mode 100644 Pmw/Pmw_1_2/tests/PromptDialog_test.py
create mode 100644 Pmw/Pmw_1_2/tests/RadioSelect_test.py
create mode 100644 Pmw/Pmw_1_2/tests/ScrolledCanvas_test.py
create mode 100644 Pmw/Pmw_1_2/tests/ScrolledField_test.py
create mode 100644 Pmw/Pmw_1_2/tests/ScrolledFrame_test.py
create mode 100644 Pmw/Pmw_1_2/tests/ScrolledListBox_test.py
create mode 100644 Pmw/Pmw_1_2/tests/ScrolledText_test.py
create mode 100644 Pmw/Pmw_1_2/tests/SelectionDialog_test.py
create mode 100644 Pmw/Pmw_1_2/tests/Test.py
create mode 100644 Pmw/Pmw_1_2/tests/TestVersion.py
create mode 100644 Pmw/Pmw_1_2/tests/TextDialog_test.py
create mode 100644 Pmw/Pmw_1_2/tests/Tkinter_test.py
create mode 100644 Pmw/Pmw_1_2/tests/earthris.gif
create mode 100644 Pmw/Pmw_1_2/tests/flagup.bmp
create mode 100644 Pmw/README
create mode 100644 Pmw/__init__.py
diff --git a/Accas/A_AU_PLUS_UN.py b/Accas/A_AU_PLUS_UN.py
new file mode 100644
index 00000000..e7742703
--- /dev/null
+++ b/Accas/A_AU_PLUS_UN.py
@@ -0,0 +1,29 @@
+#@ MODIF A_AU_PLUS_UN Accas DATE 28/01/2005 AUTEUR VABHHTS J.PELLET
+# -*- coding: iso-8859-1 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2005 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+# ======================================================================
+
+from Noyau import N_REGLE
+from Validation import V_AU_PLUS_UN
+
+class AU_PLUS_UN(V_AU_PLUS_UN.AU_PLUS_UN,N_REGLE.REGLE):
+ """
+ La classe utilise l'initialiseur de REGLE. Il n'est pas
+ nécessaire d'expliciter son initialiseur car
+ V_AU_PLUS_UN.AU_PLUS_UN n'en a pas
+ """
diff --git a/Accas/__init__.py b/Accas/__init__.py
index e8414f9c..21636df6 100644
--- a/Accas/__init__.py
+++ b/Accas/__init__.py
@@ -52,6 +52,7 @@ from A_MCSIMP import MCSIMP
# Les règles
from A_AU_MOINS_UN import AU_MOINS_UN
+from A_AU_PLUS_UN import AU_PLUS_UN
from A_UN_PARMI import UN_PARMI
from A_PRESENT_PRESENT import PRESENT_PRESENT
from A_PRESENT_ABSENT import PRESENT_ABSENT
diff --git a/Aster/Cata/Macro/__init__.py b/Aster/Cata/Macro/__init__.py
index 4aebb58b..a23fff6f 100644
--- a/Aster/Cata/Macro/__init__.py
+++ b/Aster/Cata/Macro/__init__.py
@@ -19,3 +19,6 @@
#
#
# ======================================================================
+print 80
+import traceback
+traceback.print_stack()
diff --git a/Aster/Cata/Macro/calc_fonction_ops.py b/Aster/Cata/Macro/calc_fonction_ops.py
new file mode 100644
index 00000000..8a2907bb
--- /dev/null
+++ b/Aster/Cata/Macro/calc_fonction_ops.py
@@ -0,0 +1,322 @@
+#@ MODIF calc_fonction_ops Macro DATE 12/05/2005 AUTEUR DURAND C.DURAND
+# -*- coding: iso-8859-1 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2005 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+# ======================================================================
+
+
+def tocomplex(arg):
+ if arg[0]=='RI' : return complex(arg[1],arg[2])
+ if arg[0]=='MP' : return complex(arg[1]*cos(arg[2]),arg[1]*sin(arg[2]))
+
+def calc_fonction_ops(self,FFT,DERIVE,INTEGRE,LISS_ENVELOP,
+ SPEC_OSCI,ABS,COMB,COMB_C,COMPOSE,EXTRACTION,
+ ENVELOPPE,ASSE,CORR_ACCE,PUISSANCE,INVERSE,
+ NOM_PARA,NOM_RESU,INTERPOL,PROL_DROITE,
+ PROL_GAUCHE,NOM_PARA_FONC,INTERPOL_FONC,PROL_DROITE_FONC,
+ PROL_GAUCHE_FONC,**args):
+ """
+ Ecriture de la macro CALC_FONCTION
+ """
+ ier=0
+ import types
+ import string
+ import copy
+ from math import pi
+ from Utilitai.t_fonction import t_fonction,t_fonction_c,t_nappe
+ from Accas import _F
+ from Cata.cata import nappe_sdaster,fonction_sdaster,fonction_c
+ from Utilitai.Utmess import UTMESS
+ from Numeric import alltrue,less,array,reshape,cos,sin,exp,sqrt
+ from Numeric import choose,zeros,Float
+ import aster_fonctions
+
+ ### On importe les definitions des commandes a utiliser dans la macro
+ DEFI_FONCTION = self.get_cmd('DEFI_FONCTION')
+ DEFI_NAPPE = self.get_cmd('DEFI_NAPPE')
+
+ ### Comptage commandes + déclaration concept sortant
+ self.set_icmd(1)
+ self.DeclareOut('C_out',self.sd)
+
+ ### type de traitement
+ ###
+ if (INTEGRE != None):
+ __ff=INTEGRE['FONCTION'].convert()
+ if INTEGRE['METHODE']=='TRAPEZE' : __ex=__ff.trapeze(INTEGRE['COEF'])
+ if INTEGRE['METHODE']=='SIMPSON' : __ex=__ff.simpson(INTEGRE['COEF'])
+ ###
+ if (DERIVE != None):
+ __ff=DERIVE['FONCTION'].convert()
+ __ex=__ff.derive()
+ ###
+ if (INVERSE != None):
+ __ff=INVERSE['FONCTION'].convert()
+ __ex=__ff.inverse()
+ ###
+ if (ABS != None):
+ __ff=ABS['FONCTION'].convert()
+ __ex=__ff.abs()
+ ###
+ if (COMPOSE != None):
+ __ff=COMPOSE['FONC_RESU'].convert()
+ __fg=COMPOSE['FONC_PARA'].convert()
+ __ex=__ff[__fg]
+ ###
+ if (ASSE != None):
+ __f0=ASSE['FONCTION'][0].convert()
+ __f1=ASSE['FONCTION'][1].convert()
+ __ex=__f0.cat(__f1,ASSE['SURCHARGE'])
+ ###
+ if (COMB != None):
+ if args['LIST_PARA']!=None : vale_x=args['LIST_PARA'].Valeurs()
+ else :
+ vale_x=[]
+ for mcfact in COMB :
+ vale_x=vale_x+mcfact['FONCTION'].Absc()
+ vale_x=dict([(i,0) for i in vale_x]).keys()
+ vale_x.sort()
+ list_fonc=[]
+ if isinstance(self.sd,nappe_sdaster):
+ for mcfact in COMB :
+ list_fonc.append(mcfact['FONCTION'].convert())
+ list_fonch=[]
+ for f in list_fonc :
+ __ex=f
+ for g in list_fonc :
+ __ex=__ex.homo_support(g)
+ list_fonch.append(__ex)
+ list_fonc=list_fonch
+ elif isinstance(self.sd,fonction_sdaster):
+ for mcfact in COMB :
+ __ex=mcfact['FONCTION'].convert()
+ list_fonc.append(__ex.evalfonc(vale_x))
+
+ __ex=list_fonc[0]
+ __ex=__ex*COMB[0]['COEF']
+ i=1
+ for item in list_fonc[1:] :
+ item=item*COMB[i]['COEF']
+ __ex=__ex+item
+ i=i+1
+ ###
+ if (COMB_C != None):
+ if args['LIST_PARA']!=None : vale_x=args['LIST_PARA'].Valeurs()
+ else :
+ vale_x=[]
+ for mcfact in COMB_C :
+ vale_x=vale_x+mcfact['FONCTION'].Absc()
+ vale_x=dict([(i,0) for i in vale_x]).keys()
+ vale_x.sort()
+ list_fonc=[]
+ if isinstance(self.sd,nappe_sdaster):
+ for mcfact in COMB_C :
+ list_fonc.append(mcfact['FONCTION'].convert())
+ list_fonch=[]
+ for f in list_fonc :
+ __ex=f
+ for g in list_fonc :
+ __ex=__ex.homo_support(g)
+ list_fonch.appen(__ex)
+ list_fonc=list_fonch
+ elif isinstance(self.sd,fonction_sdaster) or isinstance(self.sd,fonction_c):
+ for mcfact in COMB_C :
+ __ex=mcfact['FONCTION'].convert(arg='complex')
+ list_fonc.append(__ex.evalfonc(vale_x))
+
+ __ex=list_fonc[0]
+ if COMB_C[0]['COEF_R']!=None: __ex=__ex*complex(COMB_C[0]['COEF_R'])
+ if COMB_C[0]['COEF_C']!=None: __ex=__ex*tocomplex(COMB_C[0]['COEF_C'])
+ i=1
+ for item in list_fonc[1:] :
+ if COMB_C[i]['COEF_R']!=None: coef=complex(COMB_C[i]['COEF_R'])
+ if COMB_C[i]['COEF_C']!=None: coef=tocomplex(COMB_C[i]['COEF_C'])
+ item=item*coef
+ __ex=__ex+item
+ i=i+1
+ ###
+ if (PUISSANCE != None):
+ __ff=PUISSANCE['FONCTION'].convert()
+ __ex=__ff
+ for i in range(PUISSANCE['EXPOSANT']-1) : __ex=__ex*__ff
+ ###
+ if (EXTRACTION != None):
+ if EXTRACTION['PARTIE']=='REEL' : __ex=EXTRACTION['FONCTION'].convert(arg='real')
+ if EXTRACTION['PARTIE']=='IMAG' : __ex=EXTRACTION['FONCTION'].convert(arg='imag')
+ if EXTRACTION['PARTIE']=='MODULE' : __ex=EXTRACTION['FONCTION'].convert(arg='modul')
+ if EXTRACTION['PARTIE']=='PHASE' : __ex=EXTRACTION['FONCTION'].convert(arg='phase')
+ ###
+ if (ENVELOPPE != None):
+ list_fonc=[]
+ if isinstance(self.sd,nappe_sdaster):
+ for f in ENVELOPPE['FONCTION'] : list_fonc.append(f.convert())
+ list_fonch=[]
+ for f in list_fonc :
+ __ff=f
+ for g in list_fonc :
+ __ff=__ff.homo_support(g)
+ list_fonch.append(__ff)
+ list_fonc=list_fonch
+ vale_para=list_fonc[0].vale_para
+ para =list_fonc[0].para
+ l_fonc_f =[]
+ for i in range(len(vale_para)):
+ __ff=list_fonc[0].l_fonc[i]
+ if ENVELOPPE['CRITERE']=='SUP' :
+ for f in list_fonc[1:] : __ff=__ff.sup(f.l_fonc[i])
+ if ENVELOPPE['CRITERE']=='INF' :
+ for f in list_fonc[1:] : __ff=__ff.inf(f.l_fonc[i])
+ l_fonc_f.append(__ff)
+ __ex=t_nappe(vale_para,l_fonc_f,para)
+ elif isinstance(self.sd,fonction_sdaster):
+ for f in ENVELOPPE['FONCTION'] : list_fonc.append(f.convert())
+ __ex=list_fonc[0]
+ if ENVELOPPE['CRITERE']=='SUP' :
+ for f in list_fonc[1:] : __ex=__ex.sup(f)
+ if ENVELOPPE['CRITERE']=='INF' :
+ for f in list_fonc[1:] : __ex=__ex.inf(f)
+ ###
+ if (CORR_ACCE != None):
+ __ex=CORR_ACCE['FONCTION'].convert()
+ para=copy.copy(__ex.para)
+ # suppression de la tendance de l accelero
+ __ex=__ex.suppr_tend()
+ # calcul de la vitesse
+ __ex=__ex.trapeze(0.)
+ # calcul de la tendance de la vitesse : y = a1*x +a0
+ __ex=__ex.suppr_tend()
+ if CORR_ACCE['CORR_DEPL']=='OUI':
+ # suppression de la tendance deplacement
+ # calcul du deplacement : integration
+ __ex=__ex.trapeze(0.)
+ # calcul de la tendance du déplacement : y = a1*x +a0
+ __ex=__ex.suppr_tend()
+ # regeneration de la vitesse : derivation
+ __ex=__ex.derive()
+ # regeneration de l accelero : derivation
+ __ex=__ex.derive()
+ __ex.para=para
+ ###
+ if (FFT != None):
+ if isinstance(self.sd,fonction_c):
+ __ff=FFT['FONCTION'].convert()
+ __ex=__ff.fft(FFT['METHODE'])
+ if isinstance(self.sd,fonction_sdaster):
+ __ff=FFT['FONCTION'].convert(arg='complex')
+ __ex=__ff.fft(FFT['METHODE'],FFT['SYME'])
+ ###
+ if (SPEC_OSCI != None):
+ if SPEC_OSCI['AMOR_REDUIT']==None :
+ l_amor=[0.02,0.05,0.1]
+ UTMESS('I','CALC_FONCTION',' : génération par défaut de 3 amortissements :'+str(l_amor))
+ else :
+ if type(SPEC_OSCI['AMOR_REDUIT']) not in (types.ListType,types.TupleType):
+ l_amor=[SPEC_OSCI['AMOR_REDUIT'],]
+ else : l_amor= SPEC_OSCI['AMOR_REDUIT']
+ if SPEC_OSCI['FREQ']==None and SPEC_OSCI['LIST_FREQ']==None:
+ l_freq=[]
+ for i in range(56) : l_freq.append( 0.2+0.050*i)
+ for i in range( 8) : l_freq.append( 3.0+0.075*i)
+ for i in range(14) : l_freq.append( 3.6+0.100*i)
+ for i in range(24) : l_freq.append( 5.0+0.125*i)
+ for i in range(28) : l_freq.append( 8.0+0.250*i)
+ for i in range( 6) : l_freq.append(15.0+0.500*i)
+ for i in range( 4) : l_freq.append(18.0+1.000*i)
+ for i in range(10) : l_freq.append(22.0+1.500*i)
+ texte=[]
+ for i in range(len(l_freq)/5) :
+ texte.append(' %f %f %f %f %f' %tuple(l_freq[i*5:i*5+5]))
+ UTMESS('I','CALC_FONCTION',' : génération par défaut de 150 fréquences :\n'+'\n'.join(texte))
+ elif SPEC_OSCI['LIST_FREQ']!=None:
+ l_freq=SPEC_OSCI['LIST_FREQ'].Valeurs()
+ elif SPEC_OSCI['FREQ']!=None:
+ if type(SPEC_OSCI['FREQ']) not in (types.ListType,types.TupleType):
+ l_freq=[SPEC_OSCI['FREQ'],]
+ else : l_freq= SPEC_OSCI['FREQ']
+ if abs(SPEC_OSCI['NORME'])<1.E-10 :
+ UTMESS('S','CALC_FONCTION',' : SPEC_OSCI, la norme ne peut etre nulle')
+ if SPEC_OSCI['NATURE_FONC']!='ACCE' :
+ UTMESS('S','CALC_FONCTION',' : SPEC_OSCI, le type de la fonction doit etre ACCE')
+ if SPEC_OSCI['METHODE']!='NIGAM' :
+ UTMESS('S','CALC_FONCTION',' : SPEC_OSCI, seule la méthode NIGAM est codée')
+ eps=1.e-6
+ for amor in l_amor :
+ if amor>(1-eps) :
+ UTMESS('S','CALC_FONCTION',' : SPEC_OSCI, la méthode choisie '\
+ 'suppose des amortissements sous-critiques, amor<1.')
+
+ __ff=SPEC_OSCI['FONCTION'].convert()
+
+ # appel à SPEC_OSCI
+ spectr = aster_fonctions.SPEC_OSCI(__ff.vale_x, __ff.vale_y, l_freq, l_amor)
+
+ # construction de la nappe
+ vale_para = l_amor
+ para = { 'INTERPOL' : ['LIN','LOG'],
+ 'NOM_PARA_FONC' : 'FREQ',
+ 'NOM_PARA' : 'AMOR',
+ 'PROL_DROITE' : 'EXCLU',
+ 'PROL_GAUCHE' : 'EXCLU',
+ 'NOM_RESU' : SPEC_OSCI['NATURE'] }
+ para_fonc = { 'INTERPOL' : ['LOG','LOG'],
+ 'NOM_PARA' : 'FREQ',
+ 'PROL_DROITE' : 'CONSTANT',
+ 'PROL_GAUCHE' : 'EXCLU',
+ 'NOM_RESU' : SPEC_OSCI['NATURE'] }
+ if SPEC_OSCI['NATURE']=='DEPL' : ideb = 0
+ elif SPEC_OSCI['NATURE']=='VITE' : ideb = 1
+ else : ideb = 2
+ l_fonc = []
+ for iamor in range(len(l_amor)) :
+ l_fonc.append(t_fonction(l_freq,spectr[iamor,ideb,:]/SPEC_OSCI['NORME'],para_fonc))
+ __ex=t_nappe(vale_para,l_fonc,para)
+ ###
+ if (LISS_ENVELOP!= None): return
+
+ ### creation de la fonction produite par appel à DEFI_FONCTION
+ ### on récupère les paramètres issus du calcul de __ex
+ ### et on les surcharge par ceux imposés par l'utilisateur
+
+ if isinstance(__ex,t_fonction) or isinstance(__ex,t_fonction_c):
+ para=__ex.para
+ if NOM_PARA !=None : para['NOM_PARA'] =NOM_PARA
+ if NOM_RESU !=None : para['NOM_RESU'] =NOM_RESU
+ if PROL_DROITE!=None : para['PROL_DROITE']=PROL_DROITE
+ if PROL_GAUCHE!=None : para['PROL_GAUCHE']=PROL_GAUCHE
+ if INTERPOL !=None : para['INTERPOL'] =INTERPOL
+ if isinstance(__ex,t_fonction_c): para['VALE_C'] = __ex.tabul()
+ elif isinstance(__ex,t_fonction) : para['VALE'] = __ex.tabul()
+ C_out=DEFI_FONCTION(**para)
+ elif isinstance(__ex,t_nappe):
+ def_fonc=[]
+ for f in __ex.l_fonc :
+ para=f.para
+ def_fonc.append(_F(VALE =f.tabul(),
+ INTERPOL =f.para['INTERPOL'],
+ PROL_DROITE=f.para['PROL_DROITE'],
+ PROL_GAUCHE=f.para['PROL_GAUCHE'],)
+ )
+ para=__ex.para
+ if NOM_PARA !=None : para['NOM_PARA'] =NOM_PARA
+ if NOM_RESU !=None : para['NOM_RESU'] =NOM_RESU
+ if PROL_DROITE !=None : para['PROL_DROITE']=PROL_DROITE
+ if PROL_GAUCHE !=None : para['PROL_GAUCHE']=PROL_GAUCHE
+ if NOM_PARA_FONC !=None : para['NOM_PARA_FONC'] =INTERPOL
+ if INTERPOL_FONC !=None : para['INTERPOL'] =INTERPOL
+ C_out=DEFI_NAPPE(PARA=__ex.vale_para.tolist(),DEFI_FONCTION=def_fonc,**para)
+ return ier
+
diff --git a/Aster/Cata/Macro/calc_precont_ops.py b/Aster/Cata/Macro/calc_precont_ops.py
index b345ca86..a012dfb5 100644
--- a/Aster/Cata/Macro/calc_precont_ops.py
+++ b/Aster/Cata/Macro/calc_precont_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF calc_precont_ops Macro DATE 22/11/2004 AUTEUR LEBOUVIE F.LEBOUVIER
+#@ MODIF calc_precont_ops Macro DATE 07/03/2005 AUTEUR DURAND C.DURAND
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -319,7 +319,7 @@ def calc_precont_ops(self,reuse,MODELE,CHAM_MATER,CARA_ELEM,EXCIT,
# 1.6 Blocage de tous les noeuds des cables actifs
# --------------------------------------------------
- __B_CA=AFFE_CHAR_MECA(MODELE=__M_CA,
+ _B_CA=AFFE_CHAR_MECA(MODELE=__M_CA,
DDL_IMPO= _F( GROUP_MA = __GROUP_MA_A,
DX = 0.,
DY = 0.,
@@ -328,11 +328,11 @@ def calc_precont_ops(self,reuse,MODELE,CHAM_MATER,CARA_ELEM,EXCIT,
# 1.7 Chargements concernant les cables
# -------------------------------------
- __C_CN=AFFE_CHAR_MECA(MODELE=__M_CA,**motscles)
- __C_CA=AFFE_CHAR_MECA(MODELE=MODELE,**motscle2)
- __C_CT=AFFE_CHAR_MECA(MODELE=MODELE,**motscle3)
+ _C_CN=AFFE_CHAR_MECA(MODELE=__M_CA,**motscles)
+ _C_CA=AFFE_CHAR_MECA(MODELE=MODELE,**motscle2)
+ _C_CT=AFFE_CHAR_MECA(MODELE=MODELE,**motscle3)
if CABLE_BP_INACTIF:
- __C_CI=AFFE_CHAR_MECA(MODELE=MODELE,**motscle6)
+ _C_CI=AFFE_CHAR_MECA(MODELE=MODELE,**motscle6)
@@ -343,7 +343,7 @@ def calc_precont_ops(self,reuse,MODELE,CHAM_MATER,CARA_ELEM,EXCIT,
#-------------------------------------------------------------------
# 2.1 Premiere etape : calcul sur le(s) cable(s) et
- # recuperation des __F_CAs aux noeuds
+ # recuperation des _F_CAs aux noeuds
# on travaile entre tmin et tmax
#-------------------------------------------------------------------
@@ -351,8 +351,8 @@ def calc_precont_ops(self,reuse,MODELE,CHAM_MATER,CARA_ELEM,EXCIT,
MODELE = __M_CA,
CHAM_MATER = CHAM_MATER,
CARA_ELEM = CARA_ELEM,
- EXCIT =(_F(CHARGE = __B_CA),
- _F(CHARGE = __C_CN),),
+ EXCIT =(_F(CHARGE = _B_CA),
+ _F(CHARGE = _C_CN),),
COMP_INCR =_F( RELATION = 'ELAS',
DEFORMATION = 'PETIT',
TOUT = 'OUI'),
@@ -382,7 +382,7 @@ def calc_precont_ops(self,reuse,MODELE,CHAM_MATER,CARA_ELEM,EXCIT,
CHAM_GD=__REA,
COEF_R = -1.), )
- __F_CA=AFFE_CHAR_MECA(MODELE=__M_CA,
+ _F_CA=AFFE_CHAR_MECA(MODELE=__M_CA,
VECT_ASSE = __REAC )
@@ -400,12 +400,12 @@ def calc_precont_ops(self,reuse,MODELE,CHAM_MATER,CARA_ELEM,EXCIT,
if dExcit[-1][i]==None : del dExcit[-1][i]
if CABLE_BP_INACTIF:
- dExcit.append(_F(CHARGE=__C_CI),)
+ dExcit.append(_F(CHARGE=_C_CI),)
# Creation du mots-cle EXCIT pour le STAT_NON_LINE
dExcit1=copy.copy(dExcit)
- dExcit1.append(_F(CHARGE=__C_CA),)
- dExcit1.append(_F(CHARGE = __F_CA,
+ dExcit1.append(_F(CHARGE=_C_CA),)
+ dExcit1.append(_F(CHARGE = _F_CA,
FONC_MULT=__FCT ),)
RES=STAT_NON_LINE(
@@ -439,7 +439,7 @@ def calc_precont_ops(self,reuse,MODELE,CHAM_MATER,CARA_ELEM,EXCIT,
# Creation du mots-cles EXCIT pour le STAT_NON_LINE
dExcit2=copy.copy(dExcit)
- dExcit2.append(_F(CHARGE=__C_CT,) )
+ dExcit2.append(_F(CHARGE=_C_CT,) )
# Calcul sur un seul pas (de __TINT a __TMAX)
RES=STAT_NON_LINE( reuse = RES,
diff --git a/Aster/Cata/Macro/impr_fonction_ops.py b/Aster/Cata/Macro/impr_fonction_ops.py
index 4f2ace21..1e9d6e49 100644
--- a/Aster/Cata/Macro/impr_fonction_ops.py
+++ b/Aster/Cata/Macro/impr_fonction_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF impr_fonction_ops Macro DATE 30/11/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF impr_fonction_ops Macro DATE 11/05/2005 AUTEUR MCOURTOI M.COURTOIS
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -31,9 +31,10 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
"""
macro='IMPR_FONCTION'
import aster
- from Accas import _F
- from Utilitai import Graph
- from Utilitai.Utmess import UTMESS
+ from Accas import _F
+ from Utilitai import Graph
+ from Utilitai.Utmess import UTMESS
+ from Utilitai.UniteAster import UniteAster
ier=0
# La macro compte pour 1 dans la numerotation des commandes
self.set_icmd(1)
@@ -42,21 +43,21 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
# Le nom de la variable doit etre obligatoirement le nom de la commande
CALC_FONC_INTERP = self.get_cmd('CALC_FONC_INTERP')
DEFI_LIST_REEL = self.get_cmd('DEFI_LIST_REEL')
- DEFI_FICHIER = self.get_cmd('DEFI_FICHIER')
DETRUIRE = self.get_cmd('DETRUIRE')
#----------------------------------------------
# 0. Traitement des arguments, initialisations
# unité logique des fichiers réservés
ul_reserve=(8,)
+ UL = UniteAster()
# 0.1. Fichier
nomfich=None
if args['UNITE'] and args['UNITE']<>6:
- nomfich='fort.'+str(args['UNITE'])
+ nomfich=UL.Nom(args['UNITE'])
if INFO==2:
print ' Nom du fichier :',nomfich
- if nomfich and os.path.exists(nomfich):
+ if nomfich and os.path.exists(nomfich) and os.stat(nomfich).st_size<>0:
if FORMAT=='XMGRACE':
niv='A'
else:
@@ -74,7 +75,8 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
for Ci in COURBE:
iocc+=1
dC = Ci.cree_dict_valeurs(Ci.mc_liste)
- if dC.has_key('LIST_PARA') and i0==0: i0=iocc
+ if dC.has_key('LIST_PARA') and dC['LIST_PARA']!=None and i0==0:
+ i0=iocc
for mc in dC.keys():
if dC[mc]==None: del dC[mc]
Courbe.append(dC)
@@ -142,6 +144,7 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
if typ=='nappe_sdaster':
lpar,lval=obj.Valeurs()
dico,ldicf=obj.Parametres()
+ Leg=dCi['LEGENDE']
for i in range(len(lpar)):
p=lpar[i]
lx=lval[i][0]
@@ -169,12 +172,16 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
lx=lv2[0][0]
ly=lv2[0][1]
# on stocke les données dans le Graph
+ nomresu=dic['NOM_RESU'].strip()+'_'+str(len(graph.Legendes))
dicC={
'Val' : [lx,ly],
- 'Lab' : [dic['NOM_PARA_FONC'],dic['NOM_RESU']]
+ 'Lab' : [dic['NOM_PARA_FONC'],nomresu]
}
+ # ajoute la valeur du paramètre
+ dCi['LEGENDE'] = '%s %s=%g' % (Leg,dic['NOM_PARA'].strip(),p)
Graph.AjoutParaCourbe(dicC, args=dCi)
graph.AjoutCourbe(**dicC)
+ DETRUIRE(CONCEPT=_F(NOM=('li__','ftmp__'),),ALARME='NON',INFO=1)
else:
ftmp__=obj
dpar=ftmp__.Parametres()
@@ -194,17 +201,19 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
lx=lval[0]
lr=lval[1]
if typ=='fonction_c' and dCi.has_key('PARTIE'):
- if dCi['PARTIE']=='COMPLEXE' : lr=lval[2]
+ if dCi['PARTIE']=='IMAG' : lr=lval[2]
# on stocke les données dans le Graph
if typ=='fonction_c' and not dCi.has_key('PARTIE'):
+ nomresu=dpar['NOM_RESU'].strip()+'_'+str(len(graph.Legendes))
dicC={
'Val' : lval,
- 'Lab' : [dpar['NOM_PARA'],dpar['NOM_RESU']+'_R',dpar['NOM_RESU']+'_I']
+ 'Lab' : [dpar['NOM_PARA'],nomresu+'_R',nomresu+'_I']
}
else:
+ nomresu=dpar['NOM_RESU'].strip()+'_'+str(len(graph.Legendes))
dicC={
'Val' : [lx,lr],
- 'Lab' : [dpar['NOM_PARA'],dpar['NOM_RESU']]
+ 'Lab' : [dpar['NOM_PARA'],nomresu]
}
Graph.AjoutParaCourbe(dicC, args=dCi)
graph.AjoutCourbe(**dicC)
@@ -275,14 +284,18 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
# on stocke les données dans le Graph
# on imprime la liste des paramètres seulement si LIST_PARA
if intloc:
+ nomresur=dpar['NOM_RESU'].strip()+'_'+str(len(graph.Legendes))
+ nomresu2=dpa2['NOM_RESU'].strip()+'_'+str(len(graph.Legendes)+1)
dicC={
'Val' : [lt,lx,ly],
- 'Lab' : [dpar['NOM_PARA'],dpar['NOM_RESU'],dpa2['NOM_RESU']]
+ 'Lab' : [dpar['NOM_PARA'],nomresur,nomresu2]
}
else:
+ nomresur=dpar['NOM_RESU'].strip()+'_'+str(len(graph.Legendes))
+ nomresu2=dpa2['NOM_RESU'].strip()+'_'+str(len(graph.Legendes)+1)
dicC={
'Val' : [lx,ly],
- 'Lab' : [dpar['NOM_RESU'],dpa2['NOM_RESU']]
+ 'Lab' : [nomresur,nomresu2]
}
Graph.AjoutParaCourbe(dicC, args=dCi)
graph.AjoutCourbe(**dicC)
@@ -358,7 +371,7 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
elif FORMAT=='AGRAF':
nomdigr=None
if args['UNITE_DIGR']<>6:
- nomdigr='fort.'+str(args['UNITE_DIGR'])
+ nomdigr=UL.Nom(args['UNITE_DIGR'])
kargs['FICHIER']=[nomfich, nomdigr]
kargs['dform']={ 'formR' : '%12.5E' }
@@ -373,21 +386,15 @@ def impr_fonction_ops(self, FORMAT, COURBE, INFO, **args):
# Traiter le cas des UL réservées
if args['UNITE'] and args['UNITE'] in ul_reserve:
- DEFI_FICHIER( ACTION='LIBERER', UNITE=args['UNITE'], )
+ UL.Etat(args['UNITE'], etat='F')
if FORMAT=='AGRAF' and args['UNITE_DIGR']<>args['UNITE'] \
and args['UNITE_DIGR'] in ul_reserve:
- DEFI_FICHIER( ACTION='LIBERER', UNITE=args['UNITE_DIGR'], )
+ UL.Etat(args['UNITE_DIGR'], etat='F')
# 2.4. On trace !
graph.Trace(**kargs)
# 99. Traiter le cas des UL réservées
- if args['UNITE'] and args['UNITE'] in ul_reserve:
- DEFI_FICHIER( ACTION='ASSOCIER', UNITE=args['UNITE'],
- TYPE='ASCII', ACCES='APPEND' )
- if FORMAT=='AGRAF' and args['UNITE_DIGR']<>args['UNITE'] \
- and args['UNITE_DIGR'] in ul_reserve:
- DEFI_FICHIER( ACTION='ASSOCIER', UNITE=args['UNITE_DIGR'],
- TYPE='ASCII', ACCES='APPEND' )
+ UL.EtatInit()
return ier
diff --git a/Aster/Cata/Macro/impr_table_ops.py b/Aster/Cata/Macro/impr_table_ops.py
index ca1a492f..74776f0b 100644
--- a/Aster/Cata/Macro/impr_table_ops.py
+++ b/Aster/Cata/Macro/impr_table_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF impr_table_ops Macro DATE 30/11/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF impr_table_ops Macro DATE 11/05/2005 AUTEUR MCOURTOI M.COURTOIS
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -35,9 +35,10 @@ def impr_table_ops(self, FORMAT, TABLE, INFO, **args):
"""
macro='IMPR_TABLE'
import aster
- from Accas import _F
- from Cata.cata import table_jeveux
- from Utilitai.Utmess import UTMESS
+ from Accas import _F
+ from Cata.cata import table_jeveux
+ from Utilitai.Utmess import UTMESS
+ from Utilitai.UniteAster import UniteAster
ier=0
# La macro compte pour 1 dans la numerotation des commandes
self.set_icmd(1)
@@ -45,19 +46,19 @@ def impr_table_ops(self, FORMAT, TABLE, INFO, **args):
# On importe les definitions des commandes a utiliser dans la macro
# Le nom de la variable doit etre obligatoirement le nom de la commande
DETRUIRE = self.get_cmd('DETRUIRE')
- DEFI_FICHIER = self.get_cmd('DEFI_FICHIER')
RECU_FONCTION = self.get_cmd('RECU_FONCTION')
#----------------------------------------------
# 0. Traitement des arguments, initialisations
# unité logique des fichiers réservés
ul_reserve=(8,)
+ UL = UniteAster()
# 0.1. Fichier
nomfich=None
if args['UNITE'] and args['UNITE']<>6:
- nomfich='fort.'+str(args['UNITE'])
- if nomfich and os.path.exists(nomfich):
+ nomfich=UL.Nom(args['UNITE'])
+ if nomfich and os.path.exists(nomfich) and os.stat(nomfich).st_size<>0:
if FORMAT=='XMGRACE':
UTMESS('A',macro,'Le fichier '+nomfich+' existe déjà, on écrit ' \
'à la suite.')
@@ -111,7 +112,7 @@ def impr_table_ops(self, FORMAT, TABLE, INFO, **args):
# 0.4.2. Traiter le cas des UL réservées
if args['UNITE'] and args['UNITE'] in ul_reserve:
- DEFI_FICHIER( ACTION='LIBERER', UNITE=args['UNITE'], )
+ UL.Etat(args['UNITE'], etat='F')
#----------------------------------------------
# Boucle sur les tables
@@ -205,9 +206,7 @@ def impr_table_ops(self, FORMAT, TABLE, INFO, **args):
DETRUIRE(CONCEPT=_F(NOM=('__fonc',),), ALARME='NON', INFO=1,)
# 99. Traiter le cas des UL réservées
- if args['UNITE'] and args['UNITE'] in ul_reserve:
- DEFI_FICHIER( ACTION='ASSOCIER', UNITE=args['UNITE'],
- TYPE='ASCII', ACCES='APPEND' )
+ UL.EtatInit()
return ier
diff --git a/Aster/Cata/Macro/info_fonction_ops.py b/Aster/Cata/Macro/info_fonction_ops.py
new file mode 100644
index 00000000..b728f6a4
--- /dev/null
+++ b/Aster/Cata/Macro/info_fonction_ops.py
@@ -0,0 +1,252 @@
+#@ MODIF info_fonction_ops Macro DATE 12/05/2005 AUTEUR DURAND C.DURAND
+# -*- coding: iso-8859-1 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2005 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+# ======================================================================
+def info_fonction_ops(self,RMS,NOCI_SEISME,MAX,NORME,ECART_TYPE,**args):
+ """
+ Ecriture de la macro INFO_FONCTION
+ """
+ ier=0
+ import string
+ from Utilitai.t_fonction import t_fonction,t_fonction_c,t_nappe
+ import math
+ from Accas import _F
+ from Utilitai.Utmess import UTMESS
+
+ ### On importe les definitions des commandes a utiliser dans la macro
+ CREA_TABLE = self.get_cmd('CREA_TABLE')
+ CALC_FONCTION = self.get_cmd('CALC_FONCTION')
+
+ ### Comptage commandes + déclaration concept sortant
+ self.set_icmd(1)
+ self.DeclareOut('C_out',self.sd)
+
+ ### type de traitement
+
+ ###
+ if (MAX != None):
+ __ff=MAX['FONCTION'].convert()
+ __ex=__ff.extreme()
+ n_mini=len(__ex['min'])
+ n_maxi=len(__ex['max'])
+ listeMCF=[_F(LISTE_K=[MAX['FONCTION'].nom]*(n_mini+n_maxi),PARA='FONCTION'),
+ _F(LISTE_K=['MINI',]*n_mini+['MAXI',]*n_maxi,PARA='TYPE'),]
+ if isinstance(__ff,t_nappe) :
+ listeMCF=listeMCF+[\
+ _F(LISTE_R=[i[0] for i in __ex['min']]+[i[0] for i in __ex['max']],PARA=__ff.para['NOM_PARA']),\
+ _F(LISTE_R=[i[1] for i in __ex['min']]+[i[1] for i in __ex['max']],PARA=__ff.para['NOM_PARA_FONC']),\
+ _F(LISTE_R=[i[2] for i in __ex['min']]+[i[2] for i in __ex['max']],PARA=__ff.para['NOM_RESU'])]
+ else :
+ listeMCF=listeMCF+[\
+ _F(LISTE_R=[i[0] for i in __ex['min']]+[i[0] for i in __ex['max']],PARA=__ff.para['NOM_PARA']),\
+ _F(LISTE_R=[i[1] for i in __ex['min']]+[i[1] for i in __ex['max']],PARA=__ff.para['NOM_RESU'])]
+ C_out=CREA_TABLE(LISTE=listeMCF)
+
+ ###
+ if (ECART_TYPE != None):
+ __ff=ECART_TYPE['FONCTION'].convert()
+ if ECART_TYPE['INST_INIT']!=None : tini=ECART_TYPE['INST_INIT']
+ else : tini=__ff.vale_x[0]
+ if ECART_TYPE['INST_FIN' ]!=None : tfin=ECART_TYPE['INST_FIN' ]
+ else : tfin=__ff.vale_x[-1]
+ __ff=__ff.cut(tini,__ff.vale_x[-1],ECART_TYPE['PRECISION'],ECART_TYPE['CRITERE'])
+ __ff=__ff.cut(__ff.vale_x[0],tfin,ECART_TYPE['PRECISION'],ECART_TYPE['CRITERE'])
+ if ECART_TYPE['METHODE' ]=='SIMPSON' : __ex=__ff.simpson(0.)
+ if ECART_TYPE['METHODE' ]=='TRAPEZE' : __ex=__ff.trapeze(0.)
+ fmoy=__ex.vale_y[-1]/(__ff.vale_x[-1]-__ff.vale_x[0])
+ __ff=__ff+(-1*fmoy)
+ __ff=__ff*__ff
+ if ECART_TYPE['METHODE' ]=='SIMPSON' : __ez=__ff.simpson(0.)
+ if ECART_TYPE['METHODE' ]=='TRAPEZE' : __ez=__ff.trapeze(0.)
+ sigma=math.sqrt(__ez.vale_y[-1]/(__ff.vale_x[-1]-__ff.vale_x[0]))
+ C_out=CREA_TABLE(LISTE=(_F(LISTE_K=ECART_TYPE['FONCTION'].nom,PARA='FONCTION'),
+ _F(LISTE_K=ECART_TYPE['METHODE'] ,PARA='METHODE'),
+ _F(LISTE_R=fmoy ,PARA='MOYENNE'),
+ _F(LISTE_R=sigma ,PARA='ECART_TYPE'),
+ _F(LISTE_R=tini ,PARA='INST_INIT'),
+ _F(LISTE_R=tfin ,PARA='INST_FIN'),)
+ )
+
+ ###
+ if (RMS != None):
+ RMS =list(RMS)
+ sigm =[]
+ tmpi =[]
+ tmpf =[]
+ nomf =[]
+ meth =[]
+ for i_rms in RMS :
+ __ff=i_rms['FONCTION'].convert()
+ if i_rms['INST_INIT']!=None : tini=i_rms['INST_INIT']
+ else : tini=__ff.vale_x[0]
+ if i_rms['INST_FIN' ]!=None : tfin=i_rms['INST_FIN' ]
+ else : tfin=__ff.vale_x[-1]
+ __ff=__ff.cut(tini,__ff.vale_x[-1],i_rms['PRECISION'],i_rms['CRITERE'])
+ __ff=__ff.cut(__ff.vale_x[0],tfin,i_rms['PRECISION'],i_rms['CRITERE'])
+ __ff=__ff*__ff
+ if i_rms['METHODE' ]=='SIMPSON' : __ez=__ff.simpson(0.)
+ if i_rms['METHODE' ]=='TRAPEZE' :
+ __ez=__ff.trapeze(0.)
+ sigm.append(math.sqrt(__ez.vale_y[-1]/(__ff.vale_x[-1]-__ff.vale_x[0])))
+ tmpi.append(tini)
+ tmpf.append(tfin)
+ nomf.append(i_rms['FONCTION'].nom)
+ meth.append(i_rms['METHODE'])
+ C_out=CREA_TABLE(LISTE=(_F(LISTE_K=nomf ,PARA='FONCTION'),
+ _F(LISTE_K=meth ,PARA='METHODE'),
+ _F(LISTE_R=tmpi ,PARA='INST_INIT'),
+ _F(LISTE_R=tmpf ,PARA='INST_FIN'),
+ _F(LISTE_R=sigm ,PARA='RMS'), )
+ )
+
+ ###
+ if (NORME != None):
+ __ff=NORME['FONCTION'].convert()
+ norme=[]
+ for __fi in __ff.l_fonc :
+ norme.append(__fi.normel2())
+ nom=[NORME['FONCTION'].nom,]*len(norme)
+ C_out=CREA_TABLE(LISTE=(_F(LISTE_R=norme ,PARA='NORME'),
+ _F(LISTE_K=nom ,PARA='FONCTION'), )
+ )
+
+ ###
+ if (NOCI_SEISME != None):
+ l_table=[]
+ if NOCI_SEISME['SPEC_OSCI'] !=None :
+ ### cas intensité spectrale d'une nappe de SRO
+ ### la seule option licite est INTE_SPEC
+ UTMESS('I','INFO_FONCTION',''' : intensite spectrale, avant de calculer l'\
+intensite spectrale, il est prudent de verifier la norme de la nappe sur laquelle \
+porte le calcul, ceci peut etre une source d erreurs.''')
+ amor=NOCI_SEISME['AMOR_REDUIT']
+ fini=NOCI_SEISME['FREQ_INIT' ]
+ ffin=NOCI_SEISME['FREQ_FIN' ]
+ __sp =NOCI_SEISME['SPEC_OSCI'].convert()
+ vale_x=__sp.l_fonc[0].vale_x
+ vale_y=[__sp(amor,f) for f in vale_x]
+ para =__sp.l_fonc[0].para
+ __srov=t_fonction(vale_x,vale_y,para)
+ if NOCI_SEISME['NATURE']=='DEPL' :
+ __srov.vale_y=(__srov.vale_y/__srov.vale_x)*2.*math.pi
+ elif NOCI_SEISME['NATURE']=='VITE' :
+ __srov.vale_y=__srov.vale_y/__srov.vale_x/__srov.vale_x
+ elif NOCI_SEISME['NATURE']=='ACCE' :
+ __srov.vale_y=__srov.vale_y/__srov.vale_x/__srov.vale_x
+ __srov.vale_y=__srov.vale_y/__srov.vale_x/2./math.pi
+ __srov=__srov.cut(fini,ffin,NOCI_SEISME['PRECISION'],NOCI_SEISME['CRITERE'])
+ insp=__srov.trapeze(0.).vale_y[-1]
+ l_table.append(_F(LISTE_R=fini ,PARA='FREQ_INIT' ))
+ l_table.append(_F(LISTE_R=ffin ,PARA='FREQ_FIN' ))
+ l_table.append(_F(LISTE_R=amor ,PARA='AMOR_REDUIT'))
+ l_table.append(_F(LISTE_R=insp ,PARA='INTE_SPECT' ))
+ if NOCI_SEISME['FONCTION'] !=None :
+ ### cas fonction
+ l_table.append(_F(LISTE_K=NOCI_SEISME['FONCTION'].nom,PARA='FONCTION'))
+ __ac=NOCI_SEISME['FONCTION'].convert()
+ option= NOCI_SEISME['OPTION']
+ if NOCI_SEISME['INST_INIT']!=None : tdeb=NOCI_SEISME['INST_INIT']
+ else : tdeb=__ac.vale_x[0]
+ if NOCI_SEISME['INST_FIN' ]!=None : tfin=NOCI_SEISME['INST_FIN' ]
+ else : tfin=__ac.vale_x[-1]
+ # calcul de la vitesse :
+ __vi=__ac.trapeze(NOCI_SEISME['COEF'])
+ # calcul du déplacement :
+ __de=__vi.trapeze(NOCI_SEISME['COEF'])
+ # calcul de |acceleration| :
+ __aa=__ac.abs()
+ # calcul de integrale(|acceleration|) :
+ ### on "coupe" la fonction entre tdeb et tfin
+ __ac=__ac.cut(tdeb,tfin,NOCI_SEISME['PRECISION'],NOCI_SEISME['CRITERE'])
+ __vi=__vi.cut(tdeb,tfin,NOCI_SEISME['PRECISION'],NOCI_SEISME['CRITERE'])
+ __de=__de.cut(tdeb,tfin,NOCI_SEISME['PRECISION'],NOCI_SEISME['CRITERE'])
+ __aa=__aa.cut(tdeb,tfin,NOCI_SEISME['PRECISION'],NOCI_SEISME['CRITERE'])
+ if NOCI_SEISME['FREQ' ]!=None : l_freq=NOCI_SEISME['FREQ']
+ elif NOCI_SEISME['LIST_FREQ']!=None : l_freq=NOCI_SEISME['LIST_FREQ'].Valeurs()
+ else :
+ # fréquences par défaut
+ l_freq=[]
+ for i in range(56) : l_freq.append( 0.2+0.050*i)
+ for i in range( 8) : l_freq.append( 3.0+0.075*i)
+ for i in range(14) : l_freq.append( 3.6+0.100*i)
+ for i in range(24) : l_freq.append( 5.0+0.125*i)
+ for i in range(28) : l_freq.append( 8.0+0.250*i)
+ for i in range( 6) : l_freq.append(15.0+0.500*i)
+ for i in range( 4) : l_freq.append(18.0+1.000*i)
+ for i in range(10) : l_freq.append(22.0+1.500*i)
+ if option in('TOUT','MAXI','ACCE_SUR_VITE') :
+ # calcul du max des valeurs absolues
+ maxa_ac=__ac.abs().extreme()['max'][0][1]
+ maxa_vi=__vi.abs().extreme()['max'][0][1]
+ maxa_de=__de.abs().extreme()['max'][0][1]
+ l_table.append(_F(LISTE_R=maxa_ac,PARA='ACCE_MAX'))
+ l_table.append(_F(LISTE_R=maxa_vi,PARA='VITE_MAX'))
+ l_table.append(_F(LISTE_R=maxa_de,PARA='DEPL_MAX'))
+ l_table.append(_F(LISTE_R=maxa_ac/maxa_vi,PARA='ACCE_SUR_VITE'))
+ if option in('TOUT','INTE_ARIAS') :
+ __a2=__ac*__ac
+ inte_arias=__a2.trapeze(0.).vale_y[-1]
+ inte_arias=inte_arias*math.pi/NOCI_SEISME['PESANTEUR']/2.
+ l_table.append(_F(LISTE_R=inte_arias,PARA='INTE_ARIAS'))
+ if option in('TOUT','POUV_DEST') :
+ __v2=__vi*__vi
+ pouv_dest=__v2.trapeze(0.).vale_y[-1]
+ pouv_dest=pouv_dest*(math.pi)**3/NOCI_SEISME['PESANTEUR']/2.
+ l_table.append(_F(LISTE_R=pouv_dest,PARA='POUV_DEST'))
+ if option in('TOUT','VITE_ABSO_CUMU') :
+ __vc=__aa.trapeze(0.)
+ vite_abso=__vc.vale_y[-1]
+ l_table.append(_F(LISTE_R=vite_abso,PARA='VITE_ABSO_CUMU'))
+ if option in('TOUT','INTE_SPEC') :
+ amor=NOCI_SEISME['AMOR_REDUIT']
+ fini=NOCI_SEISME['FREQ_INIT' ]
+ ffin=NOCI_SEISME['FREQ_FIN' ]
+ __so= CALC_FONCTION(SPEC_OSCI=_F(
+ NATURE ='VITE',
+ NATURE_FONC='ACCE',
+ FONCTION =NOCI_SEISME['FONCTION'],
+ METHODE ='NIGAM',
+ NORME =NOCI_SEISME['NORME'],
+ FREQ =l_freq,
+ AMOR_REDUIT=(amor,)
+ ), )
+ __srov=__so.convert().l_fonc[0]
+ __srov=__srov.cut(fini,ffin,NOCI_SEISME['PRECISION'],NOCI_SEISME['CRITERE'])
+ __srov.vale_y=__srov.vale_y/__srov.vale_x/__srov.vale_x
+ insp=__srov.trapeze(0.).vale_y[-1]
+ l_table.append(_F(LISTE_R=fini ,PARA='FREQ_INIT' ))
+ l_table.append(_F(LISTE_R=ffin ,PARA='FREQ_FIN' ))
+ l_table.append(_F(LISTE_R=amor ,PARA='AMOR_REDUIT'))
+ l_table.append(_F(LISTE_R=insp ,PARA='INTE_SPECT' ))
+ if option in('TOUT','DUREE_PHAS_FORT') :
+ __a2=__ac*__ac
+ __i2=__a2.trapeze(0.)
+ arias = __i2.vale_y[-1]*math.pi/NOCI_SEISME['PESANTEUR']/2.
+ valinf = arias * NOCI_SEISME['BORNE_INF']
+ valsup = arias * NOCI_SEISME['BORNE_SUP']
+ for i in range(len(__i2.vale_x)) :
+ ariask = __i2.vale_y[i]*math.pi/NOCI_SEISME['PESANTEUR']/2.
+ if ariask>=valinf : break
+ for j in range(len(__i2.vale_x)-1,-1,-1) :
+ ariask = __i2.vale_y[j]*math.pi/NOCI_SEISME['PESANTEUR']/2.
+ if ariask<=valsup : break
+ dphfor = __i2.vale_x[j] - __i2.vale_x[i]
+ l_table.append(_F(LISTE_R=dphfor,PARA='DUREE_PHAS_FORT'))
+ C_out=CREA_TABLE(LISTE=l_table)
+
+ return ier
diff --git a/Aster/Cata/Macro/macr_ascouf_calc_ops.py b/Aster/Cata/Macro/macr_ascouf_calc_ops.py
index fda98363..4c7c9b96 100644
--- a/Aster/Cata/Macro/macr_ascouf_calc_ops.py
+++ b/Aster/Cata/Macro/macr_ascouf_calc_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF macr_ascouf_calc_ops Macro DATE 22/11/2004 AUTEUR LEBOUVIE F.LEBOUVIER
+#@ MODIF macr_ascouf_calc_ops Macro DATE 08/02/2005 AUTEUR CIBHHLV L.VIVAN
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -358,6 +358,7 @@ def macr_ascouf_calc_ops(self,TYPE_MAILLAGE,CL_BOL_P2_GV,MAILLAGE,MODELE,CHAM_MA
# l epaisseur
#
l_grno=MAILLAGE.LIST_GROUP_NO()
+ tabprl=[None]*4
tablig=[None]*4
#
# prelevements des ligaments circonferentiels et longitudinaux
@@ -370,15 +371,20 @@ def macr_ascouf_calc_ops(self,TYPE_MAILLAGE,CL_BOL_P2_GV,MAILLAGE,MODELE,CHAM_MA
elif (tgrno[0][:4] in LIG) and (tgrno[0][4:6] not in ('GV','TU','MI')): lgrno.append(tgrno[0])
#
motscles={}
- motscles['SEGMENT']=[]
- for grno in lgrno : motscles['SEGMENT'].append(_F(INTITULE=grno,GROUP_NO=grno))
+ motscles['ACTION']=[]
+ for grno in lgrno :
+ motscles['ACTION'].append(_F(RESULTAT=nomres,
+ NOM_CHAM='SIEF_ELNO_ELGA',
+ TOUT_CMP='OUI',
+ INTITULE=grno,
+ GROUP_NO=grno,
+ OPERATION='EXTRACTION',))
motscles['TITRE']='TABLE DE POST-TRAITEMENT SECTION SOUS-EPAISSEUR'
+ tabprl[1]=POST_RELEVE_T(**motscles)
tablig[1]=POST_RCCM(MATER = rccmat,
- MAILLAGE = MAILLAGE,
TYPE_RESU_MECA = 'EVOLUTION',
OPTION = 'PM_PB',
- TRANSITOIRE=_F(RESULTAT=nomres,
- NOM_CHAM='SIEF_ELNO_ELGA',),**motscles)
+ TRANSITOIRE=_F(TABL_RESU_MECA = tabprl[1],),)
#
motscles={}
motscles['ACTION']=[]
@@ -436,6 +442,7 @@ def macr_ascouf_calc_ops(self,TYPE_MAILLAGE,CL_BOL_P2_GV,MAILLAGE,MODELE,CHAM_MA
# les 8 ligaments sont tous les 45 degres
#
ACOUR = mc_IMPR_TABLE['ANGLE']*pi/180.0
+ secprl=[None]*3
secrcm=[None]*3
secinv=[None]*3
secmoy=[None]*3
@@ -450,15 +457,21 @@ def macr_ascouf_calc_ops(self,TYPE_MAILLAGE,CL_BOL_P2_GV,MAILLAGE,MODELE,CHAM_MA
#
# moyenne RCCM sur les sections MI,TU et GV
#
- motscles['SEGMENT']=[]
- for j in range(8) : motscles['SEGMENT'].append(_F(INTITULE=LIG[j]+SECT[i],
- GROUP_NO=LIG[j]+SECT[i]))
- secrcm[i] = POST_RCCM( MAILLAGE = MAILLAGE ,
- MATER = rccmat ,
- TYPE_RESU_MECA = 'EVOLUTION' ,
- OPTION = 'PM_PB' ,
- TRANSITOIRE = _F(RESULTAT = nomres,NOM_CHAM='SIEF_ELNO_ELGA'),
- **motscles)
+ motscles={}
+ motscles['ACTION']=[]
+ for j in range(8) :
+ motscles['ACTION'].append(_F(RESULTAT=nomres,
+ NOM_CHAM='SIEF_ELNO_ELGA',
+ TOUT_CMP='OUI',
+ INTITULE=LIG[j]+SECT[i],
+ GROUP_NO=LIG[j]+SECT[i],
+ OPERATION='EXTRACTION',))
+ motscles['TITRE']='TABLE DE POST-TRAITEMENT MOYENNE RCCM SECTION '+SECT[i]
+ secprl[i]=POST_RELEVE_T(**motscles)
+ secrcm[i]=POST_RCCM(MATER = rccmat,
+ TYPE_RESU_MECA = 'EVOLUTION',
+ OPTION = 'PM_PB',
+ TRANSITOIRE=_F(TABL_RESU_MECA = secprl[i],),)
#
# invariants sur les sections MI,TU et GV
#
diff --git a/Aster/Cata/Macro/macr_ascouf_mail_ops.py b/Aster/Cata/Macro/macr_ascouf_mail_ops.py
index f7b95acf..fe02927a 100644
--- a/Aster/Cata/Macro/macr_ascouf_mail_ops.py
+++ b/Aster/Cata/Macro/macr_ascouf_mail_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF macr_ascouf_mail_ops Macro DATE 30/11/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF macr_ascouf_mail_ops Macro DATE 09/05/2005 AUTEUR LEBOUVIE F.LEBOUVIER
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -2339,8 +2339,8 @@ def macr_ascouf_mail_ops(self,EXEC_MAILLAGE,TYPE_ELEM,COUDE,
# coude fissure
#
if FISS_COUDE!=None:
- if (RM/EP1)<5. or (RM/EP1)>12.:
- print ' valeur hors domaine de validite (5,12)'
+ if (RM/EP1)<5. or (RM/EP1)>50.:
+ print ' valeur hors domaine de validite (5,50)'
print ' rapport RM/EP1 :',(RM/EP1)
self.cr.fatal(" erreur donnees ")
ier = ier+1
diff --git a/Aster/Cata/Macro/macr_aspic_calc_ops.py b/Aster/Cata/Macro/macr_aspic_calc_ops.py
index b6d91b36..5426c395 100644
--- a/Aster/Cata/Macro/macr_aspic_calc_ops.py
+++ b/Aster/Cata/Macro/macr_aspic_calc_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF macr_aspic_calc_ops Macro DATE 22/11/2004 AUTEUR LEBOUVIE F.LEBOUVIER
+#@ MODIF macr_aspic_calc_ops Macro DATE 08/02/2005 AUTEUR CIBHHLV L.VIVAN
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -427,18 +427,21 @@ def macr_aspic_calc_ops(self,TYPE_MAILLAGE,TUBULURE,MAILLAGE,MODELE,CHAM_MATER,C
if i<10 : NUME = '0'+str(i)
else : NUME = str(i)
mcsimp={}
- mcsimp['PRECISION']=55.E-1
- mcsimp['GROUP_NO' ]='LD'+str(i)
+ mcsimp['INTITULE' ]='LD'+str(i)
+ mcsimp['GROUP_NO' ]='LD'+str(i)
+ mcsimp['RESULTAT' ]=nomres
+ mcsimp['TOUT_ORDRE' ]='OUI'
+ mcsimp['NOM_CHAM' ]='SIEF_ELNO_ELGA'
+ mcsimp['PRECISION' ]=55.E-1
+ mcsimp['TOUT_CMP' ]='OUI'
+ mcsimp['OPERATION' ]='EXTRACTION'
mcfact.append( _F(**mcsimp) )
- __pmpbsd=POST_RCCM(MATER = MRCCM,
- MAILLAGE = MAILLAGE,
+ __prelsd=POST_RELEVE_T(ACTION=mcfact)
+ __pmpbsd=POST_RCCM(OPTION = 'PM_PB',
TYPE_RESU_MECA = 'EVOLUTION',
- TYPE_RESU = 'VALE_MAX',
- OPTION = 'PM_PB',
- SEGMENT = mcfact,
- TRANSITOIRE = _F(RESULTAT =nomres,
- NOM_CHAM ='SIEF_ELNO_ELGA',
- TOUT_ORDRE='OUI',),
+ TYPE_RESU = 'VALE_MAX',
+ MATER = MRCCM,
+ TRANSITOIRE = _F(TABL_RESU_MECA = __prelsd,),
TITRE = '-- TRAITEMENT DES AZIMUTS DROITS --',)
IMPR_TABLE(TABLE = __pmpbsd, )
#
@@ -514,18 +517,21 @@ def macr_aspic_calc_ops(self,TYPE_MAILLAGE,TUBULURE,MAILLAGE,MODELE,CHAM_MATER,C
if i<10 : NUME = '0'+str(i)
else : NUME = str(i)
mcsimp={}
- mcsimp['PRECISION']=55.E-1
- mcsimp['GROUP_NO' ]='LI'+str(i)
+ mcsimp['INTITULE' ]='LI'+str(i)
+ mcsimp['GROUP_NO' ]='LI'+str(i)
+ mcsimp['RESULTAT' ]=nomres
+ mcsimp['TOUT_ORDRE' ]='OUI'
+ mcsimp['NOM_CHAM' ]='SIEF_ELNO_ELGA'
+ mcsimp['PRECISION' ]=55.E-1
+ mcsimp['TOUT_CMP' ]='OUI'
+ mcsimp['OPERATION' ]='EXTRACTION'
mcfact.append( _F(**mcsimp) )
- __pmpbsi=POST_RCCM(MATER = MRCCM,
- MAILLAGE = MAILLAGE,
+ __prelsi=POST_RELEVE_T(ACTION=mcfact)
+ __pmpbsi=POST_RCCM(OPTION = 'PM_PB',
TYPE_RESU_MECA = 'EVOLUTION',
- TYPE_RESU = 'VALE_MAX',
- OPTION = 'PM_PB',
- SEGMENT = mcfact,
- TRANSITOIRE = _F(RESULTAT =nomres,
- NOM_CHAM ='SIEF_ELNO_ELGA',
- TOUT_ORDRE='OUI',),
+ TYPE_RESU = 'VALE_MAX',
+ MATER = MRCCM,
+ TRANSITOIRE = _F(TABL_RESU_MECA = __prelsi,),
TITRE = '-- TRAITEMENT DES AZIMUTS INCLINES --',)
IMPR_TABLE(TABLE = __pmpbsi, )
#
diff --git a/Aster/Cata/Macro/macr_cabri_mail_ops.py b/Aster/Cata/Macro/macr_cabri_mail_ops.py
index d5ad388f..92154545 100644
--- a/Aster/Cata/Macro/macr_cabri_mail_ops.py
+++ b/Aster/Cata/Macro/macr_cabri_mail_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF macr_cabri_mail_ops Macro DATE 14/09/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF macr_cabri_mail_ops Macro DATE 07/02/2005 AUTEUR MABBAS M.ABBAS
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -72,11 +72,11 @@ def macr_cabri_mail_ops(self,EXEC_MAILLAGE,RAFF_MAILLAGE,VERI_MAIL,GEOM_BRID,
imp_formF = 1
else:
imp_formF = 0
- if IMPRESSION['FICHIER']!=None:
- imp_fich = IMPRESSION['FICHIER']
- imp_fichF = 1
- else:
- imp_fichF = 0
+# if IMPRESSION['FICHIER']!=None:
+# imp_fich = IMPRESSION['FICHIER']
+# imp_fichF = 1
+# else:
+# imp_fichF = 0
# Maillage
nrad = RAFF_MAILLAGE['NB_RADIAL']
@@ -141,8 +141,8 @@ def macr_cabri_mail_ops(self,EXEC_MAILLAGE,RAFF_MAILLAGE,VERI_MAIL,GEOM_BRID,
nomres = LIRE_MAILLAGE(VERI_MAIL=_F(APLAT = ver_apla,
VERIF = ver_veri ),)
- if (imp_fichF == 1):
- print imp_fich
+# if (imp_fichF == 1):
+# print imp_fich
if (imp_formF == 1):
print imp_form
if (imp_unitF == 1):
diff --git a/Aster/Cata/Macro/macr_fiab_impr_ops.py b/Aster/Cata/Macro/macr_fiab_impr_ops.py
index 3b338c77..08ac8d10 100644
--- a/Aster/Cata/Macro/macr_fiab_impr_ops.py
+++ b/Aster/Cata/Macro/macr_fiab_impr_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF macr_fiab_impr_ops Macro DATE 07/10/2004 AUTEUR GNICOLAS G.NICOLAS
+#@ MODIF macr_fiab_impr_ops Macro DATE 24/01/2005 AUTEUR DURAND C.DURAND
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -17,8 +17,6 @@
# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
# ======================================================================
-
-
# RESPONSABLE GNICOLAS G.NICOLAS
#
def macr_fiab_impr_ops(self, INFO,
@@ -86,14 +84,16 @@ def macr_fiab_impr_ops(self, INFO,
# 5. Ecritures des gradients
#____________________________________________________________________
#
- for val in GRADIENTS :
+ if GRADIENTS is not None :
#
- IMPR_TABLE ( TABLE = val["TABLE"],
- SENSIBILITE = val["PARA_SENSI"],
- NOM_PARA = (val["NOM_PARA"]),
- UNITE = Unite_Fichier_ASTER_vers_FIABILITE,
- FORMAT_R = FORMAT_R,
- INFO = INFO )
+ for val in GRADIENTS :
+#
+ IMPR_TABLE ( TABLE = val["TABLE"],
+ SENSIBILITE = val["PARA_SENSI"],
+ NOM_PARA = (val["NOM_PARA"]),
+ UNITE = Unite_Fichier_ASTER_vers_FIABILITE,
+ FORMAT_R = FORMAT_R,
+ INFO = INFO )
#____________________________________________________________________
#
# 6. Libération du fichier d'échange
diff --git a/Aster/Cata/Macro/macr_lign_coupe_ops.py b/Aster/Cata/Macro/macr_lign_coupe_ops.py
index 0d57da06..107ec4a2 100644
--- a/Aster/Cata/Macro/macr_lign_coupe_ops.py
+++ b/Aster/Cata/Macro/macr_lign_coupe_ops.py
@@ -1,21 +1,21 @@
-#@ MODIF macr_lign_coupe_ops Macro DATE 14/09/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF macr_lign_coupe_ops Macro DATE 14/02/2005 AUTEUR DURAND C.DURAND
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-# (AT YOUR OPTION) ANY LATER VERSION.
-#
-# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-#
-# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
-# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
# ======================================================================
@@ -23,81 +23,104 @@
########################################################################
# script PYTHON de creation d un maillage de ligne de coupe
-def crea_mail_lig_coup(lignes):
+def crea_mail_lig_coup(dimension,lignes,groups):
import os,sys,copy
- try:
# construction du maillage au format Aster des segments de lignes de coupe
- nblig=len(lignes)
- dimension=len(lignes[0][0])
+ nblig=len(lignes)
+ nbngr=len(groups)
- resu='TITRE\n'
- titre='Maillage ligne de coupe'+'\n'
- resu=resu+'FINSF\n'
- resu=resu+'COOR_'+str(dimension)+'D\n'
+ resu='TITRE\n'
+ titre='Maillage ligne de coupe'+'\n'
+ resu=resu+'FINSF\n'
+ resu=resu+'COOR_'+str(dimension)+'D\n'
# creation des noeuds
- nbno=0
- for i in range(nblig):
- pt1 = lignes[i][0]
- pt2 = lignes[i][1]
- nbp_lig_coupe = lignes[i][2]
- for j in range(nbp_lig_coupe):
- if dimension==2:
- x=pt1[0]+j*(pt2[0]-pt1[0])/(nbp_lig_coupe-1)
- y=pt1[1]+j*(pt2[1]-pt1[1])/(nbp_lig_coupe-1)
- nbno=nbno+1
- noeud=' N'+str(nbno)+' '+str(x)+' '+str(y)+'\n'
- resu=resu+noeud
- elif dimension==3:
- x=pt1[0]+j*(pt2[0]-pt1[0])/(nbp_lig_coupe-1)
- y=pt1[1]+j*(pt2[1]-pt1[1])/(nbp_lig_coupe-1)
- z=pt1[2]+j*(pt2[2]-pt1[2])/(nbp_lig_coupe-1)
- nbno=nbno+1
- noeud=' N'+str(nbno)+' '+str(x)+' '+str(y)+' '+str(z)+'\n'
- resu=resu+noeud
- resu=resu+'FINSF\n'
+ nbno=0
+ for i in range(nblig):
+ pt1 = lignes[i][0]
+ pt2 = lignes[i][1]
+ nbp_lig_coupe = lignes[i][2]
+ for j in range(nbp_lig_coupe):
+ if dimension==2:
+ x=pt1[0]+j*(pt2[0]-pt1[0])/(nbp_lig_coupe-1)
+ y=pt1[1]+j*(pt2[1]-pt1[1])/(nbp_lig_coupe-1)
+ nbno=nbno+1
+ noeud=' N'+str(nbno)+' '+str(x)+' '+str(y)+'\n'
+ resu=resu+noeud
+ elif dimension==3:
+ x=pt1[0]+j*(pt2[0]-pt1[0])/(nbp_lig_coupe-1)
+ y=pt1[1]+j*(pt2[1]-pt1[1])/(nbp_lig_coupe-1)
+ z=pt1[2]+j*(pt2[2]-pt1[2])/(nbp_lig_coupe-1)
+ nbno=nbno+1
+ noeud=' N'+str(nbno)+' '+str(x)+' '+str(y)+' '+str(z)+'\n'
+ resu=resu+noeud
+ for i in range(nbngr):
+ for pt in groups[i][1:]:
+ if dimension==2:
+ nbno=nbno+1
+ noeud=' N'+str(nbno)+' '+str(pt[0])+' '+str(pt[1])+'\n'
+ resu=resu+noeud
+ elif dimension==3:
+ nbno=nbno+1
+ noeud=' N'+str(nbno)+' '+str(pt[0])+' '+str(pt[1])+' '+str(pt[2])+'\n'
+ resu=resu+noeud
+ resu=resu+'FINSF\n'
# creation des mailles
- nbma=0
- for i in range(nblig):
- nbp_lig_coupe = lignes[i][2]
- resu=resu+'SEG2\n'
- for j in range(nbp_lig_coupe-1):
- nbma=nbma+1
- maille=' M'+str(nbma)+' N'+str(nbma+i)+' N'+str(nbma+1+i)+'\n'
- resu=resu+maille
- resu=resu+'FINSF\n'
+ nbma=0
+ for i in range(nblig):
+ nbp_lig_coupe = lignes[i][2]
+ resu=resu+'SEG2\n'
+ for j in range(nbp_lig_coupe-1):
+ nbma=nbma+1
+ maille=' M'+str(nbma)+' N'+str(nbma+i)+' N'+str(nbma+1+i)+'\n'
+ resu=resu+maille
+ resu=resu+'FINSF\n'
+ for i in range(nbngr):
+ resu=resu+'SEG2\n'
+ for pt in groups[i][1:-1]:
+ nbma=nbma+1
+ maille=' M'+str(nbma)+' N'+str(nbma+nblig+i)+' N'+str(nbma+nblig+1+i)+'\n'
+ resu=resu+maille
+ resu=resu+'FINSF\n'
# creation des groupes de mailles (1 par ligne de coupe)
- nbma=0
- for i in range(nblig):
- resu=resu+'GROUP_MA\n'
- resu=resu+' LICOU'+str(i+1)
- nbp_lig_coupe = lignes[i][2]
- for j in range(nbp_lig_coupe-1):
- nbma=nbma+1
- resu=resu+' M'+str(nbma)+'\n'
- resu=resu+'\n'
- resu=resu+'FINSF\n'
- resu=resu+'FIN\n'
-
- return resu
-
- except :
- return 0
+ nbma=0
+ for i in range(nblig):
+ resu=resu+'GROUP_MA\n'
+ resu=resu+' LICOU'+str(i+1)
+ nbp_lig_coupe = lignes[i][2]
+ for j in range(nbp_lig_coupe-1):
+ nbma=nbma+1
+ resu=resu+' M'+str(nbma)+'\n'
+ resu=resu+'\n'
+ resu=resu+'FINSF\n'
+ for i in range(nbngr):
+ resu=resu+'GROUP_MA\n'
+ resu=resu+groups[i][0]
+ nbp_lig_coupe = len(groups[i])-1
+ for j in range(nbp_lig_coupe-1):
+ nbma=nbma+1
+ resu=resu+' M'+str(nbma)+'\n'
+ resu=resu+'\n'
+ resu=resu+'FINSF\n'
+ resu=resu+'FIN\n'
+
+ return resu
+
########################################################################
-def macr_lign_coupe_ops(self,RESULTAT,UNITE_MAILLAGE,LIGN_COUPE,MODELE,
- NOM_CHAM,**args):
+def macr_lign_coupe_ops(self,RESULTAT,UNITE_MAILLAGE,LIGN_COUPE,NOM_CHAM,MODELE,**args):
"""
Ecriture de la macro MACR_LIGN_COUPE
"""
- import os
+ import os,string,types
from Accas import _F
from Noyau.N_utils import AsType
+ import aster
ier=0
# On importe les definitions des commandes a utiliser dans la macro
@@ -106,20 +129,57 @@ def macr_lign_coupe_ops(self,RESULTAT,UNITE_MAILLAGE,LIGN_COUPE,MODELE,
AFFE_MODELE =self.get_cmd('AFFE_MODELE')
PROJ_CHAMP =self.get_cmd('PROJ_CHAMP')
POST_RELEVE_T =self.get_cmd('POST_RELEVE_T')
+ CREA_TABLE =self.get_cmd('CREA_TABLE')
# La macro compte pour 1 dans la numerotation des commandes
#self.icmd=1
self.set_icmd(1)
+
+ nomresu=RESULTAT.nom
+ l_modele=aster.getvectjev(nomresu.ljust(19)+'.MODL')
+ n_modele=string.strip(l_modele[0])
+ if n_modele=='' :
+ if MODELE==None:
+ ier=ier+1
+ self.cr.fatal(" nom du modele absent dans le concept resultat "+nomresu)
+ return ier
+ else : n_modele=MODELE.nom
+ l_mailla=aster.getvectjev(n_modele.ljust(8)+'.MODELE .NOMA')
+ n_mailla=string.strip(l_mailla[0])
+ dime=aster.getvectjev(n_mailla.ljust(8)+'.DIME')[5]
+ collgrno=aster.getcolljev(n_mailla.ljust(8)+'.GROUPENO')
lignes=[]
+ groups=[]
+ minidim=dime
for m in LIGN_COUPE :
- lignes.append((m['COOR_ORIG'],m['COOR_EXTR'],m['NB_POINTS']))
+ if m['NB_POINTS'] !=None :
+ lignes.append((m['COOR_ORIG'],m['COOR_EXTR'],m['NB_POINTS']))
+ minidim=min(minidim,len(m['COOR_ORIG']),len(m['COOR_EXTR']))
+ elif m['GROUP_NO']!=None :
+ ngrno=m['GROUP_NO'].ljust(8).upper()
+ if ngrno not in collgrno.keys() :
+ ier=ier+1
+ self.cr.fatal(" le group_no "+ngrno+" n est pas dans le maillage "+n_mailla)
+ return ier
+ grpn=collgrno[ngrno]
+ l_coor_group=[ngrno,]
+ for node in grpn:
+ l_coor_group.append(aster.getvectjev(n_mailla.ljust(8)+'.COORDO .VALE',3*(node-1),3))
+ groups.append(l_coor_group)
+
+ if minidim!=dime:
+ ier=ier+1
+ self.cr.fatal(" dimensions de maillage et de coordonnees incoherentes")
+ return ier
+
# Création du maillage des NB_POINTS segments entre COOR_ORIG et COOR_EXTR
+ # ainsi que des segments reliant les noeuds issus des group_no demandés
# par appel au script python crea_mail_lig_coup
# le maillage est ensuite recopié dans l unité logique UNITE_MAILLAGE
- resu_mail=crea_mail_lig_coup(lignes)
+ resu_mail=crea_mail_lig_coup(dime,lignes,groups)
cur_dir=os.getcwd()
nomFichierSortie =cur_dir+'/fort.'+str(UNITE_MAILLAGE)
fproc=open(nomFichierSortie,'w')
@@ -134,8 +194,11 @@ def macr_lign_coupe_ops(self,RESULTAT,UNITE_MAILLAGE,LIGN_COUPE,MODELE,
iocc=1
motscles['CREA_GROUP_NO']=[]
for m in LIGN_COUPE :
- motscles['CREA_GROUP_NO'].append(_F(GROUP_MA='LICOU'+str(iocc),) )
- iocc=iocc+1
+ if m['NB_POINTS'] !=None :
+ motscles['CREA_GROUP_NO'].append(_F(GROUP_MA='LICOU'+str(iocc),) )
+ iocc=iocc+1
+ elif m['GROUP_NO']!=None :
+ motscles['CREA_GROUP_NO'].append(_F(GROUP_MA=m['GROUP_NO'].ljust(8).upper(),) )
__macou=DEFI_GROUP( reuse =__macou , MAILLAGE=__macou , **motscles );
if AsType(RESULTAT).__name__ in ('evol_elas','evol_noli') :
@@ -151,23 +214,52 @@ def macr_lign_coupe_ops(self,RESULTAT,UNITE_MAILLAGE,LIGN_COUPE,MODELE,
__recou=PROJ_CHAMP(METHODE='ELEM',
RESULTAT=RESULTAT,
- MODELE_1=MODELE,
+ MODELE_1=self.jdc.current_context[n_modele],
MODELE_2=__mocou,
+ TYPE_CHAM='NOEU',
NOM_CHAM=NOM_CHAM,);
- # Production d'une table par ligne de coupe
- # Toutes les tables sont des concepts sortant de la macro définies
- # dans chaque occurence du mcfact lign_coupe
+ # Production d'une table pour toutes les lignes de coupe
- iocc=1
+ ioc2=0
+ mcACTION=[]
for m in LIGN_COUPE :
- self.DeclareOut('tt',m['TABLE'])
- tt=POST_RELEVE_T(ACTION=_F(INTITULE = 'lig.coupe'+str(iocc),
- RESULTAT = __recou,
- GROUP_NO = 'LICOU'+str(iocc),
- NOM_CHAM = NOM_CHAM,
- TOUT_CMP = 'OUI',
- OPERATION = 'EXTRACTION', ),);
- iocc=iocc+1
+ if m['NB_POINTS'] !=None :
+ ioc2=ioc2+1
+ groupe='LICOU'+str(ioc2)
+ if m['INTITULE'] !=None : intitl=m['INTITULE']
+ else : intitl='l.coupe'+str(ioc2)
+ elif m['GROUP_NO']!=None :
+ groupe=m['GROUP_NO'].ljust(8).upper()
+ if m['INTITULE'] !=None : intitl=m['INTITULE']
+ else : intitl=groupe
+ mcACTION.append( _F(INTITULE = intitl,
+ RESULTAT = __recou,
+ GROUP_NO = groupe,
+ NOM_CHAM = NOM_CHAM,
+ TOUT_CMP = 'OUI',
+ OPERATION = 'EXTRACTION', ) )
+
+ __tabitm=POST_RELEVE_T(ACTION=mcACTION,);
+
+ # on repasse par les tables python pour supprimer les paramètres inutiles
+ # NOEUD (car il est propre au maillage de la ligne) et RESU
+
+ self.DeclareOut('nomres',self.sd)
+ dictab=__tabitm.EXTR_TABLE()
+ listpara=dictab.para
+ listpara.remove('NOEUD')
+ listpara.remove('RESU')
+
+ coltab=[]
+ for key in listpara :
+ val=dictab[key].values()[key]
+ if type(val[0])==types.IntType :
+ coltab.append(_F(PARA=key,LISTE_I=val))
+ elif type(val[0])==types.FloatType :
+ coltab.append(_F(PARA=key,LISTE_R=val))
+ elif type(val[0])==types.StringType :
+ coltab.append(_F(PARA=key,LISTE_K=val,TYPE_K='K16'))
+ nomres=CREA_TABLE(LISTE=coltab)
return ier
diff --git a/Aster/Cata/Macro/macr_recal_ops.py b/Aster/Cata/Macro/macr_recal_ops.py
index 308846a5..17597e90 100644
--- a/Aster/Cata/Macro/macr_recal_ops.py
+++ b/Aster/Cata/Macro/macr_recal_ops.py
@@ -1,4 +1,4 @@
-#@ MODIF macr_recal_ops Macro DATE 14/09/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF macr_recal_ops Macro DATE 14/03/2005 AUTEUR DURAND C.DURAND
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -45,7 +45,7 @@ def macr_recal_ops(self,UNITE_ESCL, RESU_EXP, POIDS, LIST_PARA, RESU_CALC,
import Macro
from Cata import cata
from Cata.cata import DEFI_LIST_REEL
- from Macro.recal import gestion,transforme_list_Num,EXTRACT,calcul_F,graphique
+ from Macro.recal import gestion,transforme_list_Num,calcul_F,graphique
from Macro import reca_message
from Macro import reca_algo
from Macro import reca_interp
@@ -82,7 +82,6 @@ def macr_recal_ops(self,UNITE_ESCL, RESU_EXP, POIDS, LIST_PARA, RESU_CALC,
if v.__class__.__name__ in ('OPER','MACRO'):
self.current_context[k]= v
self.current_context['_F']=cata.__dict__['_F']
- self.g_context['EXTRACT']=EXTRACT
#_____________________________________________
#
diff --git a/Aster/Cata/Macro/macro_cara_poutre_ops.py b/Aster/Cata/Macro/macro_cara_poutre_ops.py
deleted file mode 100644
index a98d3d6f..00000000
--- a/Aster/Cata/Macro/macro_cara_poutre_ops.py
+++ /dev/null
@@ -1,684 +0,0 @@
-# -*- coding: utf-8 -*-
-#@ MODIF macro_cara_poutre_ops Macro DATE 25/06/2002 AUTEUR JMBHH01 J.M.PROIX
-# CONFIGURATION MANAGEMENT OF EDF VERSION
-# ======================================================================
-# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-# (AT YOUR OPTION) ANY LATER VERSION.
-#
-# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-#
-# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
-# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
-# ======================================================================
-# RESPONSABLE JMBHH01 J.M.PROIX
-def macro_cara_poutre_ops(self,UNITE_MAILLAGE,SYME_X,SYME_Y,GROUP_MA_BORD,
- GROUP_MA,ORIG_INER,NOEUD,GROUP_MA_INTE,
- LONGUEUR,MATERIAU,LIAISON,
- **args):
- """
- Ecriture de la macro MACRO_CARA_POUTRE
- """
- import types
- from Accas import _F
- ier=0
- # On importe les definitions des commandes a utiliser dans la macro
- # Le nom de la variable doit etre obligatoirement le nom de la commande
- LIRE_MAILLAGE =self.get_cmd('LIRE_MAILLAGE')
- DEFI_GROUP =self.get_cmd('DEFI_GROUP')
- CREA_MAILLAGE =self.get_cmd('CREA_MAILLAGE')
- AFFE_MODELE =self.get_cmd('AFFE_MODELE')
- DEFI_MATERIAU =self.get_cmd('DEFI_MATERIAU')
- AFFE_MATERIAU =self.get_cmd('AFFE_MATERIAU')
- DEFI_FONCTION =self.get_cmd('DEFI_FONCTION')
- DEFI_CONSTANTE =self.get_cmd('DEFI_CONSTANTE')
- AFFE_CHAR_THER =self.get_cmd('AFFE_CHAR_THER')
- AFFE_CHAR_THER_F=self.get_cmd('AFFE_CHAR_THER_F')
- THER_LINEAIRE =self.get_cmd('THER_LINEAIRE')
- CALC_VECT_ELEM =self.get_cmd('CALC_VECT_ELEM')
- CALC_MATR_ELEM =self.get_cmd('CALC_MATR_ELEM')
- NUME_DDL =self.get_cmd('NUME_DDL')
- ASSE_VECTEUR =self.get_cmd('ASSE_VECTEUR')
- POST_ELEM =self.get_cmd('POST_ELEM')
- # La macro compte pour 1 dans la numerotation des commandes
- self.icmd=1
-
- # Le concept sortant (de type tabl_cara_geom) est nommé 'nomres' dans
- # le contexte de la macro
-
- self.DeclareOut('nomres',self.sd)
-
- if GROUP_MA_BORD and GROUP_MA:
- if not LIAISON:
- ier=ier+1
- self.cr.fatal("Avec GROUP_MA, il faut obligatoirement preciser LIAISON, LONGUEUR ET MATERIAU")
- return ier
-
- __nomlma=LIRE_MAILLAGE(UNITE=UNITE_MAILLAGE,)
-
- __nomamo=AFFE_MODELE(MAILLAGE=__nomlma,
- AFFE=_F(TOUT='OUI',
- PHENOMENE='MECANIQUE',
- MODELISATION='D_PLAN',), )
-
- __nomdma=DEFI_MATERIAU(ELAS=_F(E=1.0,NU=0.,RHO=1.0),)
-
-
- __nomama=AFFE_MATERIAU(MAILLAGE=__nomlma,
- AFFE=_F(TOUT='OUI',
- MATER=__nomdma,), )
-
-# --- CALCUL DES CARACTERISTIQUES GEOMETRIQUES DE LA SECTION :
-# ------------------------------------------------------
-
- motsimps={}
- if GROUP_MA : motsimps['GROUP_MA'] = GROUP_MA
- if SYME_X : motsimps['SYME_X'] = SYME_X
- if SYME_Y : motsimps['SYME_Y'] = SYME_Y
- motsimps['ORIG_INER'] = ORIG_INER
- mfact=_F(TOUT='OUI',**motsimps)
- nomres=POST_ELEM(MODELE=__nomamo,
- CHAM_MATER=__nomama,
- CARA_GEOM=mfact )
-
-# nb : si GROUP_MA n existe pas : le mot clé est ignoré
-
-#
-# ==================================================================
-# --- = CALCUL DE LA CONSTANTE DE TORSION SUR TOUT LE MAILLAGE =
-# --- = OU DU CENTRE DE TORSION/CISAILLEMENT =
-# --- = DES COEFFICIENTS DE CISAILLEMENT =
-# --- = ET DE L INERTIE DE GAUCHISSEMENT =
-# --- = ON CREE UN MODELE PLAN 2D THERMIQUE REPRESENTANT LA SECTION =
-# --- = DE LA POUTRE CAR ON A A RESOUDRE DES E.D.P. AVEC DES LAPLACIENS=
-# ==================================================================
-
- if GROUP_MA_BORD and not GROUP_MA:
-
-# --- TRANSFORMATION DES GROUP_MA EN GROUP_NO SUR-LESQUELS
-# --- ON POURRA APPLIQUER DES CONDITIONS DE TEMPERATURE IMPOSEE :
-# ---------------------------------------------------------
- motscles={}
- if type(GROUP_MA_BORD)==types.StringType:
- motscles['CREA_GROUP_NO']=_F(GROUP_MA=GROUP_MA_BORD,)
- else:
- motscles['CREA_GROUP_NO']=[]
- for grma in GROUP_MA_BORD:
- motscles['CREA_GROUP_NO'].append(_F(GROUP_MA=grma,))
- __nomlma=DEFI_GROUP(reuse=__nomlma,
- MAILLAGE=__nomlma,
- **motscles)
-
-
-# --- CREATION D UN MAILLAGE IDENTIQUE AU PREMIER A CECI PRES
-# --- QUE LES COORDONNEES SONT EXPRIMEES DANS LE REPERE PRINCIPAL
-# --- D INERTIE DONT L ORIGINE EST LE CENTRE DE GRAVITE DE LA SECTION :
-# ---------------------------------------------------------------
-
- __nomapi=CREA_MAILLAGE(MAILLAGE=__nomlma,
- REPERE=_F(TABLE=nomres,
- NOM_ORIG='CDG', ), )
-
-# --- AFFECTATION DU PHENOMENE 'THERMIQUE' AU MODELE EN VUE DE
-# --- LA CONSTRUCTION D UN OPERATEUR LAPLACIEN SUR CE MODELE :
-# ------------------------------------------------------
-
- __nomoth=AFFE_MODELE(MAILLAGE=__nomapi,
- AFFE=_F(TOUT='OUI',
- PHENOMENE='THERMIQUE',
- MODELISATION='PLAN',), )
-
-# --- POUR LA CONSTRUCTION DU LAPLACIEN, ON DEFINIT UN
-# --- PSEUDO-MATERIAU DONT LES CARACTERISTIQUES THERMIQUES SONT :
-# --- LAMBDA = 1, RHO*CP = 0 :
-# ----------------------
-
- __nomath=DEFI_MATERIAU(THER=_F(LAMBDA=1.0,RHO_CP=0.,),)
-
-# --- DEFINITION D UN CHAM_MATER A PARTIR DU MATERIAU PRECEDENT :
-# ---------------------------------------------------------
-
- __chmath=AFFE_MATERIAU(MAILLAGE=__nomapi,
- AFFE=_F(TOUT='OUI',
- MATER=__nomath,), )
-
-#
-# ------------------------------------------------------------
-# --- - CALCUL DE LA CONSTANTE DE TORSION PAR RESOLUTION -
-# --- - D UN LAPLACIEN AVEC UN TERME SOURCE EGAL A -2 -
-# --- - L INCONNUE ETANT NULLE SUR LE CONTOUR DE LA SECTION : -
-# --- - LAPLACIEN(PHI) = -2 DANS LA SECTION -
-# --- - PHI = 0 SUR LE CONTOUR : -
-# ------------------------------------------------------------
-#
-# --- ON IMPOSE LA VALEUR 0 A L INCONNUE SCALAIRE SUR LE CONTOUR
-# --- DE LA SECTION
-# --- ET ON A UN TERME SOURCE EGAL A -2 DANS TOUTE LA SECTION :
-# -------------------------------------------------------
-
- motscles={}
- if GROUP_MA_INTE:
- motscles['LIAISON_UNIF']=_F(GROUP_MA=GROUP_MA_INTE,DDL='TEMP'),
- __chart1=AFFE_CHAR_THER(MODELE=__nomoth,
- TEMP_IMPO =_F(GROUP_NO=GROUP_MA_BORD,
- TEMP=0. ),
- SOURCE =_F(TOUT='OUI',
- SOUR=2.0),
- **motscles )
-
-# --- POUR CHAQUE TROU DE LA SECTION :
-# --- .ON A IMPOSE QUE PHI EST CONSTANT SUR LE CONTOUR INTERIEUR
-# --- EN FAISANT LE LIAISON_UNIF DANS LE AFFE_CHAR_THER PRECEDENT
-# --- .ON IMPOSE EN PLUS D(PHI)/DN = 2*AIRE(TROU)/L(TROU)
-# --- OU D/DN DESIGNE LA DERIVEE PAR RAPPORT A LA
-# --- NORMALE ET L DESIGNE LA LONGUEUR DU BORD DU TROU :
-# -------------------------------------------------------
-
- if GROUP_MA_INTE:
- __tbaire=POST_ELEM(MODELE=__nomoth,
- AIRE_INTERNE=_F(GROUP_MA_BORD=GROUP_MA_INTE,), )
-
- motscles={}
- motscles['FLUX_REP']=[]
- if type(GROUP_MA_INTE)==types.StringType:
- motscles['FLUX_REP']=_F(GROUP_MA=GROUP_MA_INTE,CARA_TORSION=__tbaire)
- else:
- motscles['FLUX_REP']=[]
- for grma in GROUP_MA_INTE:
- motscles['FLUX_REP'].append(_F(GROUP_MA=grma,CARA_TORSION=__tbaire),)
- __chart2=AFFE_CHAR_THER(MODELE=__nomoth,**motscles)
-
-# --- RESOLUTION DE LAPLACIEN(PHI) = -2
-# --- AVEC PHI = 0 SUR LE CONTOUR :
-# ----------------------------------------
-
- motscles={}
- motscles['EXCIT']=[_F(CHARGE=__chart1,),]
- if GROUP_MA_INTE:
- motscles['EXCIT'].append(_F(CHARGE=__chart2,))
- __tempe1=THER_LINEAIRE(MODELE=__nomoth,
- CHAM_MATER=__chmath,
- SOLVEUR=_F(STOP_SINGULIER='NON',),
- **motscles )
-
-#
-# ----------------------------------------------
-# --- - CALCUL DU CENTRE DE TORSION/CISAILLEMENT -
-# --- - ET DES COEFFICIENTS DE CISAILLEMENT : -
-# ----------------------------------------------
-#
-# --- POUR LE CALCUL DES CONSTANTES DE CISAILLEMENT, ON VA DEFINIR
-# --- UN PREMIER TERME SOURCE, SECOND MEMBRE DE L EQUATION DE LAPLACE
-# --- PAR UNE FONCTION EGALE A Y :
-# --------------------------
-
- __fnsec1=DEFI_FONCTION(NOM_PARA='X',
- VALE=(0.,0.,10.,10.),
- PROL_DROITE='LINEAIRE',
- PROL_GAUCHE='LINEAIRE',
- )
-
- __fnsec0=DEFI_CONSTANTE(VALE=0.,)
-
-# --- LE TERME SOURCE CONSTITUANT LE SECOND MEMBRE DE L EQUATION
-# --- DE LAPLACE EST PRIS EGAL A Y DANS TOUTE LA SECTION :
-# --------------------------------------------------
-
-
- motscles={}
- if NOEUD:
- motscles['TEMP_IMPO']=(_F(NOEUD=NOEUD,TEMP=__fnsec0))
- __chart2=AFFE_CHAR_THER_F(MODELE=__nomoth,
- SOURCE=_F(TOUT='OUI',
- SOUR=__fnsec1,),
- **motscles )
-
-# --- RESOLUTION DE LAPLACIEN(PHI) = -Y
-# --- AVEC D(PHI)/D(N) = 0 SUR LE CONTOUR :
-# ------------------------------------------------
-
- __tempe2=THER_LINEAIRE(MODELE=__nomoth,
- CHAM_MATER=__chmath,
- EXCIT=_F(CHARGE=__chart2,),
- SOLVEUR=_F(STOP_SINGULIER='NON',),
- )
-
-# --- POUR LE CALCUL DES CONSTANTES DE CISAILLEMENT, ON VA DEFINIR
-# --- UN PREMIER TERME SOURCE, SECOND MEMBRE DE L EQUATION DE LAPLACE
-# --- PAR UNE FONCTION EGALE A Z :
-# --------------------------
-
- __fnsec2=DEFI_FONCTION(NOM_PARA='Y',
- VALE=(0.,0.,10.,10.),
- PROL_DROITE='LINEAIRE',
- PROL_GAUCHE='LINEAIRE',
- )
-
-# --- LE TERME SOURCE CONSTITUANT LE SECOND MEMBRE DE L EQUATION
-# --- DE LAPLACE EST PRIS EGAL A Z DANS TOUTE LA SECTION :
-# --------------------------------------------------
-
- motscles={}
- if NOEUD:
- motscles['TEMP_IMPO']=_F(NOEUD=NOEUD,TEMP=__fnsec0)
- __chart3=AFFE_CHAR_THER_F(MODELE=__nomoth,
- SOURCE=_F(TOUT='OUI',
- SOUR=__fnsec2,),
- **motscles)
-
-# --- RESOLUTION DE LAPLACIEN(PHI) = -Z
-# --- AVEC D(PHI)/D(N) = 0 SUR LE CONTOUR :
-# ------------------------------------------------
-
- __tempe3=THER_LINEAIRE(MODELE=__nomoth,
- CHAM_MATER=__chmath,
- EXCIT=_F(CHARGE=__chart3,),
- SOLVEUR=_F(STOP_SINGULIER='NON',),
- )
-
-# --- CALCUL DE LA CONSTANTE DE TORSION :
-# ---------------------------------
-
- motscles={}
- if GROUP_MA_INTE:
- motscles['CARA_POUTRE']=_F(CARA_GEOM=nomres,
- LAPL_PHI=__tempe1,
- TOUT='OUI',
- OPTION='CARA_TORSION',
- GROUP_MA_INTE=GROUP_MA_INTE,)
- else:
- motscles['CARA_POUTRE']=_F(CARA_GEOM=nomres,
- LAPL_PHI=__tempe1,
- TOUT='OUI',
- OPTION='CARA_TORSION', )
- nomres=POST_ELEM(reuse=nomres,
- MODELE=__nomoth,
- CHAM_MATER=__chmath,
- **motscles )
-
-# --- CALCUL DES COEFFICIENTS DE CISAILLEMENT ET DES COORDONNEES DU
-# --- CENTRE DE CISAILLEMENT/TORSION :
-# ------------------------------
-
- nomres=POST_ELEM(reuse=nomres,
- MODELE=__nomoth,
- CHAM_MATER=__chmath,
- CARA_POUTRE=_F(CARA_GEOM=nomres,
- LAPL_PHI_Y=__tempe2,
- LAPL_PHI_Z=__tempe3,
- TOUT='OUI',
- OPTION='CARA_CISAILLEMENT',), )
-
-#
-# ------------------------------------------------------------
-# --- - CALCUL DE L INERTIE DE GAUCHISSEMENT PAR RESOLUTION DE -
-# --- - LAPLACIEN(OMEGA) = 0 DANS LA SECTION -
-# --- - AVEC D(OMEGA)/D(N) = Z*NY-Y*NZ SUR LE -
-# --- - CONTOUR DE LA SECTION -
-# --- - NY ET NZ SONT LES COMPOSANTES DU VECTEUR N NORMAL -
-# --- - A CE CONTOUR -
-# --- - ET SOMME_S(OMEGA.DS) = 0 -
-# --- - OMEGA EST LA FONCTION DE GAUCHISSEMENT -
-# --- - L INERTIE DE GAUCHISSEMENT EST SOMME_S(OMEGA**2.DS) -
-# ------------------------------------------------------------
-#
-# --- CREATION D UN MAILLAGE DONT LES COORDONNEES SONT EXPRIMEES
-# --- DANS LE REPERE PRINCIPAL D INERTIE MAIS AVEC COMME ORIGINE
-# --- LE CENTRE DE TORSION DE LA SECTION, ON VA DONC UTILISER
-# --- LE MAILLAGE DE NOM NOMAPI DONT LES COORDONNEES SONT
-# --- EXPRIMEES DANS LE REPERE PRINCIPAL D'INERTIE, L'ORIGINE
-# --- ETANT LE CENTRE DE GRAVITE DE LA SECTION (QUI EST DONC
-# --- A CHANGER) :
-# ----------
-
- __nomapt=CREA_MAILLAGE(MAILLAGE=__nomapi,
- REPERE=_F(TABLE=nomres,
- NOM_ORIG='TORSION',) )
-
-# --- AFFECTATION DU PHENOMENE 'THERMIQUE' AU MODELE EN VUE DE
-# --- LA CONSTRUCTION D UN OPERATEUR LAPLACIEN SUR CE MODELE :
-# ------------------------------------------------------
-
- __nomot2=AFFE_MODELE(MAILLAGE=__nomapt,
- AFFE=_F(TOUT='OUI',
- PHENOMENE='THERMIQUE',
- MODELISATION='PLAN', ) )
-
-# --- DEFINITION D UN CHAM_MATER A PARTIR DU MATERIAU PRECEDENT :
-# ---------------------------------------------------------
-
- __chmat2=AFFE_MATERIAU(MAILLAGE=__nomapt,
- AFFE=_F(TOUT='OUI',
- MATER=__nomath, ), )
-
-# --- POUR LE CALCUL DE L INERTIE DE GAUCHISSEMENT, ON VA DEFINIR
-# --- LA COMPOSANTE SELON Y DU FLUX A IMPOSER SUR LE CONTOUR
-# --- PAR UNE FONCTION EGALE A -X :
-# ---------------------------
-
- __fnsec3=DEFI_FONCTION(NOM_PARA='X',
- VALE=(0.,0.,10.,-10.),
- PROL_DROITE='LINEAIRE',
- PROL_GAUCHE='LINEAIRE',
- )
-
-# --- POUR LE CALCUL DE L INERTIE DE GAUCHISSEMENT, ON VA DEFINIR
-# --- LA COMPOSANTE SELON X DU FLUX A IMPOSER SUR LE CONTOUR
-# --- PAR UNE FONCTION EGALE A Y :
-# --------------------------
-
- __fnsec4=DEFI_FONCTION(NOM_PARA='Y',
- VALE=(0.,0.,10.,10.),
- PROL_DROITE='LINEAIRE',
- PROL_GAUCHE='LINEAIRE',
- )
-
-# --- DANS LE BUT D IMPOSER LA RELATION LINEAIRE ENTRE DDLS
-# --- SOMME_SECTION(OMEGA.DS) = 0 ( CETTE CONDITION
-# --- VENANT DE L EQUATION D EQUILIBRE SELON L AXE DE LA POUTRE
-# --- N = 0, N ETANT L EFFORT NORMAL)
-# --- ON CALCULE LE VECTEUR DE CHARGEMENT DU A UN TERME SOURCE EGAL
-# --- A 1., LES TERMES DE CE VECTEUR SONT EGAUX A
-# --- SOMME_SECTION(NI.DS) ET SONT DONC LES COEFFICIENTS DE
-# --- LA RELATION LINEAIRE A IMPOSER.
-# --- ON DEFINIT DONC UN CHARGEMENT DU A UN TERME SOURCE EGAL A 1 :
-# -----------------------------------------------------------
-
- __chart4=AFFE_CHAR_THER(MODELE=__nomot2,
- SOURCE=_F(TOUT='OUI',
- SOUR=1.0), )
-
-# --- ON CALCULE LE VECT_ELEM DU AU CHARGEMENT PRECEDENT
-# --- IL S AGIT DES VECTEURS ELEMENTAIRES DONT LE TERME
-# --- AU NOEUD COURANT I EST EGAL A SOMME_SECTION(NI.DS) :
-# --------------------------------------------------
-
- __vecel=CALC_VECT_ELEM(CHARGE=__chart4,
- OPTION='CHAR_THER'
- )
-
-# --- ON CALCULE LE MATR_ELEM DES MATRICES ELEMENTAIRES
-# --- DE CONDUCTIVITE UNIQUEMENT POUR GENERER LE NUME_DDL
-# --- SUR-LEQUEL S APPUIERA LE CHAMNO UTILISE POUR ECRIRE LA
-# --- RELATION LINEAIRE ENTRE DDLS :
-# ----------------------------
-
- __matel=CALC_MATR_ELEM(MODELE=__nomot2,
- CHAM_MATER=__chmat2,
- CHARGE=__chart4,
- OPTION='RIGI_THER',)
-
-# --- ON DEFINIT LE NUME_DDL ASSOCIE AU MATR_ELEM DEFINI
-# --- PRECEDEMMENT POUR CONSTRUIRE LE CHAMNO UTILISE POUR ECRIRE LA
-# --- RELATION LINEAIRE ENTRE DDLS :
-# ----------------------------
-
- __numddl=NUME_DDL(MATR_RIGI=__matel,
- METHODE='LDLT', )
-
-# --- ON CONSTRUIT LE CHAMNO QUI VA ETRE UTILISE POUR ECRIRE LA
-# --- RELATION LINEAIRE ENTRE DDLS :
-# ----------------------------
-
- __chamno=ASSE_VECTEUR(VECT_ELEM=__vecel,
- NUME_DDL=__numddl, )
-
-# --- ON IMPOSE LA RELATION LINEAIRE ENTRE DDLS
-# --- SOMME_SECTION(OMEGA.DS) = 0 ( CETTE CONDITION
-# --- VENANT DE L EQUATION D EQUILIBRE SELON L AXE DE LA POUTRE
-# --- N = 0, N ETANT L EFFORT NORMAL)
-# --- POUR IMPOSER CETTE RELATION ON PASSE PAR LIAISON_CHAMNO,
-# --- LES TERMES DU CHAMNO (I.E. SOMME_SECTION(NI.DS))
-# --- SONT LES COEFFICIENTS DE LA RELATION LINEAIRE :
-# ---------------------------------------------
-
- __chart5=AFFE_CHAR_THER(MODELE=__nomot2,
- LIAISON_CHAMNO=_F(CHAM_NO=__chamno,
- COEF_IMPO=0.), )
-
-# --- LE CHARGEMENT EST UN FLUX REPARTI NORMAL AU CONTOUR
-# --- DONT LES COMPOSANTES SONT +Z (I.E. +Y) ET -Y (I.E. -X)
-# --- SELON LA DIRECTION NORMALE AU CONTOUR :
-# -------------------------------------
-
- __chart6=AFFE_CHAR_THER_F(MODELE=__nomot2,
- FLUX_REP=_F(GROUP_MA=GROUP_MA_BORD,
- FLUX_X =__fnsec4,
- FLUX_Y =__fnsec3,), )
-
-# --- RESOLUTION DE LAPLACIEN(OMEGA) = 0
-# --- AVEC D(OMEGA)/D(N) = Z*NY-Y*NZ SUR LE CONTOUR DE LA SECTION
-# --- ET SOMME_SECTION(OMEGA.DS) = 0 ( CETTE CONDITION
-# --- VENANT DE L EQUATION D EQUILIBRE SELON L AXE DE LA POUTRE
-# --- N = 0, N ETANT L EFFORT NORMAL) :
-# -------------------------------
-
- __tempe4=THER_LINEAIRE(MODELE=__nomot2,
- CHAM_MATER=__chmat2,
- EXCIT=(_F(CHARGE=__chart5,),
- _F(CHARGE=__chart6,),),
- SOLVEUR=_F(METHODE='LDLT',
- RENUM='SANS',
- STOP_SINGULIER='NON',), )
-
-# --- CALCUL DE L INERTIE DE GAUCHISSEMENT :
-# -------------------------------------
-
- nomres=POST_ELEM(reuse=nomres,
- MODELE=__nomot2,
- CHAM_MATER=__chmat2,
- CARA_POUTRE=_F(CARA_GEOM=nomres,
- LAPL_PHI=__tempe4,
- TOUT='OUI',
- OPTION='CARA_GAUCHI'), )
-
-#
-# ==================================================================
-# --- = CALCUL DE LA CONSTANTE DE TORSION SUR CHAQUE GROUPE =
-# --- = ET DU CENTRE DE TORSION/CISAILLEMENT =
-# --- = DES COEFFICIENTS DE CISAILLEMENT =
-# ==================================================================
-#
-
-
- if GROUP_MA_BORD and GROUP_MA:
-
- if type(GROUP_MA_BORD)==types.StringType :
- l_group_ma_bord=[GROUP_MA_BORD,]
- else:
- l_group_ma_bord= GROUP_MA_BORD
- if type(GROUP_MA)==types.StringType :
- l_group_ma=[GROUP_MA,]
- else:
- l_group_ma= GROUP_MA
-
- if NOEUD:
- if type(NOEUD)==types.StringType :
- l_noeud=[NOEUD,]
- else:
- l_noeud= NOEUD
-
- if len(l_group_ma)!=len(l_group_ma_bord):
- ier=ier+1
- self.cr.fatal("GROUP_MA et GROUP_MA_BORD incoherents")
- return ier
- if NOEUD and (len(l_group_ma)!=len(l_noeud)):
- ier=ier+1
- self.cr.fatal("GROUP_MA et NOEUD incoherents")
- return ier
-
- for i in range(0,len(l_group_ma_bord)):
-
-# --- TRANSFORMATION DES GROUP_MA EN GROUP_NO SUR-LESQUELS
-# --- ON POURRA APPLIQUER DES CONDITIONS DE TEMPERATURE IMPOSEE :
-# ---------------------------------------------------------
-
- __nomlma=DEFI_GROUP(reuse=__nomlma,
- MAILLAGE=__nomlma,
- CREA_GROUP_NO=_F(GROUP_MA=l_group_ma_bord[i],) )
-
-
-# --- CREATION D UN MAILLAGE IDENTIQUE AU PREMIER A CECI PRES
-# --- QUE LES COORDONNEES SONT EXPRIMEES DANS LE REPERE PRINCIPAL
-# --- D INERTIE DONT L ORIGINE EST LE CENTRE DE GRAVITE DE LA SECTION :
-# ---------------------------------------------------------------
-
- __nomapi=CREA_MAILLAGE(MAILLAGE=__nomlma,
- REPERE=_F(TABLE=nomres,
- NOM_ORIG='CDG',
- GROUP_MA=l_group_ma[i], ), )
-
-# --- AFFECTATION DU PHENOMENE 'THERMIQUE' AU MODELE EN VUE DE
-# --- LA CONSTRUCTION D UN OPERATEUR LAPLACIEN SUR CE MODELE :
-# ------------------------------------------------------
-
- __nomoth=AFFE_MODELE(MAILLAGE=__nomapi,
- AFFE=_F(GROUP_MA=l_group_ma[i],
- PHENOMENE='THERMIQUE',
- MODELISATION='PLAN', ) )
-
-# --- POUR LA CONSTRUCTION DU LAPLACIEN, ON DEFINIT UN
-# --- PSEUDO-MATERIAU DONT LES CARACTERISTIQUES THERMIQUES SONT :
-# --- LAMBDA = 1, RHO*CP = 0 :
-# ----------------------
-
- __nomath=DEFI_MATERIAU(THER=_F(LAMBDA=1.0,
- RHO_CP=0.0, ), )
-
-# --- DEFINITION D UN CHAM_MATER A PARTIR DU MATERIAU PRECEDENT :
-# ---------------------------------------------------------
-
- __chmath=AFFE_MATERIAU(MAILLAGE=__nomapi,
- AFFE=_F(TOUT='OUI',
- MATER=__nomath ), )
-
-#
-# ------------------------------------------------------------
-# --- - CALCUL DE LA CONSTANTE DE TORSION PAR RESOLUTION -
-# --- - D UN LAPLACIEN AVEC UN TERME SOURCE EGAL A -2 -
-# --- - L INCONNUE ETANT NULLE SUR LE CONTOUR DE LA SECTION : -
-# --- - LAPLACIEN(PHI) = -2 DANS LA SECTION -
-# --- - PHI = 0 SUR LE CONTOUR : -
-# ------------------------------------------------------------
-#
-# --- ON IMPOSE LA VALEUR 0 A L INCONNUE SCALAIRE SUR LE CONTOUR
-# --- DE LA SECTION
-# --- ET ON A UN TERME SOURCE EGAL A -2 DANS TOUTE LA SECTION :
-# -------------------------------------------------------
-
- __chart1=AFFE_CHAR_THER(MODELE=__nomoth,
- TEMP_IMPO=_F(GROUP_NO=l_group_ma_bord[i],
- TEMP=0.0 ),
- SOURCE=_F(TOUT='OUI',
- SOUR=2.0 ) )
-
-# --- RESOLUTION DE LAPLACIEN(PHI) = -2
-# --- AVEC PHI = 0 SUR LE CONTOUR :
-# ----------------------------------------
-
- __tempe1=THER_LINEAIRE(MODELE=__nomoth,
- CHAM_MATER=__chmath,
- EXCIT=_F(CHARGE=__chart1, ),
- SOLVEUR=_F(STOP_SINGULIER='NON',) )
-
-#
-# ----------------------------------------------
-# --- - CALCUL DU CENTRE DE TORSION/CISAILLEMENT -
-# --- - ET DES COEFFICIENTS DE CISAILLEMENT : -
-# ----------------------------------------------
-#
-# --- POUR LE CALCUL DES CONSTANTES DE CISAILLEMENT, ON VA DEFINIR
-# --- UN PREMIER TERME SOURCE, SECOND MEMBRE DE L EQUATION DE LAPLACE
-# --- PAR UNE FONCTION EGALE A Y :
-# --------------------------
-
- __fnsec1=DEFI_FONCTION(NOM_PARA='X',
- VALE=(0.,0.,10.,10.),
- PROL_DROITE='LINEAIRE',
- PROL_GAUCHE='LINEAIRE', )
-
- __fnsec0=DEFI_CONSTANTE(VALE=0.,)
-
-# --- LE TERME SOURCE CONSTITUANT LE SECOND MEMBRE DE L EQUATION
-# --- DE LAPLACE EST PRIS EGAL A Y DANS TOUTE LA SECTION :
-# --------------------------------------------------
-
- __chart2=AFFE_CHAR_THER_F(MODELE=__nomoth,
- TEMP_IMPO=_F(NOEUD=l_noeud[i],
- TEMP=__fnsec0),
- SOURCE=_F(TOUT='OUI',
- SOUR=__fnsec1) )
-
-# --- RESOLUTION DE LAPLACIEN(PHI) = -Y
-# --- AVEC D(PHI)/D(N) = 0 SUR LE CONTOUR :
-# ------------------------------------------------
-
- __tempe2=THER_LINEAIRE(MODELE=__nomoth,
- CHAM_MATER=__chmath,
- EXCIT=_F(CHARGE=__chart2, ),
- SOLVEUR=_F(STOP_SINGULIER='NON',) )
-
-# --- POUR LE CALCUL DES CONSTANTES DE CISAILLEMENT, ON VA DEFINIR
-# --- UN PREMIER TERME SOURCE, SECOND MEMBRE DE L EQUATION DE LAPLACE
-# --- PAR UNE FONCTION EGALE A Z :
-# --------------------------
-
- __fnsec2=DEFI_FONCTION(NOM_PARA='Y',
- VALE=(0.,0.,10.,10.),
- PROL_DROITE='LINEAIRE',
- PROL_GAUCHE='LINEAIRE', )
-
-# --- LE TERME SOURCE CONSTITUANT LE SECOND MEMBRE DE L EQUATION
-# --- DE LAPLACE EST PRIS EGAL A Z DANS TOUTE LA SECTION :
-# --------------------------------------------------
-
- __chart3=AFFE_CHAR_THER_F(MODELE=__nomoth,
- TEMP_IMPO=_F(NOEUD=l_noeud[i],
- TEMP=__fnsec0),
- SOURCE=_F(TOUT='OUI',
- SOUR=__fnsec2) )
-
-# --- RESOLUTION DE LAPLACIEN(PHI) = -Z
-# --- AVEC D(PHI)/D(N) = 0 SUR LE CONTOUR :
-# ------------------------------------------------
-
- __tempe3=THER_LINEAIRE(MODELE=__nomoth,
- CHAM_MATER=__chmath,
- EXCIT=_F(CHARGE=__chart3, ),
- SOLVEUR=_F(STOP_SINGULIER='NON',) )
-
-# --- CALCUL DE LA CONSTANTE DE TORSION :
-# ---------------------------------
-
- nomres=POST_ELEM(reuse=nomres,
- MODELE=__nomoth,
- CHAM_MATER=__chmath,
- CARA_POUTRE=_F(CARA_GEOM=nomres,
- LAPL_PHI=__tempe1,
- GROUP_MA=l_group_ma[i],
- OPTION='CARA_TORSION' ), )
-
-# --- CALCUL DES COEFFICIENTS DE CISAILLEMENT ET DES COORDONNEES DU
-# --- CENTRE DE CISAILLEMENT/TORSION :
-# ------------------------------
-
- nomres=POST_ELEM(reuse=nomres,
- MODELE=__nomoth,
- CHAM_MATER=__chmath,
- CARA_POUTRE=_F(CARA_GEOM=nomres,
- LAPL_PHI_Y=__tempe2,
- LAPL_PHI_Z=__tempe3,
- GROUP_MA=l_group_ma[i],
- LONGUEUR=LONGUEUR,
- MATERIAU=MATERIAU,
- LIAISON =LIAISON,
- OPTION='CARA_CISAILLEMENT' ), )
-
- return ier
-
diff --git a/Aster/Cata/Macro/macro_matr_asse_ops.py b/Aster/Cata/Macro/macro_matr_asse_ops.py
index 5466b685..4c7f99f1 100644
--- a/Aster/Cata/Macro/macro_matr_asse_ops.py
+++ b/Aster/Cata/Macro/macro_matr_asse_ops.py
@@ -1,21 +1,21 @@
-#@ MODIF macro_matr_asse_ops Macro DATE 14/09/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF macro_matr_asse_ops Macro DATE 01/04/2005 AUTEUR VABHHTS J.PELLET
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-# (AT YOUR OPTION) ANY LATER VERSION.
-#
-# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-#
-# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
-# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
# ======================================================================
@@ -58,6 +58,15 @@ def macro_matr_asse_ops(self,MODELE,CHAM_MATER,CARA_ELEM,MATR_ASSE,
ier=ier+1
self.cr.fatal(" Avec methode MULT_FRONT, RENUM doit etre MDA, MD ou RCMK.")
return ier
+ elif methode=='MUMPS':
+ if SOLVEUR['RENUM']:
+ renum=SOLVEUR['RENUM']
+ else:
+ renum='SANS'
+ if renum not in ('SANS',):
+ ier=ier+1
+ self.cr.fatal(" Avec methode MUMPS, RENUM doit etre SANS.")
+ return ier
elif methode=='GCPC':
if SOLVEUR['RENUM']:
renum=SOLVEUR['RENUM']
@@ -81,7 +90,7 @@ def macro_matr_asse_ops(self,MODELE,CHAM_MATER,CARA_ELEM,MATR_ASSE,
lrigel = 0
lmasel = 0
-# decalage eventuel en premiere position dans la liste de l occurence de MATR_ASSE contenant
+# decalage eventuel en premiere position dans la liste de l occurence de MATR_ASSE contenant
# l option de rigidite
try :
for m in MATR_ASSE:
@@ -103,20 +112,6 @@ def macro_matr_asse_ops(self,MODELE,CHAM_MATER,CARA_ELEM,MATR_ASSE,
self.cr.fatal(" UNE DES OPTIONS DOIT ETRE RIGI_MECA OU RIGI_THER OU RIGI_ACOU OU RIGI_MECA_LAGR")
return ier
- if m['SIEF_ELGA']!=None and option!='RIGI_GEOM':
- ier=ier+1
- self.cr.fatal(" SIEF_ELGA N EST ADMIS QU AVEC L OPTION RIGI_GEOM")
- return ier
-
- if m['MODE_FOURIER']!=None and option not in ('RIGI_MECA','RIGI_FLUI_STRU','RIGI_THER'):
- ier=ier+1
- self.cr.fatal(" MODE_FOURIER N EST ADMIS QU AVEC UNE DES OPTIONS RIGI_MECA RIGI_FLUI_STRU RIGI_THER")
- return ier
-
- if (m['THETA']!=None or m['PROPAGATION']!=None) and option!='RIGI_MECA_LAGR':
- ier=ier+1
- self.cr.fatal(" PROPAGATION ET,OU THETA NE SONT ADMIS QU AVEC L OPTION RIGI_MECA_LAGR")
- return ier
motscles={'OPTION':option}
if option == 'AMOR_MECA':
@@ -134,11 +129,19 @@ def macro_matr_asse_ops(self,MODELE,CHAM_MATER,CARA_ELEM,MATR_ASSE,
if CHAM_MATER != None: motscles['CHAM_MATER'] =CHAM_MATER
if CARA_ELEM != None: motscles['CARA_ELEM'] =CARA_ELEM
if INST != None: motscles['INST'] =INST
- if m['SIEF_ELGA'] : motscles['SIEF_ELGA'] =m['SIEF_ELGA']
- if m['MODE_FOURIER']: motscles['MODE_FOURIER']=m['MODE_FOURIER']
- if m['THETA'] : motscles['THETA'] =m['THETA']
- if m['PROPAGATION'] : motscles['PROPAGATION'] =m['PROPAGATION']
+ try : motscles['SIEF_ELGA'] =m['SIEF_ELGA']
+ except IndexError : pass
+
+ try : motscles['MODE_FOURIER'] =m['MODE_FOURIER']
+ except IndexError : pass
+
+ try : motscles['THETA'] =m['THETA']
+ except IndexError : pass
+
+ try : motscles['PROPAGATION'] =m['PROPAGATION']
+ except IndexError : pass
+ print motscles
__a=CALC_MATR_ELEM(MODELE=MODELE,**motscles)
if option == 'RIGI_MECA':
diff --git a/Aster/Cata/Macro/pre_gmsh_ops.py b/Aster/Cata/Macro/pre_gmsh_ops.py
deleted file mode 100644
index 8ff4170e..00000000
--- a/Aster/Cata/Macro/pre_gmsh_ops.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-#@ MODIF pre_gmsh_ops Macro DATE 11/06/2002 AUTEUR DURAND C.DURAND
-# CONFIGURATION MANAGEMENT OF EDF VERSION
-# ======================================================================
-# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-# (AT YOUR OPTION) ANY LATER VERSION.
-#
-# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-#
-# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
-# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
-# ======================================================================
-
-def pre_gmsh_ops(self,UNITE_MAILLAGE,UNITE_GMSH,MODI_QUAD,**args):
- """
- Ecriture de la macro PRE_GMSH
- """
- import os
- from Macro.ajout_quad_gmsh import ajout_quad_gmsh
- ier=0
-
- PRE_GMSH_LECT =self.get_cmd('PRE_GMSH_LECT')
-
- # La macro compte pour 1 dans la numerotation des commandes
- self.icmd=1
-
- if MODI_QUAD=='OUI':
- cur_dir=os.getcwd()
- unit = str(UNITE_GMSH)
- nomFichierGmsh = cur_dir+'/fort.'+unit
- nomFichierMail = cur_dir+'/sortie'
-
-# récupération du fichier .msh complet mis dans la string 'texte'
-
- fproc=open(nomFichierGmsh,'r')
- texte=fproc.read()
- fproc.close()
-
- resu=ajout_quad_gmsh(texte)
- if not resu:
- ier=ier+1
- self.cr.fatal("Erreur dans la methode python de transformation mailles lineaires-quadratiques")
- return ier
-
- fsort=open(nomFichierMail,'w')
- fsort.write(resu)
- fsort.close()
- os.system('cp '+nomFichierMail+' '+nomFichierGmsh)
-
- PRE_GMSH_LECT(UNITE_MAILLAGE = UNITE_MAILLAGE,
- UNITE_GMSH = UNITE_GMSH )
-
- return ier
-
diff --git a/Aster/Cata/Macro/reca_algo.py b/Aster/Cata/Macro/reca_algo.py
index 319d6d67..65e02bd1 100644
--- a/Aster/Cata/Macro/reca_algo.py
+++ b/Aster/Cata/Macro/reca_algo.py
@@ -1,4 +1,4 @@
-#@ MODIF reca_algo Macro DATE 14/09/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF reca_algo Macro DATE 14/03/2005 AUTEUR DURAND C.DURAND
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -26,7 +26,6 @@ import copy,os
import LinearAlgebra
from Cata.cata import INFO_EXEC_ASTER
from Cata.cata import DETRUIRE
-from Macro.recal import EXTRACT
from Accas import _F
diff --git a/Aster/Cata/Macro/recal.py b/Aster/Cata/Macro/recal.py
index cb2d4778..591614c8 100644
--- a/Aster/Cata/Macro/recal.py
+++ b/Aster/Cata/Macro/recal.py
@@ -1,4 +1,4 @@
-#@ MODIF recal Macro DATE 14/09/2004 AUTEUR MCOURTOI M.COURTOIS
+#@ MODIF recal Macro DATE 14/03/2005 AUTEUR DURAND C.DURAND
# -*- coding: iso-8859-1 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
@@ -29,7 +29,6 @@ import Gnuplot
import Cata
from Cata.cata import INCLUDE,DETRUIRE
from Accas import _F
-from Utilitai.extract import EXTRACT
import os
@@ -151,13 +150,14 @@ def calcul_F(self,UL,para,val,reponses):
Fichier_Resu.append(post_bloc)
#--------------------------------------------------------------------------------
- #on va ajouter la fonction EXTRACT
+ #on va ajouter la fonction d'extraction du numarray de la table par la méthode Array
#et on stocke les réponses calculées dans la liste Lrep
#qui va etre retournée par la fonction calcul_F
self.g_context['Lrep'] = []
Fichier_Resu.append('Lrep=[]'+'\n')
for i in range(len(reponses)):
- Fichier_Resu.append('F = EXTRACT('+str(reponses[i][0])+','+"'"+str(reponses[i][1])+"'"+','+"'"+str(reponses[i][2])+"'"+')'+'\n')
+ Fichier_Resu.append('t'+str(reponses[i][0])+'='+str(reponses[i][0])+'.EXTR_TABLE()'+'\n')
+ Fichier_Resu.append('F = '+'t'+str(reponses[i][0])+'.Array('+"'"+str(reponses[i][1])+"'"+','+"'"+str(reponses[i][2])+"'"+')'+'\n')
Fichier_Resu.append('Lrep.append(F)'+'\n')
#ouverture du fichier fort.3 et mise a jour de celui ci
diff --git a/Pmw/Alpha_99_9_example/__init__.py b/Pmw/Alpha_99_9_example/__init__.py
new file mode 100644
index 00000000..83d04e76
--- /dev/null
+++ b/Pmw/Alpha_99_9_example/__init__.py
@@ -0,0 +1 @@
+# File to allow this directory to be treated as a python package.
diff --git a/Pmw/Alpha_99_9_example/lib/Pmw.def b/Pmw/Alpha_99_9_example/lib/Pmw.def
new file mode 100644
index 00000000..358a2b46
--- /dev/null
+++ b/Pmw/Alpha_99_9_example/lib/Pmw.def
@@ -0,0 +1,9 @@
+# Widgets whose name is the same as its module.
+_widgets = ('AlphaExample',)
+
+# Widgets whose name is not the same as its module.
+_extraWidgets = {}
+
+_functions = {}
+
+_modules = ()
diff --git a/Pmw/Alpha_99_9_example/lib/PmwAlphaExample.py b/Pmw/Alpha_99_9_example/lib/PmwAlphaExample.py
new file mode 100644
index 00000000..5e4f88c1
--- /dev/null
+++ b/Pmw/Alpha_99_9_example/lib/PmwAlphaExample.py
@@ -0,0 +1,24 @@
+import string
+import Pmw
+
+_default_text = "AlphaExample example alpha Pmw megawidget.\nPmw version: " + \
+ Pmw.version() + '\nPmw Alpha versions: ' + \
+ string.join(Pmw.version(alpha = 1), ' ')
+
+class AlphaExample(Pmw.MessageDialog):
+ # Dummy widget for illustrating use of Pmw alpha version directory
+
+ def __init__(self, parent = None, **kw):
+
+ # Define the megawidget options.
+ INITOPT = Pmw.INITOPT
+ optiondefs = (
+ ('message_text', _default_text, None),
+ )
+ self.defineoptions(kw, optiondefs)
+
+ # Initialise the base class (after defining the options).
+ Pmw.MessageDialog.__init__(self, parent)
+
+ # Check keywords and initialise options.
+ self.initialiseoptions(AlphaExample)
diff --git a/Pmw/Alpha_99_9_example/lib/__init__.py b/Pmw/Alpha_99_9_example/lib/__init__.py
new file mode 100644
index 00000000..83d04e76
--- /dev/null
+++ b/Pmw/Alpha_99_9_example/lib/__init__.py
@@ -0,0 +1 @@
+# File to allow this directory to be treated as a python package.
diff --git a/Pmw/Pmw_1_2/__init__.py b/Pmw/Pmw_1_2/__init__.py
new file mode 100644
index 00000000..83d04e76
--- /dev/null
+++ b/Pmw/Pmw_1_2/__init__.py
@@ -0,0 +1 @@
+# File to allow this directory to be treated as a python package.
diff --git a/Pmw/Pmw_1_2/bin/bundlepmw.py b/Pmw/Pmw_1_2/bin/bundlepmw.py
new file mode 100755
index 00000000..fdb7dc00
--- /dev/null
+++ b/Pmw/Pmw_1_2/bin/bundlepmw.py
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+
+# Helper script when freezing Pmw applications. It concatenates all
+# Pmw megawidget files into a single file, 'Pmw.py', in the current
+# directory. The script must be called with one argument, being the
+# path to the 'lib' directory of the required version of Pmw.
+# To freeze a Pmw application, you will also need to copy the
+# following files to the application directory before freezing:
+#
+# PmwBlt.py PmwColor.py
+
+import os
+import regsub
+import string
+import sys
+
+# The order of these files is significant. Files which reference
+# other files must appear later. Files may be deleted if they are not
+# used.
+files = [
+ 'Dialog', 'TimeFuncs', 'Balloon', 'ButtonBox', 'EntryField',
+ 'Group', 'LabeledWidget', 'MainMenuBar', 'MenuBar', 'MessageBar',
+ 'MessageDialog', 'NoteBook', 'OptionMenu', 'PanedWidget', 'PromptDialog',
+ 'RadioSelect', 'ScrolledCanvas', 'ScrolledField', 'ScrolledFrame',
+ 'ScrolledListBox', 'ScrolledText', 'HistoryText', 'SelectionDialog',
+ 'TextDialog', 'TimeCounter', 'AboutDialog', 'ComboBox', 'ComboBoxDialog',
+ 'Counter', 'CounterDialog',
+]
+
+# Set this to 0 if you do not use any of the Pmw.Color functions:
+needColor = 1
+
+# Set this to 0 if you do not use any of the Pmw.Blt functions:
+needBlt = 1
+
+def expandLinks(path):
+ if not os.path.isabs(path):
+ path = os.path.join(os.getcwd(), path)
+ while 1:
+ if not os.path.islink(path):
+ break
+ dir = os.path.dirname(path)
+ path = os.path.join(dir, os.readlink(path))
+
+ return path
+
+def mungeFile(file):
+ # Read the file and modify it so that it can be bundled with the
+ # other Pmw files.
+ file = 'Pmw' + file + '.py'
+ text = open(os.path.join(srcdir, file)).read()
+ text = regsub.gsub('import Pmw\>', '', text)
+ text = regsub.gsub('INITOPT = Pmw.INITOPT', '', text)
+ text = regsub.gsub('\
+#
+# Copyright 2001 MontaVista Software Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+# NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+
+import os
+import Tkinter
+import Pmw
+
+
+class DirBrowserDialog(Pmw.MegaToplevel):
+ def __init__(self, parent = None, **kw):
+ cwd = os.getcwd()
+ # Define the megawidget options.
+ INITOPT = Pmw.INITOPT
+ optiondefs = (
+ ('path', cwd, None),
+ ('hidedotfiles', 1, INITOPT),
+ ('label', None, INITOPT),
+ #('labelmargin', 0, INITOPT),
+ #('labelpos', None, INITOPT),
+ ('borderx', 20, INITOPT),
+ ('bordery', 20, INITOPT),
+ )
+
+ self.defineoptions(kw, optiondefs)
+
+ # Initialise the base class (after defining the options).
+ Pmw.MegaToplevel.__init__(self, parent)
+
+ interior = self.interior()
+
+ self.childframe = self.createcomponent('childframe', (), None,
+ Tkinter.Frame,
+ (interior,),
+ borderwidth = 1,
+ relief = 'raised',
+ )
+ self.childframe.pack(expand = 1,
+ fill = 'both',
+ )
+
+ self.labelframe = self.createcomponent('labelframe', (), None,
+ Tkinter.Frame,
+ (self.childframe,),
+ borderwidth = 2,
+ relief = 'groove',
+ )
+ self.labelframe.pack(padx = 10, pady = 10, expand = 1, fill = 'both')
+
+ if self['label']:
+ self.label = self.createcomponent('label', (), None,
+ Tkinter.Label,
+ (self.childframe,),
+ text = self['label'],
+ )
+ self.label.place(x = (10 + self['borderx']), y = 10, anchor = 'w')
+
+
+ self.workframe = self.createcomponent('workframe', (), None,
+ Tkinter.Frame,
+ (self.labelframe,),
+ #borderwidth = 2,
+ #relief = 'groove',
+ )
+ self.workframe.pack(padx = self['borderx'],
+ pady = self['bordery'],
+ expand = 1,
+ fill = 'both',
+ )
+
+ self.buttonframe = self.createcomponent('buttonframe', (), None,
+ Tkinter.Frame,
+ (interior,),
+ borderwidth = 1,
+ relief = 'raised',
+ )
+ self.buttonframe.pack(expand = 0,
+ fill = 'x',
+ )
+
+ self.optbox = self.createcomponent('optbox', (), None,
+ Pmw.OptionMenu,
+ (self.workframe,),
+ command = self.setpath,
+ )
+ self.optbox.bind('', self._setMinimumSize)
+
+ self.listbox = self.createcomponent('listbox', (), None,
+ Pmw.ScrolledListBox,
+ (self.workframe,),
+ dblclickcommand = self._select,
+ )
+
+ path = self['path']
+ self.entry = self.createcomponent('entryfield', (), None,
+ Pmw.EntryField,
+ (self.workframe,),
+ value = path,
+ command = self.enteredpath,
+ labelpos = 'nw',
+ label_text = 'Current Path:',
+ )
+
+ #self.createlabel(self.workframe, childCols = 1, childRows = 3)
+
+ self.buttonbox = self.createcomponent('buttonbox', (), None,
+ Pmw.ButtonBox,
+ (self.buttonframe,),
+ )
+ self.buttonbox.add('OK', text = 'OK',
+ command = self.okbutton)
+ self.buttonbox.add('Cancel', text = 'Cancel',
+ command = self.cancelbutton)
+ self.buttonbox.add('New Directory', text = 'New Directory',
+ command = self.newdirbutton)
+
+ self.buttonbox.alignbuttons()
+ self.buttonbox.pack(expand = 1, fill = 'x')
+
+ self.optbox.grid(row = 2, column = 2, sticky = 'ew')
+ self.listbox.grid(row = 3, column = 2, sticky = 'news')
+ self.entry.grid(row = 5, column = 2, sticky = 'ew')
+ self.workframe.grid_rowconfigure(3, weight = 1)
+ self.workframe.grid_rowconfigure(4, minsize = 20)
+ self.workframe.grid_columnconfigure(2, weight = 1)
+
+
+ self.setpath(self['path'])
+
+ # Check keywords and initialise options.
+ self.initialiseoptions()
+
+ def setpath(self, path):
+ path = os.path.abspath(os.path.expanduser(path))
+
+ if os.path.isfile(path):
+ path = os.path.dirname(path)
+
+ dirlist = []
+ hidedotfiles = self['hidedotfiles']
+ try:
+ posix = (os.name == 'posix')
+ for entry in os.listdir(path):
+ entryPath = path + '/' + entry
+ if hidedotfiles and entry[0] == '.':
+ # skip dot files if desired
+ continue
+ if not os.path.isdir(entryPath):
+ # skip files
+ continue
+ if not os.access(entryPath, os.R_OK | os.X_OK):
+ # skip directories we can't enter any way
+ continue
+ dirlist.append(entry)
+
+ except:
+ self.entry.setentry(self['path'])
+ return
+
+ self.entry.setentry(path)
+
+ self['path'] = path
+
+ dirlist.sort()
+ if path != '/':
+ dirlist.insert(0, '..')
+
+ self.listbox.setlist(dirlist)
+ pathlist = []
+ while path != '/':
+ pathlist.append(path)
+ path = os.path.dirname(path)
+ pathlist.append('/')
+ self.optbox.setitems(pathlist, 0)
+
+ def _setMinimumSize(self, event):
+ # If the optionmenu changes width, make sure it does not
+ # shrink later.
+ owidth = self.optbox.winfo_width()
+ self.workframe.grid_columnconfigure(2, minsize = owidth)
+
+ def _select(self):
+ sel = self.listbox.getcurselection()
+ if self['path'] == '/':
+ self['path'] = ''
+ if len(sel) > 0:
+ if sel[0] == '..':
+ self.setpath(os.path.dirname(self['path']))
+ else:
+ self.setpath(self['path'] + '/' + sel[0])
+
+
+ def getcurpath(self):
+ return self['path']
+
+ def enteredpath(self):
+ self.setpath(self.entry.get())
+
+ def okbutton(self):
+ self.deactivate(self['path'])
+
+ def cancelbutton(self):
+ self.deactivate(None)
+
+ def newdirbutton(self):
+ CreateDirectoryPopup(self.interior(), self['path'])
+ self.setpath(self['path'])
+
+
+
+class CreateDirectoryPopup:
+ def __init__(self, parent, path):
+ self.path = path
+ self.parent = parent
+ self.newdirpopup = Pmw.PromptDialog(parent,
+ buttons = ('OK', 'Cancel'),
+ defaultbutton = 'OK',
+ title = 'New Directory',
+ entryfield_labelpos = 'nw',
+ label_text = 'Enter new directory name for:\n%s'%self.path,
+ command = self._buttonpress
+ )
+
+ self.newdirpopup.activate()
+
+ def _buttonpress(self, button):
+ if button == 'OK':
+ newdirname = self.newdirpopup.get()
+ dirlist = os.listdir(self.path)
+ if newdirname in dirlist:
+ ErrorPopup(self.parent,
+ 'Error: "%s", already exists as a file or directory.'%newdirname)
+ else:
+ try:
+ os.mkdir(self.path + '/' + newdirname)
+ except:
+ ErrorPopup(self.parent,
+ 'Error: Could not create directory: "%s"'%newdirname)
+ else:
+ self.newdirpopup.deactivate()
+ else:
+ self.newdirpopup.deactivate()
+
+
+def ErrorPopup(parent, message):
+ error = Pmw.MessageDialog(parent, title = 'Error',
+ message_text = message,
+ defaultbutton = 0,
+ )
+ error.activate()
+
+if __name__ == '__main__':
+
+ rootWin = Tkinter.Tk()
+
+ Pmw.initialise()
+
+ rootWin.title('Directory Browser Dialog Demo')
+
+ def buildBrowser():
+ # Create the hierarchical directory browser widget
+ dirBrowserDialog = DirBrowserDialog(rootWin,
+ #labelpos = 'nw',
+ label = 'Select a directory',
+ title = 'Directory Selector',
+ #path = '~',
+ #hidedotfiles = 0,
+ )
+ dir = dirBrowserDialog.activate()
+ print 'Selected Directory:', dir
+
+ dirButton = Tkinter.Button(rootWin, text="Browser", command=buildBrowser)
+ dirButton.pack(side = 'left', padx = 10, pady = 10)
+
+ exitButton = Tkinter.Button(rootWin, text="Quit", command=rootWin.quit)
+ exitButton.pack(side = 'left', padx = 10, pady = 10)
+
+ rootWin.mainloop()
diff --git a/Pmw/Pmw_1_2/contrib/MCListbox.py b/Pmw/Pmw_1_2/contrib/MCListbox.py
new file mode 100644
index 00000000..166b8a04
--- /dev/null
+++ b/Pmw/Pmw_1_2/contrib/MCListbox.py
@@ -0,0 +1,706 @@
+#
+# FILE: MCListbox.py
+#
+# DESCRIPTION:
+# This file provides a generic Multi-Column Listbox widget. It is derived
+# from a heavily hacked version of Pmw.ScrolledFrame
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+# NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+import string
+import Tkinter
+import Pmw
+
+class MultiColumnListbox(Pmw.MegaWidget):
+ def __init__(self, parent = None, **kw):
+ colors = Pmw.Color.getdefaultpalette(parent)
+
+ # Define the megawidget options.
+ INITOPT = Pmw.INITOPT
+ optiondefs = (
+ #('borderframe', 1, INITOPT),
+ ('horizflex', 'fixed', self._horizflex),
+ ('horizfraction', 0.05, INITOPT),
+ ('hscrollmode', 'dynamic', self._hscrollMode),
+ ('labelmargin', 0, INITOPT),
+ ('labelpos', None, INITOPT),
+ ('scrollmargin', 2, INITOPT),
+ ('usehullsize', 0, INITOPT),
+ ('vertflex', 'fixed', self._vertflex),
+ ('vertfraction', 0.05, INITOPT),
+ ('vscrollmode', 'dynamic', self._vscrollMode),
+ ('labellist', None, INITOPT),
+ ('selectbackground', colors['selectBackground'], INITOPT),
+ ('selectforeground', colors['selectForeground'], INITOPT),
+ ('background', colors['background'], INITOPT),
+ ('foreground', colors['foreground'], INITOPT),
+ ('command', None, None),
+ ('dblclickcommand', None, None),
+ )
+ self.defineoptions(kw, optiondefs)
+
+ # Initialise the base class (after defining the options).
+ Pmw.MegaWidget.__init__(self, parent)
+
+ self._numcolumns = len(self['labellist'])
+ self._columnlabels = self['labellist']
+ self._lineid = 0
+ self._numrows = 0
+ self._lineitemframes = []
+ self._lineitems = []
+ self._lineitemdata = {}
+ self._labelframe = {}
+ self._cursel = []
+
+ # Create the components.
+ self.origInterior = Pmw.MegaWidget.interior(self)
+
+ if self['usehullsize']:
+ self.origInterior.grid_propagate(0)
+
+ # Create a frame widget to act as the border of the clipper.
+ self._borderframe = self.createcomponent('borderframe',
+ (), None,
+ Tkinter.Frame,
+ (self.origInterior,),
+ relief = 'sunken',
+ borderwidth = 2,
+ )
+ self._borderframe.grid(row = 2, column = 2,
+ rowspan = 2, sticky = 'news')
+
+ # Create the clipping windows.
+ self._hclipper = self.createcomponent('hclipper',
+ (), None,
+ Tkinter.Frame,
+ (self._borderframe,),
+ width = 400,
+ height = 300,
+ )
+ self._hclipper.pack(fill = 'both', expand = 1)
+
+ self._hsframe = self.createcomponent('hsframe', (), None,
+ Tkinter.Frame,
+ (self._hclipper,),
+ )
+
+
+ self._vclipper = self.createcomponent('vclipper',
+ (), None,
+ Tkinter.Frame,
+ (self._hsframe,),
+ #width = 400,
+ #height = 300,
+ highlightthickness = 0,
+ borderwidth = 0,
+ )
+
+ self._vclipper.grid(row = 1, column = 0,
+ columnspan = self._numcolumns,
+ sticky = 'news')#, expand = 1)
+ self._hsframe.grid_rowconfigure(1, weight = 1)#, minsize = 300)
+
+
+ gridcolumn = 0
+ for labeltext in self._columnlabels:
+ lframe = self.createcomponent(labeltext+'frame', (), None,
+ Tkinter.Frame,
+ (self._hsframe,),
+ borderwidth = 1,
+ relief = 'raised',
+ )
+ label = self.createcomponent(labeltext, (), None,
+ Tkinter.Label,
+ (lframe,),
+ text = labeltext,
+ )
+ label.pack(expand = 0, fill = 'y', side = 'left')
+ lframe.grid(row = 0, column = gridcolumn, sticky = 'ews')
+ self._labelframe[labeltext] = lframe
+ #lframe.update()
+ #print lframe.winfo_reqwidth()
+ self._hsframe.grid_columnconfigure(gridcolumn, weight = 1)
+ gridcolumn = gridcolumn + 1
+
+ lframe.update()
+ self._labelheight = lframe.winfo_reqheight()
+ self.origInterior.grid_rowconfigure(2, minsize = self._labelheight + 2)
+
+ self.origInterior.grid_rowconfigure(3, weight = 1, minsize = 0)
+ self.origInterior.grid_columnconfigure(2, weight = 1, minsize = 0)
+
+ # Create the horizontal scrollbar
+ self._horizScrollbar = self.createcomponent('horizscrollbar',
+ (), 'Scrollbar',
+ Tkinter.Scrollbar,
+ (self.origInterior,),
+ orient='horizontal',
+ command=self._xview
+ )
+
+ # Create the vertical scrollbar
+ self._vertScrollbar = self.createcomponent('vertscrollbar',
+ (), 'Scrollbar',
+ Tkinter.Scrollbar,
+ (self.origInterior,),
+ #(self._hclipper,),
+ orient='vertical',
+ command=self._yview
+ )
+
+ self.createlabel(self.origInterior, childCols = 3, childRows = 4)
+
+ # Initialise instance variables.
+ self._horizScrollbarOn = 0
+ self._vertScrollbarOn = 0
+ self.scrollTimer = None
+ self._scrollRecurse = 0
+ self._horizScrollbarNeeded = 0
+ self._vertScrollbarNeeded = 0
+ self.startX = 0
+ self.startY = 0
+ self._flexoptions = ('fixed', 'expand', 'shrink', 'elastic')
+
+ # Create a frame in the clipper to contain the widgets to be
+ # scrolled.
+ self._vsframe = self.createcomponent('vsframe',
+ (), None,
+ Tkinter.Frame,
+ (self._vclipper,),
+ #height = 300,
+ #borderwidth = 4,
+ #relief = 'groove',
+ )
+
+ # Whenever the clipping window or scrolled frame change size,
+ # update the scrollbars.
+ self._hsframe.bind('', self._reposition)
+ self._vsframe.bind('', self._reposition)
+ self._hclipper.bind('', self._reposition)
+ self._vclipper.bind('', self._reposition)
+
+ #elf._vsframe.bind('', self._vsframeselect)
+
+ # Check keywords and initialise options.
+ self.initialiseoptions()
+
+ def destroy(self):
+ if self.scrollTimer is not None:
+ self.after_cancel(self.scrollTimer)
+ self.scrollTimer = None
+ Pmw.MegaWidget.destroy(self)
+
+ # ======================================================================
+
+ # Public methods.
+
+ def interior(self):
+ return self._vsframe
+
+ # Set timer to call real reposition method, so that it is not
+ # called multiple times when many things are reconfigured at the
+ # same time.
+ def reposition(self):
+ if self.scrollTimer is None:
+ self.scrollTimer = self.after_idle(self._scrollBothNow)
+
+
+
+ def insertrow(self, index, rowdata):
+ #if len(rowdata) != self._numcolumns:
+ # raise ValueError, 'Number of items in rowdata does not match number of columns.'
+ if index > self._numrows:
+ index = self._numrows
+
+ rowframes = {}
+ for columnlabel in self._columnlabels:
+ celldata = rowdata.get(columnlabel)
+ cellframe = self.createcomponent(('cellframeid.%d.%s'%(self._lineid,
+ columnlabel)),
+ (), ('Cellframerowid.%d'%self._lineid),
+ Tkinter.Frame,
+ (self._vsframe,),
+ background = self['background'],
+ #borderwidth = 1,
+ #relief = 'flat'
+ )
+
+ cellframe.bind('', self._cellframedblclick)
+ cellframe.bind('', self._cellframeselect)
+
+ if celldata:
+ cell = self.createcomponent(('cellid.%d.%s'%(self._lineid,
+ columnlabel)),
+ (), ('Cellrowid.%d'%self._lineid),
+ Tkinter.Label,
+ (cellframe,),
+ background = self['background'],
+ foreground = self['foreground'],
+ text = celldata,
+ )
+
+ cell.bind('', self._celldblclick)
+ cell.bind('', self._cellselect)
+
+ cell.pack(expand = 0, fill = 'y', side = 'left', padx = 1, pady = 1)
+ rowframes[columnlabel] = cellframe
+
+ self._lineitemdata[self._lineid] = rowdata
+ self._lineitems.insert(index, self._lineid)
+ self._lineitemframes.insert(index, rowframes)
+ self._numrows = self._numrows + 1
+ self._lineid = self._lineid + 1
+
+ self._placedata(index)
+
+ def _placedata(self, index = 0):
+ gridy = index
+ for rowframes in self._lineitemframes[index:]:
+ gridx = 0
+ for columnlabel in self._columnlabels:
+ rowframes[columnlabel].grid(row = gridy,
+ column = gridx,
+ sticky = 'news')
+ gridx = gridx + 1
+ gridy = gridy + 1
+
+
+
+ def addrow(self, rowdata):
+ self.insertrow(self._numrows, rowdata)
+
+ def delrow(self, index):
+ rowframes = self._lineitemframes.pop(index)
+ for columnlabel in self._columnlabels:
+ rowframes[columnlabel].destroy()
+ self._placedata(index)
+ self._numrows = self._numrows - 1
+ del self._lineitems[index]
+ if index in self._cursel:
+ self._cursel.remove(index)
+
+
+ def curselection(self):
+ # Return a tuple of just one element as this will probably be the
+ # interface used in a future implementation when multiple rows can
+ # be selected at once.
+ return tuple(self._cursel)
+
+ def getcurselection(self):
+ # Return a tuple of just one row as this will probably be the
+ # interface used in a future implementation when multiple rows can
+ # be selected at once.
+ sellist = []
+ for sel in self._cursel:
+ sellist.append(self._lineitemdata[self._lineitems[sel]])
+ return tuple(sellist)
+
+ # ======================================================================
+
+ # Configuration methods.
+
+ def _hscrollMode(self):
+ # The horizontal scroll mode has been configured.
+
+ mode = self['hscrollmode']
+
+
+ if mode == 'static':
+ if not self._horizScrollbarOn:
+ self._toggleHorizScrollbar()
+ elif mode == 'dynamic':
+ if self._horizScrollbarNeeded != self._horizScrollbarOn:
+ self._toggleHorizScrollbar()
+ elif mode == 'none':
+ if self._horizScrollbarOn:
+ self._toggleHorizScrollbar()
+ else:
+ message = 'bad hscrollmode option "%s": should be static, dynamic, or none' % mode
+ raise ValueError, message
+
+ def _vscrollMode(self):
+ # The vertical scroll mode has been configured.
+
+ mode = self['vscrollmode']
+
+ if mode == 'static':
+ if not self._vertScrollbarOn:
+ self._toggleVertScrollbar()
+ elif mode == 'dynamic':
+ if self._vertScrollbarNeeded != self._vertScrollbarOn:
+ self._toggleVertScrollbar()
+ elif mode == 'none':
+ if self._vertScrollbarOn:
+ self._toggleVertScrollbar()
+ else:
+ message = 'bad vscrollmode option "%s": should be static, dynamic, or none' % mode
+ raise ValueError, message
+
+ def _horizflex(self):
+ # The horizontal flex mode has been configured.
+
+ flex = self['horizflex']
+
+ if flex not in self._flexoptions:
+ message = 'bad horizflex option "%s": should be one of %s' % \
+ mode, str(self._flexoptions)
+ raise ValueError, message
+
+ self.reposition()
+
+ def _vertflex(self):
+ # The vertical flex mode has been configured.
+
+ flex = self['vertflex']
+
+ if flex not in self._flexoptions:
+ message = 'bad vertflex option "%s": should be one of %s' % \
+ mode, str(self._flexoptions)
+ raise ValueError, message
+
+ self.reposition()
+
+
+
+ # ======================================================================
+
+ # Private methods.
+
+ def _reposition(self, event):
+ gridx = 0
+ for col in self._columnlabels:
+ maxwidth = self._labelframe[col].winfo_reqwidth()
+ for row in self._lineitemframes:
+ cellwidth = row[col].winfo_reqwidth()
+ if cellwidth > maxwidth:
+ maxwidth = cellwidth
+ self._hsframe.grid_columnconfigure(gridx, minsize = maxwidth)
+ gridwidth = self._hsframe.grid_bbox(column = gridx, row = 0)[2]
+ if self['horizflex'] in ('expand', 'elastic') and gridwidth > maxwidth:
+ maxwidth = gridwidth
+ self._vsframe.grid_columnconfigure(gridx, minsize = maxwidth)
+ gridx = gridx + 1
+
+
+
+ self._vclipper.configure(height = self._hclipper.winfo_height() - self._labelheight)
+
+ self.reposition()
+
+ # Called when the user clicks in the horizontal scrollbar.
+ # Calculates new position of frame then calls reposition() to
+ # update the frame and the scrollbar.
+ def _xview(self, mode, value, units = None):
+
+ if mode == 'moveto':
+ frameWidth = self._hsframe.winfo_reqwidth()
+ self.startX = string.atof(value) * float(frameWidth)
+ else:
+ clipperWidth = self._hclipper.winfo_width()
+ if units == 'units':
+ jump = int(clipperWidth * self['horizfraction'])
+ else:
+ jump = clipperWidth
+
+ if value == '1':
+ self.startX = self.startX + jump
+ else:
+ self.startX = self.startX - jump
+
+ self.reposition()
+
+ # Called when the user clicks in the vertical scrollbar.
+ # Calculates new position of frame then calls reposition() to
+ # update the frame and the scrollbar.
+ def _yview(self, mode, value, units = None):
+
+ if mode == 'moveto':
+ frameHeight = self._vsframe.winfo_reqheight()
+ self.startY = string.atof(value) * float(frameHeight)
+ else:
+ clipperHeight = self._vclipper.winfo_height()
+ if units == 'units':
+ jump = int(clipperHeight * self['vertfraction'])
+ else:
+ jump = clipperHeight
+
+ if value == '1':
+ self.startY = self.startY + jump
+ else:
+ self.startY = self.startY - jump
+
+ self.reposition()
+
+ def _getxview(self):
+
+ # Horizontal dimension.
+ clipperWidth = self._hclipper.winfo_width()
+ frameWidth = self._hsframe.winfo_reqwidth()
+ if frameWidth <= clipperWidth:
+ # The scrolled frame is smaller than the clipping window.
+
+ self.startX = 0
+ endScrollX = 1.0
+
+ if self['horizflex'] in ('expand', 'elastic'):
+ relwidth = 1
+ else:
+ relwidth = ''
+ else:
+ # The scrolled frame is larger than the clipping window.
+
+ if self['horizflex'] in ('shrink', 'elastic'):
+ self.startX = 0
+ endScrollX = 1.0
+ relwidth = 1
+ else:
+ if self.startX + clipperWidth > frameWidth:
+ self.startX = frameWidth - clipperWidth
+ endScrollX = 1.0
+ else:
+ if self.startX < 0:
+ self.startX = 0
+ endScrollX = (self.startX + clipperWidth) / float(frameWidth)
+ relwidth = ''
+
+ # Position frame relative to clipper.
+ self._hsframe.place(x = -self.startX, relwidth = relwidth)
+ return (self.startX / float(frameWidth), endScrollX)
+
+ def _getyview(self):
+
+ # Vertical dimension.
+ clipperHeight = self._vclipper.winfo_height()
+ frameHeight = self._vsframe.winfo_reqheight()
+ if frameHeight <= clipperHeight:
+ # The scrolled frame is smaller than the clipping window.
+
+ self.startY = 0
+ endScrollY = 1.0
+
+ if self['vertflex'] in ('expand', 'elastic'):
+ relheight = 1
+ else:
+ relheight = ''
+ else:
+ # The scrolled frame is larger than the clipping window.
+
+ if self['vertflex'] in ('shrink', 'elastic'):
+ self.startY = 0
+ endScrollY = 1.0
+ relheight = 1
+ else:
+ if self.startY + clipperHeight > frameHeight:
+ self.startY = frameHeight - clipperHeight
+ endScrollY = 1.0
+ else:
+ if self.startY < 0:
+ self.startY = 0
+ endScrollY = (self.startY + clipperHeight) / float(frameHeight)
+ relheight = ''
+
+ # Position frame relative to clipper.
+ self._vsframe.place(y = -self.startY, relheight = relheight)
+ return (self.startY / float(frameHeight), endScrollY)
+
+ # According to the relative geometries of the frame and the
+ # clipper, reposition the frame within the clipper and reset the
+ # scrollbars.
+ def _scrollBothNow(self):
+ self.scrollTimer = None
+
+ # Call update_idletasks to make sure that the containing frame
+ # has been resized before we attempt to set the scrollbars.
+ # Otherwise the scrollbars may be mapped/unmapped continuously.
+ self._scrollRecurse = self._scrollRecurse + 1
+ self.update_idletasks()
+ self._scrollRecurse = self._scrollRecurse - 1
+ if self._scrollRecurse != 0:
+ return
+
+ xview = self._getxview()
+ yview = self._getyview()
+ self._horizScrollbar.set(xview[0], xview[1])
+ self._vertScrollbar.set(yview[0], yview[1])
+
+ self._horizScrollbarNeeded = (xview != (0.0, 1.0))
+ self._vertScrollbarNeeded = (yview != (0.0, 1.0))
+
+ # If both horizontal and vertical scrollmodes are dynamic and
+ # currently only one scrollbar is mapped and both should be
+ # toggled, then unmap the mapped scrollbar. This prevents a
+ # continuous mapping and unmapping of the scrollbars.
+ if (self['hscrollmode'] == self['vscrollmode'] == 'dynamic' and
+ self._horizScrollbarNeeded != self._horizScrollbarOn and
+ self._vertScrollbarNeeded != self._vertScrollbarOn and
+ self._vertScrollbarOn != self._horizScrollbarOn):
+ if self._horizScrollbarOn:
+ self._toggleHorizScrollbar()
+ else:
+ self._toggleVertScrollbar()
+ return
+
+ if self['hscrollmode'] == 'dynamic':
+ if self._horizScrollbarNeeded != self._horizScrollbarOn:
+ self._toggleHorizScrollbar()
+
+ if self['vscrollmode'] == 'dynamic':
+ if self._vertScrollbarNeeded != self._vertScrollbarOn:
+ self._toggleVertScrollbar()
+
+ def _toggleHorizScrollbar(self):
+
+ self._horizScrollbarOn = not self._horizScrollbarOn
+
+ interior = self.origInterior
+ if self._horizScrollbarOn:
+ self._horizScrollbar.grid(row = 5, column = 2, sticky = 'news')
+ interior.grid_rowconfigure(4, minsize = self['scrollmargin'])
+ else:
+ self._horizScrollbar.grid_forget()
+ interior.grid_rowconfigure(4, minsize = 0)
+
+ def _toggleVertScrollbar(self):
+
+ self._vertScrollbarOn = not self._vertScrollbarOn
+
+ interior = self.origInterior
+ if self._vertScrollbarOn:
+ self._vertScrollbar.grid(row = 3, column = 4, sticky = 'news')
+ interior.grid_columnconfigure(3, minsize = self['scrollmargin'])
+ else:
+ self._vertScrollbar.grid_forget()
+ interior.grid_columnconfigure(3, minsize = 0)
+
+ # ======================================================================
+
+ # Selection methods.
+
+ #def _vsframeselect(self, event):
+ # print 'vsframe event x: %d y: %d'%(event.x, event.y)
+ # col, row = self._vsframe.grid_location(event.x, event.y)
+ # self._select(col, row)
+
+ def _cellframeselect(self, event):
+ #print 'cellframe event x: %d y: %d'%(event.x, event.y)
+ x = event.widget.winfo_x()
+ y = event.widget.winfo_y()
+ #col, row = self._vsframe.grid_location(x + event.x, y + event.y)
+ self._select(x + event.x, y + event.y)#(col, row)
+
+ def _cellselect(self, event):
+ #print 'cell event x: %d y: %d'%(event.x, event.y)
+ lx = event.widget.winfo_x()
+ ly = event.widget.winfo_y()
+ parent = event.widget.pack_info()['in']
+ fx = parent.winfo_x()
+ fy = parent.winfo_y()
+ #col, row = self._vsframe.grid_location(fx + lx + event.x, fy + ly + event.y)
+ self._select(fx + lx + event.x, fy + ly + event.y)#(col, row)
+
+ def _select(self, x, y):
+ col, row = self._vsframe.grid_location(x, y)
+ #print 'Clicked on col: %d row: %d'%(col,row)
+ cfg = {}
+ lineid = self._lineitems[row]
+ cfg['Cellrowid.%d_foreground'%lineid] = self['selectforeground']
+ cfg['Cellrowid.%d_background'%lineid] = self['selectbackground']
+ cfg['Cellframerowid.%d_background'%lineid] = self['selectbackground']
+ #cfg['Cellframerowid%d_relief'%row] = 'raised'
+
+ if self._cursel != []:
+ cursel = self._cursel[0]
+ lineid = self._lineitems[cursel]
+ if cursel != None and cursel != row:
+ cfg['Cellrowid.%d_foreground'%lineid] = self['foreground']
+ cfg['Cellrowid.%d_background'%lineid] = self['background']
+ cfg['Cellframerowid.%d_background'%lineid] = self['background']
+ #cfg['Cellframerowid%d_relief'%cursel] = 'flat'
+
+ apply(self.configure, (), cfg)
+ self._cursel = [row]
+
+ cmd = self['command']
+ if callable(cmd):
+ cmd()
+
+
+
+ def _cellframedblclick(self, event):
+ #print 'double click cell frame'
+ cmd = self['dblclickcommand']
+ if callable(cmd):
+ cmd()
+
+ def _celldblclick(self, event):
+ #print 'double click cell'
+ cmd = self['dblclickcommand']
+ if callable(cmd):
+ cmd()
+
+if __name__ == '__main__':
+
+ rootWin = Tkinter.Tk()
+
+ Pmw.initialise()
+
+ rootWin.title('MultiColumnListbox Demo')
+ rootWin.configure(width = 500, height = 300)
+ rootWin.update()
+
+ def dbl():
+ print listbox.getcurselection()
+
+ listbox = MultiColumnListbox(rootWin,
+ #usehullsize = 1,
+ labellist = ('Column 0',
+ 'Column 1',
+ 'Column 2',
+ 'Column 3',
+ 'Column 4',
+ #'Column 5',
+ #'Column 6',
+ #'Column 7',
+ #'Column 8',
+ #'Column 9',
+ ),
+ horizflex = 'expand',
+ #vertflex = 'elastic',
+ dblclickcommand = dbl,
+ )
+
+
+ #print 'start adding item'
+ for i in range(20):
+ r = {}
+ for j in range(5):
+ r[('Column %d'%j)] = 'Really long item name %d'%i
+ listbox.addrow(r)
+ #print 'items added'
+
+ listbox.pack(expand = 1, fill = 'both', padx = 10, pady = 10)
+
+
+ exitButton = Tkinter.Button(rootWin, text="Quit", command=rootWin.quit)
+ exitButton.pack(side = 'left', padx = 10, pady = 10)
+
+ rootWin.mainloop()
diff --git a/Pmw/Pmw_1_2/contrib/PmwFileDialog.py b/Pmw/Pmw_1_2/contrib/PmwFileDialog.py
new file mode 100644
index 00000000..dc7b4616
--- /dev/null
+++ b/Pmw/Pmw_1_2/contrib/PmwFileDialog.py
@@ -0,0 +1,498 @@
+#
+__version__ = '$Id: PmwFileDialog.py,v 1.2 2002/08/23 15:03:35 gregm Exp $'
+#
+# Filename dialogs using Pmw
+#
+# (C) Rob W.W. Hooft, Nonius BV, 1998
+#
+# Modifications:
+#
+# J. Willem M. Nissink, Cambridge Crystallographic Data Centre, 8/2002
+# Added optional information pane at top of dialog; if option
+# 'info' is specified, the text given will be shown (in blue).
+# Modified example to show both file and directory-type dialog
+#
+# No Guarantees. Distribute Freely.
+# Please send bug-fixes/patches/features to
+#
+################################################################################
+import os,fnmatch,time
+import Tkinter,Pmw
+#Pmw.setversion("0.8.5")
+
+def _errorpop(master,text):
+ d=Pmw.MessageDialog(master,
+ title="Error",
+ message_text=text,
+ buttons=("OK",))
+ d.component('message').pack(ipadx=15,ipady=15)
+ d.activate()
+ d.destroy()
+
+class PmwFileDialog(Pmw.Dialog):
+ """File Dialog using Pmw"""
+ def __init__(self, parent = None, **kw):
+ # Define the megawidget options.
+ optiondefs = (
+ ('filter', '*', self.newfilter),
+ ('directory', os.getcwd(), self.newdir),
+ ('filename', '', self.newfilename),
+ ('historylen',10, None),
+ ('command', None, None),
+ ('info', None, None),
+ )
+ self.defineoptions(kw, optiondefs)
+ # Initialise base class (after defining options).
+ Pmw.Dialog.__init__(self, parent)
+
+ self.withdraw()
+
+ # Create the components.
+ interior = self.interior()
+
+ if self['info'] is not None:
+ rowoffset=1
+ dn = self.infotxt()
+ dn.grid(row=0,column=0,columnspan=2,padx=3,pady=3)
+ else:
+ rowoffset=0
+
+ dn = self.mkdn()
+ dn.grid(row=0+rowoffset,column=0,columnspan=2,padx=3,pady=3)
+ del dn
+
+ # Create the directory list component.
+ dnb = self.mkdnb()
+ dnb.grid(row=1+rowoffset,column=0,sticky='news',padx=3,pady=3)
+ del dnb
+
+ # Create the filename list component.
+ fnb = self.mkfnb()
+ fnb.grid(row=1+rowoffset,column=1,sticky='news',padx=3,pady=3)
+ del fnb
+
+ # Create the filter entry
+ ft = self.mkft()
+ ft.grid(row=2+rowoffset,column=0,columnspan=2,padx=3,pady=3)
+ del ft
+
+ # Create the filename entry
+ fn = self.mkfn()
+ fn.grid(row=3+rowoffset,column=0,columnspan=2,padx=3,pady=3)
+ fn.bind('',self.okbutton)
+ del fn
+
+ # Buttonbox already exists
+ bb=self.component('buttonbox')
+ bb.add('OK',command=self.okbutton)
+ bb.add('Cancel',command=self.cancelbutton)
+ del bb
+
+ Pmw.alignlabels([self.component('filename'),
+ self.component('filter'),
+ self.component('dirname')])
+
+ def infotxt(self):
+ """ Make information block component at the top """
+ return self.createcomponent(
+ 'infobox',
+ (), None,
+ Tkinter.Label, (self.interior(),),
+ width=51,
+ relief='groove',
+ foreground='darkblue',
+ justify='left',
+ text=self['info']
+ )
+
+ def mkdn(self):
+ """Make directory name component"""
+ return self.createcomponent(
+ 'dirname',
+ (), None,
+ Pmw.ComboBox, (self.interior(),),
+ entryfield_value=self['directory'],
+ entryfield_entry_width=40,
+ entryfield_validate=self.dirvalidate,
+ selectioncommand=self.setdir,
+ labelpos='w',
+ label_text='Directory:')
+
+ def mkdnb(self):
+ """Make directory name box"""
+ return self.createcomponent(
+ 'dirnamebox',
+ (), None,
+ Pmw.ScrolledListBox, (self.interior(),),
+ label_text='directories',
+ labelpos='n',
+ hscrollmode='none',
+ dblclickcommand=self.selectdir)
+
+ def mkft(self):
+ """Make filter"""
+ return self.createcomponent(
+ 'filter',
+ (), None,
+ Pmw.ComboBox, (self.interior(),),
+ entryfield_value=self['filter'],
+ entryfield_entry_width=40,
+ selectioncommand=self.setfilter,
+ labelpos='w',
+ label_text='Filter:')
+
+ def mkfnb(self):
+ """Make filename list box"""
+ return self.createcomponent(
+ 'filenamebox',
+ (), None,
+ Pmw.ScrolledListBox, (self.interior(),),
+ label_text='files',
+ labelpos='n',
+ hscrollmode='none',
+ selectioncommand=self.singleselectfile,
+ dblclickcommand=self.selectfile)
+
+ def mkfn(self):
+ """Make file name entry"""
+ return self.createcomponent(
+ 'filename',
+ (), None,
+ Pmw.ComboBox, (self.interior(),),
+ entryfield_value=self['filename'],
+ entryfield_entry_width=40,
+ entryfield_validate=self.filevalidate,
+ selectioncommand=self.setfilename,
+ labelpos='w',
+ label_text='Filename:')
+
+ def dirvalidate(self,string):
+ if os.path.isdir(string):
+ return Pmw.OK
+ else:
+ return Pmw.PARTIAL
+
+ def filevalidate(self,string):
+ if string=='':
+ return Pmw.PARTIAL
+ elif os.path.isfile(string):
+ return Pmw.OK
+ elif os.path.exists(string):
+ return Pmw.PARTIAL
+ else:
+ return Pmw.OK
+
+ def okbutton(self):
+ """OK action: user thinks he has input valid data and wants to
+ proceed. This is also called by in the filename entry"""
+ fn=self.component('filename').get()
+ self.setfilename(fn)
+ if self.validate(fn):
+ self.canceled=0
+ self.deactivate()
+
+ def cancelbutton(self):
+ """Cancel the operation"""
+ self.canceled=1
+ self.deactivate()
+
+ def tidy(self,w,v):
+ """Insert text v into the entry and at the top of the list of
+ the combobox w, remove duplicates"""
+ if not v:
+ return
+ entry=w.component('entry')
+ entry.delete(0,'end')
+ entry.insert(0,v)
+ list=w.component('scrolledlist')
+ list.insert(0,v)
+ index=1
+ while indexself['historylen']:
+ list.delete(index)
+ else:
+ index=index+1
+ w.checkentry()
+
+ def setfilename(self,value):
+ if not value:
+ return
+ value=os.path.join(self['directory'],value)
+ dir,fil=os.path.split(value)
+ self.configure(directory=dir,filename=value)
+
+ c=self['command']
+ if callable(c):
+ c()
+
+ def newfilename(self):
+ """Make sure a newly set filename makes it into the combobox list"""
+ self.tidy(self.component('filename'),self['filename'])
+
+ def setfilter(self,value):
+ self.configure(filter=value)
+
+ def newfilter(self):
+ """Make sure a newly set filter makes it into the combobox list"""
+ self.tidy(self.component('filter'),self['filter'])
+ self.fillit()
+
+ def setdir(self,value):
+ self.configure(directory=value)
+
+ def newdir(self):
+ """Make sure a newly set dirname makes it into the combobox list"""
+ self.tidy(self.component('dirname'),self['directory'])
+ self.fillit()
+
+ def singleselectfile(self):
+ """Single click in file listbox. Move file to "filename" combobox"""
+ cs=self.component('filenamebox').curselection()
+ if cs!=():
+ value=self.component('filenamebox').get(cs)
+ self.setfilename(value)
+
+ def selectfile(self):
+ """Take the selected file from the filename, normalize it, and OK"""
+ self.singleselectfile()
+ value=self.component('filename').get()
+ self.setfilename(value)
+ if value:
+ self.okbutton()
+
+ def selectdir(self):
+ """Take selected directory from the dirnamebox into the dirname"""
+ cs=self.component('dirnamebox').curselection()
+ if cs!=():
+ value=self.component('dirnamebox').get(cs)
+ dir=self['directory']
+ if not dir:
+ dir=os.getcwd()
+ if value:
+ if value=='..':
+ dir=os.path.split(dir)[0]
+ else:
+ dir=os.path.join(dir,value)
+ self.configure(directory=dir)
+ self.fillit()
+
+ def askfilename(self,directory=None,filter=None):
+ """The actual client function. Activates the dialog, and
+ returns only after a valid filename has been entered
+ (return value is that filename) or when canceled (return
+ value is None)"""
+ if directory!=None:
+ self.configure(directory=directory)
+ if filter!=None:
+ self.configure(filter=filter)
+ self.fillit()
+ self.canceled=1 # Needed for when user kills dialog window
+ self.activate()
+ if self.canceled:
+ return None
+ else:
+ return self.component('filename').get()
+
+ lastdir=""
+ lastfilter=None
+ lasttime=0
+ def fillit(self):
+ """Get the directory list and show it in the two listboxes"""
+ # Do not run unnecesarily
+ if self.lastdir==self['directory'] and self.lastfilter==self['filter'] and self.lasttime>os.stat(self.lastdir)[8]:
+ return
+ self.lastdir=self['directory']
+ self.lastfilter=self['filter']
+ self.lasttime=time.time()
+ dir=self['directory']
+ if not dir:
+ dir=os.getcwd()
+ dirs=['..']
+ files=[]
+ try:
+ fl=os.listdir(dir)
+ fl.sort()
+ except os.error,arg:
+ if arg[0] in (2,20):
+ return
+ raise
+ for f in fl:
+ if os.path.isdir(os.path.join(dir,f)):
+ dirs.append(f)
+ else:
+ filter=self['filter']
+ if not filter:
+ filter='*'
+ if fnmatch.fnmatch(f,filter):
+ files.append(f)
+ self.component('filenamebox').setlist(files)
+ self.component('dirnamebox').setlist(dirs)
+
+ def validate(self,filename):
+ """Validation function. Should return 1 if the filename is valid,
+ 0 if invalid. May pop up dialogs to tell user why. Especially
+ suited to subclasses: i.e. only return 1 if the file does/doesn't
+ exist"""
+ return 1
+
+class PmwDirDialog(PmwFileDialog):
+ """Directory Dialog using Pmw"""
+ def __init__(self, parent = None, **kw):
+ # Define the megawidget options.
+ optiondefs = (
+ ('directory', os.getcwd(), self.newdir),
+ ('historylen',10, None),
+ ('command', None, None),
+ ('info', None, None),
+ )
+ self.defineoptions(kw, optiondefs)
+ # Initialise base class (after defining options).
+ Pmw.Dialog.__init__(self, parent)
+
+ self.withdraw()
+
+ # Create the components.
+ interior = self.interior()
+
+ if self['info'] is not None:
+ rowoffset=1
+ dn = self.infotxt()
+ dn.grid(row=0,column=0,columnspan=2,padx=3,pady=3)
+ else:
+ rowoffset=0
+
+ dn = self.mkdn()
+ dn.grid(row=1+rowoffset,column=0,columnspan=2,padx=3,pady=3)
+ dn.bind('',self.okbutton)
+ del dn
+
+ # Create the directory list component.
+ dnb = self.mkdnb()
+ dnb.grid(row=0+rowoffset,column=0,columnspan=2,sticky='news',padx=3,pady=3)
+ del dnb
+
+ # Buttonbox already exists
+ bb=self.component('buttonbox')
+ bb.add('OK',command=self.okbutton)
+ bb.add('Cancel',command=self.cancelbutton)
+ del bb
+
+ lastdir=""
+ def fillit(self):
+ """Get the directory list and show it in the two listboxes"""
+ # Do not run unnecesarily
+ if self.lastdir==self['directory']:
+ return
+ self.lastdir=self['directory']
+ dir=self['directory']
+ if not dir:
+ dir=os.getcwd()
+ dirs=['..']
+ try:
+ fl=os.listdir(dir)
+ fl.sort()
+ except os.error,arg:
+ if arg[0] in (2,20):
+ return
+ raise
+ for f in fl:
+ if os.path.isdir(os.path.join(dir,f)):
+ dirs.append(f)
+ self.component('dirnamebox').setlist(dirs)
+
+ def okbutton(self):
+ """OK action: user thinks he has input valid data and wants to
+ proceed. This is also called by in the dirname entry"""
+ fn=self.component('dirname').get()
+ self.configure(directory=fn)
+ if self.validate(fn):
+ self.canceled=0
+ self.deactivate()
+
+ def askfilename(self,directory=None):
+ """The actual client function. Activates the dialog, and
+ returns only after a valid filename has been entered
+ (return value is that filename) or when canceled (return
+ value is None)"""
+ if directory!=None:
+ self.configure(directory=directory)
+ self.fillit()
+ self.activate()
+ if self.canceled:
+ return None
+ else:
+ return self.component('dirname').get()
+
+ def dirvalidate(self,string):
+ if os.path.isdir(string):
+ return Pmw.OK
+ elif os.path.exists(string):
+ return Pmw.PARTIAL
+ else:
+ return Pmw.OK
+
+ def validate(self,filename):
+ """Validation function. Should return 1 if the filename is valid,
+ 0 if invalid. May pop up dialogs to tell user why. Especially
+ suited to subclasses: i.e. only return 1 if the file does/doesn't
+ exist"""
+ if filename=='':
+ _errorpop(self.interior(),"Empty filename")
+ return 0
+ if os.path.isdir(filename) or not os.path.exists(filename):
+ return 1
+ else:
+ _errorpop(self.interior(),"This is not a directory")
+ return 0
+
+class PmwExistingFileDialog(PmwFileDialog):
+ def filevalidate(self,string):
+ if os.path.isfile(string):
+ return Pmw.OK
+ else:
+ return Pmw.PARTIAL
+
+ def validate(self,filename):
+ if os.path.isfile(filename):
+ return 1
+ elif os.path.exists(filename):
+ _errorpop(self.interior(),"This is not a plain file")
+ return 0
+ else:
+ _errorpop(self.interior(),"Please select an existing file")
+ return 0
+
+class PmwExistingDirDialog(PmwDirDialog):
+ def dirvalidate(self,string):
+ if os.path.isdir(string):
+ return Pmw.OK
+ else:
+ return Pmw.PARTIAL
+
+ def validate(self,filename):
+ if os.path.isdir(filename):
+ return 1
+ elif os.path.exists(filename):
+ _errorpop(self.interior(),"This is not a directory")
+ return 0
+ else:
+ _errorpop(self.interior(),"Please select an existing directory")
+
+if __name__=="__main__":
+ root=Tkinter.Tk()
+ root.withdraw()
+ Pmw.initialise()
+
+ f0=PmwFileDialog(root)
+ f0.title('File name dialog')
+ n=f0.askfilename()
+ print '\nFilename : ',repr(n),'\n'
+
+ f1=PmwDirDialog(root,info='This is a directory dialog')
+ f1.title('Directory name dialog')
+ while 1:
+ n=f1.askfilename()
+ if n is None:
+ break
+ print "Dirname : ",repr(n)
diff --git a/Pmw/Pmw_1_2/contrib/PmwFullTimeCounter.py b/Pmw/Pmw_1_2/contrib/PmwFullTimeCounter.py
new file mode 100644
index 00000000..84e605a3
--- /dev/null
+++ b/Pmw/Pmw_1_2/contrib/PmwFullTimeCounter.py
@@ -0,0 +1,492 @@
+# Authors: Joe VanAndel, Greg McFarlane and Daniel Michelson
+
+import string
+import sys
+import time
+import Tkinter
+import Pmw
+
+class FullTimeCounter(Pmw.MegaWidget):
+ """Up-down counter
+
+ A TimeCounter is a single-line entry widget with Up and Down arrows
+ which increment and decrement the Time value in the entry.
+ """
+
+ def __init__(self, parent = None, **kw):
+
+ # Define the megawidget options.
+ INITOPT = Pmw.INITOPT
+ optiondefs = (
+ ('autorepeat', 1, INITOPT),
+ ('buttonaspect', 1.0, INITOPT),
+ ('initwait', 300, INITOPT),
+ ('labelmargin', 0, INITOPT),
+ ('labelpos', None, INITOPT),
+ ('max', '', self._max),
+ ('min', '', self._min),
+ ('padx', 0, INITOPT),
+ ('pady', 0, INITOPT),
+ ('repeatrate', 50, INITOPT),
+ ('value', '', INITOPT),
+ )
+ self.defineoptions(kw, optiondefs)
+
+ # Initialise the base class (after defining the options).
+ Pmw.MegaWidget.__init__(self, parent)
+
+ self.arrowDirection = {}
+ self._flag = 'stopped'
+ self._timerId = None
+
+ self._createComponents()
+
+ value = self['value']
+ if value is None or value == '':
+ now = time.time()
+ value = time.strftime('%Y:%m:%d:%H:%M',time.gmtime(now))
+ self._setTimeFromStr(value)
+
+ # Check keywords and initialise options.
+ self.initialiseoptions()
+
+ def _createComponents(self):
+
+ # Create the components.
+ interior = self.interior()
+
+ # If there is no label, put the arrows and the entry directly
+ # into the interior, otherwise create a frame for them. In
+ # either case the border around the arrows and the entry will
+ # be raised (but not around the label).
+ if self['labelpos'] is None:
+ frame = interior
+ else:
+ frame = self.createcomponent('frame',
+ (), None,
+ Tkinter.Frame, (interior,))
+ frame.grid(column=2, row=2, sticky='nsew')
+ interior.grid_columnconfigure(2, weight=1)
+ interior.grid_rowconfigure(2, weight=1)
+
+ frame.configure(relief = 'raised', borderwidth = 1)
+
+ # Create the down arrow buttons.
+
+ # Create the year down arrow.
+ self._downYearArrowBtn = self.createcomponent('downyeararrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._downYearArrowBtn] = 0
+ self._downYearArrowBtn.grid(column = 0, row = 2)
+
+ # Create the month down arrow.
+ self._downMonthArrowBtn = self.createcomponent('downmontharrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._downMonthArrowBtn] = 0
+ self._downMonthArrowBtn.grid(column = 1, row = 2)
+
+ # Create the day down arrow.
+ self._downDayArrowBtn = self.createcomponent('downdayarrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._downDayArrowBtn] = 0
+ self._downDayArrowBtn.grid(column = 2, row = 2)
+
+ # Create the hour down arrow.
+ self._downHourArrowBtn = self.createcomponent('downhourarrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._downHourArrowBtn] = 0
+ self._downHourArrowBtn.grid(column = 3, row = 2)
+
+ # Create the minute down arrow.
+ self._downMinuteArrowBtn = self.createcomponent('downminutearrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._downMinuteArrowBtn] = 0
+ self._downMinuteArrowBtn.grid(column = 4, row = 2)
+
+ # Create the entry fields.
+
+ # Create the year entry field.
+ self._yearCounterEntry = self.createcomponent('yearentryfield',
+ (('yearentry', 'yearentryfield_entry'),), None,
+ Pmw.EntryField, (frame,), validate='integer', entry_width = 4)
+ self._yearCounterEntry.grid(column = 0, row = 1, sticky = 'news')
+
+ # Create the month entry field.
+ self._monthCounterEntry = self.createcomponent('monthentryfield',
+ (('monthentry', 'monthentryfield_entry'),), None,
+ Pmw.EntryField, (frame,), validate='integer', entry_width = 2)
+ self._monthCounterEntry.grid(column = 1, row = 1, sticky = 'news')
+
+ # Create the day entry field.
+ self._dayCounterEntry = self.createcomponent('dayentryfield',
+ (('dayentry', 'dayentryfield_entry'),), None,
+ Pmw.EntryField, (frame,), validate='integer', entry_width = 2)
+ self._dayCounterEntry.grid(column = 2, row = 1, sticky = 'news')
+
+ # Create the hour entry field.
+ self._hourCounterEntry = self.createcomponent('hourentryfield',
+ (('hourentry', 'hourentryfield_entry'),), None,
+ Pmw.EntryField, (frame,), validate='integer', entry_width = 2)
+ self._hourCounterEntry.grid(column = 3, row = 1, sticky = 'news')
+
+ # Create the minute entry field.
+ self._minuteCounterEntry = self.createcomponent('minuteentryfield',
+ (('minuteentry', 'minuteentryfield_entry'),), None,
+ Pmw.EntryField, (frame,), validate='integer', entry_width = 2)
+ self._minuteCounterEntry.grid(column = 4, row = 1, sticky = 'news')
+
+ # Create the up arrow buttons.
+
+ # Create the year up arrow.
+ self._upYearArrowBtn = self.createcomponent('upyeararrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._upYearArrowBtn] = 1
+ self._upYearArrowBtn.grid(column = 0, row = 0)
+
+ # Create the month up arrow.
+ self._upMonthArrowBtn = self.createcomponent('upmontharrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._upMonthArrowBtn] = 1
+ self._upMonthArrowBtn.grid(column = 1, row = 0)
+
+ # Create the day up arrow.
+ self._upDayArrowBtn = self.createcomponent('updayarrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._upDayArrowBtn] = 1
+ self._upDayArrowBtn.grid(column = 2, row = 0)
+
+ # Create the hour up arrow.
+ self._upHourArrowBtn = self.createcomponent('uphourarrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._upHourArrowBtn] = 1
+ self._upHourArrowBtn.grid(column = 3, row = 0)
+
+ # Create the minute up arrow.
+ self._upMinuteArrowBtn = self.createcomponent('upminutearrow',
+ (), 'Arrow',
+ Tkinter.Canvas, (frame,),
+ width = 16, height = 16, relief = 'raised', borderwidth = 2)
+ self.arrowDirection[self._upMinuteArrowBtn] = 1
+ self._upMinuteArrowBtn.grid(column = 4, row = 0)
+
+ # Make it resize nicely.
+ padx = self['padx']
+ pady = self['pady']
+ for col in range(5): # YY, MM, DD, HH, mm
+ frame.grid_columnconfigure(col, weight = 1, pad = padx)
+ frame.grid_rowconfigure(0, pad = pady)
+ frame.grid_rowconfigure(2, pad = pady)
+
+ frame.grid_rowconfigure(1, weight = 1)
+
+ # Create the label.
+ self.createlabel(interior)
+
+ # Set bindings.
+
+ # Up year
+ self._upYearArrowBtn.bind('',
+ lambda event, s=self,button=self._upYearArrowBtn:
+ s._drawArrow(button, 1))
+ self._upYearArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._upYearArrowBtn:
+ s._countUp(button))
+ self._upYearArrowBtn.bind('',
+ lambda event, s=self, button=self._upYearArrowBtn:
+ s._stopUpDown(button))
+
+ # Up month
+ self._upMonthArrowBtn.bind('',
+ lambda event, s=self,button=self._upMonthArrowBtn:
+ s._drawArrow(button, 1))
+ self._upMonthArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._upMonthArrowBtn:
+ s._countUp(button))
+ self._upMonthArrowBtn.bind('',
+ lambda event, s=self, button=self._upMonthArrowBtn:
+ s._stopUpDown(button))
+
+ # Up day
+ self._upDayArrowBtn.bind('',
+ lambda event, s=self,button=self._upDayArrowBtn:
+ s._drawArrow(button, 1))
+ self._upDayArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._upDayArrowBtn:
+ s._countUp(button))
+ self._upDayArrowBtn.bind('',
+ lambda event, s=self, button=self._upDayArrowBtn:
+ s._stopUpDown(button))
+
+ # Up hour
+ self._upHourArrowBtn.bind('',
+ lambda event, s=self,button=self._upHourArrowBtn:
+ s._drawArrow(button, 1))
+ self._upHourArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._upHourArrowBtn:
+ s._countUp(button))
+ self._upHourArrowBtn.bind('',
+ lambda event, s=self, button=self._upHourArrowBtn:
+ s._stopUpDown(button))
+
+ # Up minute
+ self._upMinuteArrowBtn.bind('',
+ lambda event, s=self,button=self._upMinuteArrowBtn:
+ s._drawArrow(button, 1))
+ self._upMinuteArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._upMinuteArrowBtn:
+ s._countUp(button))
+ self._upMinuteArrowBtn.bind('',
+ lambda event, s=self, button=self._upMinuteArrowBtn:
+ s._stopUpDown(button))
+
+
+ # Down year
+ self._downYearArrowBtn.bind('',
+ lambda event, s=self,button=self._downYearArrowBtn:
+ s._drawArrow(button, 0))
+ self._downYearArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._downYearArrowBtn:
+ s._countDown(button))
+ self._downYearArrowBtn.bind('',
+ lambda event, s=self, button=self._downYearArrowBtn:
+ s._stopUpDown(button))
+
+ # Down month
+ self._downMonthArrowBtn.bind('',
+ lambda event, s=self,button=self._downMonthArrowBtn:
+ s._drawArrow(button, 0))
+ self._downMonthArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._downMonthArrowBtn:
+ s._countDown(button))
+ self._downMonthArrowBtn.bind('',
+ lambda event, s=self, button=self._downMonthArrowBtn:
+ s._stopUpDown(button))
+
+ # Down day
+ self._downDayArrowBtn.bind('',
+ lambda event, s=self,button=self._downDayArrowBtn:
+ s._drawArrow(button, 0))
+ self._downDayArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._downDayArrowBtn:
+ s._countDown(button))
+ self._downDayArrowBtn.bind('',
+ lambda event, s=self, button=self._downDayArrowBtn:
+ s._stopUpDown(button))
+
+ # Down hour
+ self._downHourArrowBtn.bind('',
+ lambda event, s=self,button=self._downHourArrowBtn:
+ s._drawArrow(button, 0))
+ self._downHourArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._downHourArrowBtn:
+ s._countDown(button))
+ self._downHourArrowBtn.bind('',
+ lambda event, s=self, button=self._downHourArrowBtn:
+ s._stopUpDown(button))
+
+ # Down minute
+ self._downMinuteArrowBtn.bind('',
+ lambda event, s=self,button=self._downMinuteArrowBtn:
+ s._drawArrow(button, 0))
+ self._downMinuteArrowBtn.bind('<1>',
+ lambda event, s=self,button=self._downMinuteArrowBtn: s._countDown(button))
+ self._downMinuteArrowBtn.bind('',
+ lambda event, s=self, button=self._downMinuteArrowBtn:
+ s._stopUpDown(button))
+
+
+ self._yearCounterEntry.bind('', self.invoke)
+ self._monthCounterEntry.bind('', self.invoke)
+ self._dayCounterEntry.bind('', self.invoke)
+ self._hourCounterEntry.bind('', self.invoke)
+ self._minuteCounterEntry.bind('', self.invoke)
+
+ self._yearCounterEntry.bind('', self._resizeArrow)
+ self._monthCounterEntry.bind('', self._resizeArrow)
+ self._dayCounterEntry.bind('', self._resizeArrow)
+ self._hourCounterEntry.bind('', self._resizeArrow)
+ self._minuteCounterEntry.bind('', self._resizeArrow)
+
+ def _drawArrow(self, arrow, direction):
+ arrow.delete('arrow')
+
+ fg = self._yearCounterEntry.cget('entry_foreground')
+
+ bw = (string.atoi(arrow['borderwidth']) +
+ string.atoi(arrow['highlightthickness'])) / 2
+ h = string.atoi(arrow['height']) + 2 * bw
+ w = string.atoi(arrow['width']) + 2 * bw
+
+ if direction == 0:
+ # down arrow
+ arrow.create_polygon(
+ 0.25 * w + bw, 0.25 * h + bw,
+ 0.50 * w + bw, 0.75 * h + bw,
+ 0.75 * w + bw, 0.25 * h + bw,
+ fill=fg, tag='arrow')
+ else:
+ arrow.create_polygon(
+ 0.25 * w + bw, 0.75 * h + bw,
+ 0.50 * w + bw, 0.25 * h + bw,
+ 0.75 * w + bw, 0.75 * h + bw,
+ fill=fg, tag='arrow')
+
+ def _resizeArrow(self, event = None):
+ for btn in (self._upYearArrowBtn, self._upMonthArrowBtn,
+ self._upDayArrowBtn, self._upHourArrowBtn,
+ self._upMinuteArrowBtn, self._downYearArrowBtn,
+ self._downMonthArrowBtn, self._downDayArrowBtn,
+ self._downHourArrowBtn, self._downMinuteArrowBtn):
+ bw = (string.atoi(btn['borderwidth']) + \
+ string.atoi(btn['highlightthickness']))
+ newHeight = self._yearCounterEntry.winfo_reqheight() - 2 * bw
+ newWidth = newHeight * self['buttonaspect']
+ btn.configure(width=newWidth, height=newHeight)
+ self._drawArrow(btn, self.arrowDirection[btn])
+
+ def _min(self):
+ self._minVal = None
+
+ def _max(self):
+ self._maxVal = None
+
+ def _setTimeFromStr(self, str):
+ list = string.split(str, ':')
+ if len(list) != 5:
+ raise ValueError, 'invalid value: ' + str
+
+ self._year = string.atoi(list[0])
+ self._month = string.atoi(list[1])
+ self._day = string.atoi(list[2])
+ self._hour = string.atoi(list[3])
+ self._minute = string.atoi(list[4])
+
+ self._setHMS()
+
+ def getstring(self):
+ return '%04d:%02d:%02d:%02d:%02d' % (self._year, self._month,
+ self._day, self._hour,
+ self._minute)
+
+ def getint(self):
+ pass
+
+ def _countUp(self, button):
+ self._relief = self._upYearArrowBtn.cget('relief')
+ button.configure(relief='sunken')
+ if button == self._upYearArrowBtn: datetype = "year"
+ elif button == self._upMonthArrowBtn: datetype = "month"
+ elif button == self._upDayArrowBtn: datetype = "day"
+ elif button == self._upHourArrowBtn: datetype = "hour"
+ elif button == self._upMinuteArrowBtn: datetype = "minute"
+ self._count(1, datetype, 'start')
+
+ def _countDown(self, button):
+ self._relief = self._downYearArrowBtn.cget('relief')
+ button.configure(relief='sunken')
+ if button == self._downYearArrowBtn: datetype = "year"
+ elif button == self._downMonthArrowBtn: datetype = "month"
+ elif button == self._downDayArrowBtn: datetype = "day"
+ elif button == self._downHourArrowBtn: datetype = "hour"
+ elif button == self._downMinuteArrowBtn: datetype = "minute"
+ self._count(-1, datetype, 'start')
+
+ def _count(self, factor, datetype, newFlag=None):
+ if newFlag != 'force':
+ if newFlag is not None:
+ self._flag = newFlag
+
+ if self._flag == 'stopped':
+ return
+
+ if datetype == "year": self._year = self._year + factor
+ elif datetype == "month": self._month = self._month + factor
+ elif datetype == "day": self._day = self._day + factor
+ elif datetype == "hour": self._hour = self._hour + factor
+ elif datetype == "minute": self._minute = self._minute + factor
+ secs = time.mktime((self._year, self._month, self._day, self._hour,
+ self._minute, 0, 0, 0, -1))
+ tt = time.localtime(secs) # NOT gmtime!
+
+ self._year = tt[0]
+ self._month = tt[1]
+ self._day = tt[2]
+ self._hour = tt[3]
+ self._minute = tt[4]
+ self._setHMS()
+
+ if newFlag != 'force':
+ if self['autorepeat']:
+ if self._flag == 'start':
+ delay = self['initwait']
+ self._flag = 'running'
+ else:
+ delay = self['repeatrate']
+ self._timerId = self.after(
+ delay, lambda self=self, factor=factor, datetype=datetype:
+ self._count(factor, datetype, 'running'))
+
+ def _setHMS(self):
+ self._yearCounterEntry.setentry('%04d' % self._year)
+ self._monthCounterEntry.setentry('%02d' % self._month)
+ self._dayCounterEntry.setentry('%02d' % self._day)
+ self._hourCounterEntry.setentry('%02d' % self._hour)
+ self._minuteCounterEntry.setentry('%02d' % self._minute)
+
+ def _stopUpDown(self, button):
+ if self._timerId is not None:
+ self.after_cancel(self._timerId)
+ self._timerId = None
+ button.configure(relief=self._relief)
+ self._flag = 'stopped'
+
+ def invoke(self, event = None):
+ cmd = self['command']
+ if callable(cmd):
+ cmd()
+
+ def destroy(self):
+ if self._timerId is not None:
+ self.after_cancel(self._timerId)
+ self._timerId = None
+ Pmw.MegaWidget.destroy(self)
+
+if __name__=="__main__":
+
+ def showString():
+ stringVal = _time.getstring()
+ print stringVal
+
+ root = Tkinter.Tk()
+ Pmw.initialise(root)
+ root.title('FullTimeCounter')
+
+ exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
+ exitButton.pack(side = 'bottom')
+
+ _time = FullTimeCounter(root,
+ labelpos = 'n',
+ label_text = 'YYYY:MM:DD:HH:mm')
+ _time.pack(fill = 'both', expand = 1, padx=10, pady=5)
+
+ button = Tkinter.Button(root, text = 'Show', command = showString)
+ button.pack()
+ root.mainloop()
diff --git a/Pmw/Pmw_1_2/contrib/PmwVerticalGauge.py b/Pmw/Pmw_1_2/contrib/PmwVerticalGauge.py
new file mode 100644
index 00000000..b413f937
--- /dev/null
+++ b/Pmw/Pmw_1_2/contrib/PmwVerticalGauge.py
@@ -0,0 +1,253 @@
+"""
+I needed a simple gauge, so I've made on with Pmw.
+It might be useful for others to use as a base to develop more comples
+gauges with.
+
+Is it worth cleaning up and submitting?
+
+cheers and thanks
+
+chris
+
+Dr. Chris Wright
+Intensive Care Unit
+Monash Medical Centre
+Clayton. VIC Australia
+"""
+
+import sys
+import Tkinter
+import Pmw
+import time
+
+
+if sys.platform == 'win32':
+ # MS-Windows specific fonts
+ label_font = "-family Ariel -size 12"
+ value_font = "-family Ariel -size 12"
+ small_font = "-family {MS Sans Serif} -size 9 -weight bold"
+ header_font = "-family {MS Sans Serif} -weight bold"
+else:
+ # X-Windows specific fonts
+ label_font = "-*-helvetica-*-r-*-*-*-160-*-*-*-*-*-*"
+ value_font = "-*-courier-*-r-*-*-*-160-*-*-*-*-*-*"
+ small_font = "-*-helvetica-*-r-*-*-*-130-*-*-*-*-*-*"
+ header_font = "-*-helvetica-bold-r-*-*-*-150-*-*-*-*-*-*"
+
+class VerticalGauge(Pmw.MegaWidget):
+ """Vertical gauge with actual and desired settings"""
+
+ def __init__(self, parent = None, **kw):
+ optiondefs = (
+ ('min', 0, None),
+ ('max', 100, None),
+ ('majortickinterval', 10, None),
+ ('minortickinterval', 5, None),
+ ('units', '', None),
+ ('bg', 'grey', self._backgroundSet),
+ ('actualvalue', 50, self._actualSet),
+ ('desiredvalue', 50, self._desiredSet),
+ ('actualcolour', 'yellow1', None),
+ ('desiredcolour', 'turquoise1', None),
+ ('label', 'Label', None),
+ )
+ self.defineoptions(kw, optiondefs)
+ Pmw.MegaWidget.__init__(self, parent)
+
+ interior = self.interior()
+ interior.grid_rowconfigure(1, weight = 1)
+ for r in range(3):
+ interior.grid_columnconfigure(r, weight = 1)
+
+ self.actuallabel = self.createcomponent('actualLabel',
+ (), None,
+ Tkinter.Label, (interior,),
+ text = '',
+ width = 3,
+ relief = 'sunken',
+ bd = 1,
+ fg = self['actualcolour'],
+ font = value_font)
+ self.actuallabel.grid(sticky = "nswe", row = 0, column = 0)
+
+ self.label = self.createcomponent('label',
+ (), None,
+ Tkinter.Label, (interior,),
+ text = self['label'],
+ relief = 'raised',
+ font = label_font,
+ fg = 'navy',
+ bd = 2)
+ self.label.grid(sticky = "nsew", row = 0, column = 1)
+
+ self.desiredlabel = self.createcomponent('desiredLabel',
+ (), None,
+ Tkinter.Label, (interior,),
+ text = '',
+ width = 3,
+ relief = 'sunken',
+ bd = 1,
+ fg = self['desiredcolour'],
+ font = value_font)
+ self.desiredlabel.grid(sticky = "nswe", row = 0, column = 2)
+
+ self.canvas = self.createcomponent('canvas',
+ (), None,
+ Tkinter.Canvas, (interior,),
+ width = 100,
+ height = 300,
+ bg = 'grey')
+
+ self.canvas.grid(sticky = "nsew", columnspan = 3, pady = 1)
+ self.canvas.bind("", self._createGaugeAxes)
+
+ self._createGaugeAxes()
+
+ self.initialiseoptions()
+
+ def _createGaugeAxes(self, event = None):
+ min = self['min']
+ max = self['max']
+ units = self['units']
+ majortickinterval = self['majortickinterval']
+
+ gauge_range = max - min
+
+ c = self.canvas
+ c.delete("all")
+ if event:
+ h, w = event.height, event.width
+ else:
+ h = int(c.configure("height")[4])
+ w = int(c.configure("width")[4])
+
+ self.lower = h - 15
+ self.upper = 15
+ self.middle = w / 2
+ c.create_line(self.middle, self.lower, self.middle, self.upper)
+
+ majortickcount = int((max - min) / majortickinterval)
+ self.axislength = self.lower - self.upper
+ self.majortickdistance = float(self.axislength) / majortickcount
+ self.majortickwidth = w / 5
+ labeloffset = (w / 4) + 10
+
+ for i in range(majortickcount + 1):
+ v = min + i * majortickinterval
+ d = self.lower - i * self.majortickdistance
+ c.create_line(self.middle, d, self.middle + self.majortickwidth, d)
+ c.create_text(self.middle + labeloffset, d, font = small_font, text = str(v))
+
+ self._desiredSet(event)
+ self._actualSet(event)
+
+ def _backgroundSet(self):
+ self.canvas.configure(bg = self['bg'])
+
+ def _desiredSet(self, event = None):
+ c = self.canvas
+ desired = self['desiredvalue']
+ desiredcolour = self['desiredcolour']
+
+ min = self['min']
+ max = self['max']
+
+ if desired > max: desired = max
+ if desired < min: desired = min
+ gauge_range = max - min
+
+ c = self.canvas
+ if event:
+ h, w = event.height, event.width
+ else:
+ h = int(c.configure("height")[4])
+ w = int(c.configure("width")[4])
+
+
+ desired_y = self.lower - (float(desired - min) / gauge_range) * self.axislength
+
+ try:
+ c.delete('desiredBar')
+ except:
+ pass
+
+ c.create_line(self.middle - self.majortickwidth, desired_y,
+ self.middle + self.majortickwidth, desired_y,
+ fill = desiredcolour, stipple = 'gray50',
+ width = 10, tag = 'desiredBar')
+ self.desiredlabel.configure(text = desired)
+
+ def setActual(self, value):
+ self.configure(actualvalue = value)
+
+ def getActual(self):
+ return self.cget('actualvalue')
+
+ def _actualSet(self, event = None):
+ c = self.canvas
+ actual = self['actualvalue']
+ actualcolour = self['actualcolour']
+
+ min = self['min']
+ max = self['max']
+
+ if actual > max: actual = max
+ if actual < min: actual = min
+ gauge_range = max - min
+
+ c = self.canvas
+ if event:
+ h, w = event.height, event.width
+ else:
+ h = int(c.configure("height")[4])
+ w = int(c.configure("width")[4])
+
+ actual_y = self.lower - (float(actual - min) / gauge_range) * self.axislength
+
+ try:
+ c.delete('actualPointer')
+ except:
+ pass
+
+ triangle = ((self.middle, actual_y),
+ (self.middle - 1.4 * self.majortickwidth, actual_y - self.majortickwidth / 2),
+ (self.middle - 1.4 * self.majortickwidth, actual_y + self.majortickwidth / 2))
+
+ c.create_polygon(triangle, fill = actualcolour, tag = 'actualPointer')
+ self.actuallabel.configure(text = actual)
+
+
+Pmw.forwardmethods(VerticalGauge, Tkinter.Canvas, 'canvas')
+
+if __name__ == '__main__':
+
+
+ # Initialise Tkinter and Pmw.
+ root = Pmw.initialise()
+ root.title('Pmw VerticalGauge demonstration')
+
+
+ def increase():
+ av = g1.getActual()
+ g1.setActual(av + 1)
+
+ def decrease():
+ av = g1.getActual()
+ g1.setActual(av - 1)
+
+ g1 = VerticalGauge(min = 0,
+ max = 30,
+ actualvalue = 15,
+ desiredvalue = 22,
+ majortickinterval = 2,
+ label = "Pms")
+ g1.grid(sticky = "nsew")
+ root.grid_rowconfigure(0, weight = 1)
+ root.grid_columnconfigure(0, weight = 1)
+ b1 = Tkinter.Button(text = "Increase", command = increase)
+ b1.grid()
+ b2 = Tkinter.Button(text = "Decrease", command = decrease)
+ b2.grid()
+
+ # Let's go.
+ root.mainloop()
diff --git a/Pmw/Pmw_1_2/contrib/README b/Pmw/Pmw_1_2/contrib/README
new file mode 100644
index 00000000..2662f77e
--- /dev/null
+++ b/Pmw/Pmw_1_2/contrib/README
@@ -0,0 +1,10 @@
+This directory contains contributed Pmw megawidgets.
+
+DirBrowser.py directory selection dialog
+MCListbox.py multi-column selectable listbox
+PmwFileDialog.py file selection dialog
+PmwFullTimeCounter.py time counter which includes year, month and day
+PmwVerticalGauge.py a simple gauge indicating a value and a threshold
+TreeBrowser.py generic hierarchical tree browser
+
+Each file can be executed and will display a demo of its megawidget.
diff --git a/Pmw/Pmw_1_2/contrib/TreeBrowser.py b/Pmw/Pmw_1_2/contrib/TreeBrowser.py
new file mode 100644
index 00000000..6d9fe89a
--- /dev/null
+++ b/Pmw/Pmw_1_2/contrib/TreeBrowser.py
@@ -0,0 +1,732 @@
+#
+# FILE: TreeBrowser.py
+#
+# DESCRIPTION:
+# This file provides a generic hierarchical tree browser widget.
+#
+# AUTHOR: Steve Kinneberg ,
+# MontaVista Software, Inc.
+
+
+
+
+
applicationname
+
+Initialisation option. The name of application, to be dispayed in the dialog body and in
+ the window title if the title option is not given. The default is ''.
+
+
+
+
+
borderx
+
+Initialisation option. The padding to the left and right of the text message and icon. The default is 20.
+
+
+
+
+
bordery
+
+Initialisation option. The padding above and below the text message and icon. The default is 20.
+
+
+
+
+
buttonboxpos
+
+Initialisation option. Specifies on which side of the dialog window to place the button
+ box. Must be one of 'n', 's', 'e' or 'w'. The default is 's'.
+
+
+
+
+
buttons
+
+This must be a tuple or a list and specifies the names on the
+ buttons in the button box. The default is ('Close',).
+
+
+
+
+
command
+
+Specifies a function to call whenever a button in the button box
+ is invoked or the window is deleted by the window manager. The
+ function is called with a single argument, which is the name of
+ the button which was invoked, or None if the window was deleted
+ by the window manager.
+
If the value of command is not callable, the default behaviour
+ is to deactivate the window if it is active, or withdraw the
+ window if it is not active. If it is deactivated, deactivate()
+ is called with the button name or None as described above. The default is None.
+
+
+
+
+
+
deactivatecommand
+
+If this is callable, it will be called whenever the megawidget is
+ deactivated by a call to deactivate(). The default is None.
+
+
+
+
+
defaultbutton
+
+Specifies the default button in the button box. If the <Return>
+ key is hit when the dialog has focus, the default button will be
+ invoked. If defaultbutton is None, there will be no default
+ button and hitting the <Return> key will have no effect. The default is 0.
+
+
+
+
+
iconmargin
+
+Initialisation option. The padding between the text message and icon. The default is 20.
+
+
+
+
+
iconpos
+
+Initialisation option. Specifies on which side of the text message to place the icon.
+ Must be one of 'n', 's', 'e' or 'w'. The default is 'w'.
+
+
+
+
+
master
+
+This is used by the activate() method to control whether the
+ window is made transient during modal dialogs. See the
+ activate() method. The default is 'parent'.
+
+
+
+
+
separatorwidth
+
+Initialisation option. If this is greater than 0, a separator line with the specified
+ width will be created between the button box and the child site,
+ as a component named separator. Since the default border of the
+ button box and child site is raised, this option does not
+ usually need to be set for there to be a visual separation between
+ the button box and child site. The default is 0.
+
+
+
+
+
title
+
+This is the title that the window manager displays in the title
+ bar of the window. The default is None.
+
+
+
+
+
Components
+Components created by this megawidget and its base
+classes are described below.
+
+
buttonbox
+
+This is the button box containing the buttons for the dialog. By
+ default it is created with the options
+ (hull_borderwidth = 1, hull_relief = 'raised'). By default, this component is a Pmw.ButtonBox.
+
+
+
+
+
dialogchildsite
+
+This is the child site for the dialog, which may be used to
+ specialise the megawidget by creating other widgets within it. By
+ default it is created with the options
+ (borderwidth = 1, relief = 'raised'). By default, this component is a Tkinter.Frame.
+
+
+
+
+
hull
+
+This acts as the body for the entire megawidget. Other components
+ are created as children of the hull to further specialise this
+ class. By default, this component is a Tkinter.Toplevel.
+
+
+
+
+
icon
+
+If the iconpos option is not None, this component is created
+ to contain the icon label for the dialog. To display a bitmap as
+ an icon, set the icon_bitmap component option to any of the
+ forms acceptable to Tk, such as 'warning' or 'error'. By default, this component is a Tkinter.Label.
+
+
+
+
+
message
+
+The label to contain the text message for the dialog. To set
+ the text, use the message_text component option. By default, this component is a Tkinter.Label.
+
+
+
+
+
separator
+
+If the separatorwidth initialisation option is non-zero, the
+ separator component is the line dividing the area between the
+ button box and the child site. By default, this component is a Tkinter.Frame.
+
+
+
+
+
+
Methods
+This megawidget has no methods of its own.
+For a description of its inherited methods, see the
+manual for its base class
+Pmw.MessageDialog.
+
+
+
Example
+The image at the top of this manual is a snapshot
+of the window (or part of the window) produced
+by the following code.
+
+class Demo:
+ def __init__(self, parent):
+ # Create dialog.
+ Pmw.aboutversion('9.9')
+ Pmw.aboutcopyright('Copyright My Company 1999\nAll rights reserved')
+ Pmw.aboutcontact(
+ 'For information about this application contact:\n' +
+ ' My Help Desk\n' +
+ ' Phone: +61 2 9876 5432\n' +
+ ' email: help@my.company.com.au'
+ )
+ self.about = Pmw.AboutDialog(parent, applicationname = 'My Application')
+ self.about.withdraw()
+
+ # Create button to launch the dialog.
+ w = Tkinter.Button(parent, text = 'Show about dialog',
+ command = self.execute)
+ w.pack(padx = 8, pady = 8)
+
+ def execute(self):
+ self.about.show()
+
+
+
+
+
+
+
+
+
+
+
+
+ Pmw 1.2 -
+ 5 Aug 2003
+ - Home
+ Manual page last reviewed: 18 May 2002
+
+ A balloon megawidget can be used to give short help messages to
+ the user when they place the mouse over a button or other widget
+ for a short time. It can also be used to display help messages
+ for canvas or text items.
+
+
One balloon megawidget can be used to display help for many
+ widgets or items. For each widget or item that requires balloon
+ help, the bind() or bindtag() method is used to specify the
+ help text that should be displayed.
+
+
The help message is displayed in a popup balloon window when the
+ mouse remains over the widget or item for a short time. The popup
+ balloon is withdrawn when the mouse leaves the widget or item, or
+ any mouse buttons are pressed.
+
+
The position of the popup balloon is configurable and may appear
+ either relative to the widget or item or relative to the position
+ of the mouse.
+
+
The popup balloon is displayed without any window manager
+ decorations.
+
+
The megawidget can cooperate with a Pmw.MessageBar to display a
+ single-line help message as well as the balloon help.
+
+
+
+
+
+
Options
+Options for this megawidget and its base
+classes are described below.
+
+
activatecommand
+
+If this is callable, it will be called whenever the megawidget is
+ activated by a call to activate(). The default is None.
+
+
+
+
+
deactivatecommand
+
+If this is callable, it will be called whenever the megawidget is
+ deactivated by a call to deactivate(). The default is None.
+
+
+
+
+
initwait
+
+The number of milliseconds delay between when the mouse enters a
+ widget or item and when the popup balloon window should be
+ displayed. The default is 500.
+
+
+
+
+
master
+
+This is used by the activate() method to control whether the
+ window is made transient during modal dialogs. See the
+ activate() method. The default is 'parent'.
+
+
+
+
+
relmouse
+
+This may be one of 'both', 'x', 'y' or 'none' and
+ indicates that the top left corner of the popup balloon window
+ should be placed relative to the current position of the mouse
+ rather than relative to the bottom left corner of the widget or
+ item (the default). The positioning may be set for the horizontal
+ (x) and vertical (y) axes independently. The default is 'none'.
+
+
+
+
+
state
+
+This may be one of 'both', 'balloon', 'status' or 'none'
+ and indicates whether the help message should be displayed in the
+ popup balloon window, in an associated messagebar (via the
+ statuscommand option), or both. The default is 'both'.
+
+
+
+
+
statuscommand
+
+This specifies a function to call when the mouse enters a widget
+ or item bound to this balloon megawidget. To configure a
+ Pmw.MessageBar to display help, set this option to the helpmessage
+ method of the messagebar. The default is None.
+
+
+
+
+
title
+
+This is the title that the window manager displays in the title
+ bar of the window. The default is None.
+
+
+
+
+
xoffset
+
+This specifies the horizontal offset of the position of the left
+ side of the popup balloon window relative the point determined by
+ the relmouse option. The default is 20.
+
+
+
+
+
yoffset
+
+This specifies the vertical offset of the position of the top of
+ the popup balloon window relative the point determined by the
+ relmouse option. The default is 1.
+
+
+
+
+
Components
+Components created by this megawidget and its base
+classes are described below.
+
+
hull
+
+This acts as the body for the entire megawidget. Other components
+ are created as children of the hull to further specialise this
+ class. By default, this component is a Tkinter.Toplevel.
+
+
+
+
+
label
+
+This component displays the text of the help message in the popup
+ balloon window. By default it is created with a 'lightyellow'
+ background, a 'black' foreground and is 'left' justified. By default, this component is a Tkinter.Label.
+
+
+
+
+
+
Methods
+Only methods specific to this megawidget are described below.
+For a description of its inherited methods, see the
+manual for its base class
+Pmw.MegaToplevel.
+
+
+
bind(widget, balloonHelp, statusHelp = None)
+Create bindings for widget so that balloon help and/or status
+ help is displayed when the mouse enters the widget. The balloon
+ help message is given by balloonHelp and the status help message
+ is given by statusHelp. If balloonHelp is None, no balloon
+ is displayed. If statusHelp is not set, it defaults to
+ balloonHelp. Any previous bindings for this widget are removed.
+
+
+
+
+
clearstatus()
+Clear the text in the associated messagebar by passing None to
+ the statuscommand function.
+
+
+
+
+
showstatus(statusHelp)
+Set the text in the associated messagebar by passing statusHelp
+ to the statuscommand function.
+
+
+
+Create bindings for the tag or item specified by tagOrItem in
+ the text or canvas widget so that balloon help and/or status
+ help is displayed when the mouse enters the tag or item. The
+ balloon help message is given by balloonHelp and the status help
+ message is given by statusHelp. If balloonHelp is None, no
+ balloon is displayed. If statusHelp is not set, it defaults to
+ balloonHelp. Any previous bindings for this tag or item are
+ removed.
+
+
+
+
+
tagunbind(widget, tagOrItem)
+Remove the balloon help bindings from the tag or item specified by
+ tagOrItem in the text or canvas widget.
+
Note that tagunbind() must be called when deleting a canvas
+ item, so that the popup balloon window can be withdrawn if it was
+ triggered by the item. (Unfortunately this can not be automated
+ as is done for widgets since Tk does not support <Destroy>
+ bindings on canvas items, so there is no way that Pmw.Balloon can
+ be notified of the deletion of an item.)
+
+
+
+
+
+
unbind(widget)
+Remove the balloon help bindings from widget.
+
+
+
+
+
Example
+The image at the top of this manual is a snapshot
+of the window (or part of the window) produced
+by the following code.
+
+class Demo:
+ def __init__(self, parent):
+ # Create the Balloon.
+ self.balloon = Pmw.Balloon(parent)
+
+ # Create some widgets and megawidgets with balloon help.
+ frame = Tkinter.Frame(parent)
+ frame.pack(padx = 10, pady = 5)
+ field = Pmw.EntryField(frame,
+ labelpos = 'nw',
+ label_text = 'Command:')
+ field.setentry('mycommand -name foo')
+ field.pack(side = 'left', padx = 10)
+ self.balloon.bind(field, 'Command to\nstart/stop',
+ 'Enter the shell command to control')
+
+ start = Tkinter.Button(frame, text='Start')
+ start.pack(side='left', padx = 10)
+ self.balloon.bind(start, 'Start the command')
+
+ stop = Tkinter.Button(frame, text='Stop')
+ stop.pack(side='left', padx = 10)
+ self.balloon.bind(stop, 'Stop the command')
+
+ self.suicide = Tkinter.Button(frame, text='Kill me soon!',
+ command = self.killButton)
+ self.suicide.pack(side='left', padx = 10)
+ self.balloon.bind(self.suicide, 'Watch this button disappear!')
+
+ scrolledCanvas = Pmw.ScrolledCanvas(parent,
+ canvas_width = 300,
+ canvas_height = 115,
+ )
+ scrolledCanvas.pack()
+ canvas = scrolledCanvas.component('canvas')
+ self.canvas = canvas
+
+ # Create some canvas items and individual help.
+ item = canvas.create_arc(5, 5, 35, 35, fill = 'red', extent = 315)
+ self.balloon.tagbind(canvas, item, 'This is help for\nan arc item')
+ item = canvas.create_bitmap(20, 150, bitmap = 'question')
+ self.balloon.tagbind(canvas, item, 'This is help for\na bitmap')
+ item = canvas.create_line(50, 60, 70, 80, 85, 20, width = 5)
+ self.balloon.tagbind(canvas, item, 'This is help for\na line item')
+ item = canvas.create_text(10, 90, text = 'Canvas items with balloons',
+ anchor = 'nw', font = field.cget('entry_font'))
+ self.balloon.tagbind(canvas, item, 'This is help for\na text item')
+
+ # Create two canvas items which have the same tag and which use
+ # the same help.
+ canvas.create_rectangle(100, 10, 170, 50, fill = 'aliceblue',
+ tags = 'TAG1')
+ self.bluecircle = canvas.create_oval(110, 30, 160, 80, fill = 'blue',
+ tags = 'TAG1')
+ self.balloon.tagbind(canvas, 'TAG1',
+ 'This is help for the two blue items' + '\n' * 10 +
+ 'It is very, very big.',
+ 'This is help for the two blue items')
+ item = canvas.create_text(180, 10, text = 'Delete',
+ anchor = 'nw', font = field.cget('entry_font'))
+ self.balloon.tagbind(canvas, item,
+ 'After 2 seconds,\ndelete the blue circle')
+ canvas.tag_bind(item, '<ButtonPress>', self._canvasButtonpress)
+ scrolledCanvas.resizescrollregion()
+
+ scrolledText = Pmw.ScrolledText(parent,
+ text_width = 32,
+ text_height = 4,
+ text_wrap = 'none',
+ )
+ scrolledText.pack(pady = 5)
+ text = scrolledText.component('text')
+ self.text = text
+
+ text.insert('end',
+ 'This is a text widget with ', '',
+ ' balloon', 'TAG1',
+ '\nhelp. Find the ', '',
+ ' text ', 'TAG1',
+ ' tagged with', '',
+ ' help.', 'TAG2',
+ '\n', '',
+ 'Remove tag 1.', 'TAG3',
+ '\nAnother line.\nAnd another', '',
+ )
+ text.tag_configure('TAG1', borderwidth = 2, relief = 'sunken')
+ text.tag_configure('TAG3', borderwidth = 2, relief = 'raised')
+
+ self.balloon.tagbind(text, 'TAG1',
+ 'There is one secret\nballoon help.\nCan you find it?')
+ self.balloon.tagbind(text, 'TAG2',
+ 'Well done!\nYou found it!')
+ self.balloon.tagbind(text, 'TAG3',
+ 'After 2 seconds\ndelete the tag')
+ text.tag_bind('TAG3', '<ButtonPress>', self._textButtonpress)
+
+ frame = Tkinter.Frame(parent)
+ frame.pack(padx = 10)
+ self.toggleBalloonVar = Tkinter.IntVar()
+ self.toggleBalloonVar.set(1)
+ toggle = Tkinter.Checkbutton(frame,
+ variable = self.toggleBalloonVar,
+ text = 'Balloon help', command = self.toggle)
+ toggle.pack(side = 'left', padx = 10)
+ self.balloon.bind(toggle, 'Toggle balloon help\non and off')
+
+ self.toggleStatusVar = Tkinter.IntVar()
+ self.toggleStatusVar.set(1)
+ toggle = Tkinter.Checkbutton(frame,
+ variable = self.toggleStatusVar,
+ text = 'Status help', command = self.toggle)
+ toggle.pack(side = 'left', padx = 10)
+ self.balloon.bind(toggle,
+ 'Toggle status help on and off, on and off' + '\n' * 10 +
+ 'It is very, very big, too.',
+ 'Toggle status help on and off')
+
+ # Create and pack the MessageBar.
+ messageBar = Pmw.MessageBar(parent,
+ entry_width = 40,
+ entry_relief='groove',
+ labelpos = 'w',
+ label_text = 'Status:')
+ messageBar.pack(fill = 'x', expand = 1, padx = 10, pady = 5)
+
+ # Configure the balloon to display its status messages in the
+ # message bar.
+ self.balloon.configure(statuscommand = messageBar.helpmessage)
+
+ def toggle(self):
+ if self.toggleBalloonVar.get():
+ if self.toggleStatusVar.get():
+ self.balloon.configure(state = 'both')
+ else:
+ self.balloon.configure(state = 'balloon')
+ else:
+ if self.toggleStatusVar.get():
+ self.balloon.configure(state = 'status')
+ else:
+ self.balloon.configure(state = 'none')
+
+ def killButton(self):
+ # Test for old bug when destroying widgets 1) while the
+ # balloon was up and 2) during the initwait period.
+ print 'Destroying button in 2 seconds'
+ self.suicide.after(2000, self.suicide.destroy)
+
+ def _canvasButtonpress(self, event):
+ print 'Destroying blue circle in 2 seconds'
+ self.canvas.after(2000, self.deleteBlueCircle)
+
+ def deleteBlueCircle(self):
+ self.balloon.tagunbind(self.canvas, self.bluecircle)
+ self.canvas.delete(self.bluecircle)
+
+ def _textButtonpress(self, event):
+ print 'Deleting the text tag in 2 seconds'
+ self.text.after(2000, self.deleteTextTag)
+
+ def deleteTextTag(self):
+ self.balloon.tagunbind(self.text, 'TAG1')
+ self.text.tag_delete('TAG1')
+
+
+
+
+
+
+
+
+
+
+
+
+ Pmw 1.2 -
+ 5 Aug 2003
+ - Home
+ Manual page last reviewed: 20 May 2002
+