mirror of
https://github.com/gryf/wicd.git
synced 2026-01-05 21:34:16 +01:00
experimental branch:
- Port a bunch of fixes from the trunk - Use an actual Gtk.Menu in the toolbar for the "Network" widget
This commit is contained in:
243
data/wicd.glade
243
data/wicd.glade
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||||
<!--Generated with glade3 3.4.5 on Mon Oct 6 22:39:07 2008 -->
|
<!--Generated with glade3 3.4.5 on Sun Oct 12 01:15:35 2008 -->
|
||||||
<glade-interface>
|
<glade-interface>
|
||||||
<widget class="GtkWindow" id="window1">
|
<widget class="GtkWindow" id="window1">
|
||||||
<property name="width_request">450</property>
|
<property name="width_request">450</property>
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
<property name="title" translatable="yes">Wicd Manager</property>
|
<property name="title" translatable="yes">Wicd Manager</property>
|
||||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||||
<property name="default_width">550</property>
|
<property name="default_width">550</property>
|
||||||
<property name="icon">wicd.png</property>
|
|
||||||
<property name="gravity">GDK_GRAVITY_CENTER</property>
|
<property name="gravity">GDK_GRAVITY_CENTER</property>
|
||||||
<signal name="destroy" handler="exit"/>
|
<signal name="destroy" handler="exit"/>
|
||||||
<signal name="delete_event" handler="exit"/>
|
<signal name="delete_event" handler="exit"/>
|
||||||
@@ -23,12 +22,131 @@
|
|||||||
<property name="icon_size">GTK_ICON_SIZE_MENU</property>
|
<property name="icon_size">GTK_ICON_SIZE_MENU</property>
|
||||||
<property name="icon_size_set">True</property>
|
<property name="icon_size_set">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkMenuToolButton" id="network_menu">
|
<widget class="GtkToolItem" id="menubar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="is_important">True</property>
|
<property name="is_important">True</property>
|
||||||
<property name="stock_id">gtk-network</property>
|
<child>
|
||||||
<property name="menu">menu1</property>
|
<widget class="GtkMenuBar" id="menubar1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="network_menu">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">gtk-network</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenu" id="menu1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="attach_widget">network_menu</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="create_adhoc_network_button">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">Create Ad-Hoc Network</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="create_adhoc_network_button_button"/>
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="menu-item-image2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-add</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="iface_menu_button">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Enable/Disable Interfaces</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenu" id="iface_menu">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="iface_menu_enable_wired">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Enable Wired Interface</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_iface_menu_enable_wired"/>
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="menu-item-image5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="iface_menu_enable_wireless">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Enable Wireless Interface</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_iface_menu_enable_wireless"/>
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="menu-item-image6">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="iface_menu_disable_wired">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Disable Wired Interface</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_iface_menu_disable_wired"/>
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="menu-item-image7">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-stop</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="iface_menu_disable_wireless">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Disable Wireless Interface</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_iface_menu_disable_wireless"/>
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="menu-item-image8">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-stop</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="connect_button">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">Hidden Network</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="connect_clicked"/>
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="menu-item-image1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="icon_name">network-wireless</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -36,6 +154,8 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="is_important">True</property>
|
<property name="is_important">True</property>
|
||||||
|
<property name="label" translatable="yes">_Disconnect All</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
<property name="stock_id">gtk-disconnect</property>
|
<property name="stock_id">gtk-disconnect</property>
|
||||||
<signal name="clicked" handler="disconnect_clicked"/>
|
<signal name="clicked" handler="disconnect_clicked"/>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -47,6 +167,8 @@
|
|||||||
<widget class="GtkToolButton" id="refresh_button">
|
<widget class="GtkToolButton" id="refresh_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="is_important">True</property>
|
<property name="is_important">True</property>
|
||||||
|
<property name="label" translatable="yes">_Refresh</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
<property name="stock_id">gtk-refresh</property>
|
<property name="stock_id">gtk-refresh</property>
|
||||||
<signal name="clicked" handler="refresh_clicked"/>
|
<signal name="clicked" handler="refresh_clicked"/>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -58,6 +180,8 @@
|
|||||||
<widget class="GtkToolButton" id="preferences_button">
|
<widget class="GtkToolButton" id="preferences_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="is_important">True</property>
|
<property name="is_important">True</property>
|
||||||
|
<property name="label" translatable="yes">_Preferences</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
<property name="stock_id">gtk-preferences</property>
|
<property name="stock_id">gtk-preferences</property>
|
||||||
<signal name="clicked" handler="preferences_clicked"/>
|
<signal name="clicked" handler="preferences_clicked"/>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -69,6 +193,8 @@
|
|||||||
<widget class="GtkToolButton" id="about_button">
|
<widget class="GtkToolButton" id="about_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="is_important">True</property>
|
<property name="is_important">True</property>
|
||||||
|
<property name="label" translatable="yes">_About</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
<property name="stock_id">gtk-about</property>
|
<property name="stock_id">gtk-about</property>
|
||||||
<signal name="clicked" handler="about_clicked"/>
|
<signal name="clicked" handler="about_clicked"/>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -81,6 +207,8 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK</property>
|
<property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK</property>
|
||||||
<property name="is_important">True</property>
|
<property name="is_important">True</property>
|
||||||
|
<property name="label" translatable="yes">_Quit</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
<property name="stock_id">gtk-quit</property>
|
<property name="stock_id">gtk-quit</property>
|
||||||
<signal name="clicked" handler="quit_clicked"/>
|
<signal name="clicked" handler="quit_clicked"/>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -179,111 +307,6 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="GtkMenu" id="menu1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="connect_button">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Hidden Network</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="connect_clicked"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="icon_name">network-wireless</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="create_adhoc_network_button">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Create Ad-Hoc Network</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="create_adhoc_network_button_button"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-add</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="iface_menu_button">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Enable/Disable Interfaces</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenu" id="iface_menu">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="iface_menu_enable_wired">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Enable Wired Interface</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_iface_menu_enable_wired"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image6">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-yes</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="iface_menu_enable_wireless">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Enable Wireless Interface</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_iface_menu_enable_wireless"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image5">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-yes</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="iface_menu_disable_wired">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Disable Wired Interface</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_iface_menu_disable_wired"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image7">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-stop</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="iface_menu_disable_wireless">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Disable Wireless Interface</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_iface_menu_disable_wireless"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image8">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-stop</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<widget class="GtkDialog" id="configure_script_dialog">
|
<widget class="GtkDialog" id="configure_script_dialog">
|
||||||
<property name="width_request">416</property>
|
<property name="width_request">416</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ import wicd.misc as misc
|
|||||||
import wicd.wnettools as wnettools
|
import wicd.wnettools as wnettools
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ more stable for some set ups.
|
|||||||
|
|
||||||
# Compile the regex patterns that will be used to search the output of iwlist
|
# Compile the regex patterns that will be used to search the output of iwlist
|
||||||
# scan for info these are well tested, should work on most cards
|
# scan for info these are well tested, should work on most cards
|
||||||
essid_pattern = re.compile('.*ESSID:"(.*?)"\n', re.I | re.M | re.S)
|
essid_pattern = re.compile('.*ESSID:(.*?)\n', re.I | re.M | re.S)
|
||||||
ap_mac_pattern = re.compile('.*Address: (.*?)\n', re.I | re.M | re.S)
|
ap_mac_pattern = re.compile('.*Address: (.*?)\n', re.I | re.M | re.S)
|
||||||
channel_pattern = re.compile('.*Channel:? ?(\d\d?)', re.I | re.M | re.S)
|
channel_pattern = re.compile('.*Channel:? ?(\d\d?)', re.I | re.M | re.S)
|
||||||
strength_pattern = re.compile('.*Quality:?=? ?(\d+)\s*/?\s*(\d*)', re.I | re.M | re.S)
|
strength_pattern = re.compile('.*Quality:?=? ?(\d+)\s*/?\s*(\d*)', re.I | re.M | re.S)
|
||||||
@@ -131,11 +133,23 @@ class Interface(wnettools.BaseInterface):
|
|||||||
|
|
||||||
def IsUp(self, ifconfig=None):
|
def IsUp(self, ifconfig=None):
|
||||||
""" Determines if the interface is up.
|
""" Determines if the interface is up.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if the interface is up, False otherwise.
|
True if the interface is up, False otherwise.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if not self.iface: return False
|
||||||
|
flags_file = '/sys/class/net/%s/flags' % self.iface
|
||||||
|
try:
|
||||||
|
flags = open(flags_file, "r").read().strip()
|
||||||
|
except IOError:
|
||||||
|
print "Could not open %s, using ifconfig to determine status" % flags_file
|
||||||
|
return self._slow_is_up(ifconfig)
|
||||||
|
return bool(int(flags, 16) & 1)
|
||||||
|
|
||||||
|
|
||||||
|
def _slow_is_up(self, ifconfig=None):
|
||||||
|
""" Determine if an interface is up using ifconfig. """
|
||||||
if not ifconfig:
|
if not ifconfig:
|
||||||
cmd = "ifconfig " + self.iface
|
cmd = "ifconfig " + self.iface
|
||||||
if self.verbose: print cmd
|
if self.verbose: print cmd
|
||||||
@@ -145,11 +159,9 @@ class Interface(wnettools.BaseInterface):
|
|||||||
lines = output.split('\n')
|
lines = output.split('\n')
|
||||||
if len(lines) < 5:
|
if len(lines) < 5:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
for line in lines[1:4]:
|
for line in lines[1:4]:
|
||||||
if line.strip().startswith('UP'):
|
if line.strip().startswith('UP'):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@@ -168,24 +180,49 @@ class WiredInterface(Interface, wnettools.BaseWiredInterface):
|
|||||||
|
|
||||||
def GetPluggedIn(self):
|
def GetPluggedIn(self):
|
||||||
""" Get the current physical connection state.
|
""" Get the current physical connection state.
|
||||||
|
|
||||||
The method will first attempt to use ethtool do determine
|
The method will first attempt to use ethtool do determine
|
||||||
physical connection state. Should ethtool fail to run properly,
|
physical connection state. Should ethtool fail to run properly,
|
||||||
mii-tool will be used instead.
|
mii-tool will be used instead.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if a link is detected, False otherwise.
|
True if a link is detected, False otherwise.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not self.iface:
|
if not self.iface:
|
||||||
return False
|
return False
|
||||||
|
# check for link using /sys/class/net/iface/carrier
|
||||||
|
# is usually more accurate
|
||||||
|
sys_device = '/sys/class/net/%s/' % self.iface
|
||||||
|
carrier_path = sys_device + 'carrier'
|
||||||
|
if not self.IsUp():
|
||||||
|
MAX_TRIES = 3
|
||||||
|
tries = 0
|
||||||
|
self.Up()
|
||||||
|
while True:
|
||||||
|
tries += 1
|
||||||
|
time.sleep(2)
|
||||||
|
if self.IsUp() or tries > MAX_TRIES: break
|
||||||
|
|
||||||
|
if os.path.exists(carrier_path):
|
||||||
|
carrier = open(carrier_path, 'r')
|
||||||
|
try:
|
||||||
|
link = carrier.read().strip()
|
||||||
|
link = int(link)
|
||||||
|
if link == 1:
|
||||||
|
return True
|
||||||
|
elif link == 0:
|
||||||
|
return False
|
||||||
|
except (IOError, ValueError, TypeError):
|
||||||
|
print 'Error checking link using /sys/class/net/%s/carrier' % self.iface
|
||||||
|
|
||||||
if self.ETHTOOL_FOUND and self.link_detect != misc.MIITOOL:
|
if self.ETHTOOL_FOUND and self.link_detect != misc.MIITOOL:
|
||||||
return self._eth_get_plugged_in()
|
return self._eth_get_plugged_in()
|
||||||
elif self.MIITOOL_FOUND:
|
elif self.MIITOOL_FOUND:
|
||||||
return self._mii_get_plugged_in()
|
return self._mii_get_plugged_in()
|
||||||
else:
|
else:
|
||||||
print 'Error: No way of checking for a wired connection. Make \
|
print 'Error: No way of checking for a wired connection. Make ' + \
|
||||||
sure that either mii-tool or ethtool is installed.'
|
'sure that either mii-tool or ethtool is installed.'
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _eth_get_plugged_in(self):
|
def _eth_get_plugged_in(self):
|
||||||
@@ -254,7 +291,6 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
|
|||||||
cmd = 'iwlist ' + self.iface + ' scan'
|
cmd = 'iwlist ' + self.iface + ' scan'
|
||||||
if self.verbose: print cmd
|
if self.verbose: print cmd
|
||||||
results = misc.Run(cmd)
|
results = misc.Run(cmd)
|
||||||
|
|
||||||
# Split the networks apart, using Cell as our split point
|
# Split the networks apart, using Cell as our split point
|
||||||
# this way we can look at only one network at a time.
|
# this way we can look at only one network at a time.
|
||||||
# The spaces around ' Cell ' are to minimize the chance that someone
|
# The spaces around ' Cell ' are to minimize the chance that someone
|
||||||
@@ -293,17 +329,17 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
ap = {}
|
ap = {}
|
||||||
# ESSID - Switch '<hidden>' to 'Hidden' to remove
|
|
||||||
# brackets that can mix up formatting.
|
|
||||||
ap['essid'] = misc.RunRegex(essid_pattern, cell)
|
ap['essid'] = misc.RunRegex(essid_pattern, cell)
|
||||||
|
if ap['essid']:
|
||||||
|
ap['essid'] = ap['essid'].strip('"')
|
||||||
try:
|
try:
|
||||||
ap['essid'] = misc.to_unicode(ap['essid'])
|
ap['essid'] = misc.to_unicode(ap['essid'])
|
||||||
except UnicodeDecodeError, UnicodeEncodeError:
|
except UnicodeDecodeError, UnicodeEncodeError:
|
||||||
print 'Unicode problem with current network essid, ignoring!!'
|
print 'Unicode problem with current network essid, ignoring!!'
|
||||||
return None
|
return None
|
||||||
if ap['essid'] in ['<hidden>', ""]:
|
if ap['essid'] in ['<hidden>', ""]:
|
||||||
ap['essid'] = 'Hidden'
|
|
||||||
ap['hidden'] = True
|
ap['hidden'] = True
|
||||||
|
ap['essid'] = "<hidden>"
|
||||||
else:
|
else:
|
||||||
ap['hidden'] = False
|
ap['hidden'] = False
|
||||||
|
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if ap['essid'] in [ "", '<hidden>']:
|
if ap['essid'] in [ "", '<hidden>']:
|
||||||
ap['essid'] = 'Hidden'
|
ap['essid'] = '<hidden>'
|
||||||
ap['hidden'] = True
|
ap['hidden'] = True
|
||||||
else:
|
else:
|
||||||
ap['hidden'] = False
|
ap['hidden'] = False
|
||||||
|
|||||||
@@ -258,11 +258,12 @@ class appGui(object):
|
|||||||
self.network_list = self.wTree.get_widget("network_list_vbox")
|
self.network_list = self.wTree.get_widget("network_list_vbox")
|
||||||
self.status_area = self.wTree.get_widget("connecting_hbox")
|
self.status_area = self.wTree.get_widget("connecting_hbox")
|
||||||
self.status_bar = self.wTree.get_widget("statusbar")
|
self.status_bar = self.wTree.get_widget("statusbar")
|
||||||
|
menu = self.wTree.get_widget("menu1")
|
||||||
|
|
||||||
self.status_area.hide_all()
|
self.status_area.hide_all()
|
||||||
|
|
||||||
if os.path.exists(wpath.etc + "wicd.png"):
|
if os.path.exists(wpath.images + "wicd.png"):
|
||||||
self.window.set_icon_from_file(wpath.etc + "wicd.png")
|
self.window.set_icon_from_file(wpath.images + "wicd.png")
|
||||||
self.statusID = None
|
self.statusID = None
|
||||||
self.first_dialog_load = True
|
self.first_dialog_load = True
|
||||||
self.is_visible = True
|
self.is_visible = True
|
||||||
@@ -825,7 +826,6 @@ class appGui(object):
|
|||||||
daemon.WriteWindowSize(width, height, "main")
|
daemon.WriteWindowSize(width, height, "main")
|
||||||
|
|
||||||
if self.standalone:
|
if self.standalone:
|
||||||
self.window.destroy()
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
self.is_visible = False
|
self.is_visible = False
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ def Run(cmd, include_stderr=False, return_pipe=False):
|
|||||||
one output string from the command.
|
one output string from the command.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if type(cmd) is not list:
|
||||||
cmd = to_unicode(str(cmd))
|
cmd = to_unicode(str(cmd))
|
||||||
cmd = cmd.split()
|
cmd = cmd.split()
|
||||||
if include_stderr:
|
if include_stderr:
|
||||||
err = STDOUT
|
err = STDOUT
|
||||||
fds = True
|
fds = True
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ class TrayIcon(object):
|
|||||||
self.tray = egg.trayicon.TrayIcon("WicdTrayIcon")
|
self.tray = egg.trayicon.TrayIcon("WicdTrayIcon")
|
||||||
self.pic = gtk.Image()
|
self.pic = gtk.Image()
|
||||||
self.tooltip.set_tip(self.eb, "Initializing wicd...")
|
self.tooltip.set_tip(self.eb, "Initializing wicd...")
|
||||||
self.pic.set_from_file("images/no-signal.png")
|
self.pic.set_from_file(wpath.images + "no-signal.png")
|
||||||
|
|
||||||
self.eb.connect('button_press_event', self.tray_clicked)
|
self.eb.connect('button_press_event', self.tray_clicked)
|
||||||
self.eb.add(self.pic)
|
self.eb.add(self.pic)
|
||||||
|
|||||||
@@ -1025,8 +1025,6 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
cur_network = self.LastScan[id]
|
cur_network = self.LastScan[id]
|
||||||
essid_key = "essid:" + cur_network["essid"]
|
essid_key = "essid:" + cur_network["essid"]
|
||||||
bssid_key = cur_network["bssid"]
|
bssid_key = cur_network["bssid"]
|
||||||
if self.debug_mode:
|
|
||||||
print bssid_key
|
|
||||||
|
|
||||||
if self.config.get(essid_key, 'use_settings_globally'):
|
if self.config.get(essid_key, 'use_settings_globally'):
|
||||||
section = essid_key
|
section = essid_key
|
||||||
@@ -1041,8 +1039,9 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
# Read the essid because we need to name those hidden
|
# Read the essid because we need to name those hidden
|
||||||
# wireless networks now - but only read it if it is hidden.
|
# wireless networks now - but only read it if it is hidden.
|
||||||
if cur_network["hidden"]:
|
if cur_network["hidden"]:
|
||||||
cur_network["essid"] = misc.Noneify(self.config.get(section,
|
cur_network["essid"] = config.get(section, x)
|
||||||
"essid"))
|
if cur_network["essid"] in ["", "Hidden", "<hidden>"]:
|
||||||
|
cur_network["essid"] = "<hidden>"
|
||||||
for x in self.config.options(section):
|
for x in self.config.options(section):
|
||||||
if not cur_network.has_key(x) or x.endswith("script"):
|
if not cur_network.has_key(x) or x.endswith("script"):
|
||||||
cur_network[x] = misc.Noneify(self.config.get(section, x))
|
cur_network[x] = misc.Noneify(self.config.get(section, x))
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
|
|
||||||
def SetWpaDriver(self, driver):
|
def SetWpaDriver(self, driver):
|
||||||
""" Sets the wpa_driver. """
|
""" Sets the wpa_driver. """
|
||||||
self.wpa_driver = _sanitize_string_strict(driver)
|
self.wpa_driver = _sanitize_string(driver)
|
||||||
|
|
||||||
def SetEssid(self, essid):
|
def SetEssid(self, essid):
|
||||||
""" Set the essid of the wireless interface.
|
""" Set the essid of the wireless interface.
|
||||||
@@ -561,8 +561,8 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
essid -- essid to set the interface to
|
essid -- essid to set the interface to
|
||||||
|
|
||||||
"""
|
"""
|
||||||
cmd = 'iwconfig %s essid %s' % (self.iface, essid)
|
cmd = ['iwconfig', self.iface, 'essid', essid]
|
||||||
if self.verbose: print cmd
|
if self.verbose: print str(cmd)
|
||||||
misc.Run(cmd)
|
misc.Run(cmd)
|
||||||
|
|
||||||
def StopWPA(self):
|
def StopWPA(self):
|
||||||
@@ -623,7 +623,7 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _GetRalinkInfo(self):
|
def _GetRalinkInfo(self):
|
||||||
""" Get a network info list used for ralink drivers
|
""" Get a network info dict used for ralink drivers
|
||||||
|
|
||||||
Calls iwpriv <wireless interface> get_site_survey, which
|
Calls iwpriv <wireless interface> get_site_survey, which
|
||||||
on some ralink cards will return encryption and signal
|
on some ralink cards will return encryption and signal
|
||||||
@@ -631,49 +631,56 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
iwpriv = misc.Run('iwpriv ' + self.iface + ' get_site_survey')
|
iwpriv = misc.Run('iwpriv ' + self.iface + ' get_site_survey')
|
||||||
lines = iwpriv.splitlines()
|
lines = iwpriv.splitlines()[2:]
|
||||||
lines = lines[2:]
|
aps = {}
|
||||||
return lines
|
patt = re.compile("((?:[0-9A-Z]{2}:){5}[0-9A-Z]{2})")
|
||||||
|
for x in lines:
|
||||||
|
ap = {}
|
||||||
|
info = x.split(" ")
|
||||||
|
info = filter(None, [x.strip() for x in info])
|
||||||
|
if re.match(patt, info[2].upper()):
|
||||||
|
bssid = info[2].upper()
|
||||||
|
offset = -1
|
||||||
|
elif re.match(patt, info[3].upper()):
|
||||||
|
bssid = info[3].upper()
|
||||||
|
offset = 0
|
||||||
|
else: # Invalid
|
||||||
|
print 'Invalid iwpriv line. Skipping it.'
|
||||||
|
continue
|
||||||
|
ap['strength'] = info[1]
|
||||||
|
if info[5 + offset] == 'WEP' or info[4 + offset] == 'WEP':
|
||||||
|
ap['encryption_method'] = 'WEP'
|
||||||
|
elif info[5 + offset] in ['WPA-PSK', 'WPA']:
|
||||||
|
ap['encryption_method'] = 'WPA'
|
||||||
|
elif info[5 + offset] == 'WPA2-PSK':
|
||||||
|
ap['encryption_method'] = 'WPA2'
|
||||||
|
else:
|
||||||
|
print "Unknown AuthMode, can't assign encryption_method!"
|
||||||
|
ap['encryption_method'] = 'Unknown'
|
||||||
|
aps[bssid] = ap
|
||||||
|
return aps
|
||||||
|
|
||||||
def _ParseRalinkAccessPoint(self, ap, ralink_info, cell):
|
def _ParseRalinkAccessPoint(self, ap, ralink_info, cell):
|
||||||
""" Parse encryption and signal strength info for ralink cards
|
""" Parse encryption and signal strength info for ralink cards
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
ap -- array containing info about the current access point
|
ap -- array containing info about the current access point
|
||||||
ralink_info -- string containing available network info
|
ralink_info -- dict containing available network info
|
||||||
cell -- string containing cell information
|
cell -- string containing cell information
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Updated array containing info about the current access point
|
Updated array containing info about the current access point
|
||||||
|
|
||||||
"""
|
"""
|
||||||
lines = ralink_info
|
|
||||||
wep_pattern = re.compile('.*Encryption key:(.*?)\n', re.I | re.M | re.S)
|
wep_pattern = re.compile('.*Encryption key:(.*?)\n', re.I | re.M | re.S)
|
||||||
for x in lines: # Iterate through all networks found
|
if ralink_info.has_key(ap['bssid']):
|
||||||
info = x.split()
|
info = ralink_info[ap['bssid']]
|
||||||
# Make sure we read in a valid entry
|
for key in info.keys():
|
||||||
if len(info) < 5 or info == None or info == '':
|
ap[key] = info[key]
|
||||||
break
|
if misc.RunRegex(wep_pattern, cell) == 'on':
|
||||||
if info[2] == ap['essid']:
|
ap['encryption'] = True
|
||||||
if misc.RunRegex(wep_pattern, cell) == 'on':
|
else:
|
||||||
ap['encryption'] = True
|
ap['encryption'] = False
|
||||||
if info[5] == 'WEP' or (
|
|
||||||
(info[5] == 'OPEN' or info[5] == 'SHARED') and
|
|
||||||
info[4] == 'WEP'):
|
|
||||||
ap['encryption_method'] = 'WEP'
|
|
||||||
elif info[5] == 'WPA-PSK':
|
|
||||||
ap['encryption_method'] = 'WPA'
|
|
||||||
elif info[5] == 'WPA2-PSK':
|
|
||||||
ap['encryption_method'] = 'WPA2'
|
|
||||||
else:
|
|
||||||
print 'Unknown AuthMode, can\'t assign encryption_method!!'
|
|
||||||
ap['encryption_method'] = 'Unknown'
|
|
||||||
else:
|
|
||||||
ap['encryption'] = False
|
|
||||||
|
|
||||||
# Set signal strength here (in dBm, not %),
|
|
||||||
# ralink drivers don't return link quality
|
|
||||||
ap['strength'] = info[1]
|
|
||||||
return ap
|
return ap
|
||||||
|
|
||||||
def SetMode(self, mode):
|
def SetMode(self, mode):
|
||||||
@@ -729,12 +736,12 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if not self.iface: return False
|
if not self.iface: return False
|
||||||
cmd = 'iwconfig %s essid "%s"' % (self.iface, essid)
|
cmd = ['iwconfig', self.iface, 'essid', essid]
|
||||||
if channel:
|
if channel:
|
||||||
cmd = ''.join([cmd, ' channel ', str(channel)])
|
cmd.extend(['channel', str(channel)])
|
||||||
if bssid:
|
if bssid:
|
||||||
cmd = ''.join([cmd, ' ap ', bssid])
|
cmd.extend(['ap', bssid])
|
||||||
if self.verbose: print cmd
|
if self.verbose: print str(cmd)
|
||||||
misc.Run(cmd)
|
misc.Run(cmd)
|
||||||
|
|
||||||
def GeneratePSK(self, network):
|
def GeneratePSK(self, network):
|
||||||
@@ -841,7 +848,7 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
cmd_list.append('SSID=' + info[2])
|
cmd_list.append('SSID=' + info[2])
|
||||||
|
|
||||||
for cmd in cmd_list:
|
for cmd in cmd_list:
|
||||||
cmd = 'iwpriv ' + self.iface + ' '
|
cmd = 'iwpriv ' + self.iface + ' ' + cmd
|
||||||
if self.verbose: print cmd
|
if self.verbose: print cmd
|
||||||
misc.Run(cmd)
|
misc.Run(cmd)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user