Fix functionality with python 3.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/10/head r14.1.0
Michele Calgaro 1 year ago
parent 00acd92ff9
commit cf571297f5
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -324,7 +324,7 @@ class MicroHAL__(object):
if proc not in self.getSupportedFileSystems(): if proc not in self.getSupportedFileSystems():
# The filesystem is not supported by the running kernel, # The filesystem is not supported by the running kernel,
# but it might be built as module, so we try to load that. # but it might be built as module, so we try to load that.
retval, msg = SimpleCommandRunner().run(["/sbin/modprobe",module]) retval, msg = SimpleCommandRunner().run([b"/sbin/modprobe",module])
if retval > 0: if retval > 0:
print(msg) print(msg)
print("Couldn't load driver " + module + " for filesystem " + fs) print("Couldn't load driver " + module + " for filesystem " + fs)
@ -605,8 +605,8 @@ class MicroHAL(object):
if self.devices is None: if self.devices is None:
self.devices = [] self.devices = []
retval, msg = SimpleCommandRunner().run(["/usr/bin/lshal"]) retval, msg = SimpleCommandRunner().run([b"/usr/bin/lshal"])
if retval > 0: if retval is None or retval > 0:
return [] return []
partition_to_uid = {} partition_to_uid = {}
@ -817,7 +817,7 @@ class MicroHAL(object):
if proc not in self.getSupportedFileSystems(): if proc not in self.getSupportedFileSystems():
# The filesystem is not supported by the running kernel, # The filesystem is not supported by the running kernel,
# but it might be built as module, so we try to load that. # but it might be built as module, so we try to load that.
retval, msg = SimpleCommandRunner().run(["/sbin/modprobe",module]) retval, msg = SimpleCommandRunner().run([b"/sbin/modprobe",module])
if retval > 0: if retval > 0:
print(msg) print(msg)
print("Couldn't load driver " + module + " for filesystem " + fs) print("Couldn't load driver " + module + " for filesystem " + fs)

