diff -up system-config-rootpassword-1.99.6/src/passwordDialog.py.python3 system-config-rootpassword-1.99.6/src/passwordDialog.py
--- system-config-rootpassword-1.99.6/src/passwordDialog.py.python3 2009-09-14 13:16:11.000000000 +0200
+++ system-config-rootpassword-1.99.6/src/passwordDialog.py 2019-11-19 13:18:47.765718065 +0100
@@ -23,10 +23,12 @@
#
import string
-import gtk
-import gobject
+import gi
+gi.require_version('Gtk', '3.0')
+gi.require_version('Gdk', '3.0')
+from gi.repository import Gtk,Gdk
import libuser
-import cracklib
+import pwquality
import sys
sys.path.append('/usr/share/system-config-rootpassword')
@@ -34,99 +36,99 @@ sys.path.append('/usr/share/system-confi
## I18N
##
import gettext
-_ = lambda x: gettext.ldgettext("system-config-rootpassword", x)
-N_ = lambda x: x
+t = gettext.translation("system-config-rootpassword", fallback=True)
+_ = t.gettext
##
## Icon for windows
##
iconPixbuf = None
-try:
- iconPixbuf = gtk.gdk.pixbuf_new_from_file("/usr/share/system-config-rootpassword/pixmaps/system-config-rootpassword.png")
-except:
- pass
+img = Gtk.Image()
+img.set_from_file("/usr/share/system-config-rootpassword/pixmaps/system-config-rootpassword.png")
+iconPixbuf = img.get_pixbuf()
class childWindow:
#You must specify a runPriority for the order in which you wish your module to run
runPriority = 40
- moduleName = _("Root Password")
+ moduleName = str(_("Root Password"))
moduleClass = "reconfig"
commentTag = _("Change the root password for the system")
def destroy(self, args):
- gtk.main_quit()
+ Gtk.main_quit()
def __init__(self, user=None):
self.admin = libuser.ADMIN()
self.user = user
self.doDebug = None
- self.mainWindow = gtk.Window()
+ self.mainWindow = Gtk.Window()
self.mainWindow.connect("destroy", self.destroy)
- self.mainWindow.set_position(gtk.WIN_POS_CENTER)
+ self.mainWindow.set_position(Gtk.WindowPosition.CENTER)
self.mainWindow.set_icon(iconPixbuf)
self.mainWindow.set_border_width(10)
self.mainWindow.set_resizable(False)
- self.toplevel = gtk.VBox(False)
- self.mainVBox = gtk.VBox(False)
- self.iconBox = gtk.HBox()
- self.passwordEntry = gtk.Entry()
+ self.toplevel = Gtk.VBox(False)
+ self.mainVBox = Gtk.VBox(False)
+ self.iconBox = Gtk.HBox()
+ self.passwordEntry = Gtk.Entry()
self.passwordEntry.set_visibility(False)
- self.confirmEntry = gtk.Entry()
+ self.confirmEntry = Gtk.Entry()
self.confirmEntry.set_visibility(False)
- self.okButton = gtk.Button('_Change root password')
- self.cancelButton = gtk.Button(stock='gtk-cancel')
- self.securityBar = gtk.ProgressBar(adjustment=None)
- self.securityTooltips = gtk.Tooltips()
+ self.okButton = Gtk.Button(_('OK'))
+ self.cancelButton = Gtk.Button(_('Cancel'))
+ self.securityBar = Gtk.ProgressBar()
+ self.securityBar.set_show_text(True)
p = None
self.icon = None
- try:
- p = gtk.gdk.pixbuf_new_from_file("../pixmaps/system-config-rootpassword.png")
- except:
- try:
- p = gtk.gdk.pixbuf_new_from_file("/usr/share/system-config-rootpassword/pixmaps/system-config-rootpassword.png")
- except:
- print "no image found"
- pass
-
- if p:
- self.icon = gtk.Image()
+ img = Gtk.Image()
+ img.set_from_file("../pixmaps/system-config-rootpassword.png")
+ p = img.get_pixbuf()
+ if p == None:
+ img.set_from_file("/usr/share/system-config-rootpassword/pixmaps/system-config-rootpassword.png")
+ p=img.get_pixbuf()
+ if p == None:
+ print("no image found")
+ else:
+ self.icon = Gtk.Image()
self.icon.set_from_pixbuf(p)
- self.title = gtk.Label(_("Root Password"))
- self.title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse ("white"))
+ self.title = Gtk.Label(_("Root Password"))
+ color = Gdk.RGBA()
+ color.parse("white")
+ self.title.override_color(Gtk.StateType.NORMAL,color)
if self.user == None:
#If no user was passed in, assume that we're chaning the root password
- self.msgLabel = gtk.Label(_("You can change the root password by filling \nthe following fields:"))
+ self.msgLabel = Gtk.Label(_("You can change the root password by filling \nthe following fields:"))
self.user = "root"
else:
- self.msgLabel = gtk.Label(_("Please set the password for %s.") % self.user)
+ self.msgLabel = Gtk.Label(_("Please set the password for %s.") % self.user)
self.msgLabel.set_line_wrap(False)
self.msgLabel.set_alignment(0.0, 0.5)
- self.table = gtk.Table(2, 2)
- label = gtk.Label(_("New Root Password:"))
+ self.table = Gtk.Table(2, 2)
+ label = Gtk.Label(_("New Root Password:"))
label.set_alignment(0.0, 0.5)
- self.table.attach(label, 0, 1, 0, 1, gtk.FILL)
- self.table.attach(self.passwordEntry, 1, 2, 0, 1, gtk.SHRINK, gtk.FILL, 5, 5)
- label = gtk.Label(_("Confirm Root Password:"))
+ self.table.attach(label, 0, 1, 0, 1)
+ self.table.attach(self.passwordEntry, 1, 2, 0, 1)
+ label = Gtk.Label(_("Confirm Root Password:"))
label.set_alignment(0.0, 0.5)
- self.table.attach(label, 0, 1, 1, 2, gtk.FILL)
- self.table.attach(self.confirmEntry, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5, 5)
+ self.table.attach(label, 0, 1, 1, 2)
+ self.table.attach(self.confirmEntry, 1, 2, 1, 2)
def okClicked(self, *args):
result = self.apply()
if result == 0:
- gtk.main_quit()
+ Gtk.main_quit()
def apply(self, *args):
passwd1 = self.passwordEntry.get_text()
passwd2 = self.confirmEntry.get_text()
if self.doDebug:
- print "don't change root password in debug mode"
+ print("don't change root password in debug mode")
return 0
#if (len(passwd1) < 6) or (len(passwd2) < 6):
@@ -136,12 +138,12 @@ class childWindow:
# self.grabFocus()
# return None
- elif passwd1 != passwd2:
- self.msgLabel.set_text("The two fields did not match. Please try \nagain:")
- self.passwordEntry.set_text("")
- self.confirmEntry.set_text("")
- self.grabFocus()
- return None
+ elif passwd1 != passwd2:
+ self.msgLabel.set_text("The two fields did not match. Please try \nagain:")
+ self.passwordEntry.set_text("")
+ self.confirmEntry.set_text("")
+ self.grabFocus()
+ return None
if self.doDebug:
@@ -152,7 +154,7 @@ class childWindow:
return 0
def setKickstartData(self, kickstartData):
- print "in setKickstartData"
+ print("in setKickstartData")
#Get the lang from the list of languages
return 0
@@ -163,7 +165,7 @@ class childWindow:
def launch(self, doDebug = None):
self.doDebug = doDebug
- self.internalVBox = gtk.VBox(False, 10)
+ self.internalVBox = Gtk.VBox(False, 10)
self.internalVBox.set_border_width(10)
self.msgLabel.set_size_request(500, -1)
@@ -185,17 +187,19 @@ class childWindow:
test = ((length_password/16.0)<= 1.0) and (length_password/16.0) or 1.0
strength = None
try:
- cracklib.FascistCheck(self.passwordEntry.get_text())
- except ValueError as e:
- strength = e.message
+ settings = pwquality.PWQSettings()
+ settings.read_config()
+ settings.check(self.passwordEntry.get_text())
+ except pwquality.PWQError as e:
+ strength = e.args[1]
if (strength == None):
self.securityBar.set_text("Security Level: Strong")
if (test < 0.8):
test = 0.8
self.securityBar.set_fraction(test)
- self.securityTooltips.set_tip(self.passwordEntry, "Good")
+ self.passwordEntry.set_tooltip_text("Good")
else :
- self.securityTooltips.set_tip(self.passwordEntry, strength)
+ self.passwordEntry.set_tooltip_text(str(strength))
if (0.5 >= test ):
self.securityBar.set_text("Security Level: Weak")
self.securityBar.set_fraction(test)
@@ -215,28 +219,28 @@ class childWindow:
def stand_alone(self):
self.mainWindow.set_title(_("Root Password"))
- bb = gtk.HButtonBox()
- bb.set_layout(gtk.BUTTONBOX_END)
+ bb = Gtk.HButtonBox()
+ bb.set_layout(Gtk.ButtonBoxStyle.END)
bb.set_spacing(5)
self.passwordEntry.connect("changed", self.activation)
self.confirmEntry.connect("changed", self.activation)
self.okButton.set_sensitive(False)
self.okButton.connect("clicked", self.okClicked)
self.cancelButton.connect("clicked", self.destroy)
- self.securityTooltips.set_tip(self.passwordEntry, "Remember that your password should have at least 6 characters in length")
+ self.passwordEntry.set_tooltip_text("Remember that your password should have at least 6 characters in length")
self.securityBar.set_fraction(0.0)
if self.icon:
- self.iconBox.pack_start(self.icon, False)
- self.iconBox.pack_start(self.msgLabel, False)
+ self.iconBox.pack_start(self.icon, False,0,0)
+ self.iconBox.pack_start(self.msgLabel, False,0,0)
self.mainWindow.add(self.toplevel)
self.mainVBox.set_spacing(5)
- self.toplevel.pack_start(self.iconBox, False)
- self.toplevel.pack_start(self.mainVBox, False)
- self.mainVBox.pack_start(self.table, False)
- self.mainVBox.pack_start(self.securityBar)
- bb.pack_start(self.cancelButton)
- bb.pack_start(self.okButton)
- self.mainVBox.pack_start(bb, False)
+ self.toplevel.pack_start(self.iconBox, False,0,0)
+ self.toplevel.pack_start(self.mainVBox, False,0,0)
+ self.mainVBox.pack_start(self.table, False,0,0)
+ self.mainVBox.pack_start(self.securityBar,True,0,0)
+ bb.pack_start(self.cancelButton,True,0,0)
+ bb.pack_start(self.okButton,True,0,0)
+ self.mainVBox.pack_start(bb, False,0,0)
self.mainWindow.show_all()
self.passwordEntry.grab_focus()
- gtk.main()
+ Gtk.main()
diff -up system-config-rootpassword-1.99.6/src/rootpassword_tui.py.python3 system-config-rootpassword-1.99.6/src/rootpassword_tui.py
--- system-config-rootpassword-1.99.6/src/rootpassword_tui.py.python3 2009-09-14 13:16:11.000000000 +0200
+++ system-config-rootpassword-1.99.6/src/rootpassword_tui.py 2019-11-19 13:18:56.744552866 +0100
@@ -16,7 +16,8 @@
import libuser
from snack import *
import gettext
-_ = lambda x: gettext.ldgettext("system-config-rootpassword", x)
+t = gettext.translation("system-config-rootpassword", fallback=True)
+_ = t.gettext
class RootPasswordWindow:
@@ -45,7 +46,7 @@ class RootPasswordWindow:
self.passgrid.setField (self.pwconfirm, 1, 1)
self.toplevel.add (self.passgrid, 0, 1, (0, 0, 0, 1))
- self.bb = ButtonBar (screen, [_("OK"),_("Cancel")])
+ self.bb = ButtonBar (screen, ((_("OK"),"ok"),(_("Cancel"), "cancel")))
self.toplevel.add (self.bb, 0, 2, growx = 1)
def run(self):
diff -up system-config-rootpassword-1.99.6/src/system-config-rootpassword.py.python3 system-config-rootpassword-1.99.6/src/system-config-rootpassword.py
--- system-config-rootpassword-1.99.6/src/system-config-rootpassword.py.python3 2009-09-14 13:16:11.000000000 +0200
+++ system-config-rootpassword-1.99.6/src/system-config-rootpassword.py 2019-11-19 13:19:28.579967156 +0100
@@ -31,15 +31,14 @@ if __name__ == "__main__":
## I18N
##
import gettext
-_ = lambda x: gettext.ldgettext("system-config-rootpassword", x)
-N_ = lambda x: x
+t = gettext.translation("system-config-rootpassword", fallback=True)
+_ = t.gettext
def useTextMode():
import rootpassword_tui
app = rootpassword_tui.childWindow()
def useGuiMode():
- import gtk
import passwordDialog
app = passwordDialog.childWindow()
app.stand_alone()
@@ -62,7 +61,7 @@ else:
try:
useGuiMode()
except:
- print _("Starting graphical mode failed. Starting text mode instead.")
+ print(_("Starting graphical mode failed. Starting text mode instead."))
import time
time.sleep(2)
useTextMode()
diff -up system-config-rootpassword-1.99.6/src/system-config-rootpassword.python3 system-config-rootpassword-1.99.6/src/system-config-rootpassword
--- system-config-rootpassword-1.99.6/src/system-config-rootpassword.python3 2007-11-21 12:00:42.000000000 +0100
+++ system-config-rootpassword-1.99.6/src/system-config-rootpassword 2019-11-19 13:08:27.545129150 +0100
@@ -1,4 +1,4 @@
#!/bin/sh
export PYTHONPATH=/usr/share/system-config-rootpassword
-/usr/bin/python2 /usr/share/system-config-rootpassword/system-config-rootpassword.py $*
+/usr/bin/python3 /usr/share/system-config-rootpassword/system-config-rootpassword.py $*