[thorstenp] replace file with open
This commit is contained in:
parent
567f1e17c1
commit
ba12a63d55
|
@ -88,7 +88,7 @@ def force(func):
|
|||
|
||||
|
||||
def writeScript(filename, contents):
|
||||
script = file(filename, "w+")
|
||||
script = open(filename, "w+")
|
||||
script.write(contents)
|
||||
script.close()
|
||||
system("chmod +x %s" % filename)
|
||||
|
@ -148,8 +148,8 @@ def setupPrep():
|
|||
copy("src/osx/prep_py2app.py", APP_RS)
|
||||
move("dist/Gajim.app/Contents/Resources/__boot__.py",
|
||||
"dist/Gajim.app/Contents/Resources/__boot__.py.org")
|
||||
new = file("dist/Gajim.app/Contents/Resources/__boot__.py", "w+")
|
||||
org = file("dist/Gajim.app/Contents/Resources/__boot__.py.org")
|
||||
new = open("dist/Gajim.app/Contents/Resources/__boot__.py", "w+")
|
||||
org = open("dist/Gajim.app/Contents/Resources/__boot__.py.org")
|
||||
for line in org:
|
||||
new.write(line)
|
||||
if (('site.addsitedir' in line) and ('Python' in line)):
|
||||
|
|
|
@ -157,7 +157,7 @@ def get_default_font():
|
|||
|
||||
if os.path.exists(xfce_config_file):
|
||||
try:
|
||||
for line in file(xfce_config_file):
|
||||
for line in open(xfce_config_file):
|
||||
if line.find('name="Gtk/FontName"') != -1:
|
||||
start = line.find('value="') + 7
|
||||
return line[start:line.find('"', start)].decode('utf-8')
|
||||
|
@ -167,7 +167,7 @@ def get_default_font():
|
|||
|
||||
elif os.path.exists(kde_config_file):
|
||||
try:
|
||||
for line in file(kde_config_file):
|
||||
for line in open(kde_config_file):
|
||||
if line.find('font=') == 0: # font=Verdana,9,other_numbers
|
||||
start = 5 # 5 is len('font=')
|
||||
line = line[start:]
|
||||
|
|
|
@ -20,7 +20,7 @@ _GTK_BASE = "/Library/Frameworks/GTK+.framework/Versions/Current"
|
|||
def readEnv():
|
||||
gajimpaths.add_from_root(u'dbus.env', u'dbus.env')
|
||||
try:
|
||||
dbus_env = file(gajimpaths[u'dbus.env'], "r")
|
||||
dbus_env = open(gajimpaths[u'dbus.env'], "r")
|
||||
except Exception:
|
||||
return False
|
||||
try:
|
||||
|
@ -64,7 +64,7 @@ def setEnv(env):
|
|||
def writeEnv(env):
|
||||
gajimpaths.add_from_root(u'dbus.env', u'dbus.env')
|
||||
try:
|
||||
dbus_env = file(gajimpaths[u'dbus.env'], "w+")
|
||||
dbus_env = open(gajimpaths[u'dbus.env'], "w+")
|
||||
dbus_env.write("DBUS_SESSION_BUS_ADDRESS=\"" + env[0] + "\"\n")
|
||||
dbus_env.write("DBUS_SESSION_BUS_PID=\"" + env[1] + "\"\n")
|
||||
dbus_env.close()
|
||||
|
|
|
@ -23,7 +23,7 @@ growler = None
|
|||
|
||||
def init():
|
||||
global growler, notifications
|
||||
icon = file(os.path.join(gajim.DATA_DIR, "pixmaps", "gajim.icns"), "r")
|
||||
icon = open(os.path.join(gajim.DATA_DIR, "pixmaps", "gajim.icns"), "r")
|
||||
growler = GrowlNotifier(applicationName = "Gajim",
|
||||
notifications = notifications,
|
||||
applicationIcon = icon.read(),
|
||||
|
@ -46,7 +46,7 @@ def notify(event_type, jid, account, msg_type, path_to_image, title, text):
|
|||
path_to_image = os.path.abspath(
|
||||
os.path.join(gajim.DATA_DIR, 'pixmaps', 'events',
|
||||
'chat_msg_recv.png')) # img to display
|
||||
icon = file(path_to_image, "r")
|
||||
icon = open(path_to_image, "r")
|
||||
context = [account, jid, msg_type]
|
||||
growler.notify(event_type, title, text, icon.read(), False, None,
|
||||
context)
|
||||
|
|
Loading…
Reference in New Issue