diff --git a/curses/wicd-curses.py b/curses/wicd-curses.py
index 351ea01..ad90de4 100644
--- a/curses/wicd-curses.py
+++ b/curses/wicd-curses.py
@@ -1211,7 +1211,6 @@ def main():
# This is a wrapper around a function that calls another a function that
# is a wrapper around a infinite loop. Fun.
urwid.set_encoding('utf8')
-
ui.run_wrapper(run)
@@ -1276,21 +1275,20 @@ setup_dbus()
if __name__ == '__main__':
- #try:
- # parser = OptionParser(version="wicd-curses-%s (using wicd %s)" %
- # (CURSES_REV, daemon.Hello()),
- # prog="wicd-curses")
- #except Exception as e:
- # if "DBus.Error.AccessDenied" in e.get_dbus_name():
- # print(_('ERROR: wicd-curses was denied access to the wicd daemon: '
- # 'please check that your user is in the "$A" group.')
- # .replace('$A', '\033[1;34m' + wpath.wicd_group + '\033[0m'))
- # sys.exit(1)
- # else:
- # raise
+ try:
+ parser = OptionParser(version="wicd-curses-%s (using wicd %s)" %
+ (CURSES_REV, daemon.Hello()),
+ prog="wicd-curses")
+ except Exception as e:
+ if "DBus.Error.AccessDenied" in e.get_dbus_name():
+ print(_('ERROR: wicd-curses was denied access to the wicd daemon: '
+ 'please check that your user is in the "$A" group.')
+ .replace('$A', '\033[1;34m' + wpath.wicd_group + '\033[0m'))
+ sys.exit(1)
+ else:
+ raise
# parser.add_option("-d", "--debug", action="store_true", dest='debug',
# help="enable logging of wicd-curses (currently does nothing)")
- parser = OptionParser(prog="wicd-curses")
(options, args) = parser.parse_args()
main()
diff --git a/data/wicd.png b/data/wicd.png
deleted file mode 100644
index f81ee30..0000000
--- a/data/wicd.png
+++ /dev/null
@@ -1 +0,0 @@
-link /opt/wicd/images/wicd.png
\ No newline at end of file
diff --git a/data/wicd.ui b/data/wicd.ui
deleted file mode 100644
index 2905daf..0000000
--- a/data/wicd.ui
+++ /dev/null
@@ -1,1750 +0,0 @@
-
-
-
-
-
-
- 416
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- 5
- Configure Scripts
- center-on-parent
- dialog
- False
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- vertical
- 2
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- vertical
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Configure scripts to run for this network:
-
-
- False
- False
- 0
-
-
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
- 150
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Pre-connection Script:
-
-
- 0
-
-
-
-
- True
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
- 1
-
-
-
-
- False
- False
- 5
- 1
-
-
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
- 150
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Post-connection Script:
-
-
- 0
-
-
-
-
- True
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
- 1
-
-
-
-
- False
- False
- 5
- 2
-
-
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
- 150
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Pre-disconnection Script:
-
-
- 0
-
-
-
-
- True
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
- 1
-
-
-
-
- False
- False
- 5
- 3
-
-
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
- 150
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Post-disconnection Script:
-
-
- 0
-
-
-
-
- True
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
- 1
-
-
-
-
- False
- False
- 5
- 4
-
-
-
-
- 1
-
-
-
-
- True
- end
-
-
- gtk-cancel
- True
- True
- False
- True
-
-
- False
- False
- 0
-
-
-
-
- gtk-ok
- True
- True
- False
- True
-
-
- False
- False
- 1
-
-
-
-
- False
- end
- 0
-
-
-
-
-
- button3
- button4
-
-
-
- 5
- center-on-parent
- dialog
- False
-
-
- True
- vertical
- 2
-
-
- True
- True
-
-
- True
- 12
- 12
- 12
- 12
-
-
- True
- True
- automatic
- automatic
-
-
- True
- queue
- none
-
-
- True
- 22
- 2
- 4
- 4
-
-
- True
-
-
- Always switch to a wired connection when available
- True
- True
- False
- True
- If selected, wicd will automatically connect to a wired network
-as soon as a cable is plugged in, even if a wireless connection
-is already active.
- True
-
-
-
-
- 2
- 4
- 5
-
- 24
-
-
-
-
- True
- 24
-
-
- True
- 0
- DNS domain:
-
-
-
-
- 7
- 8
-
-
-
-
-
- True
- True
-
-
- 1
- 2
- 7
- 8
- GTK_FILL
-
-
-
-
- True
- 12
-
-
- Show never connect networks
- True
- True
- False
- True
-
-
-
-
- 2
- 19
- 20
-
-
-
-
-
- True
- 0
- <b>Never Connect</b>
- True
-
-
- 2
- 18
- 19
-
-
-
-
-
- True
- 12
-
-
- Automatically reconnect on network connection loss
- True
- True
- False
- True
-
-
-
-
- 2
- 17
- 18
-
-
-
-
-
- True
- 0
- <b>Automatic Reconnection</b>
- True
-
-
- 2
- 16
- 17
-
-
-
-
-
- True
- 12
-
-
- Use last wired network profile
- True
- True
- False
- True
- True
-
-
-
-
- 2
- 15
- 16
-
-
-
-
-
- True
- 12
-
-
- Prompt for wired network profile
- True
- True
- False
- True
- True
- pref_use_last_radio
-
-
-
-
- 2
- 14
- 15
-
-
-
-
-
- True
- 12
-
-
- Use default wired network profile
- True
- True
- False
- True
- True
- pref_use_last_radio
-
-
-
-
- 2
- 13
- 14
-
-
-
-
-
- True
- 0
- <b>Wired automatic connection</b>
- True
-
-
- 2
- 12
- 13
-
-
-
-
-
- True
- 12
-
-
- True
- 0
- Wired interface:
-
-
-
-
- 2
- 3
-
-
-
-
-
- True
- 12
-
-
- True
- 0
- Wireless interface:
-
-
-
-
- 1
- 2
-
-
-
-
-
- True
- True
-
-
- 1
- 2
- 2
- 3
-
-
-
-
-
- True
- True
-
-
- 1
- 2
- 1
- 2
-
-
-
-
-
- True
- 0
- <b>Network Interfaces</b>
- True
-
-
- 2
-
-
-
-
-
- True
- 24
-
-
- True
- 0
- DNS server 3:
-
-
-
-
- 11
- 12
-
-
-
-
-
- True
- True
-
-
- 1
- 2
- 11
- 12
-
-
-
-
-
- True
- 24
-
-
- True
- 0
- DNS server 2:
-
-
-
-
- 10
- 11
-
-
-
-
-
- True
- 24
-
-
- True
- 0
- DNS server 1:
-
-
-
-
- 9
- 10
-
-
-
-
-
- True
- 24
-
-
- True
- 0
- Search domain:
-
-
-
-
- 8
- 9
-
-
-
-
-
- True
- 12
-
-
- Use global DNS servers
- True
- True
- False
- True
-
-
-
-
- 2
- 6
- 7
-
-
-
-
-
- True
- 0
- <b>Global DNS Servers</b>
- True
-
-
- 2
- 5
- 6
-
-
-
-
-
- True
- True
-
-
- 1
- 2
- 10
- 11
-
-
-
-
-
- True
- True
-
-
- 1
- 2
- 9
- 10
-
-
-
-
-
- True
- True
-
-
- 1
- 2
- 8
- 9
-
-
-
-
-
- True
- 24
-
-
- Always show wired interface
- True
- True
- False
- If enabled, the wired network interface will always be displayed in the main window. This can be useful if your wired network card does not detect when the interface is connected to a cable.
- True
-
-
-
-
- 2
- 3
- 4
-
-
-
-
-
- True
- 0
- <b>Notifications</b>
- True
-
-
- 2
- 20
- 21
-
-
-
-
-
- True
- 12
-
-
- Display notifications about connection status
- True
- True
- False
- True
-
-
-
-
- 2
- 21
- 22
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
- General Settings
-
-
- False
-
-
-
-
- True
- 12
- 12
- 12
- 12
-
-
- True
- True
- automatic
- automatic
-
-
- True
- queue
- none
-
-
- True
- 8
-
-
- True
- 0
- <b>Route Table Flushing</b>
- True
-
-
- 4
- 5
-
-
-
-
-
- True
- 0
- <b>Wired Link Detection</b>
- True
-
-
- 2
- 3
-
-
-
-
-
- True
- 12
-
-
- True
- vertical
-
-
- Automatic (recommended)
- True
- True
- False
- True
- True
-
-
- False
- 0
-
-
-
-
- ip
- True
- True
- False
- True
- True
- flush_auto_radio
-
-
- False
- 1
-
-
-
-
- route
- True
- True
- False
- True
- True
- flush_auto_radio
-
-
- False
- 2
-
-
-
-
-
-
- 5
- 6
-
-
-
-
-
- True
- 12
-
-
- True
- vertical
-
-
- Automatic (recommended)
- True
- True
- False
- True
- True
-
-
- False
- 0
-
-
-
-
- ethtool
- True
- True
- False
- True
- True
- link_auto_radio
-
-
- False
- 1
-
-
-
-
- mii-tool
- True
- True
- False
- True
- True
- link_auto_radio
-
-
- False
- 2
-
-
-
-
-
-
- 3
- 4
-
-
-
-
-
- True
- 12
-
-
- True
- vertical
-
-
- Automatic (recommended)
- True
- True
- False
- True
- True
- dhclient_radio
-
-
- False
- 0
-
-
-
-
- dhcpcd
- True
- True
- False
- True
- True
- dhclient_radio
-
-
- False
- 1
-
-
-
-
- pump
- True
- True
- False
- True
- True
- dhclient_radio
-
-
- False
- 2
-
-
-
-
- dhclient
- True
- True
- False
- True
- True
-
-
- False
- 3
-
-
-
-
- udhcpc
- True
- True
- False
- True
- True
- dhclient_radio
-
-
- False
- 4
-
-
-
-
-
-
- 1
- 2
-
-
-
-
-
- True
- 0
- <b>DHCP Client</b>
- True
-
-
-
-
-
-
-
- True
- 0
- <b>Graphical Sudo Application</b>
- True
-
-
- 6
- 7
-
-
-
-
-
- True
- 12
-
-
- True
- vertical
-
-
- Automatic (recommended)
- True
- True
- False
- True
- True
-
-
- False
- 0
-
-
-
-
- gksudo
- True
- True
- False
- True
- True
- sudo_auto_radio
-
-
- False
- 1
-
-
-
-
- kdesu
- True
- True
- False
- True
- True
- sudo_auto_radio
-
-
- False
- 2
-
-
-
-
- ktsuss
- True
- True
- False
- True
- True
- sudo_auto_radio
-
-
- False
- 3
-
-
-
-
-
-
- 7
- 8
-
-
-
-
-
-
-
-
-
-
- 1
-
-
-
-
- True
- External Programs
-
-
- 1
- False
-
-
-
-
- True
- 12
- 12
- 12
- 12
-
-
- True
- 11
- 2
-
-
- True
- 0
- Hover your mouse over the selected backend
-to read its description.
- True
-
-
- 1
- 2
- 5
- 6
-
-
-
-
-
- True
- vertical
-
-
- True
-
-
- False
- 0
-
-
-
-
- 1
- 2
- 1
- 2
-
-
-
-
-
- True
-
-
- 2
- 3
- GTK_FILL
-
-
-
-
-
- True
- 12
-
-
- True
- 0
- Driver:
-
-
-
-
- 1
- 2
-
-
-
-
-
- True
- 12
-
-
- Use dBm to measure signal strength
- True
- True
- False
- True
-
-
-
-
- 2
- 9
- 10
-
-
-
-
-
- True
- 12
-
-
- Enable debug mode
- True
- True
- False
- True
-
-
-
-
- 2
- 7
- 8
-
-
-
-
-
- True
- 0
- <b>Wireless Interface</b>
- True
-
-
- 2
- 8
- 9
-
-
-
-
-
- True
- 0
- <b>WPA Supplicant</b>
- True
-
-
- 2
-
-
-
-
-
- True
- 0
- <b>Debugging</b>
- True
-
-
- 2
- 6
- 7
-
-
-
-
-
- True
- 12
-
-
- True
- 0
- Backend:
-
-
-
-
- 4
- 5
-
-
-
-
-
- True
- True
-
-
- 1
- 2
- 4
- 5
-
-
-
-
-
- True
- 0
- <b>Backend</b>
- True
-
-
- 2
- 3
- 4
-
-
-
-
-
- True
- 0
- You should almost always use wext as the
-WPA supplicant driver.
- True
-
-
- 1
- 2
- 2
- 3
-
-
-
-
-
- True
-
-
- 5
- 6
- GTK_FILL
-
-
-
-
-
- True
- 12
-
-
- Ping static gateways after connecting to verify association
- True
- True
- False
- True
-
-
-
-
- 2
- 10
- 11
-
-
-
-
-
-
-
- 2
-
-
-
-
- True
- Advanced Settings
-
-
- 2
- False
-
-
-
-
- 1
-
-
-
-
- True
- end
-
-
- gtk-cancel
- True
- True
- True
- True
-
-
- False
- False
- 0
-
-
-
-
- gtk-ok
- True
- True
- True
- True
-
-
- False
- False
- 1
-
-
-
-
- False
- end
- 0
-
-
-
-
-
- button2
- button1
-
-
-
- True
- gtk-add
-
-
- True
- gtk-find
-
-
- True
- gtk-delete
-
-
-
diff --git a/gnome-shell/extension.js b/gnome-shell/extension.js
deleted file mode 100644
index 8302c94..0000000
--- a/gnome-shell/extension.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2012, David Paleino
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License Version 2 as
- * published by the Free Software Foundation.
- *
- * 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, see .
- *
- */
-
-const StatusIconDispatcher = imports.ui.statusIconDispatcher;
-
-function init(metadata) {
-}
-
-function enable() {
- StatusIconDispatcher.STANDARD_TRAY_ICON_IMPLEMENTATIONS['wicd-client.py'] = 'wicd-gtk';
-}
-
-function disable() {
- StatusIconDispatcher.STANDARD_TRAY_ICON_IMPLEMENTATIONS['wicd-client.py'] = '';
-}
diff --git a/gnome-shell/metadata.json b/gnome-shell/metadata.json
deleted file mode 100644
index 38b03f7..0000000
--- a/gnome-shell/metadata.json
+++ /dev/null
@@ -1 +0,0 @@
-{"shell-version": ["3.4.2"], "uuid": "wicd@code.hanskalabs.net", "name": "WICD Network Manager", "description": "Show status of WICD"}
\ No newline at end of file
diff --git a/gtk/configscript.py b/gtk/configscript.py
deleted file mode 100644
index 0544fa0..0000000
--- a/gtk/configscript.py
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/env python3
-"""configscript -- Configure the scripts for a particular network.
-
-Script for configuring the scripts for a network passed in as a
-command line argument. This needs to run a separate process because
-editing scripts requires root access, and the GUI/Tray are typically
-run as the current user.
-
-"""
-#
-# Copyright (C) 2007-2009 Adam Blackburn
-# Copyright (C) 2007-2009 Dan O'Reilly
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License Version 2 as
-# published by the Free Software Foundation.
-#
-# 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, see .
-#
-
-import sys
-import os
-import gtk
-
-from wicd import wpath
-from wicd.translations import _
-from wicd import dbusmanager
-from wicd.configmanager import ConfigManager
-
-dbus = dbusmanager.DBusManager()
-dbus.connect_to_dbus()
-
-wireless = dbus.get_interface("wireless")
-wired = dbus.get_interface("wired")
-
-wireless_conf = wpath.etc + 'wireless-settings.conf'
-wired_conf = wpath.etc + 'wired-settings.conf'
-
-
-def none_to_blank(text):
- """Converts special string cases to a blank string.
-
- If text is None, 'None', or '' then this method will
- return '', otherwise it will just return str(text).
-
- """
- if text in (None, "None", ""):
- return ""
- else:
- return str(text)
-
-
-def blank_to_none(text):
- """Convert an empty or null string to 'None'."""
- if text in ("", None):
- return "None"
- else:
- return str(text)
-
-
-def get_script_info(network, network_type):
- """
- Read script info from disk and load it into the configuration dialog
- """
- info = {}
- if network_type == "wired":
- con = ConfigManager(wired_conf)
- section = network
- else:
- bssid = wireless.GetWirelessProperty(int(network), "bssid")
- con = ConfigManager(wireless_conf)
- section = bssid
-
- if con.has_section(section):
- info["pre_entry"] = con.get(section, "beforescript", None)
- info["post_entry"] = con.get(section, "afterscript", None)
- info["pre_disconnect_entry"] = con.get(section,
- "predisconnectscript", None)
- info["post_disconnect_entry"] = con.get(section,
- "postdisconnectscript", None)
- return info
-
-
-def write_scripts(network, network_type, script_info):
- """Writes script info to disk and loads it into the daemon."""
- if network_type == "wired":
- con = ConfigManager(wired_conf)
- con.set(network, "beforescript", script_info["pre_entry"])
- con.set(network, "afterscript", script_info["post_entry"])
- con.set(network, "predisconnectscript",
- script_info["pre_disconnect_entry"])
- con.set(network, "postdisconnectscript",
- script_info["post_disconnect_entry"])
- con.write()
- wired.ReloadConfig()
- wired.ReadWiredNetworkProfile(network)
- wired.SaveWiredNetworkProfile(network)
- else:
- bssid = wireless.GetWirelessProperty(int(network), "bssid")
- con = ConfigManager(wireless_conf)
- con.set(bssid, "beforescript", script_info["pre_entry"])
- con.set(bssid, "afterscript", script_info["post_entry"])
- con.set(bssid, "predisconnectscript",
- script_info["pre_disconnect_entry"])
- con.set(bssid, "postdisconnectscript",
- script_info["post_disconnect_entry"])
- con.write()
- wireless.ReloadConfig()
- wireless.ReadWirelessNetworkProfile(int(network))
- wireless.SaveWirelessNetworkProfile(int(network))
-
-
-def main(argv):
- """Runs the script configuration dialog."""
- if len(argv) < 2:
- print('Network id to configure is missing, aborting.')
- sys.exit(1)
-
- network = argv[1]
- network_type = argv[2]
-
- script_info = get_script_info(network, network_type)
-
- gladefile = os.path.join(wpath.gtk, "wicd.ui")
- wTree = gtk.Builder()
- wTree.set_translation_domain('wicd')
- wTree.add_from_file(gladefile)
- dialog = wTree.get_object("configure_script_dialog")
- wTree.get_object("pre_label").set_label(_('Pre-connection Script') + ":")
- wTree.get_object("post_label").set_label(_('Post-connection Script') + ":")
- wTree.get_object("pre_disconnect_label").\
- set_label(_('Pre-disconnection Script') + ":")
- wTree.get_object("post_disconnect_label").\
- set_label(_('Post-disconnection Script') + ":")
- wTree.get_object("window1").hide()
-
- pre_entry = wTree.get_object("pre_entry")
- post_entry = wTree.get_object("post_entry")
- pre_disconnect_entry = wTree.get_object("pre_disconnect_entry")
- post_disconnect_entry = wTree.get_object("post_disconnect_entry")
-
- pre_entry.set_text(none_to_blank(script_info.get("pre_entry")))
- post_entry.set_text(none_to_blank(script_info.get("post_entry")))
- pre_disconnect_entry.set_text(
- none_to_blank(script_info.get("pre_disconnect_entry"))
- )
- post_disconnect_entry.set_text(
- none_to_blank(script_info.get("post_disconnect_entry"))
- )
-
- dialog.show_all()
-
- result = dialog.run()
- if result == 1:
- script_info["pre_entry"] = blank_to_none(pre_entry.get_text())
- script_info["post_entry"] = blank_to_none(post_entry.get_text())
- script_info["pre_disconnect_entry"] = \
- blank_to_none(pre_disconnect_entry.get_text())
- script_info["post_disconnect_entry"] = \
- blank_to_none(post_disconnect_entry.get_text())
- write_scripts(network, network_type, script_info)
- dialog.destroy()
-
-
-if __name__ == '__main__':
- if os.getuid() != 0:
- print("Root privileges are required to configure scripts. Exiting.")
- sys.exit(0)
- main(sys.argv)
diff --git a/gtk/gui.py b/gtk/gui.py
deleted file mode 100644
index 75aaf49..0000000
--- a/gtk/gui.py
+++ /dev/null
@@ -1,962 +0,0 @@
-#!/usr/bin/env python3
-"""gui -- The main wicd GUI module.
-
-Module containing the code for the main wicd GUI.
-
-"""
-
-#
-# Copyright (C) 2007-2009 Adam Blackburn
-# Copyright (C) 2007-2009 Dan O'Reilly
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License Version 2 as
-# published by the Free Software Foundation.
-#
-# 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, see .
-#
-
-import os
-import sys
-import time
-
-from gi.repository import GLib as gobject
-import gtk
-from itertools import chain
-from dbus import DBusException
-
-from wicd import misc
-from wicd import wpath
-from wicd import dbusmanager
-from wicd.misc import noneToString
-from wicd.translations import _, language
-import prefs
-from prefs import PreferencesDialog
-import netentry
-from netentry import WiredNetworkEntry, WirelessNetworkEntry
-from guiutil import error, LabelEntry
-
-if __name__ == '__main__':
- wpath.chdir(__file__)
-
-proxy_obj = daemon = wireless = wired = bus = None
-DBUS_AVAIL = False
-
-
-def setup_dbus(force=True):
- """Initialize DBus."""
- global bus, daemon, wireless, wired, DBUS_AVAIL
- try:
- dbusmanager.connect_to_dbus()
- except DBusException:
- if force:
- print("Can't connect to the daemon, ' + \
- 'trying to start it automatically...")
- if not misc.PromptToStartDaemon():
- print("Failed to find a graphical sudo program, ' + \
- 'cannot continue.")
- return False
- try:
- dbusmanager.connect_to_dbus()
- except DBusException:
- error(None, _("Could not connect to wicd's D-Bus interface. "
- "Check the wicd log for error messages."))
- return False
- else:
- return False
- prefs.setup_dbus()
- netentry.setup_dbus()
- bus = dbusmanager.get_bus()
- dbus_ifaces = dbusmanager.get_dbus_ifaces()
- daemon = dbus_ifaces['daemon']
- wireless = dbus_ifaces['wireless']
- wired = dbus_ifaces['wired']
- DBUS_AVAIL = True
-
- return True
-
-
-def handle_no_dbus(from_tray=False):
- """Handle the case where no DBus is available."""
- global DBUS_AVAIL
- DBUS_AVAIL = False
- if from_tray:
- return False
- print("Wicd daemon is shutting down!")
- error(None, _('The wicd daemon has shut down. The UI will not function '
- 'properly until it is restarted.'), block=False)
- return False
-
-
-class WiredProfileChooser:
- """Class for displaying the wired profile chooser."""
- def __init__(self):
- """Initializes and runs the wired profile chooser."""
- # Import and init WiredNetworkEntry to steal some of the
- # functions and widgets it uses.
- wired_net_entry = WiredNetworkEntry()
-
- dialog = gtk.Dialog(
- title=_('Wired connection detected'),
- flags=gtk.DIALOG_MODAL,
- buttons=(gtk.STOCK_CONNECT, 1, gtk.STOCK_CANCEL, 2)
- )
- dialog.set_has_separator(False)
- dialog.set_size_request(400, 150)
- instruct_label = gtk.Label(
- _('Select or create a wired profile to connect with') + ':\n'
- )
- stoppopcheckbox = gtk.CheckButton(
- _('Stop Showing Autoconnect pop-up temporarily')
- )
-
- wired_net_entry.is_full_gui = False
- instruct_label.set_alignment(0, 0)
- stoppopcheckbox.set_active(False)
-
- # Remove widgets that were added to the normal WiredNetworkEntry
- # so that they can be added to the pop-up wizard.
- wired_net_entry.vbox_top.remove(wired_net_entry.hbox_temp)
- wired_net_entry.vbox_top.remove(wired_net_entry.profile_help)
-
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(instruct_label, fill=False, expand=False)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(wired_net_entry.profile_help, False, False)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(wired_net_entry.hbox_temp, False, False)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(stoppopcheckbox, False, False)
- dialog.show_all()
-
- wired_profiles = wired_net_entry.combo_profile_names
- wired_net_entry.profile_help.hide()
- if wired_net_entry.profile_list is not None:
- wired_profiles.set_active(0)
- print("wired profiles found")
- else:
- print("no wired profiles found")
- wired_net_entry.profile_help.show()
-
- response = dialog.run()
- if response == 1:
- print(('reading profile ', wired_profiles.get_active_text()))
- wired.ReadWiredNetworkProfile(wired_profiles.get_active_text())
- wired.ConnectWired()
- else:
- if stoppopcheckbox.get_active():
- daemon.SetForcedDisconnect(True)
- dialog.destroy()
-
-
-def get_wireless_prop(net_id, prop):
- """Get wireless property."""
- return wireless.GetWirelessProperty(net_id, prop)
-
-
-class appGui(object):
- """The main wicd GUI class."""
- def __init__(self, standalone=False, tray=None):
- """Initializes everything needed for the GUI."""
- setup_dbus()
-
- if not daemon:
- errmsg = _("Error connecting to wicd service via D-Bus. "
- "Please ensure the wicd service is running.")
- d = gtk.MessageDialog(parent=None,
- flags=gtk.DIALOG_MODAL,
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_OK,
- message_format=errmsg)
- d.run()
- sys.exit(1)
-
- self.tray = tray
-
- gladefile = os.path.join(wpath.gtk, "wicd.ui")
- self.wTree = gtk.Builder()
- self.wTree.set_translation_domain('wicd')
- self.wTree.add_from_file(gladefile)
- self.window = self.wTree.get_object("window1")
- width = int(gtk.gdk.screen_width() / 2)
- if width > 530:
- width = 530
- self.window.resize(width, int(gtk.gdk.screen_height() / 1.7))
-
- dic = {
- "refresh_clicked": self.refresh_clicked,
- "quit_clicked": self.exit,
- "rfkill_clicked": self.switch_rfkill,
- "disconnect_clicked": self.disconnect_all,
- "main_exit": self.exit,
- "cancel_clicked": self.cancel_connect,
- "hidden_clicked": self.connect_hidden,
- "preferences_clicked": self.settings_dialog,
- "about_clicked": self.about_dialog,
- "create_adhoc_clicked": self.create_adhoc_network,
- "forget_network_clicked": self.forget_network,
- }
- self.wTree.connect_signals(dic)
-
- # Set some strings in the GUI - they may be translated
- label_instruct = self.wTree.get_object("label_instructions")
- label_instruct.set_label(_('Choose from the networks below:'))
-
- probar = self.wTree.get_object("progressbar")
- probar.set_text(_('Connecting'))
-
- self.disconnect_all_button = self.wTree.get_object('disconnect_button')
- self.rfkill_button = self.wTree.get_object("rfkill_button")
- self.all_network_list = self.wTree.get_object("network_list_vbox")
- self.all_network_list.show_all()
- self.wired_network_box = gtk.VBox(False, 0)
- self.wired_network_box.show_all()
- self.network_list = gtk.VBox(False, 0)
- self.all_network_list.pack_start(self.wired_network_box, False, False)
- self.all_network_list.pack_start(self.network_list, True, True)
- self.network_list.show_all()
- self.status_area = self.wTree.get_object("connecting_hbox")
- self.status_bar = self.wTree.get_object("statusbar")
- menu = self.wTree.get_object("menu1")
-
- self.status_area.hide_all()
-
- self.window.set_icon_name('wicd-gtk')
- self.statusID = None
- self.first_dialog_load = True
- self.is_visible = True
- self.pulse_active = False
- self.pref = None
- self.standalone = standalone
- self.wpadrivercombo = None
- self.connecting = False
- self.refreshing = False
- self.prev_state = None
- self.update_cb = None
- self._wired_showing = False
- self.network_list.set_sensitive(False)
- label = gtk.Label("%s..." % _('Scanning'))
- self.network_list.pack_start(label)
- label.show()
- self.wait_for_events(0.2)
- self.window.connect('delete_event', self.exit)
- self.window.connect('key-release-event', self.key_event)
- daemon.SetGUIOpen(True)
- bus.add_signal_receiver(self.dbus_scan_finished, 'SendEndScanSignal',
- 'org.wicd.daemon.wireless')
- bus.add_signal_receiver(self.dbus_scan_started, 'SendStartScanSignal',
- 'org.wicd.daemon.wireless')
- bus.add_signal_receiver(self.update_connect_buttons, 'StatusChanged',
- 'org.wicd.daemon')
- bus.add_signal_receiver(self.handle_connection_results,
- 'ConnectResultsSent', 'org.wicd.daemon')
- bus.add_signal_receiver(lambda: setup_dbus(force=False),
- "DaemonStarting", "org.wicd.daemon")
- bus.add_signal_receiver(self._do_statusbar_update, 'StatusChanged',
- 'org.wicd.daemon')
- if standalone:
- bus.add_signal_receiver(handle_no_dbus, "DaemonClosing",
- "org.wicd.daemon")
-
- self._do_statusbar_update(*daemon.GetConnectionStatus())
- self.wait_for_events(0.1)
- self.update_cb = misc.timeout_add(2, self.update_statusbar)
- self.refresh_clicked()
-
- def handle_connection_results(self, results):
- """Handle connection results."""
- if results not in ['success', 'aborted'] and self.is_visible:
- error(self.window, language[results], block=False)
-
- def create_adhoc_network(self, widget=None):
- """Shows a dialog that creates a new adhoc network."""
- print("Starting the Ad-Hoc Network Creation Process...")
- dialog = gtk.Dialog(
- title=_('Create an Ad-Hoc Network'),
- flags=gtk.DIALOG_MODAL,
- buttons=(gtk.STOCK_CANCEL, 2, gtk.STOCK_OK, 1)
- )
- dialog.set_has_separator(False)
- dialog.set_size_request(400, -1)
- self.chkbox_use_encryption = \
- gtk.CheckButton(_('Use Encryption (WEP only)'))
- self.chkbox_use_encryption.set_active(False)
- ip_entry = LabelEntry(_('IP') + ':')
- essid_entry = LabelEntry(_('ESSID') + ':')
- channel_entry = LabelEntry(_('Channel') + ':')
- self.key_entry = LabelEntry(_('Key') + ':')
- self.key_entry.set_auto_hidden(True)
- self.key_entry.set_sensitive(False)
-
- chkbox_use_ics = \
- gtk.CheckButton(_('Activate Internet Connection Sharing'))
-
- self.chkbox_use_encryption.connect("toggled",
- self.toggle_encrypt_check)
- channel_entry.entry.set_text('3')
- essid_entry.entry.set_text('My_Adhoc_Network')
- ip_entry.entry.set_text('169.254.12.10') # Just a random IP
-
- vbox_ah = gtk.VBox(False, 0)
- self.wired_network_box = gtk.VBox(False, 0)
- vbox_ah.pack_start(self.chkbox_use_encryption, False, False)
- vbox_ah.pack_start(self.key_entry, False, False)
- vbox_ah.show()
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(essid_entry)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(ip_entry)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(channel_entry)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(chkbox_use_ics)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(vbox_ah)
- # pylint: disable-msg=E1101
- dialog.vbox.set_spacing(5)
- dialog.show_all()
- response = dialog.run()
- if response == 1:
- wireless.CreateAdHocNetwork(
- essid_entry.entry.get_text(),
- channel_entry.entry.get_text(),
- ip_entry.entry.get_text().strip(),
- "WEP",
- self.key_entry.entry.get_text(),
- self.chkbox_use_encryption.get_active(),
- False) # chkbox_use_ics.get_active())
-
- dialog.destroy()
-
- def forget_network(self, widget=None):
- """
- Shows a dialog that lists saved wireless networks, and lets the user
- delete them.
- """
- wireless.ReloadConfig()
- dialog = gtk.Dialog(
- title=_('List of saved networks'),
- flags=gtk.DIALOG_MODAL,
- buttons=(gtk.STOCK_DELETE, 1, gtk.STOCK_OK, 2)
- )
- dialog.set_has_separator(True)
- dialog.set_size_request(400, 200)
-
- networks = gtk.ListStore(str, str)
- for entry in wireless.GetSavedWirelessNetworks():
- if entry[1] != 'None':
- networks.append(entry)
- else:
- networks.append((entry[0],
- _('Global settings for this ESSID')))
- tree = gtk.TreeView(model=networks)
- tree.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
-
- cell = gtk.CellRendererText()
-
- column = gtk.TreeViewColumn(_('ESSID'), cell, text=0)
- tree.append_column(column)
-
- column = gtk.TreeViewColumn(_('BSSID'), cell, text=1)
- tree.append_column(column)
-
- scroll = gtk.ScrolledWindow()
- scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scroll.add(tree)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(scroll)
- # pylint: disable-msg=E1101
- dialog.vbox.set_spacing(5)
- dialog.show_all()
- response = dialog.run()
- if response == 1:
- model, pathlist = tree.get_selection().get_selected_rows()
- to_remove = dict(essid=[], bssid=[])
- if pathlist:
- for row in pathlist:
- it = model.get_iter(path=row)
- to_remove['essid'].append(
- misc.noneToString(model.get_value(it, 0))
- )
- to_remove['bssid'].append(model.get_value(it, 1))
-
- confirm = gtk.MessageDialog(
- flags=gtk.DIALOG_MODAL,
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_YES_NO,
- message_format=_('Are you sure you want to discard '
- 'settings for the selected networks?'))
- confirm.format_secondary_text('\n'.join(to_remove['essid']))
- response = confirm.run()
- if response == gtk.RESPONSE_YES:
- for x in to_remove['bssid']:
- wireless.DeleteWirelessNetwork(x)
- wireless.ReloadConfig()
- confirm.destroy()
- dialog.destroy()
-
- def toggle_encrypt_check(self, widget=None):
- """Toggles the encryption key entry box for the ad-hoc dialog."""
- self.key_entry.set_sensitive(self.chkbox_use_encryption.get_active())
-
- def switch_rfkill(self, widget=None):
- """Switches wifi card on/off."""
- wireless.SwitchRfKill()
- if wireless.GetRfKillEnabled():
- self.rfkill_button.set_stock_id(gtk.STOCK_MEDIA_PLAY)
- self.rfkill_button.set_label(_('Switch On Wi-Fi'))
- else:
- self.rfkill_button.set_stock_id(gtk.STOCK_MEDIA_STOP)
- self.rfkill_button.set_label(_('Switch Off Wi-Fi'))
-
- def disconnect_all(self, widget=None):
- """Disconnects from any active network."""
- def handler(*args):
- gobject.idle_add(self.all_network_list.set_sensitive, True)
-
- self.all_network_list.set_sensitive(False)
- daemon.Disconnect(reply_handler=handler, error_handler=handler)
-
- def about_dialog(self, widget, event=None):
- """Displays an about dialog."""
- dialog = gtk.AboutDialog()
- dialog.set_name("Wicd")
- dialog.set_version(daemon.Hello())
- dialog.set_authors([
- "Tom Van Braeckel",
- "Adam Blackburn",
- "Dan O'Reilly",
- "Andrew Psaltis",
- "David Paleino"
- ])
- dialog.set_website("http://launchpad.net/wicd")
- dialog.run()
- dialog.destroy()
-
- def key_event(self, widget, event=None):
- """Handle key-release-events."""
- if event.state & gtk.gdk.CONTROL_MASK and \
- gtk.gdk.keyval_name(event.keyval) in ["w", "q"]:
- self.exit()
-
- def settings_dialog(self, widget, event=None):
- """Displays a general settings dialog."""
- if not self.pref:
- self.pref = PreferencesDialog(self, self.wTree)
- else:
- self.pref.load_preferences_diag()
- if self.pref.run() == 1:
- self.pref.save_results()
- self.pref.hide()
-
- def connect_hidden(self, widget):
- """Prompts the user for a hidden network, then scans for it."""
- dialog = gtk.Dialog(
- title=('Hidden Network'),
- flags=gtk.DIALOG_MODAL,
- buttons=(gtk.STOCK_CONNECT, 1, gtk.STOCK_CANCEL, 2)
- )
- dialog.set_has_separator(False)
- lbl = gtk.Label(_('Hidden Network ESSID'))
- textbox = gtk.Entry()
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(lbl)
- # pylint: disable-msg=E1101
- dialog.vbox.pack_start(textbox)
- dialog.show_all()
- button = dialog.run()
- if button == 1:
- answer = textbox.get_text()
- dialog.destroy()
- self.refresh_networks(None, True, answer)
- else:
- dialog.destroy()
-
- def cancel_connect(self, widget):
- """Alerts the daemon to cancel the connection process."""
- # should cancel a connection if there is one in progress
- cancel_button = self.wTree.get_object("cancel_button")
- cancel_button.set_sensitive(False)
- daemon.CancelConnect()
- # Prevents automatic reconnecting if that option is enabled
- daemon.SetForcedDisconnect(True)
-
- def pulse_progress_bar(self):
- """Pulses the progress bar while connecting to a network."""
- if not self.pulse_active:
- return False
- if not self.is_visible:
- return True
- try:
- gobject.idle_add(self.wTree.get_object("progressbar").pulse)
- except Exception:
- pass
- return True
-
- def update_statusbar(self):
- """Triggers a status update in wicd-monitor."""
- if not self.is_visible:
- return True
-
- daemon.UpdateState()
- if self.connecting:
- # If we're connecting, don't wait for the monitor to send
- # us a signal, since it won't until the connection is made.
- self._do_statusbar_update(*daemon.GetConnectionStatus())
- return True
-
- def _do_statusbar_update(self, state, info):
- """Actually perform the statusbar update."""
- if not self.is_visible:
- return True
-
- if state == misc.WIRED:
- return self.set_wired_state(info)
- elif state == misc.WIRELESS:
- return self.set_wireless_state(info)
- elif state == misc.CONNECTING:
- return self.set_connecting_state(info)
- elif state in (misc.SUSPENDED, misc.NOT_CONNECTED):
- return self.set_not_connected_state(info)
- return True
-
- def set_wired_state(self, info):
- """Set wired state."""
- if self.connecting:
- # Adjust our state from connecting->connected.
- self._set_not_connecting_state()
- self.set_status(
- _('Connected to wired network (IP: $A)').replace('$A', info[0])
- )
- return True
-
- def set_wireless_state(self, info):
- """Set wireless state."""
- if self.connecting:
- # Adjust our state from connecting->connected.
- self._set_not_connecting_state()
- self.set_status(_('Connected to $A at $B (IP: $C)').replace
- ('$A', info[1]).replace
- ('$B', daemon.FormatSignalForPrinting(info[2])).replace
- ('$C', info[0]))
- return True
-
- def set_not_connected_state(self, info):
- """Set not connected state."""
- if self.connecting:
- # Adjust our state from connecting->not-connected.
- self._set_not_connecting_state()
- self.set_status(_('Not connected'))
- return True
-
- def _set_not_connecting_state(self):
- """Set not-connecting state."""
- if self.connecting:
- if self.update_cb:
- gobject.source_remove(self.update_cb)
- self.update_cb = misc.timeout_add(2, self.update_statusbar)
- self.connecting = False
- if self.pulse_active:
- self.pulse_active = False
- gobject.idle_add(self.all_network_list.set_sensitive, True)
- gobject.idle_add(self.status_area.hide_all)
- if self.statusID:
- gobject.idle_add(self.status_bar.remove_message, 1, self.statusID)
-
- def set_connecting_state(self, info):
- """Set connecting state."""
- if not self.connecting:
- if self.update_cb:
- gobject.source_remove(self.update_cb)
- self.update_cb = misc.timeout_add(500, self.update_statusbar,
- milli=True)
- self.connecting = True
- if not self.pulse_active:
- self.pulse_active = True
- misc.timeout_add(100, self.pulse_progress_bar, milli=True)
- gobject.idle_add(self.all_network_list.set_sensitive, False)
- gobject.idle_add(self.status_area.show_all)
- if self.statusID:
- gobject.idle_add(self.status_bar.remove_message, 1, self.statusID)
- if info[0] == "wireless":
- stat = wireless.CheckWirelessConnectingMessage()
- gobject.idle_add(self.set_status, "%s: %s" % (info[1], stat))
- elif info[0] == "wired":
- gobject.idle_add(self.set_status, _('Wired Network') + ': ' +
- wired.CheckWiredConnectingMessage())
- return True
-
- def update_connect_buttons(self, state=None, x=None, force_check=False):
- """Updates the connect/disconnect buttons for the GUI.
-
- If force_check is given, update the buttons even if the
- current network state is the same as the previous.
-
- """
- if not DBUS_AVAIL:
- return
- if not state:
- state, x = daemon.GetConnectionStatus()
-
- self.disconnect_all_button.set_sensitive(
- state in [misc.WIRED, misc.WIRELESS]
- )
- if self.prev_state != state or force_check:
- apbssid = wireless.GetApBssid()
- for entry in chain(self.network_list, self.wired_network_box):
- if hasattr(entry, "update_connect_button"):
- entry.update_connect_button(state, apbssid)
- self.prev_state = state
-
- def set_status(self, msg):
- """Sets the status bar message for the GUI."""
- self.statusID = self.status_bar.push(1, msg)
-
- def dbus_scan_finished(self):
- """Calls for a non-fresh update of the gui window.
-
- This method is called after a wireless scan is completed.
-
- """
- if not DBUS_AVAIL:
- return
- gobject.idle_add(self.refresh_networks, None, False, None)
-
- def dbus_scan_started(self):
- """Called when a wireless scan starts."""
- if not DBUS_AVAIL:
- return
- self.network_list.set_sensitive(False)
-
- def _remove_items_from_vbox(self, vbox):
- """Remove items fro a VBox."""
- for z in vbox:
- vbox.remove(z)
- z.destroy()
- del z
-
- def refresh_clicked(self, widget=None):
- """Kick off an asynchronous wireless scan."""
- if not DBUS_AVAIL or self.connecting:
- return
- self.refreshing = True
-
- # Remove stuff already in there.
- self._remove_items_from_vbox(self.wired_network_box)
- self._remove_items_from_vbox(self.network_list)
- label = gtk.Label("%s..." % _('Scanning'))
- self.network_list.pack_start(label)
- self.network_list.show_all()
- if wired.CheckPluggedIn() or daemon.GetAlwaysShowWiredInterface():
- printLine = True # In this case we print a separator.
- wirednet = WiredNetworkEntry()
- self.wired_network_box.pack_start(wirednet, False, False)
- wirednet.connect_button.connect("clicked", self.connect,
- "wired", 0, wirednet)
- wirednet.disconnect_button.connect("clicked", self.disconnect,
- "wired", 0, wirednet)
- wirednet.advanced_button.connect("clicked",
- self.edit_advanced, "wired", 0,
- wirednet)
- state, x = daemon.GetConnectionStatus()
- wirednet.update_connect_button(state)
-
- self._wired_showing = True
- else:
- self._wired_showing = False
-
- wireless.Scan(False)
-
- def refresh_networks(self, widget=None, fresh=True, hidden=None):
- """Refreshes the network list.
-
- If fresh=True, scans for wireless networks and displays the results.
- If a ethernet connection is available, or the user has chosen to,
- displays a Wired Network entry as well.
- If hidden isn't None, will scan for networks after running
- iwconfig essid .
-
- """
- if fresh:
- if hidden:
- wireless.SetHiddenNetworkESSID(noneToString(hidden))
- self.refresh_clicked()
- return
- print("refreshing...")
- self.network_list.set_sensitive(False)
- self._remove_items_from_vbox(self.network_list)
- self.wait_for_events()
- printLine = False # We don't print a separator by default.
- if self._wired_showing:
- printLine = True
- num_networks = wireless.GetNumberOfNetworks()
- instruct_label = self.wTree.get_object("label_instructions")
- if num_networks > 0:
- skip_never_connect = not daemon.GetShowNeverConnect()
- instruct_label.show()
- for x in range(0, num_networks):
- if skip_never_connect and \
- misc.to_bool(get_wireless_prop(x, 'never')):
- continue
- if printLine:
- sep = gtk.HSeparator()
- self.network_list.pack_start(sep, padding=10, fill=False,
- expand=False)
- sep.show()
- else:
- printLine = True
- tempnet = WirelessNetworkEntry(x)
- self.network_list.pack_start(tempnet, False, False)
- tempnet.connect_button.connect("clicked",
- self.connect, "wireless", x,
- tempnet)
- tempnet.disconnect_button.connect("clicked",
- self.disconnect, "wireless",
- x, tempnet)
- tempnet.advanced_button.connect("clicked",
- self.edit_advanced, "wireless",
- x, tempnet)
- else:
- instruct_label.hide()
- if wireless.GetKillSwitchEnabled():
- label = gtk.Label(_('Wireless Kill Switch Enabled') + ".")
- else:
- label = gtk.Label(_('No wireless networks found.'))
- self.network_list.pack_start(label)
- label.show()
- self.update_connect_buttons(force_check=True)
- self.network_list.set_sensitive(True)
- self.refreshing = False
-
- def save_settings(self, nettype, networkid, networkentry):
- """Verifies and saves the settings for the network entry."""
- entry = networkentry.advanced_dialog
- opt_entlist = []
- req_entlist = []
-
- # First make sure all the Addresses entered are valid.
- if entry.chkbox_static_ip.get_active():
- req_entlist = [entry.txt_ip, entry.txt_netmask]
- opt_entlist = [entry.txt_gateway]
-
- if entry.chkbox_static_dns.get_active() and \
- not entry.chkbox_global_dns.get_active():
- for ent in [entry.txt_dns_1, entry.txt_dns_2, entry.txt_dns_3]:
- opt_entlist.append(ent)
-
- # Required entries.
- for lblent in req_entlist:
- lblent.set_text(lblent.get_text().strip())
- if not misc.IsValidIP(lblent.get_text()):
- error(self.window, _('Invalid address in $A entry.').
- replace('$A', lblent.label.get_label()))
- return False
-
- # Optional entries, only check for validity if they're entered.
- for lblent in opt_entlist:
- lblent.set_text(lblent.get_text().strip())
- if lblent.get_text() and not misc.IsValidIP(lblent.get_text()):
- error(self.window, _('Invalid address in $A entry.').
- replace('$A', lblent.label.get_label()))
- return False
-
- # Now save the settings.
- if nettype == "wireless":
- if not networkentry.save_wireless_settings(networkid):
- return False
-
- elif nettype == "wired":
- if not networkentry.save_wired_settings():
- return False
-
- return True
-
- def edit_advanced(self, widget, ttype, networkid, networkentry):
- """Display the advanced settings dialog.
-
- Displays the advanced settings dialog and saves any changes made.
- If errors occur in the settings, an error message will be displayed
- and the user won't be able to save the changes until the errors
- are fixed.
-
- """
- dialog = networkentry.advanced_dialog
- dialog.set_values()
- dialog.show_all()
- while True:
- if self.run_settings_dialog(dialog, ttype, networkid,
- networkentry):
- break
- dialog.hide()
-
- def run_settings_dialog(self, dialog, nettype, networkid, networkentry):
- """Runs the settings dialog.
-
- Runs the settings dialog and returns True if settings are saved
- successfully, and false otherwise.
-
- """
- result = dialog.run()
- if result == gtk.RESPONSE_ACCEPT:
- if self.save_settings(nettype, networkid, networkentry):
- return True
- else:
- return False
- return True
-
- def check_encryption_valid(self, networkid, entry):
- """Make sure that encryption settings are properly filled in."""
- # Make sure no entries are left blank
- if entry.chkbox_encryption.get_active():
- encryption_info = entry.encryption_info
- for entry_info in list(encryption_info.values()):
- if entry_info[0].entry.get_text() == "" and \
- entry_info[1] == 'required':
- error(self.window, "%s (%s)" %
- (_('Required encryption information is missing.'),
- entry_info[0].label.get_label()))
- return False
- # Make sure the checkbox is checked when it should be
- elif (not entry.chkbox_encryption.get_active() and
- wireless.GetWirelessProperty(networkid, "encryption")):
- error(self.window, _('This network requires encryption to be '
- 'enabled.'))
- return False
- return True
-
- def _wait_for_connect_thread_start(self):
- """Wait for the connect thread to start."""
- self.wTree.get_object("progressbar").pulse()
- if not self._connect_thread_started:
- return True
- else:
- misc.timeout_add(2, self.update_statusbar)
- self.update_statusbar()
- return False
-
- def connect(self, widget, nettype, networkid, networkentry):
- """Initiates the connection process in the daemon."""
- def handler(*args):
- self._connect_thread_started = True
-
- def setup_interface_for_connection():
- """Initialize interface for connection."""
- cancel_button = self.wTree.get_object("cancel_button")
- cancel_button.set_sensitive(True)
- self.all_network_list.set_sensitive(False)
- if self.statusID:
- gobject.idle_add(
- self.status_bar.remove_message, 1, self.statusID)
- gobject.idle_add(
- self.set_status, _('Disconnecting active connections...'))
- gobject.idle_add(self.status_area.show_all)
- self.wait_for_events()
- self._connect_thread_started = False
-
- if nettype == "wireless":
- if not self.check_encryption_valid(networkid,
- networkentry.advanced_dialog):
- self.edit_advanced(None, nettype, networkid, networkentry)
- return False
- setup_interface_for_connection()
- wireless.ConnectWireless(networkid, reply_handler=handler,
- error_handler=handler)
- elif nettype == "wired":
- setup_interface_for_connection()
- wired.ConnectWired(reply_handler=handler, error_handler=handler)
-
- gobject.source_remove(self.update_cb)
- misc.timeout_add(100, self._wait_for_connect_thread_start, milli=True)
-
- def disconnect(self, widget, nettype, networkid, networkentry):
- """Disconnects from the given network.
-
- Keyword arguments:
- widget -- The disconnect button that was pressed.
- event -- unused
- nettype -- "wired" or "wireless", depending on the network entry type.
- networkid -- unused
- networkentry -- The NetworkEntry containing the disconnect button.
-
- """
- def handler(*args):
- gobject.idle_add(self.all_network_list.set_sensitive, True)
- gobject.idle_add(self.network_list.set_sensitive, True)
-
- widget.hide()
- networkentry.connect_button.show()
- daemon.SetForcedDisconnect(True)
- self.network_list.set_sensitive(False)
- if nettype == "wired":
- wired.DisconnectWired(reply_handler=handler, error_handler=handler)
- else:
- wireless.DisconnectWireless(reply_handler=handler,
- error_handler=handler)
-
- def wait_for_events(self, amt=0):
- """Wait for any pending gtk events to finish before moving on.
-
- Keyword arguments:
- amt -- a number specifying the number of ms to wait before checking
- for pending events.
-
- """
- time.sleep(amt)
- while gtk.events_pending():
- gtk.main_iteration()
-
- def exit(self, widget=None, event=None):
- """Hide the wicd GUI.
-
- This method hides the wicd GUI and writes the current window size
- to disc for later use. This method normally does NOT actually
- destroy the GUI, it just hides it.
-
- """
- self.window.hide()
- gobject.source_remove(self.update_cb)
- bus.remove_signal_receiver(self._do_statusbar_update, 'StatusChanged',
- 'org.wicd.daemon')
- [width, height] = self.window.get_size()
- try:
- daemon.SetGUIOpen(False)
- except DBusException:
- pass
-
- if self.standalone:
- sys.exit(0)
-
- self.is_visible = False
- return True
-
- def show_win(self):
- """Brings the GUI out of the hidden state.
-
- Method to show the wicd GUI, alert the daemon that it is open,
- and refresh the network list.
-
- """
- self.window.present()
- self.window.deiconify()
- self.wait_for_events()
- self.is_visible = True
- daemon.SetGUIOpen(True)
- self.wait_for_events(0.1)
- gobject.idle_add(self.refresh_clicked)
- self._do_statusbar_update(*daemon.GetConnectionStatus())
- bus.add_signal_receiver(self._do_statusbar_update, 'StatusChanged',
- 'org.wicd.daemon')
- self.update_cb = misc.timeout_add(2, self.update_statusbar)
-
-
-if __name__ == '__main__':
- setup_dbus()
- app = appGui(standalone=True)
- mainloop = gobject.MainLoop()
- mainloop.run()
diff --git a/gtk/guiutil.py b/gtk/guiutil.py
deleted file mode 100644
index 6fefa55..0000000
--- a/gtk/guiutil.py
+++ /dev/null
@@ -1,288 +0,0 @@
-"""guiutil - A collection of commonly used gtk/gui functions and classes."""
-#
-# Copyright (C) 2007 - 2009 Adam Blackburn
-# Copyright (C) 2007 - 2009 Dan O'Reilly
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License Version 2 as
-# published by the Free Software Foundation.
-#
-# 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, see .
-#
-
-import gtk
-import os.path
-
-import wicd.wpath as wpath
-
-HAS_NOTIFY = True
-try:
- import pynotify
- if not pynotify.init("Wicd"):
- print('Could not initalize pynotify')
- HAS_NOTIFY = False
-except ImportError:
- print("Importing pynotify failed, notifications disabled.")
- HAS_NOTIFY = False
-
-print(("Has notifications support", HAS_NOTIFY))
-
-if wpath.no_use_notifications:
- print('Notifications disabled during setup.py configure')
-
-
-def can_use_notify():
- """Check whether WICD is allowed to use notifications."""
- use_notify = os.path.exists(os.path.join(os.path.expanduser('~/.wicd'),
- 'USE_NOTIFICATIONS')
- )
- return use_notify and HAS_NOTIFY and not wpath.no_use_notifications
-
-
-def error(parent, message, block=True):
- """Shows an error dialog."""
- def delete_event(dialog, i):
- """Handle dialog destroy."""
- dialog.destroy()
-
- if can_use_notify() and not block:
- notification = pynotify.Notification("ERROR", message, "error")
- notification.show()
- return
- dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,
- gtk.BUTTONS_OK)
- dialog.set_markup(message)
- if not block:
- dialog.present()
- dialog.connect("response", delete_event)
- else:
- dialog.run()
- dialog.destroy()
-
-
-def alert(parent, message, block=True):
- """Shows an warning dialog."""
- def delete_event(dialog, i):
- """Handle dialog destroy."""
- dialog.destroy()
-
- dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING,
- gtk.BUTTONS_OK)
- dialog.set_markup(message)
- if not block:
- dialog.present()
- dialog.connect("response", delete_event)
- else:
- dialog.run()
- dialog.destroy()
-
-
-def string_input(prompt, secondary, textbox_label):
- """Dialog with a label and an entry."""
- # based on a version of a PyGTK text entry from
- # http://ardoris.wordpress.com/2008/07/05/pygtk-text-entry-dialog/
-
- def dialog_response(entry, dialog, response):
- """Handle dialog response."""
- dialog.response(response)
-
- dialog = gtk.MessageDialog(
- None,
- gtk.DIALOG_MODAL,
- gtk.MESSAGE_QUESTION,
- gtk.BUTTONS_OK_CANCEL,
- None)
-
- # set the text
- dialog.set_markup("" + prompt + "")
- # add the secondary text
- dialog.format_secondary_markup(secondary)
-
- entry = gtk.Entry()
- # allow the user to press enter instead of clicking OK
- entry.connect("activate", dialog_response, dialog, gtk.RESPONSE_OK)
-
- # create an hbox and pack the label and entry in
- hbox = gtk.HBox()
- hbox.pack_start(gtk.Label(textbox_label), False, 4, 4)
- hbox.pack_start(entry)
-
- # pack the boxes and show the dialog
- # pylint: disable-msg=E1101
- dialog.vbox.pack_end(hbox, True, True, 0)
- dialog.show_all()
-
- if dialog.run() == gtk.RESPONSE_OK:
- text = entry.get_text()
- dialog.destroy()
- return text
- else:
- dialog.destroy()
- return None
-
-
-class SmallLabel(gtk.Label):
- """Small GtkLabel."""
- def __init__(self, text=''):
- gtk.Label.__init__(self, text)
- self.set_size_request(50, -1)
-
-
-class LeftAlignedLabel(gtk.Label):
- """GtkLabel with text aligned to left."""
- def __init__(self, label=None):
- gtk.Label.__init__(self, label)
- self.set_alignment(0.0, 0.5)
-
-
-class LabelEntry(gtk.HBox):
- """A label on the left with a textbox on the right."""
- def __init__(self, text):
- gtk.HBox.__init__(self)
- self.entry = gtk.Entry()
- self.entry.set_size_request(200, -1)
- self.label = LeftAlignedLabel()
- self.label.set_text(text)
- self.label.set_size_request(170, -1)
- self.pack_start(self.label, fill=True, expand=True)
- self.pack_start(self.entry, fill=False, expand=False)
- self.label.show()
- self.entry.show()
- self.entry.connect('focus-out-event', self.hide_characters)
- self.entry.connect('focus-in-event', self.show_characters)
- self.auto_hide_text = False
- self.show()
-
- def set_text(self, text):
- """Set text of the GtkEntry."""
- # For compatibility...
- self.entry.set_text(text)
-
- def get_text(self):
- """Get text of the GtkEntry."""
- return self.entry.get_text()
-
- def set_auto_hidden(self, value):
- """Set auto-hide of the text of GtkEntry."""
- self.entry.set_visibility(False)
- self.auto_hide_text = value
-
- def show_characters(self, widget=None, event=None):
- """When the box has focus, show the characters."""
- if self.auto_hide_text and widget:
- self.entry.set_visibility(True)
-
- def set_sensitive(self, value):
- """Set sensitivity of the widget."""
- self.entry.set_sensitive(value)
- self.label.set_sensitive(value)
-
- def hide_characters(self, widget=None, event=None):
- """When the box looses focus, hide them."""
- if self.auto_hide_text and widget:
- self.entry.set_visibility(False)
-
-
-class GreyLabel(gtk.Label):
- """Creates a grey gtk.Label."""
- def __init__(self):
- gtk.Label.__init__(self)
-
- 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):
- """Set text of the GtkEntry."""
- # For compatibility...
- self.entry.set_text(text)
-
- def get_entry_text(self):
- """Get text of the GtkEntry."""
- return self.entry.get_text()
-
- def set_sensitive(self, value):
- """Set sensitivity of the widget."""
- self.entry.set_sensitive(value)
- self.label.set_sensitive(value)
- self.check.set_sensitive(value)
-
- def click_handler(self, widget=None, event=None):
- """Handle clicks."""
- active = self.check.get_active()
- self.entry.set_visibility(active)
-
-
-class LabelCombo(gtk.HBox):
- """A label on the left with a combobox on the right."""
-
- def __init__(self, text):
- gtk.HBox.__init__(self)
- self.combo = gtk.ComboBox()
- self.combo.set_size_request(200, -1)
- self.label = LeftAlignedLabel()
- self.label.set_text(text)
- self.label.set_size_request(170, -1)
- cell = gtk.CellRendererText()
- self.combo.pack_start(cell, True)
- self.combo.add_attribute(cell, 'text', 0)
- self.pack_start(self.label, fill=True, expand=True)
- self.pack_start(self.combo, fill=False, expand=False)
- self.label.show()
- self.combo.show()
- self.show()
-
- def get_active(self):
- """Return the selected item in the GtkComboBox."""
- return self.combo.get_active()
-
- def set_active(self, index):
- """Set given item in the GtkComboBox."""
- self.combo.set_active(index)
-
- def get_active_text(self):
- """Return the selected item's text in the GtkComboBox."""
- return self.combo.get_active_text()
-
- def get_model(self):
- """Return the GtkComboBox's model."""
- return self.combo.get_model()
-
- def set_model(self, model=None):
- """Set the GtkComboBox's model."""
- self.combo.set_model(model)
-
- def set_sensitive(self, value):
- """Set sensitivity of the widget."""
- self.combo.set_sensitive(value)
- self.label.set_sensitive(value)
diff --git a/gtk/netentry.py b/gtk/netentry.py
deleted file mode 100644
index 2e0701c..0000000
--- a/gtk/netentry.py
+++ /dev/null
@@ -1,1311 +0,0 @@
-"""netentry -- Network entry widgets for the GUI.
-
-This module provides GUI widgets used to represent wired and wireless
-entries in the GUI's network list, as well as any settings dialogs
-contained within them.
-
-"""
-#
-# Copyright (C) 2008-2009 Adam Blackburn
-# Copyright (C) 2008-2009 Dan O'Reilly
-# Copyright (C) 2009 Andrew Psaltis
-# Copyright (C) 2011 David Paleino
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License Version 2 as
-# published by the Free Software Foundation.
-#
-# 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, see .
-#
-import os
-
-import gtk
-
-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
-from guiutil import string_input, ProtectedLabelEntry, LabelCombo
-
-from wicd.translations import language, _
-
-# These get set when a NetworkEntry is instantiated.
-daemon = None
-wired = None
-wireless = None
-
-
-def setup_dbus():
- """Initialize DBus."""
- global daemon, wireless, wired
- daemon = dbusmanager.get_interface('daemon')
- wireless = dbusmanager.get_interface('wireless')
- wired = dbusmanager.get_interface('wired')
-
-
-class AdvancedSettingsDialog(gtk.Dialog):
- """Advanced settings dialog."""
- def __init__(self, network_name=None):
- """Build the base advanced settings dialog.
-
- This class isn't used by itself, instead it is used as a parent for
- the WiredSettingsDialog and WirelessSettingsDialog.
-
- """
- # if no network name was passed, just use Properties as the title
- if network_name:
- title = '%s - %s' % (network_name, _('Properties'))
- else:
- title = _('Properties')
-
- gtk.Dialog.__init__(
- self,
- title=title,
- flags=gtk.DIALOG_MODAL,
- buttons=(
- gtk.STOCK_CANCEL,
- gtk.RESPONSE_REJECT,
- gtk.STOCK_OK,
- gtk.RESPONSE_ACCEPT
- )
- )
-
- self.set_default_size()
-
- self.connect('show', lambda *a, **k: self.set_default_size())
-
- # Set up the Advanced Settings Dialog.
- self.txt_ip = LabelEntry(_('IP'))
- self.txt_ip.entry.connect('focus-out-event', self.set_defaults)
- self.txt_netmask = LabelEntry(_('Netmask'))
- self.txt_gateway = LabelEntry(_('Gateway'))
- self.txt_search_dom = LabelEntry(_('Search domain'))
- self.txt_domain = LabelEntry(_('DNS domain'))
- self.txt_dns_1 = LabelEntry(_('DNS server') + ' 1')
- self.txt_dns_2 = LabelEntry(_('DNS server') + ' 2')
- self.txt_dns_3 = LabelEntry(_('DNS server') + ' 3')
- dhcp_hostname_hbox = gtk.HBox(False, 0)
- self.chkbox_use_dhcp_hostname = gtk.CheckButton()
- self.txt_dhcp_hostname = LabelEntry("DHCP Hostname")
- dhcp_hostname_hbox.pack_start(
- self.chkbox_use_dhcp_hostname, fill=False, expand=False)
- dhcp_hostname_hbox.pack_start(self.txt_dhcp_hostname)
- self.chkbox_static_ip = gtk.CheckButton(_('Use Static IPs'))
- self.chkbox_static_dns = gtk.CheckButton(_('Use Static DNS'))
- self.chkbox_global_dns = gtk.CheckButton(_('Use global DNS servers'))
- self.hbox_dns = gtk.HBox(False, 0)
- self.hbox_dns.pack_start(self.chkbox_static_dns)
- self.hbox_dns.pack_start(self.chkbox_global_dns)
-
- # Set up the script settings button
- self.script_button = gtk.Button()
- script_image = gtk.Image()
- script_image.set_from_stock(gtk.STOCK_EXECUTE, 4)
- script_image.set_padding(4, 0)
- # self.script_button.set_alignment(.5, .5)
- self.script_button.set_image(script_image)
- self.script_button.set_label(_('Scripts'))
-
- self.button_hbox = gtk.HBox(False, 2)
- self.button_hbox.pack_start(
- self.script_button, fill=False, expand=False)
- self.button_hbox.show()
-
- self.swindow = gtk.ScrolledWindow()
- self.swindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- self.viewport = gtk.Viewport()
- self.viewport.set_shadow_type(gtk.SHADOW_NONE)
- self.cvbox = gtk.VBox()
- self.viewport.add(self.cvbox)
- self.swindow.add(self.viewport)
- # pylint: disable-msg=E1101
- self.vbox.pack_start(self.swindow)
-
- assert(isinstance(self.cvbox, gtk.VBox))
- self.cvbox.pack_start(self.chkbox_static_ip, fill=False, expand=False)
- self.cvbox.pack_start(self.txt_ip, fill=False, expand=False)
- self.cvbox.pack_start(self.txt_netmask, fill=False, expand=False)
- self.cvbox.pack_start(self.txt_gateway, fill=False, expand=False)
- self.cvbox.pack_start(self.hbox_dns, fill=False, expand=False)
- self.cvbox.pack_start(self.txt_domain, fill=False, expand=False)
- self.cvbox.pack_start(self.txt_search_dom, fill=False, expand=False)
- self.cvbox.pack_start(self.txt_dns_1, fill=False, expand=False)
- self.cvbox.pack_start(self.txt_dns_2, fill=False, expand=False)
- self.cvbox.pack_start(self.txt_dns_3, fill=False, expand=False)
- self.cvbox.pack_start(dhcp_hostname_hbox, fill=False, expand=False)
- self.cvbox.pack_end(
- self.button_hbox, fill=False, expand=False, padding=5)
-
- # Connect the events to the actions
- self.chkbox_static_ip.connect("toggled", self.toggle_ip_checkbox)
- self.chkbox_static_dns.connect("toggled", self.toggle_dns_checkbox)
- self.chkbox_global_dns.connect(
- "toggled", self.toggle_global_dns_checkbox)
- self.chkbox_use_dhcp_hostname.connect(
- 'toggled',
- self.toggle_dhcp_hostname_checkbox
- )
-
- # Start with all disabled, then they will be enabled later.
- self.chkbox_static_ip.set_active(False)
- self.chkbox_static_dns.set_active(False)
-
- def set_default_size(self):
- """Set default window size."""
- width, height = self.get_size()
- s_height = gtk.gdk.screen_height()
- if s_height < 768:
- height = s_height * .75
- else:
- height = 600
- self.resize(int(width), int(height))
-
- def set_defaults(self, widget=None, event=None):
- """Put some default values into entries to help the user out."""
- self.txt_ip.set_text(self.txt_ip.get_text().strip())
- ip = self.txt_ip.get_text() # For easy typing :)
- netmask = self.txt_netmask
- gateway = self.txt_gateway
- if misc.IsValidIP(ip):
- # Only do these things if it's IPv4
- if misc.IsValidIPv4(ip):
- # Make sure the gateway box is blank
- if stringToNone(gateway.get_text()) is None:
- # Fill it in with a .1 at the end
- gateway.set_text(ip[:ip.rindex('.')] + '.1')
-
- # Make sure the netmask is blank
- if stringToNone(netmask.get_text()) is None:
- # Fill in the most common one
- if ip.startswith('172'):
- netmask.set_text('255.240.0.0')
- elif ip.startswith('10'):
- netmask.set_text('255.0.0.0')
- else:
- # 192.168 and all other cases
- netmask.set_text('255.255.255.0')
- elif ip != '':
- error(None, _('Invalid IP address entered.'))
-
- def reset_static_checkboxes(self):
- """Enable the right stuff."""
- if stringToNone(self.txt_ip.get_text()):
- self.chkbox_static_ip.set_active(True)
- self.chkbox_static_dns.set_active(True)
- self.chkbox_static_dns.set_sensitive(False)
- else:
- self.chkbox_static_ip.set_active(False)
- self.chkbox_static_dns.set_sensitive(True)
-
- if stringToNone(self.txt_dns_1.get_text()) or \
- self.chkbox_global_dns.get_active():
- self.chkbox_static_dns.set_active(True)
- else:
- self.chkbox_static_dns.set_active(False)
-
- # This will properly disable unused boxes.
- self.toggle_ip_checkbox()
- self.toggle_dns_checkbox()
- self.toggle_global_dns_checkbox()
-
- def toggle_ip_checkbox(self, widget=None):
- """Toggle entries/checkboxes based on the static IP checkbox."""
- # Should disable the static IP text boxes, and also enable the DNS
- # checkbox when disabled and disable when enabled.
- if self.chkbox_static_ip.get_active():
- self.chkbox_static_dns.set_active(True)
- self.chkbox_static_dns.set_sensitive(False)
- else:
- self.chkbox_static_dns.set_sensitive(True)
-
- self.txt_ip.set_sensitive(self.chkbox_static_ip.get_active())
- self.txt_netmask.set_sensitive(self.chkbox_static_ip.get_active())
- self.txt_gateway.set_sensitive(self.chkbox_static_ip.get_active())
-
- def toggle_dns_checkbox(self, widget=None):
- """Toggle entries and checkboxes based on the static dns checkbox."""
- # Should disable the static DNS boxes
- if self.chkbox_static_ip.get_active():
- self.chkbox_static_dns.set_active(True)
- self.chkbox_static_dns.set_sensitive(False)
-
- self.chkbox_global_dns.set_sensitive(self.chkbox_static_dns.
- get_active())
-
- search_list = [self.txt_dns_1, self.txt_dns_2, self.txt_dns_3,
- self.txt_domain, self.txt_search_dom]
- if self.chkbox_static_dns.get_active():
- # If global dns is on, don't use local dns
- for w in search_list:
- w.set_sensitive(not self.chkbox_global_dns.get_active())
- else:
- for w in search_list:
- w.set_sensitive(False)
- self.chkbox_global_dns.set_active(False)
-
- def toggle_dhcp_hostname_checkbox(self, widget=None):
- """Set widget sensitivity."""
- self.txt_dhcp_hostname.set_sensitive(
- self.chkbox_use_dhcp_hostname.get_active())
-
- def toggle_global_dns_checkbox(self, widget=None):
- """Set the DNS entries' sensitivity based on the Global checkbox."""
- global_dns_active = daemon.GetUseGlobalDNS()
- if not global_dns_active and self.chkbox_global_dns.get_active():
- error(
- None,
- _('Global DNS has not been enabled in general preferences.')
- )
- self.chkbox_global_dns.set_active(False)
- if daemon.GetUseGlobalDNS() and self.chkbox_static_dns.get_active():
- for w in [self.txt_dns_1, self.txt_dns_2, self.txt_dns_3,
- self.txt_domain, self.txt_search_dom]:
- w.set_sensitive(not self.chkbox_global_dns.get_active())
-
- def toggle_encryption(self, widget=None):
- """
- Toggle the encryption combobox based on the encryption checkbox.
- """
- active = self.chkbox_encryption.get_active()
- self.vbox_encrypt_info.set_sensitive(active)
- self.combo_encryption.set_sensitive(active)
-
- def destroy_called(self, *args):
- """Clean up everything."""
- super(AdvancedSettingsDialog, self).destroy()
- self.destroy()
- del self
-
- def save_settings(self, networkid=None):
- """Save settings common to wired and wireless settings dialogs."""
- if self.chkbox_static_ip.get_active():
- self.set_net_prop("ip", noneToString(self.txt_ip.get_text()))
- self.set_net_prop(
- "netmask", noneToString(self.txt_netmask.get_text()))
- self.set_net_prop(
- "gateway", noneToString(self.txt_gateway.get_text()))
- else:
- self.set_net_prop("ip", '')
- self.set_net_prop("netmask", '')
- self.set_net_prop("gateway", '')
-
- if self.chkbox_static_dns.get_active() and \
- not self.chkbox_global_dns.get_active():
- self.set_net_prop('use_static_dns', True)
- self.set_net_prop('use_global_dns', False)
- self.set_net_prop(
- 'dns_domain', noneToString(self.txt_domain.get_text()))
- self.set_net_prop(
- "search_domain", noneToString(self.txt_search_dom.get_text()))
- self.set_net_prop("dns1", noneToString(self.txt_dns_1.get_text()))
- self.set_net_prop("dns2", noneToString(self.txt_dns_2.get_text()))
- self.set_net_prop("dns3", noneToString(self.txt_dns_3.get_text()))
- elif (self.chkbox_static_dns.get_active() and
- self.chkbox_global_dns.get_active()):
- self.set_net_prop('use_static_dns', True)
- self.set_net_prop('use_global_dns', True)
- else:
- self.set_net_prop('use_static_dns', False)
- self.set_net_prop('use_global_dns', False)
- self.set_net_prop('dns_domain', '')
- self.set_net_prop("search_domain", '')
- self.set_net_prop("dns1", '')
- self.set_net_prop("dns2", '')
- self.set_net_prop("dns3", '')
- self.set_net_prop('usedhcphostname',
- self.chkbox_use_dhcp_hostname.get_active())
- self.set_net_prop("dhcphostname", noneToString(self.txt_dhcp_hostname.
- get_text()))
-
- def change_encrypt_method(self, widget=None):
- """Load all the entries for a given encryption method."""
- for z in self.vbox_encrypt_info:
- z.destroy() # Remove stuff in there already
- ID = self.combo_encryption.get_active()
- methods = self.encrypt_types
- self.encryption_info = {}
-
- # If nothing is selected, select the first entry.
- if ID == -1:
- self.combo_encryption.set_active(0)
- ID = 0
-
- for type_ in ['required', 'optional']:
- fields = methods[ID][type_]
- for field in fields:
- try:
- field_text = language[field[1].lower().replace(' ', '_')]
- except KeyError:
- 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
- # data.
- self.encryption_info[field[0]] = [box, type_]
-
- if self.wired:
- box.entry.set_text(noneToBlankString(
- wired.GetWiredProperty(field[0])))
- else:
- box.entry.set_text(
- noneToBlankString(wireless.
- GetWirelessProperty(self.networkID,
- field[0])))
- self.vbox_encrypt_info.show_all()
-
-
-class WiredSettingsDialog(AdvancedSettingsDialog):
- """Wired settings dialog."""
- def __init__(self, name):
- """Build the wired settings dialog."""
- AdvancedSettingsDialog.__init__(self, _('Wired Network'))
-
- # So we can test if we are wired or wireless (for
- # change_encrypt_method())
- self.wired = True
-
- # This section is largely copied from WirelessSettingsDialog, but with
- # some changes
- #
- # Set up encryption stuff
- self.combo_encryption = gtk.combo_box_new_text()
- self.chkbox_encryption = gtk.CheckButton(_('Use Encryption'))
- # Make the vbox to hold the encryption stuff.
- self.vbox_encrypt_info = gtk.VBox(False, 0)
- self.chkbox_encryption.set_active(
- bool(wired.GetWiredProperty('encryption_enabled')))
- self.combo_encryption.set_sensitive(False)
- self.encrypt_types = misc.LoadEncryptionMethods(wired=True)
-
- # Build the encryption menu
- for x, enc_type in enumerate(self.encrypt_types):
- self.combo_encryption.append_text(enc_type['name'])
- self.combo_encryption.set_active(0)
- self.change_encrypt_method()
- self.toggle_encryption()
-
- self.cvbox.pack_start(self.chkbox_encryption, False, False)
- self.cvbox.pack_start(self.combo_encryption, False, False)
- self.cvbox.pack_start(self.vbox_encrypt_info, False, False)
-
- # Connect signals.
- self.chkbox_encryption.connect("toggled", self.toggle_encryption)
- self.combo_encryption.connect("changed", self.change_encrypt_method)
-
- self.des = self.connect("destroy", self.destroy_called)
- self.script_button.connect("clicked", self.edit_scripts)
- self.prof_name = name
-
- def set_net_prop(self, option, value):
- """Sets the given option to the given value for this network."""
- wired.SetWiredProperty(option, value)
-
- def edit_scripts(self, widget=None, event=None):
- """Launch the script editting dialog."""
- profile = self.prof_name
- cmdend = [os.path.join(wpath.gtk, "configscript.py"), profile, "wired"]
- if os.getuid() != 0:
- cmdbase = misc.get_sudo_cmd(
- _('You must enter your password to configure scripts'),
- prog_num=daemon.GetSudoApp()
- )
- if not cmdbase:
- error(None, _("Could not find a graphical sudo program. "
- "The script editor could not be launched. "
- "You'll have to edit scripts directly your "
- "configuration "
- "file."))
- return
- cmdbase.extend(cmdend)
- misc.LaunchAndWait(cmdbase)
- else:
- misc.LaunchAndWait(cmdend)
-
- def set_values(self):
- """Fill in the Gtk.Entry objects with the correct values."""
- self.txt_ip.set_text(self.format_entry("ip"))
- self.txt_netmask.set_text(self.format_entry("netmask"))
- self.txt_gateway.set_text(self.format_entry("gateway"))
-
- self.txt_dns_1.set_text(self.format_entry("dns1"))
- self.txt_dns_2.set_text(self.format_entry("dns2"))
- self.txt_dns_3.set_text(self.format_entry("dns3"))
- self.txt_domain.set_text(self.format_entry("dns_domain"))
- self.txt_search_dom.set_text(self.format_entry("search_domain"))
- self.chkbox_global_dns.set_active(
- bool(wired.GetWiredProperty("use_global_dns")))
-
- dhcphname = wired.GetWiredProperty("dhcphostname")
- if dhcphname is None:
- dhcphname = os.uname()[1]
-
- self.txt_dhcp_hostname.set_text(dhcphname)
- self.reset_static_checkboxes()
-
- self.chkbox_encryption.set_active(
- bool(wired.GetWiredProperty('encryption_enabled')))
- self.change_encrypt_method()
- self.toggle_encryption()
-
- def save_settings(self, networkid=None):
- """Save settings to disk."""
- # Check encryption info
- encrypt_info = self.encryption_info
- self.set_net_prop(
- "encryption_enabled",
- self.chkbox_encryption.get_active()
- )
- if self.chkbox_encryption.get_active():
- print("setting encryption info...")
- encrypt_methods = self.encrypt_types
- self.set_net_prop(
- "enctype",
- encrypt_methods[self.combo_encryption.get_active()]['type']
- )
- # Make sure all required fields are filled in.
- for entry_info in list(encrypt_info.values()):
- if entry_info[0].entry.get_text() == "" and \
- entry_info[1] == 'required':
- error(
- self,
- "%s (%s)" % (
- _('Required encryption information is missing.'),
- entry_info[0].label.get_label()
- )
- )
- return False
- # Now save all the entries.
- for entry_key, entry_info in list(encrypt_info.items()):
- self.set_net_prop(entry_key,
- noneToString(entry_info[0].entry.get_text()))
- else:
- print("no encryption specified...")
- self.set_net_prop("enctype", "None")
- AdvancedSettingsDialog.save_settings(self)
- wired.SaveWiredNetworkProfile(self.prof_name)
- return True
-
- def format_entry(self, label):
- """Helper method to fetch and format wired properties."""
- return noneToBlankString(wired.GetWiredProperty(label))
-
- def destroy_called(self, *args):
- """Clean up everything."""
- self.disconnect(self.des)
- super(WiredSettingsDialog, self).destroy_called()
- self.destroy()
- del self
-
-
-class WirelessSettingsDialog(AdvancedSettingsDialog):
- """Wireless settings dialog."""
- def __init__(self, networkID):
- """Build the wireless settings dialog."""
- AdvancedSettingsDialog.__init__(
- self, wireless.GetWirelessProperty(networkID, 'essid'))
- # So we can test if we are wired or wireless (for
- # change_encrypt_method())
- self.wired = False
-
- # Set up encryption stuff
- self.networkID = networkID
- self.combo_encryption = gtk.combo_box_new_text()
- self.chkbox_encryption = gtk.CheckButton(_('Use Encryption'))
- self.chkbox_global_settings = gtk.CheckButton(
- _('Use these settings for all networks sharing this essid'))
-
- rate_vbox = gtk.VBox(False, 0)
-
- self.combo_rate = LabelCombo(_('Wireless bitrate'))
- rates = gtk.ListStore(str)
- self.bitrates = wireless.GetAvailableBitrates()
- self.bitrates.append('auto')
- for br in self.bitrates:
- rates.append((br,))
- self.combo_rate.set_model(rates)
- self.chkbox_lower_rate = gtk.CheckButton(_('Allow lower bitrates'))
- rate_vbox.pack_start(self.combo_rate)
- rate_vbox.pack_start(self.chkbox_lower_rate)
-
- # Make the vbox to hold the encryption stuff.
- self.vbox_encrypt_info = gtk.VBox(False, 0)
- self.toggle_encryption()
- 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)
- )
- information_button.show()
-
- # Build the encryption menu
- activeID = -1 # Set the menu to this item when we are done
- for x, enc_type in enumerate(self.encrypt_types):
- self.combo_encryption.append_text(enc_type['name'])
- if enc_type['type'] == wireless.GetWirelessProperty(networkID,
- "enctype"):
- activeID = x
- self.combo_encryption.set_active(activeID)
- if activeID != -1:
- self.chkbox_encryption.set_active(True)
- self.combo_encryption.set_sensitive(True)
- self.vbox_encrypt_info.set_sensitive(True)
- else:
- self.combo_encryption.set_active(0)
- self.change_encrypt_method()
-
- self.cvbox.pack_start(rate_vbox, False, False)
- self.cvbox.pack_start(self.chkbox_global_settings, False, False)
- self.cvbox.pack_start(self.chkbox_encryption, False, False)
- self.cvbox.pack_start(self.combo_encryption, False, False)
- self.cvbox.pack_start(self.vbox_encrypt_info, False, False)
-
- # Connect signals.
- self.chkbox_encryption.connect("toggled", self.toggle_encryption)
- self.combo_encryption.connect("changed", self.change_encrypt_method)
- self.script_button.connect("clicked", self.edit_scripts)
- self.des = self.connect("destroy", self.destroy_called)
-
- def destroy_called(self, *args):
- """Clean up everything."""
- self.disconnect(self.des)
- super(WirelessSettingsDialog, self).destroy_called()
- self.destroy()
- del self
-
- def edit_scripts(self, widget=None, event=None):
- """Launch the script editting dialog."""
- cmdend = [os.path.join(wpath.gtk, "configscript.py"),
- str(self.networkID), "wireless"]
- if os.getuid() != 0:
- cmdbase = misc.get_sudo_cmd(
- _('You must enter your password to configure scripts'),
- prog_num=daemon.GetSudoApp()
- )
- if not cmdbase:
- error(None, _("Could not find a graphical sudo program. The "
- "script editor could not be launched. You'll "
- "have to edit scripts directly your "
- "configuration file."))
- return
- cmdbase.extend(cmdend)
- misc.LaunchAndWait(cmdbase)
- else:
- misc.LaunchAndWait(cmdend)
-
- def set_net_prop(self, option, value):
- """Sets the given option to the given value for this network."""
- wireless.SetWirelessProperty(self.networkID, option, value)
-
- def set_values(self):
- """Set the various network settings to the right values."""
- networkID = self.networkID
- self.txt_ip.set_text(self.format_entry(networkID, "ip"))
- self.txt_netmask.set_text(self.format_entry(networkID, "netmask"))
- self.txt_gateway.set_text(self.format_entry(networkID, "gateway"))
-
- self.chkbox_global_dns.set_active(
- bool(wireless.GetWirelessProperty(networkID, 'use_global_dns')))
- self.chkbox_static_dns.set_active(
- bool(wireless.GetWirelessProperty(networkID, 'use_static_dns')))
-
- self.txt_dns_1.set_text(self.format_entry(networkID, "dns1"))
- self.txt_dns_2.set_text(self.format_entry(networkID, "dns2"))
- self.txt_dns_3.set_text(self.format_entry(networkID, "dns3"))
- self.txt_domain.set_text(self.format_entry(networkID, "dns_domain"))
- self.txt_search_dom.set_text(
- self.format_entry(networkID, "search_domain"))
-
- self.reset_static_checkboxes()
- self.chkbox_encryption.set_active(
- bool(wireless.GetWirelessProperty(networkID, 'encryption')))
- self.chkbox_global_settings.set_active(
- bool(wireless.GetWirelessProperty(networkID,
- 'use_settings_globally')))
-
- self.chkbox_use_dhcp_hostname.set_active(
- bool(wireless.GetWirelessProperty(networkID, 'usedhcphostname')))
-
- dhcphname = wireless.GetWirelessProperty(networkID, "dhcphostname")
- if dhcphname is None:
- dhcphname = os.uname()[1]
- self.txt_dhcp_hostname.set_text(dhcphname)
-
- self.toggle_dhcp_hostname_checkbox()
-
- # TODO: get the value from the config
- chosen_bitrate = wireless.GetWirelessProperty(networkID, 'bitrate')
- if chosen_bitrate not in self.bitrates:
- chosen_bitrate = 'auto'
- self.combo_rate.set_active(self.bitrates.index(chosen_bitrate))
- self.chkbox_lower_rate.set_active(
- bool(
- wireless.GetWirelessProperty(networkID, 'allow_lower_bitrates')
- )
- )
-
- activeID = -1 # Set the menu to this item when we are done
- user_enctype = wireless.GetWirelessProperty(networkID, "enctype")
- for x, enc_type in enumerate(self.encrypt_types):
- if enc_type['type'] == user_enctype:
- activeID = x
-
- self.combo_encryption.set_active(activeID)
- if activeID != -1:
- self.chkbox_encryption.set_active(True)
- self.combo_encryption.set_sensitive(True)
- self.vbox_encrypt_info.set_sensitive(True)
- else:
- self.combo_encryption.set_active(0)
- self.change_encrypt_method()
-
- def save_settings(self, networkid=None):
- # Check encryption info
- encrypt_info = self.encryption_info
- if self.chkbox_encryption.get_active():
- print("setting encryption info...")
- encrypt_methods = self.encrypt_types
- self.set_net_prop(
- "enctype",
- encrypt_methods[self.combo_encryption.get_active()]['type']
- )
- # Make sure all required fields are filled in.
- for entry_info in list(encrypt_info.values()):
- if entry_info[0].entry.get_text() == "" and \
- entry_info[1] == 'required':
- error(
- self,
- "%s (%s)" % (
- _('Required encryption information is missing.'),
- entry_info[0].label.get_label()
- )
- )
- return False
- # Now save all the entries.
- for entry_key, entry_info in list(encrypt_info.items()):
- self.set_net_prop(entry_key,
- noneToString(entry_info[0].entry.get_text()))
- elif (not self.chkbox_encryption.get_active() and
- wireless.GetWirelessProperty(networkid, "encryption")):
- # Encrypt checkbox is off, but the network needs it.
- error(self, _('This network requires encryption to be enabled.'))
- return False
- else:
- print("no encryption specified...")
- self.set_net_prop("enctype", "None")
- AdvancedSettingsDialog.save_settings(self)
-
- if self.chkbox_global_settings.get_active():
- self.set_net_prop('use_settings_globally', True)
- else:
- self.set_net_prop('use_settings_globally', False)
- wireless.RemoveGlobalEssidEntry(networkid)
-
- if self.combo_rate.get_active() == -1:
- self.set_net_prop('bitrate', 'auto')
- else:
- self.set_net_prop(
- 'bitrate',
- self.bitrates[self.combo_rate.get_active()]
- )
- self.set_net_prop(
- 'allow_lower_bitrates',
- bool(self.chkbox_lower_rate.get_active())
- )
- wireless.SaveWirelessNetworkProfile(networkid)
- return True
-
- def format_entry(self, networkid, label):
- """Helper method for fetching/formatting wireless properties."""
- return noneToBlankString(wireless.GetWirelessProperty(networkid,
- label))
-
-
-class NetworkEntry(gtk.HBox):
- """Network entry."""
- def __init__(self):
- """Base network entry class.
-
- Provides gtk objects used by both the WiredNetworkEntry and
- WirelessNetworkEntry classes.
-
- """
- setup_dbus()
- gtk.HBox.__init__(self, False, 2)
- self.image = gtk.Image()
- self.pack_start(self.image, False, False)
-
- # Create an HBox to hold the buttons
- self.buttons_hbox = gtk.HBox(False, 6)
-
- # Set up the Connect button
- self.connect_button = gtk.Button(stock=gtk.STOCK_CONNECT)
- self.connect_hbox = gtk.HBox(False, 2)
- self.connect_hbox.pack_start(self.connect_button, False, False)
- self.connect_hbox.show()
-
- # Set up the Disconnect button
- self.disconnect_button = gtk.Button(stock=gtk.STOCK_DISCONNECT)
- self.connect_hbox.pack_start(self.disconnect_button, False, False)
-
- # Create a label to hold the name of the entry
- self.name_label = gtk.Label()
- self.name_label.set_alignment(0, 0.5)
-
- # Set up the VBox that goes in the gtk.Expander
- self.expander_vbox = gtk.VBox(False, 1)
- self.expander_vbox.show()
- self.pack_end(self.expander_vbox)
-
- # Set up the advanced settings button
- self.advanced_button = gtk.Button()
- self.advanced_image = gtk.Image()
- self.advanced_image.set_from_stock(gtk.STOCK_EDIT, 4)
- self.advanced_image.set_padding(4, 0)
- self.advanced_button.set_alignment(.5, .5)
- self.advanced_button.set_label(_('Properties'))
- self.advanced_button.set_image(self.advanced_image)
-
- self.buttons_hbox.pack_start(self.connect_hbox, False, False)
- self.buttons_hbox.pack_start(self.advanced_button, False, False)
-
- self.vbox_top = gtk.VBox(False, 0)
- self.expander_vbox.pack_start(self.name_label)
- self.expander_vbox.pack_start(self.vbox_top)
- self.expander_vbox.pack_start(self.buttons_hbox)
-
- def destroy_called(self, *args):
- """Clean up everything."""
- super(NetworkEntry, self).destroy()
- self.destroy()
- del self
-
-
-class WiredNetworkEntry(NetworkEntry):
- """Wired network entry."""
- def __init__(self):
- """Load the wired network entry."""
- NetworkEntry.__init__(self)
- # Center the picture and pad it a bit
- self.image.set_padding(0, 0)
- self.image.set_alignment(.5, .5)
- self.image.set_size_request(60, -1)
- self.image.set_from_icon_name("wired-gui", gtk.ICON_SIZE_DND)
- self.image.show()
- self.connect_button.show()
-
- self.name_label.set_use_markup(True)
- self.name_label.set_label("" + _('Wired Network') + "")
-
- self.is_full_gui = True
-
- self.button_add = gtk.Button(stock=gtk.STOCK_ADD)
- self.button_delete = gtk.Button(stock=gtk.STOCK_DELETE)
- self.profile_help = gtk.Label(_('To connect to a wired network, you '
- 'must create a network profile. To '
- 'create a network profile, type a '
- 'name that describes this network, '
- 'and press Add.'))
- self.chkbox_default_profile = gtk.CheckButton(_('Use as default '
- 'profile (overwrites '
- 'any previous '
- 'default)'))
- self.combo_profile_names = gtk.combo_box_new_text()
-
- # Format the profile help label.
- self.profile_help.set_justify(gtk.JUSTIFY_LEFT)
- self.profile_help.set_line_wrap(True)
-
- # Pack the various VBox objects.
- self.hbox_temp = gtk.HBox(False, 0)
- self.hbox_def = gtk.HBox(False, 0)
- self.vbox_top.pack_start(self.profile_help, True, True)
- self.vbox_top.pack_start(self.hbox_def)
- self.vbox_top.pack_start(self.hbox_temp)
- self.hbox_temp.pack_start(self.combo_profile_names, True, True)
- self.hbox_temp.pack_start(self.button_add, False, False)
- self.hbox_temp.pack_start(self.button_delete, False, False)
- self.hbox_def.pack_start(self.chkbox_default_profile, False, False)
-
- # Connect events
- self.button_add.connect("clicked", self.add_profile)
- self.button_delete.connect("clicked", self.remove_profile)
- self.chkbox_default_profile.connect("toggled",
- self.toggle_default_profile)
- self.combo_profile_names.connect("changed", self.change_profile)
-
- # Build profile list.
- self.profile_list = wired.GetWiredProfileList()
- default_prof = wired.GetDefaultWiredNetwork()
- if self.profile_list:
- starting_index = 0
- for x, prof in enumerate(self.profile_list):
- self.combo_profile_names.append_text(prof)
- if default_prof == prof:
- starting_index = x
- self.combo_profile_names.set_active(starting_index)
- else:
- print("no wired profiles found")
- self.profile_help.show()
-
- self.advanced_dialog = \
- WiredSettingsDialog(self.combo_profile_names.get_active_text())
-
- # Show everything, but hide the profile help label.
- self.show_all()
- self.profile_help.hide()
-
- # Toggle the default profile checkbox to the correct state.
- if to_bool(wired.GetWiredProperty("default")):
- self.chkbox_default_profile.set_active(True)
- else:
- self.chkbox_default_profile.set_active(False)
-
- self.check_enable()
- self.wireddis = self.connect("destroy", self.destroy_called)
-
- def destroy_called(self, *args):
- """Clean up everything."""
- self.disconnect(self.wireddis)
- self.advanced_dialog.destroy_called()
- del self.advanced_dialog
- super(WiredNetworkEntry, self).destroy_called()
- self.destroy()
- del self
-
- def save_wired_settings(self):
- """Save wired network settings."""
- return self.advanced_dialog.save_settings()
-
- def check_enable(self):
- """Disable objects if the profile list is empty."""
- profile_list = wired.GetWiredProfileList()
- if not profile_list:
- self.button_delete.set_sensitive(False)
- self.connect_button.set_sensitive(False)
- self.advanced_button.set_sensitive(False)
-
- def update_connect_button(self, state, apbssid=None):
- """Update the connection/disconnect button for this entry."""
- if state == misc.WIRED:
- self.disconnect_button.show()
- self.connect_button.hide()
- else:
- self.disconnect_button.hide()
- self.connect_button.show()
-
- def add_profile(self, widget):
- """Add a profile to the profile list."""
- response = string_input(
- "Enter a profile name", "The profile name will not be used by the "
- "computer. It allows you to easily distinguish between different "
- "network profiles.",
- "Profile name:"
- ).strip()
-
- # if response is "" or None
- if not response:
- error(None, "Invalid profile name", block=True)
- return False
-
- profile_name = response
- profile_list = wired.GetWiredProfileList()
- if profile_list:
- if profile_name in profile_list:
- return False
-
- self.profile_help.hide()
- wired.CreateWiredNetworkProfile(profile_name, False)
- self.combo_profile_names.prepend_text(profile_name)
- self.combo_profile_names.set_active(0)
- self.advanced_dialog.prof_name = profile_name
- if self.is_full_gui:
- self.button_delete.set_sensitive(True)
- self.connect_button.set_sensitive(True)
- self.advanced_button.set_sensitive(True)
-
- def remove_profile(self, widget):
- """Remove a profile from the profile list."""
- print("removing profile")
- profile_name = self.combo_profile_names.get_active_text()
- wired.DeleteWiredNetworkProfile(profile_name)
- self.combo_profile_names.remove_text(self.combo_profile_names.
- get_active())
- self.combo_profile_names.set_active(0)
- self.advanced_dialog.prof_name = \
- self.combo_profile_names.get_active_text()
- if not wired.GetWiredProfileList():
- self.profile_help.show()
- entry = self.combo_profile_names.child
- entry.set_text("")
- if self.is_full_gui:
- self.button_delete.set_sensitive(False)
- self.advanced_button.set_sensitive(False)
- self.connect_button.set_sensitive(False)
- else:
- self.profile_help.hide()
-
- def toggle_default_profile(self, widget):
- """Change the default profile."""
- if self.chkbox_default_profile.get_active():
- # Make sure there is only one default profile at a time
- wired.UnsetWiredDefault()
- wired.SetWiredProperty("default",
- self.chkbox_default_profile.get_active())
- wired.SaveWiredNetworkProfile(
- self.combo_profile_names.get_active_text())
-
- def change_profile(self, widget):
- """Called when a new profile is chosen from the list."""
- # Make sure the name doesn't change everytime someone types something
- if self.combo_profile_names.get_active() > -1:
- if not self.is_full_gui:
- return
-
- profile_name = self.combo_profile_names.get_active_text()
- wired.ReadWiredNetworkProfile(profile_name)
-
- if hasattr(self, 'advanced_dialog'):
- self.advanced_dialog.prof_name = profile_name
- self.advanced_dialog.set_values()
-
- is_default = wired.GetWiredProperty("default")
- self.chkbox_default_profile.set_active(to_bool(is_default))
-
- def format_entry(self, label):
- """Help method for fetching/formatting wired properties."""
- return noneToBlankString(wired.GetWiredProperty(label))
-
-
-class WirelessNetworkEntry(NetworkEntry):
- """Wireless network entry."""
- def __init__(self, networkID):
- """Build the wireless network entry."""
- NetworkEntry.__init__(self)
-
- self.networkID = networkID
- self.image.set_padding(0, 0)
- self.image.set_alignment(.5, .5)
- self.image.set_size_request(60, -1)
- self.image.show()
- self.essid = noneToBlankString(
- wireless.GetWirelessProperty(networkID, "essid"))
- self.lbl_strength = GreyLabel()
- self.lbl_encryption = GreyLabel()
- self.lbl_channel = GreyLabel()
-
- print(("ESSID : " + self.essid))
- self.chkbox_autoconnect = gtk.CheckButton(
- _('Automatically connect to this network'))
- self.chkbox_neverconnect = gtk.CheckButton(
- _('Never connect to this network'))
-
- self.set_signal_strength(
- wireless.GetWirelessProperty(networkID, 'quality'),
- wireless.GetWirelessProperty(networkID, 'strength')
- )
- self.set_encryption(
- wireless.GetWirelessProperty(networkID, 'encryption'),
- wireless.GetWirelessProperty(networkID, 'encryption_method')
- )
- self.set_channel(wireless.GetWirelessProperty(networkID, 'channel'))
- self.name_label.set_use_markup(True)
- self.name_label.set_label(
- "%s %s %s %s" % (
- self._escape(self.essid),
- self.lbl_strength.get_label(),
- self.lbl_encryption.get_label(),
- self.lbl_channel.get_label(),
- )
- )
- # Add the wireless network specific parts to the NetworkEntry
- # VBox objects.
- self.vbox_top.pack_start(self.chkbox_autoconnect, False, False)
- self.vbox_top.pack_start(self.chkbox_neverconnect, False, False)
-
- if to_bool(self.format_entry(networkID, "automatic")):
- self.chkbox_autoconnect.set_active(True)
- else:
- self.chkbox_autoconnect.set_active(False)
-
- if to_bool(self.format_entry(networkID, "never")):
- self.chkbox_autoconnect.set_sensitive(False)
- self.connect_button.set_sensitive(False)
- self.chkbox_neverconnect.set_active(True)
- else:
- self.chkbox_neverconnect.set_active(False)
-
- # Connect signals.
- self.chkbox_autoconnect.connect("toggled", self.update_autoconnect)
- self.chkbox_neverconnect.connect("toggled", self.update_neverconnect)
-
- # Show everything
- self.show_all()
- self.advanced_dialog = WirelessSettingsDialog(networkID)
- self.wifides = self.connect("destroy", self.destroy_called)
-
- def _escape(self, val):
- """Escapes special characters so they're displayed correctly."""
- return val.replace("&", "&"). \
- replace("<", "<"). \
- replace(">", ">"). \
- replace("'", "'"). \
- replace('"', """)
-
- def save_wireless_settings(self, networkid):
- """Save wireless network settings."""
- return self.advanced_dialog.save_settings(networkid)
-
- def update_autoconnect(self, widget=None):
- """Called when the autoconnect checkbox is toggled."""
- wireless.SetWirelessProperty(
- self.networkID,
- "automatic",
- noneToString(self.chkbox_autoconnect. get_active())
- )
- wireless.SaveWirelessNetworkProperty(self.networkID, "automatic")
-
- def update_neverconnect(self, widget=None):
- """Called when the neverconnect checkbox is toggled."""
- wireless.SetWirelessProperty(
- self.networkID,
- "never",
- noneToString(self.chkbox_neverconnect.get_active())
- )
- wireless.SaveWirelessNetworkProperty(self.networkID, "never")
- if self.chkbox_neverconnect.get_active():
- self.chkbox_autoconnect.set_sensitive(False)
- self.connect_button.set_sensitive(False)
- else:
- self.chkbox_autoconnect.set_sensitive(True)
- self.connect_button.set_sensitive(True)
-
- def destroy_called(self, *args):
- """Clean up everything."""
- self.disconnect(self.wifides)
- self.advanced_dialog.destroy_called()
- del self.advanced_dialog
- super(WirelessNetworkEntry, self).destroy_called()
- self.destroy()
- del self
-
- def update_connect_button(self, state, apbssid):
- """Update the connection/disconnect button for this entry."""
- if to_bool(self.format_entry(self.networkID, "never")):
- self.connect_button.set_sensitive(False)
- if not apbssid:
- apbssid = wireless.GetApBssid()
- if state == misc.WIRELESS and \
- apbssid == wireless.GetWirelessProperty(self.networkID, "bssid"):
- self.disconnect_button.show()
- self.connect_button.hide()
- else:
- self.disconnect_button.hide()
- self.connect_button.show()
-
- def set_signal_strength(self, strength, dbm_strength):
- """Set the signal strength displayed in the WirelessNetworkEntry."""
- if strength:
- strength = int(strength)
- else:
- strength = -1
- if dbm_strength:
- dbm_strength = int(dbm_strength)
- else:
- dbm_strength = -100
- display_type = daemon.GetSignalDisplayType()
- if daemon.GetWPADriver() == 'ralink legacy' or display_type == 1:
- # Use the -xx dBm signal strength to display a signal icon
- # I'm not sure how accurately the dBm strength is being
- # "converted" to strength bars, so suggestions from people
- # for a better way would be welcome.
- if dbm_strength >= -60:
- signal_img = 'signal-100'
- elif dbm_strength >= -70:
- signal_img = 'signal-75'
- elif dbm_strength >= -80:
- signal_img = 'signal-50'
- else:
- signal_img = 'signal-25'
- ending = "dBm"
- disp_strength = str(dbm_strength)
- else:
- # Uses normal link quality, should be fine in most cases
- if strength > 75:
- signal_img = 'signal-100'
- elif strength > 50:
- signal_img = 'signal-75'
- elif strength > 25:
- signal_img = 'signal-50'
- else:
- signal_img = 'signal-25'
- ending = "%"
- disp_strength = str(strength)
- self.image.set_from_icon_name(signal_img, gtk.ICON_SIZE_DND)
- self.lbl_strength.set_label(disp_strength + ending)
- self.image.show()
-
- def set_encryption(self, on, ttype):
- """Set the encryption value for the WirelessNetworkEntry."""
- if on and ttype:
- self.lbl_encryption.set_label(str(ttype))
- if on and not ttype:
- self.lbl_encryption.set_label(_('Secured'))
- if not on:
- self.lbl_encryption.set_label(_('Unsecured'))
-
- def set_channel(self, channel):
- """Set the channel value for the WirelessNetworkEntry."""
- self.lbl_channel.set_label(_('Channel') + ' ' + str(channel))
-
- def format_entry(self, networkid, label):
- """Helper method for fetching/formatting wireless properties."""
- return noneToBlankString(wireless.GetWirelessProperty(networkid,
- label))
-
-
-class WirelessInformationDialog(gtk.Dialog):
- """Wireless information dialog."""
- def __init__(self, networkID, parent):
- gtk.Dialog.__init__(self, parent=parent)
-
- # Make the combo box.
- self.lbl_strength = gtk.Label()
- self.lbl_strength.set_alignment(0, 0.5)
- self.lbl_encryption = gtk.Label()
- self.lbl_encryption.set_alignment(0, 0.5)
- self.lbl_mac = gtk.Label()
- self.lbl_mac.set_alignment(0, 0.5)
- self.lbl_channel = gtk.Label()
- self.lbl_channel.set_alignment(0, 0.5)
- self.lbl_mode = gtk.Label()
- self.lbl_mode.set_alignment(0, 0.5)
- self.hbox_status = gtk.HBox(False, 5)
-
- # Set the values of the network info labels.
- self.set_signal_strength(
- wireless.GetWirelessProperty(networkID, 'quality'),
- wireless.GetWirelessProperty(networkID, 'strength')
- )
- self.set_mac_address(wireless.GetWirelessProperty(networkID, 'bssid'))
- self.set_mode(wireless.GetWirelessProperty(networkID, 'mode'))
- self.set_channel(wireless.GetWirelessProperty(networkID, 'channel'))
- self.set_encryption(
- wireless.GetWirelessProperty(networkID, 'encryption'),
- wireless.GetWirelessProperty(networkID, 'encryption_method')
- )
-
- self.set_title('Network Information')
- vbox = self.vbox
- self.set_has_separator(False)
- table = gtk.Table(5, 2)
- table.set_col_spacings(12)
- # pylint: disable-msg=E1101
- vbox.pack_start(table)
-
- # Pack the network status HBox.
- table.attach(LeftAlignedLabel('Signal strength:'), 0, 1, 0, 1)
- table.attach(self.lbl_strength, 1, 2, 0, 1)
-
- table.attach(LeftAlignedLabel('Encryption type:'), 0, 1, 1, 2)
- table.attach(self.lbl_encryption, 1, 2, 1, 2)
-
- table.attach(LeftAlignedLabel('Access point address:'), 0, 1, 2, 3)
- table.attach(self.lbl_mac, 1, 2, 2, 3)
-
- table.attach(LeftAlignedLabel('Mode:'), 0, 1, 3, 4)
- table.attach(self.lbl_mode, 1, 2, 3, 4)
-
- table.attach(LeftAlignedLabel('Channel:'), 0, 1, 4, 5)
- table.attach(self.lbl_channel, 1, 2, 4, 5)
-
- # pylint: disable-msg=E1101
- vbox.show_all()
-
- self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
- self.show()
- self.run()
- self.destroy()
-
- def set_signal_strength(self, strength, dbm_strength):
- """Set the signal strength displayed in the WirelessNetworkEntry."""
- if strength is not None:
- strength = int(strength)
- else:
- strength = -1
- if dbm_strength is not None:
- dbm_strength = int(dbm_strength)
- else:
- dbm_strength = -100
- display_type = daemon.GetSignalDisplayType()
- if daemon.GetWPADriver() == 'ralink legacy' or display_type == 1:
- # Use the -xx dBm signal strength to display a signal icon
- # I'm not sure how accurately the dBm strength is being
- # "converted" to strength bars, so suggestions from people
- # for a better way would be welcome.
- if dbm_strength >= -60:
- signal_img = 'signal-100.png'
- elif dbm_strength >= -70:
- signal_img = 'signal-75.png'
- elif dbm_strength >= -80:
- signal_img = 'signal-50.png'
- else:
- signal_img = 'signal-25.png'
- ending = "dBm"
- disp_strength = str(dbm_strength)
- else:
- # Uses normal link quality, should be fine in most cases
- if strength > 75:
- signal_img = 'signal-100.png'
- elif strength > 50:
- signal_img = 'signal-75.png'
- elif strength > 25:
- signal_img = 'signal-50.png'
- else:
- signal_img = 'signal-25.png'
- ending = "%"
- disp_strength = str(strength)
- self.lbl_strength.set_label(disp_strength + ending)
-
- def set_mac_address(self, address):
- """Set the MAC address for the WirelessNetworkEntry."""
- self.lbl_mac.set_label(str(address))
-
- def set_encryption(self, on, ttype):
- """Set the encryption value for the WirelessNetworkEntry."""
- if on and ttype:
- self.lbl_encryption.set_label(str(ttype))
- if on and not ttype:
- self.lbl_encryption.set_label(_('Secured'))
- if not on:
- self.lbl_encryption.set_label(_('Unsecured'))
-
- def set_channel(self, channel):
- """Set the channel value for the WirelessNetworkEntry."""
- self.lbl_channel.set_label(_('Channel') + ' ' + str(channel))
-
- def set_mode(self, mode):
- """Set the mode value for the WirelessNetworkEntry."""
- self.lbl_mode.set_label(str(mode))
-
- def format_entry(self, networkid, label):
- """Helper method for fetching/formatting wireless properties."""
- return noneToBlankString(wireless.GetWirelessProperty(networkid,
- label))
diff --git a/gtk/prefs.py b/gtk/prefs.py
deleted file mode 100644
index d293a60..0000000
--- a/gtk/prefs.py
+++ /dev/null
@@ -1,491 +0,0 @@
-#!/usr/bin/env python3
-
-"""prefs -- Wicd Preferences Dialog.
-
-Displays the main settings dialog window for wicd and
-handles recieving/sendings the settings from/to the daemon.
-
-"""
-
-#
-# Copyright (C) 2008-2009 Adam Blackburn
-# Copyright (C) 2008-2009 Dan O'Reilly
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License Version 2 as
-# published by the Free Software Foundation.
-#
-# 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, see .
-#
-import os
-
-import gtk
-from gi.repository import GObject as gobject
-try:
- import pynotify
-except ImportError:
- pynotify = None
-
-from wicd import misc
-from wicd import wpath
-from wicd import dbusmanager
-from wicd.misc import checkboxTextboxToggle, noneToBlankString
-from wicd.translations import _
-
-daemon = None
-wireless = None
-wired = None
-
-USER_SETTINGS_DIR = os.path.expanduser('~/.wicd/')
-
-
-def setup_dbus():
- """Initialize DBus."""
- global daemon, wireless, wired
- daemon = dbusmanager.get_interface('daemon')
- wireless = dbusmanager.get_interface('wireless')
- wired = dbusmanager.get_interface('wired')
-
-
-class PreferencesDialog(object):
- """Class for handling the wicd preferences dialog window."""
- def __init__(self, parent, wTree):
- setup_dbus()
- self.parent = parent
- self.wTree = wTree
-
- self.ethtoolradio = None
- self.miitoolradio = None
-
- self.wpadrivercombo = None
- self.wpadrivers = None
- self.backends = None
- self.backendcombo = None
- self.be_descriptions = None
- self.preferwiredcheckbox = None
- self.useGlobalDNSCheckbox = None
- self.displaytypecheckbox = None
- self.verifyapcheckbox = None
- self.debugmodecheckbox = None
- self.wiredcheckbox = None
- self.showneverconnectcheckbox = None
- self.reconnectcheckbox = None
- self.notificationscheckbox = None
-
- self.usedefaultradiobutton = None
- self.lastusedradiobutton = None
- self.showlistradiobutton = None
-
- self.kdesuradio = None
- self.gksudoradio = None
- self.sudoautoradio = None
- self.ktsussradio = None
-
- self.dhclientradio = None
- self.dhcpautoradio = None
- self.pumpradio = None
- self.udhcpcradio = None
- self.dhcpcdradio = None
-
- self.linkautoradio = None
- self.routeflushradio = None
- self.ipflushradio = None
- self.flushautoradio = None
-
- self.dialog = None
- self.entryWiredInterface = None
- self.entryWirelessInterface = None
-
- self.dns1Entry = None
- self.dns2Entry = None
- self.dns3Entry = None
- self.searchDomEntry = None
- self.dnsDomEntry = None
-
- self.prep_settings_diag()
- self.load_preferences_diag()
-
- def _setup_external_app_radios(self, radio_list, get_method, set_method):
- """Generic function for setting up external app radios."""
- # Disable radios for apps that aren't installed.
- for app in radio_list[1:]:
- app.set_sensitive(daemon.GetAppAvailable(app.get_label()))
- selected_app = get_method()
- # Make sure the app we want to select is actually available.
- if radio_list[selected_app].get_property("sensitive"):
- radio_list[selected_app].set_active(True)
- else:
- # If it isn't, default to Automatic.
- set_method(misc.AUTO)
- radio_list[misc.AUTO].set_active(True)
-
- def load_preferences_diag(self):
- """Loads data into the preferences Dialog."""
-
- self.wiredcheckbox.set_active(daemon.GetAlwaysShowWiredInterface())
- self.reconnectcheckbox.set_active(daemon.GetAutoReconnect())
- self.debugmodecheckbox.set_active(daemon.GetDebugMode())
- self.displaytypecheckbox.set_active(daemon.GetSignalDisplayType())
- self.verifyapcheckbox.set_active(daemon.GetShouldVerifyAp())
- self.preferwiredcheckbox.set_active(daemon.GetPreferWiredNetwork())
- self.showneverconnectcheckbox.set_active(daemon.GetShowNeverConnect())
-
- dhcp_list = [self.dhcpautoradio, self.dhclientradio, self.dhcpcdradio,
- self.pumpradio, self.udhcpcradio]
- self._setup_external_app_radios(
- dhcp_list, daemon.GetDHCPClient, daemon.SetDHCPClient)
-
- wired_link_list = [self.linkautoradio, self.ethtoolradio,
- self.miitoolradio]
- self._setup_external_app_radios(
- wired_link_list,
- daemon.GetLinkDetectionTool,
- daemon.SetLinkDetectionTool
- )
-
- flush_list = [self.flushautoradio, self.ipflushradio,
- self.routeflushradio]
- self._setup_external_app_radios(
- flush_list, daemon.GetFlushTool, daemon.SetFlushTool)
-
- sudo_list = [self.sudoautoradio, self.gksudoradio, self.kdesuradio,
- self.ktsussradio]
- self._setup_external_app_radios(
- sudo_list, daemon.GetSudoApp, daemon.SetSudoApp)
-
- auto_conn_meth = daemon.GetWiredAutoConnectMethod()
- if auto_conn_meth == 1:
- self.usedefaultradiobutton.set_active(True)
- elif auto_conn_meth == 2:
- self.showlistradiobutton.set_active(True)
- elif auto_conn_meth == 3:
- self.lastusedradiobutton.set_active(True)
-
- self.entryWirelessInterface.set_text(daemon.GetWirelessInterface())
- self.entryWiredInterface.set_text(daemon.GetWiredInterface())
-
- def_driver = daemon.GetWPADriver()
- try:
- self.wpadrivercombo.set_active(self.wpadrivers.index(def_driver))
- except ValueError:
- self.wpadrivercombo.set_active(0)
-
- self.useGlobalDNSCheckbox.connect(
- "toggled",
- checkboxTextboxToggle,
- (
- self.dns1Entry, self.dns2Entry, self.dns3Entry,
- self.dnsDomEntry, self.searchDomEntry
- )
- )
-
- dns_addresses = daemon.GetGlobalDNSAddresses()
- self.useGlobalDNSCheckbox.set_active(daemon.GetUseGlobalDNS())
- self.dns1Entry.set_text(noneToBlankString(dns_addresses[0]))
- self.dns2Entry.set_text(noneToBlankString(dns_addresses[1]))
- self.dns3Entry.set_text(noneToBlankString(dns_addresses[2]))
- self.dnsDomEntry.set_text(noneToBlankString(dns_addresses[3]))
- self.searchDomEntry.set_text(noneToBlankString(dns_addresses[4]))
-
- if not daemon.GetUseGlobalDNS():
- self.searchDomEntry.set_sensitive(False)
- self.dnsDomEntry.set_sensitive(False)
- self.dns1Entry.set_sensitive(False)
- self.dns2Entry.set_sensitive(False)
- self.dns3Entry.set_sensitive(False)
-
- cur_backend = daemon.GetSavedBackend()
- try:
- self.backendcombo.set_active(self.backends.index(cur_backend))
- except ValueError:
- self.backendcombo.set_active(0)
-
- self.notificationscheckbox.set_active(
- os.path.exists(
- os.path.join(USER_SETTINGS_DIR, 'USE_NOTIFICATIONS')
- ))
-
- # if pynotify isn't installed disable the option
- if not pynotify:
- self.notificationscheckbox.set_active(False)
- self.notificationscheckbox.set_sensitive(False)
-
- # if notifications were disabled with the configure flag
- if wpath.no_use_notifications:
- self.notificationscheckbox.set_active(False)
- self.notificationscheckbox.hide()
- self.wTree.get_object('label2').hide()
-
- self.wTree.get_object("notebook2").set_current_page(0)
-
- def run(self):
- """Runs the preferences dialog window."""
- return self.dialog.run()
-
- def hide(self):
- """Hides the preferences dialog window."""
- self.dialog.hide()
-
- def destroy(self):
- """Destroy dialog."""
- self.dialog.destroy()
-
- def show_all(self):
- """Shows the preferences dialog window."""
- self.dialog.show()
-
- def save_results(self):
- """Pushes the selected settings to the daemon."""
- daemon.SetUseGlobalDNS(self.useGlobalDNSCheckbox.get_active())
- # Strip whitespace from DNS entries
- for i in [self.dns1Entry, self.dns2Entry, self.dns3Entry,
- self.dnsDomEntry, self.searchDomEntry]:
- i.set_text(i.get_text().strip())
- daemon.SetGlobalDNS(
- self.dns1Entry.get_text(),
- self.dns2Entry.get_text(),
- self.dns3Entry.get_text(),
- self.dnsDomEntry.get_text(),
- self.searchDomEntry.get_text()
- )
- daemon.SetWirelessInterface(self.entryWirelessInterface.get_text())
- daemon.SetWiredInterface(self.entryWiredInterface.get_text())
- daemon.SetWPADriver(self.wpadrivers[self.wpadrivercombo.get_active()])
- daemon.SetAlwaysShowWiredInterface(self.wiredcheckbox.get_active())
- daemon.SetAutoReconnect(self.reconnectcheckbox.get_active())
- daemon.SetDebugMode(self.debugmodecheckbox.get_active())
- daemon.SetSignalDisplayType(int(self.displaytypecheckbox.get_active()))
- daemon.SetShouldVerifyAp(bool(self.verifyapcheckbox.get_active()))
- daemon.SetPreferWiredNetwork(
- bool(self.preferwiredcheckbox.get_active()))
- daemon.SetShowNeverConnect(
- bool(self.showneverconnectcheckbox.get_active()))
- if self.showlistradiobutton.get_active():
- daemon.SetWiredAutoConnectMethod(2)
- elif self.lastusedradiobutton.get_active():
- daemon.SetWiredAutoConnectMethod(3)
- else:
- daemon.SetWiredAutoConnectMethod(1)
-
- daemon.SetBackend(self.backends[self.backendcombo.get_active()])
-
- # External Programs Tab
- if self.dhcpautoradio.get_active():
- dhcp_client = misc.AUTO
- elif self.dhclientradio.get_active():
- dhcp_client = misc.DHCLIENT
- elif self.dhcpcdradio.get_active():
- dhcp_client = misc.DHCPCD
- elif self.pumpradio.get_active():
- dhcp_client = misc.PUMP
- else:
- dhcp_client = misc.UDHCPC
- daemon.SetDHCPClient(dhcp_client)
-
- if self.linkautoradio.get_active():
- link_tool = misc.AUTO
- elif self.ethtoolradio.get_active():
- link_tool = misc.ETHTOOL
- else:
- link_tool = misc.MIITOOL
- daemon.SetLinkDetectionTool(link_tool)
-
- if self.flushautoradio.get_active():
- flush_tool = misc.AUTO
- elif self.ipflushradio.get_active():
- flush_tool = misc.IP
- else:
- flush_tool = misc.ROUTE
- daemon.SetFlushTool(flush_tool)
-
- if self.sudoautoradio.get_active():
- sudo_tool = misc.AUTO
- elif self.gksudoradio.get_active():
- sudo_tool = misc.GKSUDO
- elif self.kdesuradio.get_active():
- sudo_tool = misc.KDESU
- else:
- sudo_tool = misc.KTSUSS
- daemon.SetSudoApp(sudo_tool)
-
- [width, height] = self.dialog.get_size()
-
- not_path = os.path.join(USER_SETTINGS_DIR, 'USE_NOTIFICATIONS')
- if self.notificationscheckbox.get_active():
- if not os.path.exists(not_path):
- open(not_path, 'w')
- else:
- if os.path.exists(not_path):
- os.remove(not_path)
- # if this GUI was started by a tray icon,
- # instantly change the notifications there
- if self.parent.tray:
- self.parent.tray.icon_info.use_notify = \
- self.notificationscheckbox.get_active()
-
- def set_label(self, glade_str, label):
- """Sets the label for the given widget in wicd.glade."""
- self.wTree.get_object(glade_str).set_label(label)
-
- def prep_settings_diag(self):
- """Set up anything that doesn't have to be persisted later."""
- def build_combobox(lbl):
- """Sets up a ComboBox using the given widget name."""
- liststore = gtk.ListStore(gobject.TYPE_STRING)
- combobox = self.wTree.get_object(lbl)
- combobox.clear()
- combobox.set_model(liststore)
- cell = gtk.CellRendererText()
- combobox.pack_start(cell, True)
- combobox.add_attribute(cell, 'text', 0)
- return combobox
-
- def setup_label(name, lbl=""):
- """Sets up a label for the given widget name."""
- widget = self.wTree.get_object(name)
- # if lbl:
- # widget.set_label(lbl)
- if widget is None:
- raise ValueError('widget %s does not exist' % name)
- return widget
-
- # External Programs tab
- # self.wTree.get_object("gen_settings_label").set_label(_('General '
- # 'Settings'))
- # self.wTree.get_object("ext_prog_label").set_label(_('External '
- # 'Programs'))
- # self.wTree.get_object("dhcp_client_label").set_label(_('DHCP '
- # 'Client'))
- # self.wTree.get_object("wired_detect_label").set_label(_('Wired Link '
- # 'Detection'))
- # self.wTree.get_object("route_flush_label").set_label(_('Route Table '
- # 'Flushing'))
- # self.wTree.get_object("pref_backend_label").set_label(_('Backend') +
- # ":")
-
- # entryWiredAutoMethod = self.wTree.get_object("pref_wired_auto_label")
- # entryWiredAutoMethod.set_label('Wired Autoconnect Setting:')
- # entryWiredAutoMethod.set_alignment(0, 0)
- # atrlist = pango.AttrList()
- # atrlist.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, 50))
- # entryWiredAutoMethod.set_attributes(atrlist)
-
- # self.set_label("pref_dns1_label", "%s 1" % _('DNS server'))
- # self.set_label("pref_dns2_label", "%s 2" % _('DNS server'))
- # self.set_label("pref_dns3_label", "%s 3" % _('DNS server'))
- # self.set_label("pref_search_dom_label", "%s:" % _('Search domain'))
- # self.set_label("pref_wifi_label", "%s:" % _('Wireless Interface'))
- # self.set_label("pref_wired_label", "%s:" % _('Wired Interface'))
- # self.set_label("pref_driver_label", "%s:" % _('WPA Supplicant '
- # 'Driver'))
-
- self.dialog = self.wTree.get_object("pref_dialog")
- self.dialog.set_title(_('Preferences'))
- self.dialog.set_icon_name('wicd-gtk')
- width = int(gtk.gdk.screen_width() / 2.4)
- if width > 450:
- width = 450
- self.dialog.resize(width, int(gtk.gdk.screen_height() / 2))
-
- self.wiredcheckbox = setup_label("pref_always_check",
- _('''Always show wired interface'''))
- self.preferwiredcheckbox = setup_label("pref_prefer_wired_check",
- "prefer_wired")
-
- self.reconnectcheckbox = setup_label("pref_auto_check",
- _('Automatically reconnect on '
- 'connection loss'))
- self.showneverconnectcheckbox = setup_label(
- "pref_show_never_connect_check", _('Show never connect networks'))
- self.debugmodecheckbox = setup_label("pref_debug_check",
- _('Enable debug mode'))
- self.displaytypecheckbox = setup_label(
- "pref_dbm_check", _('Use dBm to measure signal strength'))
- self.verifyapcheckbox = setup_label(
- "pref_verify_ap_check",
- _('Ping static gateways after connecting to verify association'))
- self.usedefaultradiobutton = setup_label(
- "pref_use_def_radio",
- _('Use default profile on wired autoconnect'))
- self.showlistradiobutton = setup_label(
- "pref_prompt_radio",
- _('Prompt for profile on wired autoconnect'))
- self.lastusedradiobutton = setup_label(
- "pref_use_last_radio",
- _('Use last used profile on wired autoconnect'))
-
- self.notificationscheckbox = setup_label(
- "pref_use_libnotify",
- _('Display notifications about connection status'))
-
- # DHCP Clients
- self.dhcpautoradio = setup_label(
- "dhcp_auto_radio", _('Automatic (recommended)'))
- self.dhclientradio = self.wTree.get_object("dhclient_radio")
- self.pumpradio = self.wTree.get_object("pump_radio")
- self.dhcpcdradio = self.wTree.get_object("dhcpcd_radio")
- self.udhcpcradio = self.wTree.get_object("udhcpc_radio")
-
- # Wired Link Detection Apps
- self.linkautoradio = setup_label("link_auto_radio",
- _('Automatic (recommended)'))
- self.linkautoradio = setup_label("link_auto_radio")
- self.ethtoolradio = setup_label("ethtool_radio")
- self.miitoolradio = setup_label("miitool_radio")
-
- # Route Flushing Apps
- self.flushautoradio = setup_label("flush_auto_radio",
- _('Automatic (recommended)'))
- self.ipflushradio = setup_label("ip_flush_radio")
- self.routeflushradio = setup_label("route_flush_radio")
-
- # Graphical Sudo Apps
- self.sudoautoradio = setup_label("sudo_auto_radio",
- _('Automatic (recommended)'))
- self.gksudoradio = setup_label("gksudo_radio")
- self.kdesuradio = setup_label("kdesu_radio")
- self.ktsussradio = setup_label("ktsuss_radio")
-
- # Replacement for the combo box hack
- self.wpadrivercombo = build_combobox("pref_wpa_combobox")
- self.wpadrivers = wireless.GetWpaSupplicantDrivers()
- self.wpadrivers.append("ralink_legacy")
- self.wpadrivers.append('none')
-
- for x in self.wpadrivers:
- self.wpadrivercombo.append_text(x)
-
- self.entryWirelessInterface = self.wTree.get_object("pref_wifi_entry")
- self.entryWiredInterface = self.wTree.get_object("pref_wired_entry")
-
- # Set up global DNS stuff
- self.useGlobalDNSCheckbox = setup_label("pref_global_check",
- 'use_global_dns')
- self.searchDomEntry = self.wTree.get_object("pref_search_dom_entry")
- self.dnsDomEntry = self.wTree.get_object("pref_dns_dom_entry")
- self.dns1Entry = self.wTree.get_object("pref_dns1_entry")
- self.dns2Entry = self.wTree.get_object("pref_dns2_entry")
- self.dns3Entry = self.wTree.get_object("pref_dns3_entry")
-
- self.backendcombo = build_combobox("pref_backend_combobox")
- self.backendcombo.connect("changed", self.be_combo_changed)
- # Load backend combobox
- self.backends = daemon.GetBackendList()
- self.be_descriptions = daemon.GetBackendDescriptionDict()
-
- for x in self.backends:
- if x:
- if x == 'ioctl':
- x = 'ioctl NOT SUPPORTED'
- self.backendcombo.append_text(x)
-
- def be_combo_changed(self, combo):
- """Update the description label for the given backend."""
- self.backendcombo.set_tooltip_text(
- self.be_descriptions[self.backends[combo.get_active()]])
diff --git a/gtk/wicd-client.py b/gtk/wicd-client.py
deleted file mode 100644
index adc2682..0000000
--- a/gtk/wicd-client.py
+++ /dev/null
@@ -1,1187 +0,0 @@
-#!/usr/bin/env python3
-"""wicd - wireless connection daemon frontend implementation
-
-This module implements a usermode frontend for wicd. It updates connection
-information, provides an (optional) tray icon, and allows for launching of
-the wicd GUI and Wired Profile Chooser.
-
-class TrayIcon() -- Parent class of TrayIconGUI and IconConnectionInfo.
- class TrayConnectionInfo() -- Child class of TrayIcon which provides
- and updates connection status.
- class TrayIconGUI() -- Child class of TrayIcon which implements the tray.
- icon itself. Parent class of StatusTrayIconGUI and EggTrayIconGUI.
- class IndicatorTrayIconGUI() -- Implements the tray icon using
- appindicator.Indicator.
- class StatusTrayIconGUI() -- Implements the tray icon using a
- gtk.StatusIcon.
- class EggTrayIconGUI() -- Implements the tray icon using egg.trayicon.
- def usage() -- Prints usage information.
- def main() -- Runs the wicd frontend main loop.
-
-"""
-
-#
-# Copyright (C) 2007 - 2009 Adam Blackburn
-# Copyright (C) 2007 - 2009 Dan O'Reilly
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License Version 2 as
-# published by the Free Software Foundation.
-#
-# 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, see .
-#
-
-import atexit
-import getopt
-import os
-import sys
-
-from dbus import DBusException
-import gtk
-from gi.repository import GLib as gobject
-import pango
-
-import pygtk
-
-try:
- import appindicator
-except ImportError:
- appindicator = None
-
-try:
- import pynotify
-except ImportError:
- pynotify = None
-
-# Wicd specific imports
-from wicd import wpath
-from wicd import misc
-from wicd import dbusmanager
-import gui
-from guiutil import error, can_use_notify
-
-from wicd.translations import _
-
-
-pygtk.require('2.0')
-
-if pynotify and not pynotify.init("Wicd"):
- pynotify = None
-
-ICON_AVAIL = True
-USE_EGG = False
-# Import egg.trayicon if we're using an older gtk version
-if not hasattr(gtk, "StatusIcon"):
- try:
- import egg.trayicon
- USE_EGG = True
- except ImportError:
- print('Unable to load tray icon: Missing both egg.trayicon and '
- 'gtk.StatusIcon modules.')
- ICON_AVAIL = False
-
-misc.RenameProcess("wicd-client")
-
-if __name__ == '__main__':
- wpath.chdir(__file__)
-
-daemon = wireless = wired = lost_dbus_id = None
-DBUS_AVAIL = False
-
-theme = gtk.icon_theme_get_default()
-theme.append_search_path(wpath.images)
-
-
-def catchdbus(func):
- """Decorator to catch DBus exceptions."""
- def wrapper(*args, **kwargs):
- try:
- return func(*args, **kwargs)
- except DBusException as e:
- if e.get_dbus_name() is not None and \
- "DBus.Error.AccessDenied" in e.get_dbus_name():
- error(None,
- _('Unable to contact the Wicd daemon due to an access '
- 'denied error from DBus. Please check that your user '
- 'is in the $A group.').replace("$A", "%s" %
- wpath.wicd_group))
- raise DBusException(e)
- else:
- print(("warning: ignoring exception %s" % e))
- return None
- wrapper.__name__ = func.__name__
- wrapper.__module__ = func.__module__
- wrapper.__dict__ = func.__dict__
- wrapper.__doc__ = func.__doc__
- return wrapper
-
-
-class NetworkMenuItem(gtk.ImageMenuItem):
- """Network menu item."""
- def __init__(self, lbl, is_active=False):
- gtk.ImageMenuItem.__init__(self)
- self.label = gtk.Label(lbl)
- if is_active:
- atrlist = pango.AttrList()
- atrlist.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, 50))
- self.label.set_attributes(atrlist)
- self.label.set_justify(gtk.JUSTIFY_LEFT)
- self.label.set_alignment(0, 0)
- self.add(self.label)
- self.label.show()
-
-
-class TrayIcon(object):
- """Base Tray Icon class.
-
- Base Class for implementing a tray icon to display network status.
-
- """
- def __init__(self, animate, displaytray=True, displayapp=False):
- self.cur_sndbytes = -1
- self.cur_rcvbytes = -1
- self.last_sndbytes = -1
- self.last_rcvbytes = -1
- self.max_snd_gain = 10000
- self.max_rcv_gain = 10000
-
- if appindicator:
- self.tr = self.IndicatorTrayIconGUI(self)
- elif USE_EGG:
- self.tr = self.EggTrayIconGUI(self)
- else:
- self.tr = self.StatusTrayIconGUI(self)
- if displayapp:
- self.tr.toggle_wicd_gui()
- self.icon_info = self.TrayConnectionInfo(self, self.tr, animate)
- self.tr.icon_info = self.icon_info
- print(('displaytray %s' % displaytray))
- self.tr.visible(displaytray)
-
- def is_embedded(self):
- if USE_EGG:
- raise NotImplementedError()
- else:
- return self.tr.is_embedded() # pylint: disable-msg=E1103
-
- def get_bandwidth_bytes(self):
- """Gets the amount of byte sent sine the last time I checked"""
- dev_dir = '/sys/class/net/'
- iface = daemon.GetCurrentInterface()
-
- for fldr in os.listdir(dev_dir):
- if fldr == iface:
- dev_dir = dev_dir + fldr + "/statistics/"
- break
-
- try:
- self.cur_rcvbytes = int(
- open(dev_dir + "rx_bytes", "r").read().strip())
- self.cur_sndbytes = int(
- open(dev_dir + "tx_bytes", "r").read().strip())
- except (IOError, OSError, ValueError):
- self.cur_sndbytes = -1
- self.cur_rcvbytes = -1
-
- class TrayConnectionInfo(object):
- """Class for updating the tray icon status."""
- def __init__(self, parent, tr, animate=True):
- """Initialize variables needed for the icon status methods."""
- self.last_strength = -2
- self.still_wired = False
- self.network = ''
- self.tried_reconnect = False
- self.connection_lost_counter = 0
- self.tr = tr
- self.last_sndbytes = -1
- self.last_rcvbytes = -1
- self.max_snd_gain = 10000
- self.max_rcv_gain = 10000
- self.animate = animate
-
- self.parent = parent
-
- self.network_name = '' # SSID
- self.network_type = 'none' # Wired/Wireless/None
- self.network_str = '' # Signal Strength
- self.network_addr = '0.0.0.0' # IP Address
- self.network_br = '' # Bitrate
-
- # keep track of the last state to provide appropriate
- # notifications
- self._last_bubble = None
- self.last_state = None
- self.should_notify = True
-
- if DBUS_AVAIL:
- self.update_tray_icon()
- else:
- handle_no_dbus()
- self.set_not_connected_state()
-
- # Initial update of the tooltip
- self.update_tooltip()
-
- def update_tooltip(self):
- """
- Updates the trayicon tooltip based on current connection status
- """
- if (self.network_type == "none"):
- self.tr.set_tooltip(_('Not connected'))
- elif (self.network_type == "wireless"):
- self.tr.set_tooltip(_('Connected to $A at $B (IP: $C)')
- .replace('$A', self.network_name)
- .replace('$B', self.network_str)
- .replace('$C', self.network_addr))
- elif (self.network_type == "wired"):
- self.tr.set_tooltip(_('Connected to wired network (IP: $A)')
- .replace('$A', self.network_addr))
- elif (self.network_type == "killswitch"):
- self.tr.set_tooltip(_('Not connected') + "(" +
- _('Wireless Kill Switch Enabled') + ")")
- elif (self.network_type == "no_daemon"):
- self.tr.set_tooltip(_('Wicd daemon unreachable'))
-
- return True
-
- def _show_notification(self, title, details, image=None):
- if self.should_notify:
- try:
- if not self._last_bubble:
- self._last_bubble = pynotify.Notification(
- title, details, image)
- self._last_bubble.show()
- else:
- self._last_bubble.clear_actions()
- self._last_bubble.clear_hints()
- self._last_bubble.update(title, details, image)
- self._last_bubble.show()
- except Exception as e:
- if hasattr(e, 'message') and e.message != '':
- msg = e.message
- elif hasattr(e, 'args') and len(e.args) > 0:
- msg = e.args[-1]
- else:
- msg = str(e)
- print(("Exception during notification: %s" % msg))
-
- self.should_notify = False
-
- @catchdbus
- def wired_profile_chooser(self):
- """Launch the wired profile chooser."""
- gui.WiredProfileChooser()
- daemon.SetNeedWiredProfileChooser(False)
-
- def set_wired_state(self, info):
- """Sets the icon info for a wired state."""
- wired_ip = info[0]
- self.network_addr = str(info[0])
- self.network_type = "wired"
- self.tr.set_from_name('wired')
- # status_string = _('Connected to wired network (IP: $A)'). \
- # replace('$A',wired_ip)
- # self.tr.set_tooltip(status_string)
- self._show_notification(_('Wired Network'),
- _('Connection established'),
- 'network-wired')
-
- self.update_tooltip()
-
- @catchdbus
- def set_wireless_state(self, info):
- """Sets the icon info for a wireless state."""
- lock = ''
- wireless_ip = info[0]
- self.network = info[1]
- strength = info[2]
- cur_net_id = int(info[3])
- sig_string = daemon.FormatSignalForPrinting(str(strength))
- self.network_type = "wireless"
- self.network_addr = str(info[0])
- self.network_name = info[1]
- self.network_str = sig_string
- self.network_br = info[4]
- self.set_signal_image(int(info[2]), lock)
-
- if wireless.GetWirelessProperty(cur_net_id, "encryption"):
- lock = "-lock"
- # status_string = (_('Connected to $A at $B (IP: $C)')
- # .replace('$A', self.network)
- # .replace('$B', sig_string)
- # .replace('$C', str(wireless_ip)))
- # self.tr.set_tooltip(status_string)
- self.set_signal_image(int(strength), lock)
- self._show_notification(self.network,
- _('Connection established'),
- 'network-wireless')
-
- self.update_tooltip()
-
- def set_connecting_state(self, info):
- """Sets the icon info for a connecting state."""
- wired = False
- if info[0] == 'wired' and len(info) == 1:
- cur_network = _('Wired Network')
- wired = True
- else:
- cur_network = info[1]
- status_string = _('Connecting') + " to " + cur_network + "..."
- self.update_tooltip()
- # self.tr.set_tooltip(status_string)
- self.tr.set_from_name('no-signal')
- if wired:
- self._show_notification(cur_network,
- _('Establishing connection...'),
- 'network-wired')
- else:
- self._show_notification(cur_network,
- _('Establishing connection...'),
- 'network-wireless')
-
- @catchdbus
- def set_not_connected_state(self, info=None):
- """Set the icon info for the not connected state."""
- self.tr.set_from_name('no-signal')
- if not DBUS_AVAIL:
- status = _('Wicd daemon unreachable')
- elif wireless.GetKillSwitchEnabled():
- status = (_('Not connected') + " (" +
- _('Wireless Kill Switch Enabled') + ")")
- else:
- status = _('Not connected')
- # self.tr.set_tooltip(status)
- self._show_notification(_('Disconnected'), None, 'stop')
- self.update_tooltip()
-
- @catchdbus
- def update_tray_icon(self, state=None, info=None):
- """Updates the tray icon and current connection status."""
- if not DBUS_AVAIL:
- return False
-
- if not state or not info:
- [state, info] = daemon.GetConnectionStatus()
-
- # should this state change display a notification?
- self.should_notify = (can_use_notify() and
- self.last_state != state)
-
- self.last_state = state
-
- if state == misc.WIRED:
- self.set_wired_state(info)
- elif state == misc.WIRELESS:
- self.set_wireless_state(info)
- elif state == misc.CONNECTING:
- self.set_connecting_state(info)
- elif state in (misc.SUSPENDED, misc.NOT_CONNECTED):
- self.set_not_connected_state(info)
- else:
- print('Invalid state returned!!!')
- return False
- return True
-
- @catchdbus
- def set_signal_image(self, wireless_signal, lock):
- """Sets the tray icon image for an active wireless connection."""
- if self.animate:
- TrayIcon.get_bandwidth_bytes(self.parent)
- prefix = self.get_bandwidth_activity()
- else:
- prefix = 'idle-'
- if daemon.GetSignalDisplayType() == 0:
- if wireless_signal > 75:
- signal_img = "high-signal"
- elif wireless_signal > 50:
- signal_img = "good-signal"
- elif wireless_signal > 25:
- signal_img = "low-signal"
- else:
- signal_img = "bad-signal"
- else:
- if wireless_signal >= -60:
- signal_img = "high-signal"
- elif wireless_signal >= -70:
- signal_img = "good-signal"
- elif wireless_signal >= -80:
- signal_img = "low-signal"
- else:
- signal_img = "bad-signal"
- img_name = ''.join([prefix, signal_img, lock])
- self.tr.set_from_name(img_name)
-
- @catchdbus
- def get_bandwidth_activity(self):
- """Determines what network activity state we are in."""
- transmitting = False
- receiving = False
-
- dev_dir = '/sys/class/net/'
- wiface = daemon.GetWirelessInterface()
- for fldr in os.listdir(dev_dir):
- if fldr == wiface:
- dev_dir = dev_dir + fldr + "/statistics/"
- break
- try:
- rcvbytes = int(open(dev_dir + "rx_bytes", "r").read().strip())
- sndbytes = int(open(dev_dir + "tx_bytes", "r").read().strip())
- except IOError:
- sndbytes = None
- rcvbytes = None
-
- if not rcvbytes or not sndbytes:
- return 'idle-'
-
- # Figure out receiving data info.
- activity = self.is_network_active(self.parent.cur_rcvbytes,
- self.parent.max_rcv_gain,
- self.parent.last_rcvbytes)
- receiving = activity[0]
- self.parent.max_rcv_gain = activity[1]
- self.parent.last_rcvbytes = activity[2]
-
- # Figure out out transmitting data info.
- activity = self.is_network_active(self.parent.cur_sndbytes,
- self.parent.max_snd_gain,
- self.parent.last_sndbytes)
- transmitting = activity[0]
- self.parent.max_snd_gain = activity[1]
- self.parent.last_sndbytes = activity[2]
-
- if transmitting and receiving:
- return 'both-'
- elif transmitting:
- return 'transmitting-'
- elif receiving:
- return 'receiving-'
- else:
- return 'idle-'
-
- def is_network_active(self, bytes, max_gain, last_bytes):
- """Determines if a network is active.
-
- Determines if a network is active by looking at the
- number of bytes sent since the previous check. This method
- is generic, and can be used to determine activity in both
- the sending and receiving directions.
-
- Returns:
- A tuple containing three elements:
- 1) a boolean specifying if the network is active.
- 2) an int specifying the maximum gain the network has had.
- 3) an int specifying the last recorded number of bytes sent.
-
- """
- active = False
- if last_bytes == -1:
- last_bytes = bytes
- elif bytes > (last_bytes + float(max_gain / 20.0)):
- last_bytes = bytes
- active = True
-
- gain = bytes - last_bytes
- if gain > max_gain:
- max_gain = gain
- return (active, max_gain, last_bytes)
-
- class TrayIconGUI(object):
- """Base Tray Icon UI class.
-
- Implements methods and variables used by both egg/StatusIcon
- tray icons.
-
- """
- def __init__(self, parent):
- self.list = []
- self.label = None
- self.data = None
-
- menu = """
-
-
-
-
-
- """
- actions = [
- ('Menu', None, 'Menu'),
- ('Connect', gtk.STOCK_CONNECT, _('Connect')),
- ('Info', gtk.STOCK_INFO, _('_Connection Info'), None,
- _('Information about the current connection'),
- self.on_conn_info),
- ('Quit', gtk.STOCK_QUIT, _('_Quit'), None,
- _('Quit wicd-tray-icon'), self.on_quit),
- ]
- actg = gtk.ActionGroup('Actions')
- actg.add_actions(actions)
- self.manager = gtk.UIManager()
- self.manager.insert_action_group(actg, 0)
- self.manager.add_ui_from_string(menu)
- self.menu = (self.manager.get_widget('/Menubar/Menu/Quit').
- props.parent)
- self.gui_win = None
- self.current_icon_name = None
- self._is_scanning = False
- net_menuitem = self.manager.get_widget("/Menubar/Menu/Connect/")
- if not appindicator:
- net_menuitem.connect("activate", self.on_net_menu_activate)
-
- self.parent = parent
- self.time = 2 # Time between updates
- self.cont = 'Stop'
- self.conn_info_txt = ''
-
- def tray_scan_started(self):
- """Callback for when a wireless scan is started."""
- if not DBUS_AVAIL:
- return
- self._is_scanning = True
- self.init_network_menu()
-
- def tray_scan_ended(self):
- """Callback for when a wireless scan finishes."""
- if not DBUS_AVAIL:
- return
- self._is_scanning = False
- self.populate_network_menu()
-
- def on_activate(self, data=None):
- """Opens the wicd GUI."""
- if DBUS_AVAIL:
- self.toggle_wicd_gui()
- else:
- # error(None,
- # _('The wicd daemon is unavailable, so your request '
- # 'cannot be completed'))
- pass
-
- def on_quit(self, widget=None):
- """Closes the tray icon."""
- sys.exit(0)
-
- def on_about(self, data=None):
- """Opens the About Dialog."""
- dialog = gtk.AboutDialog()
- dialog.set_name('Wicd Tray Icon')
- dialog.set_version('2.0')
- dialog.set_comments('An icon that shows your network connectivity')
- dialog.set_website('http://launchpad.net/wicd')
- dialog.run()
- dialog.destroy()
-
- def on_conn_info(self, data=None):
- """Opens the Connection Information Dialog"""
- window = gtk.Dialog(
- "Wicd Connection Info",
- None,
- 0,
- (gtk.STOCK_OK, gtk.RESPONSE_CLOSE)
- )
-
- # Create labels
- self.label = gtk.Label()
- self.data = gtk.Label()
- self.data.set_selectable(True)
- self.label.show()
- self.data.show()
- self.list = []
- self.list.append(self.data)
- self.list.append(self.label)
-
- # Setup table
- table = gtk.Table(1, 2)
- table.set_col_spacings(12)
- table.attach(self.label, 0, 1, 0, 1)
- table.attach(self.data, 1, 2, 0, 1)
-
- # Setup Window
- content = window.get_content_area()
- content.pack_start(table, True, True, 0)
- content.show_all()
-
- # Start updates
- self.cont = 'Go'
- gobject.timeout_add(5000, self.update_conn_info_win, self.list)
- self.update_conn_info_win(self.list)
-
- window.run()
-
- # Destroy window and stop updates
- window.destroy()
- self.cont = 'Stop'
-
- def update_conn_info_win(self, *args):
- """Updates the information in the connection summary window"""
- if (self.cont == "Stop"):
- return False
-
- [state, info] = daemon.GetConnectionStatus()
- [rx, tx] = self.get_current_bandwidth()
-
- # Choose info for the data
- if state == misc.WIRED:
- text = (_("$A\n$B KB/s\n$C KB/s")
- .replace('$A', str(info[0])) # IP
- .replace('$B', str(rx)) # RX
- .replace('$C', str(tx))) # TX
- elif state == misc.WIRELESS:
- text = (_("$A\n$B\n$C\n$D\n$E KB/s\n$F KB/s")
- .replace('$A', str(info[1])) # SSID
- .replace('$B', str(info[4])) # Speed
- .replace('$C', str(info[0])) # IP
- .replace('$D',
- daemon.FormatSignalForPrinting(str(info[2])))
- .replace('$E', str(rx))
- .replace('$F', str(tx)))
- else:
- text = ''
-
- # Choose info for the labels
- self.list[0].set_text('\n' + text)
- if state == misc.WIRED:
- self.list[1].set_text(_("Wired\nIP:\nRX:\nTX:"))
- elif state == misc.WIRELESS:
- self.list[1].set_text(_("Wireless\nSSID:\nSpeed:\nIP:\n"
- "Strength:\nRX:\nTX:"))
- elif state == misc.CONNECTING:
- self.list[1].set_text(_('Connecting'))
- elif state in (misc.SUSPENDED, misc.NOT_CONNECTED):
- self.list[1].set_text(_('Disconnected'))
-
- return True
-
- def get_current_bandwidth(self):
- """
- Calculates the current bandwidth based on sent/received bytes
- divided over time. Unit is in KB/s
- """
- self.parent.get_bandwidth_bytes()
- rxb = self.parent.cur_rcvbytes - self.parent.last_rcvbytes
- txb = self.parent.cur_sndbytes - self.parent.last_sndbytes
-
- self.parent.last_rcvbytes = self.parent.cur_rcvbytes
- self.parent.last_sndbytes = self.parent.cur_sndbytes
-
- rx_rate = float(rxb / (self.time * 1024))
- tx_rate = float(txb / (self.time * 1024))
-
- return (rx_rate, tx_rate)
-
- def _add_item_to_menu(self, net_menu, lbl, type_, n_id, is_connecting,
- is_active):
- """Add an item to the network list submenu."""
- def network_selected(widget, net_type, net_id):
- """Callback method for a menu item selection."""
- if net_type == "__wired__":
- wired.ConnectWired()
- else:
- wireless.ConnectWireless(net_id)
-
- item = NetworkMenuItem(lbl, is_active)
- image = gtk.Image()
-
- if type_ == "__wired__":
- image.set_from_icon_name("network-wired",
- gtk.ICON_SIZE_SMALL_TOOLBAR)
- else:
- image.set_from_icon_name(self._get_img(n_id),
- gtk.ICON_SIZE_SMALL_TOOLBAR)
- item.set_image(image)
- del image
- item.connect("activate", network_selected, type_, n_id)
- net_menu.append(item)
- item.show()
- if is_connecting:
- item.set_sensitive(False)
- del item
-
- @catchdbus
- def _get_img(self, net_id):
- """Determines which image to use for the wireless entries."""
- def fix_strength(val, default):
- """Assigns given strength to a default value if needed."""
- return val and int(val) or default
-
- def get_prop(prop):
- return wireless.GetWirelessProperty(net_id, prop)
-
- strength = fix_strength(get_prop("quality"), -1)
- dbm_strength = fix_strength(get_prop('strength'), -100)
-
- if daemon.GetWPADriver() == 'ralink legacy' or \
- daemon.GetSignalDisplayType() == 1:
- if dbm_strength >= -60:
- signal_img = 'signal-100'
- elif dbm_strength >= -70:
- signal_img = 'signal-75'
- elif dbm_strength >= -80:
- signal_img = 'signal-50'
- else:
- signal_img = 'signal-25'
- else:
- if strength > 75:
- signal_img = 'signal-100'
- elif strength > 50:
- signal_img = 'signal-75'
- elif strength > 25:
- signal_img = 'signal-50'
- else:
- signal_img = 'signal-25'
- return signal_img
-
- @catchdbus
- def on_net_menu_activate(self, item):
- """Trigger a background scan to populate the network menu.
-
- Called when the network submenu is moused over. We
- sleep briefly, clear pending gtk events, and if
- we're still being moused over we trigger a scan.
- This is to prevent scans when the user is just
- mousing past the menu to select another menu item.
-
- """
- def dummy(x=None):
- pass
-
- if self._is_scanning:
- return True
-
- self.init_network_menu()
- gobject.timeout_add(800, self._trigger_scan_if_needed, item)
-
- @catchdbus
- def _trigger_scan_if_needed(self, item):
- """Trigger a scan if the network menu is being hovered over."""
- while gtk.events_pending():
- gtk.main_iteration()
- if item.state != gtk.STATE_PRELIGHT:
- return True
- wireless.Scan(False)
- return False
-
- @catchdbus
- def populate_network_menu(self, data=None):
- """Populates the network list submenu."""
- def get_prop(net_id, prop):
- return wireless.GetWirelessProperty(net_id, prop)
-
- net_menuitem = self.manager.get_widget("/Menubar/Menu/Connect/")
- submenu = net_menuitem.get_submenu()
- self._clear_menu(submenu)
- if not DBUS_AVAIL:
- net_menuitem.show()
- return
-
- is_connecting = daemon.CheckIfConnecting()
- num_networks = wireless.GetNumberOfNetworks()
- [status, info] = daemon.GetConnectionStatus()
-
- if daemon.GetAlwaysShowWiredInterface() or \
- wired.CheckPluggedIn():
- if status == misc.WIRED:
- is_active = True
- else:
- is_active = False
- self._add_item_to_menu(submenu, "Wired Network", "__wired__",
- 0, is_connecting, is_active)
- sep = gtk.SeparatorMenuItem()
- submenu.append(sep)
- sep.show()
-
- if num_networks > 0:
- skip_never_connect = not daemon.GetShowNeverConnect()
- for x in range(0, num_networks):
- if (skip_never_connect and
- misc.to_bool(get_prop(x, "never"))):
- continue
- essid = get_prop(x, "essid")
- if status == misc.WIRELESS and info[1] == essid:
- is_active = True
- else:
- is_active = False
- self._add_item_to_menu(submenu, essid, "wifi", x,
- is_connecting, is_active)
- else:
- no_nets_item = gtk.MenuItem(_('No wireless networks found.'))
- no_nets_item.set_sensitive(False)
- no_nets_item.show()
- submenu.append(no_nets_item)
-
- submenu.reposition()
- net_menuitem.show()
-
- def init_network_menu(self):
- """Set the right-click network menu to the scanning state."""
- net_menuitem = self.manager.get_widget("/Menubar/Menu/Connect/")
- submenu = net_menuitem.get_submenu()
- self._clear_menu(submenu)
-
- loading_item = gtk.MenuItem(_('Scanning') + "...")
- loading_item.set_sensitive(False)
- loading_item.show()
- submenu.append(loading_item)
- net_menuitem.show()
-
- def _clear_menu(self, menu):
- """Clear the right-click menu."""
- for item in menu.get_children():
- menu.remove(item)
- item.destroy()
-
- def toggle_wicd_gui(self):
- """Toggles the wicd GUI."""
- if not self.gui_win:
- self.gui_win = gui.appGui(tray=self)
- elif not self.gui_win.is_visible:
- self.gui_win.show_win()
- else:
- self.gui_win.exit()
- return True
-
- if USE_EGG:
- class EggTrayIconGUI(TrayIconGUI):
- """Tray Icon for gtk < 2.10.
-
- Uses the deprecated egg.trayicon module to implement the tray icon.
- Since it relies on a deprecated module, this class is only used
- for machines running versions of GTK < 2.10.
-
- """
- def __init__(self, parent):
- """Initializes the tray icon"""
- TrayIcon.TrayIconGUI.__init__(self, parent)
- self.tooltip = gtk.Tooltips()
- self.eb = gtk.EventBox()
- self.tray = egg.trayicon.TrayIcon("WicdTrayIcon")
- self.pic = gtk.Image()
- self.tooltip.set_tip(self.eb, "Initializing wicd...")
- self.pic.set_from_name('no-signal')
-
- self.eb.connect('button_press_event', self.tray_clicked)
- self.eb.add(self.pic)
- self.tray.add(self.eb)
- self.tray.show_all()
-
- def tray_clicked(self, widget, event):
- """Handles tray mouse click events."""
- if event.button == 1:
- self.toggle_wicd_gui()
- elif event.button == 3:
- self.init_network_menu()
- self.menu.popup(None, None, None, event.button, event.time)
-
- def set_from_file(self, val=None):
- """Calls set_from_file on the gtk.Image for the tray icon."""
- self.pic.set_from_file(
- os.path.join(
- wpath.images, 'hicolor/22x22/status/%s.png' % val
- )
- )
-
- def set_tooltip(self, val):
- """Set the tooltip for this tray icon.
-
- Sets the tooltip for the gtk.ToolTips associated with this
- tray icon.
-
- """
- self.tooltip.set_tip(self.eb, val)
-
- def visible(self, val):
- """Set if the icon is visible or not.
-
- If val is True, makes the icon visible, if val is False,
- hides the tray icon.
-
- """
- if val:
- self.tray.show_all()
- else:
- self.tray.hide_all()
-
- if hasattr(gtk, "StatusIcon"):
- class StatusTrayIconGUI(gtk.StatusIcon, TrayIconGUI):
- """Class for creating the wicd tray icon on gtk > 2.10.
-
- Uses gtk.StatusIcon to implement a tray icon.
-
- """
- def __init__(self, parent):
- TrayIcon.TrayIconGUI.__init__(self, parent)
- gtk.StatusIcon.__init__(self)
-
- self.current_icon_name = ''
- self.set_visible(True)
- self.connect('activate', self.on_activate)
- self.connect('popup-menu', self.on_popup_menu)
- self.set_from_name('no-signal')
- self.set_tooltip("Initializing wicd...")
-
- def on_popup_menu(self, status, button, timestamp):
- """Opens the right click menu for the tray icon."""
- self.init_network_menu()
- self.menu.popup(None, None, gtk.status_icon_position_menu,
- button, timestamp, self)
-
- def set_from_name(self, name=None):
- """Sets a new tray icon picture."""
- if name != self.current_icon_name:
- self.current_icon_name = name
- gtk.StatusIcon.set_from_icon_name(self, name)
-
- def visible(self, val):
- """Set if the icon is visible or not.
-
- If val is True, makes the icon visible, if val is False,
- hides the tray icon.
-
- """
- self.set_visible(val)
-
- if appindicator:
- class IndicatorTrayIconGUI(gtk.StatusIcon, TrayIconGUI):
- """Class for creating the wicd AppIndicator.
- This is required on recent versions of Unity (>=13.04).
-
- Uses appindicator.Indicator to implement a tray icon.
-
- """
- def __init__(self, parent):
- TrayIcon.TrayIconGUI.__init__(self, parent)
- self.ind = appindicator.Indicator("wicd", "wicd-gtk",
- appindicator.
- CATEGORY_SYSTEM_SERVICES,
- wpath.images)
- self.current_icon_name = ''
-
- # Rescaning when hovering over the net_menu doesn't work.
- # (AFAICT, AppIndicator menus don't report PRELIGHT status.)
- # We use a separate menu item instead.
- rescan = gtk.MenuItem("Rescan")
- self.menu.prepend(rescan)
- rescan.connect("activate", self.on_rescan)
- rescan.show()
-
- sep = gtk.SeparatorMenuItem()
- self.menu.prepend(sep)
- sep.show()
-
- # AppIndicator does not support tooltips so we use a
- # menu item to contain what was the tooltip.
- #
- # Also, since AppIndicator does not support actions on
- # clicking the tray icon, we use this tooltip menu
- # item to toggle the GUI
- self.tooltip_item = gtk.MenuItem("Initializing wicd...")
- self.menu.prepend(self.tooltip_item)
- self.tooltip_item.connect("activate", self.on_activate)
- self.tooltip_item.show()
-
- self.ind.set_menu(self.menu)
-
- def on_rescan(self, *data):
- """Triggers a network rescan that updates the 'Connect' menu
- when the 'Rescan' menu item is selected.
- """
- self.init_network_menu()
- wireless.Scan(False)
-
- def set_from_file(self, path=None):
- """Sets a new tray icon picture."""
- if path != self.current_icon_path:
- self.current_icon_path = path
- self.ind.set_icon(path)
-
- def set_from_name(self, name=None):
- """Sets a new tray icon picture."""
- if name != self.current_icon_name:
- self.current_icon_name = name
- self.ind.set_icon(name)
-
- def visible(self, val):
- """Set if the icon is visible or not.
-
- If val is True, makes the icon visible, if val is False,
- hides the tray icon.
-
- """
- self.ind.set_status(val and appindicator.STATUS_ACTIVE or
- appindicator.STATUS_PASSIVE)
-
- def set_tooltip(self, str):
- """Set the tooltip for this tray icon.
-
- Since AppIndicators do not support tooltips, actually
- sets the label for the top menu item associated with
- this tray icon.
-
- """
- self.tooltip_item.set_label(str)
-
-
-def usage():
- """Print usage information."""
- print("""
-wicd %s
-wireless (and wired) connection daemon front-end.
-
-Arguments:
-\t-t\t--tray\tRun the wicd tray icon only.
-\t-n\t--no-tray\tRun wicd without the tray icon.
-\t-h\t--help\t\tPrint this help information.
-\t-a\t--no-animate\tRun the tray without network traffic tray animations.
-\t-o\t--only-notifications\tDon't display anything except notifications.
-""" % wpath.version)
-
-
-def setup_dbus(force=True):
- """Initialize DBus."""
- global daemon, wireless, wired, DBUS_AVAIL, lost_dbus_id
- print("Connecting to daemon...")
- try:
- dbusmanager.connect_to_dbus()
- except DBusException:
- if force:
- print("Can't connect to the daemon, trying to start it "
- "automatically...")
- misc.PromptToStartDaemon()
- try:
- dbusmanager.connect_to_dbus()
- except DBusException:
- error(None, _("Could not connect to wicd's D-Bus interface. "
- "Check the wicd log for error messages."))
- return False
- else:
- return False
-
- if lost_dbus_id:
- gobject.source_remove(lost_dbus_id)
- lost_dbus_id = None
- dbus_ifaces = dbusmanager.get_dbus_ifaces()
- daemon = dbus_ifaces['daemon']
- wireless = dbus_ifaces['wireless']
- wired = dbus_ifaces['wired']
- DBUS_AVAIL = True
- print("Connected.")
- return True
-
-
-def on_exit():
- """Handle GUI exit."""
- if DBUS_AVAIL:
- try:
- daemon.SetGUIOpen(False)
- except DBusException:
- pass
-
-
-def handle_no_dbus():
- """Called when dbus announces its shutting down."""
- global DBUS_AVAIL, lost_dbus_id
- DBUS_AVAIL = False
- gui.handle_no_dbus(from_tray=True)
- print("Wicd daemon is shutting down!")
- err_msg = _('The wicd daemon has shut down. The UI will not function '
- 'properly until it is restarted.')
- lost_dbus_id = misc.timeout_add(5, lambda: error(None, err_msg,
- block=False))
- return False
-
-
-@catchdbus
-def main(argv):
- """The main frontend program.
-
- Keyword arguments:
- argv -- The arguments passed to the script.
-
- """
- try:
- opts, args = getopt.getopt(
- sys.argv[1:],
- 'tnhao',
- ['help', 'no-tray', 'tray', 'no-animate', 'only-notifications']
- )
- except getopt.GetoptError:
- # Print help information and exit
- usage()
- sys.exit(2)
-
- use_tray = True
- animate = True
- display_app = True
- for opt, a in opts:
- if opt in ('-h', '--help'):
- usage()
- sys.exit(0)
- elif opt in ('-t', '--tray'):
- display_app = False
- elif opt in ('-n', '--no-tray'):
- use_tray = False
- elif opt in ('-a', '--no-animate'):
- animate = False
- elif opt in ('-o', '--only-notifications'):
- print("only displaying notifications")
- use_tray = False
- display_app = False
- else:
- usage()
- sys.exit(2)
-
- print('Loading...')
- setup_dbus()
- atexit.register(on_exit)
-
- if display_app and not use_tray or not ICON_AVAIL:
- gui.appGui(standalone=True)
- mainloop = gobject.MainLoop()
- mainloop.run()
- sys.exit(0)
-
- # Set up the tray icon GUI and backend
- tray_icon = TrayIcon(animate, displaytray=use_tray, displayapp=display_app)
-
- # Check to see if wired profile chooser was called before icon
- # was launched (typically happens on startup or daemon restart).
- if DBUS_AVAIL and daemon.GetNeedWiredProfileChooser():
- daemon.SetNeedWiredProfileChooser(False)
- tray_icon.icon_info.wired_profile_chooser()
-
- bus = dbusmanager.get_bus()
- bus.add_signal_receiver(tray_icon.icon_info.wired_profile_chooser,
- 'LaunchChooser', 'org.wicd.daemon')
- bus.add_signal_receiver(tray_icon.icon_info.update_tray_icon,
- 'StatusChanged', 'org.wicd.daemon')
- bus.add_signal_receiver(tray_icon.tr.tray_scan_ended, 'SendEndScanSignal',
- 'org.wicd.daemon.wireless')
- bus.add_signal_receiver(tray_icon.tr.tray_scan_started,
- 'SendStartScanSignal', 'org.wicd.daemon.wireless')
- bus.add_signal_receiver(
- lambda: (
- handle_no_dbus() or tray_icon.icon_info.set_not_connected_state()
- ),
- "DaemonClosing",
- 'org.wicd.daemon'
- )
- bus.add_signal_receiver(lambda: setup_dbus(force=False), "DaemonStarting",
- "org.wicd.daemon")
- print('Done loading.')
- mainloop = gobject.MainLoop()
- mainloop.run()
-
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/icons/128x128/apps/wicd-gtk.png b/icons/128x128/apps/wicd-gtk.png
deleted file mode 100644
index a546623..0000000
Binary files a/icons/128x128/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/16x16/apps/wicd-gtk.png b/icons/16x16/apps/wicd-gtk.png
deleted file mode 100644
index 5d946ff..0000000
Binary files a/icons/16x16/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/192x192/apps/wicd-gtk.png b/icons/192x192/apps/wicd-gtk.png
deleted file mode 100644
index 607dd8c..0000000
Binary files a/icons/192x192/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/22x22/apps/wicd-gtk.png b/icons/22x22/apps/wicd-gtk.png
deleted file mode 100644
index a906f4c..0000000
Binary files a/icons/22x22/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/24x24/apps/wicd-gtk.png b/icons/24x24/apps/wicd-gtk.png
deleted file mode 100644
index 42f8a7b..0000000
Binary files a/icons/24x24/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/32x32/apps/wicd-gtk.png b/icons/32x32/apps/wicd-gtk.png
deleted file mode 100644
index fb05a6d..0000000
Binary files a/icons/32x32/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/36x36/apps/wicd-gtk.png b/icons/36x36/apps/wicd-gtk.png
deleted file mode 100644
index dd6ba06..0000000
Binary files a/icons/36x36/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/48x48/apps/wicd-gtk.png b/icons/48x48/apps/wicd-gtk.png
deleted file mode 100644
index ef0f767..0000000
Binary files a/icons/48x48/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/64x64/apps/wicd-gtk.png b/icons/64x64/apps/wicd-gtk.png
deleted file mode 100644
index f569077..0000000
Binary files a/icons/64x64/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/72x72/apps/wicd-gtk.png b/icons/72x72/apps/wicd-gtk.png
deleted file mode 100644
index d3c45e9..0000000
Binary files a/icons/72x72/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/96x96/apps/wicd-gtk.png b/icons/96x96/apps/wicd-gtk.png
deleted file mode 100644
index 6bdd5cc..0000000
Binary files a/icons/96x96/apps/wicd-gtk.png and /dev/null differ
diff --git a/icons/scalable/apps/wicd-gtk.svg b/icons/scalable/apps/wicd-gtk.svg
deleted file mode 100644
index 2f46f58..0000000
--- a/icons/scalable/apps/wicd-gtk.svg
+++ /dev/null
@@ -1,178 +0,0 @@
-
-
-
diff --git a/images/16x16/status/signal-100.png b/images/16x16/status/signal-100.png
deleted file mode 100644
index 0eb0288..0000000
Binary files a/images/16x16/status/signal-100.png and /dev/null differ
diff --git a/images/16x16/status/signal-25.png b/images/16x16/status/signal-25.png
deleted file mode 100644
index 72e0148..0000000
Binary files a/images/16x16/status/signal-25.png and /dev/null differ
diff --git a/images/16x16/status/signal-50.png b/images/16x16/status/signal-50.png
deleted file mode 100644
index 177c716..0000000
Binary files a/images/16x16/status/signal-50.png and /dev/null differ
diff --git a/images/16x16/status/signal-75.png b/images/16x16/status/signal-75.png
deleted file mode 100644
index 599df25..0000000
Binary files a/images/16x16/status/signal-75.png and /dev/null differ
diff --git a/images/22x22/status/bad-signal-lock.png b/images/22x22/status/bad-signal-lock.png
deleted file mode 100644
index 0b5ff2f..0000000
Binary files a/images/22x22/status/bad-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/bad-signal.png b/images/22x22/status/bad-signal.png
deleted file mode 100644
index 0b5ff2f..0000000
Binary files a/images/22x22/status/bad-signal.png and /dev/null differ
diff --git a/images/22x22/status/both-bad-signal-lock.png b/images/22x22/status/both-bad-signal-lock.png
deleted file mode 100644
index 38cb205..0000000
Binary files a/images/22x22/status/both-bad-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/both-bad-signal.png b/images/22x22/status/both-bad-signal.png
deleted file mode 100644
index 38cb205..0000000
Binary files a/images/22x22/status/both-bad-signal.png and /dev/null differ
diff --git a/images/22x22/status/both-good-signal-lock.png b/images/22x22/status/both-good-signal-lock.png
deleted file mode 100644
index 2bb8626..0000000
Binary files a/images/22x22/status/both-good-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/both-good-signal.png b/images/22x22/status/both-good-signal.png
deleted file mode 100644
index 2bb8626..0000000
Binary files a/images/22x22/status/both-good-signal.png and /dev/null differ
diff --git a/images/22x22/status/both-high-signal-lock.png b/images/22x22/status/both-high-signal-lock.png
deleted file mode 100644
index 5132836..0000000
Binary files a/images/22x22/status/both-high-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/both-high-signal.png b/images/22x22/status/both-high-signal.png
deleted file mode 100644
index 5132836..0000000
Binary files a/images/22x22/status/both-high-signal.png and /dev/null differ
diff --git a/images/22x22/status/both-low-signal-lock.png b/images/22x22/status/both-low-signal-lock.png
deleted file mode 100644
index 7ab10fd..0000000
Binary files a/images/22x22/status/both-low-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/both-low-signal.png b/images/22x22/status/both-low-signal.png
deleted file mode 100644
index 7ab10fd..0000000
Binary files a/images/22x22/status/both-low-signal.png and /dev/null differ
diff --git a/images/22x22/status/good-signal-lock.png b/images/22x22/status/good-signal-lock.png
deleted file mode 100644
index 9109295..0000000
Binary files a/images/22x22/status/good-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/good-signal.png b/images/22x22/status/good-signal.png
deleted file mode 100644
index 9109295..0000000
Binary files a/images/22x22/status/good-signal.png and /dev/null differ
diff --git a/images/22x22/status/high-signal-lock.png b/images/22x22/status/high-signal-lock.png
deleted file mode 100644
index 6223add..0000000
Binary files a/images/22x22/status/high-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/high-signal.png b/images/22x22/status/high-signal.png
deleted file mode 100644
index 6223add..0000000
Binary files a/images/22x22/status/high-signal.png and /dev/null differ
diff --git a/images/22x22/status/idle-bad-signal-lock.png b/images/22x22/status/idle-bad-signal-lock.png
deleted file mode 100644
index 0b5ff2f..0000000
Binary files a/images/22x22/status/idle-bad-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/idle-bad-signal.png b/images/22x22/status/idle-bad-signal.png
deleted file mode 100644
index 0b5ff2f..0000000
Binary files a/images/22x22/status/idle-bad-signal.png and /dev/null differ
diff --git a/images/22x22/status/idle-good-signal-lock.png b/images/22x22/status/idle-good-signal-lock.png
deleted file mode 100644
index 9109295..0000000
Binary files a/images/22x22/status/idle-good-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/idle-good-signal.png b/images/22x22/status/idle-good-signal.png
deleted file mode 100644
index 9109295..0000000
Binary files a/images/22x22/status/idle-good-signal.png and /dev/null differ
diff --git a/images/22x22/status/idle-high-signal-lock.png b/images/22x22/status/idle-high-signal-lock.png
deleted file mode 100644
index 6223add..0000000
Binary files a/images/22x22/status/idle-high-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/idle-high-signal.png b/images/22x22/status/idle-high-signal.png
deleted file mode 100644
index 6223add..0000000
Binary files a/images/22x22/status/idle-high-signal.png and /dev/null differ
diff --git a/images/22x22/status/idle-low-signal-lock.png b/images/22x22/status/idle-low-signal-lock.png
deleted file mode 100644
index c569e5c..0000000
Binary files a/images/22x22/status/idle-low-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/idle-low-signal.png b/images/22x22/status/idle-low-signal.png
deleted file mode 100644
index c569e5c..0000000
Binary files a/images/22x22/status/idle-low-signal.png and /dev/null differ
diff --git a/images/22x22/status/low-signal-lock.png b/images/22x22/status/low-signal-lock.png
deleted file mode 100644
index c569e5c..0000000
Binary files a/images/22x22/status/low-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/low-signal.png b/images/22x22/status/low-signal.png
deleted file mode 100644
index c569e5c..0000000
Binary files a/images/22x22/status/low-signal.png and /dev/null differ
diff --git a/images/22x22/status/no-signal.png b/images/22x22/status/no-signal.png
deleted file mode 100644
index a410637..0000000
Binary files a/images/22x22/status/no-signal.png and /dev/null differ
diff --git a/images/22x22/status/receiving-bad-signal-lock.png b/images/22x22/status/receiving-bad-signal-lock.png
deleted file mode 100644
index 0d54c5d..0000000
Binary files a/images/22x22/status/receiving-bad-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/receiving-bad-signal.png b/images/22x22/status/receiving-bad-signal.png
deleted file mode 100644
index 0d54c5d..0000000
Binary files a/images/22x22/status/receiving-bad-signal.png and /dev/null differ
diff --git a/images/22x22/status/receiving-good-signal-lock.png b/images/22x22/status/receiving-good-signal-lock.png
deleted file mode 100644
index 752c233..0000000
Binary files a/images/22x22/status/receiving-good-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/receiving-good-signal.png b/images/22x22/status/receiving-good-signal.png
deleted file mode 100644
index 752c233..0000000
Binary files a/images/22x22/status/receiving-good-signal.png and /dev/null differ
diff --git a/images/22x22/status/receiving-high-signal-lock.png b/images/22x22/status/receiving-high-signal-lock.png
deleted file mode 100644
index 22393ce..0000000
Binary files a/images/22x22/status/receiving-high-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/receiving-high-signal.png b/images/22x22/status/receiving-high-signal.png
deleted file mode 100644
index 22393ce..0000000
Binary files a/images/22x22/status/receiving-high-signal.png and /dev/null differ
diff --git a/images/22x22/status/receiving-low-signal-lock.png b/images/22x22/status/receiving-low-signal-lock.png
deleted file mode 100644
index f0db613..0000000
Binary files a/images/22x22/status/receiving-low-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/receiving-low-signal.png b/images/22x22/status/receiving-low-signal.png
deleted file mode 100644
index f0db613..0000000
Binary files a/images/22x22/status/receiving-low-signal.png and /dev/null differ
diff --git a/images/22x22/status/signal-100.png b/images/22x22/status/signal-100.png
deleted file mode 100644
index 4aaba84..0000000
Binary files a/images/22x22/status/signal-100.png and /dev/null differ
diff --git a/images/22x22/status/signal-25.png b/images/22x22/status/signal-25.png
deleted file mode 100644
index 2e271ab..0000000
Binary files a/images/22x22/status/signal-25.png and /dev/null differ
diff --git a/images/22x22/status/signal-50.png b/images/22x22/status/signal-50.png
deleted file mode 100644
index de5918b..0000000
Binary files a/images/22x22/status/signal-50.png and /dev/null differ
diff --git a/images/22x22/status/signal-75.png b/images/22x22/status/signal-75.png
deleted file mode 100644
index 9335516..0000000
Binary files a/images/22x22/status/signal-75.png and /dev/null differ
diff --git a/images/22x22/status/transmitting-bad-signal-lock.png b/images/22x22/status/transmitting-bad-signal-lock.png
deleted file mode 100644
index 41878ae..0000000
Binary files a/images/22x22/status/transmitting-bad-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/transmitting-bad-signal.png b/images/22x22/status/transmitting-bad-signal.png
deleted file mode 100644
index 41878ae..0000000
Binary files a/images/22x22/status/transmitting-bad-signal.png and /dev/null differ
diff --git a/images/22x22/status/transmitting-good-signal-lock.png b/images/22x22/status/transmitting-good-signal-lock.png
deleted file mode 100644
index baa6c1c..0000000
Binary files a/images/22x22/status/transmitting-good-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/transmitting-good-signal.png b/images/22x22/status/transmitting-good-signal.png
deleted file mode 100644
index baa6c1c..0000000
Binary files a/images/22x22/status/transmitting-good-signal.png and /dev/null differ
diff --git a/images/22x22/status/transmitting-high-signal-lock.png b/images/22x22/status/transmitting-high-signal-lock.png
deleted file mode 100644
index 9907e5d..0000000
Binary files a/images/22x22/status/transmitting-high-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/transmitting-high-signal.png b/images/22x22/status/transmitting-high-signal.png
deleted file mode 100644
index 9907e5d..0000000
Binary files a/images/22x22/status/transmitting-high-signal.png and /dev/null differ
diff --git a/images/22x22/status/transmitting-low-signal-lock.png b/images/22x22/status/transmitting-low-signal-lock.png
deleted file mode 100644
index a1a02ef..0000000
Binary files a/images/22x22/status/transmitting-low-signal-lock.png and /dev/null differ
diff --git a/images/22x22/status/transmitting-low-signal.png b/images/22x22/status/transmitting-low-signal.png
deleted file mode 100644
index a1a02ef..0000000
Binary files a/images/22x22/status/transmitting-low-signal.png and /dev/null differ
diff --git a/images/22x22/status/wired.png b/images/22x22/status/wired.png
deleted file mode 100644
index b7f593c..0000000
Binary files a/images/22x22/status/wired.png and /dev/null differ
diff --git a/images/24x24/status/signal-100.png b/images/24x24/status/signal-100.png
deleted file mode 100644
index fae16df..0000000
Binary files a/images/24x24/status/signal-100.png and /dev/null differ
diff --git a/images/24x24/status/signal-25.png b/images/24x24/status/signal-25.png
deleted file mode 100644
index cfb4e99..0000000
Binary files a/images/24x24/status/signal-25.png and /dev/null differ
diff --git a/images/24x24/status/signal-50.png b/images/24x24/status/signal-50.png
deleted file mode 100644
index b9c9420..0000000
Binary files a/images/24x24/status/signal-50.png and /dev/null differ
diff --git a/images/24x24/status/signal-75.png b/images/24x24/status/signal-75.png
deleted file mode 100644
index ba46fb3..0000000
Binary files a/images/24x24/status/signal-75.png and /dev/null differ
diff --git a/images/32x32/status/signal-100.png b/images/32x32/status/signal-100.png
deleted file mode 100644
index c2c75ee..0000000
Binary files a/images/32x32/status/signal-100.png and /dev/null differ
diff --git a/images/32x32/status/signal-25.png b/images/32x32/status/signal-25.png
deleted file mode 100644
index d9c3b01..0000000
Binary files a/images/32x32/status/signal-25.png and /dev/null differ
diff --git a/images/32x32/status/signal-50.png b/images/32x32/status/signal-50.png
deleted file mode 100644
index b040f0d..0000000
Binary files a/images/32x32/status/signal-50.png and /dev/null differ
diff --git a/images/32x32/status/signal-75.png b/images/32x32/status/signal-75.png
deleted file mode 100644
index 537ed8c..0000000
Binary files a/images/32x32/status/signal-75.png and /dev/null differ
diff --git a/images/36x36/status/signal-100.png b/images/36x36/status/signal-100.png
deleted file mode 100644
index d60b620..0000000
Binary files a/images/36x36/status/signal-100.png and /dev/null differ
diff --git a/images/36x36/status/signal-25.png b/images/36x36/status/signal-25.png
deleted file mode 100644
index 173e95c..0000000
Binary files a/images/36x36/status/signal-25.png and /dev/null differ
diff --git a/images/36x36/status/signal-50.png b/images/36x36/status/signal-50.png
deleted file mode 100644
index 3220899..0000000
Binary files a/images/36x36/status/signal-50.png and /dev/null differ
diff --git a/images/36x36/status/signal-75.png b/images/36x36/status/signal-75.png
deleted file mode 100644
index ef3761e..0000000
Binary files a/images/36x36/status/signal-75.png and /dev/null differ
diff --git a/images/48x48/devices/wired-gui.png b/images/48x48/devices/wired-gui.png
deleted file mode 100644
index 9a65ad9..0000000
Binary files a/images/48x48/devices/wired-gui.png and /dev/null differ
diff --git a/images/48x48/status/signal-100.png b/images/48x48/status/signal-100.png
deleted file mode 100644
index bfd17d8..0000000
Binary files a/images/48x48/status/signal-100.png and /dev/null differ
diff --git a/images/48x48/status/signal-25.png b/images/48x48/status/signal-25.png
deleted file mode 100644
index e698b2a..0000000
Binary files a/images/48x48/status/signal-25.png and /dev/null differ
diff --git a/images/48x48/status/signal-50.png b/images/48x48/status/signal-50.png
deleted file mode 100644
index e5fd237..0000000
Binary files a/images/48x48/status/signal-50.png and /dev/null differ
diff --git a/images/48x48/status/signal-75.png b/images/48x48/status/signal-75.png
deleted file mode 100644
index d59763e..0000000
Binary files a/images/48x48/status/signal-75.png and /dev/null differ
diff --git a/images/original/status/signal-100.png b/images/original/status/signal-100.png
deleted file mode 100644
index 744a12b..0000000
Binary files a/images/original/status/signal-100.png and /dev/null differ
diff --git a/images/original/status/signal-25.png b/images/original/status/signal-25.png
deleted file mode 100644
index c4e12d4..0000000
Binary files a/images/original/status/signal-25.png and /dev/null differ
diff --git a/images/original/status/signal-50.png b/images/original/status/signal-50.png
deleted file mode 100644
index 198733a..0000000
Binary files a/images/original/status/signal-50.png and /dev/null differ
diff --git a/images/original/status/signal-75.png b/images/original/status/signal-75.png
deleted file mode 100644
index eaadde4..0000000
Binary files a/images/original/status/signal-75.png and /dev/null differ
diff --git a/images/scalable/devices/wired-gui.svg b/images/scalable/devices/wired-gui.svg
deleted file mode 100644
index 437efcd..0000000
--- a/images/scalable/devices/wired-gui.svg
+++ /dev/null
@@ -1,682 +0,0 @@
-
-
-
diff --git a/other/wicd-gtk.xpm b/other/wicd-gtk.xpm
deleted file mode 100644
index a0f4052..0000000
--- a/other/wicd-gtk.xpm
+++ /dev/null
@@ -1,156 +0,0 @@
-/* XPM */
-static char *wicd_client[] = {
-/* columns rows colors chars-per-pixel */
-"32 32 118 2",
-" c black",
-". c #000100",
-"X c #000200",
-"o c #000300",
-"O c #000301",
-"+ c #000401",
-"@ c #000501",
-"# c #000601",
-"$ c #000801",
-"% c #000901",
-"& c #000902",
-"* c #000B02",
-"= c #000F02",
-"- c #001303",
-"; c #001403",
-": c #001804",
-"> c #001B04",
-", c #001E05",
-"< c #001F05",
-"1 c #002105",
-"2 c #002205",
-"3 c #002406",
-"4 c #002706",
-"5 c #002907",
-"6 c #002D07",
-"7 c #003008",
-"8 c #003108",
-"9 c #003408",
-"0 c #003509",
-"q c #003709",
-"w c #003809",
-"e c #003909",
-"r c #003A09",
-"t c #003C0A",
-"y c #003F0A",
-"u c #00400A",
-"i c #00420B",
-"p c #00440B",
-"a c #00450B",
-"s c #00460B",
-"d c #004A0C",
-"f c #004C0C",
-"g c #004E0D",
-"h c #004F0D",
-"j c #00520D",
-"k c #00530D",
-"l c #00570E",
-"z c #00590E",
-"x c #005D0F",
-"c c #006110",
-"v c #006410",
-"b c #006510",
-"n c #006811",
-"m c #006A11",
-"M c #006D11",
-"N c #006E12",
-"B c #007012",
-"V c #007312",
-"C c #007613",
-"Z c #007913",
-"A c #008115",
-"S c #008215",
-"D c #008315",
-"F c #008616",
-"G c #008716",
-"H c #008A16",
-"J c #008B16",
-"K c #008C16",
-"L c #008E17",
-"P c #008F17",
-"I c #009017",
-"U c #009117",
-"Y c #009518",
-"T c #009D19",
-"R c #00A01A",
-"E c #00A61B",
-"W c #00A71B",
-"Q c #00A81B",
-"! c #00A91B",
-"~ c #00AF1C",
-"^ c #00B01C",
-"/ c #00B11D",
-"( c #00B21D",
-") c #00B31D",
-"_ c #00B91E",
-"` c #00BA1E",
-"' c #00BB1E",
-"] c #00BC1E",
-"[ c #00BF1F",
-"{ c #00C11F",
-"} c #00C820",
-"| c #00CA20",
-" . c #00CE21",
-".. c #00D222",
-"X. c #00D322",
-"o. c #00D422",
-"O. c #00D723",
-"+. c #00DB23",
-"@. c #00DC23",
-"#. c #00DD24",
-"$. c #00E024",
-"%. c #00E124",
-"&. c #00E725",
-"*. c #00ED26",
-"=. c #00EF26",
-"-. c #00EF27",
-";. c #00F127",
-":. c #00F227",
-">. c #00F427",
-",. c #00F527",
-"<. c #00F828",
-"1. c #00F928",
-"2. c #00FB28",
-"3. c #00FC29",
-"4. c #00FD29",
-"5. c #00FE29",
-"6. c #00FF29",
-"7. c None",
-/* pixels */
-"7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7. ; 7.7.7.7.7.7.7.7.7.7.7.7.7.7. - 7.7.7.7.7.7.",
-"7.7.7.7.7.5 Q < 7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.> Q 6 7.7.7.7.7.",
-"7.7.7.7.a :.h 7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.s >.f 7.7.7.7.",
-"7.7.7.0 ,.' 7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7. ( <.t 7.7.7.",
-"7.7.* +.6.i 7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.e 6.%.= 7.7.",
-"7.7.Z 6.#.. 7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7. o.6.S 7.7.",
-"7.@ &.6.P 7.7.7.7.7.v l 7.7.7.7.7.7.7.7.j m 7.7.7.7.7.F 6.*.% 7.",
-"7.a 6.6.k 7.7.7.7.j { 7.7.7.7.7.7.7.7.7.7.` z 7.7.7.7.d 6.6.g 7.",
-"7.G 6.6.4 7.7.7.7.| C 7.7.7.7.7.7.7.7.7.7.B ..7.7.7.7., 6.6.I 7.",
-" ) 6.6.& 7.7.7.y 6.u 7.7.7. 7.7.7.9 6.d 7.7.7.o 3.6.] ",
-" | 6.1. 7.7.7.M 6.7.7.7. 7.7.7.2.V 7.7.7. -.6.X. ",
-" .6.<. 7.7.7.V 6.7.7.7. 7.7.7.<.Z 7.7.7. =.6.O. ",
-" [ 6.6.$ 7.7.7.x 6.7 7.7.7. 7.7.7.1 6.b 7.7.7.X 2.6.} ",
-"7.T 6.6.3 7.7.7.7.;.n 7.7.7. 7.7.7.c ,.7.7.7.7.> 6.6.E ",
-"7.b 6.6.h 7.7.7.7.L W 7.7.7. 7.7.7.R Y 7.7.7.7.s 6.6.N 7.",
-"7.> 3.6.J 7.7.7.7.7.' s 7.7. 7.7.y [ 7.7.7.7.7.A 6.5.2 7.",
-"7. ~ 6.O. 7.7.7.7.7.z O 7. 7.X l 7.7.7.7.7. .6._ 7.",
-"7.7.7 2.6.r 7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.8 6.4.q 7.7.",
-"7.7. D 6./ 7.7.7.7.7.7.7. 7.7.7.7.7.7.7. Q 6.K 7.7.",
-"7.7.7.O ! 6.p 7.7.7.7.7.7.7. 7.7.7.7.7.7.7.t 5.^ @ 7.7.7.",
-"7.7.7.7.+ H $.: 7.7.7.7.7.7. 7.7.7.7.7.7.; @.U # 7.7.7.7.",
-"7.7.7.7.7.7.9 V $ 7.7.7.7.7. 7.7.7.7.7.# B w 7.7.7.7.7.",
-"7.7.7.7.7.7.7.7. 7.7.7.7. 7.7.7.7. 7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7.7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7.7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7.7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7.7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.7.7.",
-"7.7.7.7.7.7.7.7.7.7. 7.7.7.7.7.7.7.7.7.7."
-};
diff --git a/other/wicd-tray.desktop b/other/wicd-tray.desktop
deleted file mode 100644
index eaebcc3..0000000
--- a/other/wicd-tray.desktop
+++ /dev/null
@@ -1,16 +0,0 @@
-[Desktop Entry]
-Categories=Network;Settings;Utility;X-GNOME-NetworkSettings;
-Exec=wicd-gtk --tray
-GenericName=Network Manager
-Icon=wicd-gtk
-Icon[en_US]=wicd-gtk
-Name=Wicd Network Manager Tray
-Name[en_US]=Wicd Network Manager Tray
-Comment=Display network connection status in the system tray
-Comment[en_US]=Display network connection status in the system tray
-Comment[he]=הצגת מצב חיבור רשת במגש מערכת
-Terminal=false
-Type=Application
-Version=1.0
-X-GNOME-Autostart-enabled=true
-X-KDE-autostart-after=panel
diff --git a/other/wicd.desktop b/other/wicd.desktop
deleted file mode 100644
index d8e0c12..0000000
--- a/other/wicd.desktop
+++ /dev/null
@@ -1,14 +0,0 @@
-[Desktop Entry]
-Categories=Network;Settings;Utility;X-GNOME-NetworkSettings;
-Exec=wicd-gtk --no-tray
-GenericName=Network Manager
-Icon=wicd-gtk
-Icon[en_US]=wicd-gtk
-Name=Wicd Network Manager
-Name[en_US]=Wicd Network Manager
-Comment=Start the Wicd client without system tray icon
-Comment[en_US]=Start the Wicd client without system tray icon
-Comment[he]=הפעלת לקוח Wicd בלי סמל מגש מערכת
-Terminal=false
-Type=Application
-Version=1.0
diff --git a/scripts/wicd-gtk b/scripts/wicd-gtk
deleted file mode 100755
index 37eda4a..0000000
--- a/scripts/wicd-gtk
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# check_firstrun()
-if [ ! -d "$HOME/.wicd" ]; then
- mkdir -p "$HOME/.wicd"
-fi
-# Make sure the user knows WHEREAREMYFILES ;-)
-if [ -e "/var/lib/wicd/WHEREAREMYFILES" ] && [ ! -L "$HOME/.wicd/WHEREAREMYFILES" ]; then
- ln -s "/var/lib/wicd/WHEREAREMYFILES" "$HOME/.wicd/WHEREAREMYFILES"
-fi
-
-exec /usr/bin/python3 -O /usr/share/wicd/gtk/wicd-client.py $@
diff --git a/setup.py b/setup.py
index fc892ab..2f89b97 100755
--- a/setup.py
+++ b/setup.py
@@ -437,7 +437,6 @@ class clear_generated(Command):
for item in os.listdir('in'):
if item.endswith('.in'):
print('Removing completed', item, end=' ')
- original_name = os.path.join('in', item)
final_name = item[:-3].replace('=', '/')
print(final_name, '...', end=' ')
if os.path.exists(final_name):
@@ -483,43 +482,6 @@ class install(_install):
(wpath.postconnectscripts, [empty_file])
])
- if not wpath.no_install_gtk:
- data.append((wpath.desktop, ['other/wicd.desktop']))
- data.append((wpath.bin, ['scripts/wicd-client']))
- data.append((wpath.bin, ['scripts/wicd-gtk']))
- data.append((wpath.gtk, [
- 'gtk/wicd-client.py',
- 'gtk/netentry.py',
- 'gtk/prefs.py',
- 'gtk/gui.py',
- 'gtk/guiutil.py',
- 'data/wicd.ui',
- 'gtk/configscript.py',
- ]))
- data.append((wpath.autostart, ['other/wicd-tray.desktop']))
- if not wpath.no_install_man:
- data.append((wpath.mandir + 'man1/', ['man/wicd-client.1']))
- for size in os.listdir('icons'):
- for category in os.listdir(os.path.join('icons', size)):
- imgdir = os.path.join('icons', size, category)
- data.append((os.path.join(wpath.icons, size, category),
- [(os.path.join(imgdir, f))
- for f in os.listdir(imgdir)
- if not f.startswith('.')]))
- for size in os.listdir('images'):
- for category in os.listdir(os.path.join('images', size)):
- imgdir = os.path.join('images', size, category)
- data.append((os.path.join(wpath.images, 'hicolor', size,
- category),
- [(os.path.join(imgdir, f))
- for f in os.listdir(imgdir)
- if not f.startswith('.')]))
- data.append((wpath.pixmaps, ['other/wicd-gtk.xpm']))
- if not wpath.no_install_gnome_shell_extensions:
- data.append(
- (wpath.gnome_shell_extensions + 'wicd@code.hanskalabs.net',
- ['gnome-shell/' + f for f in os.listdir('gnome-shell')])
- )
if not wpath.no_install_ncurses:
data.append((wpath.curses, ['curses/curses_misc.py']))
data.append((wpath.curses, ['curses/prefs_curses.py']))
@@ -548,9 +510,6 @@ class install(_install):
data.append((wpath.docdir, ['INSTALL', 'LICENSE', 'AUTHORS',
'README', 'CHANGES', ]))
data.append((wpath.varlib, ['other/WHEREAREMYFILES']))
- if not wpath.no_install_kde:
- if not wpath.no_install_gtk:
- data.append((wpath.kdedir, ['other/wicd-tray.desktop']))
if not wpath.no_install_init:
data.append((wpath.init, [wpath.initfile]))
if not wpath.no_install_man: