fix prints
This commit is contained in:
parent
98d6ba25c3
commit
6718706c65
|
@ -54,8 +54,9 @@ if options.exit:
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
sock.connect(single_app_addr)
|
sock.connect(single_app_addr)
|
||||||
sock.send('EXIT')
|
sock.send('EXIT')
|
||||||
if sock.recv(1024).strip() == 'OK': print 'Ok'
|
if sock.recv(1024).strip() == 'OK': print ('Ok')
|
||||||
except Exception, e: pass
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
@ -77,5 +78,5 @@ else:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
app.run()
|
app.run()
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e
|
print (e)
|
||||||
|
|
30
ez_setup.py
30
ez_setup.py
|
@ -13,6 +13,8 @@ the appropriate options to ``use_setuptools()``.
|
||||||
|
|
||||||
This file can also be run as a script to install or upgrade setuptools.
|
This file can also be run as a script to install or upgrade setuptools.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
DEFAULT_VERSION = "0.6c11"
|
DEFAULT_VERSION = "0.6c11"
|
||||||
DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
|
DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
|
||||||
|
@ -63,8 +65,10 @@ md5_data = {
|
||||||
}
|
}
|
||||||
|
|
||||||
import sys, os
|
import sys, os
|
||||||
try: from hashlib import md5
|
try:
|
||||||
except ImportError: from md5 import md5
|
from hashlib import md5
|
||||||
|
except ImportError:
|
||||||
|
from md5 import md5
|
||||||
|
|
||||||
def _validate_md5(egg_name, data):
|
def _validate_md5(egg_name, data):
|
||||||
if egg_name in md5_data:
|
if egg_name in md5_data:
|
||||||
|
@ -103,14 +107,14 @@ def use_setuptools(
|
||||||
return do_download()
|
return do_download()
|
||||||
try:
|
try:
|
||||||
pkg_resources.require("setuptools>="+version); return
|
pkg_resources.require("setuptools>="+version); return
|
||||||
except pkg_resources.VersionConflict, e:
|
except pkg_resources.VersionConflict as e:
|
||||||
if was_imported:
|
if was_imported:
|
||||||
print >>sys.stderr, (
|
print (
|
||||||
"The required version of setuptools (>=%s) is not available, and\n"
|
"The required version of setuptools (>=%s) is not available, and\n"
|
||||||
"can't be installed while this script is running. Please install\n"
|
" can't be installed while this script is running. Please install\n"
|
||||||
" a more recent version first, using 'easy_install -U setuptools'."
|
" a more recent version first, using 'easy_install -U setuptools'."
|
||||||
"\n\n(Currently using %r)"
|
"\n\n(Currently using %r)"
|
||||||
) % (version, e.args[0])
|
% (version, e.args[0]), file=sys.stderr)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
else:
|
else:
|
||||||
del pkg_resources, sys.modules['pkg_resources'] # reload ok
|
del pkg_resources, sys.modules['pkg_resources'] # reload ok
|
||||||
|
@ -216,10 +220,10 @@ def main(argv, version=DEFAULT_VERSION):
|
||||||
os.unlink(egg)
|
os.unlink(egg)
|
||||||
else:
|
else:
|
||||||
if setuptools.__version__ == '0.0.1':
|
if setuptools.__version__ == '0.0.1':
|
||||||
print >>sys.stderr, (
|
print (
|
||||||
"You have an obsolete version of setuptools installed. Please\n"
|
"You have an obsolete version of setuptools installed. Please\n"
|
||||||
"remove it from your system entirely before rerunning this script."
|
" remove it from your system entirely before rerunning this script.",
|
||||||
)
|
file=sys.stderr)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
req = "setuptools>="+version
|
req = "setuptools>="+version
|
||||||
|
@ -238,8 +242,8 @@ def main(argv, version=DEFAULT_VERSION):
|
||||||
from setuptools.command.easy_install import main
|
from setuptools.command.easy_install import main
|
||||||
main(argv)
|
main(argv)
|
||||||
else:
|
else:
|
||||||
print "Setuptools version",version,"or greater has been installed."
|
print ("Setuptools version %s or greater has been installed." % version)
|
||||||
print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
|
print ('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)')
|
||||||
|
|
||||||
def update_md5(filenames):
|
def update_md5(filenames):
|
||||||
"""Update our built-in md5 registry"""
|
"""Update our built-in md5 registry"""
|
||||||
|
@ -262,7 +266,7 @@ def update_md5(filenames):
|
||||||
|
|
||||||
match = re.search("\nmd5_data = {\n([^}]+)}", src)
|
match = re.search("\nmd5_data = {\n([^}]+)}", src)
|
||||||
if not match:
|
if not match:
|
||||||
print >>sys.stderr, "Internal error!"
|
print ("Internal error!", file=sys.stderr)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
src = src[:match.start(1)] + repl + src[match.end(1):]
|
src = src[:match.start(1)] + repl + src[match.end(1):]
|
||||||
|
|
|
@ -313,7 +313,8 @@ class Client:
|
||||||
self.error_messages.add(msg)
|
self.error_messages.add(msg)
|
||||||
app.error(msg)
|
app.error(msg)
|
||||||
|
|
||||||
else: print 'ERROR:', msg
|
else:
|
||||||
|
print ('ERROR: %s' % msg)
|
||||||
|
|
||||||
app.set_status(msg)
|
app.set_status(msg)
|
||||||
|
|
||||||
|
@ -323,7 +324,8 @@ class Client:
|
||||||
|
|
||||||
|
|
||||||
def process_message(self, app, type, data):
|
def process_message(self, app, type, data):
|
||||||
if debug: print 'message:', type, data
|
if debug:
|
||||||
|
print ('message: %s %s' % (type, data))
|
||||||
|
|
||||||
if type == 'heartbeat': return
|
if type == 'heartbeat': return
|
||||||
if type == 'ppd': self.process_ppd(app, data)
|
if type == 'ppd': self.process_ppd(app, data)
|
||||||
|
@ -350,13 +352,13 @@ class Client:
|
||||||
for version, type, data in self.conn.messages:
|
for version, type, data in self.conn.messages:
|
||||||
try:
|
try:
|
||||||
self.process_message(app, type, data)
|
self.process_message(app, type, data)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
self.conn.messages = []
|
self.conn.messages = []
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e
|
print (e)
|
||||||
|
|
||||||
# If client status has changed update UI
|
# If client status has changed update UI
|
||||||
newStatus = self.get_status()
|
newStatus = self.get_status()
|
||||||
|
@ -395,7 +397,7 @@ class Client:
|
||||||
self.conn.queue_command('quit')
|
self.conn.queue_command('quit')
|
||||||
self.conn.write_some()
|
self.conn.write_some()
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e
|
print (e)
|
||||||
|
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
|
|
@ -359,7 +359,7 @@ class ClientConfig:
|
||||||
set_widget_str_value(widget, self.options[name])
|
set_widget_str_value(widget, self.options[name])
|
||||||
|
|
||||||
except: # Don't let one bad widget kill everything
|
except: # Don't let one bad widget kill everything
|
||||||
print 'WARNING: failed to set widget "%s"' % name
|
print ('WARNING: failed to set widget "%s"' % name)
|
||||||
|
|
||||||
# Setup passkey and password entries
|
# Setup passkey and password entries
|
||||||
app.passkey_validator.set_good()
|
app.passkey_validator.set_good()
|
||||||
|
@ -614,8 +614,8 @@ class ClientConfig:
|
||||||
if value is None: options[name + '!'] = None
|
if value is None: options[name + '!'] = None
|
||||||
else: options[name] = value
|
else: options[name] = value
|
||||||
|
|
||||||
except Exception, e: # Don't let one bad widget kill everything
|
except Exception as e: # Don't let one bad widget kill everything
|
||||||
print 'WARNING: failed to save widget "%s": %s' % (name, e)
|
print ('WARNING: failed to save widget "%s": %s' % (name, e))
|
||||||
|
|
||||||
# Removed options
|
# Removed options
|
||||||
for name in self.options:
|
for name in self.options:
|
||||||
|
|
|
@ -104,7 +104,7 @@ class Connection:
|
||||||
if err != 0 and not err in [
|
if err != 0 and not err in [
|
||||||
errno.EINPROGRESS, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
|
errno.EINPROGRESS, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
|
||||||
self.fail_reason = 'connect'
|
self.fail_reason = 'connect'
|
||||||
raise Exception, 'Connection failed: ' + errno.errorcode[err]
|
raise Exception('Connection failed: ' + errno.errorcode[err])
|
||||||
|
|
||||||
if self.password: self.queue_command('auth "%s"' % self.password)
|
if self.password: self.queue_command('auth "%s"' % self.password)
|
||||||
map(self.queue_command, self.init_commands)
|
map(self.queue_command, self.init_commands)
|
||||||
|
@ -124,14 +124,14 @@ class Connection:
|
||||||
|
|
||||||
|
|
||||||
def connection_lost(self):
|
def connection_lost(self):
|
||||||
print 'Connection lost'
|
print ('Connection lost')
|
||||||
self.close()
|
self.close()
|
||||||
self.fail_reason = 'closed'
|
self.fail_reason = 'closed'
|
||||||
raise Exception, 'Lost connection'
|
raise Exception('Lost connection')
|
||||||
|
|
||||||
|
|
||||||
def connection_error(self, err, msg):
|
def connection_error(self, err, msg):
|
||||||
print 'Connection Error: %d: %s' % (err, msg)
|
print ('Connection Error: %d: %s' % (err, msg))
|
||||||
self.close()
|
self.close()
|
||||||
if err == errno.ECONNREFUSED: self.fail_reason = 'refused'
|
if err == errno.ECONNREFUSED: self.fail_reason = 'refused'
|
||||||
elif err in [errno.ETIMEDOUT, errno.ENETDOWN, errno.ENETUNREACH]:
|
elif err in [errno.ETIMEDOUT, errno.ENETDOWN, errno.ENETUNREACH]:
|
||||||
|
@ -153,7 +153,7 @@ class Connection:
|
||||||
self.connection_lost()
|
self.connection_lost()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
except socket.error, (err, msg):
|
except socket.error as (err, msg):
|
||||||
# Error codes for nothing to read
|
# Error codes for nothing to read
|
||||||
if err not in [errno.EAGAIN, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
|
if err not in [errno.EAGAIN, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
|
||||||
if bytesRead: return bytesRead
|
if bytesRead: return bytesRead
|
||||||
|
@ -178,7 +178,7 @@ class Connection:
|
||||||
self.connection_lost()
|
self.connection_lost()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
except socket.error, (err, msg):
|
except socket.error as (err, msg):
|
||||||
# Error codes for write buffer full
|
# Error codes for write buffer full
|
||||||
if err not in [errno.EAGAIN, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
|
if err not in [errno.EAGAIN, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
|
||||||
if bytesWritten: return bytesWritten
|
if bytesWritten: return bytesWritten
|
||||||
|
@ -189,7 +189,7 @@ class Connection:
|
||||||
|
|
||||||
|
|
||||||
def queue_command(self, command):
|
def queue_command(self, command):
|
||||||
if debug: print 'command: ' + command
|
if debug: print ('command: ' + command)
|
||||||
self.writeBuf += command + '\n'
|
self.writeBuf += command + '\n'
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,9 +199,9 @@ class Connection:
|
||||||
#if debug: print 'MSG:', type, msg
|
#if debug: print 'MSG:', type, msg
|
||||||
self.messages.append((version, type, msg))
|
self.messages.append((version, type, msg))
|
||||||
self.last_message = time.time()
|
self.last_message = time.time()
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print 'ERROR parsing PyON message: %s: %s' % (
|
print ('ERROR parsing PyON message: %s: %s'
|
||||||
str(e), data.encode('string_escape'))
|
% (str(e), data.encode('string_escape')))
|
||||||
|
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
|
@ -214,8 +214,7 @@ class Connection:
|
||||||
|
|
||||||
if len(tokens) < 3:
|
if len(tokens) < 3:
|
||||||
self.readBuf = self.readBuf[eol:]
|
self.readBuf = self.readBuf[eol:]
|
||||||
raise Exception, 'Invalid PyON line: ' + \
|
raise Exception('Invalid PyON line: ' + line.encode('string_escape'))
|
||||||
line.encode('string_escape')
|
|
||||||
|
|
||||||
version = int(tokens[1])
|
version = int(tokens[1])
|
||||||
type = tokens[2]
|
type = tokens[2]
|
||||||
|
@ -248,21 +247,20 @@ class Connection:
|
||||||
while self.parse(): continue
|
while self.parse(): continue
|
||||||
|
|
||||||
# Handle special case for OSX disconnect
|
# Handle special case for OSX disconnect
|
||||||
except socket.error, e:
|
except socket.error as e:
|
||||||
if sys.platform == 'darwin' and e.errno == errno.EPIPE:
|
if sys.platform == 'darwin' and e.errno == errno.EPIPE:
|
||||||
self.fail_reason = 'refused'
|
self.fail_reason = 'refused'
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
else: raise
|
else: raise
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print 'ERROR on connection to %s:%d: %s' % (
|
print ('ERROR on connection to %s:%d: %s' % (self.address, self.port, e))
|
||||||
self.address, self.port, e)
|
|
||||||
|
|
||||||
# Timeout connection
|
# Timeout connection
|
||||||
if self.connected and self.last_message and \
|
if self.connected and self.last_message and \
|
||||||
self.last_message + 10 < time.time():
|
self.last_message + 10 < time.time():
|
||||||
print 'Connection timed out'
|
print ('Connection timed out')
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,7 +275,7 @@ if __name__ == '__main__':
|
||||||
conn.update()
|
conn.update()
|
||||||
|
|
||||||
for version, type, data in conn.messages:
|
for version, type, data in conn.messages:
|
||||||
print 'PyON %d %s:\n' % (version, type), data
|
print ('PyON %d %s:\n' % (version, type), data)
|
||||||
conn.messages = []
|
conn.messages = []
|
||||||
|
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import time
|
||||||
import re
|
import re
|
||||||
import traceback
|
import traceback
|
||||||
import platform
|
import platform
|
||||||
|
@ -75,8 +75,8 @@ def osx_version():
|
||||||
if sys.platform != 'darwin': return None
|
if sys.platform != 'darwin': return None
|
||||||
try:
|
try:
|
||||||
ver = tuple([int(x) for x in platform.mac_ver()[0].split('.')])
|
ver = tuple([int(x) for x in platform.mac_ver()[0].split('.')])
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e
|
print (e)
|
||||||
darwin_ver = platform.release().split('.')
|
darwin_ver = platform.release().split('.')
|
||||||
ver = (10, int(darwin_ver[0]) - 4, int(darwin_ver[1]))
|
ver = (10, int(darwin_ver[0]) - 4, int(darwin_ver[1]))
|
||||||
return ver
|
return ver
|
||||||
|
@ -100,7 +100,8 @@ def osx_add_GtkApplicationDelegate_methods():
|
||||||
applicationShouldHandleReopen_hasVisibleWindows_,
|
applicationShouldHandleReopen_hasVisibleWindows_,
|
||||||
signature = sig1)
|
signature = sig1)
|
||||||
])
|
])
|
||||||
except Exception, e: print e
|
except Exception as e:
|
||||||
|
print (e)
|
||||||
|
|
||||||
|
|
||||||
def osx_accel_window_close(accel_group, acceleratable, keyval, modifier):
|
def osx_accel_window_close(accel_group, acceleratable, keyval, modifier):
|
||||||
|
@ -170,8 +171,8 @@ class FAHControl(SingleAppServer):
|
||||||
try:
|
try:
|
||||||
self.db = load_fahcontrol_db()
|
self.db = load_fahcontrol_db()
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e
|
print (e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# OSX integration
|
# OSX integration
|
||||||
|
@ -537,7 +538,8 @@ class FAHControl(SingleAppServer):
|
||||||
ag.connect_group(key, mod, gtk.ACCEL_VISIBLE,
|
ag.connect_group(key, mod, gtk.ACCEL_VISIBLE,
|
||||||
osx_accel_window_minimize)
|
osx_accel_window_minimize)
|
||||||
self.window.add_accel_group(ag)
|
self.window.add_accel_group(ag)
|
||||||
except Exception, e: print e
|
except Exception as e:
|
||||||
|
print (e)
|
||||||
|
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
||||||
|
@ -600,8 +602,8 @@ class FAHControl(SingleAppServer):
|
||||||
cmd = ['/usr/bin/osascript', '-e', 'tell app "FAHControl" to reopen']
|
cmd = ['/usr/bin/osascript', '-e', 'tell app "FAHControl" to reopen']
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(cmd)
|
subprocess.Popen(cmd)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e, ':', ' '.join(cmd)
|
print (e, ':', ' '.join(cmd))
|
||||||
|
|
||||||
|
|
||||||
def connect_option_cell(self, name, model, col):
|
def connect_option_cell(self, name, model, col):
|
||||||
|
@ -706,7 +708,8 @@ class FAHControl(SingleAppServer):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.db.flush_queued()
|
self.db.flush_queued()
|
||||||
except Exception, e: print e
|
except Exception as e:
|
||||||
|
print (e)
|
||||||
|
|
||||||
sys.exit(0) # Force shutdown
|
sys.exit(0) # Force shutdown
|
||||||
|
|
||||||
|
@ -738,7 +741,7 @@ class FAHControl(SingleAppServer):
|
||||||
def load_theme(self, theme):
|
def load_theme(self, theme):
|
||||||
for name, rc in self.theme_list:
|
for name, rc in self.theme_list:
|
||||||
if theme == name:
|
if theme == name:
|
||||||
print 'Loading theme', theme
|
print ('Loading theme %r' % theme)
|
||||||
|
|
||||||
settings = gtk.settings_get_default()
|
settings = gtk.settings_get_default()
|
||||||
|
|
||||||
|
@ -841,7 +844,7 @@ class FAHControl(SingleAppServer):
|
||||||
elif name == 'team_stats': value = ''
|
elif name == 'team_stats': value = ''
|
||||||
elif name == 'donor_stats_link': value = 'Folding@home'
|
elif name == 'donor_stats_link': value = 'Folding@home'
|
||||||
elif name == 'team_stats_link': value = 'Folding@home'
|
elif name == 'team_stats_link': value = 'Folding@home'
|
||||||
else: raise Exception, 'Unknown preference widget "%s"' % name
|
else: raise Exception('Unknown preference widget "%s"' % name)
|
||||||
|
|
||||||
if value is not None: set_widget_str_value(widget, value)
|
if value is not None: set_widget_str_value(widget, value)
|
||||||
|
|
||||||
|
@ -946,7 +949,8 @@ class FAHControl(SingleAppServer):
|
||||||
self.client_list.set(iter, i, row[i])
|
self.client_list.set(iter, i, row[i])
|
||||||
self.client_list.row_changed(path, iter)
|
self.client_list.row_changed(path, iter)
|
||||||
iter = self.client_list.iter_next(iter)
|
iter = self.client_list.iter_next(iter)
|
||||||
except Exception, e: print e
|
except Exception as e:
|
||||||
|
print (e)
|
||||||
return False # no timer repeat
|
return False # no timer repeat
|
||||||
|
|
||||||
|
|
||||||
|
@ -964,7 +968,7 @@ class FAHControl(SingleAppServer):
|
||||||
name = client.name
|
name = client.name
|
||||||
i = ibyname_old.get(name)
|
i = ibyname_old.get(name)
|
||||||
if i is None:
|
if i is None:
|
||||||
print 'unable to resort client list: unknown name %s' % name
|
print ('unable to resort client list: unknown name %s' % name)
|
||||||
return
|
return
|
||||||
new_order.append(i)
|
new_order.append(i)
|
||||||
self.client_list.reorder(new_order)
|
self.client_list.reorder(new_order)
|
||||||
|
@ -1239,7 +1243,7 @@ class FAHControl(SingleAppServer):
|
||||||
|
|
||||||
# log to terminal window
|
# log to terminal window
|
||||||
if sys.exc_info()[2]: traceback.print_exc()
|
if sys.exc_info()[2]: traceback.print_exc()
|
||||||
print 'ERROR:', message
|
print ('ERROR: %s' % message)
|
||||||
|
|
||||||
# Don't open more than one
|
# Don't open more than one
|
||||||
if self.error_dialog is not None: return False
|
if self.error_dialog is not None: return False
|
||||||
|
@ -1346,7 +1350,7 @@ class FAHControl(SingleAppServer):
|
||||||
if slot is not None: cmd.append('--slot=%d' % slot.id)
|
if slot is not None: cmd.append('--slot=%d' % slot.id)
|
||||||
|
|
||||||
debug = True
|
debug = True
|
||||||
if debug: print cmd
|
if debug: print (cmd)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
|
@ -1354,7 +1358,7 @@ class FAHControl(SingleAppServer):
|
||||||
bufsize = 4096, stderr=subprocess.PIPE)
|
bufsize = 4096, stderr=subprocess.PIPE)
|
||||||
else:
|
else:
|
||||||
self.viewer = subprocess.Popen(cmd, cwd = get_home_dir())
|
self.viewer = subprocess.Popen(cmd, cwd = get_home_dir())
|
||||||
except Exception, e:
|
except Exception:
|
||||||
self.error('Failed to launch viewer with command:\n\n' +
|
self.error('Failed to launch viewer with command:\n\n' +
|
||||||
' '.join(cmd))
|
' '.join(cmd))
|
||||||
|
|
||||||
|
@ -1388,7 +1392,7 @@ class FAHControl(SingleAppServer):
|
||||||
def on_window_is_active(self, window, *args):
|
def on_window_is_active(self, window, *args):
|
||||||
try:
|
try:
|
||||||
if window.is_active(): self.update_client_list()
|
if window.is_active(): self.update_client_list()
|
||||||
except Exception, e: print e
|
except Exception as e: print (e)
|
||||||
|
|
||||||
|
|
||||||
# Preferences signals
|
# Preferences signals
|
||||||
|
|
|
@ -70,7 +70,7 @@ class SingleAppServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
|
||||||
sock.connect(single_app_addr)
|
sock.connect(single_app_addr)
|
||||||
sock.send('PING')
|
sock.send('PING')
|
||||||
if sock.recv(1024).strip() == 'OK':
|
if sock.recv(1024).strip() == 'OK':
|
||||||
print 'Already running'
|
print ('Already running')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
except socket.error:
|
except socket.error:
|
||||||
|
|
|
@ -113,7 +113,7 @@ def get_widget_str_value(widget):
|
||||||
return widget.get_active_text()
|
return widget.get_active_text()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print 'ERROR: unsupported widget type %s' % type(widget)
|
print ('ERROR: unsupported widget type %s' % type(widget))
|
||||||
|
|
||||||
|
|
||||||
def set_widget_str_value(widget, value):
|
def set_widget_str_value(widget, value):
|
||||||
|
@ -147,7 +147,7 @@ def set_widget_str_value(widget, value):
|
||||||
widget.set_active(i)
|
widget.set_active(i)
|
||||||
return
|
return
|
||||||
|
|
||||||
print 'ERROR: Invalid value "%s"' % value
|
print ('ERROR: Invalid value "%s"' % value)
|
||||||
|
|
||||||
elif isinstance(widget, gtk.ProgressBar):
|
elif isinstance(widget, gtk.ProgressBar):
|
||||||
widget.set_text(value)
|
widget.set_text(value)
|
||||||
|
@ -160,7 +160,7 @@ def set_widget_str_value(widget, value):
|
||||||
widget.set_fraction(fraction)
|
widget.set_fraction(fraction)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print 'ERROR: unsupported option widget type %s' % type(widget)
|
print ('ERROR: unsupported option widget type %s' % type(widget))
|
||||||
|
|
||||||
|
|
||||||
def set_widget_change_action(widget, action):
|
def set_widget_change_action(widget, action):
|
||||||
|
@ -180,7 +180,7 @@ def set_widget_change_action(widget, action):
|
||||||
widget.connect('rows_reordered', action)
|
widget.connect('rows_reordered', action)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print 'ERROR: unsupported option widget type %s' % type(widget)
|
print ('ERROR: unsupported option widget type %s' % type(widget))
|
||||||
|
|
||||||
|
|
||||||
def get_home_dir():
|
def get_home_dir():
|
||||||
|
|
Loading…
Reference in New Issue