def click_mppe_callback(self, widget, key):
        active = widget.get_active()
        if active and key != "name":
            self.vpn_setting.set_data_item(key, "yes")
            #self.set_group_active(False)
            self.set_group_sensitive(False)

            self.mppe_group_set_sensitive(True)
            self.init_ui()
        else:
            #self.set_group_active(True)
            self.set_group_sensitive(True)
            self.vpn_setting.delete_data_item(key)
            self.mppe_group_set_active(False)
            self.mppe_group_set_sensitive(False)
            self.init_ui()

        if self.init_lock:
            if self.connection.check_setting_finish():
                Dispatcher.set_button("save", True)
            else:
                Dispatcher.set_button("save", False)

        if self.auth_lock():
            self.require_mppe_label.set_sensitive(False)
            self.require_mppe.set_sensitive(False)
            return
    def click_mppe_callback(self, widget, key):
        active = widget.get_active()
        if active and key != "name":
            self.vpn_setting.set_data_item(key, "yes")
            #self.set_group_active(False)
            self.set_group_sensitive(False)

            self.mppe_group_set_sensitive(True)
            self.init_ui()
        else:
            #self.set_group_active(True)
            self.set_group_sensitive(True)
            self.vpn_setting.delete_data_item(key)
            self.mppe_group_set_active(False)
            self.mppe_group_set_sensitive(False)
            self.init_ui()
        
        if self.init_lock:
            if self.connection.check_setting_finish():
                Dispatcher.set_button("save", True)
            else:
                Dispatcher.set_button("save", False)

        if self.auth_lock():
            self.require_mppe_label.set_sensitive(False)
            self.require_mppe.set_sensitive(False)
            return
 def set_foot_bar_button(self, connection):
     if type(connection) == NMRemoteConnection:
         self.foot_box.show_delete(connection)
     else:
         self.foot_box.hide_delete()
     states = self.setting_group.get_button_state(connection)
     if states:
         Dispatcher.set_button(*states)
Esempio n. 4
0
def check_settings(connection, fn):
    if connection.check_setting_finish():
        Dispatcher.set_button('save', True)
        print "pass"
        #print connection.get_setting("802-11-wireless-security").prop_dict
    else:
        Dispatcher.set_button("save", False)
        print "not pass, ==================>"
Esempio n. 5
0
 def set_foot_bar_button(self, connection):
     if type(connection) == NMRemoteConnection:
         self.foot_box.show_delete(connection)
     else:
         self.foot_box.hide_delete()
     states = self.setting_group.get_button_state(connection)
     if states:
         Dispatcher.set_button(*states)
