[Python-modules-commits] [pythondialog] 01/06: Import pythondialog_3.4.0.orig.tar.bz2

Tristan Seligmann mithrandi at moszumanska.debian.org
Thu Jun 23 21:17:46 UTC 2016


This is an automated email from the git hooks/post-receive script.

mithrandi pushed a commit to branch master
in repository pythondialog.

commit 9049159d92c34ae67dbb3693648ce0fbe0b22041
Author: Tristan Seligmann <mithrandi at debian.org>
Date:   Thu Jun 23 23:00:49 2016 +0200

    Import pythondialog_3.4.0.orig.tar.bz2
---
 ChangeLog                                          |  55 ++++++++++++++
 PKG-INFO                                           |  17 +++--
 README.rst                                         |  13 ++--
 dialog.py                                          |  79 ++++++++++++++++++++-
 doc/conf.py                                        |   9 ++-
 doc/screenshots/snapshots.debian.net/buildlist.png | Bin 54845 -> 0 bytes
 doc/screenshots/snapshots.debian.net/calendar.png  | Bin 28331 -> 0 bytes
 doc/screenshots/snapshots.debian.net/checklist.png | Bin 23278 -> 0 bytes
 doc/screenshots/snapshots.debian.net/editbox.png   | Bin 49883 -> 0 bytes
 doc/screenshots/snapshots.debian.net/form.png      | Bin 44187 -> 0 bytes
 doc/screenshots/snapshots.debian.net/fselect.png   | Bin 26774 -> 0 bytes
 doc/screenshots/snapshots.debian.net/inputbox.png  | Bin 13036 -> 0 bytes
 doc/screenshots/snapshots.debian.net/menu.png      | Bin 59289 -> 0 bytes
 doc/screenshots/snapshots.debian.net/msgbox.png    | Bin 36198 -> 0 bytes
 .../snapshots.debian.net/passwordbox.png           | Bin 12762 -> 0 bytes
 doc/screenshots/snapshots.debian.net/radiolist.png | Bin 30790 -> 0 bytes
 doc/screenshots/snapshots.debian.net/scrollbox.png | Bin 43274 -> 0 bytes
 doc/screenshots/snapshots.debian.net/treeview.png  | Bin 43748 -> 0 bytes
 doc/screenshots/snapshots.debian.net/yesno.png     | Bin 13806 -> 0 bytes
 doc/widgets.rst                                    |   2 +
 examples/demo.py                                   |  22 ++++--
 examples/with-autowidgetsize/demo.py               |  22 ++++--
 22 files changed, 194 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 648a0b8..86076f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2016-05-07  Florent Rougon  <f.rougon at 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 at 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 at free.fr>
+
+	Update copyright notices and demo version
+
+	Fix typo
+
+2016-05-07  Florent Rougon  <f.rougon at 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 at free.fr>
+
+	Add demo example for Dialog.editbox_str()
+
+2016-05-06  Florent Rougon  <f.rougon at 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 at 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 at free.fr>
 
 	Release 3.3.0
diff --git a/PKG-INFO b/PKG-INFO
index 687a525..b62dece 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: pythondialog
-Version: 3.3.0
+Version: 3.4.0
 Summary: A Python interface to the UNIX dialog utility and mostly-compatible programs
 Home-page: http://pythondialog.sourceforge.net/
 Author: Florent Rougon
 Author-email: f.rougon at free.fr
 License: UNKNOWN
-Download-URL: http://sourceforge.net/projects/pythondialog/files/pythondialog/3.3.0/python3-pythondialog-3.3.0.tar.bz2
+Download-URL: http://sourceforge.net/projects/pythondialog/files/pythondialog/3.4.0/python3-pythondialog-3.4.0.tar.bz2
 Description: ===============================================================================
         Python wrapper for the UNIX "dialog" utility
         ===============================================================================
@@ -54,10 +54,13 @@ Description: ===================================================================
         generates dialog boxes. So is pythondialog. They allow you to build nice
         interfaces quickly and easily, but you don't have full control over the
         widgets, nor can you create new widgets without modifying dialog itself.
-        If you need to do low-level stuff, you should have a look at ncurses or
-        slang instead. For sophisticated text-mode interfaces, the `Urwid Python
-        library`_ looks rather interesting, too.
+        If you need to do low-level stuff, you should have a look at `ncurses`_
+        (cf. the ``curses`` module in the Python standard library), `blessings`_
+        or slang instead. For sophisticated text-mode interfaces, the `Urwid
+        Python library`_ looks rather interesting, too.
         
