Drop python2 support.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/8/head
Slávek Banko 2 years ago committed by Michele Calgaro
parent b9c0b6996a
commit 94f5a3f12e
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -75,8 +75,8 @@ class GrubConfigAppClass(programbase):
#--- Load menu.lst using the load_menulst() method #--- Load menu.lst using the load_menulst() method
self.load_menulst() self.load_menulst()
print self.globalvars print(self.globalvars)
print self.itemslist print(self.itemslist)
# - GRUB Options Tab - # - GRUB Options Tab -
if standalone: if standalone:
@ -273,12 +273,12 @@ class GrubConfigAppClass(programbase):
self.oslistview.setSelected(self.oslistviewitems[0],True) self.oslistview.setSelected(self.oslistviewitems[0],True)
ops_list = self.load_osprobe() ops_list = self.load_osprobe()
print ops_list # mhb debug print(ops_list) # mhb debug
####################################################################### #######################################################################
# reload listviews, because they have changed # reload listviews, because they have changed
def reloadListViews(self,name): def reloadListViews(self,name):
print "reloaded" print("reloaded")
# you should repaint the one that is not changed on screen # you should repaint the one that is not changed on screen
if name == "oslist": if name == "oslist":
self.oslistview.clear() self.oslistview.clear()
@ -298,7 +298,7 @@ class GrubConfigAppClass(programbase):
for item in self.itemslist: for item in self.itemslist:
try: try:
if self.itemslist.index(item) == int(self.globalvars['default'][0]): 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])) self.itemslistviewitems.append(BoldListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0]))
else: else:
self.itemslistviewitems.append(TDEListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0])) 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.customoptions.setText(customoptions[:-1])
self.updatingGUI = False self.updatingGUI = False
print "oslistview item selected" #mhb debug print("oslistview item selected") #mhb debug
pass pass
####################################################################### #######################################################################
def slotDisplayNameLabelChanged(self, string): def slotDisplayNameLabelChanged(self, string):
if(self.updatingGUI == False): if(self.updatingGUI == False):
print "display name changed" #mhb debug print("display name changed") #mhb debug
i = self.oslistviewitems.index(self.oslistview.selectedItem()) i = self.oslistviewitems.index(self.oslistview.selectedItem())
self.itemslist[i]["title"][0] = string self.itemslist[i]["title"][0] = string
self.oslistview.selectedItem().setText(0,string) self.oslistview.selectedItem().setText(0,string)
@ -362,7 +362,7 @@ class GrubConfigAppClass(programbase):
pass pass
####################################################################### #######################################################################
def slotUpButtonClicked(self): def slotUpButtonClicked(self):
print "UpButton clicked" #mhb debug print("UpButton clicked") #mhb debug
i = self.itemslistviewitems.index(self.itemslistview.selectedItem()) i = self.itemslistviewitems.index(self.itemslistview.selectedItem())
self.itemslistview.selectedItem().itemAbove().moveItem(self.itemslistview.selectedItem()) self.itemslistview.selectedItem().itemAbove().moveItem(self.itemslistview.selectedItem())
# itemslist should have the same i for the same option # itemslist should have the same i for the same option
@ -375,7 +375,7 @@ class GrubConfigAppClass(programbase):
####################################################################### #######################################################################
def slotDownButtonClicked(self): def slotDownButtonClicked(self):
print "DownButton clicked" #mhb debug print("DownButton clicked") #mhb debug
i = self.itemslistviewitems.index(self.itemslistview.selectedItem()) i = self.itemslistviewitems.index(self.itemslistview.selectedItem())
self.itemslistview.selectedItem().moveItem(self.itemslistview.selectedItem().itemBelow()) self.itemslistview.selectedItem().moveItem(self.itemslistview.selectedItem().itemBelow())
if(i != len(self.itemslist)-1): if(i != len(self.itemslist)-1):
@ -387,7 +387,7 @@ class GrubConfigAppClass(programbase):
####################################################################### #######################################################################
def slotSetDefaultButtonClicked(self): def slotSetDefaultButtonClicked(self):
print "SetDefaultButton cliicked" #mhb debug print("SetDefaultButton cliicked") #mhb debug
try: try:
defaultn = int(self.globalvars["default"][0]) defaultn = int(self.globalvars["default"][0])
except ValueError: except ValueError:
@ -419,7 +419,7 @@ class GrubConfigAppClass(programbase):
#self.__updateGroupList() #self.__updateGroupList()
self.updatingGUI = False self.updatingGUI = False
programbase.exec_loop(self) programbase.exec_loop(self)
print "done" print("done")
####################################################################### #######################################################################
@ -453,7 +453,7 @@ class GrubConfigAppClass(programbase):
for line in menufd: for line in menufd:
# Checks if the first non-white char in a line is a # # Checks if the first non-white char in a line is a #
if re.search(r'^(/s)*#',line) or re.search(r'^(/s)*$',line): 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: if itemlock == 1:
itemlock = 0 itemlock = 0
currentitem += 1 currentitem += 1
@ -499,7 +499,7 @@ class GrubConfigAppClass(programbase):
pass pass
# okay, it's not commented # okay, it's not commented
else: else:
print "a not commented line" # mhb debug print("a not commented line") # mhb debug
self.modifiedlines.append(linenum) self.modifiedlines.append(linenum)
# we presume the first character is already a name # we presume the first character is already a name
var_name = line.split()[0] var_name = line.split()[0]
@ -509,7 +509,7 @@ class GrubConfigAppClass(programbase):
if var_name in parsable: if var_name in parsable:
# cat 0 - a title - triggers itemlock, has a name and a value, which should be stored as text # cat 0 - a title - triggers itemlock, has a name and a value, which should be stored as text
if var_name == "title": if var_name == "title":
print line.split(None,1) print(line.split(None,1))
var_value.append(line.split(None,1)[1][:-1]) var_value.append(line.split(None,1)[1][:-1])
itemlock = 1 itemlock = 1
self.itemslist.append({}) self.itemslist.append({})
@ -561,7 +561,7 @@ class GrubConfigAppClass(programbase):
#print "it has no value" # mhb debug #print "it has no value" # mhb debug
# print "parsed another line" # mhb debug # print "parsed another line" # mhb debug
linenum += 1; linenum += 1;
print "load_menulst() called" # mhb debug print("load_menulst() called") # mhb debug
return "not working yet" return "not working yet"
####################################################################### #######################################################################
@ -576,7 +576,7 @@ class GrubConfigAppClass(programbase):
# 2. writing the lines in another list (or something more efficient # 2. writing the lines in another list (or something more efficient
output = {} output = {}
# the globals first # the globals first
for unit, value in self.globalvars.items(): for unit, value in list(self.globalvars.items()):
lines.append(value[-1]) lines.append(value[-1])
temp_str="" temp_str=""
temp_str+=(str(unit)+" ") temp_str+=(str(unit)+" ")
@ -586,7 +586,7 @@ class GrubConfigAppClass(programbase):
# itemslist next (abattoir) # itemslist next (abattoir)
for item in self.itemslist: for item in self.itemslist:
for unit, value in reversed(item.items()): for unit, value in reversed(list(item.items())):
lines.append(value[-1]) lines.append(value[-1])
temp_str="" temp_str=""
temp_str+=(str(unit)+" ") 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) # 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) # line by line write it in the output file (to be exact, to a file in /tmp)
linenum = 0 linenum = 0
print linecontent print(linecontent)
print lines print(lines)
# foreach file as line: # foreach file as line:
for originalline in trfile: for originalline in trfile:
# if its number isn't in the location list, simply write it # if its number isn't in the location list, simply write it
@ -627,7 +627,7 @@ class GrubConfigAppClass(programbase):
# mhb TODO: Exception handling # mhb TODO: Exception handling
os.remove(self.readfilename) os.remove(self.readfilename)
print "save_menulst() called" # mhb debug print("save_menulst() called") # mhb debug
return "not working yet" return "not working yet"
@ -637,10 +637,10 @@ class GrubConfigAppClass(programbase):
detected = os.popen('os-prober').readlines() detected = os.popen('os-prober').readlines()
ops_list = [] ops_list = []
for ops in detected: for ops in detected:
ops = string.replace(ops,"\n","") ops = ops.replace("\n","")
temp_list = ops.split(':') temp_list = ops.split(':')
partition = temp_list[0] 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]) re_obj = re.search(r'([sh]d)([a-z])([0-9])*$',temp_list[0])
disk = ord(re_obj.group(2))%97 disk = ord(re_obj.group(2))%97
part = int(re_obj.group(3))-1 part = int(re_obj.group(3))-1
@ -662,7 +662,7 @@ class GrubConfigAppClass(programbase):
linux_os = os.popen('linux-boot-prober '+partition).readlines() linux_os = os.popen('linux-boot-prober '+partition).readlines()
linux_list = [] linux_list = []
for lops in linux_os: for lops in linux_os:
lops = string.replace(lops,"\n","") lops = lops.replace("\n","")
temp_linux_list = lops.split(':') temp_linux_list = lops.split(':')
linux_list.append(temp_linux_list) linux_list.append(temp_linux_list)
temp_list.append(linux_list) temp_list.append(linux_list)
@ -680,7 +680,7 @@ def create_grubconfig(parent,name):
########################################################################## ##########################################################################
def MakeAboutData(): def MakeAboutData():
aboutdata = TDEAboutData("guidance", programname, version, 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") TDEAboutData.License_GPL, "Copyright (C) 2006-2007 Martin Böhm")
aboutdata.addAuthor("Martin Böhm", "Developer", "martin.bohm@kubuntu.org", "http://mhb.ath.cx/") aboutdata.addAuthor("Martin Böhm", "Developer", "martin.bohm@kubuntu.org", "http://mhb.ath.cx/")
aboutdata.addAuthor("Simon Edwards", "Developer", "simon@simonzone.com", "http://www.simonzone.com/software/") aboutdata.addAuthor("Simon Edwards", "Developer", "simon@simonzone.com", "http://www.simonzone.com/software/")

@ -44,8 +44,8 @@ class XF86Screen(object):
(rc,x,y) = ixf86misc.XRRQueryExtension(self.display) (rc,x,y) = ixf86misc.XRRQueryExtension(self.display)
if rc==0: if rc==0:
return return
except AttributeError, errmsg: except AttributeError as errmsg:
print "Trapped AttributeError:", errmsg, " - attempting to continue." print("Trapped AttributeError:", errmsg, " - attempting to continue.")
return return
self.screenconfig = ixf86misc.XRRGetScreenInfo(self.display, ixf86misc.RootWindow(self.display, self.screenid)) self.screenconfig = ixf86misc.XRRGetScreenInfo(self.display, ixf86misc.RootWindow(self.display, self.screenid))
@ -140,7 +140,7 @@ class XF86Server(object):
self.displayname = displayname self.displayname = displayname
self.display = ixf86misc.XOpenDisplay(displayname) self.display = ixf86misc.XOpenDisplay(displayname)
if self.display is None: 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) self._defaultscreen = ixf86misc.DefaultScreen(self.display)
@ -169,29 +169,29 @@ class XF86Error(Exception):
if __name__=='__main__': if __name__=='__main__':
xg = XF86Server() xg = XF86Server()
xs = xg.getDefaultScreen() xs = xg.getDefaultScreen()
print "Number of screens:",str(len(xg.screens)) print("Number of screens:",str(len(xg.screens)))
print "Idle seconds:",xs.getIdleSeconds() print("Idle seconds:",xs.getIdleSeconds())
print print()
print "Gamma:"+str(xs.getGamma()) print("Gamma:"+str(xs.getGamma()))
print print()
if xg.resolutionSupportAvailable(): if xg.resolutionSupportAvailable():
print "SizeID:"+str(xs.getSizeID()) print("SizeID:"+str(xs.getSizeID()))
print "Size:"+str(xs.getSize()) print("Size:"+str(xs.getSize()))
sizes = xs.getAvailableSizes() sizes = xs.getAvailableSizes()
print "Available Sizes:" + str(sizes) print("Available Sizes:" + str(sizes))
print print()
print "Rotation:" + str(xs.getRotation()) print("Rotation:" + str(xs.getRotation()))
print "Available Rotations:" + str(xs.getAvailableRotations()) print("Available Rotations:" + str(xs.getAvailableRotations()))
print print()
print "Refresh rate:" + str(xs.getRefreshRate()) print("Refresh rate:" + str(xs.getRefreshRate()))
print "Refresh rates for the current screen:"+str(xs.getAvailableRefreshRates(xs.getSizeID())) print("Refresh rates for the current screen:"+str(xs.getAvailableRefreshRates(xs.getSizeID())))
for i in range(len(sizes)): 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) xs.setScreenConfigAndRate(0,1,75)
print "SizeID:"+str(xs.getSizeID()) print("SizeID:"+str(xs.getSizeID()))
print "Size:"+str(xs.getSize()) print("Size:"+str(xs.getSize()))
sizes = xs.getAvailableSizes() sizes = xs.getAvailableSizes()
print "Available Sizes:" + str(sizes) print("Available Sizes:" + str(sizes))
else: else:
print "(no resolution / randr support available)" print("(no resolution / randr support available)")

@ -326,8 +326,8 @@ class MicroHAL__(object):
# but it might be built as module, so we try to load that. # but it might be built as module, so we try to load that.
retval, msg = SimpleCommandRunner().run(["/sbin/modprobe",module]) retval, msg = SimpleCommandRunner().run(["/sbin/modprobe",module])
if retval > 0: if retval > 0:
print msg print(msg)
print "Couldn't load driver " + module + " for filesystem " + fs print("Couldn't load driver " + module + " for filesystem " + fs)
# Force refresh of list of supported filesystems # Force refresh of list of supported filesystems
self.supportedfs = None self.supportedfs = None
return proc in self.getSupportedFileSystems() return proc in self.getSupportedFileSystems()
@ -632,73 +632,73 @@ class MicroHAL(object):
# Detect the end of this block of device data. # Detect the end of this block of device data.
state = READING_TOP state = READING_TOP
if u"info.category" in parsed_hash: if "info.category" in parsed_hash:
new_device = None new_device = None
capabilities_string = u" ".join(parsed_hash[u"info.capabilities"]) capabilities_string = " ".join(parsed_hash["info.capabilities"])
capabilities = self._parseStringList(capabilities_string) capabilities = self._parseStringList(capabilities_string)
category = self._parseString(' '.join(parsed_hash[u"info.category"])) category = self._parseString(' '.join(parsed_hash["info.category"]))
if category==u"volume": if category=="volume":
# Is it a 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': if is_disc is not None and is_disc[0]=='true':
continue continue
is_partition = parsed_hash.get(u"volume.is_partition") is_partition = parsed_hash.get("volume.is_partition")
if is_partition is not None: if is_partition is not None:
is_partition = is_partition[0] is_partition = is_partition[0]
if is_partition=='true': if is_partition=='true':
new_device = Partition() 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 partition_to_uid[new_device] = current_uid
if u"info.parent" in parsed_hash: if "info.parent" in parsed_hash:
parent_uid = self._parseString(' '.join(parsed_hash[u"info.parent"])) parent_uid = self._parseString(' '.join(parsed_hash["info.parent"]))
partition_to_uid[new_device] = parent_uid partition_to_uid[new_device] = parent_uid
else: else:
new_device = Disk() new_device = Disk()
uid_to_disk[current_uid] = new_device uid_to_disk[current_uid] = new_device
if u"volume.uuid" in parsed_hash: if "volume.uuid" in parsed_hash:
new_device.uuid = self._parseString(' '.join(parsed_hash[u"volume.uuid"])) new_device.uuid = self._parseString(' '.join(parsed_hash["volume.uuid"]))
if u"volume.label" in parsed_hash: if "volume.label" in parsed_hash:
new_device.label = self._parseString(parsed_hash[u"volume.label"][0]) new_device.label = self._parseString(parsed_hash["volume.label"][0])
# If HAL returns label beginning with '#', it usually means that the # If HAL returns label beginning with '#', it usually means that the
# actual label contains an Unix path. So we replace '#' with '/'. # actual label contains an Unix path. So we replace '#' with '/'.
if len(new_device.label) and new_device.label[0]=='%': if len(new_device.label) and new_device.label[0]=='%':
new_device.label = new_device.label.replace('%', '/') new_device.label = new_device.label.replace('%', '/')
if u"volume.size" in parsed_hash: if "volume.size" in parsed_hash:
size = parsed_hash[u"volume.size"][0] size = parsed_hash["volume.size"][0]
new_device.size = self.formatSizeBytes(int(size)) new_device.size = self.formatSizeBytes(int(size))
else: else:
new_device.size = "?" new_device.size = "?"
# is it a storage device? # is it a storage device?
elif category==u"storage": elif category=="storage":
storage_model = self._parseString(' '.join(parsed_hash[u"storage.model"])) storage_model = self._parseString(' '.join(parsed_hash["storage.model"]))
storage_removable = parsed_hash[u"storage.removable"][0]==u"true" 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 \ if "storage.cdrom.cdrw" in parsed_hash \
and parsed_hash[u"storage.cdrom.cdrw"][0]==u"true": and parsed_hash["storage.cdrom.cdrw"][0]=="true":
new_device = BurnerDisk() new_device = BurnerDisk()
else: else:
new_device= RemovableDisk() new_device= RemovableDisk()
elif u"storage.floppy" in capabilities: elif "storage.floppy" in capabilities:
new_device = FloppyDevice() new_device = FloppyDevice()
else: else:
if u"storage.bus" in parsed_hash \ if "storage.bus" in parsed_hash \
and self._parseString(' '.join(parsed_hash[u"storage.bus"]))==u"usb": and self._parseString(' '.join(parsed_hash["storage.bus"]))=="usb":
new_device = USBDisk() new_device = USBDisk()
else: else:
@ -711,8 +711,8 @@ class MicroHAL(object):
continue continue
# Handle the generic properties. # Handle the generic properties.
new_device.dev = self._parseString(' '.join(parsed_hash[u"block.device"])) new_device.dev = self._parseString(' '.join(parsed_hash["block.device"]))
new_device.major = int(parsed_hash[u"block.major"][0]) new_device.major = int(parsed_hash["block.major"][0])
self.devices.append(new_device) self.devices.append(new_device)
@ -722,9 +722,9 @@ class MicroHAL(object):
parsed_hash[ parts[0] ] = parts[2:] parsed_hash[ parts[0] ] = parts[2:]
# Attach the partitions to thier devices. # 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] 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 = uid_to_disk[parent]
parent_device.appendPartition(partition) parent_device.appendPartition(partition)
self.devices.remove(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. # but it might be built as module, so we try to load that.
retval, msg = SimpleCommandRunner().run(["/sbin/modprobe",module]) retval, msg = SimpleCommandRunner().run(["/sbin/modprobe",module])
if retval > 0: if retval > 0:
print msg print(msg)
print "Couldn't load driver " + module + " for filesystem " + fs print("Couldn't load driver " + module + " for filesystem " + fs)
# Force refresh of list of supported filesystems # Force refresh of list of supported filesystems
self.supportedfs = None self.supportedfs = None
return proc in self.getSupportedFileSystems() return proc in self.getSupportedFileSystems()
@ -842,7 +842,7 @@ class MicroHAL(object):
for partition in item.partitions: for partition in item.partitions:
if partition.dev==device: if partition.dev==device:
return partition.label return partition.label
print "No Label found for ",device print("No Label found for ",device)
return "" return ""
def getUUIDByDevice(self, device): def getUUIDByDevice(self, device):
@ -851,7 +851,7 @@ class MicroHAL(object):
#print partition, partition.getUUID() #print partition, partition.getUUID()
if partition.dev==device: if partition.dev==device:
return partition.uuid return partition.uuid
print "No UUID found for ",device print("No UUID found for ",device)
return "" return ""
def getDeviceByUUID(self, uuid): def getDeviceByUUID(self, uuid):
@ -870,19 +870,19 @@ class MicroHAL(object):
if __name__=='__main__': if __name__=='__main__':
hal = MicroHAL() hal = MicroHAL()
for item in hal.getDevices(): for item in hal.getDevices():
print(str(item)) print((str(item)))
print print()
#""" #"""
for item in hal.getDevices(): for item in hal.getDevices():
for partition in item.partitions: for partition in item.partitions:
print partition, partition.getLabel() print(partition, partition.getLabel())
#""" #"""
#realhal = RealHAL() #realhal = RealHAL()
#for item in realhal.getDevices(): #for item in realhal.getDevices():
# print(str(item)) # print(str(item))
print print()

@ -204,8 +204,8 @@ class SMBShareSelectDialog(KDialogBase):
######################################################################## ########################################################################
def slotNewItems(self,items): def slotNewItems(self,items):
for entry in items: for entry in items:
newitem = SMBShareListViewItem(self.lookupqueue[0], unicode(entry.name()), KURL(entry.url()), self) newitem = SMBShareListViewItem(self.lookupqueue[0], str(entry.name()), KURL(entry.url()), self)
self.url_to_list_item_map[unicode(entry.url().prettyURL())] = newitem self.url_to_list_item_map[str(entry.url().prettyURL())] = newitem
# Notice how I copied the KURL object and TQString (to a python string) # 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): 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. list_item.setURL(KURL(newUrl)) # The copy is important.
# Reselect the selected node. (This will force a refresh). # Reselect the selected node. (This will force a refresh).
@ -317,7 +317,7 @@ class SMBShareSelectDialog(KDialogBase):
self.usernameedit.setEnabled(False) self.usernameedit.setEnabled(False)
selectedurl = self.selecteditem.getURL() selectedurl = self.selecteditem.getURL()
self.reconnectbutton.setEnabled(unicode(selectedurl.user())!="") self.reconnectbutton.setEnabled(str(selectedurl.user())!="")
self.updatinggui = False self.updatinggui = False
@ -333,11 +333,11 @@ class SMBShareSelectDialog(KDialogBase):
self.passwordedit.setEnabled(True) self.passwordedit.setEnabled(True)
self.usernameedit.setEnabled(True) self.usernameedit.setEnabled(True)
username = unicode(self.usernameedit.text()) username = str(self.usernameedit.text())
password = unicode(self.passwordedit.text()) password = str(self.passwordedit.text())
selectedurl = self.selecteditem.getURL() selectedurl = self.selecteditem.getURL()
if username!="" and password!="" and \ 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) self.reconnectbutton.setEnabled(True)
else: else:
self.reconnectbutton.setEnabled(False) self.reconnectbutton.setEnabled(False)
@ -404,10 +404,10 @@ class SMBShareListViewItem(TDEListViewItem):
self.setExpandable(True) self.setExpandable(True)
if url.hasPath() and url.path(-1)!="/": 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() self.component = parts[-1].lower()
elif url.hasHost(): elif url.hasHost():
self.component = unicode(url.host()).lower() self.component = str(url.host()).lower()
else: else:
self.component = None self.component = None
@ -502,7 +502,7 @@ class SMBShareListViewItem(TDEListViewItem):
# Another wrinkle is that the treeview contains a level of workgroups while # 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. # a given URL omits the workgroup a jumps directly to the machine name.
def selectURL(self,targeturl): def selectURL(self,targeturl):
path = unicode(targeturl.path(-1)) path = str(targeturl.path(-1))
parts = [x for x in path.split("/") if x!=""] parts = [x for x in path.split("/") if x!=""]
if targeturl.hasHost(): if targeturl.hasHost():
tmp = [targeturl.host()] tmp = [targeturl.host()]

