Manually register addon widget signals. Otherwise main keeps bugging with
GtkWarnings when timer plugin is disabled.
check-in: 33e106bce5 user: mario tags: trunk
# encoding: UTF-8# api: python # type: functions# title: Python2 and Python3 compatibility# version: 0.1# version: 0.2## Renames some Python3 modules into their Py2 equivalent.# Slim local alternative to `six` module.import sys
2829303132333435363738394041
282930313233343536373839404142434445
++++
import urllib2
from urllib import urlencode
import urlparse
import cookielib
# filesysfromStringIOimportStringIOfrom gzip importGzipFiledef gzip_decode(bytes):returnGzipFile(fileobj=StringIO(bytes)).read()# return zlib.decompress(bytes, 16 + zlib.MAX_WBITS) # not fully compatible# Python 3else:# version tags
PY2 =0
505152535455565758
545556575859606162636465666768697071727374
+-++++++++++++
import urllib.request as urllib2
from urllib.parse import urlencode
import urllib.parse as urlparse
from http import cookiejar as cookielib
# filesysfrom io importStringIOfrom gzip import decompress as gzip_decode# Both# find_executable() is only needed by channels/configwintry:from distutils.spawn import find_executableexcept:def find_executable(bin): exists =[os.path.exists(dir+"/"+bin)for dir in os.environ.get("PATH").split(":")+["/"]]return exists[0]if len(exists)elseNone
if server in netrc:return netrc[server]# Retrieve content from install path or pyzip archive (alias for pkgutil.get_data)#def get_data(fn, decode=False, z=False, file_base="config"):def get_data(fn, decode=False,gz=False, file_base="config"):try:
bin = pkgutil.get_data(file_base, fn)if z:
bin =zlib.decompress(bin)ifgz:
bin =gzip_decode(bin)if decode:return bin.decode("utf-8")else:return str(bin)except:pass