1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714
|
2021-06-19 Florent Rougon <f.rougon@free.fr>
Fix related to the 'timeout' option (--timeout for dialog)
* dialog.py (Dialog._perform): ignore the dialog output when a timeout
occurred, which we know thanks to the exit code. Without this change,
output parsing or checking (e.g., in Dialog._widget_with_no_output())
would be broken by the '\ntimeout\n' string printed by dialog in such
cases (seen with msgbox, at least).
It might be that parsing is still disturbed for some widgets when a
timeout occurs, if they never produce an empty output in a no-timeout
situation: this remains to be checked. Also, it appears that the
--timeout option doesn't work with all widgets in the dialog
backend (tested with dialog 1.3-20201126: 'msgbox', 'checklist' and
'menu' support --timeout; 'inputbox' and 'mixedform' don't; other
widgets untested with this option).
2021-06-18 Florent Rougon <f.rougon@free.fr>
Show use of d.add_persistent_args(["--no-nl-expand"]) in examples
* Using this option is quite relevant when using pythondialog. Thanks to
ChristianTacke for the report. Closes:
<https://github.com/frougon/pythondialog/issues/8>.
2021-06-17 Florent Rougon <f.rougon@free.fr>
Improve support for the --timeout dialog option
* Set DIALOG_TIMEOUT in the environment when invoking dialog; this
allows us to distinguish between DIALOG_TIMEOUT and DIALOG_ESC. Add
the corresponding TIMEOUT attribute to the Dialog class. Thanks to
Rolf for the report. Closes:
<https://sourceforge.net/p/pythondialog/bugs/11/>.
2019-12-14 Florent Rougon <f.rougon@free.fr>
Release 3.5.1
2019-12-14 Florent Rougon <f.rougon@free.fr>
README.rst: update the latest version of the Python 2 backport
* README.rst: the latest version of the Python 2 backport is now 3.5.1.
This will also be the last version, unless metadata needs to be updated
(e.g., if the home page or Git repository were to move, we would
probably have to make a new upload in order to update the data published
on PyPI).
2019-12-14 Florent Rougon <f.rougon@free.fr>
Safer instruction when using easy_install
* INSTALL: when easy_install is mentioned (deprecated method!),
explicitly use <base_dir>/bin/easy_install to ensure it comes from the
right Python installation.
2019-12-14 Florent Rougon <f.rougon@free.fr>
demo: remove invalid escape sequence from sample string
* examples/with-autowidgetsize/demo.py: same change as in commit
94f0dc952f7cfe7cecc7865dd3febf4a457072c0, since the file is essentially
a copy of examples/demo.py. The escape sequence \/ is invalid in normal
strings; use a raw string here, since the goal was to display both
characters.
2019-12-14 Florent Rougon <f.rougon@free.fr>
Minor clarification in the INSTALL file
* INSTALL: clarify that versions < 3.5.0 were packaged with Distutils.
2019-12-14 Florent Rougon <f.rougon@free.fr>
Minor changes
* setup.py: switch the URL for gitlog-to-changelog from http to https.
* README.rst: replace <https://pypi.python.org/pypi/pip with>
<https://pypi.org/project/pip/>..
* INSTALL: use version 3.5.1 instead of 3.5.0 so that there is no
unneeded discrepancy with the same file from the 'py2' branch.
2019-12-13 Florent Rougon <f.rougon@free.fr>
Use URLs based on HTTPS instead of HTTP when available
2019-12-13 Florent Rougon <f.rougon@free.fr>
Warn against potentially risky values for the executable name/path
* dialog.py (Dialog.__init__): warn against the risks when passing a
relative path containing a '/' as the 'dialog' argument. In such a case,
the current directory when the Dialog instance is created is very
important.
2019-12-13 Florent Rougon <f.rougon@free.fr>
Remove current directory from the default used when PATH is unset
* dialog.py (_find_in_path): in case PATH was unset, the default value
used to start with a colon, which caused pythondialog to look for the
executable in the current directory if (1) the specified executable
didn't contain a '/' and (2) the PATH environment variable was unset.
This behavior was conformant to what glibc's execvp() function did until
version 2.24 from 2016, but wasn't ideal (if a pythondialog-based
program had its current directory world-writable, this could be used to
trap users whose PATH is unset---which is rather unlikely, fortunately).
This suboptimal default behavior when PATH is unset was changed in glibc
2.24, and we are following suit here, i.e., the new default is
"/bin:/usr/bin". Also clarify the docstring.
* dialog.py (_path_to_executable): return the result after applying
os.path.realpath() and clarify the docstring. Using os.path.realpath()
at this point ensures that the path to the dialog-like executable is
resolved at the time the Dialog instance is created. This way, a
pythondialog-based program can change its current directory after
creating a Dialog instance without fearing that this might cause
subsequent pythondialog calls to fail or to invoke an executable from a
different directory.
* dialog.py (Dialog.__init__): adapt the docstring to reflect the
aforementioned change when PATH is unset (as mentioned above for
_find_in_path()).
2019-12-06 Florent Rougon <f.rougon@free.fr>
One import statement per line
* dialog.py: one import statement per line + lexicographic sort order
eases maintenance and makes nicer diffs when imports are added or
removed.
2019-12-04 Florent Rougon <f.rougon@free.fr>
Use os.pathsep in _find_in_path() instead of hardcoding ":"
* This is more portable.
2019-12-01 Florent Rougon <f.rougon@free.fr>
Release 3.5.0
2019-12-01 Florent Rougon <f.rougon@free.fr>
Use an https URL for intersphinx_mapping
* doc/conf.py: use an https URL for the 'intersphinx_mapping' variable.
2019-12-01 Florent Rougon <f.rougon@free.fr>
Switch the packaging from Distutils to Setuptools
* Setuptools is more in line with the current trends in Python
packaging, and allows us to generate built distributions in wheel
format. Closes: <https://github.com/frougon/pythondialog/issues/7>.
* The changes in README.rst also announce the end of Python 2 support
(Python upstream is about to terminate this support too, it is time
people still using Python 2 switch to Python 3).
2019-12-01 Florent Rougon <f.rougon@free.fr>
demo: remove invalid escape sequence from sample string
* demo.py: the escape sequence \/ is invalid in normal strings; use a
raw string here, since the goal was to display both characters.
2019-12-01 Florent Rougon <f.rougon@free.fr>
Update copyright years for dialog.py, demo.py, setup.py and doc/conf.py
2016-05-07 Florent Rougon <f.rougon@free.fr>
Prune doc/screenshots/snapshots.debian.net when building source packages
* 3.4.0 tarballs were built without this directory -> no useless files
in them.
2016-05-07 Florent Rougon <f.rougon@free.fr>
Release 3.4.0
README.rst: link to the blessings library, add link to ncurses home page
2016-05-07 Florent Rougon <f.rougon@free.fr>
Add 'week_start' common option, mapped to dialog's --week-start option
* The value may be an integer or a string (cf. dialog's man page for
more details).
* Using this requires dialog 1.3-20160126 or later.
2016-05-07 Florent Rougon <f.rougon@free.fr>
Update copyright notices and demo version
Fix typo
2016-05-07 Florent Rougon <f.rougon@free.fr>
Doc build: suppress warnings about :option:`--unknown-option` references
* The documentation contains many references to dialog options. These
are not defined in the pythondialog Manual, which with recent Sphinx
(>= 1.3 or something like that) causes a lot of warnings. Fortunately,
these can be suppressed (specifically for unknown option references)
with 'suppress_warnings' in conf.py starting from Sphinx 1.4.0.
* This is what this commit does. Alternatively, the option references
could be replaced with dumb markup such as ``--unknown-option``.
2016-05-07 Florent Rougon <f.rougon@free.fr>
Add demo example for Dialog.editbox_str()
2016-05-06 Florent Rougon <f.rougon@free.fr>
Add Dialog.editbox_str()
* dialog.py (Dialog.editbox_str): new method. It is a convenience
wrapper around Dialog.editbox() that automatically creates and deletes a
temporary file containing the initial box contents which is passed as a
string (Dialog.editbox() needs it in a file).
2016-01-28 Florent Rougon <f.rougon@free.fr>
Fix bug in demo.py when /etc/passwd is inexistent
* examples/demo.py (MyApp.editbox_demo): display a message when
/etc/passwd is inexistent instead of raising an exception (trying to
display the result, which doesn't exist).
2015-05-28 Florent Rougon <f.rougon@free.fr>
Release 3.3.0
2015-05-28 Florent Rougon <f.rougon@free.fr>
Minor changes
* doc/Dialog_class_overview.rst: fix a typo
* doc/conf.py: update copyright years for the pythondialog Manual
* examples/demo.py: update version number + cosmetic change
* examples/with-autowidgetsize/demo.py: ditto
2015-05-27 Florent Rougon <f.rougon@free.fr>
Use html_theme = 'classic' with Sphinx 1.3b3 or later
* doc/conf.py: change the HTML theme name to 'classic' if the Sphinx
version is 1.3b3 or later (the old name 'default' is now deprecated).
2015-05-27 Florent Rougon <f.rougon@free.fr>
Allow passing dialog arguments via a temporary file
* dialog.py (Dialog.__init__): new 'pass_args_via_file' parameter. The
default value (None) enables argument passing via --file only if the
dialog version is recent enough to offer a reliable --file
implementation (i.e., 1.2-20150513 or later).
* dialog.py (Dialog.setup_debug): new 'expand_file_opt' parameter to
allow producing debug log files with full dialog commands as before,
instead of dialog calls containing only one --file option followed by a
path to a temporary file.
* dialog.py (Dialog._quote_arg_for_file_opt): new method (quotes
arguments for safe inclusion via --file).
* dialog.py (Dialog._call_program): honor Dialog.pass_args_via_file and
return a 3-tuple instead of a 2-tuple (new element: path to the
temporary file containing the dialog arguments, or None if
Dialog.pass_args_via_file is false).
* dialog.py (Dialog._handle_program_exit): new method, which wraps
Dialog._wait_for_program_termination() and makes sure the temporary
file, if any, is removed when it is not needed anymore.
* dialog.py (Dialog._perform): adapt to the change in the return value
of Dialog._call_program() and use Dialog._handle_program_exit() instead
of Dialog._wait_for_program_termination().
* dialog.py (Dialog.gauge_start, Dialog.gauge_stop): similar changes.
* doc/Dialog_class_overview.rst: add two notes to make it clear that the
dialog arguments may be included indirectly via --file, depending on the
pythondialog and dialog versions, as well as on the arguments passed to
Dialog.__init__().
* README.rst: mention the 'expand_file_opt' parameter along with
Dialog.setup_debug().
* examples/demo.py: new option (-E, --debug-expand-file-opt) to allow
obtaining the same dialog commands as before in the file generated by
--debug (i.e., with the --file options expanded instead of referring to
the temporary files).
2015-05-25 Florent Rougon <f.rougon@free.fr>
Fix message for InadequateBackendVersion in _dialog_version_check()
* dialog.py (Dialog._dialog_version_check): the message passed when
raising InadequateBackendVersion had a hardcoded "the programbox widget"
substring where it should have been using the 'feature' parameter.
2015-04-10 Florent Rougon <f.rougon@free.fr>
Release 3.2.2
2015-04-04 Florent Rougon <f.rougon@free.fr>
Release 3.2.2rc1
Minor improvements to README.rst and INSTALL (formatting + date)
2015-04-04 Florent Rougon <f.rougon@free.fr>
Update the 'with-autowidgetsize' demo
* examples/with-autowidgetsize/demo.py: apply yesterday's demo.py
changes to this file too.
2015-04-03 Florent Rougon <f.rougon@free.fr>
README.rst: fix command line for running the demo
* README.rst: the given command only worked if the directory containing
dialog.py was in sys.path. Prepend 'PYTHONPATH=. ' to the suggested
command to fix this.
2015-04-03 Florent Rougon <f.rougon@free.fr>
README.rst: improve formatting and references to external projects
2015-04-03 Florent Rougon <f.rougon@free.fr>
demo: fix bug when buildlist is not available
* demo.py: the demo used to crash on the report when the desert island
question had not been asked because the backend was too old for
buildlist. This is now fixed.
2015-04-03 Florent Rougon <f.rougon@free.fr>
Fix backend version check for several widgets
* dialog.py:
- minimum version for buildlist is 1.2-20121230, not 1.2;
- minimum version for programbox is 1.1-20110302, not 1.1;
- minimum version for rangebox is 1.2-20121230, not 1.2;
- minimum version for treeview is 1.2-20121230, not 1.2.
* demo.py: analogous changes to display user-friendly messages when the
backend is too old.
2015-04-03 Florent Rougon <f.rougon@free.fr>
demo: provide fallback for Python versions that don't have 'callable'
* examples/demo.py: provide a custom 'callable' function for old Python
versions (such as 3.1) that don't have the 'callable' builtin.
2015-04-03 Florent Rougon <f.rougon@free.fr>
demo: don't use contextlib anymore
* examples/demo.py: contextlib is nice but not really useful here. Since
its use in this file causes problems under Python 3.1 at least, don't
use it anymore for now.
2015-04-03 Florent Rougon <f.rougon@free.fr>
Workaround for old dialog versions that print the version on stdout
* dialog.py: some dialog versions print the version on stdout when using
--print-version (e.g., 1.1-20100428). In this case, the output read on
stderr is empty. This commit works around this problem by rerunning the
dialog program, capturing its stdout instead of stderr. The penalty is
minimal since the backend version is cached.
2014-10-30 Florent Rougon <f.rougon@free.fr>
Release 3.2.1
2014-10-30 Florent Rougon <f.rougon@free.fr>
Fix awkward wording in the license text for the tutorial example.py
* doc/intro/example.py: replace "Neither the name of the Florent Rougon
(...)" with something more appropriate.
2014-10-30 Florent Rougon <f.rougon@free.fr>
[Manual] Improve the tutorial
* doc/intro/example.py: remove the useless "import dialog" statement at
the beginning of the file
* Expand on the example:
- introduce the msgbox and infobox widgets as well;
- present the 'title', 'backtitle', 'width' and 'height' common
options;
- show how to deal with the Dialog exit codes;
- mention the autowidgetsize feature;
- suggest good practices such as locale.setlocale(locale.LC_ALL, '')
at the beginning of the program.
2014-10-18 Florent Rougon <f.rougon@free.fr>
Add a label for the Glossary in the doc
* doc/glossary.rst: add a label before the Glossary section (the
sphinx-build program from Debian unstable complains about a missing
label without this change).
2014-10-15 Florent Rougon <f.rougon@free.fr>
Release 3.2.0
2014-10-15 Sphinx team <no-email@example.com>
Add the Makefile generated by sphinx-quickstart
2014-10-15 Florent Rougon <f.rougon@free.fr>
Convert the documentation to Sphinx format
* The new documentation is much nicer and more convenient to use.
2014-10-14 Florent Rougon <f.rougon@free.fr>
Add a line for .rst files to .gitattributes
2014-09-29 Florent Rougon <f.rougon@free.fr>
Fix calendar default values and docstring
* dialog.py (Dialog.calendar): change the default values for day, month
and year from 0 to -1. This is unfortunately BACKWARD-INCOMPATIBLE,
but 0 doesn't work well for day and month in dialog, and it would be
quite unintuitive to have them default to -1 with the year still
defaulting to 0.
* dialog.py (Dialog.calendar): improve the docstring clarity.
* examples/demo.py (calendar_demo_with_help): use -1 for the initial
values of day, month and year. This is only for clarity; the previous
code would work just as well.
2014-08-20 Florent Rougon <f.rougon@free.fr>
Release 3.1.0
2014-08-20 Florent Rougon <f.rougon@free.fr>
Miscellaneous little changes to ancillary files
* MANIFEST.in: remove "global-exclude *~" and
"global-exclude .gitattributes" because they cause warnings upon
installation with pip that may frighten users, and only provide a safety
net against hypothetical bugs that don't exist in the current version.
* TODO: update the file now that the 'autowidgetsize' option has been
implemented.
* setup.py: don't print the "No .git directory, using the 'ChangeLog'
file as is" message anymore, as it pollutes the installation with pip,
possibly causing users to fear that something went wrong.
2014-08-20 Florent Rougon <f.rougon@free.fr>
Change 'autowidgetsize' into a Dialog constructor option
* dialog.py: remove the 'features' mechanism and change 'autowidgetsize'
into a Dialog constructor option (boolean, keyword-only argument). This
is simpler, doesn't require any recent package and makes it possible to
have several Dialog instances with different values for the
'autowidgetsize' setting in the same process... The 'features' mechanism
is removed because it will have no use after this change.
* examples/with-autowidgetsize/demo.py,
examples/with-autowidgetsize/simple_example.py: adapt to this change.
2014-08-18 Florent Rougon <f.rougon@free.fr>
New 'examples' directory; examples using 'autowidgetsize'
* demo.py, simple_example.py: move to the new 'examples' directory.
* New subdirectory of 'examples' named 'with-autowidgetsize', containing
copies of demo.py and simple_example.py using the 'autowidgetsize'
option (small modifications have been necessary in order to preserve
correct display).
2014-08-19 Florent Rougon <f.rougon@free.fr>
demo.py: programbox and progressboxoid changes
* demo.py (MyApp.programbox_demo): remove the \n character at the end of
'text'. Otherwise, dialog will see *two* newline chars in a row at the
end and will faithfully print a blank line. This, in turn, may cause
unwanted scrolling if the window doesn't have enough space for that
line.
* demo.py: run programbox_demo from MyApp.demo() if the dialog version
is >= 1.2-20140112, otherwise leave it in MyApp.additional_widgets().
Versions older than 1.2-20140112 have a bug that makes it unsuitable
for the main demo.
* demo.py (MyApp.progressboxoid): allow additional arguments to be
passed as **kwargs.
2014-08-18 Florent Rougon <f.rougon@free.fr>
New 'autowidgetsize' feature
* dialog.py: add the 'autowidgetsize' feature. When enabled,
pythondialog's widget-producing methods behave as if width=0, height=0,
etc. had been passed, except where these parameters are explicitely
specified with different values. This feature is currently marked as
experimental, please give some feedback.
Note: in order to differentiate between a default value obtained when
'autowidgetsize' is disabled and an explicitely-specified width, height,
etc., the size parameters modified by this commit now default to None.
In order to compensate for this information loss, the effective default
values when 'autowidgetsize' is disabled are now mentioned in the
docstrings of the corresponding widget-producing methods.
* dialog.py (Dialog._default_size): new method returning the appropriate
default values for the size parameters depending on whether
'autowidgetsize' is enabled or not. This allows tight factoring of the
code that had to be added to almost every widget.
2014-08-18 Florent Rougon <f.rougon@free.fr>
New 'features' concept
* dialog.py: new concept called 'features' that is similar to Python's
__future__ statement. The general idea is that users can globally modify
pythondialog's behavior by calling:
dialog.enable_feature(FEATURE)
right after importing the 'dialog' module, in order to ensure consistent
behavior. In this call, FEATURE must be a member of the 'dialog.Feature'
enum. Using this mechanism therefore requires a Python installation
containing the 'enum' module. Since it is part of the standard library
in Python 3.4, this should not be a significant problem.
Note: the Python 3.4 'enum' module has been backported to older Python
versions under the name 'enum34'.
* dialog.py: this commit adds the following module-level variables:
_HAS_ENUM, _features
as well as the Feature class (which is an enum).
* dialog.py (enable_feature, disable_feature, feature_enabled_p): new
functions.
2014-07-23 Florent Rougon <f.rougon@free.fr>
Remove _create_temporary_directory() in favor of tempfile.NamedTemporaryFile()
* dialog.py (Dialog.scrollbox): use tempfile.NamedTemporaryFile()
instead of our custom _create_temporary_directory() function.
* There was no security problem in _create_temporary_directory() as far
as I know, however it is usually better to use well-tested library
functions when possible instead of custom ones. When
_create_temporary_directory() was written, what was available from the
tempfile module was not satisfactory, but this is not the case anymore.
* dialog.py: BACKWARD INCOMPATIBILITY: the
UnableToCreateTemporaryDirectory exception is not defined anymore.
Dialog.scrollbox() now creates a temporary file without any temporary
directory, therefore there is no place anymore for this exception to be
used. The equivalent condition in tempfile.NamedTemporaryFile()
generates an OSError exception (more precisely, a FileExistsError in
Python 3.3 or later, which is a subclass of OSError). As usual, this
exception is wrapped by pythondialog and seen as a PythonDialogOSError
by user code.
* As a conclusion, wherever user code was expecting
UnableToCreateTemporaryDirectory in previous versions, it should now
expect a PythonDialogOSError, consistently with the tempfile module and
OSError wrapping by pythondialog.
2014-07-18 Florent Rougon <f.rougon@free.fr>
Improve installation instructions
* INSTALL: better explain the pip-based installation method. In
particular, indicate in which situations it is safe or unsafe to use.
* README.rst: minor improvement.
2014-05-20 Florent Rougon <f.rougon@free.fr>
Declare .gitattributes and .gitignore with 'export-ignore'
* .gitattributes: declare these two files in .gitattributes with the
'export-ignore' attribute, for the benefit of 'git archive'.
2014-05-20 Florent Rougon <f.rougon@free.fr>
Update the pip documentation URL
* README.rst: update the pip documentation URL which changed according
to <https://mail.python.org/pipermail/distutils-sig/2014-May/024180.html>.
2014-01-19 Florent Rougon <f.rougon@free.fr>
Exclude *~ and .gitattributes files from source distributions
* MANIFEST.in: safety measure for future updates that might
inadvertently introduce undesired files in the source dist.
2014-01-13 Florent Rougon <f.rougon@free.fr>
Introduce end-of-line normalization for text files in the repository
2013-11-01 Florent Rougon <f.rougon@free.fr>
Release 3.0.1
2013-10-27 Florent Rougon <f.rougon@free.fr>
Make sure ChangeLog.init and ChangeLog are read/written using UTF-8
* setup.py: make sure ChangeLog.init and ChangeLog are read/written
using UTF-8 (regardless of locale settings), consistently with the Git
repository and release tarballs.
2013-10-18 Florent Rougon <f.rougon@free.fr>
Minor improvements
* dialog.py (Dialog.backend_version): when raising
UnableToRetrieveBackendVersion, print the exit code (which is now a
string) with repr()-style representation.
* demo.py:
- use the print() function instead of sys.stderr.write();
- minor improvement of the buildlist demo.
* setup.py:
- add "ncurses" and "terminal" as keywords;
- use a 'with' statement to open and close 'README.rst'.
* README.rst: mainly, write appropriate text concerning the Python 2
backport.
2013-10-12 Florent Rougon <f.rougon@free.fr>
Release 3.0.0
Minor improvements
Add buildlist support
2013-10-12 Florent Rougon <f.rougon@free.fr>
Better support for parsing dialog output
* This commit allows parsing a dialog output style used by the buildlist
widget, that was not supported before.
* dialog.py (Dialog._parse_quoted_string): new optional 'start'
argument.
* dialog.py (Dialog._split_shellstyle_arglist): new function to parse a
list of strings quoted in POSIX shell style, in order to process
buildlist output.
* dialog.py (Dialog._parse_help): new optional 'multival_on_single_line'
argument to allow parsing of the buildlist help output.
2013-10-12 Florent Rougon <f.rougon@free.fr>
Improve Extra button support
* With this commit, Extra button support should be as good as in the
dialog backend. If not, it's a bug.
* dialog.py: fix support for the Extra button in calendar, rangebox,
timebox and treeview, where None was returned instead of the value one
could reasonably expect.
* dialog.py: document usage of the Extra button in the Dialog class
docstring.
* demo.py: add examples of Extra button usage in textbox_demo() and
rangebox_demo().
2013-10-12 Florent Rougon <f.rougon@free.fr>
Full help support for all widgets
* dialog.py: add support for --help-status and --help-tags.
* dialog.py: review all widgets, making sure that all help-related
options can effectively be used (in particular 'item_help' and
'help_status') and that the relevant output is returned to the caller in
a suitable form.
* dialog.py: compatibility should not be affected for 'menu' nor for
basic usage when only the "help" exit code is checked, without parsing
the output. With this commit, widget-producing methods do check if the
exit code is "help" and, in that case, parse the output in order to
return a useful and easy to use Python object to the caller. This means
that "HELP " prefixes are removed, shell-style quoting and
backslash-escaping is undone, and that the output of --help-status is
returned as a hopefully useful data structure.
* demo.py: add help support to many widgets, showing how to use the new
facilities.
2013-10-06 Florent Rougon <f.rougon@free.fr>
Nicer exit codes for widget-producing methods
* The purpose of this commit is:
- to bring consistency among the exit codes (before: integers mixed
with "help" for 'menu' and "accepted"/"renamed" for 'inputmenu';
after: all strings);
- to merge DIALOG_HELP and DIALOG_ITEM_HELP into a single high-level
code (Dialog.HELP, which is the string "help");
- to make user code shorter and nicer (d.OK or "ok" vs. d.DIALOG_OK
for instance, where 'd' is a Dialog instance);
- to provide the exit codes as class attributes instead of instance
attributes, since they shouldn't depend on any particular instance;
- to prevent future backward-compatibility problems by raising an
exception when receiving an unknown exit code from the backend
instead of passing it through.
Backward-compatibility is only affected for code that relies on
d.DIALOG_OK and friends being integers, or having a particular value.
Most of the code using these attributes simply compare them with the
return value (or the first element of the return value) of
widget-producing methods; this kind of use will work as before, with
only a DeprecationWarning to suggest using the new attributes (see
README.rst for instructions on how to enable DeprecationWarning's).
* dialog.py: make widget-producing methods return a high-level "Dialog
exit code" such as "ok", "cancel", "esc", "extra" and "help" instead of
the integer exit status of the dialog backend. The Dialog exit codes are
available as Dialog.OK, Dialog.CANCEL, etc. (class attributes). The
low-level exit codes (integers) are now stored as private class
attributes: Dialog._DIALOG_OK, Dialog._DIALOG_CANCEL, etc. In order to
preserve backward-compatibility in most cases, the Dialog class has
properties named DIALOG_OK, DIALOG_CANCEL, etc. that emit a
DeprecationWarning and return the corresponding high-level code (i.e,
Dialog.OK, Dialog.CANCEL, etc.). DIALOG_HELP and DIALOG_ITEM_HELP are
both mapped to Dialog.HELP.
* demo.py: use the new attributes of the Dialog class (OK, CANCEL, etc.)
instead of the deprecated attributes (DIALOG_OK, DIALOG_CANCEL, etc.) of
Dialog instances. Also change various strings and comments to use the
new terminology (Dialog exit code AKA high-level exit code vs. dialog
exit status AKA low-level exit code).
* simple_example.py: ditto.
2013-10-04 Florent Rougon <f.rougon@free.fr>
More metadata for Dialog widget-producing methods
* This commit prepares for a transition to user-visible Dialog exit
codes (note the capital D) that are strings, such as "ok" or "cancel".
* dialog.py (retval_is_code): new decorator that sets the attribute of
the same name on its argument. This attribute allows to reliably detect
if a widget-producing method returns a dialog exit status or a sequence
whose first element is a dialog exit status.
* dialog.py: apply the decorator to the relevant widget-producing
methods.
* demo.py (MyDialog.widget_loop): use the new attribute instead of
testing whether the return value of a widget-producing method supports
indexing.
2013-10-01 Florent Rougon <f.rougon@free.fr>
Release 2.14.1
2013-10-01 Florent Rougon <f.rougon@free.fr>
Fixes for the programbox demo
* demo.py (programbox_demo): the programbox demo (only run in
--test-suite mode) uses subprocess.DEVNULL, which was added in Python
3.3. Provide an alternate method when this feature is not available.
* demo.py (programbox_demo): close the pipe used to communicate with
dialog when it is not needed anymore (otherwise, running the demo with
warnings enabled [python3 -Wd demo.py 2>/path/to/file] shows a
ResourceWarning).
2013-10-01 Florent Rougon <f.rougon@free.fr>
Better reporting of dialog errors
* dialog.py: when dialog exits with status DIALOG_ERROR, write its
output as part of the DialogError exception that is raised. This should
make it much easier to understand the cause of errors. This requires
reading the dialog output before wait()ing for it to exit, which is a
good thing in any case, as big amounts of output could cause a kind of
deadlock, since dialog would be blocked with its output pipe full while
we would be wait()ing for it to exit.
2013-09-30 Florent Rougon <f.rougon@free.fr>
Easier management of the ChangeLog file
* Rename ChangeLog to ChangeLog.init and modify setup.py to
automatically generate, when invoked, an up-to-date ChangeLog file with
the oldest entries from ChangeLog.init and the newest ones from the Git
log.
* README.distributors: new file explaining this mechanism and how to
prepare a package (or new release) from the Git repository.
2013-09-26 Florent Rougon <f.rougon@free.fr>
Decorate Dialog.form with the 'widget' decorator
* dialog.py: in commit cfcf412d86c5d8daebcf004d4e9fe02ecbb881b3, it was
forgotten to use the 'widget' decorator on Dialog.form. This commit
fixes this bug.
2013-09-20 Florent Rougon <f.rougon@free.fr>
Clarify the rules concerning the 'widget' decorator
* dialog.py: be more precise about the interface that must be offered by
methods decorated with the 'widget' decorator (and therefore having the
'is_widget' attribute). Also, don't use the "widget-producing"
expression to qualify methods that are not eligible for this decorator
(such as Dialog.gauge_update()).
* demo.py: similar precisions.
2013-09-17 Florent Rougon <f.rougon@free.fr>
Prepare for the 2.14.0 release
* dialog.py: minor docstring fix
* dialog.py: bump the version number
2013-09-17 Florent Rougon <f.rougon@free.fr>
Add a sample program really intended for newcomers
* simple_example.py: new sample program, short, with absolutely no
magic, intended for first-timers.
* dialog.py: adapt the comments to point to this new file.
2013-09-17 Florent Rougon <f.rougon@free.fr>
Improve structure and ESC handling in the demo
* demo.py: new MyApp class that implements the core of the demo. This
class relies on a new MyDialog class that automatically wraps every
widget-producing method of dialog.Dialog in order to display the
"confirm quit" dialog if the user presses the Escape key or the Cancel
button. This class also provides a few dialog-related methods used in
the demo.
* demo.py: This new structure should completely fix handling of the
Escape key, which was not satisfactory in previous versions since it
required a while loop for every widget call that made the code redundant
and harder to read. The new wrapping mechanism is completely transparent
for most of the code in MyApp, which thus becomes shorter, more reliable
and easier to read. The "magic" is contained within the MyDialog class.
* A sample program for newcomers to pythondialog with absolutely no
magic will be added in the next commit (simple_example.py).
2013-09-15 Florent Rougon <f.rougon@free.fr>
Add an 'is_widget' attribute to Dialog widget-producing methods
* dialog.py (widget): new decorator to mark the Dialog methods that
provide a widget. As explained in the docstring, this allows code to
perform automatic operations on these specific methods. For instance,
one can define a class that behaves similarly to Dialog, except that
after every widget-producing call, it spawns a "confirm quit" dialog if
the widget returned DIALOG_ESC, and loops in case the user doesn't
actually want to quit.
2013-09-14 Florent Rougon <f.rougon@free.fr>
Check for too old versions of the backend
* dialog.py: new exception InadequateBackendVersion
* dialog.py: use it to abort when the user tries to use a programbox,
rangebox or treeview widget with a dialog version that does not
implement the widget in question.
* demo.py: for the latest widgets added to dialog, check the version of
the backend if it's dialog and display an explanation instead of the
widget demo when it is too old.
2013-09-14 Florent Rougon <f.rougon@free.fr>
Backend version caching and comparing
* dialog.py (Dialog.backend_version): slight modification to the API:
when the dialog-like backend does not return DIALOG_OK, raise
UnableToRetrieveBackendVersion (new exception) instead of returning
None. This way, the method either returns a string or raises an
exception.
* dialog.py: new DialogBackendVersion class (and BackendVersion abstract
base class) for parsing the version string of the dialog backend,
storing it in a structured format, and providing easy and reliable
comparisons between versions using the standard comparison operators (<,
<=, ==, !=, >=, >).
* dialog.py (Dialog.__init__): retrieve the backend version and store
the corresponding (Dialog)BackendVersion instance into a public
'cached_backend_version' attribute. This should avoid having to run
'<backend> --print-version' every time someone needs the version.
* demo.py: use Dialog.cached_backend_version.
2013-09-11 Florent Rougon <f.rougon@free.fr>
Minor fixes
* dialog.py: prefix OSErrorHandling with an underscore.
* dialog.py: rename *_rec private attributes to the corresponding *_cre
(Compiled Regular Expression).
* dialog.py: add treeview to the list of widgets in the Dialog class
docstring (forgotten when the widget support was added).
2013-09-11 Florent Rougon <f.rougon@free.fr>
Misc demo improvements
* demo.py: move a bunch of widget demos from additional_widgets() to the
main demo() function to give them more visibility. The remaining widgets
in additional_widgets() either have little warts (like programbox which
is waiting for a fix in the dialog backend), are cumbersome to use in
the demo (this is the case of progressbox_demo_with_filepath), or are
almost identical to widgets already presented in the main part of the
demo.
* demo.py: use the current local time to initialize the timebox widget.
* demo.py: minor improvements.
2013-09-11 Florent Rougon <f.rougon@free.fr>
Add support for 'treeview'
2013-09-10 Florent Rougon <f.rougon@free.fr>
Add support for 'rangebox'
Add support for 'programbox'
2013-09-07 Florent Rougon <f.rougon@free.fr>
Factor out OSError and IOError handling
* dialog.py: use a context manager to factor out OSError and IOError
handling throughout the module.
2013-09-06 Florent Rougon <f.rougon@free.fr>
Add support for new dialog common options
* dialog.py: add support for --default-button and --no-tags.
2013-09-06 Florent Rougon <f.rougon@free.fr>
Add version_info to dialog.py
* dialog.py: new 'version_info' module-level attribute, similar to what
the 'sys' module provides. This avoids the need to parse __version__
when one wants to extract for instance the major and/or minor version
number of pythondialog.
2013-09-06 Florent Rougon <f.rougon@free.fr>
Minor improvements
2013-08-22 Florent Rougon <f.rougon@free.fr>
Remove the installation prefix from setup.cfg and release 2.13.1
* From now on, pythondialog releases will follow a major.minor.micro
versioning scheme.
* setup.cfg: remove the /usr/local installation prefix that breaks
installations with pip in a virtualenv, at least.
* INSTALL: update the installation and uninstallation instructions to
document and favor the method based on pip.
2013-08-20 Florent Rougon <f.rougon@free.fr>
Demo improvement with Dialog.maxsize()
* demo.py: pass the available (terminal-dependent) width and height to
demo() and additional_widgets(); use this information to display a
tailbox widget that almost fills the screen (whatever the terminal
size).
2013-08-19 Florent Rougon <f.rougon@free.fr>
Release 2.13
* setup.cfg: don't build zip files anymore, as I don't think anyone
using pythondialog could be unable to uncompress a tar.gz or tar.bz2
file.
* demo.py: "Mayonnaise" is spelt with two n's, dammit!
2013-08-19 Florent Rougon <f.rougon@free.fr>
New method Dialog.set_background_title(), better Dialog doc
* dialog.py (Dialog.set_background_title): new method. Now that we deal
with dash escaping, such a method does become useful since it avoids
users having to use the low-level Dialog.add_persistent_args() and
bother with dash escaping.
* dialog.py (Dialog.setBackgroundTitle): this old method from
pythondialog 1.0 is still deprecated because its case style is
inconsistent with the rest of pythondialog; it simply calls
Dialog.set_background_title() after printing a DeprecationWarning.
* dialog.py (Dialog): add set_background_title, maxsize and
backend_version to the docstring and reorganize a bit the list of public
methods.
* demo.py: use the new method.
2013-08-19 Florent Rougon <f.rougon@free.fr>
Add demo code for the timebox widget
2013-08-16 Florent Rougon <f.rougon@free.fr>
Prepare for the 2.12 release
* dialog.py: add a copyright notice for Peter Åstrand because of commit
v2.09-2-ga3429a4.
* setup.py: put python3 in the shebang line; change 'url' and
'download_url' to point to SourceForge.
* Minor documentation updates and editorial changes for the release.
2013-08-16 Florent Rougon <f.rougon@free.fr>
Provide an implementation of textwrap.indent() in demo.py
This is for Python versions < 3.3, where this function is not in the
standard library.
2013-08-16 Florent Rougon <f.rougon@free.fr>
Make debugging easier
* dialog.py: there is no need to copy/paste Python code from the
DEBUGGING file into dialog.py anymore in order to see the command lines
corresponding to the dialog calls. Just call
d.setup_debug(True, file=<file object>) to turn debugging on and
d.setup_debug(False) to turn it off, where d is obviously a Dialog
instance.
* demo.py: new options --debug and --debug-file to activate debugging
and specify where the debug log is written to.
* DEBUGGING: not useful anymore.
* MANIFEST.in: don't ship DEBUGGING anymore.
* README.rst: mention this in a new "Troubleshooting" section.
2013-08-15 Florent Rougon <f.rougon@free.fr>
New dialog.__version__ attribute
* dialog.py: new dialog.__version__ attribute
* demo.py: use it to print the pythondialog version in the first screen
* setup.py: use dialog.__version__
2013-08-15 Florent Rougon <f.rougon@free.fr>
Add support for --print-version and --print-maxsize
* dialog.py (Dialog.backend_version, Dialog.maxsize): new methods that
respectively extract the relevant info from dialog --print-version and
--print-maxsize.
* demo.py: use them to display the backend version and terminal size in
the first screen (+ Python version as a bonus); also warn if the
terminal is too small, which might be the cause of Ubuntu#694824.
2013-08-15 Florent Rougon <f.rougon@free.fr>
New arg 'use_persistent_args' for _call_program() and _perform()
* dialog.py (Dialog._call_program, Dialog._perform): new argument
'use_persistent_args' that allows to skip the insertion of
dialog_persistent_arglist. This is necessary to use for instance
--print-version without emptying dialog_persistent_arglist first.
* dialog.py (Dialog._call_program, Dialog._perform): to enhance
readability and maintainability, make all keyword arguments of these
methods keyword-only.
2013-08-13 Florent Rougon <f.rougon@free.fr>
Add support for common options from dialog 1.1-20120215
* dialog.py: add support for dialog common options --ascii-lines,
--colors, --column-separator, --date-format, --exit-label,
--extra-button, --extra-label, --hfile, --hline, --keep-tite,
--keep-window, --no-collapse, --no-lines, --no-mouse, --no-nl-expand,
--no-ok, --scrollbar, --time-format, --trace and --visit-items
(closes: Ubuntu#739873).
2013-08-12 Florent Rougon <f.rougon@free.fr>
Improve exception handling
* dialog.py: don't assume that exceptions are strings; thus, use str()
to obtain the message when translating from a "foreign" exception to a
subclass of dialog.error.
* dialog.py: use str(e) instead of e.strerror when e is an OSError
instance, because e.strerror does not contain the file name (even when
there is one available in e.filename), contrary to str(e).
* dialog.py: prepare the transition from PythonDialogIOError to
PythonDialogOSError. PythonDialogIOError is now a subclass of
PythonDialogOSError so that users can safely replace "except
PythonDialogIOError" clauses with "except PythonDialogOSError" even if
running under Python < 3.3. pythondialog will raise PythonDialogOSError
instead of PythonDialogIOError when Python stops distinguishing between
IOError and OSError, i.e. when running under Python 3.3 or later.
* dialog.py: use "raise ... from ..." (available in Python >= 3.0) where
appropriate.
2013-08-11 Florent Rougon <f.rougon@free.fr>
Conform to the gauge protocol described in dialog(1)
* dialog.py (Dialog.gauge_update): actually conform to the gauge
protocol described in dialog(1); this fixes a slight synchronization bug
when 'update_text' is True (closes: SF#3; thanks to MapK for spotting
this and providing a patch).
* dialog.py (Dialog.gauge_update): raise BadPythonDialogUsage if the
'percent' argument is not an integer, since this is the only type
accepted by the gauge protocol as described in dialog(1).
2013-08-10 Florent Rougon <f.rougon@free.fr>
Escape non-option arguments to dialog that start with --
* dialog.py (_dash_escape): new function that inserts a '--' element
before every element in a list that starts with '--' (returns a new
list).
* dialog.py (_dash_escape_nf): same as _dash_escape, but ignores the
first element.
* dialog.py (Dialog.dash_escape, Dialog.dash_escape_nf): new class
methods for public use, for those using Dialog.add_persistent_args().
* dialog.py (Dialog._call_program): new keyword argument 'dash_escape'
to control the dash-escaping of the argument list; by default, the
appropriate part is filtered through _dash_escape_nf().
* dialog.py (Dialog._perform): new keyword argument 'dash_escape' that
is passed as is to Dialog._call_program() (closes: SF#5; thanks to
Denilson Figueiredo de Sá for the report).
* dialog.py: use _dash_escape_nf() where appropriate in
_common_args_syntax for options that are passed as keyword arguments
(e.g., title="...").
* dialog.py (Dialog.setBackgroundTitle): use self.dash_escape_nf() in
this long-deprecated method.
2013-07-28 Florent Rougon <f.rougon@free.fr>
Standard-behaving __str__ and __repr__ for our exceptions
* dialog.py:error.__str__(): return the exception message instead of
something enclosed in angle brackets.
* Compatibility is not affected unless one had the ill-advised idea to
parse the return value of __str__. The complete_message() method of
exceptions behaves exactly as before.
* demo.py: use the new, more standard method, to retrieve the error
message.
2013-07-28 Florent Rougon <f.rougon@free.fr>
Use os.path.abspath(__file__) to refer to the demo source file
* This avoids problems when running the demo from a directory that is
not the one containing demo.py (closes: SF#4).
2013-07-27 Florent Rougon <f.rougon@free.fr>
* README: rename to README.rst, convert to reStructuredText and
update for Python 3
* INSTALL: update for Python 3
* MANIFEST.in: include README.rst
* setup.py: update for Python 3 and the README -> README.rst
change, email address update
2013-06-19 Florent Rougon <f.rougon@free.fr>
Replace the question for the calendar demo with a non-perishable one
* demo.py: the question about an estimate of Debian *** release is
bound to become out-of-date. Replace it with a question that will
not need a change every couple of years.
2013-06-19 Florent Rougon <f.rougon@free.fr>
Minor improvements
* demo.py: use locale.setlocale(locale.LC_ALL, '') to properly
initialize the locales
* dialog.py: code readability improvement
2013-06-19 Florent Rougon <f.rougon@free.fr>
Minor bug fixes
* dialog.py(_to_onoff): regexp match against "on$"/"off$" instead
of "on"/"off".
* dialog.py: more rigorous handling of "title" and "help_button"
keyword arguments. For instance, passing 'title=None' to a
function that gets this argument through its **kwargs results in a
kwargs dictionary that does contain a "title" key (with None as
the corresponding value); therefore '"title" not in kwargs' is not
a great test to determine if the title should be set to a default
value.
2013-06-19 Florent Rougon <f.rougon@free.fr>
* Favor usage of True/False over 1/0 and on/off in dialog.py and
demo.py, docstrings included.
2013-06-19 Florent Rougon <f.rougon@free.fr>
Improve error handling
* dialog.py(_to_onoff): actually raise an exception when the given
parameter is a string that doesn't represent a boolean according
to the regexps.
* demo.py: when handling exceptions at top level, start by
printing a traceback, which is always very practical to find the
origin of problems.
2013-06-18 Florent Rougon <f.rougon@free.fr>
* Replace assert statements with PythonDialogBug exceptions.
This is less practical for coding in dialog.py but makes it easier
for dialog.py users to catch all (most) exceptions that come from
pythondialog.
2013-06-18 Florent Rougon <f.rougon@free.fr>
Cosmetic changes
* Change deprecated %u into %d.
* Remove trailing whitespace.
* Coding-style update for the generic exception.
2013-06-18 Florent Rougon <f.rougon@free.fr>
Improve error reporting between fork() and execve()
* Print a traceback if an error happens between fork() and
execve() when calling dialog.
2013-06-18 Florent Rougon <f.rougon@free.fr>
* Basic porting to Python 3.
2010-03-17 Florent Rougon <f.rougon@free.fr>
* dialog.py: Move the definition of _simple_option() before its uses
which, according to
<https://sourceforge.net/p/pythondialog/patches/2/>,
"makes pydev happy when browsing the code".
* dialog.py: Remove the "True = 0 == 0" and "False = 0 == 1"
compatibility measures that were still in place for Python
versions < 2.3. Such old versions are not supported anymore; besides,
True and False are becoming reserved words in Python 3.
2010-03-16 Florent Rougon <f.rougon@free.fr>
* Release 2.11.
* README: I thought I was adding a valuable precision in version 2.09
when I changed "LGPL" to "LGPL version 2.1" in the README file (after
looking at COPYING), but actually, the terms at the beginning of
dialog.py are "either version 2.1 of the License, or (at your option)
any later version". Sorry about that, fixed.
* demo.py: use "if <test> <expr1> else <expr2>" expressions more
often, since they are allowed in Python >= 2.5...
2010-03-16 Florent Rougon <flo@via.ecp.fr>
* Release 2.10.
* dialog.py: add Peter Åstrand's modifications to deal with
Xdialog's incompatibilities with respect to dialog:
- new "use_stdout" keyword argument for Dialog.__init__()
- factoring of final newline removals with the addition of
Dialog._strip_xdialog_newline().
* dialog.py: add support for dialog options --no-label,
--yes-label and --insecure (the last one not being so dangerous as
the name seems to imply: "Makes the password widget friendlier but
less secure, by echoing asterisks for each character"; BTW, kdm
has a very nice way of handling this issue IMO: an option that
echoes each character with x asterisks, where x = 3 IIRC).
2010-03-14 Florent Rougon <flo@via.ecp.fr>
* Release 2.09.
* dialog.py: new supported widgets: editbox, inputmenu, mixedform,
mixedgauge, pause, passwordform, progressbox.
* demo.py: general improvements, such as:
- hopefully more helpful dialog when the user fails to select
a file in fselect;
- since actually selecting a file with this widget is already
boring after the second time, the widget can be exited by
pressing Esc or the Cancel button (in which case the parts
of the demo that need the file path will be skipped).
- replace a few calls to Dialog.scrollbox() by calls to
Dialog.msgbox(), since the latter provides nice automatic
line wrapping.
* demo.py: support GNU-style option passing with getopt.py; you
can use --help to get a list of available options
* demo.py: no need to change a global variable anymore to switch
the demo to "fast mode", just use --fast
* demo.py: add --test-suite mode, mainly for developers: it
tests *all* widgets, not only those included in the "default
mode", and automatically enables "fast mode".
* dialog.py(__call_program): make the function more generic. stdin
redirection doesn't involve automatic pipe(2) creation in
__call_program() anymore; instead, __call_program expects a file
descriptor when it is asked to redirect dialog's stdin (parameter
'redir_child_stdin_from_fd').
The caller may still decide to create a pipe and pass its file
descriptor for reading as the 'redir_child_stdin_from_fd'
parameter, but the new possibility of redirecting dialog's stdin
from an arbitrary file descriptor allows for instance to redirect
it from an existing file, network socket... This is used to
implement --progressbox cleanly.
This change has the additional benefit of simplifying the API,
since __call_program()'s return value is always a 2-element tuple
now.
* dialog.py(__call_program): new close_fds option causing the
child process to close the specified file descriptors before the
execve(2) system call. This is useful for instance to have the
child close an end of a pipe he isn't going to use. Without that,
deadlocks could happen because of the child never seeing EOF from
the pipe.
* dialog.py: use warnings.warn(..., DeprecationWarning) for
obsolete functions.
* dialog.py: remove convoluted syntax *(<list>,) that was used at
several places. I don't see any use for this syntax anymore, and
changing it to simply <list> didn't make the universe collapse (so
far).
* dialog.py: prefix attributes for internal use (such as
Dialog._call_program) with a single underscore instead of a double
one: we don't need the name mangling here. These underscores in
dialog.py are just an indication that the attribute is "internal"
and thus subject to API changes, etc. Thanks to Peter Åstrand for
pointing this out.
* setup.py:
- improve the long description, use ReStructuredText
- add Trove classifiers
- add download_url
* Review and update README, TODO...
2010-02-19 Florent Rougon <flo@via.ecp.fr>
* dialog.py: add support for --dselect
* dialog.py: add support for DIALOG_ITEM_HELP
* demo.py: small fixes
2009-10-31 Florent Rougon <flo@via.ecp.fr>
* Released 2.08, skipping version 2.07 to avoid creating confusion
with the 2.7 version released by Peter Åstrand in 2004.
2009-02-04 Florent Rougon <flo@via.ecp.fr>
* Add support for --form.
* dialog.py(__call_program): compute the argument list before
forking, otherwise things get difficult to understand if this
computation raises an exception.
2004-03-29 Florent Rougon <flo@via.ecp.fr>
* Released 2.06.
2004-03-19 Florent Rougon <flo@via.ecp.fr>
* dialog.py: fixed a bug with the default_item "common argument"
(corresponding to dialog's --default-item option) thanks to Peter
Mathiasson.
2004-03-16 Florent Rougon <flo@via.ecp.fr>
* demo.py: make sure the directory passed to --fselect ends with
os.sep so that its contents can be seen right away in the file
selection box displayed by dialog.
2004-03-15 Florent Rougon <flo@via.ecp.fr>
* dialog.py: fix a bug (the standard output of the process running
dialog used to be connected to a pipe) that rendered pythondialog
unusable with recent versions of dialog (thanks, Peter Åstrand!).
* dialog.py: the generic exception is now 'error' ('dialog.error',
if you understand this better). The old name is still there for
backward-compatibility.
* Several new exceptions have appeared: PythonDialogSystemError,
PythonDialogIOError, PythonDialogOSError,
PythonDialogErrorBeforeExecInChildProcess,
PythonDialogReModuleError, UnableToCreateTemporaryDirectory,
PythonDialogBug, ProbablyPythonBug.
* dialog.py: the ExecutableNotFound exception was not mentioned in
the docstring module. Fixed.
* dialog.py: the complete_message() of 'error' instances does not
write a dot at the end of the message anymore.
* dialog.py: rename the ExceptionPrettyIdentifier attribute of
'error' subclasses to ExceptionShortDescription.
* dialog.py: the constructor of 'error' instances can now be
called with no argument if no useful message can be added to the
ExceptionShortDescription.
* dialog.py: added the new DIALOG_EXTRA and DIALOG_HELP return
codes that appeared somewhere between versions 0.9a-20020309a and
0.9b-20040301 of dialog.
* dialog.py: Remove the possibility to choose (from Dialog's
constructor) the values of the DIALOG_{OK,CANCEL,ERROR,...}
environment variables passed to dialog because this is absolutely
useless as far as I can see and clutters the API.
* dialog.py: Dialog's constructor has a new 'compat' parameter
that can be used to enable a compatibility mode with dialog-like
programs whose interface is only slightly different from that of
dialog. The demo runs fine with Xdialog 2.0.6 in the "Xdialog"
compatibility mode. However, I don't want the special cases to
expand too much, so it would be really better for you to report
bugs if your dialog-like program is not dialog-compatible!
* dialog.py: don't try any PATH components (nor any components
from ":/bin:/usr/bin" if PATH is undefined) if the 'dialog'
parameter of Dialog's constructor contains a '/'.
* dialog.py: somewhere between versions 0.9a-20020309a and
0.9b-20040301, dialog started not to quote tags in the output of
--checklist if they didn't contain any space. Adapt the dialog
invocation (now using --separate-output) and the output parsing
accordingly (still works with 0.9a-20020309a).
* dialog.py: the data fed to dialog in Dialog.gauge_update()
happened to work with dialog 0.9a-20020309a but did not conform to
the manual page and presumably broke Xdialog. This is fixed,
thanks to Peter Åstrand.
* dialog.py: modifications in Dialog.scrollbox():
- don't use the old insecure tempfile.mktemp() anymore
(tempfile.mkstemp() didn't exist before Python 2.3)
- don't display a title for the box if no title was in kwargs
- the return value is now that of the dialog-like program
- UnableToCreateTemporaryDirectory is now raised if for some
strange reason, we cannot create a temporary directory
* dialog.py: review every function to catch possible exceptions
such as IOError and OSError, in order to turn them into subclasses
of 'error' (such as PythonDialogIOError and PythonDialogOSError).
Rare beasts such as MemoryError are still not caught. Such an
enterprise would be unreasonable, if not simply impossible.
* dialog.py: updated the various docstrings to show which
exceptions every function can raise. To make this manageable, many
functions refer to the docstrings of internal, heavily-used
functions such as Dialog.__perform whose docstrings are,
unfortunately but rightfully, not included in the HTML
documentation generated by pydoc. Some sort of automated
documentation generation system would be needed to solve this
problem in a satisfactory way.
* demo.py: minor update with respect to Debian sarge's release
date forecasts...
2003-09-16 Florent Rougon <flo@via.ecp.fr>
* Released 2.05.
* Changed the "private" class names to start with two underscores
instead of one.
2003-09-01 Florent Rougon <flo@via.ecp.fr>
* Released 2.04.
* dialog.py: Replaced the apply() calls with calls using the
"extended call syntax" since apply() is deprecated since the
release of Python 2.3.
2002-09-05 Florent Rougon <flo@via.ecp.fr>
* Released 2.03.
* dialog.py: Reorganized the documentation between the module's
docstring and that of the Dialog class.
* README: Added the "history" section and other improvements.
2002-09-04 Florent Rougon <flo@via.ecp.fr>
* dialog.py: Prefixed global variables with an underscore and
made some cosmetic fixes.
* dialog.py: Removed the set_background_title alias to
setBackgroundTitle since nobody uses it yet and setBackgroundTitle
is obsolete. Even though I prefer set_background_title to
setBackgroundTitle for consistency with other methods, there is no
point in adding an obsolete method.
2002-09-03 Florent Rougon <flo@via.ecp.fr>
* Packaged pythondialog with Distutils.
* Improved the README.
2002-09-02 Florent Rougon <flo@via.ecp.fr>
* dialog.py: Improved the common_args_syntax initialization so
that simple dialog Common Options can be passed as foo=1 keyword
arguments with 1 having a real boolean meaning (was not the case
before).
* Handled the licensing stuff : GNU LGPL license for dialog.py and
public domain for demo.py. Added the COPYING file.
* dialog.py: Wrote a proper module docstring.
* demo.py: Added the last widgets to the demo.
2002-08-30 Florent Rougon <flo@via.ecp.fr>
* dialog.py: Added the calendar, fselect, passwordbox, tailbox and
timebox widgets.
2002-08-29 Florent Rougon <flo@via.ecp.fr>
* dialog.py (_wait_for_program_termination): Raises a DialogError
exception when dialog returns self.DIALOG_ERROR. Exceptions are so
handy.
* demo.py: Cleaned up the demo code making it easier (I hope) to
focus on a given widget, added error handling.
* dialog.py: Took the demo to put it in a new, separate file:
demo.py.
2002-08-21 Florent Rougon <flo@via.ecp.fr>
* dialog.py: Documented the widgets properly.
* dialog.py: Generalized the widgets that didn't offer all the
capabilities available from dialog.
* dialog.py: Went through the various widgets so that the
associated methods return the dialog exit status (with additional
information, if relevant).
* dialog.py: Finally cleaned up the method used to collect the
arguments given to dialog. They are now stored as elements of a
list and properly quoted to protect them from shell expansion just
before the call to popen3. Now, you should be safe with any
character in the strings passed to dialog (labels, texts, etc.).
2002-08-09 Florent Rougon <flo@via.ecp.fr>
* dialog.py: All boxes should now support the common arguments
scheme (well, I still have to look at the gauge closer).
* dialog.py: Added support for "common arguments"; now, you can
use any combination of the _common options_ for the dialog program
when creating a box. Example:
d.checklist(<usual args for a checklist box>,
title="...", backtitle="...", <other common args>)
One thing is still broken: we must shell-escape the strings so
that apostrophes (') used to delimit shell arguments don't clash
with apostrophes used these arguments themselves.
* dialog.py: Added support for "persistent arguments" arguments
(--backtitle is a good candidate for this).
* dialog.py: Removed a leftover debugging print in _perform.
* dialog.py: Simplified the DIALOG* arguments handling.
2002-08-08 Florent Rougon <flo@via.ecp.fr>
* dialog.py: Added a short docstring for the module.
* dialog.py: Rewrote checklist to get all the features from the
corresponding option in dialog.
* dialog.py: Rewrote _perform; now, we can use the DIALOG*
environment variables set in the constructor, which allows us
distinguish between ESC pressed and a dialog error, among others;
also, we use no temporary file anymore to store dialog's stderr.
* dialog.py: Added some exceptions.
* dialog.py: Rewrote __init__; now, we can set choose in the
constructor the DIALOG* environment variables to pass the dialog
program as well as this program (could be whiptail for instance)
from the constructor (and the environment variables can be
different for two Dialog instances used in the same python
process...).
* dialog.py: Renamed __foo methods to _foo.
2002-08-07 Florent Rougon <flo@via.ecp.fr>
* dialog.py: Cosmetic fixes.
* dialog.py: Added a proper GPL header (dialog.py only had a short
mention about its license being the GNU GPL).
* Split dialog.py, creating a Changelog file in the format
described in the GNU Coding Standards, as well as README, AUTHORS,
COPYING and TODO.
2000-07-30 Sultanbek Tezadov (http://sultan.da.ru/)
* dialog.py: Added the gauge widget.
* dialog.py: Added a 'title' option to some widgets.
* dialog.py: Added a 'checked' option to the checklist dialog;
clicking "Cancel" is now recognizable.
* dialog.py: Added a 'selected' option to the radiolist dialog;
clicking "Cancel" is now recognizable.
* dialog.py: Some other cosmetic changes and improvements.
2000-??-?? Robb Shecter <robb@acm.org>
* Initial release.
# Local Variables:
# coding: utf-8
# End:
|