def check_settings(connection, fn):
    if connection.check_setting_finish():
        Dispatcher.set_button('save', True)
        print "pass"
        #print connection.get_setting("802-11-wireless-security").prop_dict
    else:
        Dispatcher.set_button("save", False)
        print "not pass, ==================>"
    def entry_changed_cb(self, widget, string, key):
        if string == "":
            #print key,"entry is empty"
            self.vpn_setting.delete_data_item(key)
        elif key != "name":
            self.vpn_setting.set_data_item(key, string)

        if self.connection.check_setting_finish():
            Dispatcher.set_button("save", True)
        else:
            Dispatcher.set_button("save", False)
    def entry_changed_cb(self, widget, string, key):
        if string == "":
            #print key,"entry is empty"
            self.vpn_setting.delete_data_item(key)
        elif key != "name":
            self.vpn_setting.set_data_item(key, string)

        if self.connection.check_setting_finish():
            Dispatcher.set_button("save", True)
        else:
            Dispatcher.set_button("save", False)
    def radio_toggled(self, widget, service_type):
        if widget.get_active():
            self.vpn_setting.service_type = "org.freedesktop.NetworkManager." + service_type
            self.service_type = service_type

        if self.connection.check_setting_finish():
            Dispatcher.set_button("save", True)
        else:
            Dispatcher.set_button("save", False)
            self.refresh()

        Dispatcher.emit("vpn-type-change", self.connection)
    def radio_toggled(self, widget, service_type):
        if widget.get_active():
            self.vpn_setting.service_type = "org.freedesktop.NetworkManager." + service_type
            self.service_type = service_type

        if self.connection.check_setting_finish():
            Dispatcher.set_button("save", True)
        else:
            Dispatcher.set_button("save", False)
            self.refresh()

        Dispatcher.emit("vpn-type-change", self.connection)
    def check_button_cb(self, widget, key):
        auth_lock = self.auth_lock()
        active = widget.get_active()
        if key.startswith("refuse"):
            if active:
                self.vpn_setting.delete_data_item(key)
            else:
                self.vpn_setting.set_data_item(key, "yes")

            if auth_lock:
                self.require_mppe_label.set_sensitive(False)
                self.require_mppe.set_sensitive(False)

                self.set_group_sensitive(True)
            else:
                self.require_mppe_label.set_sensitive(True)
                self.require_mppe.set_sensitive(True)

        elif key.startswith("no"):
            if active:
                self.vpn_setting.delete_data_item(key)
            else:
                self.vpn_setting.set_data_item(key, "yes")

        elif key == "echo":
            if active:
                self.vpn_setting.set_data_item("lcp-echo-failure", "5")
                self.vpn_setting.set_data_item("lcp-echo-interval", "30")
            else:
                self.vpn_setting.delete_data_item("lcp-echo-failure")
                self.vpn_setting.delete_data_item("lcp-echo-interval")
        elif key.startswith("ipsec"):
            if active:
                self.vpn_setting.set_data_item(key, "yes")
            else:
                self.vpn_setting.delete_data_item(key)
        elif key.startswith("require") or key.startswith("mppe"):
            if active:
                self.vpn_setting.set_data_item(key, "yes")
            else:
                self.vpn_setting.delete_data_item(key)
            

        if self.connection.check_setting_finish():
            Dispatcher.set_button("save", True)
        else:
            Dispatcher.set_button("save", False)
 def save_settings(self, widget, value, types):
     if type(value) is str:
         if (value == "") or TypeConvert.is_valid_mac_address(value):
             setattr(self.ethernet_setting, types, value)
             #if self.connection.check_setting_finish():
                 #Dispatcher.set_button("save", True)
             is_valid = self.connection.check_setting_finish()
         else:
             is_valid = False
             #Dispatcher.set_button("save", False)
         self.settings_obj.mac_is_valid = is_valid
         if not self._init:
             self.settings_obj.set_button("save", is_valid)
     else:
         setattr(self.ethernet_setting, types, value)
         if self.connection.check_setting_finish() and not self._init:
             Dispatcher.set_button("save", True)
    def check_button_cb(self, widget, key):
        auth_lock = self.auth_lock()
        active = widget.get_active()
        if key.startswith("refuse"):
            if active:
                self.vpn_setting.delete_data_item(key)
            else:
                self.vpn_setting.set_data_item(key, "yes")

            if auth_lock:
                self.require_mppe_label.set_sensitive(False)
                self.require_mppe.set_sensitive(False)

                self.set_group_sensitive(True)
            else:
                self.require_mppe_label.set_sensitive(True)
                self.require_mppe.set_sensitive(True)

        elif key.startswith("no"):
            if active:
                self.vpn_setting.delete_data_item(key)
            else:
                self.vpn_setting.set_data_item(key, "yes")

        elif key == "echo":
            if active:
                self.vpn_setting.set_data_item("lcp-echo-failure", "5")
                self.vpn_setting.set_data_item("lcp-echo-interval", "30")
            else:
                self.vpn_setting.delete_data_item("lcp-echo-failure")
                self.vpn_setting.delete_data_item("lcp-echo-interval")
        elif key.startswith("ipsec"):
            if active:
                self.vpn_setting.set_data_item(key, "yes")
            else:
                self.vpn_setting.delete_data_item(key)
        elif key.startswith("require") or key.startswith("mppe"):
            if active:
                self.vpn_setting.set_data_item(key, "yes")
            else:
                self.vpn_setting.delete_data_item(key)

        if self.connection.check_setting_finish():
            Dispatcher.set_button("save", True)
        else:
            Dispatcher.set_button("save", False)
 def check_settings(self, connection):
     if connection.check_setting_finish():
         Dispatcher.set_button('save', True)
     else:
         Dispatcher.set_button("save", False)
 def check_settings(self, connection):
     if connection.check_setting_finish():
         Dispatcher.set_button('save', True)
     else:
         Dispatcher.set_button("save", False)