@ -40,9 +40,9 @@ class SimpleCommandRunner(TQObject):
is the output from stdout and stderr. is the output from stdout and stderr.
""" """
global debug global debug
if debug: print cmdlist if debug: print(cmdlist)
self.STDOUT_only = STDOUT_only self.STDOUT_only = STDOUT_only
self.output = u"" self.output = ""
proc = TDEProcess() proc = TDEProcess()
proc.setEnvironment("LANG","US") proc.setEnvironment("LANG","US")
proc.setEnvironment("LC_ALL","US") proc.setEnvironment("LC_ALL","US")
@ -58,12 +58,12 @@ class SimpleCommandRunner(TQObject):
######################################################################## ########################################################################
def slotStdout(self,proc,buffer,buflen): def slotStdout(self,proc,buffer,buflen):
global debug global debug
if debug: print "slotStdout() |"+buffer+"|" if debug: print("slotStdout() |"+buffer+"|")
self.output += buffer.decode(locale.getpreferredencoding()) self.output += buffer.decode(locale.getpreferredencoding())
######################################################################## ########################################################################
def slotStderr(self,proc,buffer,buflen): def slotStderr(self,proc,buffer,buflen):
global debug global debug
if debug: print "slotStderr() |"+buffer+"|" if debug: print("slotStderr() |"+buffer+"|")
if not self.STDOUT_only: if not self.STDOUT_only:
self.output += buffer.decode(locale.getpreferredencoding()) self.output += buffer.decode(locale.getpreferredencoding())

