Ejemplo n.º 1
0
 def show_more_options(self, widget):
     self.settings_obj.initial_lock = True
     widget.parent.destroy()
     self.wireless = SettingSection(_("Wireless"), always_show=True)
     self.ipv4 = SettingSection(_("IPv4 settings"), always_show=True)
     self.ipv6 = SettingSection(_("IPv6 settings"), always_show=True)
     self.wireless.load([
         Wireless(self.connection,
                  self.set_button,
                  settings_obj=self.settings_obj)
     ])
     self.ipv4.load([
         IPV4Conf(self.connection,
                  self.set_button,
                  settings_obj=self.settings_obj,
                  link_local=True)
     ])
     self.ipv6.load([
         IPV6Conf(self.connection,
                  self.set_button,
                  settings_obj=self.settings_obj,
                  link_local=True)
     ])
     self.main_box.pack_start(self.wireless, False, False, 15)
     self.main_box.pack_start(self.ipv4, False, False)
     self.main_box.pack_start(self.ipv6, False, False, 15)
     self.settings_obj.initial_lock = False
Ejemplo n.º 2
0
    def __init__(self, connection, set_button, settings_obj=None):
        gtk.Alignment.__init__(self, 0, 0 ,0, 0)
        self.set_padding(35, 0, 20, 0)

        self.main_box = gtk.VBox()
        self.tab_name = "sfds"
        basic = SettingSection(_("Basic"))

        self.button = Button(_("Advanced"))
        self.button.set_size_request(50, 22)
        self.button.connect("clicked", self.show_more_options)
        self.broadband = SettingSection(_("Broadband"), always_show=True)
        self.ipv4 = SettingSection(_("IPv4 settings"), always_show=True)
        self.ppp = SettingSection(_("PPP"), always_show=True)
        align = gtk.Alignment(0, 0, 0, 0)
        align.set_padding(0, 0, 225, 0)
        align.add(self.button)
        
        self.broadband = Broadband(connection, set_button, settings_obj)
        basic.load([self.broadband, align])
        self.ipv4.load([IPV4Conf(connection, set_button, settings_obj=settings_obj)])
        self.ppp.load([PPPConf(connection, set_button, settings_obj)])

        self.space = gtk.HBox()
        self.space.set_size_request(-1 ,30)

        self.main_box.pack_start(basic, False, False)

        self.add(self.main_box)
    def __init__(self, connection, set_button, settings_obj=None):
        gtk.Alignment.__init__(self, 0, 0, 0, 0)
        self.connection = connection
        self.set_button = set_button
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        self.set_padding(35, 0, 20, 0)

        self.main_box = gtk.VBox()
        self.tab_name = "sfds"
        basic = SettingSection(_("Basic"))

        self.button = Button(_("Advanced"))
        self.button.connect("clicked", self.show_more_options)
        self.wired = SettingSection(_("Wired"), always_show=False)
        align = gtk.Alignment(0, 0, 0, 0)
        align.set_padding(0, 0, 376, 0)
        align.set_size_request(-1, 30)
        align.add(self.button)

        basic.load([
            PPTPConf(connection, set_button, settings_obj=self.settings_obj),
            align
        ])

        self.main_box.pack_start(basic, False, False)

        self.add(self.main_box)
 def show_more_options(self, widget):
     widget.destroy()
     self.ipv4 = SettingSection(_("IPv4 settings"), always_show=True)
     self.ipv4.load([
         IPV4Conf(self.connection,
                  self.set_button,
                  settings_obj=self.settings_obj)
     ])
     ppp = SettingSection(_("PPP settings"), always_show=True)
     ppp.load([PPPConf(settings_obj=self.settings_obj)])
     Dispatcher.emit("vpn-type-change", self.connection)
     self.main_box.pack_start(self.ipv4, False, False, 15)
     self.main_box.pack_start(ppp, False, False)
Ejemplo n.º 5
0
    def __init__(self,
                 connection,
                 set_button,
                 need_ssid=False,
                 settings_obj=None):
        gtk.Alignment.__init__(self, 0, 0, 0, 0)
        self.set_padding(35, 0, 20, 0)
        self.connection = connection
        self.set_button = set_button
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        if isinstance(connection, NMRemoteConnection):
            net_manager.set_primary_wireless(settings_obj.ap, connection)

        self.main_box = gtk.VBox()
        self.tab_name = ""
        basic = SettingSection(_("Basic"))
        log.debug("start section")

        if need_ssid:
            security = Security(connection,
                                set_button,
                                need_ssid,
                                settings_obj=settings_obj)
        else:
            security = Security(connection,
                                set_button,
                                settings_obj=settings_obj)
        security.button.connect("clicked", self.show_more_options)
        basic.load([security])
        self.main_box.pack_start(basic, False, False)

        self.add(self.main_box)
    def __init__(self, connection, set_button, settings_obj=None):
        gtk.Alignment.__init__(self, 0, 0 ,0, 0)
        self.set_padding(35, 0, 20, 0)
        self.connection = connection
        self.set_button = set_button
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj
        
        if isinstance(connection, NMRemoteConnection):
            net_manager.set_primary_wire(settings_obj.device, connection)

        self.main_box = gtk.VBox()

        basic = SettingSection(_("Wired"), always_show=True)
        button = Button(_("Advanced"))
        button.connect("clicked", self.show_more_options)

        align = gtk.Alignment(0, 0, 0, 0)
        align.set_padding(0, 0, 285, 0)
        align.add(button)

        basic.load([Wired(self.connection, self.set_button, settings_obj), align])
        self.main_box.pack_start(basic, False, False)
        self.add(self.main_box)
