Sun, 01 Sep 2019 17:44:33 +0200
Removed some more support for QtWebKit and the old web rowser and Python2.
eric6/Documentation/Source/eric6.Globals.E5ConfigParser.html | file | annotate | diff | comparison | revisions | |
eric6/Documentation/Source/eric6.Globals.compatibility_fixes.html | file | annotate | diff | comparison | revisions | |
eric6/Documentation/Source/eric6.WebBrowser.SafeBrowsing.SafeBrowsingUtilities.html | file | annotate | diff | comparison | revisions | |
eric6/Globals/E5ConfigParser.py | file | annotate | diff | comparison | revisions | |
eric6/Globals/compatibility_fixes.py | file | annotate | diff | comparison | revisions | |
eric6/WebBrowser/SafeBrowsing/SafeBrowsingUtilities.py | file | annotate | diff | comparison | revisions | |
eric6/eric6_webbrowser.py | file | annotate | diff | comparison | revisions | |
eric6/eric6_webbrowser.pyw | file | annotate | diff | comparison | revisions | |
linux/eric6_webbrowser.desktop.in | file | annotate | diff | comparison | revisions |
--- a/eric6/Documentation/Source/eric6.Globals.E5ConfigParser.html Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric6.Globals.E5ConfigParser</title> -<meta charset="UTF-8"> -<style> -body { - background: #EDECE6; - margin: 0em 1em 10em 1em; - color: black; -} - -h1 { color: white; background: #85774A; } -h2 { color: white; background: #85774A; } -h3 { color: white; background: #9D936E; } -h4 { color: white; background: #9D936E; } - -a { color: #BA6D36; } - -</style> -</head> -<body><a NAME="top" ID="top"></a> -<h1>eric6.Globals.E5ConfigParser</h1> -<p> -Module implementing a ConfigParser wrapper for Python 2 to provide the -dictionary like interface of the Python 3 variant. -</p> -<h3>Global Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Classes</h3> -<table> -<tr> -<td><a href="#E5ConfigParser">E5ConfigParser</a></td> -<td>Class implementing a wrapper of the ConfigParser class implementing dictionary like special methods and some enhancements from Python 3.</td> -</tr> -</table> -<h3>Functions</h3> -<table> -<tr><td>None</td></tr> -</table> -<hr /><hr /> -<a NAME="E5ConfigParser" ID="E5ConfigParser"></a> -<h2>E5ConfigParser</h2> -<p> - Class implementing a wrapper of the ConfigParser class implementing - dictionary like special methods and some enhancements from Python 3. -</p> -<h3>Derived from</h3> -SafeConfigParser -<h3>Class Attributes</h3> -<table> -<tr><td>OPTCRE</td></tr><tr><td>OPTCRE_NV</td></tr><tr><td>_OPT_NV_TMPL</td></tr><tr><td>_OPT_TMPL</td></tr> -</table> -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Methods</h3> -<table> -<tr> -<td><a href="#E5ConfigParser.__init__">E5ConfigParser</a></td> -<td>Constructor</td> -</tr><tr> -<td><a href="#E5ConfigParser.__contains__">__contains__</a></td> -<td>Special method to test, if a section is contained in the config.</td> -</tr><tr> -<td><a href="#E5ConfigParser.__delitem__">__delitem__</a></td> -<td>Special method to delete a section.</td> -</tr><tr> -<td><a href="#E5ConfigParser.__getitem__">__getitem__</a></td> -<td>Special method to get a section.</td> -</tr><tr> -<td><a href="#E5ConfigParser.__iter__">__iter__</a></td> -<td>Special method to return an iterator of the section names starting with the default section.</td> -</tr><tr> -<td><a href="#E5ConfigParser.__len__">__len__</a></td> -<td>Special method get the number of sections of the config.</td> -</tr><tr> -<td><a href="#E5ConfigParser.__setitem__">__setitem__</a></td> -<td>Special method to set the values of a section.</td> -</tr> -</table> -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<a NAME="E5ConfigParser.__init__" ID="E5ConfigParser.__init__"></a> -<h4>E5ConfigParser (Constructor)</h4> -<b>E5ConfigParser</b>(<i>defaults=None, dict_type=_default_dict, allow_no_value=False, delimiters=('=', ':')</i>) -<p> - Constructor -</p><a NAME="E5ConfigParser.__contains__" ID="E5ConfigParser.__contains__"></a> -<h4>E5ConfigParser.__contains__</h4> -<b>__contains__</b>(<i>key</i>) -<p> - Special method to test, if a section is contained in the config. -</p><dl> -<dt><i>key</i> (str)</dt> -<dd> -name of the section -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -flag indicating containment -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl><a NAME="E5ConfigParser.__delitem__" ID="E5ConfigParser.__delitem__"></a> -<h4>E5ConfigParser.__delitem__</h4> -<b>__delitem__</b>(<i>key</i>) -<p> - Special method to delete a section. -</p><dl> -<dt><i>key</i> (str)</dt> -<dd> -name of the section -</dd> -</dl><dl> -<dt>Raises <b>KeyError</b>:</dt> -<dd> -raised to indicate a non-existent section -</dd><dt>Raises <b>ValueError</b>:</dt> -<dd> -raised to indicate non-removal of the - default section -</dd> -</dl><a NAME="E5ConfigParser.__getitem__" ID="E5ConfigParser.__getitem__"></a> -<h4>E5ConfigParser.__getitem__</h4> -<b>__getitem__</b>(<i>key</i>) -<p> - Special method to get a section. -</p><dl> -<dt><i>key</i> (str)</dt> -<dd> -name of the section -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -section for the given key -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -dict -</dd> -</dl><dl> -<dt>Raises <b>KeyError</b>:</dt> -<dd> -raised if a non-existent key is given -</dd> -</dl><a NAME="E5ConfigParser.__iter__" ID="E5ConfigParser.__iter__"></a> -<h4>E5ConfigParser.__iter__</h4> -<b>__iter__</b>(<i></i>) -<p> - Special method to return an iterator of the section names starting - with the default section. -</p><dl> -<dt>Returns:</dt> -<dd> -iterator of the section names contained in the config -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -iterator of str -</dd> -</dl><a NAME="E5ConfigParser.__len__" ID="E5ConfigParser.__len__"></a> -<h4>E5ConfigParser.__len__</h4> -<b>__len__</b>(<i></i>) -<p> - Special method get the number of sections of the config. -</p><dl> -<dt>Returns:</dt> -<dd> -number of sections -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -int -</dd> -</dl><a NAME="E5ConfigParser.__setitem__" ID="E5ConfigParser.__setitem__"></a> -<h4>E5ConfigParser.__setitem__</h4> -<b>__setitem__</b>(<i>key, values</i>) -<p> - Special method to set the values of a section. -</p><dl> -<dt><i>key</i> (str)</dt> -<dd> -name of the section -</dd><dt><i>values</i> (dict)</dt> -<dd> -value for the section -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html> \ No newline at end of file
--- a/eric6/Documentation/Source/eric6.Globals.compatibility_fixes.html Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,382 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric6.Globals.compatibility_fixes</title> -<meta charset="UTF-8"> -<style> -body { - background: #EDECE6; - margin: 0em 1em 10em 1em; - color: black; -} - -h1 { color: white; background: #85774A; } -h2 { color: white; background: #85774A; } -h3 { color: white; background: #9D936E; } -h4 { color: white; background: #9D936E; } - -a { color: #BA6D36; } - -</style> -</head> -<body><a NAME="top" ID="top"></a> -<h1>eric6.Globals.compatibility_fixes</h1> -<p> -Module implementing some workarounds to let eric6 run under Python 2. -</p> -<h3>Global Attributes</h3> -<table> -<tr><td>__find_module</td></tr><tr><td>__join</td></tr><tr><td>__load_source</td></tr> -</table> -<h3>Classes</h3> -<table> -<tr> -<td><a href="#File">File</a></td> -<td></td> -</tr><tr> -<td><a href="#PlainStrList">PlainStrList</a></td> -<td>Keep track that all added paths to sys.path are str.</td> -</tr> -</table> -<h3>Functions</h3> -<table> -<tr> -<td><a href="#find_moduleAsStr">find_moduleAsStr</a></td> -<td>Convert none str parameter of the imp.find_module into str.</td> -</tr><tr> -<td><a href="#joinAsUnicode">joinAsUnicode</a></td> -<td>Convert none unicode parameter of the os.path.join into unicode.</td> -</tr><tr> -<td><a href="#load_sourceAsStr">load_sourceAsStr</a></td> -<td>Convert none str parameter of the imp.load_source into str.</td> -</tr><tr> -<td><a href="#open">open</a></td> -<td>Replacement for the build in open function.</td> -</tr> -</table> -<hr /><hr /> -<a NAME="File" ID="File"></a> -<h2>File</h2> - -<h3>Derived from</h3> -file -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Methods</h3> -<table> -<tr> -<td><a href="#File.__init__">File</a></td> -<td>Constructor</td> -</tr><tr> -<td><a href="#File.next">next</a></td> -<td>Public method used in an iterator.</td> -</tr><tr> -<td><a href="#File.read">read</a></td> -<td>Public method to read n bytes or all if n=-1 from file.</td> -</tr><tr> -<td><a href="#File.readline">readline</a></td> -<td>Public method to read one line from file.</td> -</tr><tr> -<td><a href="#File.readlines">readlines</a></td> -<td>Public method to read all lines from file.</td> -</tr><tr> -<td><a href="#File.write">write</a></td> -<td>Public method to write given data to file and encode if needed.</td> -</tr> -</table> -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<a NAME="File.__init__" ID="File.__init__"></a> -<h4>File (Constructor)</h4> -<b>File</b>(<i>filein, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True</i>) -<p> - Constructor -</p><p> - It checks for unimplemented parameters. -</p><dl> -<dt><i>filein</i></dt> -<dd> -filename or file descriptor (string) -</dd><dt><i>mode=</i></dt> -<dd> -access mode (string) -</dd><dt><i>buffering=</i></dt> -<dd> -size of the read buffer (string) -</dd><dt><i>encoding=</i></dt> -<dd> -character encoding for reading/ writing (string) -</dd><dt><i>errors=</i></dt> -<dd> -behavior for the character encoding ('strict', - 'explicit', ...) (string) -</dd><dt><i>newline=</i></dt> -<dd> -controls how universal newlines works (string) -</dd><dt><i>closefd=</i></dt> -<dd> -close underlying file descriptor if given as file - parameter (boolean) -</dd> -</dl><dl> -<dt>Raises <b>NotImplementedError</b>:</dt> -<dd> -for not implemented method parameters -</dd> -</dl><a NAME="File.next" ID="File.next"></a> -<h4>File.next</h4> -<b>next</b>(<i></i>) -<p> - Public method used in an iterator. -</p><dl> -<dt>Returns:</dt> -<dd> -decoded data read -</dd> -</dl><a NAME="File.read" ID="File.read"></a> -<h4>File.read</h4> -<b>read</b>(<i>n=-1</i>) -<p> - Public method to read n bytes or all if n=-1 from file. -</p><dl> -<dt><i>n=</i></dt> -<dd> -bytecount or all if n=-1 (int) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -decoded bytes read -</dd> -</dl><a NAME="File.readline" ID="File.readline"></a> -<h4>File.readline</h4> -<b>readline</b>(<i>limit=-1</i>) -<p> - Public method to read one line from file. -</p><dl> -<dt><i>limit=</i></dt> -<dd> -maximum bytes to read or all if limit=-1 (int) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -decoded line read -</dd> -</dl><a NAME="File.readlines" ID="File.readlines"></a> -<h4>File.readlines</h4> -<b>readlines</b>(<i>hint=-1</i>) -<p> - Public method to read all lines from file. -</p><dl> -<dt><i>hint=</i></dt> -<dd> -maximum bytes to read or all if hint=-1 (int) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -decoded lines read -</dd> -</dl><a NAME="File.write" ID="File.write"></a> -<h4>File.write</h4> -<b>write</b>(<i>txt</i>) -<p> - Public method to write given data to file and encode if needed. -</p><dl> -<dt><i>txt</i></dt> -<dd> -data to write. (str, bytes) -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="PlainStrList" ID="PlainStrList"></a> -<h2>PlainStrList</h2> -<p> - Keep track that all added paths to sys.path are str. -</p> -<h3>Derived from</h3> -list -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Methods</h3> -<table> -<tr> -<td><a href="#PlainStrList.__init__">PlainStrList</a></td> -<td>Constructor</td> -</tr><tr> -<td><a href="#PlainStrList.__convert">__convert</a></td> -<td>Private method to convert unicode to file system encoding.</td> -</tr><tr> -<td><a href="#PlainStrList.__setitem__">__setitem__</a></td> -<td>Special method to overwrite a specific list item.</td> -</tr><tr> -<td><a href="#PlainStrList.insert">insert</a></td> -<td>Public method to insert a specific list item.</td> -</tr> -</table> -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<a NAME="PlainStrList.__init__" ID="PlainStrList.__init__"></a> -<h4>PlainStrList (Constructor)</h4> -<b>PlainStrList</b>(<i>*args</i>) -<p> - Constructor -</p><dl> -<dt><i>args</i></dt> -<dd> -list of paths to start with (list) -</dd> -</dl><a NAME="PlainStrList.__convert" ID="PlainStrList.__convert"></a> -<h4>PlainStrList.__convert</h4> -<b>__convert</b>(<i>element</i>) -<p> - Private method to convert unicode to file system encoding. -</p><dl> -<dt><i>element</i></dt> -<dd> -to convert from unicode to file system encoding (any) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -converted element -</dd> -</dl><a NAME="PlainStrList.__setitem__" ID="PlainStrList.__setitem__"></a> -<h4>PlainStrList.__setitem__</h4> -<b>__setitem__</b>(<i>idx, value</i>) -<p> - Special method to overwrite a specific list item. -</p><dl> -<dt><i>idx</i></dt> -<dd> -index of the item (int) -</dd><dt><i>value</i></dt> -<dd> -the new value (any) -</dd> -</dl><a NAME="PlainStrList.insert" ID="PlainStrList.insert"></a> -<h4>PlainStrList.insert</h4> -<b>insert</b>(<i>idx, value</i>) -<p> - Public method to insert a specific list item. -</p><dl> -<dt><i>idx</i></dt> -<dd> -index of the item (int) -</dd><dt><i>value</i></dt> -<dd> -the new value (any) -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="find_moduleAsStr" ID="find_moduleAsStr"></a> -<h2>find_moduleAsStr</h2> -<b>find_moduleAsStr</b>(<i>*args</i>) -<p> - Convert none str parameter of the imp.find_module into str. -</p><dl> -<dt><i>args</i></dt> -<dd> -(str, unicode) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -list of args converted to str (list) -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="joinAsUnicode" ID="joinAsUnicode"></a> -<h2>joinAsUnicode</h2> -<b>joinAsUnicode</b>(<i>*args</i>) -<p> - Convert none unicode parameter of the os.path.join into unicode. -</p><dl> -<dt><i>args</i></dt> -<dd> -paths which should be joined (str, unicode) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -unicode str of the path (unicode) -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="load_sourceAsStr" ID="load_sourceAsStr"></a> -<h2>load_sourceAsStr</h2> -<b>load_sourceAsStr</b>(<i>*args</i>) -<p> - Convert none str parameter of the imp.load_source into str. -</p><dl> -<dt><i>args</i></dt> -<dd> -(str, unicode) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -list of args converted to str (list) -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="open" ID="open"></a> -<h2>open</h2> -<b>open</b>(<i>filein, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True</i>) -<p> - Replacement for the build in open function. -</p><dl> -<dt><i>filein</i></dt> -<dd> -filename or file descriptor (string) -</dd><dt><i>mode=</i></dt> -<dd> -access mode (string) -</dd><dt><i>buffering=</i></dt> -<dd> -size of the read buffer (string) -</dd><dt><i>encoding=</i></dt> -<dd> -character encoding for reading/ writing (string) -</dd><dt><i>errors=</i></dt> -<dd> -behavior for the character encoding ('strict', - 'explicit', ...) (string) -</dd><dt><i>newline=</i></dt> -<dd> -controls how universal newlines works (string) -</dd><dt><i>closefd=</i></dt> -<dd> -close underlying file descriptor if given as file - parameter (boolean) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -Returns the new file object -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html> \ No newline at end of file
--- a/eric6/Documentation/Source/eric6.WebBrowser.SafeBrowsing.SafeBrowsingUtilities.html Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric6.WebBrowser.SafeBrowsing.SafeBrowsingUtilities</title> -<meta charset="UTF-8"> -<style> -body { - background: #EDECE6; - margin: 0em 1em 10em 1em; - color: black; -} - -h1 { color: white; background: #85774A; } -h2 { color: white; background: #85774A; } -h3 { color: white; background: #9D936E; } -h4 { color: white; background: #9D936E; } - -a { color: #BA6D36; } - -</style> -</head> -<body><a NAME="top" ID="top"></a> -<h1>eric6.WebBrowser.SafeBrowsing.SafeBrowsingUtilities</h1> -<p> -Module implementing some utilities for Google Safe Browsing. -</p> -<h3>Global Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Classes</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Functions</h3> -<table> -<tr> -<td><a href="#toHex">toHex</a></td> -<td>Public method to convert a bytes array to a hex string.</td> -</tr><tr> -<td><a href="#toHex_1">toHex</a></td> -<td>Public method to convert a bytes array to a hex string.</td> -</tr> -</table> -<hr /><hr /> -<a NAME="toHex" ID="toHex"></a> -<h2>toHex</h2> -<b>toHex</b>(<i>value</i>) -<p> - Public method to convert a bytes array to a hex string. -</p><dl> -<dt><i>value</i> (bytes)</dt> -<dd> -value to be converted -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -hex string -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="toHex_1" ID="toHex_1"></a> -<h2>toHex</h2> -<b>toHex</b>(<i>value</i>) -<p> - Public method to convert a bytes array to a hex string. -</p><dl> -<dt><i>value</i> (bytes)</dt> -<dd> -value to be converted -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -hex string -</dd> -</dl><dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html> \ No newline at end of file
--- a/eric6/Globals/E5ConfigParser.py Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2016 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Module implementing a ConfigParser wrapper for Python 2 to provide the -dictionary like interface of the Python 3 variant. -""" - -from __future__ import unicode_literals - -try: - from configparser import ConfigParser as E5ConfigParser -except ImportError: - # Py2 part with the compatibility wrapper class - try: - from collections import OrderedDict as _default_dict - # __IGNORE_WARNING_N813__ - except ImportError: - # fallback for setup.py which hasn't yet built _collections - _default_dict = dict - - import re - import itertools - from ConfigParser import SafeConfigParser, DEFAULTSECT - - class E5ConfigParser(SafeConfigParser): - """ - Class implementing a wrapper of the ConfigParser class implementing - dictionary like special methods and some enhancements from Python 3. - """ - _OPT_TMPL = r""" - (?P<option>.*?) # very permissive! - \s*(?P<vi>{delim})\s* # any number of space/tab, - # followed by any of the - # allowed delimiters, - # followed by any space/tab - (?P<value>.*)$ # everything up to eol - """ - _OPT_NV_TMPL = r""" - (?P<option>.*?) # very permissive! - \s*(?: # any number of space/tab, - (?P<vi>{delim})\s* # optionally followed by - # any of the allowed - # delimiters, followed by any - # space/tab - (?P<value>.*))?$ # everything up to eol - """ - # Compiled regular expression for matching options with typical - # separators - OPTCRE = re.compile(_OPT_TMPL.format(delim="=|:"), re.VERBOSE) - # Compiled regular expression for matching options with optional - # values delimited using typical separators - OPTCRE_NV = re.compile(_OPT_NV_TMPL.format(delim="=|:"), re.VERBOSE) - - def __init__(self, defaults=None, dict_type=_default_dict, - allow_no_value=False, delimiters=('=', ':')): - """ - Constructor - """ - SafeConfigParser.__init__( - self, - defaults=defaults, dict_type=dict_type, - allow_no_value=allow_no_value) - - if delimiters == ('=', ':'): - self._optcre = \ - self.OPTCRE_NV if allow_no_value else self.OPTCRE - else: - d = "|".join(re.escape(d) for d in delimiters) - if allow_no_value: - self._optcre = re.compile( - self._OPT_NV_TMPL.format(delim=d), re.VERBOSE) - else: - self._optcre = re.compile( - self._OPT_TMPL.format(delim=d), re.VERBOSE) - - def __getitem__(self, key): - """ - Special method to get a section. - - @param key name of the section - @type str - @return section for the given key - @rtype dict - @exception KeyError raised if a non-existent key is given - """ - if key == DEFAULTSECT: - return self._defaults - elif self.has_section(key): - return self._sections[key] - else: - raise KeyError(key) - - def __setitem__(self, key, values): - """ - Special method to set the values of a section. - - @param key name of the section - @type str - @param values value for the section - @type dict - """ - # To conform with the mapping protocol, overwrites existing values - # in the section. - if key == DEFAULTSECT: - self._defaults.clear() - elif self.has_section(key): - self._sections[key].clear() - else: - self.add_section(key) - for subkey, value in values.items(): - subkey = self.optionxform(str(subkey)) - if value is not None: - value = str(value) - self.set(key, subkey, value) - - def __delitem__(self, key): - """ - Special method to delete a section. - - @param key name of the section - @type str - @exception ValueError raised to indicate non-removal of the - default section - @exception KeyError raised to indicate a non-existent section - """ - if key == DEFAULTSECT: - raise ValueError("Cannot remove the default section.") - if not self.has_section(key): - raise KeyError(key) - self.remove_section(key) - - def __contains__(self, key): - """ - Special method to test, if a section is contained in the config. - - @param key name of the section - @type str - @return flag indicating containment - @rtype bool - """ - return key == DEFAULTSECT or self.has_section(key) - - def __len__(self): - """ - Special method get the number of sections of the config. - - @return number of sections - @rtype int - """ - return len(self._sections) + 1 # the default section - - def __iter__(self): - """ - Special method to return an iterator of the section names starting - with the default section. - - @return iterator of the section names contained in the config - @rtype iterator of str - """ - return itertools.chain((DEFAULTSECT,), self._sections.keys()) - - -if __name__ == "__main__": - # This is some test code. - import sys - - c = E5ConfigParser() - c["DEFAULT"] = {'ServerAliveInterval': '45', - 'Compression': 'yes', - 'CompressionLevel': '9'} - c['bitbucket.org'] = {} - c['bitbucket.org']['User'] = 'hg' - c['topsecret.server.com'] = {} - topsecret = c['topsecret.server.com'] - topsecret['Port'] = '50022' - topsecret['ForwardX11'] = 'no' - c['DEFAULT']['ForwardX11'] = 'yes' - - c.write(sys.stdout)
--- a/eric6/Globals/compatibility_fixes.py Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,289 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2013 - 2015 Tobias Rzepka <tobias.rzepka@gmail.com> -# - -""" -Module implementing some workarounds to let eric6 run under Python 2. -""" - - -import __builtin__ # __IGNORE_EXCEPTION__ -import codecs -import imp -import locale -import os -import sys - -# convert all command line arguments to unicode -sys.argv = [arg.decode(locale.getpreferredencoding()) for arg in sys.argv] - -""" -Improvement for the os.path.join function because the original join doesn't -use the correct encoding. -""" -# Save original function for use in joinAsUnicode -__join = os.path.join -# Flag to disable unicode conversion of join function -os.path.join_unicode = True - - -def joinAsUnicode(*args): - """ - Convert none unicode parameter of the os.path.join into unicode. - - @param args paths which should be joined (str, unicode) - @return unicode str of the path (unicode) - """ - if os.path.join_unicode: - convArgs = [] - for arg in args: - if isinstance(arg, str): - arg = arg.decode(locale.getpreferredencoding(), 'replace') - convArgs.append(arg) - return __join(*convArgs) - else: - return __join(*args) - -# Replace os.path.join with unicode aware version -os.path.join = joinAsUnicode - -""" -Improvement for the imp.load_source and imp.find_module functions because the -originals doesn't use the correct encoding. -""" -# Save original function for use in load_sourceAsStr and find_moduleAsStr -__load_source = imp.load_source -__find_module = imp.find_module - - -def load_sourceAsStr(*args): - """ - Convert none str parameter of the imp.load_source into str. - - @param args (str, unicode) - @return list of args converted to str (list) - """ - convArgs = [] - for arg in args: - if isinstance(arg, unicode): - arg = arg.encode(sys.getfilesystemencoding(), 'strict') - convArgs.append(arg) - return __load_source(*convArgs) - - -def find_moduleAsStr(*args): - """ - Convert none str parameter of the imp.find_module into str. - - @param args (str, unicode) - @return list of args converted to str (list) - """ - convArgs = [] - for arg in args: - if isinstance(arg, unicode): - arg = arg.encode(sys.getfilesystemencoding(), 'strict') - convArgs.append(arg) - return __find_module(*convArgs) - -# Replace imp.load_source and imp.find_module with unicode aware version -imp.load_source = load_sourceAsStr -imp.find_module = find_moduleAsStr - -""" -Improvement for the sys.path list because some other functions doesn't expect -unicode in the sys.path list. -""" - - -class PlainStrList(list): - """ - Keep track that all added paths to sys.path are str. - """ - def __init__(self, *args): - """ - Constructor - - @param args list of paths to start with (list) - """ - super(PlainStrList, self).__init__() - self.extend(list(args)) - - def __convert(self, element): - """ - Private method to convert unicode to file system encoding. - - @param element to convert from unicode to file system encoding (any) - @return converted element - """ - if isinstance(element, unicode): - # Throw exception if it can't be converted, otherwise exception - # could occur somewhere else - element = element.encode(sys.getfilesystemencoding(), 'strict') - return element - - def __setitem__(self, idx, value): - """ - Special method to overwrite a specific list item. - - @param idx index of the item (int) - @param value the new value (any) - """ - super(PlainStrList, self).__setitem__(idx, self.__convert(value)) - - def insert(self, idx, value): - """ - Public method to insert a specific list item. - - @param idx index of the item (int) - @param value the new value (any) - """ - super(PlainStrList, self).insert(idx, self.__convert(value)) - - -# insert a conversion function from unicode to str at sys.path access -sys.path = PlainStrList(*sys.path) - -""" -The open function and File class simulates the open behaviour of Python3. - -The Eric6 used features are emulated only. The not emulated features -should throw a NotImplementedError exception. -""" - - -def open(filein, mode='r', buffering=-1, encoding=None, - errors=None, newline=None, closefd=True): - """ - Replacement for the build in open function. - - @param filein filename or file descriptor (string) - @keyparam mode access mode (string) - @keyparam buffering size of the read buffer (string) - @keyparam encoding character encoding for reading/ writing (string) - @keyparam errors behavior for the character encoding ('strict', - 'explicit', ...) (string) - @keyparam newline controls how universal newlines works (string) - @keyparam closefd close underlying file descriptor if given as file - parameter (boolean) - @return Returns the new file object - """ - return File(filein, mode, buffering, encoding, errors, newline, closefd) - - -class File(file): # __IGNORE_WARNING__ - """ - Facade for the original file class. - """ - def __init__(self, filein, mode='r', buffering=-1, - encoding=None, errors=None, newline=None, closefd=True): - """ - Constructor - - It checks for unimplemented parameters. - - @param filein filename or file descriptor (string) - @keyparam mode access mode (string) - @keyparam buffering size of the read buffer (string) - @keyparam encoding character encoding for reading/ writing (string) - @keyparam errors behavior for the character encoding ('strict', - 'explicit', ...) (string) - @keyparam newline controls how universal newlines works (string) - @keyparam closefd close underlying file descriptor if given as file - parameter (boolean) - @exception NotImplementedError for not implemented method parameters - """ - self.__encoding = encoding - self.__newline = str(newline) - self.__closefd = closefd - if newline is not None: - if 'r' in mode: - raise NotImplementedError - else: - mode = mode.replace('t', 'b') - if 'b' not in mode: - mode = mode + 'b' - - if closefd is False: - raise NotImplementedError - - if errors is None: - self.__errors = 'strict' - else: - self.__errors = errors - - file.__init__(self, filein, mode, buffering) # __IGNORE_WARNING__ - - def read(self, n=-1): - """ - Public method to read n bytes or all if n=-1 from file. - - @keyparam n bytecount or all if n=-1 (int) - @return decoded bytes read - """ - txt = super(File, self).read(n) - if self.__encoding is None: - return txt - else: - return codecs.decode(txt, self.__encoding) - - def readline(self, limit=-1): - """ - Public method to read one line from file. - - @keyparam limit maximum bytes to read or all if limit=-1 (int) - @return decoded line read - """ - txt = super(File, self).readline(limit) - if self.__encoding is None: - return txt - else: - return codecs.decode(txt, self.__encoding) - - def readlines(self, hint=-1): - """ - Public method to read all lines from file. - - @keyparam hint maximum bytes to read or all if hint=-1 (int) - @return decoded lines read - """ - if self.__encoding is None: - return super(File, self).readlines(hint) - else: - return [codecs.decode(txt, self.__encoding) - for txt in super(File, self).readlines(hint)] - - def write(self, txt): - """ - Public method to write given data to file and encode if needed. - - @param txt data to write. (str, bytes) - """ - if self.__encoding is not None: - txt = codecs.encode(txt, self.__encoding, self.__errors) - elif isinstance(txt, unicode): - txt = codecs.encode(txt, 'utf-8', self.__errors) - - if self.__newline in ['\r\n', '\r']: - txt = txt.replace('\n', self.__newline) - - super(File, self).write(txt) - - def next(self): - """ - Public method used in an iterator. - - @return decoded data read - """ - txt = super(File, self).next() - if self.__encoding is None: - return txt - else: - return codecs.decode(txt, self.__encoding) - -# Inject into the __builtin__ dictionary -__builtin__.open = open - -# -# eflag: FileType = Python2 -# eflag: noqa = M702
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingUtilities.py Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2017 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Module implementing some utilities for Google Safe Browsing. -""" - -from __future__ import unicode_literals - -import sys - -if sys.version_info < (3, 0): - def toHex(value): - """ - Public method to convert a bytes array to a hex string. - - @param value value to be converted - @type bytes - @return hex string - @rtype str - """ - return value.encode("hex") -else: - def toHex(value): - """ - Public method to convert a bytes array to a hex string. - - @param value value to be converted - @type bytes - @return hex string - @rtype str - """ - return value.hex()
--- a/eric6/eric6_webbrowser.py Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Copyright (c) 2002 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Eric6 Web Browser. - -This is the main Python script that performs the necessary initialization -of the web browser and starts the Qt event loop. This is a standalone version -of the integrated helpviewer. -""" - -from __future__ import unicode_literals - -import sys -import os - -sys.path.insert(1, os.path.dirname(__file__)) - -import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__ - -try: # Only for Py2 - import Globals.compatibility_fixes # __IGNORE_WARNING__ -except (ImportError): - pass - -try: - try: - from PyQt5 import sip - except ImportError: - import sip - sip.setdestroyonexit(False) -except AttributeError: - pass - -try: - from PyQt5 import QtWebKit # __IGNORE_WARNING__ -except ImportError: - if "--quiet" not in sys.argv: - from PyQt5.QtCore import qVersion, QTimer - from PyQt5.QtWidgets import QApplication - from E5Gui import E5MessageBox - app = QApplication([]) - QTimer.singleShot(0, lambda: E5MessageBox.critical( - None, - "eric6 Web Browser (QtWebKit based)", - "QtWebKit is needed to run this variant of the eric6 Web Browser." - " However, it seems to be missing. You are using Qt {0}, which" - " doesn't include this anymore.".format(qVersion()))) - app.exec_() - sys.exit(100) - -for arg in sys.argv[:]: - if arg.startswith("--config="): - import Globals - configDir = arg.replace("--config=", "") - Globals.setConfigDir(configDir) - sys.argv.remove(arg) - elif arg.startswith("--settings="): - from PyQt5.QtCore import QSettings - settingsDir = os.path.expanduser(arg.replace("--settings=", "")) - if not os.path.isdir(settingsDir): - os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) - sys.argv.remove(arg) - -# make ThirdParty package available as a packages repository -sys.path.insert(2, os.path.join(os.path.dirname(__file__), - "ThirdParty", "Pygments")) -sys.path.insert(2, os.path.join(os.path.dirname(__file__), - "ThirdParty", "EditorConfig")) - -import Globals -from Globals import AppInfo - -from E5Gui.E5Application import E5Application - -from Toolbox import Startup - -from Helpviewer.HelpSingleApplication import HelpSingleApplicationClient - -app = None - - -def createMainWidget(argv): - """ - Function to create the main widget. - - @param argv list of command line parameters - @type list of str - @return reference to the main widget - @rtype QWidget - """ - from Helpviewer.HelpWindow import HelpWindow - - searchWord = None - qthelp = False - single = False - name = "" - - for arg in reversed(argv): - if arg.startswith("--search="): - searchWord = argv[1].split("=", 1)[1] - argv.remove(arg) - elif arg.startswith("--name="): - name = arg.replace("--name=", "") - argv.remove(arg) - elif arg.startswith("--newtab="): - # only used for single application client - argv.remove(arg) - elif arg == "--qthelp": - qthelp = True - argv.remove(arg) - elif arg == "--quiet": - # only needed until we reach this point - argv.remove(arg) - elif arg == "--single": - single = True - argv.remove(arg) - elif arg.startswith("--"): - argv.remove(arg) - - try: - home = argv[1] - except IndexError: - home = "" - - helpWindow = HelpWindow(home, '.', None, 'help viewer', - searchWord=searchWord, qthelp=qthelp, - single=single, saname=name) - return helpWindow - - -def main(): - """ - Main entry point into the application. - """ - global app - - options = [ - ("--config=configDir", - "use the given directory as the one containing the config files"), - ("--qthelp", "start the browser with support for QtHelp"), - ("--quiet", "don't show any startup error messages"), - ("--search=word", "search for the given word"), - ("--settings=settingsDir", - "use the given directory to store the settings files"), - ("--single", "start the browser as a single application"), - ] - appinfo = AppInfo.makeAppInfo(sys.argv, - "eric6 Web Browser", - "file", - "web browser", - options) - - # set the library paths for plugins - Startup.setLibraryPaths() - - app = E5Application(sys.argv) - client = HelpSingleApplicationClient() - res = client.connect() - if res > 0: - if len(sys.argv) > 1: - client.processArgs(sys.argv[1:]) - sys.exit(0) - elif res < 0: - print("eric6_webbrowser: {0}".format(client.errstr())) - # __IGNORE_WARNING_M801__ - sys.exit(res) - - res = Startup.simpleAppStartup(sys.argv, - appinfo, - createMainWidget, - installErrorHandler=True, - app=app) - sys.exit(res) - -if __name__ == '__main__': - main()
--- a/eric6/eric6_webbrowser.pyw Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2011 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Module implementing the Windows entry point. -""" - -from __future__ import unicode_literals - -from eric6_webbrowser import main - -main()
--- a/linux/eric6_webbrowser.desktop.in Sun Sep 01 17:43:03 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Exec=@BINDIR@/eric6_webbrowser@MARKER@ -MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https; -Icon=ericWeb@MARKER@ -Terminal=false -Name=eric6 Web Browser (QtWebKit)@PY_MARKER@ -Name[de]=eric6 Web Browser (QtWebKit)@PY_MARKER@ -Comment=Web Browser for PyQt based on QtWebKit -Comment[de]=Web Browser für PyQt basierend auf QtWebKit -GenericName=Web Browser -GenericName[de]=Web Browser -Categories=Qt;X-Python;Network;WebBrowser;X-QtWebKit; -StartupNotify=true