@ -73,7 +73,7 @@ class FileProcess(TQListViewItem):
""" Parses a signal string representation or a signal number and sends it to """ Parses a signal string representation or a signal number and sends it to
the process.""" the process."""
if not self.isparent: if not self.isparent:
print "Item is not a process, only a filedescriptor." print("Item is not a process, only a filedescriptor.")
return return
try: try:
signal_int = int(signal) signal_int = int(signal)
@ -81,17 +81,17 @@ class FileProcess(TQListViewItem):
try: try:
signal_int = self.signals[signal] signal_int = self.signals[signal]
except IndexError: except IndexError:
print "No known signal received ", signal print("No known signal received ", signal)
return False return False
try: try:
rc = os.kill(int(self.pid),signal_int) # TODO: Catch OSError rc = os.kill(int(self.pid),signal_int) # TODO: Catch OSError
except OSError, message: except OSError as message:
print "OSError: Couldn't %s %s %s" % (signal,self.pname,self.pid) print("OSError: Couldn't %s %s %s" % (signal,self.pname,self.pid))
print message print(message)
if not rc: 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 return True
print "Signal %i didn't succeed" % signal_int print("Signal %i didn't succeed" % signal_int)
return False return False
def fillColumns(self): def fillColumns(self):
@ -125,7 +125,7 @@ class FUser(FUserUI):
self.umountbutton.setEnabled(False) self.umountbutton.setEnabled(False)
self.explanationlabel.setText( 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> <br>
The processes that are blocking %s are listed below. These processes must be closed The processes that are blocking %s are listed below. These processes must be closed
before %s can be disabled. before %s can be disabled.
@ -159,7 +159,7 @@ class FUser(FUserUI):
if os.path.isfile(path): if os.path.isfile(path):
self.lsof_bin = path self.lsof_bin = path
else: 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): def readPixmaps(self):
self.pix = { self.pix = {
@ -185,7 +185,7 @@ class FUser(FUserUI):
type = line[0] type = line[0]
info = line[1:] info = line[1:]
if type is "p": if type == "p":
pid = info pid = info
parentproc = FileProcess(self.processlist,pid,True) parentproc = FileProcess(self.processlist,pid,True)
self.processes.append(parentproc) self.processes.append(parentproc)
@ -243,7 +243,7 @@ class FUser(FUserUI):
self.processlist.selectedItem().sendSignal("KILL") self.processlist.selectedItem().sendSignal("KILL")
self.refreshProcesslist() self.refreshProcesslist()
except AttributeError: except AttributeError:
print "No killable item selected." print("No killable item selected.")
def slotKillallButtonClicked(self): def slotKillallButtonClicked(self):
for process in self.realprocesses: for process in self.realprocesses:
@ -266,17 +266,17 @@ class FUser(FUserUI):
SimpleCommandRunner SimpleCommandRunner
rc, output = SimpleCommandRunner().run(['/bin/umount',self.device]) rc, output = SimpleCommandRunner().run(['/bin/umount',self.device])
if rc == 0: if rc == 0:
print "%s successfully unmounted." % self.device print("%s successfully unmounted." % self.device)
# Close dialog and return 0 - sucessfully umounted. # Close dialog and return 0 - sucessfully umounted.
self.done(0) self.done(0)
else: else:
print "Unmounting %s failed: %s" % (self.device,output[:-1]) print("Unmounting %s failed: %s" % (self.device,output[:-1]))
self.isMounted() self.isMounted()
################################################################################################ ################################################################################################
if standalone: if standalone:
device = "/dev/hda1" device = "/dev/hda1"
print 'Device is ', device print('Device is ', device)
cmd_args = TDECmdLineArgs.init(sys.argv, "FUser", cmd_args = TDECmdLineArgs.init(sys.argv, "FUser",
"A graphical frontend to fuser, but without using it :-)", "0.2") "A graphical frontend to fuser, but without using it :-)", "0.2")

@ -183,8 +183,8 @@ class MountEntryExt(object):
# object. # object.
def __init__(self,base=None): def __init__(self,base=None):
if base==None: if base==None:
self.device = unicode(i18n("<device>")) self.device = str(i18n("<device>"))
self.mountpoint = unicode(i18n("<mount point>")) self.mountpoint = str(i18n("<mount point>"))
self.mounttype = 'ext2' self.mounttype = 'ext2'
self.uuid = "" self.uuid = ""
self.label = "" self.label = ""
@ -319,13 +319,13 @@ class MountEntryExt(object):
if self.label != "": if self.label != "":
return MountEntry.encodeMountEntryString("LABEL="+self.label) return MountEntry.encodeMountEntryString("LABEL="+self.label)
else: 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": elif self.getUseAsDevice() == "uuid":
if self.uuid != "": if self.uuid != "":
return "UUID="+self.uuid return "UUID="+self.uuid
return MountEntry.encodeMountEntryString("UUID="+self.uuid) return MountEntry.encodeMountEntryString("UUID="+self.uuid)
else: 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) return MountEntry.encodeMountEntryString(self.device)
######################################################################## ########################################################################
@ -364,10 +364,10 @@ class MountEntryExt(object):
options.append(o.strip()) options.append(o.strip())
return self.getDeviceString() + \ return self.getDeviceString() + \
u" " + MountEntry.encodeMountEntryString(self.mountpoint.replace("%20","\040")) + \ " " + MountEntry.encodeMountEntryString(self.mountpoint.replace("%20","\040")) + \
u" " + MountEntry.encodeMountEntryString(self.mounttype) + \ " " + MountEntry.encodeMountEntryString(self.mounttype) + \
u" " + MountEntry.encodeMountEntryString(u",".join(options)) + \ " " + MountEntry.encodeMountEntryString(",".join(options)) + \
u" " + unicode(self.fs_freq) + u" " + unicode(self.fs_passno) " " + str(self.fs_freq) + " " + str(self.fs_passno)
######################################################################## ########################################################################
def getCategory(self): def getCategory(self):
@ -412,22 +412,22 @@ class MountEntryExt(object):
self.mountpoint).arg(output) self.mountpoint).arg(output)
captionmsg = i18n("Unable to disable %1").arg(self.mountpoint) 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: if (rc & 1)!=0:
extramsg += unicode(i18n("\"incorrect invocation or permissions\"\n")) extramsg += str(i18n("\"incorrect invocation or permissions\"\n"))
if (rc & 2)!=0: 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: 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: if (rc & 8)!=0:
extramsg += unicode(i18n("\"user interrupt\"\n")) extramsg += str(i18n("\"user interrupt\"\n"))
if (rc & 16)!=0: 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: if (rc & 32)!=0:
extramsg += unicode(i18n("\"mount failure\"\n")) extramsg += str(i18n("\"mount failure\"\n"))
if (rc & 64)!=0: if (rc & 64)!=0:
extramsg += unicode(i18n("\"some mount succeeded\"\n")) extramsg += str(i18n("\"some mount succeeded\"\n"))
in_use = False in_use = False
if not mount_action: if not mount_action:
@ -444,10 +444,10 @@ class MountEntryExt(object):
fuser.exec_loop() fuser.exec_loop()
in_use_message = "" in_use_message = ""
if fuser.result() != 0: 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 extramsg += in_use_message
else: else:
extramsg += unicode(i18n("(none)")) extramsg += str(i18n("(none)"))
if not in_use: if not in_use:
KMessageBox.detailedSorry(parentdialog, msg, extramsg, captionmsg) KMessageBox.detailedSorry(parentdialog, msg, extramsg, captionmsg)
@ -723,8 +723,8 @@ class MountEntryExtAlien(MountEntryExt):
def getFstabOptions(self): def getFstabOptions(self):
# Construct the options field. # Construct the options field.
options = super(MountEntryExtAlien,self).getFstabOptions() options = super(MountEntryExtAlien,self).getFstabOptions()
options.append('uid='+unicode(self.uid)) options.append('uid='+str(self.uid))
options.append('gid='+unicode(self.gid)) options.append('gid='+str(self.gid))
options.append(['noauto','auto'][self.auto]) options.append(['noauto','auto'][self.auto])
options.append(['ro','rw'][self.writeable]) options.append(['ro','rw'][self.writeable])
options.append(['nouser','user','users','owner'][self.allowusermount]) options.append(['nouser','user','users','owner'][self.allowusermount])
@ -877,15 +877,15 @@ class MountEntryExtSMB(MountEntryExtAlien):
# Write out the credentials file # Write out the credentials file
if self.credentialsfile is None: if self.credentialsfile is None:
i = 1 i = 1
while os.path.exists(self.CREDENTIALSBASENAME+unicode(i)): while os.path.exists(self.CREDENTIALSBASENAME+str(i)):
i += 1 i += 1
self.credentialsfile = self.CREDENTIALSBASENAME+unicode(i) self.credentialsfile = self.CREDENTIALSBASENAME+str(i)
fd = os.open(self.credentialsfile,os.O_WRONLY|os.O_CREAT,0600) fd = os.open(self.credentialsfile,os.O_WRONLY|os.O_CREAT,0o600)
fhandle = os.fdopen(fd,'w') 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') ) .encode(locale.getpreferredencoding(),'replace') )
fhandle.close() fhandle.close()
options.append(u"credentials="+self.credentialsfile) options.append("credentials="+self.credentialsfile)
return options return options
######################################################################## ########################################################################
@ -938,7 +938,7 @@ class MountEntryExtSwap(MountEntryExt):
options.remove('defaults') options.remove('defaults')
except ValueError: except ValueError:
pass pass
self.extraoptions = u",".join(options) self.extraoptions = ",".join(options)
######################################################################## ########################################################################
def copy(self,newobject=None): def copy(self,newobject=None):
@ -1092,7 +1092,7 @@ class MountEntry(object):
self.extension = self.MountTypes[self.mounttype][0](base) self.extension = self.MountTypes[self.mounttype][0](base)
self.extensionObjects[self.mounttype] = self.extension self.extensionObjects[self.mounttype] = self.extension
except (KeyError,IndexError): 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): def getMountType(self):
@ -1104,7 +1104,7 @@ class MountEntry(object):
try: try:
self.extensionObjects[newtypename] = self.MountTypes[newtypename][0](self.extension) self.extensionObjects[newtypename] = self.MountTypes[newtypename][0](self.extension)
except KeyError: except KeyError:
raise NotImplementedError, "Unknown mounttype:"+newtypename raise NotImplementedError("Unknown mounttype:"+newtypename)
self.mounttype = newtypename self.mounttype = newtypename
self.extension = self.extensionObjects[newtypename] self.extension = self.extensionObjects[newtypename]
self.extension.setMountType(newtypename) self.extension.setMountType(newtypename)
@ -1136,8 +1136,8 @@ class MountEntry(object):
def __getattr__(self,name): def __getattr__(self,name):
try: try:
return getattr(self.extension,name) return getattr(self.extension,name)
except AttributeError, a: except AttributeError as a:
print a print(a)
######################################################################## ########################################################################
# FIXME # FIXME
@ -1150,7 +1150,7 @@ class MountEntry(object):
######################################################################## ########################################################################
def getMountTypes(): def getMountTypes():
return MountEntry.MountTypes.keys() return list(MountEntry.MountTypes.keys())
getMountTypes = staticmethod(getMountTypes) getMountTypes = staticmethod(getMountTypes)
######################################################################## ########################################################################
@ -1160,7 +1160,7 @@ class MountEntry(object):
######################################################################## ########################################################################
def encodeMountEntryString(string): def encodeMountEntryString(string):
newstring = u"" newstring = ""
for c in string: for c in string:
if c==' ': if c==' ':
newstring += "\\040" newstring += "\\040"
@ -1263,13 +1263,13 @@ class MountTable(object):
fhandle.close() fhandle.close()
if not sysfs_in_fstab: 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.notInFstab = True
sysfsentry.maydisable = False sysfsentry.maydisable = False
#self.append(sysfsentry) #self.append(sysfsentry)
if not usbdevfs_in_fstab: 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.notInFstab = True
usbdevfsentry.maydisable = False usbdevfsentry.maydisable = False
self.append(usbdevfsentry) self.append(usbdevfsentry)
@ -1314,8 +1314,8 @@ class MountTable(object):
for entry in self.allentries: for entry in self.allentries:
if not entry.notInFstab: if not entry.notInFstab:
line = entry.getFstabLine() line = entry.getFstabLine()
fhandle.write(line+u"\n") fhandle.write(line+"\n")
print line print(line)
fhandle.close() fhandle.close()
fhandle = None fhandle = None
@ -1335,7 +1335,7 @@ class MountTable(object):
return self.entries.__contains(item) return self.entries.__contains(item)
######################################################################## ########################################################################
def __delitem__(self,key): def __delitem__(self,key):
raise NotImplementedError, "No __delitem__ on MountTable." raise NotImplementedError("No __delitem__ on MountTable.")
######################################################################## ########################################################################
def __getitem__(self,key): def __getitem__(self,key):
@ -1349,7 +1349,7 @@ class MountTable(object):
return self.entries.__len__() return self.entries.__len__()
######################################################################## ########################################################################
def __setitem__(self,key,value): def __setitem__(self,key,value):
raise NotImplementedError, "No __setitem__ on MountTable." raise NotImplementedError("No __setitem__ on MountTable.")
############################################################################ ############################################################################
class MountEntryDialogOptions(TQWidget): class MountEntryDialogOptions(TQWidget):
@ -1547,20 +1547,20 @@ class MountEntryDialogOptions(TQWidget):
######################################################################## ########################################################################
def undisplayMountEntry(self,entry): def undisplayMountEntry(self,entry):
if self.showmountpoint: if self.showmountpoint:
entry.setMountPoint( unicode(self.mountpointlineedit.text()) ) entry.setMountPoint( str(self.mountpointlineedit.text()) )
if self.showdevice: if self.showdevice:
entry.setDevice( unicode(self.devicelineedit.text()) ) entry.setDevice( str(self.devicelineedit.text()) )
if self.showuuid and self.showdevice: if self.showuuid and self.showdevice:
if self.devicecheckbox.isChecked(): if self.devicecheckbox.isChecked():
entry.setUUID(None) entry.setUUID(None)
else: else:
entry.setUUID( unicode(self.uuidlineedit.text()) ) entry.setUUID( str(self.uuidlineedit.text()) )
if self.showlabel and self.showdevice: if self.showlabel and self.showdevice:
if self.devicecheckbox.isChecked(): if self.devicecheckbox.isChecked():
entry.setLabel(None) entry.setLabel(None)
else: else:
entry.setLabel( unicode(self.labellineedit.text()) ) entry.setLabel( str(self.labellineedit.text()) )
if allowuuid and self.showuuid: if allowuuid and self.showuuid:
if self.uuidcheckbox.isChecked(): if self.uuidcheckbox.isChecked():
@ -1572,7 +1572,7 @@ class MountEntryDialogOptions(TQWidget):
if self.devicecheckbox.isChecked(): if self.devicecheckbox.isChecked():
entry.setUseAsDevice("devicenode") entry.setUseAsDevice("devicenode")
entry.setExtraOptions( unicode(self.optionslineedit.text()) ) entry.setExtraOptions( str(self.optionslineedit.text()) )
if self.showfs_freq: if self.showfs_freq:
entry.setFSFreq(self.fsfreqspinbox.value()) entry.setFSFreq(self.fsfreqspinbox.value())
if self.showfs_passno: if self.showfs_passno:
@ -1597,7 +1597,7 @@ class MountEntryDialogOptions(TQWidget):
######################################################################## ########################################################################
def slotUUIDCheckboxClicked(self): def slotUUIDCheckboxClicked(self):
if self.uuidlineedit.text() == "": if self.uuidlineedit.text() == "":
label = microhal.getUUIDByDevice(unicode(self.devicelineedit.text())) label = microhal.getUUIDByDevice(str(self.devicelineedit.text()))
self.uuidlineedit.setText(label) self.uuidlineedit.setText(label)
self.devicecheckbox.setChecked(False) self.devicecheckbox.setChecked(False)
self.devicelineedit.setEnabled(False) self.devicelineedit.setEnabled(False)
@ -1607,7 +1607,7 @@ class MountEntryDialogOptions(TQWidget):
def slotLabelCheckboxClicked(self): def slotLabelCheckboxClicked(self):
if self.labellineedit.text() == "": if self.labellineedit.text() == "":
label = microhal.getLabelByDevice(unicode(self.devicelineedit.text())) label = microhal.getLabelByDevice(str(self.devicelineedit.text()))
self.labellineedit.setText(label) self.labellineedit.setText(label)
self.uuidcheckbox.setChecked(False) self.uuidcheckbox.setChecked(False)
self.devicelineedit.setEnabled(False) self.devicelineedit.setEnabled(False)
@ -1775,24 +1775,24 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
######################################################################## ########################################################################
def undisplayMountEntry(self,entry): def undisplayMountEntry(self,entry):
entry.setDevice( unicode(self.devicelineedit.text()) ) entry.setDevice( str(self.devicelineedit.text()) )
if self.showuuid: if self.showuuid:
if self.devicecheckbox.isChecked() or self.labelcheckbox.isChecked(): if self.devicecheckbox.isChecked() or self.labelcheckbox.isChecked():
entry.setUUID(None) entry.setUUID(None)
else: else:
entry.setUUID( unicode(self.uuidlineedit.text()) ) entry.setUUID( str(self.uuidlineedit.text()) )
if self.showlabel: if self.showlabel:
if self.devicecheckbox.isChecked() or self.uuidcheckbox.isChecked(): if self.devicecheckbox.isChecked() or self.uuidcheckbox.isChecked():
entry.setLabel(None) entry.setLabel(None)
else: else:
entry.setLabel( unicode(self.labellineedit.text()) ) entry.setLabel( str(self.labellineedit.text()) )
if not self.showlabel and not self.showuuid: if not self.showlabel and not self.showuuid:
if self.uuidcheckbox.isChecked() or self.labelcheckbox.isChecked(): if self.uuidcheckbox.isChecked() or self.labelcheckbox.isChecked():
entry.setLabel(None) entry.setLabel(None)
else: else:
entry.setLabel( unicode(self.devicelineedit.text()) ) entry.setLabel( str(self.devicelineedit.text()) )
if allowuuid: if allowuuid:
if self.uuidcheckbox.isChecked(): if self.uuidcheckbox.isChecked():
@ -1803,7 +1803,7 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
if self.devicecheckbox.isChecked(): if self.devicecheckbox.isChecked():
entry.setUseAsDevice("devicenode") entry.setUseAsDevice("devicenode")
entry.setMountPoint( unicode(self.mountpointlineedit.text()) ) entry.setMountPoint( str(self.mountpointlineedit.text()) )
entry.setExtraOptions(self.options) entry.setExtraOptions(self.options)
entry.setFSFreq(self.fsfreq) entry.setFSFreq(self.fsfreq)
entry.setFSPassno(self.fspassno) entry.setFSPassno(self.fspassno)
@ -1833,7 +1833,7 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
######################################################################## ########################################################################
def slotUUIDCheckboxClicked(self): def slotUUIDCheckboxClicked(self):
if self.uuidlineedit.text() == "": if self.uuidlineedit.text() == "":
label = microhal.getUUIDByDevice(unicode(self.devicelineedit.text())) label = microhal.getUUIDByDevice(str(self.devicelineedit.text()))
self.uuidlineedit.setText(label) self.uuidlineedit.setText(label)
self.devicecheckbox.setChecked(False) self.devicecheckbox.setChecked(False)
self.devicelineedit.setEnabled(False) self.devicelineedit.setEnabled(False)
@ -1843,7 +1843,7 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
def slotLabelCheckboxClicked(self): def slotLabelCheckboxClicked(self):
if self.labellineedit.text() == "": if self.labellineedit.text() == "":
label = microhal.getLabelByDevice(unicode(self.devicelineedit.text())) label = microhal.getLabelByDevice(str(self.devicelineedit.text()))
self.labellineedit.setText(label) self.labellineedit.setText(label)
self.devicecheckbox.setChecked(False) self.devicecheckbox.setChecked(False)
self.devicelineedit.setEnabled(False) self.devicelineedit.setEnabled(False)
@ -2073,11 +2073,11 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
else: else:
if allowlabel: if allowlabel:
if self.labelcheckbox.isChecked(): if self.labelcheckbox.isChecked():
entry.setLabel( unicode(self.labellineedit.text()) ) entry.setLabel( str(self.labellineedit.text()) )
else: else:
entry.setUUID( unicode(self.uuidlineedit.text()) ) entry.setUUID( str(self.uuidlineedit.text()) )
else: else:
entry.setUUID( unicode(self.uuidlineedit.text()) ) entry.setUUID( str(self.uuidlineedit.text()) )
if allowlabel: if allowlabel:
if self.devicecheckbox.isChecked(): if self.devicecheckbox.isChecked():
@ -2085,15 +2085,15 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
else: else:
if allowuuid: if allowuuid:
if self.uuidcheckbox.isChecked(): if self.uuidcheckbox.isChecked():
entry.setUUID( unicode(self.uuidlineedit.text()) ) entry.setUUID( str(self.uuidlineedit.text()) )
else: else:
entry.setLabel( unicode(self.labellineedit.text()) ) entry.setLabel( str(self.labellineedit.text()) )
else: 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.setExtraOptions(self.options)
entry.setFSFreq(self.fsfreq) entry.setFSFreq(self.fsfreq)
entry.setFSPassno(self.fspassno) entry.setFSPassno(self.fspassno)
@ -2118,7 +2118,7 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
######################################################################## ########################################################################
def slotUUIDCheckboxClicked(self): def slotUUIDCheckboxClicked(self):
if self.uuidlineedit.text() == "": if self.uuidlineedit.text() == "":
label = microhal.getUUIDByDevice(unicode(self.devicelineedit.text())) label = microhal.getUUIDByDevice(str(self.devicelineedit.text()))
self.uuidlineedit.setText(label) self.uuidlineedit.setText(label)
self.devicecheckbox.setChecked(False) self.devicecheckbox.setChecked(False)
self.devicelineedit.setEnabled(False) self.devicelineedit.setEnabled(False)
@ -2249,8 +2249,8 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
self.selectsmbdialog = SMBShareSelectDialog(None) self.selectsmbdialog = SMBShareSelectDialog(None)
# This just converts a \\zootv\data\ share name to smb:/zootv/data # 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!=""] parts = [x.replace("/",'\\') for x in str(self.devicelineedit.text()).split('\\') if x!=""]
oldurl = u"smb:/"+("/".join(parts) ) oldurl = "smb:/"+("/".join(parts) )
urlobj = KURL(oldurl) urlobj = KURL(oldurl)
if self.userradio.isChecked(): if self.userradio.isChecked():
@ -2262,7 +2262,7 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
plainurl = KURL(newurlobj) plainurl = KURL(newurlobj)
plainurl.setUser(TQString.null) plainurl.setUser(TQString.null)
plainurl.setPass(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 #convert the first part to an IP address
nmboutput = subprocess.Popen(["nmblookup",parts[0]], stdout=subprocess.PIPE).stdout nmboutput = subprocess.Popen(["nmblookup",parts[0]], stdout=subprocess.PIPE).stdout
nmboutput.readline() nmboutput.readline()
@ -2317,8 +2317,8 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
######################################################################## ########################################################################
def undisplayMountEntry(self,entry): def undisplayMountEntry(self,entry):
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.setExtraOptions(self.options)
entry.setFSFreq(self.fsfreq) entry.setFSFreq(self.fsfreq)
entry.setFSPassno(self.fspassno) entry.setFSPassno(self.fspassno)
@ -2332,8 +2332,8 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
entry.setUsername(None) entry.setUsername(None)
entry.setPassword(None) entry.setPassword(None)
else: else:
entry.setUsername( unicode(self.usernameedit.text()) ) entry.setUsername( str(self.usernameedit.text()) )
entry.setPassword( unicode(self.passwordedit.text()) ) entry.setPassword( str(self.passwordedit.text()) )
######################################################################## ########################################################################
def slotAdvancedClicked(self): def slotAdvancedClicked(self):
@ -2455,7 +2455,7 @@ class MountEntryDialog(KDialogBase):
# Disk types # Disk types
ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-hdd"),i18n("Disk Filesystems")) ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-hdd"),i18n("Disk Filesystems"))
self.comboIndexToMountType.append(None) self.comboIndexToMountType.append(None)
items = self.MountTypeEditorsDisk.keys() items = list(self.MountTypeEditorsDisk.keys())
items.sort() items.sort()
for mounttype in items: for mounttype in items:
self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype)) self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype))
@ -2464,7 +2464,7 @@ class MountEntryDialog(KDialogBase):
# Network types # Network types
ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-network"),i18n("Network Filesystems")) ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-network"),i18n("Network Filesystems"))
self.comboIndexToMountType.append(None) self.comboIndexToMountType.append(None)
items = self.MountTypeEditorsNetwork.keys() items = list(self.MountTypeEditorsNetwork.keys())
items.sort() items.sort()
for mounttype in items: for mounttype in items:
self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype)) self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype))
@ -2473,7 +2473,7 @@ class MountEntryDialog(KDialogBase):
# System types # System types
ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-blockdevice"),i18n("Operating System")) ROListBoxItem(self.mounttypecombo.listBox(),UserIcon("hi16-blockdevice"),i18n("Operating System"))
self.comboIndexToMountType.append(None) self.comboIndexToMountType.append(None)
items = self.MountTypeEditorsSystem.keys() items = list(self.MountTypeEditorsSystem.keys())
items.sort() items.sort()
for mounttype in items: for mounttype in items:
self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype)) self.mounttypecombo.insertItem(MountEntry.getMountTypeLongName(mounttype))
@ -2597,7 +2597,7 @@ class MountEntryDialog(KDialogBase):
i18n("Mountpoint already in use"))!=KMessageBox.Continue: i18n("Mountpoint already in use"))!=KMessageBox.Continue:
return 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 ... # If device is not in /dev and it's no bind mount, ask if that's meant this way ...
options = self.currentMountEntry.getFstabOptions() options = self.currentMountEntry.getFstabOptions()
if (not self.currentMountEntry.getDevice().startswith("/dev/") if (not self.currentMountEntry.getDevice().startswith("/dev/")
@ -2696,7 +2696,7 @@ class MountEntryAdvancedCommonUnixDialog(KDialogBase):
self.allowexecutablecheckbox.isChecked(), self.allowexecutablecheckbox.isChecked(),
self.allowsuidcheckbox.isChecked(), self.allowsuidcheckbox.isChecked(),
self.usedevpointscheckbox.isChecked(), self.usedevpointscheckbox.isChecked(),
unicode(self.optionslineedit.text()), str(self.optionslineedit.text()),
self.fsfreqspinbox.value(), self.fsfreqspinbox.value(),
self.fspassnospinbox.value()) self.fspassnospinbox.value())
@ -2724,7 +2724,7 @@ class MountEntryAdvancedPlainDialog(KDialogBase):
self.fsfreqspinbox.setValue(fsfreq) self.fsfreqspinbox.setValue(fsfreq)
self.fspassnospinbox.setValue(fspassno) self.fspassnospinbox.setValue(fspassno)
self.exec_loop() 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): class MountListViewItem(TDEListViewItem):
@ -3091,13 +3091,13 @@ class MountConfigApp(programbase):
blk = hal_device.getDev() blk = hal_device.getDev()
devicepath, devicename = ('/'.join(blk.split('/')[0:-1])+'/', blk.split('/')[-1]) 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. # 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] = sizeview.SizeView(self,devicename,devicepath)
self.sizeviewdialogs[devicename].exec_loop() self.sizeviewdialogs[devicename].exec_loop()
else: else:
self.sizeviewdialogs[devicename].exec_loop() self.sizeviewdialogs[devicename].exec_loop()
else: else:
print "Sizeview doesn't support",blk.__class__," yet." print("Sizeview doesn't support",blk.__class__," yet.")
######################################################################## ########################################################################
def slotListClicked(self,item): def slotListClicked(self,item):

@ -62,7 +62,7 @@ class SizeView(TQDialog):
self.readSize() self.readSize()
self.readSwaps() self.readSwaps()
partitions = self.partitions.keys() partitions = list(self.partitions.keys())
partitions.sort() partitions.sort()
number=1 number=1
@ -99,7 +99,7 @@ class SizeView(TQDialog):
rows = int(n/cols)+1 rows = int(n/cols)+1
else: else:
rows = int(n/cols) rows = int(n/cols)
if n is 1: rows = 2 if n == 1: rows = 2
# Build main Gridlayout. # Build main Gridlayout.
total_rows = rows+2 total_rows = rows+2
@ -209,7 +209,7 @@ class DiskGroup(TQGroupBox):
self.diskview.setScaledContents(1) self.diskview.setScaledContents(1)
DiskViewGroupLayout.addWidget(self.diskview) DiskViewGroupLayout.addWidget(self.diskview)
parts = self.partitions.keys() parts = list(self.partitions.keys())
parts.sort() parts.sort()
self.percentages() self.percentages()
@ -247,11 +247,11 @@ class DiskGroup(TQGroupBox):
def percentages(self): def percentages(self):
p_t = 0 p_t = 0
for p in self.partitions.values(): for p in list(self.partitions.values()):
p_t += int(p) p_t += int(p)
self.perc = {} 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)) self.perc[p] = float(float(self.partitions[p])/float(p_t))
return self.perc return self.perc
@ -408,7 +408,8 @@ class DiskPixmap(TQPixmap):
linewidth = 2 # Width of surrounding frame 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.percents = percents
self.w,self.h = w,h self.w,self.h = w,h
self.colors = colors self.colors = colors
@ -425,7 +426,7 @@ class DiskPixmap(TQPixmap):
# Paint background, this is interesting for empty partitions. # Paint background, this is interesting for empty partitions.
p.fillRect(0,0,w,h,TQBrush(TQColor("white"))) p.fillRect(0,0,w,h,TQBrush(TQColor("white")))
parts = self.percents.keys() parts = list(self.percents.keys())
parts.sort() parts.sort()
xa = wa = 0 xa = wa = 0
for part in parts: for part in parts:

