Merge pull request #206 from lazlolazlolazlo/codestyle

Fix some small codestyle issues according to pep8.
This commit is contained in:
Micah Lee 2015-11-08 12:43:42 -08:00
commit 2b1a3e927e
8 changed files with 35 additions and 33 deletions

View File

@ -40,6 +40,7 @@ if get_platform() == 'Darwin':
else:
osx_resources_dir = None
def get_onionshare_dir():
if get_platform() == 'Darwin':
onionshare_dir = os.path.dirname(__file__)
@ -47,6 +48,7 @@ def get_onionshare_dir():
onionshare_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
return onionshare_dir
def get_html_path(filename):
p = platform.system()
if p == 'Darwin':

View File

@ -112,7 +112,7 @@ class OnionShare(object):
args = ['/usr/bin/sudo', '--', '/usr/bin/onionshare']
print "Executing: {0:s}".format(args+[str(self.port)])
p = subprocess.Popen(args+[str(self.port)], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
stdout = p.stdout.read(22) # .onion URLs are 22 chars long
stdout = p.stdout.read(22) # .onion URLs are 22 chars long
if stdout:
self.onion_host = stdout
@ -227,7 +227,7 @@ class OnionShare(object):
except urllib2.HTTPError: # Tails error
sys.stdout.write('{0:s}\n'.format(strings._('wait_for_hs_nope')))
sys.stdout.flush()
except httplib.BadStatusLine: # Tails (with bridge) error
except httplib.BadStatusLine: # Tails (with bridge) error
sys.stdout.write('{0:s}\n'.format(strings._('wait_for_hs_nope')))
sys.stdout.flush()
except KeyboardInterrupt:

View File

@ -146,7 +146,7 @@ def download(slug_candidate):
basename = os.path.basename(zip_filename)
def generate():
chunk_size = 102400 # 100kb
chunk_size = 102400 # 100kb
fp = open(zip_filename, 'rb')
done = False

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import os, sys, inspect, platform
from onionshare import helpers
def get_onionshare_gui_dir():
p = helpers.get_platform()
if p == 'Darwin':

View File

@ -26,7 +26,7 @@ import common
try:
import onionshare
except ImportError:
sys.path.append(os.path.abspath(common.onionshare_gui_dir+"/.."))
sys.path.append(os.path.abspath(common.onionshare_gui_dir + "/.."))
import onionshare
from onionshare import strings, helpers, web

View File

@ -46,4 +46,3 @@ class Options(QtGui.QHBoxLayout):
self.web.set_stay_open(False)
else:
self.web.set_stay_open(True)

View File

@ -144,7 +144,7 @@ class ServerStatus(QtGui.QVBoxLayout):
GMEM_DDESHARE = 0x2000
ctypes.windll.user32.OpenClipboard(None)
ctypes.windll.user32.EmptyClipboard()
hcd = ctypes.windll.kernel32.GlobalAlloc(GMEM_DDESHARE, len(bytes(url))+1)
hcd = ctypes.windll.kernel32.GlobalAlloc(GMEM_DDESHARE, len(bytes(url)) + 1)
pch_data = ctypes.windll.kernel32.GlobalLock(hcd)
ctypes.cdll.msvcrt.strcpy(ctypes.c_char_p(pch_data), bytes(url))
ctypes.windll.kernel32.GlobalUnlock(hcd)