@ -24,7 +24,6 @@ from tdeui import *
from tdecore import * from tdecore import *
from tdefile import * from tdefile import *
from tdeio import * from tdeio import *
from types import StringType,UnicodeType
import pwd import pwd
import grp import grp
import math import math
@ -123,7 +122,7 @@ class UserComboBox(KComboBox):
uid = int(user[2]) uid = int(user[2])
username = user[4] username = user[4]
tmplist.append( (int(uid),"%s (%s)" % (username,uid)) ) tmplist.append( (int(uid),"%s (%s)" % (username,uid)) )
tmplist.sort(lambda a,b: cmp(a[1],b[1])) tmplist.sort(key=lambda a: a[1])
self.userlist = [] self.userlist = []
for user in tmplist: for user in tmplist:
self.insertItem(user[1]) self.insertItem(user[1])
@ -152,7 +151,7 @@ class GroupComboBox(KComboBox):
gid = group[2] gid = group[2]
groupname = group[0] groupname = group[0]
tmplist.append( (int(gid),"%s (%s)" % (groupname,gid)) ) tmplist.append( (int(gid),"%s (%s)" % (groupname,gid)) )
tmplist.sort(lambda a,b: cmp(a[1],b[1])) tmplist.sort(key=lambda a: a[1])
self.grouplist = [] self.grouplist = []
for group in tmplist: for group in tmplist:
self.insertItem(group[1]) self.insertItem(group[1])
@ -195,7 +194,7 @@ class MountEntryExt(object):
self.managed = False self.managed = False
self.device_string = "" self.device_string = ""
elif isinstance(base,StringType) or isinstance(base,UnicodeType): elif isinstance(base, str):
parts = base.split() parts = base.split()
device_ref = MountEntry.decodeMountEntryString(parts[0]) device_ref = MountEntry.decodeMountEntryString(parts[0])
@ -495,7 +494,7 @@ class MountEntryExtCommonUnix(MountEntryExt):
self.allowsuid = base.allowsuid self.allowsuid = base.allowsuid
self.allowusermount = base.allowusermount self.allowusermount = base.allowusermount
elif isinstance(base,StringType) or isinstance(base,UnicodeType): elif isinstance(base, str):
options = self.extraoptions.split(",") options = self.extraoptions.split(",")
self.atime = True self.atime = True
@ -652,7 +651,7 @@ class MountEntryExtAlien(MountEntryExt):
self.auto = base.auto self.auto = base.auto
self.allowusermount = base.allowusermount self.allowusermount = base.allowusermount
elif isinstance(base,StringType) or isinstance(base,UnicodeType): elif isinstance(base, str):
self.uid = 0 self.uid = 0
self.gid = 0 self.gid = 0
options = self.extraoptions.split(",") options = self.extraoptions.split(",")
@ -753,7 +752,7 @@ class MountEntryExtVFAT(MountEntryExtAlien):
if isinstance(base,MountEntryExtVFAT): if isinstance(base,MountEntryExtVFAT):
self.suppresspermissionerrors = base.suppresspermissionerrors self.suppresspermissionerrors = base.suppresspermissionerrors
elif isinstance(base,StringType) or isinstance(base,UnicodeType): elif isinstance(base, str):
options = self.extraoptions.split(",") options = self.extraoptions.split(",")
self.suppresspermissionerrors = "quiet" in options self.suppresspermissionerrors = "quiet" in options
try: try:
@ -798,7 +797,7 @@ class MountEntryExtSMB(MountEntryExtAlien):
self.password = base.password self.password = base.password
self.credentialsfile = base.credentialsfile self.credentialsfile = base.credentialsfile
elif isinstance(base,StringType) or isinstance(base,UnicodeType): elif isinstance(base, str):
self.username = None self.username = None
self.password = "" self.password = ""
self.credentialsfile = None self.credentialsfile = None
@ -932,7 +931,7 @@ class MountEntryExtSwap(MountEntryExt):
def __init__(self,base=None): def __init__(self,base=None):
super(MountEntryExtSwap,self).__init__(base) super(MountEntryExtSwap,self).__init__(base)
if isinstance(base,StringType) or isinstance(base,UnicodeType): if isinstance(base, str):
options = self.extraoptions.split(",") options = self.extraoptions.split(",")
try: try:
options.remove('defaults') options.remove('defaults')
@ -1072,7 +1071,7 @@ class MountEntry(object):
self.extensionObjects = {} self.extensionObjects = {}
if base==None: if base==None:
self.mounttype = 'auto' self.mounttype = 'auto'
elif isinstance(base,StringType) or isinstance(base,UnicodeType): elif isinstance(base, str):
parts = base.split() parts = base.split()
self.mounttype = parts[2] self.mounttype = parts[2]
# 'udf,iso9660' seems default for some devices in fstab, # 'udf,iso9660' seems default for some devices in fstab,

@ -1108,7 +1108,7 @@ class SysVInitApp(programbase):
def __selectFirstService(self): def __selectFirstService(self):
# Grab the first service in the list and select it. # Grab the first service in the list and select it.
services = self.currentrunlevel.availableservices[:] services = self.currentrunlevel.availableservices[:]
services.sort(lambda x,y: cmp(x.filename,y.filename)) services.sort(key=lambda x: x.filename)
self.selectedservice = None self.selectedservice = None
try: try:
self.selectedservice = services[0] self.selectedservice = services[0]
@ -1145,7 +1145,7 @@ class SysVInitApp(programbase):
self.servicestolistitems = {} self.servicestolistitems = {}
services = self.currentrunlevel.availableservices[:] services = self.currentrunlevel.availableservices[:]
services.sort(lambda x,y: cmp(x.filename,y.filename)) services.sort(key=lambda x: x.filename)
for item in services: for item in services:
if item.isAvailableInRunlevel(runlevelobj): if item.isAvailableInRunlevel(runlevelobj):
@ -1311,7 +1311,7 @@ class SysVInitApp(programbase):
dialog.showCancelButton(False) dialog.showCancelButton(False)
services = self.currentrunlevel.availableservices[:] services = self.currentrunlevel.availableservices[:]
services.sort(lambda x,y: cmp(x.filename,y.filename)) services.sort(key=lambda x: x.filename)
dialog.progressBar().setTotalSteps(len(services)) dialog.progressBar().setTotalSteps(len(services))
kapp.processEvents() kapp.processEvents()