@ -58,7 +58,7 @@ class DescriptionCache(object):
def __init__(self,filename,path="/tmp"): def __init__(self,filename,path="/tmp"):
if not os.path.isdir(path): 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) self.filename = os.path.join(path,filename)
@ -68,15 +68,15 @@ class DescriptionCache(object):
pickler = Unpickler(fhandle) pickler = Unpickler(fhandle)
self.data = pickler.load() self.data = pickler.load()
fhandle.close() fhandle.close()
except IOError, e: except IOError as e:
print "Couldn't load file:", e print("Couldn't load file:", e)
print "Not reading description cache data" print("Not reading description cache data")
def saveCache(self): def saveCache(self):
""" Save pickled dataobject to the file. We don't want the user to be able to save a datastructure that root """ 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.""" will read in since that would have implications for security."""
if not isroot: 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 return
try: try:
@ -85,8 +85,8 @@ class DescriptionCache(object):
pickler.dump(self.data) pickler.dump(self.data)
fhandle.close() fhandle.close()
#print "Saved description cache data to ", self.filename #print "Saved description cache data to ", self.filename
except IOError, e: except IOError as e:
print "Can't cache:", e print("Can't cache:", e)
def add(self,filename,packagename,description): def add(self,filename,packagename,description):
self.data[filename] = (packagename,description) self.data[filename] = (packagename,description)
@ -117,7 +117,7 @@ class Service(object):
self.runlevels = [] self.runlevels = []
self.gotStatus = False self.gotStatus = False
self.statusable = False self.statusable = False
self.status = unicode(i18n("?")) self.status = str(i18n("?"))
self.startpriority = "50" self.startpriority = "50"
self.killpriority = "50" self.killpriority = "50"
@ -392,7 +392,7 @@ class DebianService(Service):
self.runlevels = [] self.runlevels = []
self.gotStatus = False self.gotStatus = False
self.statusable = False self.statusable = False
self.status = unicode(i18n("not running")) self.status = str(i18n("not running"))
self.startpriority = "50" self.startpriority = "50"
self.killpriority = "50" self.killpriority = "50"
self.getStatusFrom = "pidfile" self.getStatusFrom = "pidfile"
@ -433,7 +433,7 @@ class DebianService(Service):
if ":" in line: if ":" in line:
self.packagename = line.strip().split(":")[0] self.packagename = line.strip().split(":")[0]
else: 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): def fetchStatus(self):
@ -452,14 +452,14 @@ class DebianService(Service):
def fetchStatusFromPidFile(self): def fetchStatusFromPidFile(self):
try: try:
if os.path.isfile(os.path.join('/var/run',self.pidfiles[self.filename])): if os.path.isfile(os.path.join('/var/run',self.pidfiles[self.filename])):
self.status = unicode(i18n("running")) self.status = str(i18n("running"))
else: else:
self.status = unicode(i18n("not running")) self.status = str(i18n("not running"))
except KeyError: except KeyError:
if os.path.isfile(os.path.join('/var/run',self.filename + '.pid')): if os.path.isfile(os.path.join('/var/run',self.filename + '.pid')):
self.status = unicode(i18n("running")) self.status = str(i18n("running"))
else: else:
self.status = unicode(i18n("not running")) self.status = str(i18n("not running"))
self.gotStatus = True self.gotStatus = True
############################################################################ ############################################################################
@ -546,7 +546,7 @@ class DebianServiceContext(ServiceContext):
shell_output.close() shell_output.close()
cur_runlevel = raw_runlevel[2:-1] cur_runlevel = raw_runlevel[2:-1]
for num in deb_runlevels.keys(): for num in list(deb_runlevels.keys()):
if cur_runlevel.isdigit(): if cur_runlevel.isdigit():
if num == int(cur_runlevel): if num == int(cur_runlevel):
self.__currentrunlevel = DebianRunLevel(self, num, deb_runlevels[num]) self.__currentrunlevel = DebianRunLevel(self, num, deb_runlevels[num])
@ -554,11 +554,11 @@ class DebianServiceContext(ServiceContext):
else: else:
self.runlevels.append(DebianRunLevel(self, num, deb_runlevels[num])) self.runlevels.append(DebianRunLevel(self, num, deb_runlevels[num]))
else: else:
if num == cur_runlevel: if num == cur_runlevel:
self.__currentrunlevel = DebianRunLevel(self, num, deb_runlevels[num]) self.__currentrunlevel = DebianRunLevel(self, num, deb_runlevels[num])
self.runlevels.append(self.__currentrunlevel) self.runlevels.append(self.__currentrunlevel)
else: else:
self.runlevels.append(DebianRunLevel(self, num, deb_runlevels[num])) self.runlevels.append(DebianRunLevel(self, num, deb_runlevels[num]))
self._filenametoservice = {} self._filenametoservice = {}
######################################################################## ########################################################################
@ -632,22 +632,22 @@ class DebianRunLevel(SysVRunLevel):
#print "Removing symlink, " + linkname + ", the target does not match." #print "Removing symlink, " + linkname + ", the target does not match."
try: try:
posix.unlink(linkname) posix.unlink(linkname)
except OSError, e: except OSError as e:
print "Couldn't remove symlink " + linkname + " :: " + str(e) print("Couldn't remove symlink " + linkname + " :: " + str(e))
try: try:
posix.symlink(target, linkname) posix.symlink(target, linkname)
#print "Created symlink " + linkname + " -> " + target + " successfully." #print "Created symlink " + linkname + " -> " + target + " successfully."
os.chdir(odir) os.chdir(odir)
return True return True
except OSError, e: except OSError as e:
#print "Creating symlink " + linkname + " -> " + target + " failed: " + str(e) #print "Creating symlink " + linkname + " -> " + target + " failed: " + str(e)
os.chdir(odir) os.chdir(odir)
return False return False
def removeSymlink(servicename, runleveldir, KorS): def removeSymlink(servicename, runleveldir, KorS):
if KorS not in ('K','S'): 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 return
for link in os.listdir(runleveldir): for link in os.listdir(runleveldir):
if (link[0] == KorS) and (link[3:] == servicename): if (link[0] == KorS) and (link[3:] == servicename):
@ -672,8 +672,8 @@ class DebianRunLevel(SysVRunLevel):
runleveldir = os.path.join(leveldir,"rc"+l_num+".d") runleveldir = os.path.join(leveldir,"rc"+l_num+".d")
#print "Removing symlink " + s_link #print "Removing symlink " + s_link
removeSymlink(service.filename, runleveldir, "S") removeSymlink(service.filename, runleveldir, "S")
except OSError, e: except OSError as e:
print "Could not remove symlink " + s_link + " :: " + str(e) print("Could not remove symlink " + s_link + " :: " + str(e))
self.activeservices.remove(service) self.activeservices.remove(service)
@ -698,8 +698,8 @@ class DebianRunLevel(SysVRunLevel):
try: try:
#print "Removing " + k_link #print "Removing " + k_link
removeSymlink(service.filename, runleveldir, "K") removeSymlink(service.filename, runleveldir, "K")
except OSError, e: except OSError as e:
print "Could not remove " + k_link + " :: " + str(e) print("Could not remove " + k_link + " :: " + str(e))
############################################################################ ############################################################################
@ -746,7 +746,7 @@ class GentooService(DebianService):
else: description_lines.append(line[1:].strip()) else: description_lines.append(line[1:].strip())
fhandle.close() fhandle.close()
else: 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): if len(description_lines):
self.description = "\n".join(description_lines) self.description = "\n".join(description_lines)
@ -812,7 +812,7 @@ class GentooServiceContext(ServiceContext):
def currentRunLevelNum(): def currentRunLevelNum():
runlevelbin = "/sbin/runlevel" runlevelbin = "/sbin/runlevel"
if not os.path.isfile(runlevelbin): 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) sys.exit(1)
shell_output = os.popen(runlevelbin) shell_output = os.popen(runlevelbin)
raw_runlevel = shell_output.readline() raw_runlevel = shell_output.readline()
@ -877,7 +877,7 @@ class GentooRunLevel(SysVRunLevel):
#self.no_dirs = ('reboot', 'shutdown', 'single') #self.no_dirs = ('reboot', 'shutdown', 'single')
if self.dirname not in self.no_dirs: if self.dirname not in self.no_dirs:
self.no_dirs.append(self.dirname) 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 self.leveldir = False
return return
@ -885,7 +885,7 @@ class GentooRunLevel(SysVRunLevel):
def loadInfo(self): def loadInfo(self):
""" Only look up active services if runlevel path exists, else leave empty. """ """ Only look up active services if runlevel path exists, else leave empty. """
if self.leveldir: if self.leveldir:
print "GentooRunLevel.loadInfo() from " + self.leveldir print("GentooRunLevel.loadInfo() from " + self.leveldir)
for filename in os.listdir(self.leveldir): for filename in os.listdir(self.leveldir):
# Exclude backup files from portage and .sh files like shutdown, depscan, etc. # Exclude backup files from portage and .sh files like shutdown, depscan, etc.
if (filename.find('._cfg')<0) and not filename.endswith('.sh'): if (filename.find('._cfg')<0) and not filename.endswith('.sh'):
@ -895,9 +895,9 @@ class GentooRunLevel(SysVRunLevel):
if target in self.context._filenametoservice: if target in self.context._filenametoservice:
self.activeservices.append(self.context._filenametoservice[target]) self.activeservices.append(self.context._filenametoservice[target])
else: else:
print "Couldn't find service '%s'. " % target print("Couldn't find service '%s'. " % target)
else: else:
print "%s is not a valid symlink." % linkname print("%s is not a valid symlink." % linkname)
######################################################################## ########################################################################
def setActiveAtBoot(self,service,activeflag): 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". # FIXME :: "Start at Boot" column does not properly get updated once it's "False".
# The commands issued might better be passed through via CommandRunner. # The commands issued might better be passed through via CommandRunner.
if self.name in self.no_dirs: 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 activeflag:
if not service in self.activeservices: if not service in self.activeservices:
rc_add_cmd = "rc-update add %s %s" % (service.filename, self.dirname) 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. # The brave really run it yet.
os.system(rc_add_cmd) os.system(rc_add_cmd)
self.activeservices.append(service) self.activeservices.append(service)
else: else:
if service in self.activeservices: if service in self.activeservices:
rc_del_cmd = "rc-update del %s %s" % (service.filename, self.dirname) 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. # The brave really run it yet.
os.system(rc_dell_cmd) os.system(rc_dell_cmd)
self.activeservices.remove(service) self.activeservices.remove(service)
@ -1194,7 +1194,7 @@ class SysVInitApp(programbase):
return return
self.updatingGUI = True self.updatingGUI = True
for service in self.servicestolistitems.keys(): for service in list(self.servicestolistitems.keys()):
if self.servicestolistitems[service] is item: if self.servicestolistitems[service] is item:
self.selectedservice = service self.selectedservice = service
self.__selectService(self.selectedservice) self.__selectService(self.selectedservice)
@ -1440,13 +1440,13 @@ class CommandRunner(KDialogBase):
uncolor = lambda text: re.compile('\\x1b\[[0-9]+;01m').sub("", \ 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('\\x1b\[0m').sub("", re.compile('\\033\[1;[0-9]+m').sub("", \
re.compile('\\033\[0m').sub("", text)))) 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.setText(self.output)
self.outputtextview.ensureVisible(0,self.outputtextview.contentsHeight()) self.outputtextview.ensureVisible(0,self.outputtextview.contentsHeight())
######################################################################## ########################################################################
def slotReadyReadStderr(self): def slotReadyReadStderr(self):
self.output += unicode(self.kid.readStderr()) self.output += str(self.kid.readStderr())
self.outputtextview.setText(self.output) self.outputtextview.setText(self.output)
self.outputtextview.ensureVisible(0,self.outputtextview.contentsHeight()) self.outputtextview.ensureVisible(0,self.outputtextview.contentsHeight())

@ -1,5 +1,5 @@
import os import os
fhandle = open("install_log.txt","r") fhandle = open("install_log.txt","r")
for line in fhandle.readlines(): for line in fhandle.readlines():
print "deleting ", line[:-1] print("deleting ", line[:-1])
os.system("rm -f "+line[:-1]) os.system("rm -f "+line[:-1])

