debian/0000775000000000000000000000000012046742032007170 5ustar debian/control0000664000000000000000000000143612046724045010603 0ustar Source: ndisgtk Section: net Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Julian Andres Klode Build-Depends: debhelper (>= 9), gettext, intltool, python3 Standards-Version: 3.9.3 Homepage: http://jak-linux.org/projects/ndisgtk/ VCS-Bzr: http://bazaar.launchpad.net/~juliank/ndisgtk/trunk VCS-Browser: http://codebrowse.launchpad.net/~juliank/ndisgtk/trunk Package: ndisgtk Architecture: i386 amd64 Depends: ${misc:Depends}, ${distro:Depends}, ndiswrapper-utils-1.9, ${python3:Depends}, python3-gi, gir1.2-gtk-3.0 Description: graphical frontend for ndiswrapper (installation of Windows WiFi drivers) ndisgtk is a GTK+ based frontend for ndiswrapper, allowing an easy way to install Windows wireless drivers. debian/menu0000664000000000000000000000030512046711476010065 0ustar ?package(ndisgtk):needs="X11" section="Applications/System/Hardware" \ title="Windows Wireless Drivers" \ icon="/usr/share/pixmaps/ndisgtk.xpm" \ command="su-to-root -X -c /usr/sbin/ndisgtk" debian/patches/0000755000000000000000000000000012046721124010614 5ustar debian/patches/series0000644000000000000000000000003612046721124012030 0ustar debian-changes-0.8.5-1ubuntu1 debian/patches/debian-changes-0.8.5-1ubuntu10000644000000000000000000012260412046742032015525 0ustar Description: TODO: Put a short summary on the line above and replace this paragraph with a longer explanation of this change. Complete the meta-information with other relevant fields (see below for details). To make it easier, the information below has been extracted from the changelog. Adjust it or drop it. . ndisgtk (0.8.5-1ubuntu1) UNRELEASED; urgency=low . * Port to python3 * Port to pygi * Bump policy to 3.9.3 Author: Dmitrijs Ledkovs --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: , Bug: Bug-Debian: http://bugs.debian.org/ Bug-Ubuntu: https://launchpad.net/bugs/ Forwarded: Reviewed-By: Last-Update: --- ndisgtk-0.8.5.orig/Makefile +++ ndisgtk-0.8.5/Makefile @@ -16,7 +16,7 @@ install: all install -m644 ndisgtk.png $(ICONS) install -m644 ndisgtk-error.png $(ICONS) install -m644 ndisgtk.xpm $(PIXMAPS) - install -m644 ndisgtk.glade $(SUPPORT) + install -m644 ndisgtk.ui $(SUPPORT) install -m644 ndisgtk.desktop $(MENU) install -m644 ndisgtk-kde.desktop $(MENU) $(MAKE) -C po install LOCALEDIR=$(LOCALEDIR) --- /dev/null +++ ndisgtk-0.8.5/ndisgtk.ui @@ -0,0 +1,331 @@ + + + + + 350 + False + 5 + Install Driver + False + True + center-on-parent + dialog + True + + + + True + False + vertical + + + True + False + end + + + gtk-help + True + True + False + True + + + + False + False + 0 + + + + + gtk-cancel + True + True + True + False + True + + + + False + False + 1 + + + + + _Install + True + True + True + True + True + False + True + + + + False + False + 2 + + + + + False + True + end + 0 + + + + + True + False + 6 + 6 + + + True + False + 0 + <span size="larger" weight="bold">Select <i>inf</i> file:</span> + True + + + 1 + 0 + 2 + 1 + + + + + True + True + True + True + 6 + Select inf File + + + 2 + 1 + 1 + 1 + + + + + True + False + Location: + + + 1 + 1 + 1 + 1 + + + + + True + False + start + center + True + 0 + 6 + 6 + gtk-dialog-question + 6 + + + 0 + 0 + 1 + 2 + + + + + False + True + 1 + + + + + + help + cancel_button + install_button + + + + True + False + Wireless Network Drivers + center + 450 + 250 + + + + + + True + False + True + 12 + 6 + 6 + + + True + False + 0 + 3 + 1 + <b>Currently Installed Windows Drivers:</b> + True + + + 0 + 0 + 2 + 1 + + + + + True + True + True + True + 5 + in + + + True + True + False + False + + + + + + + + + 0 + 1 + 1 + 1 + + + + + True + False + 6 + 6 + + + _Install New Driver + True + True + True + True + True + True + + + + 0 + 0 + 1 + 1 + + + + + _Remove Driver + True + True + True + True + + + + 0 + 1 + 1 + 1 + + + + + gtk-help + True + True + end + True + True + + + + 0 + 2 + 1 + 1 + + + + + Configure Network + True + True + True + end + True + + + + 0 + 3 + 1 + 1 + + + + + gtk-close + True + True + True + True + + + + 0 + 4 + 1 + 1 + + + + + 1 + 1 + 1 + 1 + + + + + + --- ndisgtk-0.8.5.orig/ndisgtk +++ ndisgtk-0.8.5/ndisgtk @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# # # @@ -30,375 +30,379 @@ import re def getoutput(*cmd): - '''Like commands.getoutput, but uses subprocess''' - myproc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - value = myproc.stdout.read() - retcode = myproc.wait() - return value, retcode + '''Like commands.getoutput, but uses subprocess''' + myproc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + universal_newlines=True) + value = myproc.stdout.read() + retcode = myproc.wait() + return value, retcode # Attempt to load GTK bindings try: - import pygtk - pygtk.require("2.0") - import gtk - import gtk.glade - import gobject + from gi.repository import Gtk + from gi.repository import Gdk + from gi.repository import GdkPixbuf + from gi.repository import GObject except ImportError: - print "Failed to load GTK bindings. Please check your Gnome installation." - sys.exit(1) + print("Failed to load GTK bindings. Please check your Gnome installation.") + sys.exit(1) # Internationalization import locale import gettext locale.setlocale(locale.LC_ALL, "") +locale.bindtextdomain("ndisgtk", "/usr/share/locale") gettext.bindtextdomain("ndisgtk", "/usr/share/locale") gettext.textdomain("ndisgtk") -gettext.install("ndisgtk", "/usr/share/locale", unicode=1) -gtk.glade.bindtextdomain("ndisgtk", "/usr/share/locale") -gtk.glade.textdomain("ndisgtk") +gettext.install("ndisgtk", "/usr/share/locale") # Data directory DATA_DIR = "/usr/share/ndisgtk" def error_dialog(message, parent = None): - """ - Displays an error message. - """ + """ + Displays an error message. + """ - dialog = gtk.MessageDialog(parent = parent, type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK, flags = gtk.DIALOG_MODAL) - dialog.set_markup(message) + dialog = Gtk.MessageDialog(parent = parent, type = Gtk.MessageType.ERROR, buttons = Gtk.ButtonsType.OK, flags = Gtk.DialogFlags.MODAL) + dialog.set_markup(message) - result = dialog.run() - dialog.destroy() + result = dialog.run() + dialog.destroy() class NdisGTK: - """ - Main application class. - """ - - def __init__(self, kde=False): - """ - Initializes the application. - """ - - # Setup glade and signals - self.signals = { "gtk_main_quit": gtk.main_quit, - "on_install_driver_clicked": self.install_driver_open, - "on_remove_driver_clicked": self.remove_driver, - "on_driver_list_cursor_changed": self.cursor_changed, - "install_dialog_close": self.install_dialog_close, - "install_button_clicked": self.install_driver, - "network_button_clicked": self.config_network, - "help_button_clicked": self.show_help, - "drag_motion": self.drag_motion, - "drag_data_received": self.drag_data_received } - - self.widgets = gtk.glade.XML(DATA_DIR + "/ndisgtk.glade", domain="ndisgtk") - self.widgets.signal_autoconnect(self.signals) - - # Get handle to window - self.window = self.widgets.get_widget("ndiswrapper_main") - - # Load icon - icon_theme = gtk.icon_theme_get_default() - self.wifi_icon = icon_theme.load_icon('ndisgtk', 48, 0) - self.wifi_error_icon = icon_theme.load_icon('ndisgtk-error', 48, 0) - self.window.set_icon(self.wifi_icon) - - # Get handle to 'Remove Driver' button - self.remove_driver = self.widgets.get_widget("remove_driver") - - # Get handle to 'Install Driver' dialog - self.install_dialog = self.widgets.get_widget("install_dialog") - self.install_dialog.set_transient_for(self.window) - - # Get handle to file chooser - self.file_chooser = self.widgets.get_widget("filechooser") - - # Enable drag-and-drop - self.window.drag_dest_set(gtk.DEST_DEFAULT_DROP, [("text/plain", 0, 80)], gtk.gdk.ACTION_COPY) - - # Setup driver list - self.setup_driver_list() - - # Use KDE network admin? - self.kde = kde - - gtk.main() - - def setup_driver_list(self): - """ - Sets up the driver list and list widget. - """ - - # Initialize lists - self.driver_list = [] - self.driver_list_store = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING) - self.driver_list_widget = self.widgets.get_widget("driver_list") - - # Set up columns - first = gtk.TreeViewColumn("icon", gtk.CellRendererPixbuf(), pixbuf = 0) - second = gtk.TreeViewColumn("desc", gtk.CellRendererText(), markup = 1) - - self.driver_list_widget.append_column(first) - self.driver_list_widget.append_column(second) - - # Set list model for widget - self.driver_list_widget.set_model(self.driver_list_store) - - # Load the list of drivers - self.get_driver_list() - - def get_driver_list(self): - """ - Gets the list of drivers from ndiswrapper. - """ - - # Clear driver list - self.driver_list_store.clear() - self.driver_list = [] - - # Run the ndiswrapper list command - output,retcode = getoutput("ndiswrapper", "-l") - - # Ignore warnings from modprobe. - output_lines = [] - for line in output.splitlines(): - if not line.startswith("WARNING: All config files need .conf"): - output_lines.append(line) - output = '\n'.join(output_lines) - - if "WARNING" in output: - error_dialog(_("Unable to see if hardware is present."), self.window) - - if ": driver" in output or ": invalid" in output: - # Newer ndiswrapper versions - # Drivers found - output = output.splitlines() - - for i in range(0, len(output)): - line = output[i] - if len(output) > i+1: line2 = output[i+1] - else: line2="" - - if "present" in line2: hardware_present = _("Yes") - else: hardware_present = _("No") - - # Get driver name - p = re.compile(".*:") # match up to first tab - driver_name = p.search(line).group()[:-1].strip() # strip trailing space - - # Add to list - if "installed" in line: - self.driver_list.append(driver_name) - self.driver_list_store.append([self.wifi_icon, - _("%s\nHardware present: %s") % (driver_name, hardware_present)]) - elif "invalid" in line: - self.driver_list.append(driver_name) - self.driver_list_store.append([self.wifi_error_icon, - _("%s\nInvalid Driver!") % driver_name]) - - elif "installed" in output or "Installed" in output or "invalid" in output: - # Drivers found - output = output.splitlines() - for i in range(1, len(output)): - line = output[i] - - if "hardware" in line: hardware_present = _("Yes") - else: hardware_present = _("No") - - # Get driver name - p = re.compile(".*\\t") # match up to first tab - driver_name = p.search(line).group()[:-1].strip() # strip trailing space - - # Add to list - - if "installed" in line: - self.driver_list.append(driver_name) - self.driver_list_store.append([self.wifi_icon, - _("%s\nHardware present: %s") % (driver_name, hardware_present)]) - elif "invalid" in line: - self.driver_list.append(driver_name) - self.driver_list_store.append([self.wifi_icon, - _("%s\nInvalid Driver!") % driver_name]) - else: - # No drivers installed - pass - - def drag_motion(self, window, context, x, y, time): - """ - Called whenever a drag motion is made. - """ - - context.drag_status(gtk.gdk.ACTION_COPY, time) - return True - - def drag_data_received(self, window, context, x, y, selection, info, timestamp): - """ - Called when a file is dragged onto the main window. - """ - - file = selection.get_text().strip() - - if file.startswith("file://"): - if file.endswith(".inf"): - self.file_chooser.set_uri(file) - self.install_driver_open() - else: - error_dialog(_("Please drag an '.inf' file instead."), self.window) - - return True - - def show_help(self, *args): - """ - Displays the help window. - Called when the 'Help' button is clicked. - """ - - # TODO: Implement - error_dialog("Help", self.window) - - def config_network(self, *args): - """ - Opens the network configuration tool. - """ - # Run the command under the normal user. - uid = int(os.getenv("SUDO_UID", 0)) - if uid == 0: - import pwd - user = os.getenv("USERNAME", pwd.getpwuid(0).pw_name) - uid = pwd.getpwnam(user).pw_uid - - if "XAUTHORITY" in os.environ: - # Create a new Xauthority for running the configuration tool. - import shutil, tempfile - (xauth_fd, xauth_name) = tempfile.mkstemp('.ndisgtk', 'xauth-') - os.close(xauth_fd) - shutil.copyfile(os.getenv("XAUTHORITY"), xauth_name) - os.chown(xauth_name, uid, -1) - - fork = os.fork() - if fork == 0: - # Set the new Xauthority, switch user and run the command - os.environ["XAUTHORITY"] = xauth_name - os.setuid(uid) - try: - if self.kde: - subprocess.call(["kcmshell", "kcm_knetworkconfmodule"]) - else: - subprocess.call(["nm-connection-editor"]) - except Exception, e: - try: - os._exit(e.errno) - except AttributeError: - os._exit(1) - os._exit(0) - - gobject.child_watch_add(fork, self.on_config_network_exited, - xauth_name) - - def on_config_network_exited(self, pid, status, xauth_name=None): - """Called when the network configuration has been called""" - errno = os.WEXITSTATUS(status) - if errno == 2: - error_dialog(_("Could not find a network configuration tool.")) - elif errno: - print >> sys.stderr, "Configuration failed:", os.strerror(errno) - os.unlink(xauth_name) - - def install_driver_open(self, *args): - """ - Opens the install driver dialog. - """ - - self.install_dialog.show() - - def install_dialog_close(self, *args): - """ - Closes the install driver dialog. - """ - - self.install_dialog.hide() - return True; - - def install_driver(self, *args): - """ - Installs a selected wireless driver. - Called when the install dialog's 'Install Driver' button is clicked. - """ - - inf_file = self.file_chooser.get_filename() - - if inf_file == None: - error_dialog(_("No file selected."), self.install_dialog) - elif not inf_file.lower().endswith(".inf"): - error_dialog(_("Not a valid driver .inf file."), self.install_dialog) - else: - # Attempt to install driver - output, retcode = getoutput("ndiswrapper", "-i", inf_file) - - # Attempt to detect errors - if "already" in output: - #driver_name = output.split()[0] - error_dialog(_("Driver is already installed."), self.install_dialog) - elif retcode != 0: - error_dialog(_("Error while installing.") , self.install_dialog) - else: - # Assume driver installed successfully. Set up and reload module - subprocess.call(["ndiswrapper", "-ma"]) - subprocess.call(["modprobe", "-r", "ndiswrapper"]) - out, ret = getoutput("modprobe", "ndiswrapper") - if ret != 0: - error_text = _("Module could not be loaded. Error was:\n\n%s\n") - if "not found" in out: - error_text += _("Is the ndiswrapper module installed?") - error_dialog(error_text % out, self.install_dialog) - - self.get_driver_list() - self.install_dialog_close() - - def remove_driver(self, *args): - """ - Removes a driver after asking for confirmation. - Called when the 'Remove Driver' button is clicked. - """ - - # Get the first selected driver - cursor = self.driver_list_widget.get_cursor()[0][0] - driver_name = self.driver_list[cursor] - - # Get confirmation - confirm = gtk.MessageDialog(type = gtk.MESSAGE_WARNING, buttons = gtk.BUTTONS_YES_NO) - confirm.set_markup(_("Are you sure you want to remove the %s driver?") % driver_name) - result = confirm.run() - - if result == gtk.RESPONSE_YES: - # Remove driver - output,retcode = getoutput("ndiswrapper", "-e", driver_name) - - # Reload driver list - self.get_driver_list() - - # Destroy the confirmation dialog - confirm.destroy() - - def cursor_changed(self, *args): - """ - Called when the currently selected driver changes. - """ + """ + Main application class. + """ + + def __init__(self, kde=False): + """ + Initializes the application. + """ + + # Setup glade and signals + self.signals = { "gtk_main_quit": Gtk.main_quit, + "on_install_driver_clicked": self.install_driver_open, + "on_remove_driver_clicked": self.remove_driver, + "on_driver_list_cursor_changed": self.cursor_changed, + "install_dialog_close": self.install_dialog_close, + "install_button_clicked": self.install_driver, + "network_button_clicked": self.config_network, + "help_button_clicked": self.show_help, + "drag_motion": self.drag_motion, + "drag_data_received": self.drag_data_received } + + self.builder = Gtk.Builder() + self.builder.set_translation_domain("ndisgtk") + self.builder.add_from_file(DATA_DIR + "/ndisgtk.ui") + self.builder.connect_signals(self.signals) + + # Get handle to window + self.window = self.builder.get_object("ndiswrapper_main") + + # Load icon + icon_theme = Gtk.IconTheme.get_default() + self.wifi_icon = icon_theme.load_icon('ndisgtk', 48, 0) + self.wifi_error_icon = icon_theme.load_icon('ndisgtk-error', 48, 0) + self.window.set_icon(self.wifi_icon) + + # Get handle to 'Remove Driver' button + self.remove_driver = self.builder.get_object("remove_driver") + + # Get handle to 'Install Driver' dialog + self.install_dialog = self.builder.get_object("install_dialog") + self.install_dialog.set_transient_for(self.window) + + # Get handle to file chooser + self.file_chooser = self.builder.get_object("filechooser") + + # Enable drag-and-drop + self.window.drag_dest_set(Gtk.DestDefaults.DROP, [Gtk.TargetEntry.new("text/plain", 0, 80)], Gdk.DragAction.COPY) + + # Setup driver list + self.setup_driver_list() + + # Use KDE network admin? + self.kde = kde + + Gtk.main() + + def setup_driver_list(self): + """ + Sets up the driver list and list widget. + """ + + # Initialize lists + self.driver_list = [] + self.driver_list_store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) + self.driver_list_widget = self.builder.get_object("driver_list") + + # Set up columns + first = Gtk.TreeViewColumn("icon", Gtk.CellRendererPixbuf(), pixbuf = 0) + second = Gtk.TreeViewColumn("desc", Gtk.CellRendererText(), markup = 1) + + self.driver_list_widget.append_column(first) + self.driver_list_widget.append_column(second) + + # Set list model for widget + self.driver_list_widget.set_model(self.driver_list_store) + + # Load the list of drivers + self.get_driver_list() + + def get_driver_list(self): + """ + Gets the list of drivers from ndiswrapper. + """ + + # Clear driver list + self.driver_list_store.clear() + self.driver_list = [] + + # Run the ndiswrapper list command + output,retcode = getoutput("ndiswrapper", "-l") + + # Ignore warnings from modprobe. + output_lines = [] + for line in output.splitlines(): + if not line.startswith("WARNING: All config files need .conf"): + output_lines.append(line) + output = '\n'.join(output_lines) + + if "WARNING" in output: + error_dialog(_("Unable to see if hardware is present."), self.window) + + if ": driver" in output or ": invalid" in output: + # Newer ndiswrapper versions + # Drivers found + output = output.splitlines() + + for i in range(0, len(output)): + line = output[i] + if len(output) > i+1: line2 = output[i+1] + else: line2="" + + if "present" in line2: hardware_present = _("Yes") + else: hardware_present = _("No") + + # Get driver name + p = re.compile(".*:") # match up to first tab + driver_name = p.search(line).group()[:-1].strip() # strip trailing space + + # Add to list + if "installed" in line: + self.driver_list.append(driver_name) + self.driver_list_store.append([self.wifi_icon, + _("%s\nHardware present: %s") % (driver_name, hardware_present)]) + elif "invalid" in line: + self.driver_list.append(driver_name) + self.driver_list_store.append([self.wifi_error_icon, + _("%s\nInvalid Driver!") % driver_name]) + + elif "installed" in output or "Installed" in output or "invalid" in output: + # Drivers found + output = output.splitlines() + for i in range(1, len(output)): + line = output[i] + + if "hardware" in line: hardware_present = _("Yes") + else: hardware_present = _("No") + + # Get driver name + p = re.compile(".*\\t") # match up to first tab + driver_name = p.search(line).group()[:-1].strip() # strip trailing space + + # Add to list + + if "installed" in line: + self.driver_list.append(driver_name) + self.driver_list_store.append([self.wifi_icon, + _("%s\nHardware present: %s") % (driver_name, hardware_present)]) + elif "invalid" in line: + self.driver_list.append(driver_name) + self.driver_list_store.append([self.wifi_icon, + _("%s\nInvalid Driver!") % driver_name]) + else: + # No drivers installed + pass + + def drag_motion(self, window, context, x, y, time): + """ + Called whenever a drag motion is made. + """ + + context.drag_status(Gtk.gdk.ACTION_COPY, time) + return True + + def drag_data_received(self, window, context, x, y, selection, info, timestamp): + """ + Called when a file is dragged onto the main window. + """ + + file = selection.get_text().strip() + + if file.startswith("file://"): + if file.endswith(".inf"): + self.file_chooser.set_uri(file) + self.install_driver_open() + else: + error_dialog(_("Please drag an '.inf' file instead."), self.window) + + return True + + def show_help(self, *args): + """ + Displays the help window. + Called when the 'Help' button is clicked. + """ + + # TODO: Implement + error_dialog("Help", self.window) + + def config_network(self, *args): + """ + Opens the network configuration tool. + """ + # Run the command under the normal user. + uid = int(os.getenv("SUDO_UID", 0)) + if uid == 0: + import pwd + user = os.getenv("USERNAME", pwd.getpwuid(0).pw_name) + uid = pwd.getpwnam(user).pw_uid + + if "XAUTHORITY" in os.environ: + # Create a new Xauthority for running the configuration tool. + import shutil, tempfile + (xauth_fd, xauth_name) = tempfile.mkstemp('.ndisgtk', 'xauth-') + os.close(xauth_fd) + shutil.copyfile(os.getenv("XAUTHORITY"), xauth_name) + os.chown(xauth_name, uid, -1) + + fork = os.fork() + if fork == 0: + # Set the new Xauthority, switch user and run the command + os.environ["XAUTHORITY"] = xauth_name + os.setuid(uid) + try: + if self.kde: + subprocess.call(["kcmshell", "kcm_knetworkconfmodule"]) + else: + subprocess.call(["nm-connection-editor"]) + except Exception: + try: + e = sys.exc_info()[1] + os._exit(e.errno) + except AttributeError: + os._exit(1) + os._exit(0) + + GObject.child_watch_add(fork, self.on_config_network_exited, + xauth_name) + + def on_config_network_exited(self, pid, status, xauth_name=None): + """Called when the network configuration has been called""" + errno = os.WEXITSTATUS(status) + if errno == 2: + error_dialog(_("Could not find a network configuration tool.")) + elif errno: + print >> sys.stderr, "Configuration failed:", os.strerror(errno) + os.unlink(xauth_name) + + def install_driver_open(self, *args): + """ + Opens the install driver dialog. + """ + + self.install_dialog.show() + + def install_dialog_close(self, *args): + """ + Closes the install driver dialog. + """ + + self.install_dialog.hide() + return True; + + def install_driver(self, *args): + """ + Installs a selected wireless driver. + Called when the install dialog's 'Install Driver' button is clicked. + """ + + inf_file = self.file_chooser.get_filename() + + if inf_file == None: + error_dialog(_("No file selected."), self.install_dialog) + elif not inf_file.lower().endswith(".inf"): + error_dialog(_("Not a valid driver .inf file."), self.install_dialog) + else: + # Attempt to install driver + output, retcode = getoutput("ndiswrapper", "-i", inf_file) + + # Attempt to detect errors + if "already" in output: + #driver_name = output.split()[0] + error_dialog(_("Driver is already installed."), self.install_dialog) + elif retcode != 0: + error_dialog(_("Error while installing.") , self.install_dialog) + else: + # Assume driver installed successfully. Set up and reload module + subprocess.call(["ndiswrapper", "-ma"]) + subprocess.call(["modprobe", "-r", "ndiswrapper"]) + out, ret = getoutput("modprobe", "ndiswrapper") + if ret != 0: + error_text = _("Module could not be loaded. Error was:\n\n%s\n") + if "not found" in out: + error_text += _("Is the ndiswrapper module installed?") + error_dialog(error_text % out, self.install_dialog) + + self.get_driver_list() + self.install_dialog_close() + + def remove_driver(self, *args): + """ + Removes a driver after asking for confirmation. + Called when the 'Remove Driver' button is clicked. + """ + + # Get the first selected driver + if not self.driver_list_widget.get_cursor()[0]: + return + cursor = self.driver_list_widget.get_cursor()[0][0] + driver_name = self.driver_list[cursor] + + # Get confirmation + confirm = Gtk.MessageDialog(type = Gtk.MessageType.WARNING, buttons = Gtk.ButtonsType.YES_NO) + confirm.set_markup(_("Are you sure you want to remove the %s driver?") % driver_name) + result = confirm.run() + + if result == Gtk.ResponseType.YES: + # Remove driver + output,retcode = getoutput("ndiswrapper", "-e", driver_name) + + # Reload driver list + self.get_driver_list() + + # Destroy the confirmation dialog + confirm.destroy() + + def cursor_changed(self, *args): + """ + Called when the currently selected driver changes. + """ - # Allow the 'Remove Driver' button to be clicked - self.remove_driver.set_sensitive(True) + # Allow the 'Remove Driver' button to be clicked + self.remove_driver.set_sensitive(True) if __name__ == '__main__': - # Check for root privileges - if os.getuid() != 0: - error_dialog(_("Root or sudo privileges required!")) - sys.exit(1) - - # Parse options and load GUI - if "--kde" in sys.argv: - NdisGTK(kde=True) - else: - NdisGTK() + # Check for root privileges + if os.getuid() != 0: + error_dialog(_("Root or sudo privileges required!")) + sys.exit(1) + + # Parse options and load GUI + if "--kde" in sys.argv: + NdisGTK(kde=True) + else: + NdisGTK() debian/rules0000775000000000000000000000125512046720325010254 0ustar #!/usr/bin/make -f # -*- makefile -*- # Check for DISTRIB_ID in /etc/lsb-release. Ignore Errors. Empty on Debian, # contains Ubuntu on Ubuntu systems DISTRO := $(shell sed -n 's/DISTRIB_ID=\(.*\)/\1/p' /etc/lsb-release 2>/dev/null) ifneq ($(DISTRO), Ubuntu) EXTRA = menu endif %: dh $@ --with python3 override_dh_auto_install: dh_auto_install # Use su-to-root on non-Ubuntu systems @if [ "$(DISTRO)" != "Ubuntu" ]; then \ echo Using su-to-root in desktop files; \ sed -i 's:Exec=\(kdesu\|gksu\) \(.*\):Exec=su-to-root -X -c "\2":' \ $(CURDIR)/debian/ndisgtk/usr/share/applications/*.desktop; \ fi override_dh_gencontrol: dh_gencontrol -u -V"distro:Depends=$(EXTRA)" debian/changelog0000664000000000000000000001320412046742021011040 0ustar ndisgtk (0.8.5-1ubuntu1) raring; urgency=low * Port to python3 * Port to pygi * Port to GtkBuilder * Port to dh9 * Bump policy to 3.9.3 -- Dmitrijs Ledkovs Thu, 08 Nov 2012 12:13:32 +0000 ndisgtk (0.8.5-1) unstable; urgency=low * New upstream release - Add X-Ubuntu-Gettext-Domain to the desktop files (LP: #331852) - Ignore modprobe warnings about missing .conf in filenames (LP: #498369) - Support NetworkManager 0.7 (LP: #500541) * Packaging updates: - Policy 3.8.4.0 - Update my e-mail address -- Julian Andres Klode Thu, 28 Jan 2010 17:21:50 +0100 ndisgtk (0.8.4-1) unstable; urgency=low * New upstream bugfix/translation release - Display an error message if the module could not be loaded, and ask the user to verify the installation. (Closes: #500637) - Display an error message if no network configuration tool could be found (LP: #256263) -- Julian Andres Klode Thu, 02 Oct 2008 17:58:30 +0200 ndisgtk (0.8.3-1) unstable; urgency=low * New upstream bugfix release - Fix removal of installed drivers (LP: #108656) - Use gksu/kdesu in desktop files * debian/rules: - Use su-to-root only if /etc/lsb-release does not exist or does not contain Ubuntu (Ubuntu has a /etc/lsb-release in base-files) -- Julian Andres Klode Fri, 28 Mar 2008 22:43:04 +0100 ndisgtk (0.8.2-1) unstable; urgency=low * New upstream release - Install icons into /usr/share/icons/hicolor/48x48/apps - Load icons from active icon theme * Fix spelling-error-in-description GTK GTK+ -- Julian Andres Klode Thu, 21 Feb 2008 19:35:03 +0100 ndisgtk (0.8.1-2) unstable; urgency=low * debian/rules: Call dh_icons to update icon cache * debian/control: - Don't use XS- prefix for Dm-Upload-Allowed - Build-Depend on debhelper (>= 5.0.51) for dh_icons -- Julian Andres Klode Fri, 15 Feb 2008 15:00:50 +0100 ndisgtk (0.8.1-1) unstable; urgency=low * New upstream releases 0.8.0 and 0.8.1 - Added many new translations - Add support for spaces in filename (LP: #133623) - Use ndiswrapper -ma instead of ndiswrapper -m (LP: #138852) and reload the module after installation - Use Special icon for invalid drivers * debian/menu: Fix menu file * debian/rules: Do not ignore make clean errors * debian/copyright: - Update the copyright years - Use proposed format: http://wiki.debian.org/Proposals/CopyrightFormat * debian/control: - Add Homepage, VCS and XS-DM-Upload-Allowed - Upgrade to policy 3.7.3 -- Julian Andres Klode Fri, 04 Jan 2008 23:04:11 +0100 ndisgtk (0.7.2-1) unstable; urgency=low * New release - show the driver list if only invalid drivers are installed - update german translation -- Julian Andres Klode Fri, 8 Jun 2007 12:36:06 +0200 ndisgtk (0.7.1-3) unstable; urgency=low * Build with Binary-arch instead of binary-indep -- Julian Andres Klode Fri, 1 Jun 2007 20:31:43 +0200 ndisgtk (0.7.1-2) unstable; urgency=low * Architecture: i386 amd64 instead of Architecture: all * Changed URL to jak-linux.org project page -- Julian Andres Klode Fri, 1 Jun 2007 18:47:25 +0200 ndisgtk (0.7.1-1) unstable; urgency=low * New Release - Closes: LP#108656 (ndisgtk can't remove installed driver) - Closes: LP#93808 (ndisgtk can't configure wireless network in kde) - List invalid drivers and allow their removal * Packaging - Depend on menu, as we use su-to-root outside of menu - Depend only on the first of ndiswrapper-utils-1.9 | ndiswrapper-utils-1.1 -- Julian Andres Klode Wed, 16 May 2007 17:49:59 +0200 ndisgtk (0.7-1) unstable; urgency=low * I am the new upstream * Initial Release for Debian (Closes: #423605) * New Release - po/Makefile: Install mo files to ndisgtk.mo - po/de.po: Add German Localization - ndisgtk: Add Support for newer ndiswrapper versions like 1.43 - Makefile: Install icon to /usr/share/icons and ndisgtk to /usr/sbin * Packaging - Standards-Version: 3.7.2 - Debhelper 5 - Depend on ndiswrapper-utils-1.1 | ndiswrapper-utils-1.9 instead of ndiswrapper-utils - debian/rules: Remove unneeded dh_* lines - debian/control: Add XS-VCS-* -- Julian Andres Klode Sun, 13 May 2007 21:57:40 +0200 ndisgtk (0.6-0ubuntu1) dapper; urgency=low * New upstream release - Added support for i18n - French translation by Martin Courtemanche - Added KDE network config support (--kde option) * Changed python-gnome2 to python-gtk2 in dependencies * Added python-glade2 to dependencies -- Sam Pohlenz Wed, 7 Dec 2005 21:12:59 +1030 ndisgtk (0.5-1ubuntu1) breezy; urgency=low * upload for Sam Pohlenz SoC project -- Oliver Grawert Mon, 22 Aug 2005 17:52:47 +0200 ndisgtk (0.5-1) breezy; urgency=low * New upstream release * Updated standards version to 3.6.2 * Added man page -- Sam Pohlenz Mon, 22 Aug 2005 20:42:30 +0930 ndisgtk (0.4-1) hoary; urgency=low * New upstream release -- Sam Pohlenz Thu, 18 Aug 2005 20:10:56 +0930 ndisgtk (0.3-1) hoary; urgency=low * New upstream release * Set architecture to all * Changed section to net -- Sam Pohlenz Tue, 9 Aug 2005 20:55:25 +0930 ndisgtk (0.2-0ubuntu1) hoary; urgency=low * Initial Release. -- Sam Pohlenz Mon, 25 Jul 2005 23:01:39 +0930 debian/source/0000775000000000000000000000000012046720466010477 5ustar debian/source/format0000664000000000000000000000001412046720466011705 0ustar 3.0 (quilt) debian/compat0000664000000000000000000000000212046720310010361 0ustar 9 debian/copyright0000664000000000000000000000121612046720360011123 0ustar Original source may be found at: http://jak-linux.org/projects/ndisgtk/ Files: * Copyright: © 2005 Sam Pohlenz © 2007-2008 Julian Andres Klode © 2012 Dmitrijs Ledkovs License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. On Debian systems, the complete text of the GNU General Public License can be found in file "/usr/share/common-licenses/GPL-2".