Example #1
0
File: gui.py Project: wmak/wicd
    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)
Example #2
0
    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..." % language['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)
Example #3
0
    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()
Example #4
0
File: gui.py Project: wmak/wicd
    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()