+        .. _ncurses: http://invisible-island.net/ncurses/ncurses.html
+        .. _blessings: https://github.com/erikrose/blessings
         .. _Urwid Python library: http://excess.org/urwid/
         
         
@@ -66,13 +69,13 @@ Description: ===================================================================
         
         * As of version 2.12, the reference implementation of pythondialog
           (which this file belongs to) requires Python 3.0 or later in the 3.x
-          series. pythondialog 3.3.0 has been tested with Python 3.1 and 3.4.
+          series. pythondialog 3.4.0 has been tested with Python 3.5.
         
         * However, in order to help users who are somehow forced to still use
           Python 2 (even though Python 3.0 was released on December 3, 2008), a
           backport of the reference implementation to Python 2 has been
           prepared. At the time of this writing, the latest pythondialog version
-          backported this way is 3.3.0. For up-to-date information about this
+          backported this way is 3.4.0. For up-to-date information about this
           backport, please visit the `pythondialog home page`_.
         
           .. _pythondialog home page: http://pythondialog.sourceforge.net/
diff --git a/README.rst b/README.rst
index 5099aff..a15b385 100644
--- a/README.rst
+++ b/README.rst
@@ -45,10 +45,13 @@ As you might infer from the name, dialog is a high-level program that
 generates dialog boxes. So is pythondialog. They allow you to build nice
 interfaces quickly and easily, but you don't have full control over the
 widgets, nor can you create new widgets without modifying dialog itself.
-If you need to do low-level stuff, you should have a look at ncurses or
-slang instead. For sophisticated text-mode interfaces, the `Urwid Python
-library`_ looks rather interesting, too.
+If you need to do low-level stuff, you should have a look at `ncurses`_
+(cf. the ``curses`` module in the Python standard library), `blessings`_
+or slang instead. For sophisticated text-mode interfaces, the `Urwid
+Python library`_ looks rather interesting, too.
 
+.. _ncurses: http://invisible-island.net/ncurses/ncurses.html
+.. _blessings: https://github.com/erikrose/blessings
 .. _Urwid Python library: http://excess.org/urwid/
 
 
@@ -57,13 +60,13 @@ Requirements
 
 * As of version 2.12, the reference implementation of pythondialog
   (which this file belongs to) requires Python 3.0 or later in the 3.x
-  series. pythondialog 3.3.0 has been tested with Python 3.1 and 3.4.
+  series. pythondialog 3.4.0 has been tested with Python 3.5.
 
 * However, in order to help users who are somehow forced to still use
   Python 2 (even though Python 3.0 was released on December 3, 2008), a
   backport of the reference implementation to Python 2 has been
   prepared. At the time of this writing, the latest pythondialog version
-  backported this way is 3.3.0. For up-to-date information about this
+  backported this way is 3.4.0. For up-to-date information about this
   backport, please visit the `pythondialog home page`_.
 
   .. _pythondialog home page: http://pythondialog.sourceforge.net/
diff --git a/dialog.py b/dialog.py
index 045bc01..24bd7ae 100644
--- a/dialog.py
+++ b/dialog.py
@@ -1,7 +1,7 @@
 # dialog.py --- A Python interface to the ncurses-based "dialog" utility
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2002, 2003, 2004, 2009, 2010, 2013, 2014, 2015  Florent Rougon
+# Copyright (C) 2002-2004, 2009-2010, 2013-2016  Florent Rougon
 # Copyright (C) 2004  Peter Åstrand
 # Copyright (C) 2000  Robb Shecter, Sultanbek Tezadov
 #
@@ -59,7 +59,7 @@ class VersionInfo(_VersionInfo):
 #: Version of pythondialog as a :class:`VersionInfo` instance.
 #:
 #: .. versionadded:: 2.14
-version_info = VersionInfo(3, 3, 0, None)
+version_info = VersionInfo(3, 4, 0, None)
 #: Version of pythondialog as a string.
 #:
 #: .. versionadded:: 2.12