Ejemplo n.º 7
0
    def __init__(self, connection, set_button_cb, settings_obj=None):
        gtk.VBox.__init__(self)
        self.tab_name = _("Wireless")
        self.connection = connection
        self.set_button = set_button_cb
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        self.wireless = self.connection.get_setting("802-11-wireless")
        ### UI
        self.ssid_label = Label(_("SSID:"),
                                enable_select=False,
                                enable_double_click=False)
        self.ssid_entry = InputEntry()
        self.ssid_entry.set_size(self.ENTRY_WIDTH, 22)

        self.mode_label = Label(_("Mode:"),
                                enable_select=False,
                                enable_double_click=False)
        self.mode_combo = ComboBox([(_("Infrastructure"), "infrastructure"),
                                    (_("Ad-hoc"), "adhoc")],
                                   fixed_width=130)

        # TODO need to put this section to personal wifi
        self.band_label = Label(_("Band:"),
                                enable_select=False,
                                enable_double_click=False)

        self.band_combo = ComboBox([(_("Automatic"), None), ("a (5 GHZ)", "a"),
                                    ("b/g (2.4)", "bg")],
                                   fixed_width=self.ENTRY_WIDTH)
        self.channel_label = Label(_("Channel:"),
                                   enable_select=False,
                                   enable_double_click=False)
        self.channel_spin = SpinBox(0, 0, 1500, 1, self.ENTRY_WIDTH)
        # BSSID
        self.bssid_label = Label(_("BSSID:"),
                                 enable_select=False,
                                 enable_double_click=False)
        self.bssid_entry = MACEntry()
        self.mac_address_label = Label(_("Device Mac Address:"),
                                       enable_select=False,
                                       enable_double_click=False)
        self.mac_entry = MACEntry()
        self.clone_addr_label = Label(_("Cloned Mac Address:"),
                                      enable_select=False,
                                      enable_double_click=False)
        self.clone_entry = MACEntry()

        self.mtu_label = Label(_("MTU:"),
                               enable_select=False,
                               enable_double_click=False)
        self.mtu_spin = SpinBox(0, 0, 1500, 1, 130)

        self.table = gtk.Table(8, 2, False)
        """
        wrap with alignment
        """
        widget_list = [
            "ssid_label", "ssid_entry", "mode_label", "mode_combo",
            "band_label", "band_combo", "channel_label", "channel_spin",
            "bssid_label", "bssid_entry", "mac_address_label", "mac_entry",
            "clone_addr_label", "clone_entry", "mtu_label", "mtu_spin"
        ]

        for widget in widget_list:
            item = getattr(self, widget)
            if widget.endswith("label"):
                item.set_can_focus(False)
                align = style.wrap_with_align(item, width=210)
            else:
                align = style.wrap_with_align(item, align="left")
            setattr(self, widget + "_align", align)

        #TODO UI change
        style.draw_background_color(self)
        #align = style.set_box_with_align(self.table, 'text')
        style.set_table(self.table)

        self.section = SettingSection(_("Default Settings"),
                                      always_show=False,
                                      revert=True,
                                      label_right=True,
                                      has_seperator=False)
        self.pack_start(self.section, False, False)
        self.section.toggle_off = self.use_default_setting
        self.section.toggle_on = self.use_user_setting
        self.section.load([self.table])
        #self.pack_start(self.table, False, False)
        #self.table.set_size_request(340, 227)

        #self.ssid_entry.set_size_request(130, 22)
        self.bssid_entry.set_size_request(130, 22)
        self.mac_entry.set_size_request(130, 22)
        self.clone_entry.set_size_request(130, 22)

        self.reset()
        #self.mode_combo.connect("item-selected", self.mode_combo_selected)
        self.band_combo.connect("item-selected", self.band_combo_selected)
        self.mtu_spin.connect("value-changed", self.spin_value_changed, "mtu")
        self.mtu_spin.value_entry.connect("changed", self.spin_user_set)
        self.channel_spin.connect("value-changed", self.spin_value_changed,
                                  "channel")
        self.ssid_entry.entry.connect("changed", self.entry_changed, "ssid")
        self.bssid_entry.connect("changed", self.entry_changed, "bssid")
        self.mac_entry.connect("changed", self.entry_changed, "mac_address")
        self.clone_entry.connect("changed", self.entry_changed,
                                 "cloned_mac_address")