summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-01-28 21:28:52 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-01-29 00:00:40 +0900
commitcf571297f52ad4a5e5843555d9c016d526f03c43 (patch)
tree7e9eb123a08b935d382ac194a9a1f9e666ee09ee
parent00acd92ff96bd6d3bb3136aa6d6b37314b3ad623 (diff)
downloadtde-guidance-cf571297.tar.gz
tde-guidance-cf571297.zip
Fix functionality with python 3.r14.1.0
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rwxr-xr-xmountconfig/MicroHAL.py8
-rwxr-xr-xmountconfig/mountconfig.py19
-rwxr-xr-xserviceconfig/serviceconfig.py6
-rwxr-xr-xwineconfig/wineconfig.py6
-rw-r--r--wineconfig/wineread.py22
-rw-r--r--wineconfig/winewrite.py10
6 files changed, 36 insertions, 35 deletions
diff --git a/mountconfig/MicroHAL.py b/mountconfig/MicroHAL.py
index 3d6fce5..07a3280 100755
--- a/mountconfig/MicroHAL.py
+++ b/mountconfig/MicroHAL.py
@@ -324,7 +324,7 @@ class MicroHAL__(object):
if proc not in self.getSupportedFileSystems():
# The filesystem is not supported by the running kernel,
# 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:
print(msg)
print("Couldn't load driver " + module + " for filesystem " + fs)
@@ -605,8 +605,8 @@ class MicroHAL(object):
if self.devices is None:
self.devices = []
- retval, msg = SimpleCommandRunner().run(["/usr/bin/lshal"])
- if retval > 0:
+ retval, msg = SimpleCommandRunner().run([b"/usr/bin/lshal"])
+ if retval is None or retval > 0:
return []
partition_to_uid = {}
@@ -817,7 +817,7 @@ class MicroHAL(object):
if proc not in self.getSupportedFileSystems():
# The filesystem is not supported by the running kernel,
# 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:
print(msg)
print("Couldn't load driver " + module + " for filesystem " + fs)
diff --git a/mountconfig/mountconfig.py b/mountconfig/mountconfig.py
index 3f6ced5..f377362 100755
--- a/mountconfig/mountconfig.py
+++ b/mountconfig/mountconfig.py
@@ -24,7 +24,6 @@ from tdeui import *
from tdecore import *
from tdefile import *
from tdeio import *
-from types import StringType,UnicodeType
import pwd
import grp
import math
@@ -123,7 +122,7 @@ class UserComboBox(KComboBox):
uid = int(user[2])
username = user[4]
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 = []
for user in tmplist:
self.insertItem(user[1])
@@ -152,7 +151,7 @@ class GroupComboBox(KComboBox):
gid = group[2]
groupname = group[0]
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 = []
for group in tmplist:
self.insertItem(group[1])
@@ -195,7 +194,7 @@ class MountEntryExt(object):
self.managed = False
self.device_string = ""
- elif isinstance(base,StringType) or isinstance(base,UnicodeType):
+ elif isinstance(base, str):
parts = base.split()
device_ref = MountEntry.decodeMountEntryString(parts[0])
@@ -495,7 +494,7 @@ class MountEntryExtCommonUnix(MountEntryExt):
self.allowsuid = base.allowsuid
self.allowusermount = base.allowusermount
- elif isinstance(base,StringType) or isinstance(base,UnicodeType):
+ elif isinstance(base, str):
options = self.extraoptions.split(",")
self.atime = True
@@ -652,7 +651,7 @@ class MountEntryExtAlien(MountEntryExt):
self.auto = base.auto
self.allowusermount = base.allowusermount
- elif isinstance(base,StringType) or isinstance(base,UnicodeType):
+ elif isinstance(base, str):
self.uid = 0
self.gid = 0
options = self.extraoptions.split(",")
@@ -753,7 +752,7 @@ class MountEntryExtVFAT(MountEntryExtAlien):
if isinstance(base,MountEntryExtVFAT):
self.suppresspermissionerrors = base.suppresspermissionerrors
- elif isinstance(base,StringType) or isinstance(base,UnicodeType):
+ elif isinstance(base, str):
options = self.extraoptions.split(",")
self.suppresspermissionerrors = "quiet" in options
try:
@@ -798,7 +797,7 @@ class MountEntryExtSMB(MountEntryExtAlien):
self.password = base.password
self.credentialsfile = base.credentialsfile
- elif isinstance(base,StringType) or isinstance(base,UnicodeType):
+ elif isinstance(base, str):
self.username = None
self.password = ""
self.credentialsfile = None
@@ -932,7 +931,7 @@ class MountEntryExtSwap(MountEntryExt):
def __init__(self,base=None):
super(MountEntryExtSwap,self).__init__(base)
- if isinstance(base,StringType) or isinstance(base,UnicodeType):
+ if isinstance(base, str):
options = self.extraoptions.split(",")
try:
options.remove('defaults')
@@ -1072,7 +1071,7 @@ class MountEntry(object):
self.extensionObjects = {}
if base==None:
self.mounttype = 'auto'
- elif isinstance(base,StringType) or isinstance(base,UnicodeType):
+ elif isinstance(base, str):
parts = base.split()
self.mounttype = parts[2]
# 'udf,iso9660' seems default for some devices in fstab,
diff --git a/serviceconfig/serviceconfig.py b/serviceconfig/serviceconfig.py
index 23c5c17..15fa559 100755
--- a/serviceconfig/serviceconfig.py
+++ b/serviceconfig/serviceconfig.py
@@ -1108,7 +1108,7 @@ class SysVInitApp(programbase):
def __selectFirstService(self):
# Grab the first service in the list and select it.
services = self.currentrunlevel.availableservices[:]
- services.sort(lambda x,y: cmp(x.filename,y.filename))
+ services.sort(key=lambda x: x.filename)
self.selectedservice = None
try:
self.selectedservice = services[0]
@@ -1145,7 +1145,7 @@ class SysVInitApp(programbase):
self.servicestolistitems = {}
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:
if item.isAvailableInRunlevel(runlevelobj):
@@ -1311,7 +1311,7 @@ class SysVInitApp(programbase):
dialog.showCancelButton(False)
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))
kapp.processEvents()
diff --git a/wineconfig/wineconfig.py b/wineconfig/wineconfig.py
index f5ab322..628f57d 100755
--- a/wineconfig/wineconfig.py
+++ b/wineconfig/wineconfig.py
@@ -430,8 +430,8 @@ class WineConfigApp(programbase):
if standalone:
self.enableButton(KDialogBase.User1,changed) # Reset button
self.enableButtonApply(changed) # Apply button
- else:
- self.emit(SIGNAL("changed(bool)"), (changed,) )
+ #else:
+ # self.emit(SIGNAL("changed(bool)"), (changed,) )
############################################################################
''' Not used.
@@ -1806,7 +1806,7 @@ class AppearancePage(TQWidget):
spacer = TQWidget(self.customcolorsvbox)
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)
bottomspacer = TQSpacerItem(51,160,TQSizePolicy.Minimum,TQSizePolicy.Expanding)
diff --git a/wineconfig/wineread.py b/wineconfig/wineread.py
index d334d7c..3a051d8 100644
--- a/wineconfig/wineread.py
+++ b/wineconfig/wineread.py
@@ -23,7 +23,7 @@ import os
# Assumes the fake windows is installed in ~/.wine
default_winepath = os.environ['HOME'] + "/.wine"
winepath = default_winepath
-defaultwinfolderspath = "c:\\windows\\profiles\\" + os.environ['USER']
+defaultwinfolderspath = "c:\\users\\" + os.environ['USER']
# Where the dll's are
default_winebuildpath = "/usr/lib/wine"
@@ -113,7 +113,7 @@ empty_shelllinks = ([26,"Desktop","","","",""],
[30,"My Video","","","",""])
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():
""" Returns a list of important windows folders """
@@ -159,7 +159,7 @@ def GetValue(key, value):
if error != 0:
return ""
- file=open('.registryvalue.reg')
+ file=open('.registryvalue.reg', encoding='utf-16', mode='r')
for line in file:
if line and line[0] == '"' or line[0] == '@':
@@ -188,7 +188,7 @@ def GetKeyValues(key):
settings = {}
- file=open('.registrykey.reg')
+ file=open('.registrykey.reg', encoding='utf-16', mode='r')
keycount = 0
for line in file:
@@ -210,7 +210,7 @@ def GetUserShellRegistry():
if error != 0:
return {}
- usershellfile=open('.registryshelluser.reg')
+ usershellfile=open('.registryshelluser.reg', encoding='utf-16', mode='r')
usershellfilelines = usershellfile.readlines()
usershellfile.close()
os.remove(".registryshelluser.reg")
@@ -221,7 +221,8 @@ def GetUserShellRegistry():
for usershellline in usershellfilelines:
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
@@ -230,7 +231,7 @@ def GetShellRegistry():
if error != 0:
return {}
- shellfile=open('.registryshell.reg')
+ shellfile=open('.registryshell.reg', encoding='utf-16', mode='r')
shellfilelines = shellfile.readlines()
shellfile.close()
os.remove(".registryshell.reg")
@@ -241,7 +242,8 @@ def GetShellRegistry():
for shellline in shellfilelines:
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
@@ -314,7 +316,7 @@ def GetApps():
if error != 0:
return []
- settingsfile=open('.registryapps.reg')
+ settingsfile=open('.registryapps.reg', encoding='utf-16', mode='r')
settingsfilelines = settingsfile.readlines()
settingsfile.close()
os.remove('.registryapps.reg')
@@ -537,7 +539,7 @@ def VerifyWineDrive(path = None):
if not path:
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 + "/system.reg") and os.path.exists(path + "/userdef.reg") and \
os.path.exists(path + "/user.reg")
diff --git a/wineconfig/winewrite.py b/wineconfig/winewrite.py
index b208e66..39f1ce3 100644
--- a/wineconfig/winewrite.py
+++ b/wineconfig/winewrite.py
@@ -60,14 +60,14 @@ def SetDriveMappings(drives):
SetShellLinks(drives[26:])
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)
shellregistry = wineread.GetShellRegistry()
for link in shelllinks:
createLink = False
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
# Compare for changes
changed = False
@@ -98,7 +98,7 @@ def SetShellLinks(shelllinks):
continue
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:
SetShellRegistry(link)
@@ -426,7 +426,7 @@ def CreateWineDrive(path = None):
if not path:
path = wineread.default_winepath
- os.system("WINEPREFIX=" + path + " wineprefixcreate --wait")
+ os.system("WINEPREFIX=" + path + " winepath --wait")
# ----- Theming -----
@@ -486,4 +486,4 @@ def CreatePorts(ports = None):
winport = ports_translation[port.rstrip("012345678")] +\
str(int(port.lstrip("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) + 1)
os.symlink("/dev/" + port, wineread.winepath + "/dosdevices/" + winport)
- \ No newline at end of file
+