1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-09 23:34:17 +01:00

Merged reyammer's branch lp:~reyammer/wicd/bug-476982: implement password hiding (LP: #476982)

This commit is contained in:
David Paleino
2011-09-15 12:50:21 +02:00
parent a526c2108d
commit bdb64eab1c
17 changed files with 72 additions and 6 deletions

View File

@@ -176,3 +176,43 @@ class GreyLabel(gtk.Label):
def set_label(self, text):
self.set_markup(text)
self.set_alignment(0, 0)
class ProtectedLabelEntry(gtk.HBox):
""" A LabelEntry with a CheckButton that protects the entry text. """
def __init__(self, label_text):
gtk.HBox.__init__(self)
self.entry = gtk.Entry()
self.entry.set_size_request(200, -1)
self.entry.set_visibility(False)
self.label = LeftAlignedLabel()
self.label.set_text(label_text)
self.label.set_size_request(165, -1)
self.check = gtk.CheckButton()
self.check.set_size_request(5, -1)
self.check.set_active(False)
self.check.set_focus_on_click(False)
self.pack_start(self.label, fill=True, expand=True)
self.pack_start(self.check, fill=True, expand=True)
self.pack_start(self.entry, fill=False, expand=False)
self.label.show()
self.check.show()
self.entry.show()
self.check.connect('clicked', self.click_handler)
self.show()
def set_entry_text(self, text):
# For compatibility...
self.entry.set_text(text)
def get_entry_text(self):
return self.entry.get_text()
def set_sensitive(self, value):
self.entry.set_sensitive(value)
self.label.set_sensitive(value)
self.check.set_sensitive(value)
def click_handler(self, widget=None, event=None):
active = self.check.get_active()
self.entry.set_visibility(active)

View File

@@ -30,7 +30,7 @@ import wicd.misc as misc
import wicd.wpath as wpath
import wicd.dbusmanager as dbusmanager
from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool
from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input
from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input, ProtectedLabelEntry
from wicd.translations import language
@@ -358,7 +358,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
self.chkbox_encryption.set_active(False)
self.combo_encryption.set_sensitive(False)
self.encrypt_types = misc.LoadEncryptionMethods()
information_button = gtk.Button(stock=gtk.STOCK_INFO)
self.button_hbox.pack_start(information_button, False, False)
information_button.connect('clicked', lambda *a, **k: WirelessInformationDialog(networkID, self))
@@ -532,10 +532,15 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
fields = methods[ID][type_]
for field in fields:
if language.has_key(field[1]):
box = LabelEntry(language[field[1].lower().replace(' ','_')])
field_text = language[field[1].lower().replace(' ','_')]
else:
box = LabelEntry(field[1].replace('_',' '))
box.set_auto_hidden(True)
field_text = field[1].replace('_',' ')
if field in methods[ID]['protected']:
box = ProtectedLabelEntry(field_text)
else:
box = LabelEntry(field_text)
self.vbox_encrypt_info.pack_start(box)
# Add the data to a dict, so that the information
# can be easily accessed by giving the name of the wanted