@ -430,8 +430,8 @@ class WineConfigApp(programbase):
if standalone: if standalone:
self.enableButton(KDialogBase.User1,changed) # Reset button self.enableButton(KDialogBase.User1,changed) # Reset button
self.enableButtonApply(changed) # Apply button self.enableButtonApply(changed) # Apply button
else: #else:
self.emit(SIGNAL("changed(bool)"), (changed,) ) # self.emit(SIGNAL("changed(bool)"), (changed,) )
############################################################################ ############################################################################
''' Not used. ''' Not used.
@ -1806,7 +1806,7 @@ class AppearancePage(TQWidget):
spacer = TQWidget(self.customcolorsvbox) spacer = TQWidget(self.customcolorsvbox)
self.customcolorsvbox.setStretchFactor(spacer,1) self.customcolorsvbox.setStretchFactor(spacer,1)
self.customcolorsvbox.setMinimumHeight(itemtext.height()*4.5) self.customcolorsvbox.setMinimumHeight(int(itemtext.height()*4.5))
#self.customcolorsvbox.setStretchFactor(self.customcolorsgrid,1) #self.customcolorsvbox.setStretchFactor(self.customcolorsgrid,1)
bottomspacer = TQSpacerItem(51,160,TQSizePolicy.Minimum,TQSizePolicy.Expanding) bottomspacer = TQSpacerItem(51,160,TQSizePolicy.Minimum,TQSizePolicy.Expanding)

@ -23,7 +23,7 @@ import os
# Assumes the fake windows is installed in ~/.wine # Assumes the fake windows is installed in ~/.wine
default_winepath = os.environ['HOME'] + "/.wine" default_winepath = os.environ['HOME'] + "/.wine"
winepath = default_winepath winepath = default_winepath
defaultwinfolderspath = "c:\\windows\\profiles\\" + os.environ['USER'] defaultwinfolderspath = "c:\\users\\" + os.environ['USER']
# Where the dll's are # Where the dll's are
default_winebuildpath = "/usr/lib/wine" default_winebuildpath = "/usr/lib/wine"
@ -113,7 +113,7 @@ empty_shelllinks = ([26,"Desktop","","","",""],
[30,"My Video","","","",""]) [30,"My Video","","","",""])
folder_nonexistent = "This folder does not exist, please map it." folder_nonexistent = "This folder does not exist, please map it."
profilesdirectory = winepath + "/dosdevices/c:/windows/profiles/" + os.environ['USER'] profilesdirectory = winepath + "/dosdevices/c:/users/" + os.environ['USER']
def GetEmptyShellLinks(): def GetEmptyShellLinks():
""" Returns a list of important windows folders """ """ Returns a list of important windows folders """
@ -159,7 +159,7 @@ def GetValue(key, value):
if error != 0: if error != 0:
return "" return ""
file=open('.registryvalue.reg') file=open('.registryvalue.reg', encoding='utf-16', mode='r')
for line in file: for line in file:
if line and line[0] == '"' or line[0] == '@': if line and line[0] == '"' or line[0] == '@':
@ -188,7 +188,7 @@ def GetKeyValues(key):
settings = {} settings = {}
file=open('.registrykey.reg') file=open('.registrykey.reg', encoding='utf-16', mode='r')
keycount = 0 keycount = 0
for line in file: for line in file:
@ -210,7 +210,7 @@ def GetUserShellRegistry():
if error != 0: if error != 0:
return {} return {}
usershellfile=open('.registryshelluser.reg') usershellfile=open('.registryshelluser.reg', encoding='utf-16', mode='r')
usershellfilelines = usershellfile.readlines() usershellfilelines = usershellfile.readlines()
usershellfile.close() usershellfile.close()
os.remove(".registryshelluser.reg") os.remove(".registryshelluser.reg")
@ -221,7 +221,8 @@ def GetUserShellRegistry():
for usershellline in usershellfilelines: for usershellline in usershellfilelines:
usershellline = usershellline.split('=') usershellline = usershellline.split('=')
settings[usershellline[0].strip('"')] = usershellline[1].strip('"\r\n') if len(usershellline) == 2:
settings[usershellline[0].strip('"')] = usershellline[1].strip('"\r\n')
return settings return settings
@ -230,7 +231,7 @@ def GetShellRegistry():
if error != 0: if error != 0:
return {} return {}
shellfile=open('.registryshell.reg') shellfile=open('.registryshell.reg', encoding='utf-16', mode='r')
shellfilelines = shellfile.readlines() shellfilelines = shellfile.readlines()
shellfile.close() shellfile.close()
os.remove(".registryshell.reg") os.remove(".registryshell.reg")
@ -241,7 +242,8 @@ def GetShellRegistry():
for shellline in shellfilelines: for shellline in shellfilelines:
shellline = shellline.split('=') shellline = shellline.split('=')
settings[shellline[0].strip('"')] = shellline[1].strip('"\r\n') if len(shellline) == 2:
settings[shellline[0].strip('"')] = shellline[1].strip('"\r\n')
return settings return settings
@ -314,7 +316,7 @@ def GetApps():
if error != 0: if error != 0:
return [] return []
settingsfile=open('.registryapps.reg') settingsfile=open('.registryapps.reg', encoding='utf-16', mode='r')
settingsfilelines = settingsfile.readlines() settingsfilelines = settingsfile.readlines()
settingsfile.close() settingsfile.close()
os.remove('.registryapps.reg') os.remove('.registryapps.reg')
@ -537,7 +539,7 @@ def VerifyWineDrive(path = None):
if not path: if not path:
path = self.default_winepath path = self.default_winepath
return os.path.exists(path + "/dosdevices/c:/windows/profiles/" + os.environ['USER']) and \ return os.path.exists(path + "/dosdevices/c:/users/" + os.environ['USER']) and \
os.path.exists(path + "/dosdevices/c:/windows/system32") and \ os.path.exists(path + "/dosdevices/c:/windows/system32") and \
os.path.exists(path + "/system.reg") and os.path.exists(path + "/userdef.reg") and \ os.path.exists(path + "/system.reg") and os.path.exists(path + "/userdef.reg") and \
os.path.exists(path + "/user.reg") os.path.exists(path + "/user.reg")

