Simplify OS path setting

This commit is contained in:
Jon Tibble 2009-11-12 23:33:59 +00:00
parent 8da19172a7
commit 1c0a86b17f

View File

@ -23,7 +23,6 @@
############################################################################### ###############################################################################
import os import os
import string
import logging import logging
import cPickle import cPickle
import zipfile import zipfile
@ -460,7 +459,7 @@ class ServiceManager(QtGui.QWidget):
def onQuickSaveService(self): def onQuickSaveService(self):
self.onSaveService(True) self.onSaveService(True)
def onLoadService(self, lastService = False): def onLoadService(self, lastService=False):
""" """
Load an existing service from disk and rebuild the serviceitems. All Load an existing service from disk and rebuild the serviceitems. All
files retrieved from the zip file are placed in a temporary directory files retrieved from the zip file are placed in a temporary directory
@ -481,11 +480,8 @@ class ServiceManager(QtGui.QWidget):
try: try:
zip = zipfile.ZipFile(unicode(filename)) zip = zipfile.ZipFile(unicode(filename))
for file in zip.namelist(): for file in zip.namelist():
if os.name == u'nt': osfile = unicode(QtCore.QDir.toNativeSeparators(file))
winfile = string.replace(file, '/', os.path.sep) names = osfile.split(os.path.sep)
names = winfile.split(os.path.sep)
else:
names = file.split(os.path.sep)
file_to = os.path.join(self.servicePath, file_to = os.path.join(self.servicePath,
names[len(names) - 1]) names[len(names) - 1])
f = open(file_to, u'wb') f = open(file_to, u'wb')
@ -501,7 +497,7 @@ class ServiceManager(QtGui.QWidget):
for item in items: for item in items:
serviceitem = ServiceItem() serviceitem = ServiceItem()
serviceitem.RenderManager = self.parent.RenderManager serviceitem.RenderManager = self.parent.RenderManager
serviceitem.set_from_service(item, self.servicePath ) serviceitem.set_from_service(item, self.servicePath)
self.addServiceItem(serviceitem) self.addServiceItem(serviceitem)
try: try:
if os.path.isfile(p_file): if os.path.isfile(p_file):