@@ -405,6 +405,8 @@ _common_args_syntax = {
     "trim": lambda enable: _simple_option("--trim", enable),
     "version": lambda enable: _simple_option("--version", enable),
     "visit_items": lambda enable: _simple_option("--visit-items", enable),
+    "week_start": lambda start: _dash_escape_nf(
+        ("--week-start", str(start) if isinstance(start, int) else start)),
     "yes_label": lambda s: _dash_escape_nf(("--yes-label", s)) }
 
 
@@ -2229,7 +2231,7 @@ by :program:`dialog`.
         all text fields are treated as :meth:`passwordbox` widgets
         rather than :meth:`inputbox` widgets.
 
-        By default (as in :program:`dialog)`, nothing is echoed to the
+        By default (as in :program:`dialog`), nothing is echoed to the
         terminal as the user types in the invisible fields. This can be
         confusing to users. Use ``insecure=True`` (keyword argument) if
         you want an asterisk to be echoed for each character entered by
@@ -2374,11 +2376,82 @@ by :program:`dialog`.
 
           any exception raised by :meth:`Dialog._perform`
 
+        .. seealso:: method :meth:`editbox_str`
+
         """
         return self._widget_with_string_output(
             ["--editbox", filepath, str(height), str(width)],
             kwargs)
 
+    def editbox_str(self, init_contents, *args, **kwargs):
+        """
+        Display a basic text editor dialog box (wrapper around :meth:`editbox`).
+
+        :param str init_contents:
+                          initial contents of the dialog box
+        :param args:      positional arguments to pass to :meth:`editbox`
+        :param kwargs:    keyword arguments to pass to :meth:`editbox`
+        :return: a tuple of the form :samp:`({code}, {text})` where:
+
+          - *code* is a :term:`Dialog exit code`;
+          - *text* is the contents of the text entry window on exit.
+
+        :rtype: tuple
+
+        The :meth:`!editbox_str` method is a thin wrapper around
+        :meth:`editbox`. :meth:`!editbox_str` accepts a string as its
+        first argument, instead of a file path. That string is written
+        to a temporary file whose path is passed to :meth:`!editbox`
+        along with the arguments specified via *args* and *kwargs*.
+        Please refer to :meth:`!editbox`\'s documentation for more
+        details.
+
+        Notes:
+
+          - the temporary file is deleted before the method returns;
+          - if *init_contents* does not end with a newline character
+            (``'\\n'``), then this method automatically adds one. This
+            is done in order to avoid unexpected behavior resulting from
+            the fact that, before version 1.3-20160209,
+            :program:`dialog`\'s editbox widget ignored the last line of
+            the input file unless it was terminated by a newline
+            character.
+
+        Notable exceptions:
+
+          - :exc:`PythonDialogOSError`
+          - any exception raised by :meth:`Dialog._perform`
+
+        .. versionadded:: 3.4
+
+        .. seealso:: method :meth:`editbox`
+
+        """
+        if not init_contents.endswith('\n'):
+            # Before version 1.3-20160209, dialog's --editbox widget
+            # doesn't read the last line of the input file unless it
+            # ends with a '\n' character.
+            init_contents += '\n'
+
+        with _OSErrorHandling():
+            tmpfile = tempfile.NamedTemporaryFile(
+                mode="w", prefix="pythondialog.tmp", delete=False)
+            try:
+                with tmpfile as f:
+                    f.write(init_contents)
+                # The temporary file is now closed. According to the tempfile
+                # module documentation, this is necessary if we want to be able
+                # to reopen it reliably regardless of the platform.
+
+                res = self.editbox(tmpfile.name, *args, **kwargs)
+            finally:
+                # The test should always succeed, but I prefer being on the
+                # safe side.
+                if os.path.exists(tmpfile.name):
+                    os.unlink(tmpfile.name)
+
+        return res
+
     @widget
     def fselect(self, filepath, height=0, width=0, **kwargs):
         """Display a file selection dialog box.
diff --git a/doc/conf.py b/doc/conf.py
index 728397d..f6544a5 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -15,6 +15,7 @@
 
 import sys
 import os
+import sphinx
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -26,6 +27,11 @@ sys.path.insert(0, os.path.abspath('..'))
 # If your documentation needs a minimal Sphinx version, state it here.
 #needs_sphinx = '1.0'
 
+if sphinx.version_info >= (1, 4, 0):
+    # Don't warn when something such as :option:`--some-option` refers to an
+    # option not documented here.
+    suppress_warnings = ['ref.option']
+
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
@@ -52,7 +58,7 @@ master_doc = 'index'
 # General information about the project.
 project = 'pythondialog'
 # This applies to the documentation, according to the Sphinx output.
-copyright = '2002-2015, Florent Rougon, Thomas Dickey'
+copyright = '2002-2016, Florent Rougon, Thomas Dickey'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -108,7 +114,6 @@ pygments_style = 'sphinx'
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-import sphinx
 if sphinx.version_info >= (1, 3, 0, 'beta', 3):
     html_theme = 'classic'
 else:
diff --git a/doc/screenshots/snapshots.debian.net/buildlist.png b/doc/screenshots/snapshots.debian.net/buildlist.png
deleted file mode 100644
index 907177d..0000000
Binary files a/doc/screenshots/snapshots.debian.net/buildlist.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/calendar.png b/doc/screenshots/snapshots.debian.net/calendar.png
deleted file mode 100644
index acf52eb..0000000
Binary files a/doc/screenshots/snapshots.debian.net/calendar.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/checklist.png b/doc/screenshots/snapshots.debian.net/checklist.png
deleted file mode 100644
index 9e256a7..0000000
Binary files a/doc/screenshots/snapshots.debian.net/checklist.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/editbox.png b/doc/screenshots/snapshots.debian.net/editbox.png
deleted file mode 100644
index 9cb4318..0000000
Binary files a/doc/screenshots/snapshots.debian.net/editbox.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/form.png b/doc/screenshots/snapshots.debian.net/form.png
deleted file mode 100644
index 287c0d7..0000000
Binary files a/doc/screenshots/snapshots.debian.net/form.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/fselect.png b/doc/screenshots/snapshots.debian.net/fselect.png
deleted file mode 100644
index 5c16837..0000000
Binary files a/doc/screenshots/snapshots.debian.net/fselect.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/inputbox.png b/doc/screenshots/snapshots.debian.net/inputbox.png
deleted file mode 100644
index 9ffcae9..0000000
Binary files a/doc/screenshots/snapshots.debian.net/inputbox.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/menu.png b/doc/screenshots/snapshots.debian.net/menu.png
deleted file mode 100644
index 697c84d..0000000
Binary files a/doc/screenshots/snapshots.debian.net/menu.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/msgbox.png b/doc/screenshots/snapshots.debian.net/msgbox.png
deleted file mode 100644
index 9605db0..0000000
Binary files a/doc/screenshots/snapshots.debian.net/msgbox.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/passwordbox.png b/doc/screenshots/snapshots.debian.net/passwordbox.png
deleted file mode 100644
index e404369..0000000
Binary files a/doc/screenshots/snapshots.debian.net/passwordbox.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/radiolist.png b/doc/screenshots/snapshots.debian.net/radiolist.png
deleted file mode 100644
index 57b1ef1..0000000
Binary files a/doc/screenshots/snapshots.debian.net/radiolist.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/scrollbox.png b/doc/screenshots/snapshots.debian.net/scrollbox.png
deleted file mode 100644
index 0a287aa..0000000
Binary files a/doc/screenshots/snapshots.debian.net/scrollbox.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/treeview.png b/doc/screenshots/snapshots.debian.net/treeview.png
deleted file mode 100644
index 0856f6e..0000000
Binary files a/doc/screenshots/snapshots.debian.net/treeview.png and /dev/null differ
diff --git a/doc/screenshots/snapshots.debian.net/yesno.png b/doc/screenshots/snapshots.debian.net/yesno.png
deleted file mode 100644
index 0de53c7..0000000
Binary files a/doc/screenshots/snapshots.debian.net/yesno.png and /dev/null differ
diff --git a/doc/widgets.rst b/doc/widgets.rst
index c5551fb..28edfc4 100644
--- a/doc/widgets.rst
+++ b/doc/widgets.rst
@@ -79,6 +79,8 @@ Edit box
 
    :meth:`~Dialog.editbox` example
 
+.. automethod:: Dialog.editbox_str
+
 
 Progress box
 ^^^^^^^^^^^^
diff --git a/examples/demo.py b/examples/demo.py
index 98a5558..341605d 100755
--- a/examples/demo.py
+++ b/examples/demo.py
@@ -3,7 +3,7 @@
 
 # demo.py --- Demonstration program and cheap test suite for pythondialog
 #
-# Copyright (C) 2002-2010, 2013, 2014, 2015  Florent Rougon
+# Copyright (C) 2002-2010, 2013-2016  Florent Rougon
 # Copyright (C) 2000  Robb Shecter, Sultanbek Tezadov
 #
 # This program is in the public domain.
@@ -77,10 +77,10 @@ import dialog
 from dialog import DialogBackendVersion
 
 progname = os.path.basename(sys.argv[0])
-progversion = "0.11"
+progversion = "0.12"
 version_blurb = """Demonstration program and cheap test suite for pythondialog.
 
-Copyright (C) 2002-2010, 2013, 2014, 2015  Florent Rougon
+Copyright (C) 2002-2010, 2013-2016  Florent Rougon
 Copyright (C) 2000  Robb Shecter, Sultanbek Tezadov
 
 This is free software; see the source for copying conditions.  There is NO
@@ -1402,7 +1402,21 @@ You should now select a node with the space bar."""
         if os.path.isfile(filepath):
             code, text = d.editbox(filepath, 20, 60,
                                    title="A Cheap Text Editor")
-
+            d.scrollbox(text, title="Resulting text")
+        else:
+            d.msgbox("Skipping the first part of the 'editbox' demo, "
+                     "as '{0}' can't be found.".format(filepath),
+                     title="'msgbox' demo")
+
+        l = ["In the previous dialog, the initial contents was",
+             "explicitly written to a file. With Dialog.editbox_str(),",
+             "you can provide it as a string and pythondialog will",
+             "automatically create and delete a temporary file for you",
+             "holding this text for dialog.\n"] + \
+             [ "This is line {0} of a boring sample text.".format(i+1)
+               for i in range(100) ]
+        code, text = d.editbox_str('\n'.join(l), 0, 0,
+                                   title="A Cheap Text Editor")
         d.scrollbox(text, title="Resulting text")
 
     def inputmenu_demo(self):
diff --git a/examples/with-autowidgetsize/demo.py b/examples/with-autowidgetsize/demo.py
index 1ecbf83..dea5a8f 100755
--- a/examples/with-autowidgetsize/demo.py
+++ b/examples/with-autowidgetsize/demo.py
@@ -3,7 +3,7 @@
 
 # demo.py --- Demonstration program and cheap test suite for pythondialog
 #
-# Copyright (C) 2002-2010, 2013, 2014, 2015  Florent Rougon
+# Copyright (C) 2002-2010, 2013-2016  Florent Rougon
 # Copyright (C) 2000  Robb Shecter, Sultanbek Tezadov
 #
 # This program is in the public domain.
@@ -77,10 +77,10 @@ import dialog
 from dialog import DialogBackendVersion
 
 progname = os.path.basename(sys.argv[0])
-progversion = "0.11-autowidgetsize"
+progversion = "0.12-autowidgetsize"
 version_blurb = """Demonstration program and cheap test suite for pythondialog.
 
-Copyright (C) 2002-2010, 2013, 2014, 2015  Florent Rougon
+Copyright (C) 2002-2010, 2013-2016  Florent Rougon
 Copyright (C) 2000  Robb Shecter, Sultanbek Tezadov
 
 This is free software; see the source for copying conditions.  There is NO
@@ -1407,7 +1407,21 @@ You should now select a node with the space bar."""
         if os.path.isfile(filepath):
             code, text = d.editbox(filepath, 20, 60,
                                    title="A Cheap Text Editor")
-
+            d.scrollbox(text, title="Resulting text")
+        else:
+            d.msgbox("Skipping the first part of the 'editbox' demo, "
+                     "as '{0}' can't be found.".format(filepath),
+                     title="'msgbox' demo")
+
+        l = ["In the previous dialog, the initial contents was",
+             "explicitly written to a file. With Dialog.editbox_str(),",
+             "you can provide it as a string and pythondialog will",
+             "automatically create and delete a temporary file for you",
+             "holding this text for dialog.\n"] + \
+             [ "This is line {0} of a boring sample text.".format(i+1)
+               for i in range(100) ]
+        code, text = d.editbox_str('\n'.join(l), 0, 0,
+                                   title="A Cheap Text Editor")
         d.scrollbox(text, title="Resulting text")
 
     def inputmenu_demo(self):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pythondialog.git



More information about the Python-modules-commits mailing list