@ -60,14 +60,14 @@ def SetDriveMappings(drives):
SetShellLinks(drives[26:]) SetShellLinks(drives[26:])
def SetShellLinks(shelllinks): def SetShellLinks(shelllinks):
existingshelllinks = os.listdir(wineread.winepath + "/dosdevices/c:/windows/profiles/" + os.environ['USER']) existingshelllinks = os.listdir(wineread.winepath + "/dosdevices/c:/users/" + os.environ['USER'])
set(existingshelllinks) set(existingshelllinks)
shellregistry = wineread.GetShellRegistry() shellregistry = wineread.GetShellRegistry()
for link in shelllinks: for link in shelllinks:
createLink = False createLink = False
if link[1] in existingshelllinks: # The link exists if link[1] in existingshelllinks: # The link exists
linkpath = wineread.winepath + "/dosdevices/c:/windows/profiles/" + os.environ['USER'] + "/" + link[1] linkpath = wineread.winepath + "/dosdevices/c:/users/" + os.environ['USER'] + "/" + link[1]
if link[2]: # The folder is mapped if link[2]: # The folder is mapped
# Compare for changes # Compare for changes
changed = False changed = False
@ -98,7 +98,7 @@ def SetShellLinks(shelllinks):
continue continue
if createLink: if createLink:
os.symlink(link[2], wineread.winepath + "/dosdevices/c:/windows/profiles/" + os.environ['USER'] + "/" + link[1]) os.symlink(link[2], wineread.winepath + "/dosdevices/c:/users/" + os.environ['USER'] + "/" + link[1])
if link[1] in shellregistry: if link[1] in shellregistry:
SetShellRegistry(link) SetShellRegistry(link)
@ -426,7 +426,7 @@ def CreateWineDrive(path = None):
if not path: if not path:
path = wineread.default_winepath path = wineread.default_winepath
os.system("WINEPREFIX=" + path + " wineprefixcreate --wait") os.system("WINEPREFIX=" + path + " winepath --wait")
# ----- Theming ----- # ----- Theming -----
@ -486,4 +486,4 @@ def CreatePorts(ports = None):
winport = ports_translation[port.rstrip("012345678")] +\ winport = ports_translation[port.rstrip("012345678")] +\
str(int(port.lstrip("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) + 1) str(int(port.lstrip("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) + 1)
os.symlink("/dev/" + port, wineread.winepath + "/dosdevices/" + winport) os.symlink("/dev/" + port, wineread.winepath + "/dosdevices/" + winport)

Loading…
Cancel
Save