@ -37,7 +37,7 @@ def createTempFile(origfile):
try: try:
ret = tempfile.mkstemp(prefix=tmp_prefix, dir=tmp_dir) ret = tempfile.mkstemp(prefix=tmp_prefix, dir=tmp_dir)
except: 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 (fd, tmpfile) = ret
shutil.copymode(origfile, tmpfile) shutil.copymode(origfile, tmpfile)
os.chown(tmpfile, origstat.st_uid, origstat.st_gid) os.chown(tmpfile, origstat.st_uid, origstat.st_gid)
@ -68,18 +68,18 @@ def getContext(editmode=False):
try: try:
if os.environ["USERCONFIG_USES_LDAP"].lower() == "true": if os.environ["USERCONFIG_USES_LDAP"].lower() == "true":
use_ldap = True use_ldap = True
except KeyError,e: except KeyError as e:
use_ldap = False use_ldap = False
if not use_ldap: if not use_ldap:
return PwdContext(editmode) return PwdContext(editmode)
else: else:
print "===================================================================" print("===================================================================")
print "Warning:" print("Warning:")
print "\tYou are using LDAP as backend. This feature is under development" print("\tYou are using LDAP as backend. This feature is under development")
print "\tand it is currently not recommended to use it." 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("\tIf you do not want to use LDAP as backend, set the environmental")
print "\tvariabale 'USERCONFIG_USES_LDAP' to 'False'." print("\tvariabale 'USERCONFIG_USES_LDAP' to 'False'.")
print "===================================================================" print("===================================================================")
return LdapContext(editmode) return LdapContext(editmode)
########################################################################### ###########################################################################
@ -117,9 +117,9 @@ class Context(object):
newuserobj = self._createUser() newuserobj = self._createUser()
if defaults: if defaults:
if systemuser: if systemuser:
r = xrange(0,self.last_system_uid) r = range(0,self.last_system_uid)
else: else:
r = xrange(self.first_uid,self.last_uid) r = range(self.first_uid,self.last_uid)
for candiate in r: for candiate in r:
for u in self._users: for u in self._users:
if u.getUID()==candiate: if u.getUID()==candiate:
@ -128,13 +128,13 @@ class Context(object):
newuserobj.setUID(candiate) newuserobj.setUID(candiate)
break break
if self.lookupUsername(u'new_user') is None: if self.lookupUsername('new_user') is None:
newuserobj.setUsername(u'new_user') newuserobj.setUsername('new_user')
else: else:
i = 1 i = 1
while 1: while 1:
if self.lookupUsername(u'new_user_'+str(i)) is None: if self.lookupUsername('new_user_'+str(i)) is None:
newuserobj.setUsername(u'new_user_'+str(i)) newuserobj.setUsername('new_user_'+str(i))
break break
i += 1 i += 1
return newuserobj return newuserobj
@ -155,7 +155,7 @@ class Context(object):
try: try:
self._groups.remove("new_user") self._groups.remove("new_user")
except ValueError: except ValueError:
print "no user removed" print("no user removed")
pass pass
return self._groups[:] return self._groups[:]
@ -180,9 +180,9 @@ class Context(object):
newgroupobj = self._createGroup() newgroupobj = self._createGroup()
if defaults: if defaults:
if systemgroup: if systemgroup:
r = xrange(0,self.last_system_gid) r = range(0,self.last_system_gid)
else: else:
r = xrange(self.first_gid,self.last_gid) r = range(self.first_gid,self.last_gid)
for candiate in r: for candiate in r:
for u in self._groups: for u in self._groups:
if u.getGID()==candiate: if u.getGID()==candiate:
@ -190,19 +190,19 @@ class Context(object):
else: else:
newgroupobj.setGID(candiate) newgroupobj.setGID(candiate)
break break
if self.lookupGroupname(u'new_group') is None: if self.lookupGroupname('new_group') is None:
newgroupobj.setGroupname(u'new_group') newgroupobj.setGroupname('new_group')
else: else:
i = 1 i = 1
while 1: while 1:
if self.lookupGroupname(u'new_user_'+str(i)) is None: if self.lookupGroupname('new_user_'+str(i)) is None:
newgroupobj.setGroupname(u'new_user_'+str(i)) newgroupobj.setGroupname('new_user_'+str(i))
break break
i += 1 i += 1
return newgroupobj return newgroupobj
def _createGroup(self): def _createGroup(self):
raise NotImplementedError, "Context.newGroup()" raise NotImplementedError("Context.newGroup()")
def addUser(self,userobj): def addUser(self,userobj):
"""Adds the given user to the authorisation database. """Adds the given user to the authorisation database.
@ -308,7 +308,7 @@ class Context(object):
fhandle = codecs.open('/etc/shells','r',locale.getpreferredencoding()) fhandle = codecs.open('/etc/shells','r',locale.getpreferredencoding())
for l in fhandle.readlines(): for l in fhandle.readlines():
# TODO: strangely this lets some comented lines slip through # 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 # Only show existing shells
if os.path.isfile(l.strip()): if os.path.isfile(l.strip()):
self._shells.append(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 After a successful save, any changes to the Context will be reflected
system wide. system wide.
""" """
raise NotImplementedError, "Context.save()" raise NotImplementedError("Context.save()")
def createHomeDirectory(self,userobj): def createHomeDirectory(self,userobj):
if os.path.exists(userobj.getHomeDirectory()): 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 # Copy the skeleton directory over
shutil.copytree(self._getSkeletonDirectory(),userobj.getHomeDirectory(),True) shutil.copytree(self._getSkeletonDirectory(),userobj.getHomeDirectory(),True)
@ -348,26 +348,26 @@ class Context(object):
shutil.rmtree(userobj.getHomeDirectory()) shutil.rmtree(userobj.getHomeDirectory())
def _createUser(self): def _createUser(self):
raise NotImplementedError, "Context._createUser()" raise NotImplementedError("Context._createUser()")
def _sanityCheck(self): def _sanityCheck(self):
userids = [] userids = []
for u in self._users: for u in self._users:
if isinstance(u,UnixUser)==False: 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() uid = u.getUID()
if uid in userids: 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) userids.append(uid)
u._sanityCheck() u._sanityCheck()
groupids = [] groupids = []
for g in self._groups: for g in self._groups:
if isinstance(g,UnixGroup)==False: 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() gid = g.getGID()
if gid in groupids: 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) groupids.append(gid)
g._sanityCheck() g._sanityCheck()
@ -447,7 +447,7 @@ class Context(object):
self.dir_mode = int(self.defaults["DIR_MODE"],8) self.dir_mode = int(self.defaults["DIR_MODE"],8)
except (KeyError,ValueError): except (KeyError,ValueError):
self.dir_mode = int("0755",8) self.dir_mode = int("0755",8)
print "Didn't read default DIR_MODE" print("Didn't read default DIR_MODE")
try: try:
self.dhome = self.defaults["DHOME"] self.dhome = self.defaults["DHOME"]
@ -496,11 +496,11 @@ class UnixUser(object):
new_group = self._context.newGroup() new_group = self._context.newGroup()
new_group.setGID(self._gid) new_group.setGID(self._gid)
new_group_name = u"group%i" % self._gid new_group_name = "group%i" % self._gid
i = 0 i = 0
while self._context.lookupGroupname(new_group_name) is not None: while self._context.lookupGroupname(new_group_name) is not None:
i += 1 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) new_group.setGroupname(new_group_name)
self._context.addGroup(new_group) self._context.addGroup(new_group)
@ -526,7 +526,7 @@ class UnixUser(object):
""" """
uid = int(uid) uid = int(uid)
if uid<0: 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 self._uid = uid
def isSystemUser(self): def isSystemUser(self):
@ -642,9 +642,9 @@ class UnixUser(object):
def _sanityCheck(self): def _sanityCheck(self):
if self._primarygroup is None: if self._primarygroup is None:
raise ValueError,"Userobj has no primary group!" raise ValueError("Userobj has no primary group!")
if self._uid is None: if self._uid is None:
raise ValueError,"Userobj has no UID!" raise ValueError("Userobj has no UID!")
########################################################################### ###########################################################################
class UnixGroup(object): class UnixGroup(object):
@ -722,7 +722,7 @@ class PwdContext(Context):
# Read in the password file # Read in the password file
fhandle = codecs.open(passwordfile,'r',locale.getpreferredencoding()) fhandle = codecs.open(passwordfile,'r',locale.getpreferredencoding())
if LockFDRead(fhandle.fileno())==False: if LockFDRead(fhandle.fileno())==False:
raise IOError,"Unable to lock the "+passwordfile+" file." raise IOError("Unable to lock the "+passwordfile+" file.")
try: try:
for line in fhandle.readlines(): for line in fhandle.readlines():
if line.strip()!="": if line.strip()!="":
@ -736,7 +736,7 @@ class PwdContext(Context):
# Read the group file # Read the group file
fhandle = codecs.open(groupfile,'r',locale.getpreferredencoding()) fhandle = codecs.open(groupfile,'r',locale.getpreferredencoding())
if LockFDRead(fhandle.fileno())==False: if LockFDRead(fhandle.fileno())==False:
raise IOError,"Unable to lock the "+groupfile+" file." raise IOError("Unable to lock the "+groupfile+" file.")
try: try:
for line in fhandle.readlines(): for line in fhandle.readlines():
if line.strip()!="": if line.strip()!="":
@ -751,7 +751,7 @@ class PwdContext(Context):
# Load up the info from the shadow file too. # Load up the info from the shadow file too.
fhandle = codecs.open(shadowfile,'r',locale.getpreferredencoding()) fhandle = codecs.open(shadowfile,'r',locale.getpreferredencoding())
if LockFDRead(fhandle.fileno())==False: if LockFDRead(fhandle.fileno())==False:
raise IOError,"Unable to lock the "+shadowfile+" file." raise IOError("Unable to lock the "+shadowfile+" file.")
try: try:
for line in fhandle.readlines(): for line in fhandle.readlines():
if line.strip()!="": if line.strip()!="":
@ -762,7 +762,7 @@ class PwdContext(Context):
userobj = self.lookupUsername(username) userobj = self.lookupUsername(username)
if userobj is not None: if userobj is not None:
if encpass=="": if encpass=="":
encpass = u"*" encpass = "*"
userobj._encpass = encpass userobj._encpass = encpass
if userobj._encpass[0]=='!': if userobj._encpass[0]=='!':
userobj._islocked = True userobj._islocked = True
@ -770,7 +770,7 @@ class PwdContext(Context):
else: else:
userobj._islocked = False userobj._islocked = False
# FIXME : set time # FIXME : set time
if passlastchange and passlastchange!=u"None": if passlastchange and passlastchange!="None":
userobj._passlastchange = int(passlastchange) userobj._passlastchange = int(passlastchange)
else: else:
passlastchange = 0 passlastchange = 0
@ -804,14 +804,14 @@ class PwdContext(Context):
else: else:
userobj._passexpiredisabledays = int(passexpiredisabledays) userobj._passexpiredisabledays = int(passexpiredisabledays)
if disableddays=="" or disableddays==u"99999": if disableddays=="" or disableddays=="99999":
userobj._disableddays = None userobj._disableddays = None
else: else:
userobj._disableddays = int(disableddays) userobj._disableddays = int(disableddays)
userobj._reserve = reserve userobj._reserve = reserve
else: else:
print "Couldn't find",username print("Couldn't find",username)
except ValueError: except ValueError:
pass pass
finally: finally:
@ -831,7 +831,7 @@ class PwdContext(Context):
def save(self): def save(self):
if self.__editmode==False: 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() self._sanityCheck()
@ -845,7 +845,7 @@ class PwdContext(Context):
# Update the passwd file # Update the passwd file
passwordlock = os.open(self.__passwordfile, os.O_WRONLY) # FIXME encoding passwordlock = os.open(self.__passwordfile, os.O_WRONLY) # FIXME encoding
if LockFDWrite(passwordlock)==False: 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: try:
os.rename(tmpname, self.__passwordfile) os.rename(tmpname, self.__passwordfile)
finally: finally:
@ -864,7 +864,7 @@ class PwdContext(Context):
# Update the group file. # Update the group file.
grouplock = os.open(self.__groupfile, os.O_WRONLY) grouplock = os.open(self.__groupfile, os.O_WRONLY)
if LockFDWrite(grouplock)==False: 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: try:
os.rename(tmpname, self.__groupfile) os.rename(tmpname, self.__groupfile)
finally: finally:
@ -887,7 +887,7 @@ class PwdContext(Context):
shadowlock = os.open(self.__shadowfile, os.O_WRONLY) shadowlock = os.open(self.__shadowfile, os.O_WRONLY)
if LockFDWrite(shadowlock)==False: 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: try:
os.rename(tmpname, self.__shadowfile) os.rename(tmpname, self.__shadowfile)
finally: finally:
@ -917,7 +917,7 @@ class LdapContext(Context):
self.editmode = editmode self.editmode = editmode
if not self.editmode: if not self.editmode:
self.ldapserver.simple_bind("admin",admin_pass) self.ldapserver.simple_bind("admin",admin_pass)
print "Connected to ", self.url print("Connected to ", self.url)
self._users = self._getUsers() self._users = self._getUsers()
@ -925,7 +925,7 @@ class LdapContext(Context):
""" Retrieve a list of users from the LDAP server. """ Retrieve a list of users from the LDAP server.
""" """
_users = [] _users = []
print "LdapContext._getUsers" print("LdapContext._getUsers")
searchScope = ldap.SCOPE_SUBTREE searchScope = ldap.SCOPE_SUBTREE
retrieveAttributes = None retrieveAttributes = None
searchFilter = "cn=*" searchFilter = "cn=*"
@ -942,11 +942,11 @@ class LdapContext(Context):
#print " --------------------- " #print " --------------------- "
result_set.append(result_data[0][1]) result_set.append(result_data[0][1])
#print result_set #print result_set
except ldap.LDAPError, e: except ldap.LDAPError as e:
print "ERROR: ",e print("ERROR: ",e)
if len(result_set) == 0: if len(result_set) == 0:
print "No Results." print("No Results.")
return return
count = 0 count = 0
""" """
@ -975,12 +975,12 @@ class LdapContext(Context):
new_user.setLoginShell(loginshell) new_user.setLoginShell(loginshell)
new_user.setUsername(login) new_user.setUsername(login)
_users.append(new_user) _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... # Debugging output...
print "ERR:: ",e print("ERR:: ",e)
print 'err:: ',entry print('err:: ',entry)
return _users return _users
def _createUser(self): def _createUser(self):
@ -990,7 +990,7 @@ class LdapContext(Context):
return LdapGroup(self) return LdapGroup(self)
def save(self): def save(self):
print "LdapContext.save() does nothing yet." print("LdapContext.save() does nothing yet.")
########################################################################### ###########################################################################
class LdapUser(UnixUser): class LdapUser(UnixUser):
@ -1010,7 +1010,7 @@ class LdapGroup(UnixGroup):
class PwdUser(UnixUser): class PwdUser(UnixUser):
def __init__(self,context): def __init__(self,context):
UnixUser.__init__(self,context) UnixUser.__init__(self,context)
self._reserve = u"" self._reserve = ""
def _initString(self,line): def _initString(self,line):
(self._username,x,self._uid,self._gid,self._gecos,self._homedirectory, \ (self._username,x,self._uid,self._gid,self._gecos,self._homedirectory, \
@ -1019,17 +1019,17 @@ class PwdUser(UnixUser):
self._gid = int(self._gid) self._gid = int(self._gid)
def _getPasswdEntry(self): def _getPasswdEntry(self):
return u":".join( [self._username, return ":".join( [self._username,
u"x", "x",
unicode(self._uid), str(self._uid),
unicode(self._primarygroup.getGID()), str(self._primarygroup.getGID()),
self._gecos, self._gecos,
self._homedirectory, self._homedirectory,
self._loginshell ] ) + u"\n" self._loginshell ] ) + "\n"
def _getShadowEntry(self): def _getShadowEntry(self):
if self._islocked: if self._islocked:
encpass = u'!' + self._encpass encpass = '!' + self._encpass
else: else:
encpass = self._encpass encpass = self._encpass
@ -1039,41 +1039,41 @@ class PwdUser(UnixUser):
passminimumagebeforechange = str(self._passminimumagebeforechange) passminimumagebeforechange = str(self._passminimumagebeforechange)
if self._passmaximumage==None: if self._passmaximumage==None:
passmaximumage = u"99999" passmaximumage = "99999"
else: else:
passmaximumage = unicode(self._passmaximumage) passmaximumage = str(self._passmaximumage)
if self._disableddays==None: if self._disableddays==None:
disableddays = u"" disableddays = ""
else: else:
disableddays = unicode(self._disableddays) disableddays = str(self._disableddays)
if self._passexpiredisabledays==None: if self._passexpiredisabledays==None:
passexpiredisabledays = u"" passexpiredisabledays = ""
else: else:
passexpiredisabledays = unicode(self._passexpiredisabledays) passexpiredisabledays = str(self._passexpiredisabledays)
if self._passexpirewarn==None: if self._passexpirewarn==None:
passexpirewarn = u"" passexpirewarn = ""
else: else:
passexpirewarn = unicode(self._passexpirewarn) passexpirewarn = str(self._passexpirewarn)
return u":".join( [self._username, return ":".join( [self._username,
encpass, encpass,
unicode(self._passlastchange), str(self._passlastchange),
passminimumagebeforechange, passminimumagebeforechange,
passmaximumage, passmaximumage,
passexpirewarn, passexpirewarn,
passexpiredisabledays, passexpiredisabledays,
disableddays, disableddays,
self._reserve ])+ u"\n" self._reserve ])+ "\n"
########################################################################### ###########################################################################
class PwdGroup(UnixGroup): class PwdGroup(UnixGroup):
def __init__(self,context): def __init__(self,context):
UnixGroup.__init__(self,context) UnixGroup.__init__(self,context)
self._memberids = u"" self._memberids = ""
self._encpass = u"" self._encpass = ""
def _initString(self,line): def _initString(self,line):
(self._groupname,self._encpass,self._gid,self._memberids) = tuple(line.strip().split(":")) (self._groupname,self._encpass,self._gid,self._memberids) = tuple(line.strip().split(":"))
@ -1087,10 +1087,10 @@ class PwdGroup(UnixGroup):
self._members.append(userobj) self._members.append(userobj)
def _getGroupFileEntry(self): def _getGroupFileEntry(self):
return u":".join( [ self._groupname, return ":".join( [ self._groupname,
self._encpass, self._encpass,
unicode(self._gid), str(self._gid),
u",".join([u.getUsername() for u in self._members if u.getPrimaryGroup() is not self])]) + u"\n" ",".join([u.getUsername() for u in self._members if u.getPrimaryGroup() is not self])]) + "\n"
########################################################################### ###########################################################################
def LockFDRead(fd): def LockFDRead(fd):
@ -1121,34 +1121,34 @@ def UnlockFD(fd):
########################################################################### ###########################################################################
if __name__=='__main__': if __name__=='__main__':
print "Testing" print("Testing")
context = getContext(True) context = getContext(True)
print "Stopping here..." print("Stopping here...")
#import sys #import sys
#sys.exit(0) ## Remove. #sys.exit(0) ## Remove.
#print "Users:" #print "Users:"
#for user in context.getUsers(): #for user in context.getUsers():
for user in context._users: for user in context._users:
print "--------------------------------------------------" print("--------------------------------------------------")
print "UID:",user.getUID() print("UID:",user.getUID())
print "Is system user:",user.isSystemUser() print("Is system user:",user.isSystemUser())
print "Username:",user.getUsername() print("Username:",user.getUsername())
print "Primary Group:",str(user.getPrimaryGroup()) print("Primary Group:",str(user.getPrimaryGroup()))
print "Groups:",[str(u) for u in user.getGroups()] print("Groups:",[str(u) for u in user.getGroups()])
print "Is locked:",user.isLocked() print("Is locked:",user.isLocked())
print "Real name:",user.getRealName() print("Real name:",user.getRealName())
print "Home Dir:",user.getHomeDirectory() print("Home Dir:",user.getHomeDirectory())
print "Maximum password age:",user.getMaximumPasswordAge() print("Maximum password age:",user.getMaximumPasswordAge())
print "Minimum password age before change:",user.getMinimumPasswordAgeBeforeChange() print("Minimum password age before change:",user.getMinimumPasswordAgeBeforeChange())
print "Expire warning:",user.getPasswordExpireWarning() print("Expire warning:",user.getPasswordExpireWarning())
print "Disable after Expire:",user.getPasswordDisableAfterExpire() print("Disable after Expire:",user.getPasswordDisableAfterExpire())
#print user._getPasswdEntry() #print user._getPasswdEntry()
print "Groups" print("Groups")
for group in context.getGroups(): for group in context.getGroups():
print str(group) print(str(group))
#print group._getGroupFileEntry() #print group._getGroupFileEntry()
print "Saving" print("Saving")
context.save() context.save()

@ -439,7 +439,7 @@ class UserConfigApp(programbase):
for userobj in users: for userobj in users:
uid = userobj.getUID() uid = userobj.getUID()
if self.showsystemaccounts or not userobj.isSystemUser(): 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(): if userobj.isLocked():
lvi.setPixmap(0,UserIcon("hi16-encrypted")) lvi.setPixmap(0,UserIcon("hi16-encrypted"))
self.useridsToListItems[uid] = lvi self.useridsToListItems[uid] = lvi
@ -457,7 +457,7 @@ class UserConfigApp(programbase):
userobj = self.admincontext.lookupUID(userid) userobj = self.admincontext.lookupUID(userid)
lvi.setText(0,userobj.getUsername()) lvi.setText(0,userobj.getUsername())
lvi.setText(1,userobj.getRealName()) lvi.setText(1,userobj.getRealName())
lvi.setText(2,unicode(userobj.getUID())) lvi.setText(2,str(userobj.getUID()))
if userobj.isLocked(): if userobj.isLocked():
lvi.setPixmap(0,UserIcon("hi16-encrypted")) lvi.setPixmap(0,UserIcon("hi16-encrypted"))
else: else:
@ -477,7 +477,7 @@ class UserConfigApp(programbase):
username = userobj.getUsername() username = userobj.getUsername()
self.loginnamelabel.setText(username) self.loginnamelabel.setText(username)
self.realnamelabel.setText(userobj.getRealName()) self.realnamelabel.setText(userobj.getRealName())
self.uidlabel.setText(unicode(userid)) self.uidlabel.setText(str(userid))
if userobj.isLocked(): if userobj.isLocked():
self.statuslabel.setText(i18n("Disabled")) self.statuslabel.setText(i18n("Disabled"))
else: else:
@ -490,7 +490,7 @@ class UserConfigApp(programbase):
# Secondary Groups # Secondary Groups
secondarygroups = [g.getGroupname() for g in userobj.getGroups() if g is not userobj.getPrimaryGroup()] 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: if isroot:
self.deletebutton.setDisabled(userobj.getUID()==0) self.deletebutton.setDisabled(userobj.getUID()==0)
@ -505,7 +505,7 @@ class UserConfigApp(programbase):
for groupobj in groups: for groupobj in groups:
gid = groupobj.getGID() gid = groupobj.getGID()
if self.showsystemgroups or not groupobj.isSystemGroup(): 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 self.groupidsToListItems[gid] = lvi
if self.selectedgroupid==gid: if self.selectedgroupid==gid:
firstselectedgroupid = gid firstselectedgroupid = gid
@ -528,7 +528,7 @@ class UserConfigApp(programbase):
self.groupmemberlist.clear() self.groupmemberlist.clear()
for userobj in members: for userobj in members:
if userobj!=None: 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: if isroot:
self.deletegroupbutton.setDisabled(groupobj.getGID()==0) self.deletegroupbutton.setDisabled(groupobj.getGID()==0)
@ -578,28 +578,28 @@ class UserConfigApp(programbase):
# Rudd-O convenience class to map groups to privilege names # Rudd-O convenience class to map groups to privilege names
class PrivilegeNames(dict): 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. """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.""" FIXME This should ideally be included in a more general module so it can be reused."""
def __init__(self): def __init__(self):
dict.__init__(self, { dict.__init__(self, {
"plugdev":i18n("Access external storage devices automatically"), "plugdev":i18n("Access external storage devices automatically"),
"adm":i18n("Administer the system"), "adm":i18n("Administer the system"),
"ltsp":i18n("Allow use of FUSE filesystems like LTSP thin client block devices"), "ltsp":i18n("Allow use of FUSE filesystems like LTSP thin client block devices"),
"dialout":i18n("Connect to the Internet using a modem"), "dialout":i18n("Connect to the Internet using a modem"),
"syslog":i18n("Monitor system logs"), "syslog":i18n("Monitor system logs"),
"fax":i18n("Send and receive faxes"), "fax":i18n("Send and receive faxes"),
"cdrom":i18n("Use CD-ROM and DVD drives"), "cdrom":i18n("Use CD-ROM and DVD drives"),
"floppy":i18n("Use floppy drives"), "floppy":i18n("Use floppy drives"),
"modem":i18n("Use modems"), "modem":i18n("Use modems"),
"scanner":i18n("Use scanners"), "scanner":i18n("Use scanners"),
}) })
def __getitem__(self,name): def __getitem__(self,name):
# This is cruft but I couldn't bring myself to kill it bua! # This is cruft but I couldn't bring myself to kill it bua!
if name in self: return dict.__getitem__(self,name) if name in self: return dict.__getitem__(self,name)
return i18n("Be a member of the %s group")%name return i18n("Be a member of the %s group")%name
class UserEditDialog(KDialogBase): class UserEditDialog(KDialogBase):
def __init__(self,parent,admincontext): def __init__(self,parent,admincontext):
@ -691,18 +691,18 @@ class UserEditDialog(KDialogBase):
infogrid.addWidget(self.shelledit,8,1) infogrid.addWidget(self.shelledit,8,1)
# Rudd-O rules. Not so much, but enough to rule. # 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 # 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. # 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 # Privileges and groups tab
groupsvbox = self.addHBoxPage(i18n("Privileges and groups")) 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 = TQListView(groupsvbox)
self.privilegeslistview.addColumn(i18n("Privilege"),-1) self.privilegeslistview.addColumn(i18n("Privilege"),-1)
self.groupslistview = TQListView(groupsvbox) self.groupslistview = TQListView(groupsvbox)
self.groupslistview.addColumn(i18n("Secondary group"),-1) self.groupslistview.addColumn(i18n("Secondary group"),-1)
groupsvbox.setStretchFactor(self.privilegeslistview,3) groupsvbox.setStretchFactor(self.privilegeslistview,3)
groupsvbox.setStretchFactor(self.groupslistview,2) groupsvbox.setStretchFactor(self.groupslistview,2)
# Password and Security Tab. # Password and Security Tab.
passwordvbox = self.addVBoxPage(i18n("Password && Security")) passwordvbox = self.addVBoxPage(i18n("Password && Security"))
@ -816,25 +816,25 @@ class UserEditDialog(KDialogBase):
self.updatingGUI = False self.updatingGUI = False
def _repopulateGroupsPrivileges(self,excludegroups=None): def _repopulateGroupsPrivileges(self,excludegroups=None):
# needs listviews to be constructed. Expects a list of PwdGroups to be excluded # needs listviews to be constructed. Expects a list of PwdGroups to be excluded
# rehash everything # rehash everything
self.privilegeslistview.clear() self.privilegeslistview.clear()
self.groupslistview.clear() self.groupslistview.clear()
self.secondarygroupcheckboxes = {} self.secondarygroupcheckboxes = {}
pn = PrivilegeNames() pn = PrivilegeNames()
if excludegroups: excludegroups = [ g.getGroupname() for g in excludegroups ] if excludegroups: excludegroups = [ g.getGroupname() for g in excludegroups ]
else: excludegroups = [] else: excludegroups = []
for group in [g.getGroupname() for g in self.admincontext.getGroups()]: for group in [g.getGroupname() for g in self.admincontext.getGroups()]:
if group in excludegroups: continue if group in excludegroups: continue
if group in pn: if group in pn:
name = i18n(unicode(pn[group]).encode(locale.getpreferredencoding())) name = i18n(str(pn[group]).encode(locale.getpreferredencoding()))
wid = self.privilegeslistview wid = self.privilegeslistview
else: else:
name = unicode(group).encode(locale.getpreferredencoding()) name = str(group).encode(locale.getpreferredencoding())
wid = self.groupslistview wid = self.groupslistview
self.secondarygroupcheckboxes[group] = TQCheckListItem(wid,name,TQCheckListItem.CheckBox) self.secondarygroupcheckboxes[group] = TQCheckListItem(wid,name,TQCheckListItem.CheckBox)
######################################################################## ########################################################################
def showEditUser(self,userid): def showEditUser(self,userid):
@ -846,13 +846,13 @@ class UserEditDialog(KDialogBase):
self.selectedgroups = [g.getGroupname() for g in self.userobj.getGroups() self.selectedgroups = [g.getGroupname() for g in self.userobj.getGroups()
if g is not self.userobj.getPrimaryGroup()] 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. # 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()]) self._repopulateGroupsPrivileges(excludegroups=[self.userobj.getPrimaryGroup()])
for group,checkbox in self.secondarygroupcheckboxes.items(): for group,checkbox in list(self.secondarygroupcheckboxes.items()):
if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On) if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
else: checkbox.setState(TQCheckListItem.Off) else: checkbox.setState(TQCheckListItem.Off)
self.originalgroups = self.selectedgroups[:] self.originalgroups = self.selectedgroups[:]
self.selectedgroups.sort() self.selectedgroups.sort()
self.__syncGUI() self.__syncGUI()
self.uidedit.setReadOnly(True) self.uidedit.setReadOnly(True)
@ -864,15 +864,15 @@ class UserEditDialog(KDialogBase):
if self.passwordedit.password()!="": if self.passwordedit.password()!="":
self.userobj.setPassword(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. # Update the groups for this user object. Rudd-O here's when you go in, stud.
# we collect the selected groups # we collect the selected groups
self.selectedgroups = [ group for group,checkbox in self.secondarygroupcheckboxes.items() if checkbox.isOn() ] 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? 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) self.userobj.removeFromGroup(g)
for gn in self.selectedgroups: for gn in self.selectedgroups:
self.userobj.addToGroup(self.admincontext.lookupGroupname(gn)) self.userobj.addToGroup(self.admincontext.lookupGroupname(gn))
primarygroupname = unicode(self.primarygroupedit.currentText()) primarygroupname = str(self.primarygroupedit.currentText())
self.userobj.setPrimaryGroup(self.admincontext.lookupGroupname(primarygroupname)) self.userobj.setPrimaryGroup(self.admincontext.lookupGroupname(primarygroupname))
# Enable/Disable the account # Enable/Disable the account
@ -889,17 +889,17 @@ class UserEditDialog(KDialogBase):
self.newgroup.setGroupname(self.__fudgeNewGroupName(self.userobj.getUsername())) self.newgroup.setGroupname(self.__fudgeNewGroupName(self.userobj.getUsername()))
self.userobj.setPrimaryGroup(self.newgroup) self.userobj.setPrimaryGroup(self.newgroup)
self.selectedgroups = [ u'dialout',u'cdrom',u'floppy',u'audio',u'video', self.selectedgroups = [ 'dialout','cdrom','floppy','audio','video',
u'plugdev',u'lpadmin',u'scanner'] 'plugdev','lpadmin','scanner']
homedir = self.__fudgeNewHomeDirectory(self.userobj.getUsername()) 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. # 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() self._repopulateGroupsPrivileges()
for group,checkbox in self.secondarygroupcheckboxes.items(): for group,checkbox in list(self.secondarygroupcheckboxes.items()):
if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On) if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
else: checkbox.setState(TQCheckListItem.Off) else: checkbox.setState(TQCheckListItem.Off)
self.userobj.setHomeDirectory(homedir) self.userobj.setHomeDirectory(homedir)
self.homediredit.setText(homedir) self.homediredit.setText(homedir)
shells = self.admincontext.getUserShells() shells = self.admincontext.getUserShells()
@ -944,8 +944,8 @@ class UserEditDialog(KDialogBase):
self.userobj.setPrimaryGroup(newgroup) self.userobj.setPrimaryGroup(newgroup)
# Update the groups for this user object. Rudd-O here's when you go in, stud. # Update the groups for this user object. Rudd-O here's when you go in, stud.
# we collect the selected groups # we collect the selected groups
self.selectedgroups = [ group for group,checkbox in self.secondarygroupcheckboxes.items() if checkbox.isOn() ] self.selectedgroups = [ group for group,checkbox in list(self.secondarygroupcheckboxes.items()) if checkbox.isOn() ]
for gn in self.selectedgroups: for gn in self.selectedgroups:
self.userobj.addToGroup(self.admincontext.lookupGroupname(gn)) self.userobj.addToGroup(self.admincontext.lookupGroupname(gn))
@ -972,18 +972,18 @@ class UserEditDialog(KDialogBase):
ok = True ok = True
# Sanity check all values. # Sanity check all values.
if self.newusermode: if self.newusermode:
newusername = unicode(self.realnameedit.text()) newusername = str(self.realnameedit.text())
if self.admincontext.lookupUsername(newusername)!=None: 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)) KMessageBox.sorry(self,i18n("Sorry, you must choose a different user name.\n'%1' is already being used.").arg(newusername))
ok = False ok = False
else: else:
newuid = int(unicode(self.uidedit.text())) newuid = int(str(self.uidedit.text()))
originaluid = self.userobj.getUID() originaluid = self.userobj.getUID()
if self.admincontext.lookupUID(newuid)!=None: if self.admincontext.lookupUID(newuid)!=None:
rc = KMessageBox.questionYesNo(self,i18n("User ID in use"), 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)) i18n("Sorry, the UID %1 is already in use. Should %2 be used instead?").arg(newuid).arg(originaluid))
if rc==KMessageBox.Yes: if rc==KMessageBox.Yes:
self.uidedit.setValue(unicode(originaluid)) self.uidedit.setValue(str(originaluid))
else: else:
ok = False ok = False
else: else:
@ -994,7 +994,7 @@ class UserEditDialog(KDialogBase):
######################################################################## ########################################################################
def slotLoginChanged(self,text): def slotLoginChanged(self,text):
newtext = unicode(text) newtext = str(text)
if not self.updatingGUI: if not self.updatingGUI:
if self.newusermode: if self.newusermode:
self.newprimarygroupname = self.__fudgeNewGroupName(newtext) self.newprimarygroupname = self.__fudgeNewGroupName(newtext)
@ -1019,7 +1019,7 @@ class UserEditDialog(KDialogBase):
self.loginnameedit.setText(self.userobj.getUsername()) self.loginnameedit.setText(self.userobj.getUsername())
self.realnameedit.setText(self.userobj.getRealName()) 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.homediredit.setText(self.userobj.getHomeDirectory())
self.shelledit.setCurrentText(self.userobj.getLoginShell()) self.shelledit.setCurrentText(self.userobj.getLoginShell())
@ -1036,7 +1036,7 @@ class UserEditDialog(KDialogBase):
if self.newusermode: if self.newusermode:
# New user mode # New user mode
self.newprimarygroupname = self.__fudgeNewGroupName(unicode(self.userobj.getUsername())) self.newprimarygroupname = self.__fudgeNewGroupName(str(self.userobj.getUsername()))
primarygroupname = self.newprimarygroupname primarygroupname = self.newprimarygroupname
self.primarygroupedit.insertItem(self.newprimarygroupname) self.primarygroupedit.insertItem(self.newprimarygroupname)
else: else:
@ -1050,7 +1050,7 @@ class UserEditDialog(KDialogBase):
if self.userobj.getExpirationDate() is None: if self.userobj.getExpirationDate() is None:
self.validradiogroup.setButton(0) self.validradiogroup.setButton(0)
self.expiredate.setDisabled(True) self.expiredate.setDisabled(True)
self.expiredate.setDate(SptimeToQDate(99999L)) self.expiredate.setDate(SptimeToQDate(99999))
else: else:
self.validradiogroup.setButton(1) self.validradiogroup.setButton(1)
self.expiredate.setDisabled(False) self.expiredate.setDisabled(False)
@ -1097,13 +1097,13 @@ class UserEditDialog(KDialogBase):
######################################################################## ########################################################################
def __updateObjectFromGUI(self,userobj): def __updateObjectFromGUI(self,userobj):
username = unicode(self.loginnameedit.text()) username = str(self.loginnameedit.text())
userobj.setUsername(username) userobj.setUsername(username)
userobj.setRealName(unicode(self.realnameedit.text())) userobj.setRealName(str(self.realnameedit.text()))
userobj.setHomeDirectory(unicode(self.homediredit.text())) userobj.setHomeDirectory(str(self.homediredit.text()))
userobj.setLoginShell(unicode(self.shelledit.currentText())) userobj.setLoginShell(str(self.shelledit.currentText()))
self.primarygroupname = unicode(self.primarygroupedit.currentText()) self.primarygroupname = str(self.primarygroupedit.currentText())
groupobj = self.admincontext.lookupGroupname(self.primarygroupname) groupobj = self.admincontext.lookupGroupname(self.primarygroupname)
if groupobj is not None: if groupobj is not None:
userobj.setPrimaryGroup(groupobj) userobj.setPrimaryGroup(groupobj)
@ -1165,30 +1165,30 @@ class UserEditDialog(KDialogBase):
if self.admincontext.lookupGroupname(basename) is None: if self.admincontext.lookupGroupname(basename) is None:
return basename return basename
x = 1 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 x += 1
return basename + u'_' + unicode(x) return basename + '_' + str(x)
####################################################################### #######################################################################
def __fudgeNewHomeDirectory(self,origbasename): def __fudgeNewHomeDirectory(self,origbasename):
basename = origbasename.replace("/","") basename = origbasename.replace("/","")
if basename=="": if basename=="":
basename = u"user" basename = "user"
dhome = self.admincontext.dhome dhome = self.admincontext.dhome
if not os.path.isdir(dhome): if not os.path.isdir(dhome):
raise OSError, dhome+" does not exist, is it correctly set in "+ \ raise OSError(dhome+" does not exist, is it correctly set in "+ \
self.admincontext.adduserconf+" ?" self.admincontext.adduserconf+" ?")
else: else:
# Make sure there's a trailing / # Make sure there's a trailing /
if dhome[-1] is not '/': if dhome[-1] != '/':
dhome = dhome+'/' dhome = dhome+'/'
if os.path.exists(dhome+basename)==False: if os.path.exists(dhome+basename)==False:
return dhome+basename return dhome+basename
else: else:
x = 1 x = 1
while os.path.exists(dhome+basename + u'_' + unicode(x)): while os.path.exists(dhome+basename + '_' + str(x)):
x += 1 x += 1
return dhome+basename return dhome+basename
@ -1200,7 +1200,7 @@ class LoginNameValidator(TQValidator):
####################################################################### #######################################################################
def validate(self,inputstr,pos): def validate(self,inputstr,pos):
instr = unicode(inputstr) instr = str(inputstr)
if len(instr)==0: if len(instr)==0:
return (TQValidator.Intermediate,pos) return (TQValidator.Intermediate,pos)
for c in instr: for c in instr:
@ -1218,7 +1218,7 @@ class LoginNameValidator(TQValidator):
####################################################################### #######################################################################
def fixup(self,inputstr): def fixup(self,inputstr):
instr = unicode(inputstr) instr = str(inputstr)
newstr = "" newstr = ""
for c in instr: for c in instr:
if (ord(c)<0x20 or ord(c)>0x7f or c.isspace() or c==":" or c=="," or c==".")==False: 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): def validate(self,inputstr,pos):
instr = unicode(inputstr) instr = str(inputstr)
for c in instr: for c in instr:
if c==":": if c==":":
return (TQValidator.Invalid,pos) return (TQValidator.Invalid,pos)
@ -1252,7 +1252,7 @@ class RealUserNameValidator(TQValidator):
####################################################################### #######################################################################
def fixup(self,inputstr): def fixup(self,inputstr):
return unicode(inputstr).replace(":","") return str(inputstr).replace(":","")
########################################################################### ###########################################################################
class ListPickerDialog(KDialogBase): class ListPickerDialog(KDialogBase):
@ -1314,7 +1314,7 @@ class ListPickerDialog(KDialogBase):
if self.exec_loop()==TQDialog.Accepted: if self.exec_loop()==TQDialog.Accepted:
newlist = [] newlist = []
for i in range(self.selectedlist.count()): 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 return newlist
else: else:
return selectedlist return selectedlist
@ -1602,7 +1602,7 @@ class GroupEditDialog(KDialogBase):
groupobj = self.admincontext.lookupGID(groupid) groupobj = self.admincontext.lookupGID(groupid)
self.groupnamelabel.setText(groupobj.getGroupname()) self.groupnamelabel.setText(groupobj.getGroupname())
self.groupidlabel.setText(unicode(groupid)) self.groupidlabel.setText(str(groupid))
availablemembers = [u.getUsername() for u in self.admincontext.getUsers()] availablemembers = [u.getUsername() for u in self.admincontext.getUsers()]
originalmembers = [u.getUsername() for u in groupobj.getUsers()] originalmembers = [u.getUsername() for u in groupobj.getUsers()]
@ -1612,7 +1612,7 @@ class GroupEditDialog(KDialogBase):
if self.exec_loop()==TQDialog.Accepted: if self.exec_loop()==TQDialog.Accepted:
newmembers = [] newmembers = []
for i in range(self.selectedlist.count()): 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. # Remove from the group object any unselected users.
for member in originalmembers: for member in originalmembers:
@ -1639,7 +1639,7 @@ class GroupEditDialog(KDialogBase):
groupname = self.groupobj.getGroupname() groupname = self.groupobj.getGroupname()
self.groupnamelabel.setText(groupname) self.groupnamelabel.setText(groupname)
self.groupnamelabel.setReadOnly(False) self.groupnamelabel.setReadOnly(False)
self.groupidlabel.setText(unicode(self.groupobj.getGID())) self.groupidlabel.setText(str(self.groupobj.getGID()))
self.groupidlabel.setReadOnly(False) self.groupidlabel.setReadOnly(False)
availablemembers = [u.getUsername() for u in self.admincontext.getUsers()] availablemembers = [u.getUsername() for u in self.admincontext.getUsers()]
@ -1647,13 +1647,13 @@ class GroupEditDialog(KDialogBase):
self.__updateLists(availablemembers,[]) self.__updateLists(availablemembers,[])
if self.exec_loop()==TQDialog.Accepted: if self.exec_loop()==TQDialog.Accepted:
self.groupobj.setGroupname(unicode(self.groupnamelabel.text())) self.groupobj.setGroupname(str(self.groupnamelabel.text()))
newgroupid = int(unicode(self.groupidlabel.text())) newgroupid = int(str(self.groupidlabel.text()))
self.groupobj.setGID(newgroupid) self.groupobj.setGID(newgroupid)
newmembers = [] newmembers = []
for i in range(self.selectedlist.count()): 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) self.admincontext.addGroup(self.groupobj)
@ -1725,9 +1725,9 @@ class GroupEditDialog(KDialogBase):
if basename not in availablegroups: if basename not in availablegroups:
return basename return basename
x = 1 x = 1
while basename + u'_' + unicode(x) in availablegroups: while basename + '_' + str(x) in availablegroups:
x += 1 x += 1
return basename + u'_' + unicode(x) return basename + '_' + str(x)
############################################################################ ############################################################################
# Factory function for KControl # Factory function for KControl
@ -1737,7 +1737,7 @@ def create_userconfig(parent,name):
########################################################################## ##########################################################################
def MakeAboutData(): def MakeAboutData():
aboutdata = TDEAboutData("guidance", programname, version, 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") TDEAboutData.License_GPL, "Copyright (C) 2003-2007 Simon Edwards")
aboutdata.addAuthor("Simon Edwards", "Developer", "simon@simonzone.com", "http://www.simonzone.com/software/") aboutdata.addAuthor("Simon Edwards", "Developer", "simon@simonzone.com", "http://www.simonzone.com/software/")
aboutdata.addAuthor("Sebastian Kügler", "Developer", "sebas@kde.org", "http://vizZzion.org") aboutdata.addAuthor("Sebastian Kügler", "Developer", "sebas@kde.org", "http://vizZzion.org")

@ -37,7 +37,7 @@ class FirstRunWizard(KWizard):
if not name: if not name:
self.setName("firstrunwizard") 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.setupPage1()
self.setupPageVersion() self.setupPageVersion()

@ -94,7 +94,7 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) {
// Call the factory function. Set up the args. // Call the factory function. Set up the args.
PyObject *pyParent = PyLong_FromVoidPtr(parent); 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. // Using NN here is effect gives our references to the arguement away.
PyObject *args = Py_BuildValue ("NN", pyParent, pyName); PyObject *args = Py_BuildValue ("NN", pyParent, pyName);
if(pyName && pyParent && args) { if(pyName && pyParent && args) {

@ -644,7 +644,7 @@ class DrivesPage(TQWidget):
def slotFolderChanged(self,folder): def slotFolderChanged(self,folder):
""" Change the directory mapping when a new one is entered in the URL box """ """ 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() self.updateChanges()
def slotFolderEdited(self,folder): def slotFolderEdited(self,folder):
@ -657,7 +657,7 @@ class DrivesPage(TQWidget):
""" Bring up a browse window to choose a ndew mapping directory """ """ Bring up a browse window to choose a ndew mapping directory """
mapping = KFileDialog.getExistingDirectory(wineread.winepath,self,i18n("Drive Mapping")) mapping = KFileDialog.getExistingDirectory(wineread.winepath,self,i18n("Drive Mapping"))
if mapping: if mapping:
mapping = unicode(mapping) mapping = str(mapping)
self.drives[self.selecteddriveid][2] = mapping self.drives[self.selecteddriveid][2] = mapping
self.updateChanges() self.updateChanges()
@ -672,7 +672,7 @@ class DrivesPage(TQWidget):
else: else:
mapping = KFileDialog.getExistingDirectory(wineread.winepath,self,i18n("Drive Mapping")) mapping = KFileDialog.getExistingDirectory(wineread.winepath,self,i18n("Drive Mapping"))
if mapping: if mapping:
mapping = unicode(mapping) mapping = str(mapping)
drive[2] = mapping drive[2] = mapping
else: else:
return return
@ -780,7 +780,7 @@ class DrivesPage(TQWidget):
self.removebutton.setEnabled(False) 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 # 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]: if self.drives[driveid][5] != self.drives[driveid][4]:
@ -811,11 +811,11 @@ class DrivesPage(TQWidget):
self.removebutton.setEnabled(True) self.removebutton.setEnabled(True)
if self.drives[driveid][4]: 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: else:
self.infotext1.setText("") self.infotext1.setText("")
if self.drives[driveid][5]: 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: else:
self.infotext2.setText("") self.infotext2.setText("")
@ -1427,7 +1427,7 @@ class GraphicsPage(TQWidget):
def slotEmuDesktopToggled(self,emudesktop): def slotEmuDesktopToggled(self,emudesktop):
if 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: else:
self.currentemudesktop = "" self.currentemudesktop = ""
self.__setEmuDesktop(self.currentemudesktop) self.__setEmuDesktop(self.currentemudesktop)
@ -1520,64 +1520,64 @@ class GraphicsPage(TQWidget):
############################################################################ ############################################################################
class AppearancePage(TQWidget): class AppearancePage(TQWidget):
themes = [unicode(i18n("No Theme"))] themes = [str(i18n("No Theme"))]
colorschemes = [unicode(i18n("Custom"))] colorschemes = [str(i18n("Custom"))]
sizes = [("NormalSize",unicode(i18n("Normal"))), sizes = [("NormalSize",str(i18n("Normal"))),
("LargeSize",unicode(i18n("Large Fonts"))), ("LargeSize",str(i18n("Large Fonts"))),
("ExtraLargeSize",unicode(i18n("Extra Large Fonts")))] ("ExtraLargeSize",str(i18n("Extra Large Fonts")))]
# Items for the combo box reference a tuple of dictionaries for color # Items for the combo box reference a tuple of dictionaries for color
# and size values and translations for that item # and size values and translations for that item
# For example, the value of BorderWidth is # For example, the value of BorderWidth is
# customizableitems[str(i18n("Window Border"))][1]["BorderWidth"][1] # customizableitems[str(i18n("Window Border"))][1]["BorderWidth"][1]
customizableitems = {"Window Border": customizableitems = {"Window Border":
({"ActiveBorder":[unicode(i18n("Active Color:")),TQColor()], ({"ActiveBorder":[str(i18n("Active Color:")),TQColor()],
"InactiveBorder":[unicode(i18n("Inactive Color:")),TQColor()]}, "InactiveBorder":[str(i18n("Inactive Color:")),TQColor()]},
{"BorderWidth":[unicode(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth {"BorderWidth":[str(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
"Title Bar": "Title Bar":
({"ActiveTitle":[unicode(i18n("Active Color:")),TQColor()], ({"ActiveTitle":[str(i18n("Active Color:")),TQColor()],
"GradientActiveTitle":[unicode(i18n("Gradient:")),TQColor()], "GradientActiveTitle":[str(i18n("Gradient:")),TQColor()],
"InactiveTitle":[unicode(i18n("Inactive Color:")),TQColor()], "InactiveTitle":[str(i18n("Inactive Color:")),TQColor()],
"GradientInactiveTitle":[unicode(i18n("Gradient:")),TQColor()], "GradientInactiveTitle":[str(i18n("Gradient:")),TQColor()],
"TitleText":[unicode(i18n("Active Text:")),TQColor()], "TitleText":[str(i18n("Active Text:")),TQColor()],
"InactiveTitleText":[unicode(i18n("Inactive Text:")),TQColor()]}, "InactiveTitleText":[str(i18n("Inactive Text:")),TQColor()]},
{}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText {}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText
"Application Workspace": "Application Workspace":
({"AppWorkSpace":[unicode(i18n("Background Color:")),TQColor()]}, ({"AppWorkSpace":[str(i18n("Background Color:")),TQColor()]},
{}), #AppWorkSpace "Background" {}), #AppWorkSpace "Background"
"Buttons": "Buttons":
({"ButtonFace":[unicode(i18n("Face:")),TQColor()], ({"ButtonFace":[str(i18n("Face:")),TQColor()],
"ButtonHilight":[unicode(i18n("Hilight:")),TQColor()], "ButtonHilight":[str(i18n("Hilight:")),TQColor()],
"ButtonLight":[unicode(i18n("Light:")),TQColor()], "ButtonLight":[str(i18n("Light:")),TQColor()],
"ButtonShadow":[unicode(i18n("Shadow:")),TQColor()], "ButtonShadow":[str(i18n("Shadow:")),TQColor()],
"ButtonText":[unicode(i18n("Text Color:")),TQColor()], "ButtonText":[str(i18n("Text Color:")),TQColor()],
"ButtonAlternateFace":[unicode(i18n("Alternate Face:")),TQColor()], "ButtonAlternateFace":[str(i18n("Alternate Face:")),TQColor()],
"ButtonDkShadow":[unicode(i18n("Dark Shadow:")),TQColor()], "ButtonDkShadow":[str(i18n("Dark Shadow:")),TQColor()],
"WindowFrame":[unicode(i18n("Frame:")),TQColor()]}, "WindowFrame":[str(i18n("Frame:")),TQColor()]},
{}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame {}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame
"Caption Buttons": "Caption Buttons":
({}, ({},
{"CaptionHeight":[unicode(i18n("Height:")),1], {"CaptionHeight":[str(i18n("Height:")),1],
"CaptionWidth":[unicode(i18n("Width:")),1]}), #Metrics: CaptionHeight, CaptionWidth "CaptionWidth":[str(i18n("Width:")),1]}), #Metrics: CaptionHeight, CaptionWidth
"Desktop": "Desktop":
({"Background":[unicode(i18n("Background:")),TQColor()]}, ({"Background":[str(i18n("Background:")),TQColor()]},
{}), #Background {}), #Background
"Menu": "Menu":
({"Menu":[unicode(i18n("Menu Background:")),TQColor()], ({"Menu":[str(i18n("Menu Background:")),TQColor()],
"MenuBar":[unicode(i18n("Menu Bar Color:")),TQColor()], "MenuBar":[str(i18n("Menu Bar Color:")),TQColor()],
"MenuHilight":[unicode(i18n("Menu Hilight:")),TQColor()], "MenuHilight":[str(i18n("Menu Hilight:")),TQColor()],
"MenuText":[unicode(i18n("Text Color:")),TQColor()]}, "MenuText":[str(i18n("Text Color:")),TQColor()]},
{"MenuHeight":[unicode(i18n("Menu Bar Height:")),1]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing) {"MenuHeight":[str(i18n("Menu Bar Height:")),1]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
"Scrollbar": "Scrollbar":
({"Scrollbar":[unicode(i18n("Color:")),TQColor()]}, ({"Scrollbar":[str(i18n("Color:")),TQColor()]},
{"ScrollWidth":[unicode(i18n("Width:")),1]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth {"ScrollWidth":[str(i18n("Width:")),1]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
"Window": "Window":
({"Window":[unicode(i18n("Background:")),TQColor()], ({"Window":[str(i18n("Background:")),TQColor()],
"WindowText":[unicode(i18n("Text Color:")),TQColor()]}, "WindowText":[str(i18n("Text Color:")),TQColor()]},
{}), #Window "Background", WindowText {}), #Window "Background", WindowText
"Selected Items": "Selected Items":
({"Hilight":[unicode(i18n("Hilight Color:")),TQColor()], ({"Hilight":[str(i18n("Hilight Color:")),TQColor()],
"HilightText":[unicode(i18n("Text Color:")),TQColor()]}, "HilightText":[str(i18n("Text Color:")),TQColor()]},
{})} #Hilight, HilightText {})} #Hilight, HilightText
def __init__(self,parent = None,name = None,modal = 0,fl = 0): def __init__(self,parent = None,name = None,modal = 0,fl = 0):
@ -1833,8 +1833,8 @@ class AppearancePage(TQWidget):
changed = False changed = False
custom = False # For a little efficiency custom = False # For a little efficiency
for item in self.customizableitems.keys(): for item in list(self.customizableitems.keys()):
for key in self.customizableitems[item][0].keys(): for key in list(self.customizableitems[item][0].keys()):
color = colors.get(key,"0 0 0") color = colors.get(key,"0 0 0")
color = color.split() color = color.split()
color = TQColor(int(color[0]),int(color[1]),int(color[2])) color = TQColor(int(color[0]),int(color[1]),int(color[2]))
@ -1847,7 +1847,7 @@ class AppearancePage(TQWidget):
return True return True
else: else:
changed = True 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)) size = int(metrics.get(key,1))
if not custom and self.customizableitems[item][1][key][1] !=\ if not custom and self.customizableitems[item][1][key][1] !=\
self.config.readNumEntry(key,1): self.config.readNumEntry(key,1):
@ -1863,11 +1863,11 @@ class AppearancePage(TQWidget):
def reset(self): def reset(self):
self.fillItemCombo(self.itemcombo) self.fillItemCombo(self.itemcombo)
self.config.setGroup("") 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 self.originalcustomcolorscheme = self.currentcustomcolorscheme
schemeslist = self.config.readListEntry("ColorSchemes") schemeslist = self.config.readListEntry("ColorSchemes")
self.colorschemes = [unicode(i18n("Custom")), self.colorschemes = [str(i18n("Custom")),
unicode(i18n("Get KDE Colors"))] + list(schemeslist) str(i18n("Get KDE Colors"))] + list(schemeslist)
self.config.setGroup(self.currentcustomcolorscheme) self.config.setGroup(self.currentcustomcolorscheme)
for preset in self.presets: for preset in self.presets:
@ -1912,15 +1912,15 @@ class AppearancePage(TQWidget):
colors = wineread.GetColorSettings() colors = wineread.GetColorSettings()
metrics = wineread.GetWindowMetrics() metrics = wineread.GetWindowMetrics()
for item in self.customizableitems.keys(): for item in list(self.customizableitems.keys()):
for key in self.customizableitems[item][0].keys(): for key in list(self.customizableitems[item][0].keys()):
color = colors.get(key,"0 0 0") color = colors.get(key,"0 0 0")
color = color.split() color = color.split()
color = TQColor(int(color[0]),int(color[1]),int(color[2])) color = TQColor(int(color[0]),int(color[1]),int(color[2]))
if color != self.config.readColorEntry(key,TQColor(0,0,0)): if color != self.config.readColorEntry(key,TQColor(0,0,0)):
self.currentcustomcolorscheme = self.colorschemes[0] self.currentcustomcolorscheme = self.colorschemes[0]
self.customizableitems[item][0][key][1] = color 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)) size = int(metrics.get(key,1))
if size != self.config.readNumEntry(key,1): if size != self.config.readNumEntry(key,1):
self.currentcustomcolorscheme = self.colorschemes[0] self.currentcustomcolorscheme = self.colorschemes[0]
@ -1944,13 +1944,13 @@ class AppearancePage(TQWidget):
colorsettings = {} colorsettings = {}
metricssettings = {} metricssettings = {}
for item in self.customizableitems.keys(): for item in list(self.customizableitems.keys()):
for key in self.customizableitems[item][0].keys(): for key in list(self.customizableitems[item][0].keys()):
color = self.customizableitems[item][0][key][1] color = self.customizableitems[item][0][key][1]
color = str(color.red()) + " " + str(color.green()) +\ color = str(color.red()) + " " + str(color.green()) +\
" " + str(color.blue()) " " + str(color.blue())
colorsettings[key] = color 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] size = self.customizableitems[item][1][key][1]
metricssettings[key] = str(size) metricssettings[key] = str(size)
@ -2006,13 +2006,13 @@ class AppearancePage(TQWidget):
""" """
combo = self.itemcombo combo = self.itemcombo
combo.clear() combo.clear()
items = self.customizableitems.keys() items = list(self.customizableitems.keys())
items.sort() items.sort()
for item in items: for item in items:
if not (allowwm and (item == "Window Border" \ if not (allowwm and (item == "Window Border" \
or item == "Title Bar" or \ or item == "Title Bar" or \
item == "Caption Buttons")): item == "Caption Buttons")):
combo.insertItem(unicode(i18n(item))) combo.insertItem(str(i18n(item)))
def slotFillItemComboDesktop(self,desktop): def slotFillItemComboDesktop(self,desktop):
""" """
@ -2026,14 +2026,14 @@ class AppearancePage(TQWidget):
if not combo: if not combo:
combo = self.itemcombo combo = self.itemcombo
combo.clear() combo.clear()
items = self.customizableitems.keys() items = list(self.customizableitems.keys())
items.sort() items.sort()
self.currentitems = [] self.currentitems = []
for item in items: for item in items:
if not (currentallowwm == 'Y' and (item == "Window Border" \ if not (currentallowwm == 'Y' and (item == "Window Border" \
or item == "Title Bar" or \ or item == "Title Bar" or \
item == "Caption Buttons")): item == "Caption Buttons")):
combo.insertItem(unicode(i18n(item))) combo.insertItem(str(i18n(item)))
self.currentitems.append(item) self.currentitems.append(item)
def slotThemeActivated(self,themeid): def slotThemeActivated(self,themeid):
@ -2043,7 +2043,7 @@ class AppearancePage(TQWidget):
def slotInstallThemeClicked(self): def slotInstallThemeClicked(self):
""" Opens up a dialog to install a new theme """ """ 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"))) "*.msstyles|" + str(i18n("Windows Styles (*.msstyles)")),self,i18n("Install Style")))
if themepath: if themepath:
themename = themepath.split('/') themename = themepath.split('/')
@ -2102,10 +2102,10 @@ class AppearancePage(TQWidget):
schemeslist.append(name) schemeslist.append(name)
self.config.writeEntry("ColorSchemes",schemeslist) self.config.writeEntry("ColorSchemes",schemeslist)
self.config.setGroup(name) self.config.setGroup(name)
for item in self.customizableitems.keys(): for item in list(self.customizableitems.keys()):
for key in schemesettings[item][0].keys(): for key in list(schemesettings[item][0].keys()):
self.config.writeEntry(key,schemesettings[item][0][key][1]) 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.writeEntry(key,schemesettings[item][1][key][1])
self.config.sync() self.config.sync()
@ -2188,7 +2188,7 @@ class AppearancePage(TQWidget):
def slotItemActivated(self,itemid): def slotItemActivated(self,itemid):
""" Picks an item to customize """ """ Picks an item to customize """
items = self.customizableitems.keys() items = list(self.customizableitems.keys())
items.sort() items.sort()
for i,item in enumerate(self.currentitems): for i,item in enumerate(self.currentitems):
if i == itemid: if i == itemid:
@ -2228,11 +2228,11 @@ class AppearancePage(TQWidget):
self.config.setGroup("") self.config.setGroup("")
self.config.writeEntry("ColorScheme",self.colorschemes[colorid]) self.config.writeEntry("ColorScheme",self.colorschemes[colorid])
self.config.setGroup(self.colorschemes[colorid]) self.config.setGroup(self.colorschemes[colorid])
for item in self.customizableitems.keys(): for item in list(self.customizableitems.keys()):
for key in self.customizableitems[item][0].keys(): for key in list(self.customizableitems[item][0].keys()):
color = self.config.readColorEntry(key,TQColor(0,0,0)) color = self.config.readColorEntry(key,TQColor(0,0,0))
self.customizableitems[item][0][key][1] = color 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) size = self.config.readNumEntry(key,1)
self.customizableitems[item][1][key][1] = size self.customizableitems[item][1][key][1] = size
elif colorid == 1: elif colorid == 1:
@ -2733,106 +2733,106 @@ class AppearancePage(TQWidget):
self.top_layout.setSpacing(spacing) self.top_layout.setSpacing(spacing)
# --- Some default color schemes, with names --- # --- Some default color schemes, with names ---
preset1 = (unicode(i18n("Purple")), preset1 = (str(i18n("Purple")),
{"Window Border": {"Window Border":
({"ActiveBorder":[unicode(i18n("Active Color:")),TQColor(239,239,239)], ({"ActiveBorder":[str(i18n("Active Color:")),TQColor(239,239,239)],
"InactiveBorder":[unicode(i18n("Inactive Color:")),TQColor(239,239,239)]}, "InactiveBorder":[str(i18n("Inactive Color:")),TQColor(239,239,239)]},
{"BorderWidth":[unicode(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth {"BorderWidth":[str(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
"Title Bar": "Title Bar":
({"ActiveTitle":[unicode(i18n("Active Color:")),TQColor(91,86,168)], ({"ActiveTitle":[str(i18n("Active Color:")),TQColor(91,86,168)],
"GradientActiveTitle":[unicode(i18n("Gradient:")),TQColor(136,118,202)], "GradientActiveTitle":[str(i18n("Gradient:")),TQColor(136,118,202)],
"InactiveTitle":[unicode(i18n("Inactive Color:")),TQColor(223,225,230)], "InactiveTitle":[str(i18n("Inactive Color:")),TQColor(223,225,230)],
"GradientInactiveTitle":[unicode(i18n("Gradient:")),TQColor(157,170,186)], "GradientInactiveTitle":[str(i18n("Gradient:")),TQColor(157,170,186)],
"TitleText":[unicode(i18n("Active Text:")),TQColor(255,255,255)], "TitleText":[str(i18n("Active Text:")),TQColor(255,255,255)],
"InactiveTitleText":[unicode(i18n("Inactive Text:")),TQColor(168,168,168)]}, "InactiveTitleText":[str(i18n("Inactive Text:")),TQColor(168,168,168)]},
{}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText {}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText
"Application Workspace": "Application Workspace":
({"AppWorkSpace":[unicode(i18n("Background Color:")),TQColor(90,90,90)]}, ({"AppWorkSpace":[str(i18n("Background Color:")),TQColor(90,90,90)]},
{}), #AppWorkSpace "Background" {}), #AppWorkSpace "Background"
"Buttons": "Buttons":
({"ButtonFace":[unicode(i18n("Face:")),TQColor(238,239,242)], ({"ButtonFace":[str(i18n("Face:")),TQColor(238,239,242)],
"ButtonHilight":[unicode(i18n("Hilight:")),TQColor(255,255,255)], "ButtonHilight":[str(i18n("Hilight:")),TQColor(255,255,255)],
"ButtonLight":[unicode(i18n("Light:")),TQColor(201,199,255)], "ButtonLight":[str(i18n("Light:")),TQColor(201,199,255)],
"ButtonShadow":[unicode(i18n("Shadow:")),TQColor(132,132,134)], "ButtonShadow":[str(i18n("Shadow:")),TQColor(132,132,134)],
"ButtonText":[unicode(i18n("Text Color:")),TQColor(0,0,0)], "ButtonText":[str(i18n("Text Color:")),TQColor(0,0,0)],
"ButtonAlternateFace":[unicode(i18n("Alternate Face:")),TQColor(238,239,242)], "ButtonAlternateFace":[str(i18n("Alternate Face:")),TQColor(238,239,242)],
"ButtonDkShadow":[unicode(i18n("Dark Shadow:")),TQColor(98,96,143)], "ButtonDkShadow":[str(i18n("Dark Shadow:")),TQColor(98,96,143)],
"WindowFrame":[unicode(i18n("Frame:")),TQColor(144,140,209)]}, "WindowFrame":[str(i18n("Frame:")),TQColor(144,140,209)]},
{}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame {}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame
"Caption Buttons": "Caption Buttons":
({}, ({},
{"CaptionHeight":[unicode(i18n("Height:")),22], {"CaptionHeight":[str(i18n("Height:")),22],
"CaptionWidth":[unicode(i18n("Width:")),22]}), #Metrics: CaptionHeight, CaptionWidth "CaptionWidth":[str(i18n("Width:")),22]}), #Metrics: CaptionHeight, CaptionWidth
"Desktop": "Desktop":
({"Background":[unicode(i18n("Background:")),TQColor(146,127,188)]}, ({"Background":[str(i18n("Background:")),TQColor(146,127,188)]},
{}), #Background {}), #Background
"Menu": "Menu":
({"Menu":[unicode(i18n("Menu Background:")),TQColor(250,251,254)], ({"Menu":[str(i18n("Menu Background:")),TQColor(250,251,254)],
"MenuBar":[unicode(i18n("Menu Bar Color:")),TQColor(238,239,242)], "MenuBar":[str(i18n("Menu Bar Color:")),TQColor(238,239,242)],
"MenuHilight":[unicode(i18n("Menu Hilight:")),TQColor(144,140,209)], "MenuHilight":[str(i18n("Menu Hilight:")),TQColor(144,140,209)],
"MenuText":[unicode(i18n("Text Color:")),TQColor(0,0,0)]}, "MenuText":[str(i18n("Text Color:")),TQColor(0,0,0)]},
{"MenuHeight":[unicode(i18n("Menu Bar Height:")),22]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing) {"MenuHeight":[str(i18n("Menu Bar Height:")),22]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
"Scrollbar": "Scrollbar":
({"Scrollbar":[unicode(i18n("Color:")),TQColor(238,239,242)]}, ({"Scrollbar":[str(i18n("Color:")),TQColor(238,239,242)]},
{"ScrollWidth":[unicode(i18n("Width:")),16]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth {"ScrollWidth":[str(i18n("Width:")),16]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
"Window": "Window":
({"Window":[unicode(i18n("Background:")),TQColor(255,255,255)], ({"Window":[str(i18n("Background:")),TQColor(255,255,255)],
"WindowText":[unicode(i18n("Text Color:")),TQColor(0,0,0)]}, "WindowText":[str(i18n("Text Color:")),TQColor(0,0,0)]},
{}), #Window "Background", WindowText {}), #Window "Background", WindowText
"Selected Items": "Selected Items":
({"Hilight":[unicode(i18n("Hilight Color:")),TQColor(144,140,209)], ({"Hilight":[str(i18n("Hilight Color:")),TQColor(144,140,209)],
"HilightText":[unicode(i18n("Text Color:")),TQColor(255,255,255)]}, "HilightText":[str(i18n("Text Color:")),TQColor(255,255,255)]},
{})}) #Hilight, HilightText {})}) #Hilight, HilightText
preset2 = (unicode(i18n("Blue")), preset2 = (str(i18n("Blue")),
{"Window Border": {"Window Border":
({"ActiveBorder":[unicode(i18n("Active Color:")),TQColor(239,239,239)], ({"ActiveBorder":[str(i18n("Active Color:")),TQColor(239,239,239)],
"InactiveBorder":[unicode(i18n("Inactive Color:")),TQColor(239,239,239)]}, "InactiveBorder":[str(i18n("Inactive Color:")),TQColor(239,239,239)]},
{"BorderWidth":[unicode(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth {"BorderWidth":[str(i18n("Width:")),1]}), #ActiveBorder, InactiveBorder, metrics: BorderWidth
"Title Bar": "Title Bar":
({"ActiveTitle":[unicode(i18n("Active Color:")),TQColor(0,113,201)], ({"ActiveTitle":[str(i18n("Active Color:")),TQColor(0,113,201)],
"GradientActiveTitle":[unicode(i18n("Gradient:")),TQColor(87,161,219)], "GradientActiveTitle":[str(i18n("Gradient:")),TQColor(87,161,219)],
"InactiveTitle":[unicode(i18n("Inactive Color:")),TQColor(191,191,191)], "InactiveTitle":[str(i18n("Inactive Color:")),TQColor(191,191,191)],
"GradientInactiveTitle":[unicode(i18n("Gradient:")),TQColor(171,171,171)], "GradientInactiveTitle":[str(i18n("Gradient:")),TQColor(171,171,171)],
"TitleText":[unicode(i18n("Active Text:")),TQColor(255,255,255)], "TitleText":[str(i18n("Active Text:")),TQColor(255,255,255)],
"InactiveTitleText":[unicode(i18n("Inactive Text:")),TQColor(95,95,95)]}, "InactiveTitleText":[str(i18n("Inactive Text:")),TQColor(95,95,95)]},
{}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText {}), #ActiveTitle, GradientActiveTitle, InactiveTitle, GradientInactiveTitle, TitleText, InactiveTitleText
"Application Workspace": "Application Workspace":
({"AppWorkSpace":[unicode(i18n("Background Color:")),TQColor(90,90,90)]}, ({"AppWorkSpace":[str(i18n("Background Color:")),TQColor(90,90,90)]},
{}), #AppWorkSpace "Background" {}), #AppWorkSpace "Background"
"Buttons": "Buttons":
({"ButtonFace":[unicode(i18n("Face:")),TQColor(239,239,239)], ({"ButtonFace":[str(i18n("Face:")),TQColor(239,239,239)],
"ButtonHilight":[unicode(i18n("Hilight:")),TQColor(246,246,246)], "ButtonHilight":[str(i18n("Hilight:")),TQColor(246,246,246)],
"ButtonLight":[unicode(i18n("Light:")),TQColor(191,207,251)], "ButtonLight":[str(i18n("Light:")),TQColor(191,207,251)],
"ButtonShadow":[unicode(i18n("Shadow:")),TQColor(148,148,153)], "ButtonShadow":[str(i18n("Shadow:")),TQColor(148,148,153)],
"ButtonText":[unicode(i18n("Text Color:")),TQColor(0,0,0)], "ButtonText":[str(i18n("Text Color:")),TQColor(0,0,0)],
"ButtonAlternateFace":[unicode(i18n("Alternate Face:")),TQColor(238,239,242)], "ButtonAlternateFace":[str(i18n("Alternate Face:")),TQColor(238,239,242)],
"ButtonDkShadow":[unicode(i18n("Dark Shadow:")),TQColor(50,101,146)], "ButtonDkShadow":[str(i18n("Dark Shadow:")),TQColor(50,101,146)],
"WindowFrame":[unicode(i18n("Frame:")),TQColor(74,149,214)]}, "WindowFrame":[str(i18n("Frame:")),TQColor(74,149,214)]},
{}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame {}), #ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, ButtonAlternateFace, ButtonDkShadow, WindowFrame
"Caption Buttons": "Caption Buttons":
({}, ({},
{"CaptionHeight":[unicode(i18n("Height:")),22], {"CaptionHeight":[str(i18n("Height:")),22],
"CaptionWidth":[unicode(i18n("Width:")),22]}), #Metrics: CaptionHeight, CaptionWidth "CaptionWidth":[str(i18n("Width:")),22]}), #Metrics: CaptionHeight, CaptionWidth
"Desktop": "Desktop":
({"Background":[unicode(i18n("Background:")),TQColor(44,109,189)]}, ({"Background":[str(i18n("Background:")),TQColor(44,109,189)]},
{}), #Background {}), #Background
"Menu": "Menu":
({"Menu":[unicode(i18n("Menu Background:")),TQColor(249,249,249)], ({"Menu":[str(i18n("Menu Background:")),TQColor(249,249,249)],
"MenuBar":[unicode(i18n("Menu Bar Color:")),TQColor(239,239,239)], "MenuBar":[str(i18n("Menu Bar Color:")),TQColor(239,239,239)],
"MenuHilight":[unicode(i18n("Menu Hilight:")),TQColor(74,149,214)], "MenuHilight":[str(i18n("Menu Hilight:")),TQColor(74,149,214)],
"MenuText":[unicode(i18n("Text Color:")),TQColor(0,0,0)]}, "MenuText":[str(i18n("Text Color:")),TQColor(0,0,0)]},
{"MenuHeight":[unicode(i18n("Menu Bar Height:")),22]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing) {"MenuHeight":[str(i18n("Menu Bar Height:")),22]}), #Menu (Background), MenuBar, MenuHilight, MenuText, metrics: MenuHeight, MenuWidth (does nothing)
"Scrollbar": "Scrollbar":
({"Scrollbar":[unicode(i18n("Color:")),TQColor(230,230,230)]}, ({"Scrollbar":[str(i18n("Color:")),TQColor(230,230,230)]},
{"ScrollWidth":[unicode(i18n("Width:")),16]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth {"ScrollWidth":[str(i18n("Width:")),16]}), #Scrollbar, metrics: ScrollHeight (does nothing), ScrollWidth
"Window": "Window":
({"Window":[unicode(i18n("Background:")),TQColor(255,255,255)], ({"Window":[str(i18n("Background:")),TQColor(255,255,255)],
"WindowText":[unicode(i18n("Text Color:")),TQColor(0,0,0)]}, "WindowText":[str(i18n("Text Color:")),TQColor(0,0,0)]},
{}), #Window "Background", WindowText {}), #Window "Background", WindowText
"Selected Items": "Selected Items":
({"Hilight":[unicode(i18n("Hilight Color:")),TQColor(74,149,214)], ({"Hilight":[str(i18n("Hilight Color:")),TQColor(74,149,214)],
"HilightText":[unicode(i18n("Text Color:")),TQColor(255,255,255)]}, "HilightText":[str(i18n("Text Color:")),TQColor(255,255,255)]},
{})}) #Hilight, HilightText {})}) #Hilight, HilightText
presets = [preset1,preset2] presets = [preset1,preset2]
@ -2877,7 +2877,7 @@ class GeneralPage(TQWidget):
"applications.</p>")) "applications.</p>"))
appwarning.setFrameStyle( TQFrame.Box | TQFrame.Raised ) appwarning.setFrameStyle( TQFrame.Box | TQFrame.Raised )
self.winversions = self.winversions + (( "global",\ 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 self.verdic["global"]=11
hbox = TQHBox(vbox) hbox = TQHBox(vbox)
@ -3150,13 +3150,13 @@ class ApplicationsPage(TQWidget):
else: else:
mailertr = str(i18n("KDE (Native)")) mailertr = str(i18n("KDE (Native)"))
else: else:
mailertr = mailer.capitalize() + unicode(i18n(" (Native)")) mailertr = mailer.capitalize() + str(i18n(" (Native)"))
mailers.append((mailer,mailertr)) mailers.append((mailer,mailertr))
for mailer in wine: for mailer in wine:
if mailer and mailer[1] == ':': if mailer and mailer[1] == ':':
mailer = mailer.lower() mailer = mailer.lower()
mailertr = mailer[mailer.rfind('\\\\')+2:mailer.rfind('.exe')] 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 else: # winebrowser
continue continue
mailers.append((mailer,mailertr)) mailers.append((mailer,mailertr))
@ -3176,7 +3176,7 @@ class ApplicationsPage(TQWidget):
""" """
app = KFileDialog.getOpenFileName(wineread.winepath + \ app = KFileDialog.getOpenFileName(wineread.winepath + \
"/dosdevices/c:",\ "/dosdevices/c:",\
"*.exe|" + unicode(i18n("Windows Executables (*.exe)")),self,i18n("Application")) "*.exe|" + str(i18n("Windows Executables (*.exe)")),self,i18n("Application"))
if app: if app:
app = str(app).split('/') app = str(app).split('/')
app = app[-1] app = app[-1]
@ -3325,11 +3325,11 @@ class LibrariesPage(TQWidget):
orderoptions = ("builtin","native","builtin,native","native,builtin","") orderoptions = ("builtin","native","builtin,native","native,builtin","")
orderoptionstr = [ orderoptionstr = [
unicode(i18n("Built-in (Wine)")), str(i18n("Built-in (Wine)")),
unicode(i18n("Native (Windows)")), str(i18n("Native (Windows)")),
unicode(i18n("Built-in then Native")), str(i18n("Built-in then Native")),
unicode(i18n("Native then Built-in")), str(i18n("Native then Built-in")),
unicode(i18n("Disable"))] str(i18n("Disable"))]
def __init__(self,parent = None,name = None,modal = 0,fl = 0): def __init__(self,parent = None,name = None,modal = 0,fl = 0):
TQWidget.__init__(self,parent) TQWidget.__init__(self,parent)
@ -3463,7 +3463,7 @@ class LibrariesPage(TQWidget):
""" """
if self.selecteddll: if self.selecteddll:
order = KInputDialog.getItem(i18n("Edit Library Override"),\ 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),\ TQStringList.fromStrList(self.orderoptionstr),\
False,0,self,"editdll") False,0,self,"editdll")
@ -3488,7 +3488,7 @@ class LibrariesPage(TQWidget):
firstselecteddll = None firstselecteddll = None
lastdll = None lastdll = None
for dll,order in self.overriddendlls.iteritems(): for dll,order in self.overriddendlls.items():
lvi = TQListViewItem(self.dllslist,dll,order) lvi = TQListViewItem(self.dllslist,dll,order)
self.dllsToListItems[dll] = lvi self.dllsToListItems[dll] = lvi
if self.selecteddll and self.selecteddll==dll: if self.selecteddll and self.selecteddll==dll:

@ -102,7 +102,7 @@ def LoadDrives():
letter = drive[1].lower() letter = drive[1].lower()
if letter in driveletters: if letter in driveletters:
drive[2] = os.readlink(winepath + "/dosdevices/" + letter) drive[2] = os.readlink(winepath + "/dosdevices/" + letter)
if drivetypes.has_key(drive[1]): if drive[1] in drivetypes:
drive[3] = drivetypes[drive[1]] drive[3] = drivetypes[drive[1]]
return drives return drives

@ -99,7 +99,7 @@ def SetShellLinks(shelllinks):
if createLink: if createLink:
os.symlink(link[2], wineread.winepath + "/dosdevices/c:/windows/profiles/" + os.environ['USER'] + "/" + link[1]) os.symlink(link[2], wineread.winepath + "/dosdevices/c:/windows/profiles/" + os.environ['USER'] + "/" + link[1])
if shellregistry.has_key(link[1]): if link[1] in shellregistry:
SetShellRegistry(link) SetShellRegistry(link)
@ -322,10 +322,10 @@ def SetDllOverrides(overrides, app = None):
origoverrides = wineread.GetDllOverrides(app) origoverrides = wineread.GetDllOverrides(app)
for dll in overrides.keys(): for dll in list(overrides.keys()):
dllfile.write('"'+str(dll)+'"="'+str(overrides[dll])+'"\n') dllfile.write('"'+str(dll)+'"="'+str(overrides[dll])+'"\n')
for dll in origoverrides.keys(): for dll in list(origoverrides.keys()):
if dll not in overrides: if dll not in overrides:
dllfile.write('"'+str(dll)+'"=-\n') dllfile.write('"'+str(dll)+'"=-\n')

Loading…
Cancel
Save