summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--grubconfig/grubconfig.py48
-rwxr-xr-xmodules/xf86misc.py44
-rwxr-xr-xmountconfig/MicroHAL.py76
-rw-r--r--mountconfig/SMBShareSelectDialog.py20
-rw-r--r--mountconfig/SimpleCommandRunner.py8
-rw-r--r--mountconfig/fuser.py28
-rwxr-xr-xmountconfig/mountconfig.py152
-rw-r--r--mountconfig/sizeview.py15
-rwxr-xr-xserviceconfig/serviceconfig.py78
-rw-r--r--uninstall_rude.py2
-rwxr-xr-xuserconfig/unixauthdb.py198
-rwxr-xr-xuserconfig/userconfig.py246
-rwxr-xr-xwineconfig/firstrunwizard.py2
-rw-r--r--wineconfig/kcm_wineconfig.cpp2
-rwxr-xr-xwineconfig/wineconfig.py290
-rw-r--r--wineconfig/wineread.py2
-rw-r--r--wineconfig/winewrite.py6
17 files changed, 609 insertions, 608 deletions
diff --git a/grubconfig/grubconfig.py b/grubconfig/grubconfig.py
index 8cf8ff2..d9d24a4 100644
--- a/grubconfig/grubconfig.py
+++ b/grubconfig/grubconfig.py
@@ -75,8 +75,8 @@ class GrubConfigAppClass(programbase):
#--- Load menu.lst using the load_menulst() method
self.load_menulst()
- print self.globalvars
- print self.itemslist
+ print(self.globalvars)
+ print(self.itemslist)
# - GRUB Options Tab -
if standalone:
@@ -273,12 +273,12 @@ class GrubConfigAppClass(programbase):
self.oslistview.setSelected(self.oslistviewitems[0],True)
ops_list = self.load_osprobe()
- print ops_list # mhb debug
+ print(ops_list) # mhb debug
#######################################################################
# reload listviews, because they have changed
def reloadListViews(self,name):
- print "reloaded"
+ print("reloaded")
# you should repaint the one that is not changed on screen
if name == "oslist":
self.oslistview.clear()
@@ -298,7 +298,7 @@ class GrubConfigAppClass(programbase):
for item in self.itemslist:
try:
if self.itemslist.index(item) == int(self.globalvars['default'][0]):
- print "bam!"
+ print("bam!")
self.itemslistviewitems.append(BoldListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0]))
else:
self.itemslistviewitems.append(TDEListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0]))
@@ -349,12 +349,12 @@ class GrubConfigAppClass(programbase):
self.customoptions.setText(customoptions[:-1])
self.updatingGUI = False
- print "oslistview item selected" #mhb debug
+ print("oslistview item selected") #mhb debug
pass
#######################################################################
def slotDisplayNameLabelChanged(self, string):
if(self.updatingGUI == False):
- print "display name changed" #mhb debug
+ print("display name changed") #mhb debug
i = self.oslistviewitems.index(self.oslistview.selectedItem())
self.itemslist[i]["title"][0] = string
self.oslistview.selectedItem().setText(0,string)
@@ -362,7 +362,7 @@ class GrubConfigAppClass(programbase):
pass
#######################################################################
def slotUpButtonClicked(self):
- print "UpButton clicked" #mhb debug
+ print("UpButton clicked") #mhb debug
i = self.itemslistviewitems.index(self.itemslistview.selectedItem())
self.itemslistview.selectedItem().itemAbove().moveItem(self.itemslistview.selectedItem())
# itemslist should have the same i for the same option
@@ -375,7 +375,7 @@ class GrubConfigAppClass(programbase):
#######################################################################
def slotDownButtonClicked(self):
- print "DownButton clicked" #mhb debug
+ print("DownButton clicked") #mhb debug
i = self.itemslistviewitems.index(self.itemslistview.selectedItem())
self.itemslistview.selectedItem().moveItem(self.itemslistview.selectedItem().itemBelow())
if(i != len(self.itemslist)-1):
@@ -387,7 +387,7 @@ class GrubConfigAppClass(programbase):
#######################################################################
def slotSetDefaultButtonClicked(self):
- print "SetDefaultButton cliicked" #mhb debug
+ print("SetDefaultButton cliicked") #mhb debug
try:
defaultn = int(self.globalvars["default"][0])
except ValueError:
@@ -419,7 +419,7 @@ class GrubConfigAppClass(programbase):
#self.__updateGroupList()
self.updatingGUI = False
programbase.exec_loop(self)
- print "done"
+ print("done")
#######################################################################
@@ -453,7 +453,7 @@ class GrubConfigAppClass(programbase):
for line in menufd:
# Checks if the first non-white char in a line is a #
if re.search(r'^(/s)*#',line) or re.search(r'^(/s)*$',line):
- print "a commented line" # mhb debug
+ print("a commented line") # mhb debug
if itemlock == 1:
itemlock = 0
currentitem += 1
@@ -499,7 +499,7 @@ class GrubConfigAppClass(programbase):
pass
# okay, it's not commented
else:
- print "a not commented line" # mhb debug
+ print("a not commented line") # mhb debug
self.modifiedlines.append(linenum)
# we presume the first character is already a name
var_name = line.split()[0]
@@ -509,7 +509,7 @@ class GrubConfigAppClass(programbase):
if var_name in parsable:
# cat 0 - a title - triggers itemlock, has a name and a value, which should be stored as text
if var_name == "title":
- print line.split(None,1)
+ print(line.split(None,1))
var_value.append(line.split(None,1)[1][:-1])
itemlock = 1
self.itemslist.append({})
@@ -561,7 +561,7 @@ class GrubConfigAppClass(programbase):
#print "it has no value" # mhb debug
# print "parsed another line" # mhb debug
linenum += 1;
- print "load_menulst() called" # mhb debug
+ print("load_menulst() called") # mhb debug
return "not working yet"
#######################################################################
@@ -576,7 +576,7 @@ class GrubConfigAppClass(programbase):
# 2. writing the lines in another list (or something more efficient
output = {}
# the globals first
- for unit, value in self.globalvars.items():
+ for unit, value in list(self.globalvars.items()):
lines.append(value[-1])
temp_str=""
temp_str+=(str(unit)+" ")
@@ -586,7 +586,7 @@ class GrubConfigAppClass(programbase):
# itemslist next (abattoir)
for item in self.itemslist:
- for unit, value in reversed(item.items()):
+ for unit, value in reversed(list(item.items())):
lines.append(value[-1])
temp_str=""
temp_str+=(str(unit)+" ")
@@ -605,8 +605,8 @@ class GrubConfigAppClass(programbase):
# read the menu.lst again (or rather its copy, to prevent the file being changed)
# line by line write it in the output file (to be exact, to a file in /tmp)
linenum = 0
- print linecontent
- print lines
+ print(linecontent)
+ print(lines)
# foreach file as line:
for originalline in trfile:
# if its number isn't in the location list, simply write it
@@ -627,7 +627,7 @@ class GrubConfigAppClass(programbase):
# mhb TODO: Exception handling
os.remove(self.readfilename)
- print "save_menulst() called" # mhb debug
+ print("save_menulst() called") # mhb debug
return "not working yet"
@@ -637,10 +637,10 @@ class GrubConfigAppClass(programbase):
detected = os.popen('os-prober').readlines()
ops_list = []
for ops in detected:
- ops = string.replace(ops,"\n","")
+ ops = ops.replace("\n","")
temp_list = ops.split(':')
partition = temp_list[0]
- temp_list[0] = string.replace(temp_list[0],"/dev/","")
+ temp_list[0] = temp_list[0].replace("/dev/","")
re_obj = re.search(r'([sh]d)([a-z])([0-9])*$',temp_list[0])
disk = ord(re_obj.group(2))%97
part = int(re_obj.group(3))-1
@@ -662,7 +662,7 @@ class GrubConfigAppClass(programbase):
linux_os = os.popen('linux-boot-prober '+partition).readlines()
linux_list = []
for lops in linux_os:
- lops = string.replace(lops,"\n","")
+ lops = lops.replace("\n","")
temp_linux_list = lops.split(':')
linux_list.append(temp_linux_list)
temp_list.append(linux_list)
@@ -680,7 +680,7 @@ def create_grubconfig(parent,name):
##########################################################################
def MakeAboutData():
aboutdata = TDEAboutData("guidance", programname, version,
- unicode(i18n("Boot Loader Configuration Tool")).encode(locale.getpreferredencoding()),
+ str(i18n("Boot Loader Configuration Tool")).encode(locale.getpreferredencoding()),
TDEAboutData.License_GPL, "Copyright (C) 2006-2007 Martin Böhm")
aboutdata.addAuthor("Martin Böhm", "Developer", "[email protected]", "http://mhb.ath.cx/")
aboutdata.addAuthor("Simon Edwards", "Developer", "[email protected]", "http://www.simonzone.com/software/")
diff --git a/modules/xf86misc.py b/modules/xf86misc.py
index 8b952d8..c21881a 100755
--- a/modules/xf86misc.py
+++ b/modules/xf86misc.py
@@ -44,8 +44,8 @@ class XF86Screen(object):
(rc,x,y) = ixf86misc.XRRQueryExtension(self.display)
if rc==0:
return
- except AttributeError, errmsg:
- print "Trapped AttributeError:", errmsg, " - attempting to continue."
+ except AttributeError as errmsg:
+ print("Trapped AttributeError:", errmsg, " - attempting to continue.")
return
self.screenconfig = ixf86misc.XRRGetScreenInfo(self.display, ixf86misc.RootWindow(self.display, self.screenid))
@@ -140,7 +140,7 @@ class XF86Server(object):
self.displayname = displayname
self.display = ixf86misc.XOpenDisplay(displayname)
if self.display is None:
- raise XF86Error, "Couldn't connect to X server."
+ raise XF86Error("Couldn't connect to X server.")
self._defaultscreen = ixf86misc.DefaultScreen(self.display)
@@ -169,29 +169,29 @@ class XF86Error(Exception):
if __name__=='__main__':
xg = XF86Server()
xs = xg.getDefaultScreen()
- print "Number of screens:",str(len(xg.screens))
- print "Idle seconds:",xs.getIdleSeconds()
- print
- print "Gamma:"+str(xs.getGamma())
- print
+ print("Number of screens:",str(len(xg.screens)))
+ print("Idle seconds:",xs.getIdleSeconds())
+ print()
+ print("Gamma:"+str(xs.getGamma()))
+ print()
if xg.resolutionSupportAvailable():
- print "SizeID:"+str(xs.getSizeID())
- print "Size:"+str(xs.getSize())
+ print("SizeID:"+str(xs.getSizeID()))
+ print("Size:"+str(xs.getSize()))
sizes = xs.getAvailableSizes()
- print "Available Sizes:" + str(sizes)
- print
- print "Rotation:" + str(xs.getRotation())
- print "Available Rotations:" + str(xs.getAvailableRotations())
- print
- print "Refresh rate:" + str(xs.getRefreshRate())
- print "Refresh rates for the current screen:"+str(xs.getAvailableRefreshRates(xs.getSizeID()))
+ print("Available Sizes:" + str(sizes))
+ print()
+ print("Rotation:" + str(xs.getRotation()))
+ print("Available Rotations:" + str(xs.getAvailableRotations()))
+ print()
+ print("Refresh rate:" + str(xs.getRefreshRate()))
+ print("Refresh rates for the current screen:"+str(xs.getAvailableRefreshRates(xs.getSizeID())))
for i in range(len(sizes)):
- print "All Refresh Rates:"+str(xs.getAvailableRefreshRates(i))
+ print("All Refresh Rates:"+str(xs.getAvailableRefreshRates(i)))
xs.setScreenConfigAndRate(0,1,75)
- print "SizeID:"+str(xs.getSizeID())
- print "Size:"+str(xs.getSize())
+ print("SizeID:"+str(xs.getSizeID()))
+ print("Size:"+str(xs.getSize()))
sizes = xs.getAvailableSizes()
- print "Available Sizes:" + str(sizes)
+ print("Available Sizes:" + str(sizes))
else:
- print "(no resolution / randr support available)"
+ print("(no resolution / randr support available)")
diff --git a/mountconfig/MicroHAL.py b/mountconfig/MicroHAL.py
index 9a913fa..3d6fce5 100755
--- a/mountconfig/MicroHAL.py
+++ b/mountconfig/MicroHAL.py
@@ -326,8 +326,8 @@ class MicroHAL__(object):
# but it might be built as module, so we try to load that.
retval, msg = SimpleCommandRunner().run(["/sbin/modprobe",module])
if retval > 0:
- print msg
- print "Couldn't load driver " + module + " for filesystem " + fs
+ print(msg)
+ print("Couldn't load driver " + module + " for filesystem " + fs)
# Force refresh of list of supported filesystems
self.supportedfs = None
return proc in self.getSupportedFileSystems()
@@ -632,73 +632,73 @@ class MicroHAL(object):
# Detect the end of this block of device data.
state = READING_TOP
- if u"info.category" in parsed_hash:
+ if "info.category" in parsed_hash:
new_device = None
- capabilities_string = u" ".join(parsed_hash[u"info.capabilities"])
+ capabilities_string = " ".join(parsed_hash["info.capabilities"])
capabilities = self._parseStringList(capabilities_string)
- category = self._parseString(' '.join(parsed_hash[u"info.category"]))
- if category==u"volume":
+ category = self._parseString(' '.join(parsed_hash["info.category"]))
+ if category=="volume":
# Is it a volume?
- is_disc = parsed_hash.get(u"volume.is_disc")
+ is_disc = parsed_hash.get("volume.is_disc")
if is_disc is not None and is_disc[0]=='true':
continue
- is_partition = parsed_hash.get(u"volume.is_partition")
+ is_partition = parsed_hash.get("volume.is_partition")
if is_partition is not None:
is_partition = is_partition[0]
if is_partition=='true':
new_device = Partition()
- new_device.num = int(parsed_hash[u"volume.partition.number"][0])
+ new_device.num = int(parsed_hash["volume.partition.number"][0])
partition_to_uid[new_device] = current_uid
- if u"info.parent" in parsed_hash:
- parent_uid = self._parseString(' '.join(parsed_hash[u"info.parent"]))
+ if "info.parent" in parsed_hash:
+ parent_uid = self._parseString(' '.join(parsed_hash["info.parent"]))
partition_to_uid[new_device] = parent_uid
else:
new_device = Disk()
uid_to_disk[current_uid] = new_device
- if u"volume.uuid" in parsed_hash:
- new_device.uuid = self._parseString(' '.join(parsed_hash[u"volume.uuid"]))
+ if "volume.uuid" in parsed_hash:
+ new_device.uuid = self._parseString(' '.join(parsed_hash["volume.uuid"]))
- if u"volume.label" in parsed_hash:
- new_device.label = self._parseString(parsed_hash[u"volume.label"][0])
+ if "volume.label" in parsed_hash:
+ new_device.label = self._parseString(parsed_hash["volume.label"][0])
# If HAL returns label beginning with '#', it usually means that the
# actual label contains an Unix path. So we replace '#' with '/'.
if len(new_device.label) and new_device.label[0]=='%':
new_device.label = new_device.label.replace('%', '/')
- if u"volume.size" in parsed_hash:
- size = parsed_hash[u"volume.size"][0]
+ if "volume.size" in parsed_hash:
+ size = parsed_hash["volume.size"][0]
new_device.size = self.formatSizeBytes(int(size))
else:
new_device.size = "?"
# is it a storage device?
- elif category==u"storage":
- storage_model = self._parseString(' '.join(parsed_hash[u"storage.model"]))
- storage_removable = parsed_hash[u"storage.removable"][0]==u"true"
+ elif category=="storage":
+ storage_model = self._parseString(' '.join(parsed_hash["storage.model"]))
+ storage_removable = parsed_hash["storage.removable"][0]=="true"
- if u"storage.cdrom" in capabilities:
+ if "storage.cdrom" in capabilities:
- if u"storage.cdrom.cdrw" in parsed_hash \
- and parsed_hash[u"storage.cdrom.cdrw"][0]==u"true":
+ if "storage.cdrom.cdrw" in parsed_hash \
+ and parsed_hash["storage.cdrom.cdrw"][0]=="true":
new_device = BurnerDisk()
else:
new_device= RemovableDisk()
- elif u"storage.floppy" in capabilities:
+ elif "storage.floppy" in capabilities:
new_device = FloppyDevice()
else:
- if u"storage.bus" in parsed_hash \
- and self._parseString(' '.join(parsed_hash[u"storage.bus"]))==u"usb":
+ if "storage.bus" in parsed_hash \
+ and self._parseString(' '.join(parsed_hash["storage.bus"]))=="usb":
new_device = USBDisk()
else:
@@ -711,8 +711,8 @@ class MicroHAL(object):
continue
# Handle the generic properties.
- new_device.dev = self._parseString(' '.join(parsed_hash[u"block.device"]))
- new_device.major = int(parsed_hash[u"block.major"][0])
+ new_device.dev = self._parseString(' '.join(parsed_hash["block.device"]))
+ new_device.major = int(parsed_hash["block.major"][0])
self.devices.append(new_device)
@@ -722,9 +722,9 @@ class MicroHAL(object):
parsed_hash[ parts[0] ] = parts[2:]
# Attach the partitions to thier devices.
- for partition in partition_to_uid.keys():
+ for partition in list(partition_to_uid.keys()):
parent = partition_to_uid[partition]
- if parent in uid_to_disk.keys():
+ if parent in list(uid_to_disk.keys()):
parent_device = uid_to_disk[parent]
parent_device.appendPartition(partition)
self.devices.remove(partition)
@@ -819,8 +819,8 @@ class MicroHAL(object):
# but it might be built as module, so we try to load that.
retval, msg = SimpleCommandRunner().run(["/sbin/modprobe",module])
if retval > 0:
- print msg
- print "Couldn't load driver " + module + " for filesystem " + fs
+ print(msg)
+ print("Couldn't load driver " + module + " for filesystem " + fs)
# Force refresh of list of supported filesystems
self.supportedfs = None
return proc in self.getSupportedFileSystems()
@@ -842,7 +842,7 @@ class MicroHAL(object):
for partition in item.partitions:
if partition.dev==device:
return partition.label
- print "No Label found for ",device
+ print("No Label found for ",device)
return ""
def getUUIDByDevice(self, device):
@@ -851,7 +851,7 @@ class MicroHAL(object):
#print partition, partition.getUUID()
if partition.dev==device:
return partition.uuid
- print "No UUID found for ",device
+ print("No UUID found for ",device)
return ""
def getDeviceByUUID(self, uuid):
@@ -870,19 +870,19 @@ class MicroHAL(object):
if __name__=='__main__':
hal = MicroHAL()
for item in hal.getDevices():
- print(str(item))
+ print((str(item)))
- print
+ print()
#"""
for item in hal.getDevices():
for partition in item.partitions:
- print partition, partition.getLabel()
+ print(partition, partition.getLabel())
#"""
#realhal = RealHAL()
#for item in realhal.getDevices():
# print(str(item))
- print
+ print()
diff --git a/mountconfig/SMBShareSelectDialog.py b/mountconfig/SMBShareSelectDialog.py
index e97a577..617ee04 100644
--- a/mountconfig/SMBShareSelectDialog.py
+++ b/mountconfig/SMBShareSelectDialog.py
@@ -204,8 +204,8 @@ class SMBShareSelectDialog(KDialogBase):
########################################################################
def slotNewItems(self,items):
for entry in items:
- newitem = SMBShareListViewItem(self.lookupqueue[0], unicode(entry.name()), KURL(entry.url()), self)
- self.url_to_list_item_map[unicode(entry.url().prettyURL())] = newitem
+ newitem = SMBShareListViewItem(self.lookupqueue[0], str(entry.name()), KURL(entry.url()), self)
+ self.url_to_list_item_map[str(entry.url().prettyURL())] = newitem
# Notice how I copied the KURL object and TQString (to a python string)
########################################################################
@@ -225,7 +225,7 @@ class SMBShareSelectDialog(KDialogBase):
########################################################################
def slotDirListRedirection(self,oldUrl,newUrl):
- list_item = self.url_to_list_item_map[unicode(oldUrl.prettyURL())]
+ list_item = self.url_to_list_item_map[str(oldUrl.prettyURL())]
list_item.setURL(KURL(newUrl)) # The copy is important.
# Reselect the selected node. (This will force a refresh).
@@ -317,7 +317,7 @@ class SMBShareSelectDialog(KDialogBase):
self.usernameedit.setEnabled(False)
selectedurl = self.selecteditem.getURL()
- self.reconnectbutton.setEnabled(unicode(selectedurl.user())!="")
+ self.reconnectbutton.setEnabled(str(selectedurl.user())!="")
self.updatinggui = False
@@ -333,11 +333,11 @@ class SMBShareSelectDialog(KDialogBase):
self.passwordedit.setEnabled(True)
self.usernameedit.setEnabled(True)
- username = unicode(self.usernameedit.text())
- password = unicode(self.passwordedit.text())
+ username = str(self.usernameedit.text())
+ password = str(self.passwordedit.text())
selectedurl = self.selecteditem.getURL()
if username!="" and password!="" and \
- ((unicode(selectedurl.user())!=username) or (unicode(selectedurl.pass_())!=password)):
+ ((str(selectedurl.user())!=username) or (str(selectedurl.pass_())!=password)):
self.reconnectbutton.setEnabled(True)
else:
self.reconnectbutton.setEnabled(False)
@@ -404,10 +404,10 @@ class SMBShareListViewItem(TDEListViewItem):
self.setExpandable(True)
if url.hasPath() and url.path(-1)!="/":
- parts = [x for x in unicode(url.path(-1)).split("/") if x!=""]
+ parts = [x for x in str(url.path(-1)).split("/") if x!=""]
self.component = parts[-1].lower()
elif url.hasHost():
- self.component = unicode(url.host()).lower()
+ self.component = str(url.host()).lower()
else:
self.component = None
@@ -502,7 +502,7 @@ class SMBShareListViewItem(TDEListViewItem):
# Another wrinkle is that the treeview contains a level of workgroups while
# a given URL omits the workgroup a jumps directly to the machine name.
def selectURL(self,targeturl):
- path = unicode(targeturl.path(-1))
+ path = str(targeturl.path(-1))
parts = [x for x in path.split("/") if x!=""]
if targeturl.hasHost():
tmp = [targeturl.host()]
diff --git a/mountconfig/SimpleCommandRunner.py b/mountconfig/SimpleCommandRunner.py
index 4eafedd..a6767b5 100644
--- a/mountconfig/SimpleCommandRunner.py
+++ b/mountconfig/SimpleCommandRunner.py
@@ -40,9 +40,9 @@ class SimpleCommandRunner(TQObject):
is the output from stdout and stderr.
"""
global debug
- if debug: print cmdlist
+ if debug: print(cmdlist)
self.STDOUT_only = STDOUT_only
- self.output = u""
+ self.output = ""
proc = TDEProcess()
proc.setEnvironment("LANG","US")
proc.setEnvironment("LC_ALL","US")
@@ -58,12 +58,12 @@ class SimpleCommandRunner(TQObject):
########################################################################
def slotStdout(self,proc,buffer,buflen):
global debug
- if debug: print "slotStdout() |"+buffer+"|"
+ if debug: print("slotStdout() |"+buffer+"|")
self.output += buffer.decode(locale.getpreferredencoding())
########################################################################
def slotStderr(self,proc,buffer,buflen):
global debug
- if debug: print "slotStderr() |"+buffer+"|"
+ if debug: print("slotStderr() |"+buffer+"|")
if not self.STDOUT_only:
self.output += buffer.decode(locale.getpreferredencoding())
diff --git a/mountconfig/fuser.py b/mountconfig/fuser.py
index 9780555..06cf1a9 100644
--- a/mountconfig/fuser.py
+++ b/mountconfig/fuser.py
@@ -73,7 +73,7 @@ class FileProcess(TQListViewItem):
""" Parses a signal string representation or a signal number and sends it to
the process."""
if not self.isparent:
- print "Item is not a process, only a filedescriptor."
+ print("Item is not a process, only a filedescriptor.")
return
try:
signal_int = int(signal)
@@ -81,17 +81,17 @@ class FileProcess(TQListViewItem):
try:
signal_int = self.signals[signal]
except IndexError:
- print "No known signal received ", signal
+ print("No known signal received ", signal)
return False
try:
rc = os.kill(int(self.pid),signal_int) # TODO: Catch OSError
- except OSError, message:
- print "OSError: Couldn't %s %s %s" % (signal,self.pname,self.pid)
- print message
+ except OSError as message:
+ print("OSError: Couldn't %s %s %s" % (signal,self.pname,self.pid))
+ print(message)
if not rc:
- print "Successfully sent signal ", signal_int, " to process ", self.pid
+ print("Successfully sent signal ", signal_int, " to process ", self.pid)
return True
- print "Signal %i didn't succeed" % signal_int
+ print("Signal %i didn't succeed" % signal_int)
return False
def fillColumns(self):
@@ -125,7 +125,7 @@ class FUser(FUserUI):
self.umountbutton.setEnabled(False)
self.explanationlabel.setText(
- unicode(i18n("""The volume %s is in use and can not be disabled.<br>
+ str(i18n("""The volume %s is in use and can not be disabled.<br>
<br>
The processes that are blocking %s are listed below. These processes must be closed
before %s can be disabled.
@@ -159,7 +159,7 @@ class FUser(FUserUI):
if os.path.isfile(path):
self.lsof_bin = path
else:
- print path, " is not a valid binary, keeping %s", self.lsof_bin
+ print(path, " is not a valid binary, keeping %s", self.lsof_bin)
def readPixmaps(self):
self.pix = {
@@ -185,7 +185,7 @@ class FUser(FUserUI):
type = line[0]
info = line[1:]
- if type is "p":
+ if type == "p":
pid = info
parentproc = FileProcess(self.processlist,pid,True)
self.processes.append(parentproc)
@@ -243,7 +243,7 @@ class FUser(FUserUI):
self.processlist.selectedItem().sendSignal("KILL")
self.refreshProcesslist()
except AttributeError:
- print "No killable item selected."
+ print("No killable item selected.")
def slotKillallButtonClicked(self):
for process in self.realprocesses:
@@ -266,17 +266,17 @@ class FUser(FUserUI):
SimpleCommandRunner
rc, output = SimpleCommandRunner().run(['/bin/umount',self.device])
if rc == 0:
- print "%s successfully unmounted." % self.device
+ print("%s successfully unmounted." % self.device)
# Close dialog and return 0 - sucessfully umounted.
self.done(0)
else:
- print "Unmounting %s failed: %s" % (self.device,output[:-1])
+ print("Unmounting %s failed: %s" % (self.device,output[:-1]))
self.isMounted()
################################################################################################
if standalone:
device = "/dev/hda1"
- print 'Device is ', device
+ print('Device is ', device)
cmd_args = TDECmdLineArgs.init(sys.argv, "FUser",
"A graphical frontend to fuser, but without using it :-)", "0.2")
diff --git a/mountconfig/mountconfig.py b/mountconfig/mountconfig.py
index d433c0b..f348aa6 100755
--- a/mountconfig/mountconfig.py
+++ b/mountconfig/mountconfig.py
@@ -183,8 +183,8 @@ class MountEntryExt(object):
# object.
def __init__(self,base=None):
if base==None:
- self.device = unicode(i18n("<device>"))
- self.mountpoint = unicode(i18n("<mount point>"))
+ self.device = str(i18n("<device>"))
+ self.mountpoint = str(i18n("<mount point>"))
self.mounttype = 'ext2'
self.uuid = ""
self.label = ""
@@ -319,13 +319,13 @@ class MountEntryExt(object):
if self.label != "":
return MountEntry.encodeMountEntryString("LABEL="+self.label)
else:
- print "No Label set, preventing you from shooting yourself in the foot"
+ print("No Label set, preventing you from shooting yourself in the foot")
elif self.getUseAsDevice() == "uuid":
if self.uuid != "":
return "UUID="+self.uuid
return MountEntry.encodeMountEntryString("UUID="+self.uuid)
else:
- print "No UUID set, preventing you from shooting yourself in the foot"
+ print("No UUID set, preventing you from shooting yourself in the foot")
return MountEntry.encodeMountEntryString(self.device)
########################################################################
@@ -364,10 +364,10 @@ class MountEntryExt(object):
options.append(o.strip())
return self.getDeviceString() + \
- u" " + MountEntry.encodeMountEntryString(self.mountpoint.replace("%20","\040")) + \
- u" " + MountEntry.encodeMountEntryString(self.mounttype) + \
- u" " + MountEntry.encodeMountEntryString(u",".join(options)) + \
- u" " + unicode(self.fs_freq) + u" " + unicode(self.fs_passno)
+ " " + MountEntry.encodeMountEntryString(self.mountpoint.replace("%20","\040")) + \
+ " " + MountEntry.encodeMountEntryString(self.mounttype) + \
+ " " + MountEntry.encodeMountEntryString(",".join(options)) + \
+ " " + str(self.fs_freq) + " " + str(self.fs_passno)
########################################################################
def getCategory(self):
@@ -412,22 +412,22 @@ class MountEntryExt(object):
self.mountpoint).arg(output)
captionmsg = i18n("Unable to disable %1").arg(self.mountpoint)
- extramsg = unicode(i18n("Return code from mount was %1.\n").arg(rc))
+ extramsg = str(i18n("Return code from mount was %1.\n").arg(rc))
if (rc & 1)!=0:
- extramsg += unicode(i18n("\"incorrect invocation or permissions\"\n"))
+ extramsg += str(i18n("\"incorrect invocation or permissions\"\n"))
if (rc & 2)!=0:
- extramsg += unicode(i18n("\"system error (out of memory, cannot fork, no more loop devices)\"\n"))
+ extramsg += str(i18n("\"system error (out of memory, cannot fork, no more loop devices)\"\n"))
if (rc & 4)!=0:
- extramsg += unicode(i18n("\"internal mount bug or missing nfs support in mount\"\n"))
+ extramsg += str(i18n("\"internal mount bug or missing nfs support in mount\"\n"))
if (rc & 8)!=0:
- extramsg += unicode(i18n("\"user interrupt\"\n"))
+ extramsg += str(i18n("\"user interrupt\"\n"))
if (rc & 16)!=0:
- extramsg += unicode(i18n("\"problems writing or locking /etc/mtab\"\n"))
+ extramsg += str(i18n("\"problems writing or locking /etc/mtab\"\n"))
if (rc & 32)!=0:
- extramsg += unicode(i18n("\"mount failure\"\n"))
+ extramsg += str(i18n("\"mount failure\"\n"))
if (rc & 64)!=0:
- extramsg += unicode(i18n("\"some mount succeeded\"\n"))
+ extramsg += str(i18n("\"some mount succeeded\"\n"))
in_use = False
if not mount_action:
@@ -444,10 +444,10 @@ class MountEntryExt(object):
fuser.exec_loop()
in_use_message = ""
if fuser.result() != 0:
- in_use_message = unicode(i18n("Unmounting %1 failed or was cancelled.").arg(self.device))
+ in_use_message = str(i18n("Unmounting %1 failed or was cancelled.").arg(self.device))
extramsg += in_use_message
else:
- extramsg += unicode(i18n("(none)"))
+ extramsg += str(i18n("(none)"))
if not in_use:
KMessageBox.detailedSorry(parentdialog, msg, extramsg, captionmsg)
@@ -723,8 +723,8 @@ class MountEntryExtAlien(MountEntryExt):
def getFstabOptions(self):
# Construct the options field.
options = super(MountEntryExtAlien,self).getFstabOptions()
- options.append('uid='+unicode(self.uid))
- options.append('gid='+unicode(self.gid))
+ options.append('uid='+str(self.uid))
+ options.append('gid='+str(self.gid))
options.append(['noauto','auto'][self.auto])
options.append(['ro','rw'][self.writeable])
options.append(['nouser','user','users','owner'][self.allowusermount])
@@ -877,15 +877,15 @@ class MountEntryExtSMB(MountEntryExtAlien):
# Write out the credentials file
if self.credentialsfile is None:
i = 1
- while os.path.exists(self.CREDENTIALSBASENAME+unicode(i)):
+ while os.path.exists(self.CREDENTIALSBASENAME+str(i)):
i += 1
- self.credentialsfile = self.CREDENTIALSBASENAME+unicode(i)
- fd = os.open(self.credentialsfile,os.O_WRONLY|os.O_CREAT,0600)
+ self.credentialsfile = self.CREDENTIALSBASENAME+str(i)
+ fd = os.open(self.credentialsfile,os.O_WRONLY|os.O_CREAT,0o600)
fhandle = os.fdopen(fd,'w')
- fhandle.write((u"username = %s\npassword = %s\n" % (self.username,self.password))
+ fhandle.write(("username = %s\npassword = %s\n" % (self.username,self.password))
.encode(locale.getpreferredencoding(),'replace') )
fhandle.close()
- options.append(u"credentials="+self.credentialsfile)
+ options.append("credentials="+self.credentialsfile)
return options
########################################################################
@@ -938,7 +938,7 @@ class MountEntryExtSwap(MountEntryExt):
options.remove('defaults')
except ValueError:
pass
- self.extraoptions = u",".join(options)
+ self.extraoptions = ",".join(options)
########################################################################
def copy(self,newobject=None):
@@ -1092,7 +1092,7 @@ class MountEntry(object):
self.extension = self.MountTypes[self.mounttype][0](base)
self.extensionObjects[self.mounttype] = self.extension
except (KeyError,IndexError):
- raise InvalidMountEntryError, u"Unable to parse mount entry:"+unicode(base)
+ raise InvalidMountEntryError("Unable to parse mount entry:"+str(base))
########################################################################
def getMountType(self):
@@ -1104,7 +1104,7 @@ class MountEntry(object):
try:
self.extensionObjects[newtypename] = self.MountTypes[newtypename][0](self.extension)
except KeyError:
- raise NotImplementedError, "Unknown mounttype:"+newtypename
+ raise NotImplementedError("Unknown mounttype:"+newtypename)
self.mounttype = newtypename
self.extension = self.extensionObjects[newtypename]
self.extension.setMountType(newtypename)
@@ -1136,8 +1136,8 @@ class MountEntry(object):
def __getattr__(self,name):
try:
return getattr(self.extension,name)
- except AttributeError, a:
- print a
+ except AttributeError as a:
+ print(a)
########################################################################
# FIXME
@@ -1150,7 +1150,7 @@ class MountEntry(object):
########################################################################
def getMountTypes():
- return MountEntry.MountTypes.keys()
+ return list(MountEntry.MountTypes.keys())
getMountTypes = staticmethod(getMountTypes)
########################################################################
@@ -1160,7 +1160,7 @@ class MountEntry(object):
########################################################################
def encodeMountEntryString(string):
- newstring = u""
+ newstring = ""
for c in string:
if c==' ':
newstring += "\\040"
@@ -1263,13 +1263,13 @@ class MountTable(object):
fhandle.close()
if not sysfs_in_fstab:
- sysfsentry = MountEntry(u"sysfs /sys sysfs defaults 0 0")
+ sysfsentry = MountEntry("sysfs /sys sysfs defaults 0 0")
sysfsentry.notInFstab = True
sysfsentry.maydisable = False
#self.append(sysfsentry)
if not usbdevfs_in_fstab:
- usbdevfsentry = MountEntry(u"procbususb /proc/bus/usb usbdevfs defaults 0 0")
+ usbdevfsentry = MountEntry("procbususb /proc/bus/usb usbdevfs defaults 0 0")
usbdevfsentry.notInFstab = True
usbdevfsentry.maydisable = False
self.append(usbdevfsentry)
@@ -1314,8 +1314,8 @@ class MountTable(object):
for entry in self.allentries:
if not entry.notInFstab:
line = entry.getFstabLine()
- fhandle.write(line+u"\n")
- print line
+ fhandle.write(line+"\n")
+ print(line)
fhandle.close()
fhandle = None
@@ -1335,7 +1335,7 @@ class MountTable(object):
return self.entries.__contains(item)
########################################################################
def __delitem__(self,key):
- raise NotImplementedError, "No __delitem__ on MountTable."
+ raise NotImplementedError("No __delitem__ on MountTable.")
########################################################################
def __getitem__(self,key):
@@ -1349,7 +1349,7 @@ class MountTable(object):
return self.entries.__len__()
########################################################################
def __setitem__(self,key,value):
- raise NotImplementedError, "No __setitem__ on MountTable."
+ raise NotImplementedError("No __setitem__ on MountTable.")
############################################################################
class MountEntryDialogOptions(TQWidget):
@@ -1547,20 +1547,20 @@ class MountEntryDialogOptions(TQWidget):
########################################################################
def undisplayMountEntry(self,entry):
if self.showmountpoint:
- entry.setMountPoint( unicode(self.mountpointlineedit.text()) )
+ entry.setMountPoint( str(self.mountpointlineedit.text()) )
if self.showdevice:
- entry.setDevice( unicode(self.devicelineedit.text()) )
+ entry.setDevice( str(self.devicelineedit.text()) )
if self.showuuid and self.showdevice:
if self.devicecheckbox.isChecked():
entry.setUUID(None)
else:
- entry.setUUID( unicode(self.uuidlineedit.text()) )
+ entry.setUUID( str(self.uuidlineedit.text()) )
if self.showlabel and self.showdevice:
if self.devicecheckbox.isChecked():
entry.setLabel(None)
else:
- entry.setLabel( unicode(self.labellineedit.text()) )
+ entry.setLabel( str(self.labellineedit.text()) )
if allowuuid and self.showuuid:
if self.uuidcheckbox.isChecked():
@@ -1572,7 +1572,7 @@ class MountEntryDialogOptions(TQWidget):
if self.devicecheckbox.isChecked():
entry.setUseAsDevice("devicenode")
- entry.setExtraOptions( unicode(self.optionslineedit.text()) )
+ entry.setExtraOptions( str(self.optionslineedit.text()) )
if self.showfs_freq:
entry.setFSFreq(self.fsfreqspinbox.value())
if self.showfs_passno:
@@ -1597,7 +1597,7 @@ class MountEntryDialogOptions(TQWidget):
########################################################################
def slotUUIDCheckboxClicked(self):
if self.uuidlineedit.text() == "":
- label = microhal.getUUIDByDevice(unicode(self.devicelineedit.text()))
+ label = microhal.getUUIDByDevice(str(self.devicelineedit.text()))
self.uuidlineedit.setText(label)
self.devicecheckbox.setChecked(False)
self.devicelineedit.setEnabled(False)
@@ -1607,7 +1607,7 @@ class MountEntryDialogOptions(TQWidget):
def slotLabelCheckboxClicked(self):
if self.labellineedit.text() == "":
- label = microhal.getLabelByDevice(unicode(self.devicelineedit.text()))
+ label = microhal.getLabelByDevice(str(self.devicelineedit.text()))
self.labellineedit.setText(label)
self.uuidcheckbox.setChecked(False)
self.devicelineedit.setEnabled(False)
@@ -1775,24 +1775,24 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
########################################################################
def undisplayMountEntry(self,entry):
- entry.setDevice( unicode(self.devicelineedit.text()) )
+ entry.setDevice( str(self.devicelineedit.text()) )
if self.showuuid:
if self.devicecheckbox.isChecked() or self.labelcheckbox.isChecked():
entry.setUUID(None)
else:
- entry.setUUID( unicode(self.uuidlineedit.text()) )
+ entry.setUUID( str(self.uuidlineedit.text()) )
if self.showlabel:
if self.devicecheckbox.isChecked() or self.uuidcheckbox.isChecked():
entry.setLabel(None)
else:
- entry.setLabel( unicode(self.labellineedit.text()) )
+ entry.setLabel( str(self.labellineedit.text()) )
if not self.showlabel and not self.showuuid:
if self.uuidcheckbox.isChecked() or self.labelcheckbox.isChecked():
entry.setLabel(None)
else:
- entry.setLabel( unicode(self.devicelineedit.text()) )
+ entry.setLabel( str(self.devicelineedit.text()) )
if allowuuid:
if self.uuidcheckbox.isChecked():
@@ -1803,7 +1803,7 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
if self.devicecheckbox.isChecked():
entry.setUseAsDevice("devicenode")
- entry.setMountPoint( unicode(self.mountpointlineedit.text()) )
+ entry.setMountPoint( str(self.mountpointlineedit.text()) )
entry.setExtraOptions(self.options)
entry.setFSFreq(self.fsfreq)
entry.setFSPassno(self.fspassno)
@@ -1833,7 +1833,7 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
########################################################################
def slotUUIDCheckboxClicked(self):
if self.uuidlineedit.text() == "":
- label = microhal.getUUIDByDevice(unicode(self.devicelineedit.text()))
+ label = microhal.getUUIDByDevice(str(self.devicelineedit.text()))
self.uuidlineedit.setText(label)
self.devicecheckbox.setChecked(False)
self.devicelineedit.setEnabled(False)
@@ -1843,7 +1843,7 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
def slotLabelCheckboxClicked(self):
if self.labellineedit.text() == "":
- label = microhal.getLabelByDevice(unicode(self.devicelineedit.text()))
+ label = microhal.getLabelByDevice(str(self.devicelineedit.text()))
self.labellineedit.setText(label)
self.devicecheckbox.setChecked(False)
self.devicelineedit.setEnabled(False)
@@ -2073,11 +2073,11 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
else:
if allowlabel:
if self.labelcheckbox.isChecked():
- entry.setLabel( unicode(self.labellineedit.text()) )
+ entry.setLabel( str(self.labellineedit.text()) )
else:
- entry.setUUID( unicode(self.uuidlineedit.text()) )
+ entry.setUUID( str(self.uuidlineedit.text()) )
else:
- entry.setUUID( unicode(self.uuidlineedit.text()) )
+ entry.setUUID( str(self.uuidlineedit.text()) )
if allowlabel:
if self.devicecheckbox.isChecked():
@@ -2085,15 +2085,15 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
else:
if allowuuid:
if self.uuidcheckbox.isChecked():
- entry.setUUID( unicode(self.uuidlineedit.text()) )
+ entry.setUUID( str(self.uuidlineedit.text()) )
else:
- entry.setLabel( unicode(self.labellineedit.text()) )
+ entry.setLabel( str(self.labellineedit.text()) )
else:
- entry.setLabel( unicode(self.labellineedit.text()) )
+ entry.setLabel( str(self.labellineedit.text()) )
- entry.setDevice( unicode(self.devicelineedit.text()) )
+ entry.setDevice( str(self.devicelineedit.text()) )
- entry.setMountPoint( unicode(self.mountpointlineedit.text()) )
+ entry.setMountPoint( str(self.mountpointlineedit.text()) )
entry.setExtraOptions(self.options)
entry.setFSFreq(self.fsfreq)
entry.setFSPassno(self.fspassno)
@@ -2118,7 +2118,7 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
########################################################################
def slotUUIDCheckboxClicked(self):
if self.uuidlineedit.text() == "":
- label = microhal.getUUIDByDevice(unicode(self.devicelineedit.text()))
+ label = microhal.getUUIDByDevice(str(self.devicelineedit.text()))
self.uuidlineedit.setText(label)
self.devicecheckbox.setChecked(False)
self.devicelineedit.setEnabled(False)
@@ -2249,8 +2249,8 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
self.selectsmbdialog = SMBShareSelectDialog(None)
# This just converts a \\zootv\data\ share name to smb:/zootv/data
- parts = [x.replace("/",'\\') for x in unicode(self.devicelineedit.text()).split('\\') if x!=""]
- oldurl = u"smb:/"+("/".join(parts) )
+ parts = [x.replace("/",'\\') for x in str(self.devicelineedit.text()).split('\\') if x!=""]
+ oldurl = "smb:/"+("/".join(parts) )
urlobj = KURL(oldurl)
if self.userradio.isChecked():
@@ -2262,7 +2262,7 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
plainurl = KURL(newurlobj)
plainurl.setUser(TQString.null)
plainurl.setPass(TQString.null)
- parts = [x.replace('\\',"/") for x in unicode(plainurl.url())[4:].split("/") if x !=""]
+ parts = [x.replace('\\',"/") for x in str(plainurl.url())[4:].split("/") if x !=""]
#convert the first part to an IP address
nmboutput = subprocess.Popen(["nmblookup",parts[0]], stdout=subprocess.PIPE).stdout
nmboutput.readline()
@@ -2317,8 +2317,8 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
########################################################################
def undisplayMountEntry(self,entry):
- entry.setDevice( unicode(self.devicelineedit.text()) )
- entry.setMountPoint( unicode(self.mountpointlineedit.text()) )
+ entry.setDevice( str(self.devicelineedit.text()) )
+ entry.setMountPoint( str(self.mountpointlineedit.text()) )
entry.setExtraOptions(self.options)
entry.setFSFreq(self.fsfreq)
entry.setFSPassno(self.fspassno)
@@ -2332,8 +2332,8 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
entry.setUsername(None)
entry.setPassword(None)
else:
- entry.setUsername( unicode(self.usernameedit.text()) )
- entry.setPassword( unicode(self.passwordedit.text()) )
+ entry.setUsername( str(self.usernameedit.text()) )
+ entry.setPassword( str(self.passwordedit.text()) )
########################################################################
def slotAdvancedClicked(self):
@@ -2455,7 +2455,7 @@ class MountEntryDialog(KDialogBase):
# Disk types
ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-hdd"),i18n("Disk Filesystems"))
self.comboIndexToMountType.append(None)
- items = self.MountTypeEditorsDisk.keys()
+ items = list(self.MountTypeEditorsDisk.keys())
items.sort()
for mounttype in items:
self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype))
@@ -2464,7 +2464,7 @@ class MountEntryDialog(KDialogBase):
# Network types
ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-network"),i18n("Network Filesystems"))
self.comboIndexToMountType.append(None)
- items = self.MountTypeEditorsNetwork.keys()
+ items = list(self.MountTypeEditorsNetwork.keys())
items.sort()
for mounttype in items:
self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype))
@@ -2473,7 +2473,7 @@ class MountEntryDialog(KDialogBase):
# System types
ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-blockdevice"),i18n("Operating System"))
self.comboIndexToMountType.append(None)
- items = self.MountTypeEditorsSystem.keys()
+ items = list(self.MountTypeEditorsSystem.keys())
items.sort()
for mounttype in items:
self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype))
@@ -2597,7 +2597,7 @@ class MountEntryDialog(KDialogBase):
i18n("Mountpoint already in use"))!=KMessageBox.Continue:
return
- if self.currentMountEntry.getMountType() in MountEntryDialog.MountTypeEditorsDisk.keys():
+ if self.currentMountEntry.getMountType() in list(MountEntryDialog.MountTypeEditorsDisk.keys()):
# If device is not in /dev and it's no bind mount, ask if that's meant this way ...
options = self.currentMountEntry.getFstabOptions()
if (not self.currentMountEntry.getDevice().startswith("/dev/")
@@ -2696,7 +2696,7 @@ class MountEntryAdvancedCommonUnixDialog(KDialogBase):
self.allowexecutablecheckbox.isChecked(),
self.allowsuidcheckbox.isChecked(),
self.usedevpointscheckbox.isChecked(),
- unicode(self.optionslineedit.text()),
+ str(self.optionslineedit.text()),
self.fsfreqspinbox.value(),
self.fspassnospinbox.value())
@@ -2724,7 +2724,7 @@ class MountEntryAdvancedPlainDialog(KDialogBase):
self.fsfreqspinbox.setValue(fsfreq)
self.fspassnospinbox.setValue(fspassno)
self.exec_loop()
- return (unicode(self.optionslineedit.text()), self.fsfreqspinbox.value(), self.fspassnospinbox.value())
+ return (str(self.optionslineedit.text()), self.fsfreqspinbox.value(), self.fspassnospinbox.value())
############################################################################
class MountListViewItem(TDEListViewItem):
@@ -3091,13 +3091,13 @@ class MountConfigApp(programbase):
blk = hal_device.getDev()
devicepath, devicename = ('/'.join(blk.split('/')[0:-1])+'/', blk.split('/')[-1])
# We keep a dict with those widgets, that saves us some time reading out all the values.
- if devicename not in self.sizeviewdialogs.keys():
+ if devicename not in list(self.sizeviewdialogs.keys()):
self.sizeviewdialogs[devicename] = sizeview.SizeView(self,devicename,devicepath)
self.sizeviewdialogs[devicename].exec_loop()
else:
self.sizeviewdialogs[devicename].exec_loop()
else:
- print "Sizeview doesn't support",blk.__class__," yet."
+ print("Sizeview doesn't support",blk.__class__," yet.")
########################################################################
def slotListClicked(self,item):
diff --git a/mountconfig/sizeview.py b/mountconfig/sizeview.py
index a4169c4..49ce9f6 100644
--- a/mountconfig/sizeview.py
+++ b/mountconfig/sizeview.py
@@ -62,7 +62,7 @@ class SizeView(TQDialog):
self.readSize()
self.readSwaps()
- partitions = self.partitions.keys()
+ partitions = list(self.partitions.keys())
partitions.sort()
number=1
@@ -99,7 +99,7 @@ class SizeView(TQDialog):
rows = int(n/cols)+1
else:
rows = int(n/cols)
- if n is 1: rows = 2
+ if n == 1: rows = 2
# Build main Gridlayout.
total_rows = rows+2
@@ -209,7 +209,7 @@ class DiskGroup(TQGroupBox):
self.diskview.setScaledContents(1)
DiskViewGroupLayout.addWidget(self.diskview)
- parts = self.partitions.keys()
+ parts = list(self.partitions.keys())
parts.sort()
self.percentages()
@@ -247,11 +247,11 @@ class DiskGroup(TQGroupBox):
def percentages(self):
p_t = 0
- for p in self.partitions.values():
+ for p in list(self.partitions.values()):
p_t += int(p)
self.perc = {}
- for p in self.partitions.keys():
+ for p in list(self.partitions.keys()):
self.perc[p] = float(float(self.partitions[p])/float(p_t))
return self.perc
@@ -408,7 +408,8 @@ class DiskPixmap(TQPixmap):
linewidth = 2 # Width of surrounding frame
- def __init__(self,percents,colors,(w,h)):
+ def __init__(self,percents,colors, xxx_todo_changeme):
+ (w,h) = xxx_todo_changeme
self.percents = percents
self.w,self.h = w,h
self.colors = colors
@@ -425,7 +426,7 @@ class DiskPixmap(TQPixmap):
# Paint background, this is interesting for empty partitions.
p.fillRect(0,0,w,h,TQBrush(TQColor("white")))
- parts = self.percents.keys()
+ parts = list(self.percents.keys())
parts.sort()
xa = wa = 0
for part in parts:
diff --git a/serviceconfig/serviceconfig.py b/serviceconfig/serviceconfig.py
index 244e40e..d806f8e 100755
--- a/serviceconfig/serviceconfig.py
+++ b/serviceconfig/serviceconfig.py
@@ -58,7 +58,7 @@ class DescriptionCache(object):
def __init__(self,filename,path="/tmp"):
if not os.path.isdir(path):
- print path, "is not a valid directory, can't cache."
+ print(path, "is not a valid directory, can't cache.")
self.filename = os.path.join(path,filename)
@@ -68,15 +68,15 @@ class DescriptionCache(object):
pickler = Unpickler(fhandle)
self.data = pickler.load()
fhandle.close()
- except IOError, e:
- print "Couldn't load file:", e
- print "Not reading description cache data"
+ except IOError as e:
+ print("Couldn't load file:", e)
+ print("Not reading description cache data")
def saveCache(self):
""" Save pickled dataobject to the file. We don't want the user to be able to save a datastructure that root
will read in since that would have implications for security."""
if not isroot:
- print "Not saving description cache data for security reasons, we're not root"
+ print("Not saving description cache data for security reasons, we're not root")
return
try:
@@ -85,8 +85,8 @@ class DescriptionCache(object):
pickler.dump(self.data)
fhandle.close()
#print "Saved description cache data to ", self.filename
- except IOError, e:
- print "Can't cache:", e
+ except IOError as e:
+ print("Can't cache:", e)
def add(self,filename,packagename,description):
self.data[filename] = (packagename,description)
@@ -117,7 +117,7 @@ class Service(object):
self.runlevels = []
self.gotStatus = False
self.statusable = False
- self.status = unicode(i18n("?"))
+ self.status = str(i18n("?"))
self.startpriority = "50"
self.killpriority = "50"
@@ -392,7 +392,7 @@ class DebianService(Service):
self.runlevels = []
self.gotStatus = False
self.statusable = False
- self.status = unicode(i18n("not running"))
+ self.status = str(i18n("not running"))
self.startpriority = "50"
self.killpriority = "50"
self.getStatusFrom = "pidfile"
@@ -433,7 +433,7 @@ class DebianService(Service):
if ":" in line:
self.packagename = line.strip().split(":")[0]
else:
- print self.path_and_filename + " is no file or does not exist!"
+ print(self.path_and_filename + " is no file or does not exist!")
########################################################################
def fetchStatus(self):
@@ -452,14 +452,14 @@ class DebianService(Service):
def fetchStatusFromPidFile(self):
try:
if os.path.isfile(os.path.join('/var/run',self.pidfiles[self.filename])):
- self.status = unicode(i18n("running"))
+ self.status = str(i18n("running"))
else:
- self.status = unicode(i18n("not running"))
+ self.status = str(i18n("not running"))
except KeyError:
if os.path.isfile(os.path.join('/var/run',self.filename + '.pid')):
- self.status = unicode(i18n("running"))
+ self.status = str(i18n("running"))
else:
- self.status = unicode(i18n("not running"))
+ self.status = str(i18n("not running"))
self.gotStatus = True
############################################################################
@@ -546,7 +546,7 @@ class DebianServiceContext(ServiceContext):
shell_output.close()
cur_runlevel = raw_runlevel[2:-1]
- for num in deb_runlevels.keys():
+ for num in list(deb_runlevels.keys()):
if cur_runlevel.isdigit():
if num == int(cur_runlevel):
self.__currentrunlevel = DebianRunLevel(self, num, deb_runlevels[num])
@@ -554,11 +554,11 @@ class DebianServiceContext(ServiceContext):
else:
self.runlevels.append(DebianRunLevel(self, num, deb_runlevels[num]))
else:
- if num == cur_runlevel:
- self.__currentrunlevel = DebianRunLevel(self, num, deb_runlevels[num])
+ if num == cur_runlevel:
+ self.__currentrunlevel = DebianRunLevel(self, num, deb_runlevels[num])
self.runlevels.append(self.__currentrunlevel)
- else:
- self.runlevels.append(DebianRunLevel(self, num, deb_runlevels[num]))
+ else:
+ self.runlevels.append(DebianRunLevel(self, num, deb_runlevels[num]))
self._filenametoservice = {}
########################################################################
@@ -632,22 +632,22 @@ class DebianRunLevel(SysVRunLevel):
#print "Removing symlink, " + linkname + ", the target does not match."
try:
posix.unlink(linkname)
- except OSError, e:
- print "Couldn't remove symlink " + linkname + " :: " + str(e)
+ except OSError as e:
+ print("Couldn't remove symlink " + linkname + " :: " + str(e))
try:
posix.symlink(target, linkname)
#print "Created symlink " + linkname + " -> " + target + " successfully."
os.chdir(odir)
return True
- except OSError, e:
+ except OSError as e:
#print "Creating symlink " + linkname + " -> " + target + " failed: " + str(e)
os.chdir(odir)
return False
def removeSymlink(servicename, runleveldir, KorS):
if KorS not in ('K','S'):
- print "OUCH, symlinks have to start with S or K!"
+ print("OUCH, symlinks have to start with S or K!")
return
for link in os.listdir(runleveldir):
if (link[0] == KorS) and (link[3:] == servicename):
@@ -672,8 +672,8 @@ class DebianRunLevel(SysVRunLevel):
runleveldir = os.path.join(leveldir,"rc"+l_num+".d")
#print "Removing symlink " + s_link
removeSymlink(service.filename, runleveldir, "S")
- except OSError, e:
- print "Could not remove symlink " + s_link + " :: " + str(e)
+ except OSError as e:
+ print("Could not remove symlink " + s_link + " :: " + str(e))
self.activeservices.remove(service)
@@ -698,8 +698,8 @@ class DebianRunLevel(SysVRunLevel):
try:
#print "Removing " + k_link
removeSymlink(service.filename, runleveldir, "K")
- except OSError, e:
- print "Could not remove " + k_link + " :: " + str(e)
+ except OSError as e:
+ print("Could not remove " + k_link + " :: " + str(e))
############################################################################
@@ -746,7 +746,7 @@ class GentooService(DebianService):
else: description_lines.append(line[1:].strip())
fhandle.close()
else:
- print self.path_and_filename + " is no file or does not exist!"
+ print(self.path_and_filename + " is no file or does not exist!")
if len(description_lines):
self.description = "\n".join(description_lines)
@@ -812,7 +812,7 @@ class GentooServiceContext(ServiceContext):
def currentRunLevelNum():
runlevelbin = "/sbin/runlevel"
if not os.path.isfile(runlevelbin):
- print "Couldn't find %s, that sucks. :o" % runlevelbin
+ print("Couldn't find %s, that sucks. :o" % runlevelbin)
sys.exit(1)
shell_output = os.popen(runlevelbin)
raw_runlevel = shell_output.readline()
@@ -877,7 +877,7 @@ class GentooRunLevel(SysVRunLevel):
#self.no_dirs = ('reboot', 'shutdown', 'single')
if self.dirname not in self.no_dirs:
self.no_dirs.append(self.dirname)
- print "Runlevel " + self.leveldir + " is not a valid path. '" + self.dirname + "'"
+ print("Runlevel " + self.leveldir + " is not a valid path. '" + self.dirname + "'")
self.leveldir = False
return
@@ -885,7 +885,7 @@ class GentooRunLevel(SysVRunLevel):
def loadInfo(self):
""" Only look up active services if runlevel path exists, else leave empty. """
if self.leveldir:
- print "GentooRunLevel.loadInfo() from " + self.leveldir
+ print("GentooRunLevel.loadInfo() from " + self.leveldir)
for filename in os.listdir(self.leveldir):
# Exclude backup files from portage and .sh files like shutdown, depscan, etc.
if (filename.find('._cfg')<0) and not filename.endswith('.sh'):
@@ -895,9 +895,9 @@ class GentooRunLevel(SysVRunLevel):
if target in self.context._filenametoservice:
self.activeservices.append(self.context._filenametoservice[target])
else:
- print "Couldn't find service '%s'. " % target
+ print("Couldn't find service '%s'. " % target)
else:
- print "%s is not a valid symlink." % linkname
+ print("%s is not a valid symlink." % linkname)
########################################################################
def setActiveAtBoot(self,service,activeflag):
@@ -908,18 +908,18 @@ class GentooRunLevel(SysVRunLevel):
# FIXME :: "Start at Boot" column does not properly get updated once it's "False".
# The commands issued might better be passed through via CommandRunner.
if self.name in self.no_dirs:
- print "Runlevel has no corresponding path, running rc-update anyway."
+ print("Runlevel has no corresponding path, running rc-update anyway.")
if activeflag:
if not service in self.activeservices:
rc_add_cmd = "rc-update add %s %s" % (service.filename, self.dirname)
- print rc_add_cmd
+ print(rc_add_cmd)
# The brave really run it yet.
os.system(rc_add_cmd)
self.activeservices.append(service)
else:
if service in self.activeservices:
rc_del_cmd = "rc-update del %s %s" % (service.filename, self.dirname)
- print rc_del_cmd
+ print(rc_del_cmd)
# The brave really run it yet.
os.system(rc_dell_cmd)
self.activeservices.remove(service)
@@ -1194,7 +1194,7 @@ class SysVInitApp(programbase):
return
self.updatingGUI = True
- for service in self.servicestolistitems.keys():
+ for service in list(self.servicestolistitems.keys()):
if self.servicestolistitems[service] is item:
self.selectedservice = service
self.__selectService(self.selectedservice)
@@ -1440,13 +1440,13 @@ class CommandRunner(KDialogBase):
uncolor = lambda text: re.compile('\\x1b\[[0-9]+;01m').sub("", \
re.compile('\\x1b\[0m').sub("", re.compile('\\033\[1;[0-9]+m').sub("", \
re.compile('\\033\[0m').sub("", text))))
- self.output += uncolor(unicode(self.kid.readStdout()))
+ self.output += uncolor(str(self.kid.readStdout()))
self.outputtextview.setText(self.output)
self.outputtextview.ensureVisible(0,self.outputtextview.contentsHeight())
########################################################################
def slotReadyReadStderr(self):
- self.output += unicode(self.kid.readStderr())
+ self.output += str(self.kid.readStderr())
self.outputtextview.setText(self.output)
self.outputtextview.ensureVisible(0,self.outputtextview.contentsHeight())
diff --git a/uninstall_rude.py b/uninstall_rude.py
index 9e0c435..5f43e9d 100644
--- a/uninstall_rude.py
+++ b/uninstall_rude.py
@@ -1,5 +1,5 @@
import os
fhandle = open("install_log.txt","r")
for line in fhandle.readlines():
- print "deleting ", line[:-1]
+ print("deleting ", line[:-1])
os.system("rm -f "+line[:-1])
diff --git a/userconfig/unixauthdb.py b/userconfig/unixauthdb.py
index 92ffcc8..e2e80c1 100755
--- a/userconfig/unixauthdb.py
+++ b/userconfig/unixauthdb.py
@@ -37,7 +37,7 @@ def createTempFile(origfile):
try:
ret = tempfile.mkstemp(prefix=tmp_prefix, dir=tmp_dir)
except:
- raise IOError, "Unable to create a new temporary file for " + origfile
+ raise IOError("Unable to create a new temporary file for " + origfile)
(fd, tmpfile) = ret
shutil.copymode(origfile, tmpfile)
os.chown(tmpfile, origstat.st_uid, origstat.st_gid)
@@ -68,18 +68,18 @@ def getContext(editmode=False):
try:
if os.environ["USERCONFIG_USES_LDAP"].lower() == "true":
use_ldap = True
- except KeyError,e:
+ except KeyError as e:
use_ldap = False
if not use_ldap:
return PwdContext(editmode)
else:
- print "==================================================================="
- print "Warning:"
- print "\tYou are using LDAP as backend. This feature is under development"
- print "\tand it is currently not recommended to use it."
- print "\tIf you do not want to use LDAP as backend, set the environmental"
- print "\tvariabale 'USERCONFIG_USES_LDAP' to 'False'."
- print "==================================================================="
+ print("===================================================================")
+ print("Warning:")
+ print("\tYou are using LDAP as backend. This feature is under development")
+ print("\tand it is currently not recommended to use it.")
+ print("\tIf you do not want to use LDAP as backend, set the environmental")
+ print("\tvariabale 'USERCONFIG_USES_LDAP' to 'False'.")
+ print("===================================================================")
return LdapContext(editmode)
###########################################################################
@@ -117,9 +117,9 @@ class Context(object):
newuserobj = self._createUser()
if defaults:
if systemuser:
- r = xrange(0,self.last_system_uid)
+ r = range(0,self.last_system_uid)
else:
- r = xrange(self.first_uid,self.last_uid)
+ r = range(self.first_uid,self.last_uid)
for candiate in r:
for u in self._users:
if u.getUID()==candiate:
@@ -128,13 +128,13 @@ class Context(object):
newuserobj.setUID(candiate)
break
- if self.lookupUsername(u'new_user') is None:
- newuserobj.setUsername(u'new_user')
+ if self.lookupUsername('new_user') is None:
+ newuserobj.setUsername('new_user')
else:
i = 1
while 1:
- if self.lookupUsername(u'new_user_'+str(i)) is None:
- newuserobj.setUsername(u'new_user_'+str(i))
+ if self.lookupUsername('new_user_'+str(i)) is None:
+ newuserobj.setUsername('new_user_'+str(i))
break
i += 1
return newuserobj
@@ -155,7 +155,7 @@ class Context(object):
try:
self._groups.remove("new_user")
except ValueError:
- print "no user removed"
+ print("no user removed")
pass
return self._groups[:]
@@ -180,9 +180,9 @@ class Context(object):
newgroupobj = self._createGroup()
if defaults:
if systemgroup:
- r = xrange(0,self.last_system_gid)
+ r = range(0,self.last_system_gid)
else:
- r = xrange(self.first_gid,self.last_gid)
+ r = range(self.first_gid,self.last_gid)
for candiate in r:
for u in self._groups:
if u.getGID()==candiate:
@@ -190,19 +190,19 @@ class Context(object):
else:
newgroupobj.setGID(candiate)
break
- if self.lookupGroupname(u'new_group') is None:
- newgroupobj.setGroupname(u'new_group')
+ if self.lookupGroupname('new_group') is None:
+ newgroupobj.setGroupname('new_group')
else:
i = 1
while 1:
- if self.lookupGroupname(u'new_user_'+str(i)) is None:
- newgroupobj.setGroupname(u'new_user_'+str(i))
+ if self.lookupGroupname('new_user_'+str(i)) is None:
+ newgroupobj.setGroupname('new_user_'+str(i))
break
i += 1
return newgroupobj
def _createGroup(self):
- raise NotImplementedError, "Context.newGroup()"
+ raise NotImplementedError("Context.newGroup()")
def addUser(self,userobj):
"""Adds the given user to the authorisation database.
@@ -308,7 +308,7 @@ class Context(object):
fhandle = codecs.open('/etc/shells','r',locale.getpreferredencoding())
for l in fhandle.readlines():
# TODO: strangely this lets some comented lines slip through
- if len(l.strip()) > 1 and l.strip()[0] is not "#":
+ if len(l.strip()) > 1 and l.strip()[0] != "#":
# Only show existing shells
if os.path.isfile(l.strip()):
self._shells.append(l.strip())
@@ -321,11 +321,11 @@ class Context(object):
After a successful save, any changes to the Context will be reflected
system wide.
"""
- raise NotImplementedError, "Context.save()"
+ raise NotImplementedError("Context.save()")
def createHomeDirectory(self,userobj):
if os.path.exists(userobj.getHomeDirectory()):
- raise IOError, u"Home directory %s already exists." % userobj.getHomeDirectory()
+ raise IOError("Home directory %s already exists." % userobj.getHomeDirectory())
# Copy the skeleton directory over
shutil.copytree(self._getSkeletonDirectory(),userobj.getHomeDirectory(),True)
@@ -348,26 +348,26 @@ class Context(object):
shutil.rmtree(userobj.getHomeDirectory())
def _createUser(self):
- raise NotImplementedError, "Context._createUser()"
+ raise NotImplementedError("Context._createUser()")
def _sanityCheck(self):
userids = []
for u in self._users:
if isinstance(u,UnixUser)==False:
- raise TypeError,"Found an object in the list of users that is not a UnixUser object."
+ raise TypeError("Found an object in the list of users that is not a UnixUser object.")
uid = u.getUID()
if uid in userids:
- raise ValueError, "User ID %i appears more than once." % uid
+ raise ValueError("User ID %i appears more than once." % uid)
userids.append(uid)
u._sanityCheck()
groupids = []
for g in self._groups:
if isinstance(g,UnixGroup)==False:
- raise TypeError,"Found an object in the list of groups that is not a UnixGroup object."
+ raise TypeError("Found an object in the list of groups that is not a UnixGroup object.")
gid = g.getGID()
if gid in groupids:
- raise ValueError, "Group ID %i appears more than once." % gid
+ raise ValueError("Group ID %i appears more than once." % gid)
groupids.append(gid)
g._sanityCheck()
@@ -447,7 +447,7 @@ class Context(object):
self.dir_mode = int(self.defaults["DIR_MODE"],8)
except (KeyError,ValueError):
self.dir_mode = int("0755",8)
- print "Didn't read default DIR_MODE"
+ print("Didn't read default DIR_MODE")
try:
self.dhome = self.defaults["DHOME"]
@@ -496,11 +496,11 @@ class UnixUser(object):
new_group = self._context.newGroup()
new_group.setGID(self._gid)
- new_group_name = u"group%i" % self._gid
+ new_group_name = "group%i" % self._gid
i = 0
while self._context.lookupGroupname(new_group_name) is not None:
i += 1
- new_group_name = u"group%i_%i" % (self._gid,i)
+ new_group_name = "group%i_%i" % (self._gid,i)
new_group.setGroupname(new_group_name)
self._context.addGroup(new_group)
@@ -526,7 +526,7 @@ class UnixUser(object):
"""
uid = int(uid)
if uid<0:
- raise ValueError, "User ID (%i) is a negative number." % uid
+ raise ValueError("User ID (%i) is a negative number." % uid)
self._uid = uid
def isSystemUser(self):
@@ -642,9 +642,9 @@ class UnixUser(object):
def _sanityCheck(self):
if self._primarygroup is None:
- raise ValueError,"Userobj has no primary group!"
+ raise ValueError("Userobj has no primary group!")
if self._uid is None:
- raise ValueError,"Userobj has no UID!"
+ raise ValueError("Userobj has no UID!")
###########################################################################
class UnixGroup(object):
@@ -722,7 +722,7 @@ class PwdContext(Context):
# Read in the password file
fhandle = codecs.open(passwordfile,'r',locale.getpreferredencoding())
if LockFDRead(fhandle.fileno())==False:
- raise IOError,"Unable to lock the "+passwordfile+" file."
+ raise IOError("Unable to lock the "+passwordfile+" file.")
try:
for line in fhandle.readlines():
if line.strip()!="":
@@ -736,7 +736,7 @@ class PwdContext(Context):
# Read the group file
fhandle = codecs.open(groupfile,'r',locale.getpreferredencoding())
if LockFDRead(fhandle.fileno())==False:
- raise IOError,"Unable to lock the "+groupfile+" file."
+ raise IOError("Unable to lock the "+groupfile+" file.")
try:
for line in fhandle.readlines():
if line.strip()!="":
@@ -751,7 +751,7 @@ class PwdContext(Context):
# Load up the info from the shadow file too.
fhandle = codecs.open(shadowfile,'r',locale.getpreferredencoding())
if LockFDRead(fhandle.fileno())==False:
- raise IOError,"Unable to lock the "+shadowfile+" file."
+ raise IOError("Unable to lock the "+shadowfile+" file.")
try:
for line in fhandle.readlines():
if line.strip()!="":
@@ -762,7 +762,7 @@ class PwdContext(Context):
userobj = self.lookupUsername(username)
if userobj is not None:
if encpass=="":
- encpass = u"*"
+ encpass = "*"
userobj._encpass = encpass
if userobj._encpass[0]=='!':
userobj._islocked = True
@@ -770,7 +770,7 @@ class PwdContext(Context):
else:
userobj._islocked = False
# FIXME : set time
- if passlastchange and passlastchange!=u"None":
+ if passlastchange and passlastchange!="None":
userobj._passlastchange = int(passlastchange)
else:
passlastchange = 0
@@ -804,14 +804,14 @@ class PwdContext(Context):
else:
userobj._passexpiredisabledays = int(passexpiredisabledays)
- if disableddays=="" or disableddays==u"99999":
+ if disableddays=="" or disableddays=="99999":
userobj._disableddays = None
else:
userobj._disableddays = int(disableddays)
userobj._reserve = reserve
else:
- print "Couldn't find",username
+ print("Couldn't find",username)
except ValueError:
pass
finally:
@@ -831,7 +831,7 @@ class PwdContext(Context):
def save(self):
if self.__editmode==False:
- raise IOError, "Can't save, the context was created Read only."
+ raise IOError("Can't save, the context was created Read only.")
self._sanityCheck()
@@ -845,7 +845,7 @@ class PwdContext(Context):
# Update the passwd file
passwordlock = os.open(self.__passwordfile, os.O_WRONLY) # FIXME encoding
if LockFDWrite(passwordlock)==False:
- raise IOError,"Couldn't get a write lock on "+self.__passwordfile
+ raise IOError("Couldn't get a write lock on "+self.__passwordfile)
try:
os.rename(tmpname, self.__passwordfile)
finally:
@@ -864,7 +864,7 @@ class PwdContext(Context):
# Update the group file.
grouplock = os.open(self.__groupfile, os.O_WRONLY)
if LockFDWrite(grouplock)==False:
- raise IOError,"Couldn't get write lock on "+self.__groupfile
+ raise IOError("Couldn't get write lock on "+self.__groupfile)
try:
os.rename(tmpname, self.__groupfile)
finally:
@@ -887,7 +887,7 @@ class PwdContext(Context):
shadowlock = os.open(self.__shadowfile, os.O_WRONLY)
if LockFDWrite(shadowlock)==False:
- raise IOError,"Couldn't get write lock on "+self.__shadowfile
+ raise IOError("Couldn't get write lock on "+self.__shadowfile)
try:
os.rename(tmpname, self.__shadowfile)
finally:
@@ -917,7 +917,7 @@ class LdapContext(Context):
self.editmode = editmode
if not self.editmode:
self.ldapserver.simple_bind("admin",admin_pass)
- print "Connected to ", self.url
+ print("Connected to ", self.url)
self._users = self._getUsers()
@@ -925,7 +925,7 @@ class LdapContext(Context):
""" Retrieve a list of users from the LDAP server.
"""
_users = []
- print "LdapContext._getUsers"
+ print("LdapContext._getUsers")
searchScope = ldap.SCOPE_SUBTREE
retrieveAttributes = None
searchFilter = "cn=*"
@@ -942,11 +942,11 @@ class LdapContext(Context):
#print " --------------------- "
result_set.append(result_data[0][1])
#print result_set
- except ldap.LDAPError, e:
- print "ERROR: ",e
+ except ldap.LDAPError as e:
+ print("ERROR: ",e)
if len(result_set) == 0:
- print "No Results."
+ print("No Results.")
return
count = 0
"""
@@ -975,12 +975,12 @@ class LdapContext(Context):
new_user.setLoginShell(loginshell)
new_user.setUsername(login)
_users.append(new_user)
- print "Number of Users:", len(self._users)
+ print("Number of Users:", len(self._users))
- except KeyError, e:
+ except KeyError as e:
# Debugging output...
- print "ERR:: ",e
- print 'err:: ',entry
+ print("ERR:: ",e)
+ print('err:: ',entry)
return _users
def _createUser(self):
@@ -990,7 +990,7 @@ class LdapContext(Context):
return LdapGroup(self)
def save(self):
- print "LdapContext.save() does nothing yet."
+ print("LdapContext.save() does nothing yet.")
###########################################################################
class LdapUser(UnixUser):
@@ -1010,7 +1010,7 @@ class LdapGroup(UnixGroup):
class PwdUser(UnixUser):
def __init__(self,context):
UnixUser.__init__(self,context)
- self._reserve = u""
+ self._reserve = ""
def _initString(self,line):
(self._username,x,self._uid,self._gid,self._gecos,self._homedirectory, \
@@ -1019,17 +1019,17 @@ class PwdUser(UnixUser):
self._gid = int(self._gid)
def _getPasswdEntry(self):
- return u":".join( [self._username,
- u"x",
- unicode(self._uid),
- unicode(self._primarygroup.getGID()),
+ return ":".join( [self._username,
+ "x",
+ str(self._uid),
+ str(self._primarygroup.getGID()),
self._gecos,
self._homedirectory,
- self._loginshell ] ) + u"\n"
+ self._loginshell ] ) + "\n"
def _getShadowEntry(self):
if self._islocked:
- encpass = u'!' + self._encpass
+ encpass = '!' + self._encpass
else:
encpass = self._encpass
@@ -1039,41 +1039,41 @@ class PwdUser(UnixUser):
passminimumagebeforechange = str(self._passminimumagebeforechange)
if self._passmaximumage==None:
- passmaximumage = u"99999"
+ passmaximumage = "99999"
else:
- passmaximumage = unicode(self._passmaximumage)
+ passmaximumage = str(self._passmaximumage)
if self._disableddays==None:
- disableddays = u""
+ disableddays = ""
else:
- disableddays = unicode(self._disableddays)
+ disableddays = str(self._disableddays)
if self._passexpiredisabledays==None:
- passexpiredisabledays = u""
+ passexpiredisabledays = ""
else:
- passexpiredisabledays = unicode(self._passexpiredisabledays)
+ passexpiredisabledays = str(self._passexpiredisabledays)
if self._passexpirewarn==None:
- passexpirewarn = u""
+ passexpirewarn = ""
else:
- passexpirewarn = unicode(self._passexpirewarn)
+ passexpirewarn = str(self._passexpirewarn)
- return u":".join( [self._username,
+ return ":".join( [self._username,
encpass,
- unicode(self._passlastchange),
+ str(self._passlastchange),
passminimumagebeforechange,
passmaximumage,
passexpirewarn,
passexpiredisabledays,
disableddays,
- self._reserve ])+ u"\n"
+ self._reserve ])+ "\n"
###########################################################################
class PwdGroup(UnixGroup):
def __init__(self,context):
UnixGroup.__init__(self,context)
- self._memberids = u""
- self._encpass = u""
+ self._memberids = ""
+ self._encpass = ""
def _initString(self,line):
(self._groupname,self._encpass,self._gid,self._memberids) = tuple(line.strip().split(":"))
@@ -1087,10 +1087,10 @@ class PwdGroup(UnixGroup):
self._members.append(userobj)
def _getGroupFileEntry(self):
- return u":".join( [ self._groupname,
+ return ":".join( [ self._groupname,
self._encpass,
- unicode(self._gid),
- u",".join([u.getUsername() for u in self._members if u.getPrimaryGroup() is not self])]) + u"\n"
+ str(self._gid),
+ ",".join([u.getUsername() for u in self._members if u.getPrimaryGroup() is not self])]) + "\n"
###########################################################################
def LockFDRead(fd):
@@ -1121,34 +1121,34 @@ def UnlockFD(fd):
###########################################################################
if __name__=='__main__':
- print "Testing"
+ print("Testing")
context = getContext(True)
- print "Stopping here..."
+ print("Stopping here...")
#import sys
#sys.exit(0) ## Remove.
#print "Users:"
#for user in context.getUsers():
for user in context._users:
- print "--------------------------------------------------"
- print "UID:",user.getUID()
- print "Is system user:",user.isSystemUser()
- print "Username:",user.getUsername()
- print "Primary Group:",str(user.getPrimaryGroup())
- print "Groups:",[str(u) for u in user.getGroups()]
- print "Is locked:",user.isLocked()
- print "Real name:",user.getRealName()
- print "Home Dir:",user.getHomeDirectory()
- print "Maximum password age:",user.getMaximumPasswordAge()
- print "Minimum password age before change:",user.getMinimumPasswordAgeBeforeChange()
- print "Expire warning:",user.getPasswordExpireWarning()
- print "Disable after Expire:",user.getPasswordDisableAfterExpire()
+ print("--------------------------------------------------")
+ print("UID:",user.getUID())
+ print("Is system user:",user.isSystemUser())
+ print("Username:",user.getUsername())
+ print("Primary Group:",str(user.getPrimaryGroup()))
+ print("Groups:",[str(u) for u in user.getGroups()])
+ print("Is locked:",user.isLocked())
+ print("Real name:",user.getRealName())
+ print("Home Dir:",user.getHomeDirectory())
+ print("Maximum password age:",user.getMaximumPasswordAge())
+ print("Minimum password age before change:",user.getMinimumPasswordAgeBeforeChange())
+ print("Expire warning:",user.getPasswordExpireWarning())
+ print("Disable after Expire:",user.getPasswordDisableAfterExpire())
#print user._getPasswdEntry()
- print "Groups"
+ print("Groups")
for group in context.getGroups():
- print str(group)
+ print(str(group))
#print group._getGroupFileEntry()
- print "Saving"
+ print("Saving")
context.save()
diff --git a/userconfig/userconfig.py b/userconfig/userconfig.py
index fb47f57..9ef5bdc 100755
--- a/userconfig/userconfig.py
+++ b/userconfig/userconfig.py
@@ -315,12 +315,12 @@ class UserConfigApp(programbase):
cmenu.setItemEnabled(1,False)
cmenu.exec_loop(p)
- #######################################################################
+ #######################################################################
def sizeHint(self):
global programbase
size_hint = programbase.sizeHint(self)
# Just make the dialog a little shorter by default.
- size_hint.setHeight(size_hint.height()-200)
+ size_hint.setHeight(size_hint.height()-200)
return size_hint
#######################################################################
@@ -439,7 +439,7 @@ class UserConfigApp(programbase):
for userobj in users:
uid = userobj.getUID()
if self.showsystemaccounts or not userobj.isSystemUser():
- lvi = TDEListViewItem(self.userlist,userobj.getUsername(),userobj.getRealName(),unicode(uid))
+ lvi = TDEListViewItem(self.userlist,userobj.getUsername(),userobj.getRealName(),str(uid))
if userobj.isLocked():
lvi.setPixmap(0,UserIcon("hi16-encrypted"))
self.useridsToListItems[uid] = lvi
@@ -457,7 +457,7 @@ class UserConfigApp(programbase):
userobj = self.admincontext.lookupUID(userid)
lvi.setText(0,userobj.getUsername())
lvi.setText(1,userobj.getRealName())
- lvi.setText(2,unicode(userobj.getUID()))
+ lvi.setText(2,str(userobj.getUID()))
if userobj.isLocked():
lvi.setPixmap(0,UserIcon("hi16-encrypted"))
else:
@@ -477,7 +477,7 @@ class UserConfigApp(programbase):
username = userobj.getUsername()
self.loginnamelabel.setText(username)
self.realnamelabel.setText(userobj.getRealName())
- self.uidlabel.setText(unicode(userid))
+ self.uidlabel.setText(str(userid))
if userobj.isLocked():
self.statuslabel.setText(i18n("Disabled"))
else:
@@ -490,7 +490,7 @@ class UserConfigApp(programbase):
# Secondary Groups
secondarygroups = [g.getGroupname() for g in userobj.getGroups() if g is not userobj.getPrimaryGroup()]
- self.secondarygrouplabel.setText(unicode(i18n(", ")).join(secondarygroups))
+ self.secondarygrouplabel.setText(str(i18n(", ")).join(secondarygroups))
if isroot:
self.deletebutton.setDisabled(userobj.getUID()==0)
@@ -505,7 +505,7 @@ class UserConfigApp(programbase):
for groupobj in groups:
gid = groupobj.getGID()
if self.showsystemgroups or not groupobj.isSystemGroup():
- lvi = TQListViewItem(self.grouplist,groupobj.getGroupname(),unicode(gid))
+ lvi = TQListViewItem(self.grouplist,groupobj.getGroupname(),str(gid))
self.groupidsToListItems[gid] = lvi
if self.selectedgroupid==gid:
firstselectedgroupid = gid
@@ -528,7 +528,7 @@ class UserConfigApp(programbase):
self.groupmemberlist.clear()
for userobj in members:
if userobj!=None:
- lvi = TQListViewItem(self.groupmemberlist,userobj.getUsername(),userobj.getRealName(),unicode(userobj.getUID()))
+ lvi = TQListViewItem(self.groupmemberlist,userobj.getUsername(),userobj.getRealName(),str(userobj.getUID()))
if isroot:
self.deletegroupbutton.setDisabled(groupobj.getGID()==0)
@@ -563,7 +563,7 @@ class UserConfigApp(programbase):
def save(self):
pass
def defaults(self):
- pass
+ pass
def sysdefaults(self):
pass
@@ -578,28 +578,28 @@ class UserConfigApp(programbase):
# Rudd-O convenience class to map groups to privilege names
class PrivilegeNames(dict):
- """Convenience dict-derived class: map known secondary groups to privilege names, provide default mapping for groups that do not have a description. This could be replaced by a simple dict() but I simply preferred the class declaration.
-
- FIXME This should ideally be included in a more general module so it can be reused."""
-
- def __init__(self):
- dict.__init__(self, {
- "plugdev":i18n("Access external storage devices automatically"),
- "adm":i18n("Administer the system"),
- "ltsp":i18n("Allow use of FUSE filesystems like LTSP thin client block devices"),
- "dialout":i18n("Connect to the Internet using a modem"),
- "syslog":i18n("Monitor system logs"),
- "fax":i18n("Send and receive faxes"),
- "cdrom":i18n("Use CD-ROM and DVD drives"),
- "floppy":i18n("Use floppy drives"),
- "modem":i18n("Use modems"),
- "scanner":i18n("Use scanners"),
- })
-
- def __getitem__(self,name):
- # This is cruft but I couldn't bring myself to kill it bua!
- if name in self: return dict.__getitem__(self,name)
- return i18n("Be a member of the %s group")%name
+ """Convenience dict-derived class: map known secondary groups to privilege names, provide default mapping for groups that do not have a description. This could be replaced by a simple dict() but I simply preferred the class declaration.
+
+ FIXME This should ideally be included in a more general module so it can be reused."""
+
+ def __init__(self):
+ dict.__init__(self, {
+ "plugdev":i18n("Access external storage devices automatically"),
+ "adm":i18n("Administer the system"),
+ "ltsp":i18n("Allow use of FUSE filesystems like LTSP thin client block devices"),
+ "dialout":i18n("Connect to the Internet using a modem"),
+ "syslog":i18n("Monitor system logs"),
+ "fax":i18n("Send and receive faxes"),
+ "cdrom":i18n("Use CD-ROM and DVD drives"),
+ "floppy":i18n("Use floppy drives"),
+ "modem":i18n("Use modems"),
+ "scanner":i18n("Use scanners"),
+ })
+
+ def __getitem__(self,name):
+ # This is cruft but I couldn't bring myself to kill it bua!
+ if name in self: return dict.__getitem__(self,name)
+ return i18n("Be a member of the %s group")%name
class UserEditDialog(KDialogBase):
def __init__(self,parent,admincontext):
@@ -637,7 +637,7 @@ class UserEditDialog(KDialogBase):
hbox.setStretchFactor(self.disabledradio,0)
label = TQLabel(hbox)
label.setPixmap(UserIcon("hi16-encrypted"))
- hbox.setStretchFactor(label,1)
+ hbox.setStretchFactor(label,1)
infogrid.addWidget(hbox,1,1)
self.enabledradiogroup.insert(self.enabledradio,0)
@@ -691,19 +691,19 @@ class UserEditDialog(KDialogBase):
infogrid.addWidget(self.shelledit,8,1)
# Rudd-O rules. Not so much, but enough to rule.
- # yeah it's not my finest hour, but it works like a charm over here. Please feel free to clean up dead code that I commented
- # I extend my deepest thanks to the people that have worked hard to construct this tool in the first place. I have no idea who the authors and contributors are, but it would make sense to have all the contributors listed on top of the file.
- # Privileges and groups tab
+ # yeah it's not my finest hour, but it works like a charm over here. Please feel free to clean up dead code that I commented
+ # I extend my deepest thanks to the people that have worked hard to construct this tool in the first place. I have no idea who the authors and contributors are, but it would make sense to have all the contributors listed on top of the file.
+ # Privileges and groups tab
groupsvbox = self.addHBoxPage(i18n("Privileges and groups"))
- # Rudd-O now here we create the widget that will hold the group listing, and fill it with the groups.
+ # Rudd-O now here we create the widget that will hold the group listing, and fill it with the groups.
self.privilegeslistview = TQListView(groupsvbox)
- self.privilegeslistview.addColumn(i18n("Privilege"),-1)
+ self.privilegeslistview.addColumn(i18n("Privilege"),-1)
self.groupslistview = TQListView(groupsvbox)
- self.groupslistview.addColumn(i18n("Secondary group"),-1)
- groupsvbox.setStretchFactor(self.privilegeslistview,3)
- groupsvbox.setStretchFactor(self.groupslistview,2)
-
+ self.groupslistview.addColumn(i18n("Secondary group"),-1)
+ groupsvbox.setStretchFactor(self.privilegeslistview,3)
+ groupsvbox.setStretchFactor(self.groupslistview,2)
+
# Password and Security Tab.
passwordvbox = self.addVBoxPage(i18n("Password && Security"))
@@ -771,7 +771,7 @@ class UserEditDialog(KDialogBase):
self.connect(self.forcepasswordchangecheckbox,SIGNAL("toggled(bool)"),self.slotForcePasswordChangeToggled)
passwordaginggrid.addWidget(self.forcepasswordchangecheckbox,0,0)
label = TQLabel(i18n("Require new password after:"),passwordagingwidget)
- passwordaginggrid.addWidget(label,0,1)
+ passwordaginggrid.addWidget(label,0,1)
self.maximumpasswordedit = TQSpinBox(passwordagingwidget)
self.maximumpasswordedit.setSuffix(i18n(" days"))
self.maximumpasswordedit.setMinValue(1)
@@ -816,25 +816,25 @@ class UserEditDialog(KDialogBase):
self.updatingGUI = False
def _repopulateGroupsPrivileges(self,excludegroups=None):
- # needs listviews to be constructed. Expects a list of PwdGroups to be excluded
-
- # rehash everything
- self.privilegeslistview.clear()
- self.groupslistview.clear()
- self.secondarygroupcheckboxes = {}
- pn = PrivilegeNames()
-
- if excludegroups: excludegroups = [ g.getGroupname() for g in excludegroups ]
- else: excludegroups = []
- for group in [g.getGroupname() for g in self.admincontext.getGroups()]:
- if group in excludegroups: continue
- if group in pn:
- name = i18n(unicode(pn[group]).encode(locale.getpreferredencoding()))
- wid = self.privilegeslistview
- else:
- name = unicode(group).encode(locale.getpreferredencoding())
- wid = self.groupslistview
- self.secondarygroupcheckboxes[group] = TQCheckListItem(wid,name,TQCheckListItem.CheckBox)
+ # needs listviews to be constructed. Expects a list of PwdGroups to be excluded
+
+ # rehash everything
+ self.privilegeslistview.clear()
+ self.groupslistview.clear()
+ self.secondarygroupcheckboxes = {}
+ pn = PrivilegeNames()
+
+ if excludegroups: excludegroups = [ g.getGroupname() for g in excludegroups ]
+ else: excludegroups = []
+ for group in [g.getGroupname() for g in self.admincontext.getGroups()]:
+ if group in excludegroups: continue
+ if group in pn:
+ name = i18n(str(pn[group]).encode(locale.getpreferredencoding()))
+ wid = self.privilegeslistview
+ else:
+ name = str(group).encode(locale.getpreferredencoding())
+ wid = self.groupslistview
+ self.secondarygroupcheckboxes[group] = TQCheckListItem(wid,name,TQCheckListItem.CheckBox)
########################################################################
def showEditUser(self,userid):
@@ -845,14 +845,14 @@ class UserEditDialog(KDialogBase):
self.passwordedit.erase()
self.selectedgroups = [g.getGroupname() for g in self.userobj.getGroups()
if g is not self.userobj.getPrimaryGroup()]
-
- # Rudd-O: now here we tick the appropriate group listing checkbox, and hide the currently active primary group of the user. We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
- self._repopulateGroupsPrivileges(excludegroups=[self.userobj.getPrimaryGroup()])
- for group,checkbox in self.secondarygroupcheckboxes.items():
- if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
- else: checkbox.setState(TQCheckListItem.Off)
-
- self.originalgroups = self.selectedgroups[:]
+
+ # Rudd-O: now here we tick the appropriate group listing checkbox, and hide the currently active primary group of the user. We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
+ self._repopulateGroupsPrivileges(excludegroups=[self.userobj.getPrimaryGroup()])
+ for group,checkbox in list(self.secondarygroupcheckboxes.items()):
+ if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
+ else: checkbox.setState(TQCheckListItem.Off)
+
+ self.originalgroups = self.selectedgroups[:]
self.selectedgroups.sort()
self.__syncGUI()
self.uidedit.setReadOnly(True)
@@ -864,18 +864,18 @@ class UserEditDialog(KDialogBase):
if self.passwordedit.password()!="":
self.userobj.setPassword(self.passwordedit.password())
# Update the groups for this user object. Rudd-O here's when you go in, stud.
- # we collect the selected groups
- self.selectedgroups = [ group for group,checkbox in self.secondarygroupcheckboxes.items() if checkbox.isOn() ]
+ # we collect the selected groups
+ self.selectedgroups = [ group for group,checkbox in list(self.secondarygroupcheckboxes.items()) if checkbox.isOn() ]
for g in self.userobj.getGroups(): # this seems wasteful to remove the user from all groups then re-add, why not a cross check?
self.userobj.removeFromGroup(g)
for gn in self.selectedgroups:
self.userobj.addToGroup(self.admincontext.lookupGroupname(gn))
- primarygroupname = unicode(self.primarygroupedit.currentText())
+ primarygroupname = str(self.primarygroupedit.currentText())
self.userobj.setPrimaryGroup(self.admincontext.lookupGroupname(primarygroupname))
- # Enable/Disable the account
+ # Enable/Disable the account
self.userobj.setLocked(self.enabledradiogroup.id(self.enabledradiogroup.selected())!=0)
self.admincontext.save()
@@ -889,17 +889,17 @@ class UserEditDialog(KDialogBase):
self.newgroup.setGroupname(self.__fudgeNewGroupName(self.userobj.getUsername()))
self.userobj.setPrimaryGroup(self.newgroup)
- self.selectedgroups = [ u'dialout',u'cdrom',u'floppy',u'audio',u'video',
- u'plugdev',u'lpadmin',u'scanner']
+ self.selectedgroups = [ 'dialout','cdrom','floppy','audio','video',
+ 'plugdev','lpadmin','scanner']
homedir = self.__fudgeNewHomeDirectory(self.userobj.getUsername())
-
- # Rudd-O FIXME: now here we tick the proper groups that should be allowed. Now it selects what userconfig selected before. FIXME consider adding a drop down that will select the appropriate profile Limited User, Advanced User or Administrator (and see if there is a config file where these profiles can be read). We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
- self._repopulateGroupsPrivileges()
- for group,checkbox in self.secondarygroupcheckboxes.items():
- if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
- else: checkbox.setState(TQCheckListItem.Off)
-
- self.userobj.setHomeDirectory(homedir)
+
+ # Rudd-O FIXME: now here we tick the proper groups that should be allowed. Now it selects what userconfig selected before. FIXME consider adding a drop down that will select the appropriate profile Limited User, Advanced User or Administrator (and see if there is a config file where these profiles can be read). We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
+ self._repopulateGroupsPrivileges()
+ for group,checkbox in list(self.secondarygroupcheckboxes.items()):
+ if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
+ else: checkbox.setState(TQCheckListItem.Off)
+
+ self.userobj.setHomeDirectory(homedir)
self.homediredit.setText(homedir)
shells = self.admincontext.getUserShells()
@@ -909,9 +909,9 @@ class UserEditDialog(KDialogBase):
elif '/bin/bash' in shells:
self.userobj.setLoginShell('/bin/bash')
elif '/bin/sh' in shells:
- self.userobj.setLoginShell('/bin/sh')
+ self.userobj.setLoginShell('/bin/sh')
elif len(shells)!=0:
- self.userobj.setLoginShell(shells[0])
+ self.userobj.setLoginShell(shells[0])
self.__syncGUI()
@@ -944,8 +944,8 @@ class UserEditDialog(KDialogBase):
self.userobj.setPrimaryGroup(newgroup)
# Update the groups for this user object. Rudd-O here's when you go in, stud.
- # we collect the selected groups
- self.selectedgroups = [ group for group,checkbox in self.secondarygroupcheckboxes.items() if checkbox.isOn() ]
+ # we collect the selected groups
+ self.selectedgroups = [ group for group,checkbox in list(self.secondarygroupcheckboxes.items()) if checkbox.isOn() ]
for gn in self.selectedgroups:
self.userobj.addToGroup(self.admincontext.lookupGroupname(gn))
@@ -953,7 +953,7 @@ class UserEditDialog(KDialogBase):
if self.passwordedit.password()!="":
self.userobj.setPassword(self.passwordedit.password())
- # Enable/Disable the account
+ # Enable/Disable the account
self.userobj.setLocked(self.enabledradiogroup.id(self.enabledradiogroup.selected())!=0)
self.admincontext.save()
@@ -972,18 +972,18 @@ class UserEditDialog(KDialogBase):
ok = True
# Sanity check all values.
if self.newusermode:
- newusername = unicode(self.realnameedit.text())
+ newusername = str(self.realnameedit.text())
if self.admincontext.lookupUsername(newusername)!=None:
KMessageBox.sorry(self,i18n("Sorry, you must choose a different user name.\n'%1' is already being used.").arg(newusername))
ok = False
else:
- newuid = int(unicode(self.uidedit.text()))
+ newuid = int(str(self.uidedit.text()))
originaluid = self.userobj.getUID()
if self.admincontext.lookupUID(newuid)!=None:
rc = KMessageBox.questionYesNo(self,i18n("User ID in use"),
i18n("Sorry, the UID %1 is already in use. Should %2 be used instead?").arg(newuid).arg(originaluid))
if rc==KMessageBox.Yes:
- self.uidedit.setValue(unicode(originaluid))
+ self.uidedit.setValue(str(originaluid))
else:
ok = False
else:
@@ -994,7 +994,7 @@ class UserEditDialog(KDialogBase):
########################################################################
def slotLoginChanged(self,text):
- newtext = unicode(text)
+ newtext = str(text)
if not self.updatingGUI:
if self.newusermode:
self.newprimarygroupname = self.__fudgeNewGroupName(newtext)
@@ -1019,7 +1019,7 @@ class UserEditDialog(KDialogBase):
self.loginnameedit.setText(self.userobj.getUsername())
self.realnameedit.setText(self.userobj.getRealName())
- self.uidedit.setText(unicode(self.userobj.getUID()))
+ self.uidedit.setText(str(self.userobj.getUID()))
self.homediredit.setText(self.userobj.getHomeDirectory())
self.shelledit.setCurrentText(self.userobj.getLoginShell())
@@ -1036,7 +1036,7 @@ class UserEditDialog(KDialogBase):
if self.newusermode:
# New user mode
- self.newprimarygroupname = self.__fudgeNewGroupName(unicode(self.userobj.getUsername()))
+ self.newprimarygroupname = self.__fudgeNewGroupName(str(self.userobj.getUsername()))
primarygroupname = self.newprimarygroupname
self.primarygroupedit.insertItem(self.newprimarygroupname)
else:
@@ -1050,7 +1050,7 @@ class UserEditDialog(KDialogBase):
if self.userobj.getExpirationDate() is None:
self.validradiogroup.setButton(0)
self.expiredate.setDisabled(True)
- self.expiredate.setDate(SptimeToQDate(99999L))
+ self.expiredate.setDate(SptimeToQDate(99999))
else:
self.validradiogroup.setButton(1)
self.expiredate.setDisabled(False)
@@ -1097,13 +1097,13 @@ class UserEditDialog(KDialogBase):
########################################################################
def __updateObjectFromGUI(self,userobj):
- username = unicode(self.loginnameedit.text())
+ username = str(self.loginnameedit.text())
userobj.setUsername(username)
- userobj.setRealName(unicode(self.realnameedit.text()))
+ userobj.setRealName(str(self.realnameedit.text()))
- userobj.setHomeDirectory(unicode(self.homediredit.text()))
- userobj.setLoginShell(unicode(self.shelledit.currentText()))
- self.primarygroupname = unicode(self.primarygroupedit.currentText())
+ userobj.setHomeDirectory(str(self.homediredit.text()))
+ userobj.setLoginShell(str(self.shelledit.currentText()))
+ self.primarygroupname = str(self.primarygroupedit.currentText())
groupobj = self.admincontext.lookupGroupname(self.primarygroupname)
if groupobj is not None:
userobj.setPrimaryGroup(groupobj)
@@ -1165,30 +1165,30 @@ class UserEditDialog(KDialogBase):
if self.admincontext.lookupGroupname(basename) is None:
return basename
x = 1
- while self.admincontext.lookupGroupname(basename + u'_' + unicode(x)) is not None:
+ while self.admincontext.lookupGroupname(basename + '_' + str(x)) is not None:
x += 1
- return basename + u'_' + unicode(x)
+ return basename + '_' + str(x)
#######################################################################
def __fudgeNewHomeDirectory(self,origbasename):
basename = origbasename.replace("/","")
if basename=="":
- basename = u"user"
+ basename = "user"
dhome = self.admincontext.dhome
if not os.path.isdir(dhome):
- raise OSError, dhome+" does not exist, is it correctly set in "+ \
- self.admincontext.adduserconf+" ?"
+ raise OSError(dhome+" does not exist, is it correctly set in "+ \
+ self.admincontext.adduserconf+" ?")
else:
# Make sure there's a trailing /
- if dhome[-1] is not '/':
+ if dhome[-1] != '/':
dhome = dhome+'/'
if os.path.exists(dhome+basename)==False:
return dhome+basename
else:
x = 1
- while os.path.exists(dhome+basename + u'_' + unicode(x)):
+ while os.path.exists(dhome+basename + '_' + str(x)):
x += 1
return dhome+basename
@@ -1200,7 +1200,7 @@ class LoginNameValidator(TQValidator):
#######################################################################
def validate(self,inputstr,pos):
- instr = unicode(inputstr)
+ instr = str(inputstr)
if len(instr)==0:
return (TQValidator.Intermediate,pos)
for c in instr:
@@ -1218,7 +1218,7 @@ class LoginNameValidator(TQValidator):
#######################################################################
def fixup(self,inputstr):
- instr = unicode(inputstr)
+ instr = str(inputstr)
newstr = ""
for c in instr:
if (ord(c)<0x20 or ord(c)>0x7f or c.isspace() or c==":" or c=="," or c==".")==False:
@@ -1236,7 +1236,7 @@ class RealUserNameValidator(TQValidator):
#######################################################################
def validate(self,inputstr,pos):
- instr = unicode(inputstr)
+ instr = str(inputstr)
for c in instr:
if c==":":
return (TQValidator.Invalid,pos)
@@ -1252,7 +1252,7 @@ class RealUserNameValidator(TQValidator):
#######################################################################
def fixup(self,inputstr):
- return unicode(inputstr).replace(":","")
+ return str(inputstr).replace(":","")
###########################################################################
class ListPickerDialog(KDialogBase):
@@ -1314,7 +1314,7 @@ class ListPickerDialog(KDialogBase):
if self.exec_loop()==TQDialog.Accepted:
newlist = []
for i in range(self.selectedlist.count()):
- newlist.append(unicode(self.selectedlist.item(i).text()))
+ newlist.append(str(self.selectedlist.item(i).text()))
return newlist
else:
return selectedlist
@@ -1411,7 +1411,7 @@ class UserDeleteDialog(KDialog):
self.connect(cancelbutton,SIGNAL("clicked()"),self.slotCancelClicked)
def deleteUser(self,userid):
- # Setup the
+ # Setup the
userobj = self.admincontext.lookupUID(userid)
self.usernamelabel.setText(i18n("Are you sure want to delete user account '%1' (%2)?").arg(userobj.getUsername()).arg(userobj.getUID()) )
self.deletedirectorycheckbox.setChecked(False)
@@ -1507,7 +1507,7 @@ class OverwriteHomeDirectoryDialog(KDialog):
self.connect(cancelbutton,SIGNAL("clicked()"),self.slotCancelClicked)
def do(self,userobj):
- # Setup the
+ # Setup the
self.toplabel.setText(i18n("The directory '%1' was entered as the home directory for new user '%2'.\n This directory already exists.") \
.arg(userobj.getHomeDirectory()).arg(userobj.getUsername()) )
self.radiogroup.setButton(0)
@@ -1602,7 +1602,7 @@ class GroupEditDialog(KDialogBase):
groupobj = self.admincontext.lookupGID(groupid)
self.groupnamelabel.setText(groupobj.getGroupname())
- self.groupidlabel.setText(unicode(groupid))
+ self.groupidlabel.setText(str(groupid))
availablemembers = [u.getUsername() for u in self.admincontext.getUsers()]
originalmembers = [u.getUsername() for u in groupobj.getUsers()]
@@ -1612,7 +1612,7 @@ class GroupEditDialog(KDialogBase):
if self.exec_loop()==TQDialog.Accepted:
newmembers = []
for i in range(self.selectedlist.count()):
- newmembers.append(unicode(self.selectedlist.item(i).text()))
+ newmembers.append(str(self.selectedlist.item(i).text()))
# Remove from the group object any unselected users.
for member in originalmembers:
@@ -1639,7 +1639,7 @@ class GroupEditDialog(KDialogBase):
groupname = self.groupobj.getGroupname()
self.groupnamelabel.setText(groupname)
self.groupnamelabel.setReadOnly(False)
- self.groupidlabel.setText(unicode(self.groupobj.getGID()))
+ self.groupidlabel.setText(str(self.groupobj.getGID()))
self.groupidlabel.setReadOnly(False)
availablemembers = [u.getUsername() for u in self.admincontext.getUsers()]
@@ -1647,13 +1647,13 @@ class GroupEditDialog(KDialogBase):
self.__updateLists(availablemembers,[])
if self.exec_loop()==TQDialog.Accepted:
- self.groupobj.setGroupname(unicode(self.groupnamelabel.text()))
- newgroupid = int(unicode(self.groupidlabel.text()))
+ self.groupobj.setGroupname(str(self.groupnamelabel.text()))
+ newgroupid = int(str(self.groupidlabel.text()))
self.groupobj.setGID(newgroupid)
newmembers = []
for i in range(self.selectedlist.count()):
- newmembers.append(unicode(self.selectedlist.item(i).text()))
+ newmembers.append(str(self.selectedlist.item(i).text()))
self.admincontext.addGroup(self.groupobj)
@@ -1725,9 +1725,9 @@ class GroupEditDialog(KDialogBase):
if basename not in availablegroups:
return basename
x = 1
- while basename + u'_' + unicode(x) in availablegroups:
+ while basename + '_' + str(x) in availablegroups:
x += 1
- return basename + u'_' + unicode(x)
+ return basename + '_' + str(x)
############################################################################
# Factory function for KControl
@@ -1737,7 +1737,7 @@ def create_userconfig(parent,name):
##########################################################################
def MakeAboutData():
aboutdata = TDEAboutData("guidance", programname, version,
- unicode(i18n("User and Group Configuration Tool")).encode(locale.getpreferredencoding()),
+ str(i18n("User and Group Configuration Tool")).encode(locale.getpreferredencoding()),
TDEAboutData.License_GPL, "Copyright (C) 2003-2007 Simon Edwards")
aboutdata.addAuthor("Simon Edwards", "Developer", "[email protected]", "http://www.simonzone.com/software/")
aboutdata.addAuthor("Sebastian Kügler", "Developer", "[email protected]", "http://vizZzion.org")
diff --git a/wineconfig/firstrunwizard.py b/wineconfig/firstrunwizard.py
index 3b3af81..8d22264 100755
--- a/wineconfig/firstrunwizard.py
+++ b/wineconfig/firstrunwizard.py
@@ -37,7 +37,7 @@ class FirstRunWizard(KWizard):
if not name:
self.setName("firstrunwizard")
- self.imagedir = unicode(TDEGlobal.dirs().findDirs("data","guidance/pics")[0])
+ self.imagedir = str(TDEGlobal.dirs().findDirs("data","guidance/pics")[0])
self.setupPage1()
self.setupPageVersion()
diff --git a/wineconfig/kcm_wineconfig.cpp b/wineconfig/kcm_wineconfig.cpp
index 34e1230..a1f9a69 100644
--- a/wineconfig/kcm_wineconfig.cpp
+++ b/wineconfig/kcm_wineconfig.cpp
@@ -94,7 +94,7 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) {
// Call the factory function. Set up the args.
PyObject *pyParent = PyLong_FromVoidPtr(parent);
- PyObject *pyName = PyString_FromString(MODULE_NAME);
+ PyObject *pyName = PyBytes_FromString(MODULE_NAME);
// Using NN here is effect gives our references to the arguement away.
PyObject *args = Py_BuildValue ("NN", pyParent, pyName);
if(pyName && pyParent && args) {
diff --git a/wineconfig/wineconfig.py b/wineconfig/wineconfig.py
index f2a61ee..b8027ea 100755
--- a/wineconfig/wineconfig.py
+++ b/wineconfig/wineconfig.py
@@ -644,7 +644,7 @@ class DrivesPage(TQWidget):
def slotFolderChanged(self,folder):
""" Change the directory mapping when a new one is entered in the URL box """
- self.drives[self.selecteddriveid][2] = unicode(folder)
+ self.drives[self.selecteddriveid][2] = str(folder)
self.updateChanges()
def slotFolderEdited(self,folder):
@@ -657,7 +657,7 @@ class DrivesPage(TQWidget):
""" Bring up a browse window to choose a ndew mapping directory """
mapping = KFileDialog.getExistingDirectory(wineread.winepath,self,i18n("Drive Mapping"))
if mapping:
- mapping = unicode(mapping)
+ mapping = str(mapping)
self.drives[self.selecteddriveid][2] = mapping
self.updateChanges()
@@ -672,7 +672,7 @@ class DrivesPage(TQWidget):
else:
mapping = KFileDialog.getExistingDirectory(wineread.winepath,self,i18n("Drive Mapping"))
if mapping:
- mapping = unicode(mapping)
+ mapping = str(mapping)
drive[2] = mapping
else:
return
@@ -780,7 +780,7 @@ class DrivesPage(TQWidget):
self.removebutton.setEnabled(False)
- self.infotext1.setText(unicode(i18n("Windows path: ")) + self.drives[driveid][4])
+ self.infotext1.setText(str(i18n("Windows path: ")) + self.drives[driveid][4])
# It seems some old versions of wine didn't store the shell folders in the same place
if self.drives[driveid][5] != self.drives[driveid][4]:
@@ -811,11 +811,11 @@ class DrivesPage(TQWidget):
self.removebutton.setEnabled(True)
if self.drives[driveid][4]:
- self.infotext1.setText(unicode(i18n("Label: ")) + self.drives[driveid][4])
+ self.infotext1.setText(str(i18n("Label: ")) + self.drives[driveid][4])
else:
self.infotext1.setText("")
if self.drives[driveid][5]:
- self.infotext2.setText(unicode(i18n("Serial: ")) + self.drives[driveid][5])
+ self.infotext2.setText(str(i18n("Serial: ")) + self.drives[driveid][5])
else:
self.infotext2.setText("")
@@ -1427,7 +1427,7 @@ class GraphicsPage(TQWidget):
def slotEmuDesktopToggled(self,emudesktop):
if emudesktop:
- self.currentemudesktop = unicode(self.xsizeedit.text()) + 'x' + str(self.ysizeedit.text())
+ self.currentemudesktop = str(self.xsizeedit.text()) + 'x' + str(self.ysizeedit.text())
else:
self.currentemudesktop = ""
self.__setEmuDesktop(self.currentemudesktop)
@@ -1520,64 +1520,64 @@ class GraphicsPage(TQWidget):
############################################################################
class AppearancePage(TQWidget):
- themes = [unicode(i18n("No Theme"))]
- colorschemes = [unicode(i18n("Custom"))]
- sizes = [("NormalSize",unicode(i18n("Normal"))),
- ("LargeSize",unicode(i18n("Large Fonts"))),
- ("ExtraLargeSize",unicode(i18n("Extra Large Fonts")))]
+ themes = [str(i18n("No Theme"))]
+ colorschemes = [str(i18n("Custom"))]
+ sizes = [("NormalSize",str(i18n("Normal"))),
+ ("LargeSize",str(i18n("Large Fonts"))),
+ ("ExtraLargeSize",str(i18n("Extra Large Fonts")))]
# Items for the combo box reference a tuple of dictionaries for color
# and size values and translations for that item
# For example, the value of BorderWidth is
# customizableitems[str(i18n("Window Border"))][1]["BorderWidth"][1]
customizableitems = {"Window Border":
- ({"ActiveBorder":[unicode(i18n("Active Color:")),TQColor()],
- "InactiveBorder":[unicode(i18n("Inactive Color:")),TQColor()]},
- {"BorderWidth":[unicode(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
+ ({"ActiveBorder":[str(i18n("Active Color:")),TQColor()],
+ "InactiveBorder":[str(i18n("Inactive Color:")),TQColor()]},
+ {"BorderWidth":[str(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
"Title Bar":
- ({"ActiveTitle":[unicode(i18n("Active Color:")),TQColor()],
- "GradientActiveTitle":[unicode(i18n("Gradient:")),TQColor()],
- "InactiveTitle":[unicode(i18n("Inactive Color:")),TQColor()],
- "GradientInactiveTitle":[unicode(i18n("Gradient:")),TQColor()],
- "TitleText":[unicode(i18n("Active Text:")),TQColor()],
- "InactiveTitleText":[unicode(i18n("Inactive Text:")),TQColor()]},
+ ({"ActiveTitle":[str(i18n("Active Color:")),TQColor()],
+ "GradientActiveTitle":[str(i18n("Gradient:")),TQColor()],
+ "InactiveTitle":[str(i18n("Inactive Color:")),TQColor()],
+ "GradientInactiveTitle":[str(i18n("Gradient:")),TQColor()],
+ "TitleText":[str(i18n("Active Text:")),TQColor()],
+ "InactiveTitleText":[str(i18n("Inactive Text:")),TQColor()]},
{}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText
"Application Workspace":
- ({"AppWorkSpace":[unicode(i18n("Background Color:")),TQColor()]},
+ ({"AppWorkSpace":[str(i18n("Background Color:")),TQColor()]},
{}), #AppWorkSpace "Background"
"Buttons":
- ({"ButtonFace":[unicode(i18n("Face:")),TQColor()],
- "ButtonHilight":[unicode(i18n("Hilight:")),TQColor()],
- "ButtonLight":[unicode(i18n("Light:")),TQColor()],
- "ButtonShadow":[unicode(i18n("Shadow:")),TQColor()],
- "ButtonText":[unicode(i18n("Text Color:")),TQColor()],
- "ButtonAlternateFace":[unicode(i18n("Alternate Face:")),TQColor()],
- "ButtonDkShadow":[unicode(i18n("Dark Shadow:")),TQColor()],
- "WindowFrame":[unicode(i18n("Frame:")),TQColor()]},
+ ({"ButtonFace":[str(i18n("Face:")),TQColor()],
+ "ButtonHilight":[str(i18n("Hilight:")),TQColor()],
+ "ButtonLight":[str(i18n("Light:")),TQColor()],
+ "ButtonShadow":[str(i18n("Shadow:")),TQColor()],
+ "ButtonText":[str(i18n("Text Color:")),TQColor()],
+ "ButtonAlternateFace":[str(i18n("Alternate Face:")),TQColor()],
+ "ButtonDkShadow":[str(i18n("Dark Shadow:")),TQColor()],
+ "WindowFrame":[str(i18n("Frame:")),TQColor()]},
{}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame
"Caption Buttons":
({},
- {"CaptionHeight":[unicode(i18n("Height:")),1],
- "CaptionWidth":[unicode(i18n("Width:")),1]}), #Metrics: CaptionHeight, CaptionWidth
+ {"CaptionHeight":[str(i18n("Height:")),1],
+ "CaptionWidth":[str(i18n("Width:")),1]}), #Metrics: CaptionHeight, CaptionWidth
"Desktop":
- ({"Background":[unicode(i18n("Background:")),TQColor()]},
+ ({"Background":[str(i18n("Background:")),TQColor()]},
{}), #Background
"Menu":
- ({"Menu":[unicode(i18n("Menu Background:")),TQColor()],
- "MenuBar":[unicode(i18n("Menu Bar Color:")),TQColor()],
- "MenuHilight":[unicode(i18n("Menu Hilight:")),TQColor()],
- "MenuText":[unicode(i18n("Text Color:")),TQColor()]},
- {"MenuHeight":[unicode(i18n("Menu Bar Height:")),1]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
+ ({"Menu":[str(i18n("Menu Background:")),TQColor()],
+ "MenuBar":[str(i18n("Menu Bar Color:")),TQColor()],
+ "MenuHilight":[str(i18n("Menu Hilight:")),TQColor()],
+ "MenuText":[str(i18n("Text Color:")),TQColor()]},
+ {"MenuHeight":[str(i18n("Menu Bar Height:")),1]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
"Scrollbar":
- ({"Scrollbar":[unicode(i18n("Color:")),TQColor()]},
- {"ScrollWidth":[unicode(i18n("Width:")),1]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
+ ({"Scrollbar":[str(i18n("Color:")),TQColor()]},
+ {"ScrollWidth":[str(i18n("Width:")),1]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
"Window":
- ({"Window":[unicode(i18n("Background:")),TQColor()],
- "WindowText":[unicode(i18n("Text Color:")),TQColor()]},
+ ({"Window":[str(i18n("Background:")),TQColor()],
+ "WindowText":[str(i18n("Text Color:")),TQColor()]},
{}), #Window "Background", WindowText
"Selected Items":
- ({"Hilight":[unicode(i18n("Hilight Color:")),TQColor()],
- "HilightText":[unicode(i18n("Text Color:")),TQColor()]},
+ ({"Hilight":[str(i18n("Hilight Color:")),TQColor()],
+ "HilightText":[str(i18n("Text Color:")),TQColor()]},
{})} #Hilight, HilightText
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
@@ -1833,8 +1833,8 @@ class AppearancePage(TQWidget):
changed = False
custom = False # For a little efficiency
- for item in self.customizableitems.keys():
- for key in self.customizableitems[item][0].keys():
+ for item in list(self.customizableitems.keys()):
+ for key in list(self.customizableitems[item][0].keys()):
color = colors.get(key,"0 0 0")
color = color.split()
color = TQColor(int(color[0]),int(color[1]),int(color[2]))
@@ -1847,7 +1847,7 @@ class AppearancePage(TQWidget):
return True
else:
changed = True
- for key in self.customizableitems[item][1].keys():
+ for key in list(self.customizableitems[item][1].keys()):
size = int(metrics.get(key,1))
if not custom and self.customizableitems[item][1][key][1] !=\
self.config.readNumEntry(key,1):
@@ -1863,11 +1863,11 @@ class AppearancePage(TQWidget):
def reset(self):
self.fillItemCombo(self.itemcombo)
self.config.setGroup("")
- self.currentcustomcolorscheme = unicode(self.config.readEntry("ColorScheme",i18n("Custom")))
+ self.currentcustomcolorscheme = str(self.config.readEntry("ColorScheme",i18n("Custom")))
self.originalcustomcolorscheme = self.currentcustomcolorscheme
schemeslist = self.config.readListEntry("ColorSchemes")
- self.colorschemes = [unicode(i18n("Custom")),
- unicode(i18n("Get KDE Colors"))] + list(schemeslist)
+ self.colorschemes = [str(i18n("Custom")),
+ str(i18n("Get KDE Colors"))] + list(schemeslist)
self.config.setGroup(self.currentcustomcolorscheme)
for preset in self.presets:
@@ -1912,15 +1912,15 @@ class AppearancePage(TQWidget):
colors = wineread.GetColorSettings()
metrics = wineread.GetWindowMetrics()
- for item in self.customizableitems.keys():
- for key in self.customizableitems[item][0].keys():
+ for item in list(self.customizableitems.keys()):
+ for key in list(self.customizableitems[item][0].keys()):
color = colors.get(key,"0 0 0")
color = color.split()
color = TQColor(int(color[0]),int(color[1]),int(color[2]))
if color != self.config.readColorEntry(key,TQColor(0,0,0)):
self.currentcustomcolorscheme = self.colorschemes[0]
self.customizableitems[item][0][key][1] = color
- for key in self.customizableitems[item][1].keys():
+ for key in list(self.customizableitems[item][1].keys()):
size = int(metrics.get(key,1))
if size != self.config.readNumEntry(key,1):
self.currentcustomcolorscheme = self.colorschemes[0]
@@ -1944,13 +1944,13 @@ class AppearancePage(TQWidget):
colorsettings = {}
metricssettings = {}
- for item in self.customizableitems.keys():
- for key in self.customizableitems[item][0].keys():
+ for item in list(self.customizableitems.keys()):
+ for key in list(self.customizableitems[item][0].keys()):
color = self.customizableitems[item][0][key][1]
color = str(color.red()) + " " + str(color.green()) +\
" " + str(color.blue())
colorsettings[key] = color
- for key in self.customizableitems[item][1].keys():
+ for key in list(self.customizableitems[item][1].keys()):
size = self.customizableitems[item][1][key][1]
metricssettings[key] = str(size)
@@ -2006,13 +2006,13 @@ class AppearancePage(TQWidget):
"""
combo = self.itemcombo
combo.clear()
- items = self.customizableitems.keys()
+ items = list(self.customizableitems.keys())
items.sort()
for item in items:
if not (allowwm and (item == "Window Border" \
or item == "Title Bar" or \
item == "Caption Buttons")):
- combo.insertItem(unicode(i18n(item)))
+ combo.insertItem(str(i18n(item)))
def slotFillItemComboDesktop(self,desktop):
"""
@@ -2026,14 +2026,14 @@ class AppearancePage(TQWidget):
if not combo:
combo = self.itemcombo
combo.clear()
- items = self.customizableitems.keys()
+ items = list(self.customizableitems.keys())
items.sort()
self.currentitems = []
for item in items:
if not (currentallowwm == 'Y' and (item == "Window Border" \
or item == "Title Bar" or \
item == "Caption Buttons")):
- combo.insertItem(unicode(i18n(item)))
+ combo.insertItem(str(i18n(item)))
self.currentitems.append(item)
def slotThemeActivated(self,themeid):
@@ -2043,7 +2043,7 @@ class AppearancePage(TQWidget):
def slotInstallThemeClicked(self):
""" Opens up a dialog to install a new theme """
- themepath = unicode(KFileDialog.getOpenFileName(os.environ['HOME'],\
+ themepath = str(KFileDialog.getOpenFileName(os.environ['HOME'],\
"*.msstyles|" + str(i18n("Windows Styles (*.msstyles)")),self,i18n("Install Style")))
if themepath:
themename = themepath.split('/')
@@ -2102,10 +2102,10 @@ class AppearancePage(TQWidget):
schemeslist.append(name)
self.config.writeEntry("ColorSchemes",schemeslist)
self.config.setGroup(name)
- for item in self.customizableitems.keys():
- for key in schemesettings[item][0].keys():
+ for item in list(self.customizableitems.keys()):
+ for key in list(schemesettings[item][0].keys()):
self.config.writeEntry(key,schemesettings[item][0][key][1])
- for key in schemesettings[item][1].keys():
+ for key in list(schemesettings[item][1].keys()):
self.config.writeEntry(key,schemesettings[item][1][key][1])
self.config.sync()
@@ -2188,7 +2188,7 @@ class AppearancePage(TQWidget):
def slotItemActivated(self,itemid):
""" Picks an item to customize """
- items = self.customizableitems.keys()
+ items = list(self.customizableitems.keys())
items.sort()
for i,item in enumerate(self.currentitems):
if i == itemid:
@@ -2228,11 +2228,11 @@ class AppearancePage(TQWidget):
self.config.setGroup("")
self.config.writeEntry("ColorScheme",self.colorschemes[colorid])
self.config.setGroup(self.colorschemes[colorid])
- for item in self.customizableitems.keys():
- for key in self.customizableitems[item][0].keys():
+ for item in list(self.customizableitems.keys()):
+ for key in list(self.customizableitems[item][0].keys()):
color = self.config.readColorEntry(key,TQColor(0,0,0))
self.customizableitems[item][0][key][1] = color
- for key in self.customizableitems[item][1].keys():
+ for key in list(self.customizableitems[item][1].keys()):
size = self.config.readNumEntry(key,1)
self.customizableitems[item][1][key][1] = size
elif colorid == 1:
@@ -2733,106 +2733,106 @@ class AppearancePage(TQWidget):
self.top_layout.setSpacing(spacing)
# --- Some default color schemes, with names ---
- preset1 = (unicode(i18n("Purple")),
+ preset1 = (str(i18n("Purple")),
{"Window Border":
- ({"ActiveBorder":[unicode(i18n("Active Color:")),TQColor(239,239,239)],
- "InactiveBorder":[unicode(i18n("Inactive Color:")),TQColor(239,239,239)]},
- {"BorderWidth":[unicode(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
+ ({"ActiveBorder":[str(i18n("Active Color:")),TQColor(239,239,239)],
+ "InactiveBorder":[str(i18n("Inactive Color:")),TQColor(239,239,239)]},
+ {"BorderWidth":[str(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
"Title Bar":
- ({"ActiveTitle":[unicode(i18n("Active Color:")),TQColor(91,86,168)],
- "GradientActiveTitle":[unicode(i18n("Gradient:")),TQColor(136,118,202)],
- "InactiveTitle":[unicode(i18n("Inactive Color:")),TQColor(223,225,230)],
- "GradientInactiveTitle":[unicode(i18n("Gradient:")),TQColor(157,170,186)],
- "TitleText":[unicode(i18n("Active Text:")),TQColor(255,255,255)],
- "InactiveTitleText":[unicode(i18n("Inactive Text:")),TQColor(168,168,168)]},
+ ({"ActiveTitle":[str(i18n("Active Color:")),TQColor(91,86,168)],
+ "GradientActiveTitle":[str(i18n("Gradient:")),TQColor(136,118,202)],
+ "InactiveTitle":[str(i18n("Inactive Color:")),TQColor(223,225,230)],
+ "GradientInactiveTitle":[str(i18n("Gradient:")),TQColor(157,170,186)],
+ "TitleText":[str(i18n("Active Text:")),TQColor(255,255,255)],
+ "InactiveTitleText":[str(i18n("Inactive Text:")),TQColor(168,168,168)]},
{}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText
"Application Workspace":
- ({"AppWorkSpace":[unicode(i18n("Background Color:")),TQColor(90,90,90)]},
+ ({"AppWorkSpace":[str(i18n("Background Color:")),TQColor(90,90,90)]},
{}), #AppWorkSpace "Background"
"Buttons":
- ({"ButtonFace":[unicode(i18n("Face:")),TQColor(238,239,242)],
- "ButtonHilight":[unicode(i18n("Hilight:")),TQColor(255,255,255)],
- "ButtonLight":[unicode(i18n("Light:")),TQColor(201,199,255)],
- "ButtonShadow":[unicode(i18n("Shadow:")),TQColor(132,132,134)],
- "ButtonText":[unicode(i18n("Text Color:")),TQColor(0,0,0)],
- "ButtonAlternateFace":[unicode(i18n("Alternate Face:")),TQColor(238,239,242)],
- "ButtonDkShadow":[unicode(i18n("Dark Shadow:")),TQColor(98,96,143)],
- "WindowFrame":[unicode(i18n("Frame:")),TQColor(144,140,209)]},
+ ({"ButtonFace":[str(i18n("Face:")),TQColor(238,239,242)],
+ "ButtonHilight":[str(i18n("Hilight:")),TQColor(255,255,255)],
+ "ButtonLight":[str(i18n("Light:")),TQColor(201,199,255)],
+ "ButtonShadow":[str(i18n("Shadow:")),TQColor(132,132,134)],
+ "ButtonText":[str(i18n("Text Color:")),TQColor(0,0,0)],
+ "ButtonAlternateFace":[str(i18n("Alternate Face:")),TQColor(238,239,242)],
+ "ButtonDkShadow":[str(i18n("Dark Shadow:")),TQColor(98,96,143)],
+ "WindowFrame":[str(i18n("Frame:")),TQColor(144,140,209)]},
{}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame
"Caption Buttons":
({},
- {"CaptionHeight":[unicode(i18n("Height:")),22],
- "CaptionWidth":[unicode(i18n("Width:")),22]}), #Metrics: CaptionHeight, CaptionWidth
+ {"CaptionHeight":[str(i18n("Height:")),22],
+ "CaptionWidth":[str(i18n("Width:")),22]}), #Metrics: CaptionHeight, CaptionWidth
"Desktop":
- ({"Background":[unicode(i18n("Background:")),TQColor(146,127,188)]},
+ ({"Background":[str(i18n("Background:")),TQColor(146,127,188)]},
{}), #Background
"Menu":
- ({"Menu":[unicode(i18n("Menu Background:")),TQColor(250,251,254)],
- "MenuBar":[unicode(i18n("Menu Bar Color:")),TQColor(238,239,242)],
- "MenuHilight":[unicode(i18n("Menu Hilight:")),TQColor(144,140,209)],
- "MenuText":[unicode(i18n("Text Color:")),TQColor(0,0,0)]},
- {"MenuHeight":[unicode(i18n("Menu Bar Height:")),22]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
+ ({"Menu":[str(i18n("Menu Background:")),TQColor(250,251,254)],
+ "MenuBar":[str(i18n("Menu Bar Color:")),TQColor(238,239,242)],
+ "MenuHilight":[str(i18n("Menu Hilight:")),TQColor(144,140,209)],
+ "MenuText":[str(i18n("Text Color:")),TQColor(0,0,0)]},
+ {"MenuHeight":[str(i18n("Menu Bar Height:")),22]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
"Scrollbar":
- ({"Scrollbar":[unicode(i18n("Color:")),TQColor(238,239,242)]},
- {"ScrollWidth":[unicode(i18n("Width:")),16]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
+ ({"Scrollbar":[str(i18n("Color:")),TQColor(238,239,242)]},
+ {"ScrollWidth":[str(i18n("Width:")),16]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
"Window":
- ({"Window":[unicode(i18n("Background:")),TQColor(255,255,255)],
- "WindowText":[unicode(i18n("Text Color:")),TQColor(0,0,0)]},
+ ({"Window":[str(i18n("Background:")),TQColor(255,255,255)],
+ "WindowText":[str(i18n("Text Color:")),TQColor(0,0,0)]},
{}), #Window "Background", WindowText
"Selected Items":
- ({"Hilight":[unicode(i18n("Hilight Color:")),TQColor(144,140,209)],
- "HilightText":[unicode(i18n("Text Color:")),TQColor(255,255,255)]},
+ ({"Hilight":[str(i18n("Hilight Color:")),TQColor(144,140,209)],
+ "HilightText":[str(i18n("Text Color:")),TQColor(255,255,255)]},
{})}) #Hilight, HilightText
- preset2 = (unicode(i18n("Blue")),
+ preset2 = (str(i18n("Blue")),
{"Window Border":
- ({"ActiveBorder":[unicode(i18n("Active Color:")),TQColor(239,239,239)],
- "InactiveBorder":[unicode(i18n("Inactive Color:")),TQColor(239,239,239)]},
- {"BorderWidth":[unicode(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
+ ({"ActiveBorder":[str(i18n("Active Color:")),TQColor(239,239,239)],
+ "InactiveBorder":[str(i18n("Inactive Color:")),TQColor(239,239,239)]},
+ {"BorderWidth":[str(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
"Title Bar":
- ({"ActiveTitle":[unicode(i18n("Active Color:")),TQColor(0,113,201)],
- "GradientActiveTitle":[unicode(i18n("Gradient:")),TQColor(87,161,219)],
- "InactiveTitle":[unicode(i18n("Inactive Color:")),TQColor(191,191,191)],
- "GradientInactiveTitle":[unicode(i18n("Gradient:")),TQColor(171,171,171)],
- "TitleText":[unicode(i18n("Active Text:")),TQColor(255,255,255)],
- "InactiveTitleText":[unicode(i18n("Inactive Text:")),TQColor(95,95,95)]},
+ ({"ActiveTitle":[str(i18n("Active Color:")),TQColor(0,113,201)],
+ "GradientActiveTitle":[str(i18n("Gradient:")),TQColor(87,161,219)],
+ "InactiveTitle":[str(i18n("Inactive Color:")),TQColor(191,191,191)],
+ "GradientInactiveTitle":[str(i18n("Gradient:")),TQColor(171,171,171)],
+ "TitleText":[str(i18n("Active Text:")),TQColor(255,255,255)],
+ "InactiveTitleText":[str(i18n("Inactive Text:")),TQColor(95,95,95)]},
{}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText
"Application Workspace":
- ({"AppWorkSpace":[unicode(i18n("Background Color:")),TQColor(90,90,90)]},
+ ({"AppWorkSpace":[str(i18n("Background Color:")),TQColor(90,90,90)]},
{}), #AppWorkSpace "Background"
"Buttons":
- ({"ButtonFace":[unicode(i18n("Face:")),TQColor(239,239,239)],
- "ButtonHilight":[unicode(i18n("Hilight:")),TQColor(246,246,246)],
- "ButtonLight":[unicode(i18n("Light:")),TQColor(191,207,251)],
- "ButtonShadow":[unicode(i18n("Shadow:")),TQColor(148,148,153)],
- "ButtonText":[unicode(i18n("Text Color:")),TQColor(0,0,0)],
- "ButtonAlternateFace":[unicode(i18n("Alternate Face:")),TQColor(238,239,242)],
- "ButtonDkShadow":[unicode(i18n("Dark Shadow:")),TQColor(50,101,146)],
- "WindowFrame":[unicode(i18n("Frame:")),TQColor(74,149,214)]},
+ ({"ButtonFace":[str(i18n("Face:")),TQColor(239,239,239)],
+ "ButtonHilight":[str(i18n("Hilight:")),TQColor(246,246,246)],
+ "ButtonLight":[str(i18n("Light:")),TQColor(191,207,251)],
+ "ButtonShadow":[str(i18n("Shadow:")),TQColor(148,148,153)],
+ "ButtonText":[str(i18n("Text Color:")),TQColor(0,0,0)],
+ "ButtonAlternateFace":[str(i18n("Alternate Face:")),TQColor(238,239,242)],
+ "ButtonDkShadow":[str(i18n("Dark Shadow:")),TQColor(50,101,146)],
+ "WindowFrame":[str(i18n("Frame:")),TQColor(74,149,214)]},
{}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame
"Caption Buttons":
({},
- {"CaptionHeight":[unicode(i18n("Height:")),22],
- "CaptionWidth":[unicode(i18n("Width:")),22]}), #Metrics: CaptionHeight, CaptionWidth
+ {"CaptionHeight":[str(i18n("Height:")),22],
+ "CaptionWidth":[str(i18n("Width:")),22]}), #Metrics: CaptionHeight, CaptionWidth
"Desktop":
- ({"Background":[unicode(i18n("Background:")),TQColor(44,109,189)]},
+ ({"Background":[str(i18n("Background:")),TQColor(44,109,189)]},
{}), #Background
"Menu":
- ({"Menu":[unicode(i18n("Menu Background:")),TQColor(249,249,249)],
- "MenuBar":[unicode(i18n("Menu Bar Color:")),TQColor(239,239,239)],
- "MenuHilight":[unicode(i18n("Menu Hilight:")),TQColor(74,149,214)],
- "MenuText":[unicode(i18n("Text Color:")),TQColor(0,0,0)]},
- {"MenuHeight":[unicode(i18n("Menu Bar Height:")),22]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
+ ({"Menu":[str(i18n("Menu Background:")),TQColor(249,249,249)],
+ "MenuBar":[str(i18n("Menu Bar Color:")),TQColor(239,239,239)],
+ "MenuHilight":[str(i18n("Menu Hilight:")),TQColor(74,149,214)],
+ "MenuText":[str(i18n("Text Color:")),TQColor(0,0,0)]},
+ {"MenuHeight":[str(i18n("Menu Bar Height:")),22]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
"Scrollbar":
- ({"Scrollbar":[unicode(i18n("Color:")),TQColor(230,230,230)]},
- {"ScrollWidth":[unicode(i18n("Width:")),16]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
+ ({"Scrollbar":[str(i18n("Color:")),TQColor(230,230,230)]},
+ {"ScrollWidth":[str(i18n("Width:")),16]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
"Window":
- ({"Window":[unicode(i18n("Background:")),TQColor(255,255,255)],
- "WindowText":[unicode(i18n("Text Color:")),TQColor(0,0,0)]},
+ ({"Window":[str(i18n("Background:")),TQColor(255,255,255)],
+ "WindowText":[str(i18n("Text Color:")),TQColor(0,0,0)]},
{}), #Window "Background", WindowText
"Selected Items":
- ({"Hilight":[unicode(i18n("Hilight Color:")),TQColor(74,149,214)],
- "HilightText":[unicode(i18n("Text Color:")),TQColor(255,255,255)]},
+ ({"Hilight":[str(i18n("Hilight Color:")),TQColor(74,149,214)],
+ "HilightText":[str(i18n("Text Color:")),TQColor(255,255,255)]},
{})}) #Hilight, HilightText
presets = [preset1,preset2]
@@ -2877,7 +2877,7 @@ class GeneralPage(TQWidget):
"applications.</p>"))
appwarning.setFrameStyle( TQFrame.Box | TQFrame.Raised )
self.winversions = self.winversions + (( "global",\
- unicode(i18n("Use Global Setting")), 0, 0, 0, "", "", 0, 0, ""),)
+ str(i18n("Use Global Setting")), 0, 0, 0, "", "", 0, 0, ""),)
self.verdic["global"]=11
hbox = TQHBox(vbox)
@@ -3150,13 +3150,13 @@ class ApplicationsPage(TQWidget):
else:
mailertr = str(i18n("KDE (Native)"))
else:
- mailertr = mailer.capitalize() + unicode(i18n(" (Native)"))
+ mailertr = mailer.capitalize() + str(i18n(" (Native)"))
mailers.append((mailer,mailertr))
for mailer in wine:
if mailer and mailer[1] == ':':
mailer = mailer.lower()
mailertr = mailer[mailer.rfind('\\\\')+2:mailer.rfind('.exe')]
- mailertr = mailertr.capitalize() + unicode(i18n(" (Windows, set by application)"))
+ mailertr = mailertr.capitalize() + str(i18n(" (Windows, set by application)"))
else: # winebrowser
continue
mailers.append((mailer,mailertr))
@@ -3176,7 +3176,7 @@ class ApplicationsPage(TQWidget):
"""
app = KFileDialog.getOpenFileName(wineread.winepath + \
"/dosdevices/c:",\
- "*.exe|" + unicode(i18n("Windows Executables (*.exe)")),self,i18n("Application"))
+ "*.exe|" + str(i18n("Windows Executables (*.exe)")),self,i18n("Application"))
if app:
app = str(app).split('/')
app = app[-1]
@@ -3325,11 +3325,11 @@ class LibrariesPage(TQWidget):
orderoptions = ("builtin","native","builtin,native","native,builtin","")
orderoptionstr = [
- unicode(i18n("Built-in (Wine)")),
- unicode(i18n("Native (Windows)")),
- unicode(i18n("Built-in then Native")),
- unicode(i18n("Native then Built-in")),
- unicode(i18n("Disable"))]
+ str(i18n("Built-in (Wine)")),
+ str(i18n("Native (Windows)")),
+ str(i18n("Built-in then Native")),
+ str(i18n("Native then Built-in")),
+ str(i18n("Disable"))]
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
TQWidget.__init__(self,parent)
@@ -3463,7 +3463,7 @@ class LibrariesPage(TQWidget):
"""
if self.selecteddll:
order = KInputDialog.getItem(i18n("Edit Library Override"),\
- unicode(i18n("Load order for %s:")) % (unicode(self.selecteddll),),
+ str(i18n("Load order for %s:")) % (str(self.selecteddll),),
TQStringList.fromStrList(self.orderoptionstr),\
False,0,self,"editdll")
@@ -3488,7 +3488,7 @@ class LibrariesPage(TQWidget):
firstselecteddll = None
lastdll = None
- for dll,order in self.overriddendlls.iteritems():
+ for dll,order in self.overriddendlls.items():
lvi = TQListViewItem(self.dllslist,dll,order)
self.dllsToListItems[dll] = lvi
if self.selecteddll and self.selecteddll==dll:
diff --git a/wineconfig/wineread.py b/wineconfig/wineread.py
index c1fa3c5..d334d7c 100644
--- a/wineconfig/wineread.py
+++ b/wineconfig/wineread.py
@@ -102,7 +102,7 @@ def LoadDrives():
letter = drive[1].lower()
if letter in driveletters:
drive[2] = os.readlink(winepath + "/dosdevices/" + letter)
- if drivetypes.has_key(drive[1]):
+ if drive[1] in drivetypes:
drive[3] = drivetypes[drive[1]]
return drives
diff --git a/wineconfig/winewrite.py b/wineconfig/winewrite.py
index 0d0d365..db01614 100644
--- a/wineconfig/winewrite.py
+++ b/wineconfig/winewrite.py
@@ -99,7 +99,7 @@ def SetShellLinks(shelllinks):
if createLink:
os.symlink(link[2], wineread.winepath + "/dosdevices/c:/windows/profiles/" + os.environ['USER'] + "/" + link[1])
- if shellregistry.has_key(link[1]):
+ if link[1] in shellregistry:
SetShellRegistry(link)
@@ -322,10 +322,10 @@ def SetDllOverrides(overrides, app = None):
origoverrides = wineread.GetDllOverrides(app)
- for dll in overrides.keys():
+ for dll in list(overrides.keys()):
dllfile.write('"'+str(dll)+'"="'+str(overrides[dll])+'"\n')
- for dll in origoverrides.keys():
+ for dll in list(origoverrides.keys()):
if dll not in overrides:
dllfile.write('"'+str(dll)+'"=-\n')