summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2024-09-30 12:34:20 +0800
committerPeng Wu <alexepico@gmail.com>2024-09-30 12:34:20 +0800
commitb6369a4d065ca0bbc209f5bcd0c8f7a28bbac1ef (patch)
tree0c9189fd53af0f9093170e2d97d2d2eca1ace860
parent3481c58faa1268cb32c7c6847fcf861575f03171 (diff)
Update src/libpinyin.ver
-rw-r--r--src/libpinyin.ver1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libpinyin.ver b/src/libpinyin.ver
index 12b8908..964d96e 100644
--- a/src/libpinyin.ver
+++ b/src/libpinyin.ver
@@ -25,6 +25,7 @@ LIBPINYIN {
pinyin_guess_sentence;
pinyin_guess_sentence_with_prefix;
pinyin_guess_predicted_candidates;
+ pinyin_guess_predicted_candidates_with_punctuations;
pinyin_phrase_segment;
pinyin_get_sentence;
pinyin_parse_full_pinyin;
1'>131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
#
# account_gui.py: gui root password and user creation dialog
#
# Copyright 2000-2007 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import gtk
import gobject
import re
import string
import gui
from iw_gui import *
from rhpl.translate import _, N_
from flags import flags

def handleCapsLockRelease(window, event, label):
    if event.keyval == gtk.keysyms.Caps_Lock and event.state & gtk.gdk.LOCK_MASK:
        if label.get_text() == "":
            label.set_text(_("<b>Caps Lock is on.</b>"))
            label.set_use_markup(True)
        else:
            label.set_text("")

class AccountWindow (InstallWindow):

    windowTitle = N_("Set Root Password")

    def getNext (self):
        def passwordError():
            self.pw.set_text("")
            self.confirm.set_text("")
            self.pw.grab_focus()            
            raise gui.StayOnScreen
            
	if not self.__dict__.has_key("pw"): return None

        pw = self.pw.get_text()
        confirm = self.confirm.get_text()

        if not pw or not confirm:
            self.intf.messageWindow(_("Error with Password"),
                                    _("You must enter your root password "
                                      "and confirm it by typing it a second "
                                      "time to continue."),
                                    custom_icon="error")
            passwordError()

        if pw != confirm:
            self.intf.messageWindow(_("Error with Password"),
                                    _("The passwords you entered were "
                                      "different.  Please try again."),
                                    custom_icon="error")
            passwordError()

        if len(pw) < 6:
            self.intf.messageWindow(_("Error with Password"),
                                    _("The root password must be at least "
                                      "six characters long."),
                                    custom_icon="error")
            passwordError()
        
        allowed = string.digits + string.ascii_letters + string.punctuation + " "
        for letter in pw:
            if letter not in allowed:
                self.intf.messageWindow(_("Error with Password"),
                                        _("Requested password contains "
                                          "non-ASCII characters, which are "
                                          "not allowed."),
                                        custom_icon="error")
                passwordError()

        self.rootPassword["password"] = self.pw.get_text()
        self.rootPassword["isCrypted"] = False
        return None

    def setFocus (self, area, data):
        self.pw.grab_focus ()

    # AccountWindow tag="accts"
    def getScreen (self, anaconda):
	self.rootPassword = anaconda.id.rootPassword
        self.intf = anaconda.intf

        self.capsLabel = gtk.Label()
        self.capsLabel.set_alignment(0.0, 0.5)

        self.intf.icw.window.connect("key-release-event",
                                     lambda w, e: handleCapsLockRelease(w, e, self.capsLabel))

	self.passwords = {}

        box = gtk.VBox ()
        box.set_border_width(5)

        hbox = gtk.HBox()
        pix = gui.readImageFromFile ("root-password.png")
        if pix:
            hbox.pack_start (pix, False)

        label = gui.WrappingLabel (_("The root account is used for "
                                     "administering the system.  Enter "
                                     "a password for the root user."))
        label.set_line_wrap(True)
        label.set_size_request(350, -1)
        label.set_alignment(0.0, 0.5)
        hbox.pack_start(label, False)

        box.pack_start(hbox, False)
       
        table = gtk.Table (3, 2)
        table.set_size_request(365, -1)
        table.set_row_spacings (5)
	table.set_col_spacings (5)

        pass1 = gui.MnemonicLabel (_("Root _Password: "))
        pass1.set_alignment (0.0, 0.5)
        table.attach (pass1, 0, 1, 0, 1, gtk.FILL, 0, 10)