Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
This commit is contained in:
commit
1845435e8c
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import gobject, gtk
|
import gobject, gtk
|
||||||
import logging
|
|
||||||
|
|
||||||
IW_AUTH_ALG_OPEN_SYSTEM = 0x00000001
|
IW_AUTH_ALG_OPEN_SYSTEM = 0x00000001
|
||||||
IW_AUTH_ALG_SHARED_KEY = 0x00000002
|
IW_AUTH_ALG_SHARED_KEY = 0x00000002
|
||||||
@ -193,11 +192,9 @@ class WPAKeyDialog(KeyDialog):
|
|||||||
wpa_ver = IW_AUTH_WPA_VERSION_WPA
|
wpa_ver = IW_AUTH_WPA_VERSION_WPA
|
||||||
caps = self.get_network().get_caps()
|
caps = self.get_network().get_caps()
|
||||||
if caps & NM_802_11_CAP_PROTO_WPA2:
|
if caps & NM_802_11_CAP_PROTO_WPA2:
|
||||||
logging.debug("Caps WPA2")
|
|
||||||
wpa_ver = IW_AUTH_WPA_VERSION_WPA2
|
wpa_ver = IW_AUTH_WPA_VERSION_WPA2
|
||||||
|
|
||||||
from nminfo import Security
|
from nminfo import Security
|
||||||
logging.debug("new security with caps 0x%X, wpa %d" % (caps, wpa_ver))
|
|
||||||
return Security.new_from_args(we_cipher, (real_key, wpa_ver, IW_AUTH_KEY_MGMT_PSK))
|
return Security.new_from_args(we_cipher, (real_key, wpa_ver, IW_AUTH_KEY_MGMT_PSK))
|
||||||
|
|
||||||
def _update_response_sensitivity(self, ignored=None):
|
def _update_response_sensitivity(self, ignored=None):
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
# vi: ts=4 ai noet
|
|
||||||
#
|
|
||||||
# Copyright (C) 2006-2007 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
import gtk
|
|
||||||
|
|
||||||
IW_AUTH_ALG_OPEN_SYSTEM = 0x00000001
|
|
||||||
IW_AUTH_ALG_SHARED_KEY = 0x00000002
|
|
||||||
|
|
||||||
class WEPKeyDialog(gtk.Dialog):
|
|
||||||
def __init__(self, net, async_cb, async_err_cb):
|
|
||||||
gtk.Dialog.__init__(self, flags=gtk.DIALOG_MODAL)
|
|
||||||
self.set_title("Wireless Key Required")
|
|
||||||
|
|
||||||
self._net = net
|
|
||||||
self._async_cb = async_cb
|
|
||||||
self._async_err_cb = async_err_cb
|
|
||||||
|
|
||||||
self.set_has_separator(False)
|
|
||||||
|
|
||||||
label = gtk.Label("A wireless encryption key is required for\n" \
|
|
||||||
" the wireless network '%s'." % net.get_ssid())
|
|
||||||
self.vbox.pack_start(label)
|
|
||||||
|
|
||||||
self._entry = gtk.Entry()
|
|
||||||
self._entry.props.visibility = False
|
|
||||||
self._entry.connect('changed', self._entry_changed_cb)
|
|
||||||
self.vbox.pack_start(self._entry)
|
|
||||||
self.vbox.show_all()
|
|
||||||
|
|
||||||
self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
|
||||||
gtk.STOCK_OK, gtk.RESPONSE_OK)
|
|
||||||
|
|
||||||
self.set_default_response(gtk.RESPONSE_OK)
|
|
||||||
self._update_response_sensitivity()
|
|
||||||
|
|
||||||
self._entry.grab_focus()
|
|
||||||
|
|
||||||
def get_key(self):
|
|
||||||
return self._entry.get_text()
|
|
||||||
|
|
||||||
def get_auth_alg(self):
|
|
||||||
return IW_AUTH_ALG_OPEN_SYSTEM
|
|
||||||
|
|
||||||
def get_network(self):
|
|
||||||
return self._net
|
|
||||||
|
|
||||||
def get_callbacks(self):
|
|
||||||
return (self._async_cb, self._async_err_cb)
|
|
||||||
|
|
||||||
def _entry_changed_cb(self, entry):
|
|
||||||
self._update_response_sensitivity()
|
|
||||||
|
|
||||||
def _update_response_sensitivity(self):
|
|
||||||
key = self.get_key()
|
|
||||||
|
|
||||||
is_hex = True
|
|
||||||
for c in key:
|
|
||||||
if not 'a' <= c <= 'f' and not '0' <= c <= '9':
|
|
||||||
is_hex = False
|
|
||||||
|
|
||||||
valid_len = (len(key) == 10 or len(key) == 26)
|
|
||||||
self.set_response_sensitive(gtk.RESPONSE_OK, is_hex and valid_len)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
dialog = WEPKeyDialog()
|
|
||||||
dialog.run()
|
|
||||||
|
|
||||||
print dialog.get_key()
|
|
@ -16,7 +16,7 @@
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import gtk
|
#import gtk
|
||||||
import gobject
|
import gobject
|
||||||
import hippo
|
import hippo
|
||||||
|
|
||||||
@ -32,20 +32,21 @@ class BuddyMenu(Palette):
|
|||||||
|
|
||||||
Palette.__init__(self, buddy.get_nick())
|
Palette.__init__(self, buddy.get_nick())
|
||||||
|
|
||||||
pixbuf = None
|
# FIXME: re-enable when buddy avatars are re-enabled
|
||||||
try:
|
# pixbuf = None
|
||||||
pixbuf = self._get_buddy_icon_pixbuf()
|
# try:
|
||||||
except gobject.GError, e:
|
# pixbuf = self._get_buddy_icon_pixbuf()
|
||||||
pass
|
# except gobject.GError, e:
|
||||||
if pixbuf:
|
# pass
|
||||||
scaled_pixbuf = pixbuf.scale_simple(units.grid_to_pixels(1),
|
# if pixbuf:
|
||||||
units.grid_to_pixels(1),
|
# scaled_pixbuf = pixbuf.scale_simple(units.grid_to_pixels(1),
|
||||||
gtk.gdk.INTERP_BILINEAR)
|
# units.grid_to_pixels(1),
|
||||||
del pixbuf
|
# gtk.gdk.INTERP_BILINEAR)
|
||||||
image = gtk.Image()
|
# del pixbuf
|
||||||
image.set_from_pixbuf(scaled_pixbuf)
|
# image = gtk.Image()
|
||||||
self.set_content(image)
|
# image.set_from_pixbuf(scaled_pixbuf)
|
||||||
image.show()
|
# self.set_content(image)
|
||||||
|
# image.show()
|
||||||
|
|
||||||
self._buddy.connect('icon-changed', self._buddy_icon_changed_cb)
|
self._buddy.connect('icon-changed', self._buddy_icon_changed_cb)
|
||||||
self._buddy.connect('nick-changed', self._buddy_nick_changed_cb)
|
self._buddy.connect('nick-changed', self._buddy_nick_changed_cb)
|
||||||
@ -54,24 +55,25 @@ class BuddyMenu(Palette):
|
|||||||
if buddy.get_nick() != owner.get_nick():
|
if buddy.get_nick() != owner.get_nick():
|
||||||
self._add_items()
|
self._add_items()
|
||||||
|
|
||||||
def _get_buddy_icon_pixbuf(self):
|
# FIXME: re-enable when buddy avatars are re-enabled
|
||||||
buddy_object = self._buddy.get_buddy()
|
# def _get_buddy_icon_pixbuf(self):
|
||||||
if not buddy_object:
|
# buddy_object = self._buddy.get_buddy()
|
||||||
return None
|
# if not buddy_object:
|
||||||
|
# return None
|
||||||
icon_data = buddy_object.props.icon
|
#
|
||||||
if not icon_data:
|
# icon_data = buddy_object.props.icon
|
||||||
return None
|
# if not icon_data:
|
||||||
pbl = gtk.gdk.PixbufLoader()
|
# return None
|
||||||
pbl.write(icon_data)
|
# pbl = gtk.gdk.PixbufLoader()
|
||||||
pixbuf = None
|
# pbl.write(icon_data)
|
||||||
try:
|
# pixbuf = None
|
||||||
pbl.close()
|
# try:
|
||||||
pixbuf = pbl.get_pixbuf()
|
# pbl.close()
|
||||||
except gobject.GError:
|
# pixbuf = pbl.get_pixbuf()
|
||||||
pass
|
# except gobject.GError:
|
||||||
del pbl
|
# pass
|
||||||
return pixbuf
|
# del pbl
|
||||||
|
# return pixbuf
|
||||||
|
|
||||||
def _add_items(self):
|
def _add_items(self):
|
||||||
shell_model = self._shell.get_model()
|
shell_model = self._shell.get_model()
|
||||||
|
Loading…
Reference in New Issue
Block a user