summaryrefslogtreecommitdiffstats
path: root/userconfig/userconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'userconfig/userconfig.py')
-rwxr-xr-xuserconfig/userconfig.py246
1 files changed, 123 insertions, 123 deletions
diff --git a/userconfig/userconfig.py b/userconfig/userconfig.py
index fb47f57..9ef5bdc 100755
--- a/userconfig/userconfig.py
+++ b/userconfig/userconfig.py
@@ -315,12 +315,12 @@ class UserConfigApp(programbase):
cmenu.setItemEnabled(1,False)
cmenu.exec_loop(p)
- #######################################################################
+ #######################################################################
def sizeHint(self):
global programbase
size_hint = programbase.sizeHint(self)
# Just make the dialog a little shorter by default.
- size_hint.setHeight(size_hint.height()-200)
+ size_hint.setHeight(size_hint.height()-200)
return size_hint
#######################################################################
@@ -439,7 +439,7 @@ class UserConfigApp(programbase):
for userobj in users:
uid = userobj.getUID()
if self.showsystemaccounts or not userobj.isSystemUser():
- lvi = TDEListViewItem(self.userlist,userobj.getUsername(),userobj.getRealName(),unicode(uid))
+ lvi = TDEListViewItem(self.userlist,userobj.getUsername(),userobj.getRealName(),str(uid))
if userobj.isLocked():
lvi.setPixmap(0,UserIcon("hi16-encrypted"))
self.useridsToListItems[uid] = lvi
@@ -457,7 +457,7 @@ class UserConfigApp(programbase):
userobj = self.admincontext.lookupUID(userid)
lvi.setText(0,userobj.getUsername())
lvi.setText(1,userobj.getRealName())
- lvi.setText(2,unicode(userobj.getUID()))
+ lvi.setText(2,str(userobj.getUID()))
if userobj.isLocked():
lvi.setPixmap(0,UserIcon("hi16-encrypted"))
else:
@@ -477,7 +477,7 @@ class UserConfigApp(programbase):
username = userobj.getUsername()
self.loginnamelabel.setText(username)
self.realnamelabel.setText(userobj.getRealName())
- self.uidlabel.setText(unicode(userid))
+ self.uidlabel.setText(str(userid))
if userobj.isLocked():
self.statuslabel.setText(i18n("Disabled"))
else:
@@ -490,7 +490,7 @@ class UserConfigApp(programbase):
# Secondary Groups
secondarygroups = [g.getGroupname() for g in userobj.getGroups() if g is not userobj.getPrimaryGroup()]
- self.secondarygrouplabel.setText(unicode(i18n(", ")).join(secondarygroups))
+ self.secondarygrouplabel.setText(str(i18n(", ")).join(secondarygroups))
if isroot:
self.deletebutton.setDisabled(userobj.getUID()==0)
@@ -505,7 +505,7 @@ class UserConfigApp(programbase):
for groupobj in groups:
gid = groupobj.getGID()
if self.showsystemgroups or not groupobj.isSystemGroup():
- lvi = TQListViewItem(self.grouplist,groupobj.getGroupname(),unicode(gid))
+ lvi = TQListViewItem(self.grouplist,groupobj.getGroupname(),str(gid))
self.groupidsToListItems[gid] = lvi
if self.selectedgroupid==gid:
firstselectedgroupid = gid
@@ -528,7 +528,7 @@ class UserConfigApp(programbase):
self.groupmemberlist.clear()
for userobj in members:
if userobj!=None:
- lvi = TQListViewItem(self.groupmemberlist,userobj.getUsername(),userobj.getRealName(),unicode(userobj.getUID()))
+ lvi = TQListViewItem(self.groupmemberlist,userobj.getUsername(),userobj.getRealName(),str(userobj.getUID()))
if isroot:
self.deletegroupbutton.setDisabled(groupobj.getGID()==0)
@@ -563,7 +563,7 @@ class UserConfigApp(programbase):
def save(self):
pass
def defaults(self):
- pass
+ pass
def sysdefaults(self):
pass
@@ -578,28 +578,28 @@ class UserConfigApp(programbase):
# Rudd-O convenience class to map groups to privilege names
class PrivilegeNames(dict):
- """Convenience dict-derived class: map known secondary groups to privilege names, provide default mapping for groups that do not have a description. This could be replaced by a simple dict() but I simply preferred the class declaration.
-
- FIXME This should ideally be included in a more general module so it can be reused."""
-
- def __init__(self):
- dict.__init__(self, {
- "plugdev":i18n("Access external storage devices automatically"),
- "adm":i18n("Administer the system"),
- "ltsp":i18n("Allow use of FUSE filesystems like LTSP thin client block devices"),
- "dialout":i18n("Connect to the Internet using a modem"),
- "syslog":i18n("Monitor system logs"),
- "fax":i18n("Send and receive faxes"),
- "cdrom":i18n("Use CD-ROM and DVD drives"),
- "floppy":i18n("Use floppy drives"),
- "modem":i18n("Use modems"),
- "scanner":i18n("Use scanners"),
- })
-
- def __getitem__(self,name):
- # This is cruft but I couldn't bring myself to kill it bua!
- if name in self: return dict.__getitem__(self,name)
- return i18n("Be a member of the %s group")%name
+ """Convenience dict-derived class: map known secondary groups to privilege names, provide default mapping for groups that do not have a description. This could be replaced by a simple dict() but I simply preferred the class declaration.
+
+ FIXME This should ideally be included in a more general module so it can be reused."""
+
+ def __init__(self):
+ dict.__init__(self, {
+ "plugdev":i18n("Access external storage devices automatically"),
+ "adm":i18n("Administer the system"),
+ "ltsp":i18n("Allow use of FUSE filesystems like LTSP thin client block devices"),
+ "dialout":i18n("Connect to the Internet using a modem"),
+ "syslog":i18n("Monitor system logs"),
+ "fax":i18n("Send and receive faxes"),
+ "cdrom":i18n("Use CD-ROM and DVD drives"),
+ "floppy":i18n("Use floppy drives"),
+ "modem":i18n("Use modems"),
+ "scanner":i18n("Use scanners"),
+ })
+
+ def __getitem__(self,name):
+ # This is cruft but I couldn't bring myself to kill it bua!
+ if name in self: return dict.__getitem__(self,name)
+ return i18n("Be a member of the %s group")%name
class UserEditDialog(KDialogBase):
def __init__(self,parent,admincontext):
@@ -637,7 +637,7 @@ class UserEditDialog(KDialogBase):
hbox.setStretchFactor(self.disabledradio,0)
label = TQLabel(hbox)
label.setPixmap(UserIcon("hi16-encrypted"))
- hbox.setStretchFactor(label,1)
+ hbox.setStretchFactor(label,1)
infogrid.addWidget(hbox,1,1)
self.enabledradiogroup.insert(self.enabledradio,0)
@@ -691,19 +691,19 @@ class UserEditDialog(KDialogBase):
infogrid.addWidget(self.shelledit,8,1)
# Rudd-O rules. Not so much, but enough to rule.
- # yeah it's not my finest hour, but it works like a charm over here. Please feel free to clean up dead code that I commented
- # I extend my deepest thanks to the people that have worked hard to construct this tool in the first place. I have no idea who the authors and contributors are, but it would make sense to have all the contributors listed on top of the file.
- # Privileges and groups tab
+ # yeah it's not my finest hour, but it works like a charm over here. Please feel free to clean up dead code that I commented
+ # I extend my deepest thanks to the people that have worked hard to construct this tool in the first place. I have no idea who the authors and contributors are, but it would make sense to have all the contributors listed on top of the file.
+ # Privileges and groups tab
groupsvbox = self.addHBoxPage(i18n("Privileges and groups"))
- # Rudd-O now here we create the widget that will hold the group listing, and fill it with the groups.
+ # Rudd-O now here we create the widget that will hold the group listing, and fill it with the groups.
self.privilegeslistview = TQListView(groupsvbox)
- self.privilegeslistview.addColumn(i18n("Privilege"),-1)
+ self.privilegeslistview.addColumn(i18n("Privilege"),-1)
self.groupslistview = TQListView(groupsvbox)
- self.groupslistview.addColumn(i18n("Secondary group"),-1)
- groupsvbox.setStretchFactor(self.privilegeslistview,3)
- groupsvbox.setStretchFactor(self.groupslistview,2)
-
+ self.groupslistview.addColumn(i18n("Secondary group"),-1)
+ groupsvbox.setStretchFactor(self.privilegeslistview,3)
+ groupsvbox.setStretchFactor(self.groupslistview,2)
+
# Password and Security Tab.
passwordvbox = self.addVBoxPage(i18n("Password && Security"))
@@ -771,7 +771,7 @@ class UserEditDialog(KDialogBase):
self.connect(self.forcepasswordchangecheckbox,SIGNAL("toggled(bool)"),self.slotForcePasswordChangeToggled)
passwordaginggrid.addWidget(self.forcepasswordchangecheckbox,0,0)
label = TQLabel(i18n("Require new password after:"),passwordagingwidget)
- passwordaginggrid.addWidget(label,0,1)
+ passwordaginggrid.addWidget(label,0,1)
self.maximumpasswordedit = TQSpinBox(passwordagingwidget)
self.maximumpasswordedit.setSuffix(i18n(" days"))
self.maximumpasswordedit.setMinValue(1)
@@ -816,25 +816,25 @@ class UserEditDialog(KDialogBase):
self.updatingGUI = False
def _repopulateGroupsPrivileges(self,excludegroups=None):
- # needs listviews to be constructed. Expects a list of PwdGroups to be excluded
-
- # rehash everything
- self.privilegeslistview.clear()
- self.groupslistview.clear()
- self.secondarygroupcheckboxes = {}
- pn = PrivilegeNames()
-
- if excludegroups: excludegroups = [ g.getGroupname() for g in excludegroups ]
- else: excludegroups = []
- for group in [g.getGroupname() for g in self.admincontext.getGroups()]:
- if group in excludegroups: continue
- if group in pn:
- name = i18n(unicode(pn[group]).encode(locale.getpreferredencoding()))
- wid = self.privilegeslistview
- else:
- name = unicode(group).encode(locale.getpreferredencoding())
- wid = self.groupslistview
- self.secondarygroupcheckboxes[group] = TQCheckListItem(wid,name,TQCheckListItem.CheckBox)
+ # needs listviews to be constructed. Expects a list of PwdGroups to be excluded
+
+ # rehash everything
+ self.privilegeslistview.clear()
+ self.groupslistview.clear()
+ self.secondarygroupcheckboxes = {}
+ pn = PrivilegeNames()
+
+ if excludegroups: excludegroups = [ g.getGroupname() for g in excludegroups ]
+ else: excludegroups = []
+ for group in [g.getGroupname() for g in self.admincontext.getGroups()]:
+ if group in excludegroups: continue
+ if group in pn:
+ name = i18n(str(pn[group]).encode(locale.getpreferredencoding()))
+ wid = self.privilegeslistview
+ else:
+ name = str(group).encode(locale.getpreferredencoding())
+ wid = self.groupslistview
+ self.secondarygroupcheckboxes[group] = TQCheckListItem(wid,name,TQCheckListItem.CheckBox)
########################################################################
def showEditUser(self,userid):
@@ -845,14 +845,14 @@ class UserEditDialog(KDialogBase):
self.passwordedit.erase()
self.selectedgroups = [g.getGroupname() for g in self.userobj.getGroups()
if g is not self.userobj.getPrimaryGroup()]
-
- # Rudd-O: now here we tick the appropriate group listing checkbox, and hide the currently active primary group of the user. We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
- self._repopulateGroupsPrivileges(excludegroups=[self.userobj.getPrimaryGroup()])
- for group,checkbox in self.secondarygroupcheckboxes.items():
- if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
- else: checkbox.setState(TQCheckListItem.Off)
-
- self.originalgroups = self.selectedgroups[:]
+
+ # Rudd-O: now here we tick the appropriate group listing checkbox, and hide the currently active primary group of the user. We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
+ self._repopulateGroupsPrivileges(excludegroups=[self.userobj.getPrimaryGroup()])
+ for group,checkbox in list(self.secondarygroupcheckboxes.items()):
+ if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
+ else: checkbox.setState(TQCheckListItem.Off)
+
+ self.originalgroups = self.selectedgroups[:]
self.selectedgroups.sort()
self.__syncGUI()
self.uidedit.setReadOnly(True)
@@ -864,18 +864,18 @@ class UserEditDialog(KDialogBase):
if self.passwordedit.password()!="":
self.userobj.setPassword(self.passwordedit.password())
# Update the groups for this user object. Rudd-O here's when you go in, stud.
- # we collect the selected groups
- self.selectedgroups = [ group for group,checkbox in self.secondarygroupcheckboxes.items() if checkbox.isOn() ]
+ # we collect the selected groups
+ self.selectedgroups = [ group for group,checkbox in list(self.secondarygroupcheckboxes.items()) if checkbox.isOn() ]
for g in self.userobj.getGroups(): # this seems wasteful to remove the user from all groups then re-add, why not a cross check?
self.userobj.removeFromGroup(g)
for gn in self.selectedgroups:
self.userobj.addToGroup(self.admincontext.lookupGroupname(gn))
- primarygroupname = unicode(self.primarygroupedit.currentText())
+ primarygroupname = str(self.primarygroupedit.currentText())
self.userobj.setPrimaryGroup(self.admincontext.lookupGroupname(primarygroupname))
- # Enable/Disable the account
+ # Enable/Disable the account
self.userobj.setLocked(self.enabledradiogroup.id(self.enabledradiogroup.selected())!=0)
self.admincontext.save()
@@ -889,17 +889,17 @@ class UserEditDialog(KDialogBase):
self.newgroup.setGroupname(self.__fudgeNewGroupName(self.userobj.getUsername()))
self.userobj.setPrimaryGroup(self.newgroup)
- self.selectedgroups = [ u'dialout',u'cdrom',u'floppy',u'audio',u'video',
- u'plugdev',u'lpadmin',u'scanner']
+ self.selectedgroups = [ 'dialout','cdrom','floppy','audio','video',
+ 'plugdev','lpadmin','scanner']
homedir = self.__fudgeNewHomeDirectory(self.userobj.getUsername())
-
- # Rudd-O FIXME: now here we tick the proper groups that should be allowed. Now it selects what userconfig selected before. FIXME consider adding a drop down that will select the appropriate profile Limited User, Advanced User or Administrator (and see if there is a config file where these profiles can be read). We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
- self._repopulateGroupsPrivileges()
- for group,checkbox in self.secondarygroupcheckboxes.items():
- if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
- else: checkbox.setState(TQCheckListItem.Off)
-
- self.userobj.setHomeDirectory(homedir)
+
+ # Rudd-O FIXME: now here we tick the proper groups that should be allowed. Now it selects what userconfig selected before. FIXME consider adding a drop down that will select the appropriate profile Limited User, Advanced User or Administrator (and see if there is a config file where these profiles can be read). We are repopulating because if the user to edit changes, we need to hide the user's secondary group. FIXME we should repopulate the groups privileges list when the primary group is changed in the other tab -- that is, on the change slot of the primary group drop down.
+ self._repopulateGroupsPrivileges()
+ for group,checkbox in list(self.secondarygroupcheckboxes.items()):
+ if group in self.selectedgroups: checkbox.setState(TQCheckListItem.On)
+ else: checkbox.setState(TQCheckListItem.Off)
+
+ self.userobj.setHomeDirectory(homedir)
self.homediredit.setText(homedir)
shells = self.admincontext.getUserShells()
@@ -909,9 +909,9 @@ class UserEditDialog(KDialogBase):
elif '/bin/bash' in shells:
self.userobj.setLoginShell('/bin/bash')
elif '/bin/sh' in shells:
- self.userobj.setLoginShell('/bin/sh')
+ self.userobj.setLoginShell('/bin/sh')
elif len(shells)!=0:
- self.userobj.setLoginShell(shells[0])
+ self.userobj.setLoginShell(shells[0])
self.__syncGUI()
@@ -944,8 +944,8 @@ class UserEditDialog(KDialogBase):
self.userobj.setPrimaryGroup(newgroup)
# Update the groups for this user object. Rudd-O here's when you go in, stud.
- # we collect the selected groups
- self.selectedgroups = [ group for group,checkbox in self.secondarygroupcheckboxes.items() if checkbox.isOn() ]
+ # we collect the selected groups
+ self.selectedgroups = [ group for group,checkbox in list(self.secondarygroupcheckboxes.items()) if checkbox.isOn() ]
for gn in self.selectedgroups:
self.userobj.addToGroup(self.admincontext.lookupGroupname(gn))
@@ -953,7 +953,7 @@ class UserEditDialog(KDialogBase):
if self.passwordedit.password()!="":
self.userobj.setPassword(self.passwordedit.password())
- # Enable/Disable the account
+ # Enable/Disable the account
self.userobj.setLocked(self.enabledradiogroup.id(self.enabledradiogroup.selected())!=0)
self.admincontext.save()
@@ -972,18 +972,18 @@ class UserEditDialog(KDialogBase):
ok = True
# Sanity check all values.
if self.newusermode:
- newusername = unicode(self.realnameedit.text())
+ newusername = str(self.realnameedit.text())
if self.admincontext.lookupUsername(newusername)!=None:
KMessageBox.sorry(self,i18n("Sorry, you must choose a different user name.\n'%1' is already being used.").arg(newusername))
ok = False
else:
- newuid = int(unicode(self.uidedit.text()))
+ newuid = int(str(self.uidedit.text()))
originaluid = self.userobj.getUID()
if self.admincontext.lookupUID(newuid)!=None:
rc = KMessageBox.questionYesNo(self,i18n("User ID in use"),
i18n("Sorry, the UID %1 is already in use. Should %2 be used instead?").arg(newuid).arg(originaluid))
if rc==KMessageBox.Yes:
- self.uidedit.setValue(unicode(originaluid))
+ self.uidedit.setValue(str(originaluid))
else:
ok = False
else:
@@ -994,7 +994,7 @@ class UserEditDialog(KDialogBase):
########################################################################
def slotLoginChanged(self,text):
- newtext = unicode(text)
+ newtext = str(text)
if not self.updatingGUI:
if self.newusermode:
self.newprimarygroupname = self.__fudgeNewGroupName(newtext)
@@ -1019,7 +1019,7 @@ class UserEditDialog(KDialogBase):
self.loginnameedit.setText(self.userobj.getUsername())
self.realnameedit.setText(self.userobj.getRealName())
- self.uidedit.setText(unicode(self.userobj.getUID()))
+ self.uidedit.setText(str(self.userobj.getUID()))
self.homediredit.setText(self.userobj.getHomeDirectory())
self.shelledit.setCurrentText(self.userobj.getLoginShell())
@@ -1036,7 +1036,7 @@ class UserEditDialog(KDialogBase):
if self.newusermode:
# New user mode
- self.newprimarygroupname = self.__fudgeNewGroupName(unicode(self.userobj.getUsername()))
+ self.newprimarygroupname = self.__fudgeNewGroupName(str(self.userobj.getUsername()))
primarygroupname = self.newprimarygroupname
self.primarygroupedit.insertItem(self.newprimarygroupname)
else:
@@ -1050,7 +1050,7 @@ class UserEditDialog(KDialogBase):
if self.userobj.getExpirationDate() is None:
self.validradiogroup.setButton(0)
self.expiredate.setDisabled(True)
- self.expiredate.setDate(SptimeToQDate(99999L))
+ self.expiredate.setDate(SptimeToQDate(99999))
else:
self.validradiogroup.setButton(1)
self.expiredate.setDisabled(False)
@@ -1097,13 +1097,13 @@ class UserEditDialog(KDialogBase):
########################################################################
def __updateObjectFromGUI(self,userobj):
- username = unicode(self.loginnameedit.text())
+ username = str(self.loginnameedit.text())
userobj.setUsername(username)
- userobj.setRealName(unicode(self.realnameedit.text()))
+ userobj.setRealName(str(self.realnameedit.text()))
- userobj.setHomeDirectory(unicode(self.homediredit.text()))
- userobj.setLoginShell(unicode(self.shelledit.currentText()))
- self.primarygroupname = unicode(self.primarygroupedit.currentText())
+ userobj.setHomeDirectory(str(self.homediredit.text()))
+ userobj.setLoginShell(str(self.shelledit.currentText()))
+ self.primarygroupname = str(self.primarygroupedit.currentText())
groupobj = self.admincontext.lookupGroupname(self.primarygroupname)
if groupobj is not None:
userobj.setPrimaryGroup(groupobj)
@@ -1165,30 +1165,30 @@ class UserEditDialog(KDialogBase):
if self.admincontext.lookupGroupname(basename) is None:
return basename
x = 1
- while self.admincontext.lookupGroupname(basename + u'_' + unicode(x)) is not None:
+ while self.admincontext.lookupGroupname(basename + '_' + str(x)) is not None:
x += 1
- return basename + u'_' + unicode(x)
+ return basename + '_' + str(x)
#######################################################################
def __fudgeNewHomeDirectory(self,origbasename):
basename = origbasename.replace("/","")
if basename=="":
- basename = u"user"
+ basename = "user"
dhome = self.admincontext.dhome
if not os.path.isdir(dhome):
- raise OSError, dhome+" does not exist, is it correctly set in "+ \
- self.admincontext.adduserconf+" ?"
+ raise OSError(dhome+" does not exist, is it correctly set in "+ \
+ self.admincontext.adduserconf+" ?")
else:
# Make sure there's a trailing /
- if dhome[-1] is not '/':
+ if dhome[-1] != '/':
dhome = dhome+'/'
if os.path.exists(dhome+basename)==False:
return dhome+basename
else:
x = 1
- while os.path.exists(dhome+basename + u'_' + unicode(x)):
+ while os.path.exists(dhome+basename + '_' + str(x)):
x += 1
return dhome+basename
@@ -1200,7 +1200,7 @@ class LoginNameValidator(TQValidator):
#######################################################################
def validate(self,inputstr,pos):
- instr = unicode(inputstr)
+ instr = str(inputstr)
if len(instr)==0:
return (TQValidator.Intermediate,pos)
for c in instr:
@@ -1218,7 +1218,7 @@ class LoginNameValidator(TQValidator):
#######################################################################
def fixup(self,inputstr):
- instr = unicode(inputstr)
+ instr = str(inputstr)
newstr = ""
for c in instr:
if (ord(c)<0x20 or ord(c)>0x7f or c.isspace() or c==":" or c=="," or c==".")==False:
@@ -1236,7 +1236,7 @@ class RealUserNameValidator(TQValidator):
#######################################################################
def validate(self,inputstr,pos):
- instr = unicode(inputstr)
+ instr = str(inputstr)
for c in instr:
if c==":":
return (TQValidator.Invalid,pos)
@@ -1252,7 +1252,7 @@ class RealUserNameValidator(TQValidator):
#######################################################################
def fixup(self,inputstr):
- return unicode(inputstr).replace(":","")
+ return str(inputstr).replace(":","")
###########################################################################
class ListPickerDialog(KDialogBase):
@@ -1314,7 +1314,7 @@ class ListPickerDialog(KDialogBase):
if self.exec_loop()==TQDialog.Accepted:
newlist = []
for i in range(self.selectedlist.count()):
- newlist.append(unicode(self.selectedlist.item(i).text()))
+ newlist.append(str(self.selectedlist.item(i).text()))
return newlist
else:
return selectedlist
@@ -1411,7 +1411,7 @@ class UserDeleteDialog(KDialog):
self.connect(cancelbutton,SIGNAL("clicked()"),self.slotCancelClicked)
def deleteUser(self,userid):
- # Setup the
+ # Setup the
userobj = self.admincontext.lookupUID(userid)
self.usernamelabel.setText(i18n("Are you sure want to delete user account '%1' (%2)?").arg(userobj.getUsername()).arg(userobj.getUID()) )
self.deletedirectorycheckbox.setChecked(False)
@@ -1507,7 +1507,7 @@ class OverwriteHomeDirectoryDialog(KDialog):
self.connect(cancelbutton,SIGNAL("clicked()"),self.slotCancelClicked)
def do(self,userobj):
- # Setup the
+ # Setup the
self.toplabel.setText(i18n("The directory '%1' was entered as the home directory for new user '%2'.\n This directory already exists.") \
.arg(userobj.getHomeDirectory()).arg(userobj.getUsername()) )
self.radiogroup.setButton(0)
@@ -1602,7 +1602,7 @@ class GroupEditDialog(KDialogBase):
groupobj = self.admincontext.lookupGID(groupid)
self.groupnamelabel.setText(groupobj.getGroupname())
- self.groupidlabel.setText(unicode(groupid))
+ self.groupidlabel.setText(str(groupid))
availablemembers = [u.getUsername() for u in self.admincontext.getUsers()]
originalmembers = [u.getUsername() for u in groupobj.getUsers()]
@@ -1612,7 +1612,7 @@ class GroupEditDialog(KDialogBase):
if self.exec_loop()==TQDialog.Accepted:
newmembers = []
for i in range(self.selectedlist.count()):
- newmembers.append(unicode(self.selectedlist.item(i).text()))
+ newmembers.append(str(self.selectedlist.item(i).text()))
# Remove from the group object any unselected users.
for member in originalmembers:
@@ -1639,7 +1639,7 @@ class GroupEditDialog(KDialogBase):
groupname = self.groupobj.getGroupname()
self.groupnamelabel.setText(groupname)
self.groupnamelabel.setReadOnly(False)
- self.groupidlabel.setText(unicode(self.groupobj.getGID()))
+ self.groupidlabel.setText(str(self.groupobj.getGID()))
self.groupidlabel.setReadOnly(False)
availablemembers = [u.getUsername() for u in self.admincontext.getUsers()]
@@ -1647,13 +1647,13 @@ class GroupEditDialog(KDialogBase):
self.__updateLists(availablemembers,[])
if self.exec_loop()==TQDialog.Accepted:
- self.groupobj.setGroupname(unicode(self.groupnamelabel.text()))
- newgroupid = int(unicode(self.groupidlabel.text()))
+ self.groupobj.setGroupname(str(self.groupnamelabel.text()))
+ newgroupid = int(str(self.groupidlabel.text()))
self.groupobj.setGID(newgroupid)
newmembers = []
for i in range(self.selectedlist.count()):
- newmembers.append(unicode(self.selectedlist.item(i).text()))
+ newmembers.append(str(self.selectedlist.item(i).text()))
self.admincontext.addGroup(self.groupobj)
@@ -1725,9 +1725,9 @@ class GroupEditDialog(KDialogBase):
if basename not in availablegroups:
return basename
x = 1
- while basename + u'_' + unicode(x) in availablegroups:
+ while basename + '_' + str(x) in availablegroups:
x += 1
- return basename + u'_' + unicode(x)
+ return basename + '_' + str(x)
############################################################################
# Factory function for KControl
@@ -1737,7 +1737,7 @@ def create_userconfig(parent,name):
##########################################################################
def MakeAboutData():
aboutdata = TDEAboutData("guidance", programname, version,
- unicode(i18n("User and Group Configuration Tool")).encode(locale.getpreferredencoding()),
+ str(i18n("User and Group Configuration Tool")).encode(locale.getpreferredencoding()),
TDEAboutData.License_GPL, "Copyright (C) 2003-2007 Simon Edwards")
aboutdata.addAuthor("Simon Edwards", "Developer", "simon@simonzone.com", "http://www.simonzone.com/software/")
aboutdata.addAuthor("Sebastian Kügler", "Developer", "sebas@kde.org", "http://vizZzion.org")