Remove dependency on "with" - works with python 2.5

master
kliment 2011-06-09 19:03:57 +02:00
parent cee3698530
commit 80b222902b
2 changed files with 10 additions and 9 deletions

View File

@ -180,10 +180,11 @@ class pronsole(cmd.Cmd):
def preloop(self):
self.processing_rc=True
try:
with open(os.path.join(os.path.expanduser("~"),".pronsolerc")) as rc:
for rc_cmd in rc:
if not rc_cmd.lstrip().startswith("#"):
self.onecmd(rc_cmd)
rc=open(os.path.join(os.path.expanduser("~"),".pronsolerc"))
for rc_cmd in rc:
if not rc_cmd.lstrip().startswith("#"):
self.onecmd(rc_cmd)
rc.close()
except IOError:
pass
self.processing_rc=False
@ -768,8 +769,8 @@ class pronsole(cmd.Cmd):
print "Skeinforge not found. \nPlease copy Skeinforge into a directory named \"skeinforge\" in the same directory as this file."
return
if not os.path.exists("skeinforge/__init__.py"):
with open("skeinforge/__init__.py","w"):
pass
f=open("skeinforge/__init__.py","w")
f.close()
try:
from skeinforge.skeinforge_application.skeinforge_utilities import skeinforge_craft
from skeinforge.skeinforge_application import skeinforge

View File

@ -218,7 +218,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.logbox.SetEditable(0)
self.sendbtn=wx.Button(self.panel,-1,"Send",pos=(700,420))
self.sendbtn.Bind(wx.EVT_BUTTON,self.sendline)
self.monitorbox=wx.CheckBox(self.panel,-1,"Monitor printer",pos=(500,40))
self.monitorbox=wx.CheckBox(self.panel,-1,"Monitor\nprinter",pos=(450,37))
self.monitorbox.Bind(wx.EVT_CHECKBOX,self.setmonitor)
self.status=self.CreateStatusBar()
self.status.SetStatusText("Not connected to printer.")
@ -462,8 +462,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
print "Skeinforge not found. \nPlease copy Skeinforge into a directory named \"skeinforge\" in the same directory as this file."
return
if not os.path.exists("skeinforge/__init__.py"):
with open("skeinforge/__init__.py","w"):
pass
f=open("skeinforge/__init__.py","w")
f.close()
self.cout=StringIO.StringIO()
self.filename=filename
self.stopsf=0