示例#1
0
 def create_combo_widget(self, label_content, items, select_index=0):
     label = Label(label_content)
     combo_box = ComboBox(items, select_index=select_index)
     hbox = gtk.HBox(spacing=5)
     hbox.pack_start(label, False, False)
     hbox.pack_start(combo_box, False, False)
     return hbox, combo_box
    def __setup_combo(self, items=[], width=HSCALEBAR_WIDTH):
        if len(items) == 0:
            return None

        combo = ComboBox(items=items,
                         select_index=0,
                         max_width=width,
                         fixed_width=width)
        combo.set_size_request(width, WIDGET_HEIGHT)
        return combo
def get_combo_group(name, items, callback=None):
    box = gtk.HBox(spacing=8)
    label = Label(name)
    combo_box = ComboBox(items)
    box.pack_start(label, False, False)
    box.pack_start(combo_box, False, False)

    if callback:
        combo_box.connect("item-selected", callback)
    return box, combo_box
示例#4
0
    def create_download_dir_table(self):
        main_table = gtk.Table(4, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)

        dir_title_label = Label(_("Download settings"))
        dir_title_label.set_size_request(200, 12)
        label_align = gtk.Alignment()
        label_align.set_padding(0, 0, 0, 0)
        label_align.add(dir_title_label)

        download_number_label = Label(_('Maximum number of download tasks: '))
        self.download_number_comobox = ComboBox(
                items = [(str(i+1), i+1) for i in range(10)],
                select_index = int(get_download_number())-1,
                )
        self.download_number_comobox.connect("item-selected", self.download_number_comobox_changed)
        download_number_hbox = gtk.HBox(spacing=5)
        download_number_hbox.pack_start(download_number_label, False, False)
        download_number_hbox.pack_start(self.download_number_comobox, False, False)

        change_download_dir_label = Label(_("Download directory: "))
        self.dir_entry = InputEntry()
        self.dir_entry.set_text(get_software_download_dir())
        self.dir_entry.set_editable(False)
        self.dir_entry.set_size(200, 25)

        modify_button = Button(_("Change"))
        modify_button.connect("clicked", self.change_download_save_dir)
        download_dir_hbox = gtk.HBox(spacing=5)
        download_dir_hbox.pack_start(change_download_dir_label, False, False)
        download_dir_hbox.pack_start(self.dir_entry, False, False)
        download_dir_hbox.pack_start(modify_button, False, False)

        main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
        main_table.attach(download_number_hbox, 0, 2, 2, 3, xoptions=gtk.FILL)
        main_table.attach(download_dir_hbox, 0, 2, 3, 4, xoptions=gtk.FILL)
        return main_table
示例#5
0
    # Add entry widget.
    entry_box = gtk.HBox(spacing=10)

    text_entry = dtk.ui.entry.TextEntry()

    text_entry.set_size(100, 22)
    input_entry = InputEntry()
    input_entry.entry.place_holder = "哈哈中"
    input_entry.set_size(100, 22)
    shortcust_entry = ShortcutKeyEntry()
    shortcust_entry.set_size(100, 22)
    password_entry = PasswordEntry()
    password_entry.set_size(100, 22)

    combo_box = ComboBox([("测试测试测试%d" % i, i) for i in range(10)],
                         fixed_width=100)

    spin_box = SpinBox(3000, 0, 5000, 100)

    # mac_entry = MACEntry()
    mac_entry = IPV4Entry()
    mac_entry.connect("changed", print_address)
    # mac_entry = IPV4Entry()
    # mac_entry.set_ip("255.255.255.andy")
    # mac_entry.set_ip("192.168..12")
    # mac_entry.set_ip("192.168..12")
    # mac_entry.set_ip("...")

    # entry_box.pack_start(text_entry, False, False)
    # entry_box.pack_start(input_entry, False, False)
    entry_box.pack_start(mac_entry, False, False)
 def __setup_combo(self, items=[], width=HSCALEBAR_WIDTH):
     combo = ComboBox(items, None, 0, width, width)
     combo.set_size_request(width, WIDGET_HEIGHT)
     return combo
示例#7
0
 def __setup_combo(self, items=[]):
     combo = ComboBox(items, None, 0, max_width = 285, fixed_width = 285)
     combo.set_size_request(-1, WIDGET_HEIGHT)
     return combo
    def __create_widget(self):
        '''create gtk widget'''
        title_item_font_size = TITLE_FONT_SIZE
        option_item_font_szie = CONTENT_FONT_SIZE

        self.label_widgets["speaker"] = Label(_("Speaker"), app_theme.get_color("globalTitleForeground"), text_size=title_item_font_size, enable_select=False, enable_double_click=False)
        self.label_widgets["microphone"] = Label(_("Microphone"), app_theme.get_color("globalTitleForeground"), text_size=title_item_font_size, enable_select=False, enable_double_click=False)
        self.label_widgets["left"] = Label(_("Left"), enable_select=False, enable_double_click=False)
        self.label_widgets["right"] = Label(_("Right"), enable_select=False, enable_double_click=False)
        self.label_widgets["speaker_port"] = Label(_("Output Port"), text_size=option_item_font_szie,
                                                   text_x_align=ALIGN_END, enable_select=False,
                                                   enable_double_click=False, fixed_width=STANDARD_LINE)
        self.label_widgets["speaker_volume"] = Label(_("Output Volume"), text_size=option_item_font_szie,
                                                     text_x_align=ALIGN_END, enable_select=False,
                                                     enable_double_click=False, fixed_width=STANDARD_LINE)
        self.label_widgets["speaker_mute"] = Label(_("Sound Enabled"), text_size=option_item_font_szie,
                                                   text_x_align=ALIGN_END, enable_select=False,
                                                   enable_double_click=False, fixed_width=STANDARD_LINE)
        self.label_widgets["speaker_balance"] = Label(_("Balance"), text_size=option_item_font_szie,
                                                      text_x_align=ALIGN_END, enable_select=False,
                                                      enable_double_click=False, fixed_width=STANDARD_LINE)
        self.label_widgets["microphone_port"] = Label(_("Input Port"), text_size=option_item_font_szie,
                                                      text_x_align=ALIGN_END, enable_select=False,
                                                      enable_double_click=False, fixed_width=STANDARD_LINE)
        self.label_widgets["microphone_volume"] = Label(_("Input Volume"), text_size=option_item_font_szie,
                                                        text_x_align=ALIGN_END, enable_select=False,
                                                        enable_double_click=False, fixed_width=STANDARD_LINE)
        self.label_widgets["microphone_mute"] = Label(_("Sound Enabled"), text_size=option_item_font_szie,
                                                      text_x_align=ALIGN_END, enable_select=False,
                                                      enable_double_click=False, fixed_width=STANDARD_LINE)
        #####################################
        # image init
        self.image_widgets["balance"] = ImageBox(app_theme.get_pixbuf("%s/balance.png" % MODULE_NAME))
        self.image_widgets["speaker"] = ImageBox(app_theme.get_pixbuf("%s/speaker-3.png" % MODULE_NAME))
        self.image_widgets["microphone"] = ImageBox(app_theme.get_pixbuf("%s/microphone.png" % MODULE_NAME))
        self.image_widgets["device"] = app_theme.get_pixbuf("%s/device.png" % MODULE_NAME)
        # button init
        self.button_widgets["balance"] = SwitchButton(
            inactive_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
            active_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"))
        self.button_widgets["speaker"] = SwitchButton(
            inactive_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
            active_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"))
        self.button_widgets["microphone"] = SwitchButton(
            inactive_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
            active_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"))
        self.button_widgets["advanced"] = Button(_("Advanced"))
        self.button_widgets["speaker_combo"] = ComboBox(fixed_width=HSCALEBAR_WIDTH)
        self.button_widgets["microphone_combo"] = ComboBox(fixed_width=HSCALEBAR_WIDTH)
        # container init
        self.container_widgets["main_vbox"] = gtk.VBox(False)
        self.container_widgets["statusbar"] = StatusBar()
        self.container_widgets["slider"] = HSlider()
        self.container_widgets["swin"] = ScrolledWindow()
        self.container_widgets["advance_set_tab_box"] = TabBox()
        self.container_widgets["advance_set_tab_box"].draw_title_background = self.draw_tab_title_background
        self.container_widgets["main_hbox"] = gtk.HBox(False)
        self.container_widgets["left_vbox"] = gtk.VBox(False)
        self.container_widgets["right_vbox"] = gtk.VBox(False)
        self.container_widgets["balance_hbox"] = gtk.HBox(False)
        self.container_widgets["speaker_main_vbox"] = gtk.VBox(False)     # speaker
        self.container_widgets["speaker_label_hbox"] = gtk.HBox(False)
        self.container_widgets["speaker_table"] = gtk.Table(4, 2)
        self.container_widgets["microphone_main_vbox"] = gtk.VBox(False)     # microphone
        self.container_widgets["microphone_label_hbox"] = gtk.HBox(False)
        self.container_widgets["microphone_table"] = gtk.Table(4, 2)
        # alignment init
        self.alignment_widgets["slider"] = gtk.Alignment()
        self.alignment_widgets["main_hbox"] = gtk.Alignment()
        self.alignment_widgets["advance_set_tab_box"] = gtk.Alignment()
        self.alignment_widgets["left"] = gtk.Alignment()
        self.alignment_widgets["right"] = gtk.Alignment()
        self.alignment_widgets["speaker_label"] = gtk.Alignment()      # speaker
        self.alignment_widgets["speaker_set"] = gtk.Alignment()
        self.alignment_widgets["microphone_label"] = gtk.Alignment()      # microphone
        self.alignment_widgets["microphone_set"] = gtk.Alignment()
        # adjust init
        volume_max_percent = pypulse.MAX_VOLUME_VALUE * 100 / pypulse.NORMAL_VOLUME_VALUE
        self.adjust_widgets["balance"] = gtk.Adjustment(0, -1.0, 1.0, 0.1, 0.2)
        self.adjust_widgets["speaker"] = gtk.Adjustment(0, 0, volume_max_percent, 1, 5)
        self.adjust_widgets["microphone"] = gtk.Adjustment(0, 0, volume_max_percent, 1, 5)
        # scale init
        self.scale_widgets["balance"] = HScalebar(value_min=-1, value_max=1, gray_progress=True)
        self.scale_widgets["balance"].set_magnetic_values([(0, 0.1), (1, 0.1), (2, 0.1)])
        self.scale_widgets["speaker"] = HScalebar(show_value=True, format_value="%", value_min=0, value_max=volume_max_percent)
        self.scale_widgets["speaker"].set_magnetic_values([(0, 5), (100, 5), (volume_max_percent, 5)])
        self.scale_widgets["microphone"] = HScalebar(show_value=True, format_value="%", value_min=0, value_max=volume_max_percent)
        self.scale_widgets["microphone"].set_magnetic_values([(0, 5), (100, 5), (volume_max_percent, 5)])
        ###################################
        # advance set
        self.container_widgets["advance_input_box"] = gtk.VBox(False)
        self.container_widgets["advance_output_box"] = gtk.VBox(False)
        self.container_widgets["advance_hardware_box"] = gtk.VBox(False)
        self.alignment_widgets["advance_input_box"] = gtk.Alignment()
        self.alignment_widgets["advance_output_box"] = gtk.Alignment()
        self.alignment_widgets["advance_hardware_box"] = gtk.Alignment()
        #
        self.label_widgets["ad_output"] = Label(_("Choose a device for sound output:"), enable_select=False, enable_double_click=False)
        self.label_widgets["ad_input"] = Label(_("Choose a device for sound input:"), enable_select=False, enable_double_click=False)
        self.label_widgets["ad_hardware"] = Label(_("Choose a device to configure:"), enable_select=False, enable_double_click=False)
        #
        self.container_widgets["ad_output"] = gtk.VBox(False)
        self.container_widgets["ad_input"] = gtk.VBox(False)
        self.container_widgets["ad_hardware"] = gtk.VBox(False)
        #
        self.view_widgets["ad_output"] = TreeView()
        self.view_widgets["ad_input"] = TreeView()
        self.view_widgets["ad_hardware"] = TreeView()
示例#9
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")
示例#10
0
    def __init__(self):
        super(EqualizerWindow, self).__init__(_("Equalizer"),
                                              372,
                                              168,
                                              DIALOG_MASK_SINGLE_PAGE,
                                              close_callback=self.hide_all,
                                              modal=False,
                                              window_hint=None,
                                              skip_taskbar_hint=False)

        self.manual_flag = False

        try:
            pre_value = float(config.get("equalizer", "preamp"))
        except:
            pre_value = 0.6

        pre_adjust = gtk.Adjustment(value=pre_value,
                                    lower=-10,
                                    upper=10,
                                    step_incr=0.1,
                                    page_incr=1,
                                    page_size=0)
        self.preamp_scale = PreampScalebar()
        self.preamp_scale.scalebar.set_adjustment(pre_adjust)
        pre_adjust.connect("value-changed", self.preamp_change)

        self.connect("configure-event", self.equalizer_configure_event)
        control_box = gtk.HBox(spacing=10)
        control_box.pack_start(self.preamp_scale, False, False)
        self.__scales = {}

        for i, label in enumerate(
            ["32", "64", "125", "250", "500", "1k", "2k", "4k", "8k", "16k"]):
            slipper_scale = SlipperScalebar(label)
            try:
                value = float(
                    config.get("equalizer", "equalizer-band%s" % str(i)))
            except:
                value = 0.0

            adjust = gtk.Adjustment(value=value,
                                    lower=-12,
                                    upper=12,
                                    step_incr=0.1,
                                    page_incr=1,
                                    page_size=0)
            adjust.changed_id = adjust.connect("value-changed",
                                               self.__on_adjust_change, i)
            slipper_scale.scalebar.set_adjustment(adjust)
            self.__scales[i] = slipper_scale.scalebar
            control_box.pack_start(slipper_scale, False, False)

        try:
            self.__equalizer = gst.element_factory_make("equalizer-10bands")
        except gst.PluginNotFoundError:
            self.__equalizer = None
            self.logerror(
                "Equalizer support requires gstreamer-plugins-bad (>= 0.10.5)")
        else:
            Player.bin.xfade_add_filter(self.__equalizer)
            for i in range(0, 10):
                try:
                    value = float(
                        config.get("equalizer", "equalizer-band%s" % str(i)))
                except:
                    value = 0

                self.__equalizer.set_property("band" + str(i), float(value))

            Player.bin.connect("tee-removed", self.__on_remove)
            config.connect("config-changed", self.__on_config_change)

        self.active_button = Button(_("Close"))
        self.active_button.connect("clicked", self.hide_win)
        self.reset_button = Button(_("Reset"))
        self.reset_button.connect("clicked", self.set_default_value)
        self.predefine_button = Button(_("Predefined"))
        self.predefine_button.connect("clicked", self.show_predefine)

        self.predefine_combo_box = ComboBox(
            [(value, key) for key, value in mandatory_i18n.items()],
            250,
            select_index=self.get_selected_index())
        self.predefine_combo_box.connect("item-selected",
                                         self.set_predefine_value)

        control_box_align = gtk.Alignment()
        control_box_align.set(0.0, 0.0, 1.0, 1.0)
        control_box_align.set_padding(10, 20, 15, 15)
        control_box_align.add(control_box)

        main_align = gtk.Alignment()
        main_align.set(0.0, 0.0, 1.0, 1.0)
        main_align.set_padding(0, 5, 2, 2)
        main_box = gtk.VBox(spacing=5)
        main_align.add(main_box)

        main_box.add(control_box_align)

        self.body_box.pack_start(main_align, True, True)
        self.left_button_box.set_buttons([self.predefine_combo_box])
        self.right_button_box.set_buttons(
            [self.reset_button, self.active_button])
示例#11
0
 def __setup_combo(self, items=[], width=120):
     combo = ComboBox(items, None, 0, width)
     return combo
示例#12
0
    def __init__(self,
                 connection,
                 set_button_cb,
                 need_ssid=False,
                 settings_obj=None):
        gtk.VBox.__init__(self)
        self.tab_name = _("Security")
        self.connection = connection
        self.set_button = set_button_cb
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj
        self.settings_obj.initial_lock = True

        self.need_ssid = need_ssid
        self.presave_index = None

        if self.need_ssid:
            log.info("enter hidden network settings")
            self.add_ssid_entry()

        if self.connection.get_setting(
                "802-11-wireless").security == "802-11-wireless-security":
            self.has_security = True
            self.setting = self.connection.get_setting(
                "802-11-wireless-security")
        else:
            self.has_security = False
        self.security_label = Label(_("Security:"),
                                    enable_select=False,
                                    enable_double_click=False)
        self.key_label = Label(_("Key:"),
                               enable_select=False,
                               enable_double_click=False)
        self.wep_index_label = Label(_("Wep index:"),
                                     enable_select=False,
                                     enable_double_click=False)

        self.auth_label = Label(_("Authentication:"),
                                enable_select=False,
                                enable_double_click=False)
        self.password_label = Label(_("Password:"******"None"), None),
                           (_("WEP (Hex or ASCII)"), "none"),
                           (_("WEP 104/128-bit Passphrase"), "none"),
                           (_("WPA WPA2 Personal"), "wpa-psk")]
        #entry_item = map(lambda l: (l[1],l[0]), enumerate(self.encry_list))
        self.security_combo = ComboBox(self.encry_list,
                                       fixed_width=self.ENTRY_WIDTH)
        #self.security_combo.set_size_request(self.ENTRY_WIDTH, 22)

        self.key_entry = PasswordEntry()
        self.password_entry = PasswordEntry()
        self.show_key_check = CheckButton(_("Show password"), padding_x=0)
        self.show_key_check.connect("toggled", self.show_key_check_button_cb)
        self.wep_index_spin = SpinBox(0, 1, 4, 1, self.ENTRY_WIDTH)
        self.auth_combo = ComboBox([(_("Shared Key"), "shared"),
                                    (_("Open System"), "open")],
                                   fixed_width=self.ENTRY_WIDTH)

        ## advance button
        self.align = gtk.Alignment(0, 1.0, 0, 0)
        self.align.set_padding(0, 0, 376, 0)
        self.align.set_size_request(-1, 30)
        self.button = Button(_("Advanced"))
        self.align.add(self.button)

        ## Create table
        self.table = gtk.Table(5, 4)
        #TODO UI change
        label_list = [
            "security_label", "key_label", "wep_index_label", "auth_label",
            "password_label"
        ]
        widget_list = [
            "password_entry", "key_entry", "wep_index_spin", "auth_combo",
            "security_combo"
        ]
        for label in label_list:
            l = getattr(self, label)
            l.set_can_focus(False)
            align = style.wrap_with_align(l, width=210)
            setattr(self, label + "_align", align)

        for w in widget_list:
            l = getattr(self, w)
            align = style.wrap_with_align(l, align="left")
            setattr(self, w + "_align", align)

        self.show_key_check_align = style.wrap_with_align(self.show_key_check,
                                                          align="left")

        self.reset(self.has_security)
        self.security_combo.connect("item-selected", self.change_encry_type)
        self.key_entry.entry.connect("changed", self.save_wep_pwd)
        self.password_entry.entry.connect("changed", self.save_wpa_pwd)
        self.wep_index_spin.connect("value-changed", self.wep_index_spin_cb)
        self.auth_combo.connect("item-selected", self.save_auth_cb)

        style.set_table(self.table)
        table_align = gtk.Alignment(0, 0, 0, 0)
        table_align.add(self.table)
        style.draw_background_color(self)
        width, height = self.ENTRY_WIDTH, 22
        self.key_entry.set_size(width, height)
        self.password_entry.set_size(width, height)
        self.wep_index_spin.set_size_request(width, height)
        self.auth_combo.set_size_request(width, height)
        self.security_combo.set_size_request(width, height)
        self.pack_start(table_align, False, False)
        self.pack_start(self.align, False, False, 0)
        self.settings_obj.initial_lock = False
 def __setup_combo(self, items=[], max_width=130, fixed_width=130):
     return ComboBox(items=items,
                     select_index=0,
                     max_width=max_width,
                     fixed_width=fixed_width)
 def __setup_combo(self, items=[]):
     combo = ComboBox(items, None, 0, 120)
     return combo
    def app_table(self):
        # Labels
        #info_label = Label("您可以根据自己需要对深度系统在默认情况下使用的程序进行设置")
        web_label = Label(_("Web"))
        mail_label = Label(_("Mail"))
        editor_label = Label(_("Editor"))
        music_label = Label(_("Music"))
        movie_label = Label(_("Video"))
        pic_label = Label(_("Photo"))
        terminal_label = Label(_("Terminal"))

        self.web = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.mail = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.editor = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.music = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.movie = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.pic = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.terminal = self.get_terminal_combo()

        table = gtk.Table(8, 2, False)
        #table.attach(style.wrap_with_align(info_label), 0, 2, 0, 1)
        table.attach(style.wrap_with_align(web_label, width=self.LEFT_WIDTH),
                     0, 1, 1, 2)
        table.attach(style.wrap_with_align(mail_label, width=self.LEFT_WIDTH),
                     0, 1, 2, 3)
        table.attach(
            style.wrap_with_align(editor_label, width=self.LEFT_WIDTH), 0, 1,
            3, 4)
        table.attach(style.wrap_with_align(music_label, width=self.LEFT_WIDTH),
                     0, 1, 4, 5)
        table.attach(style.wrap_with_align(movie_label, width=self.LEFT_WIDTH),
                     0, 1, 5, 6)
        table.attach(style.wrap_with_align(pic_label, width=self.LEFT_WIDTH),
                     0, 1, 6, 7)
        table.attach(
            style.wrap_with_align(terminal_label, width=self.LEFT_WIDTH), 0, 1,
            7, 8)

        table.attach(style.wrap_with_align(self.web), 1, 2, 1, 2, 0)
        table.attach(style.wrap_with_align(self.mail), 1, 2, 2, 3, 0)
        table.attach(style.wrap_with_align(self.editor), 1, 2, 3, 4)
        table.attach(style.wrap_with_align(self.music), 1, 2, 4, 5)
        table.attach(style.wrap_with_align(self.movie), 1, 2, 5, 6)
        table.attach(style.wrap_with_align(self.pic), 1, 2, 6, 7)
        table.attach(style.wrap_with_align(self.terminal), 1, 2, 7, 8)
        align = style.set_box_with_align(table, "text")
        style.set_table(table)

        self.pack_start(align, False, False)

        all_app_dict = self.get_all_app()
        #print all_app_dict
        apps = [
            self.web, self.mail, self.editor, self.music, self.movie, self.pic
        ]
        for app in apps:
            app.set_size_request(self.ENTRY_WIDTH, 22)
        for key in all_app_dict.iterkeys():
            if self.get_default_app:
                apps[key].add_items(all_app_dict[key])
            else:
                apps[key].add_items(all_app_dict[key], clear_first=False)
class AppView(gtk.VBox):
    ENTRY_WIDTH = 200
    LEFT_WIDTH = STANDARD_LINE - TEXT_WINDOW_LEFT_PADDING

    def __init__(self):
        '''docstring for __'''
        gtk.VBox.__init__(self)
        style.draw_background_color(self)

        self.app = AppManager()
        self.content_type_list = [
            self.app.http_content_type, self.app.mail_content_type,
            self.app.editor_content_type, self.app.audio_content_type,
            self.app.video_content_type, self.app.photo_content_type
        ]

        self.app_table()
        self.web.connect("item-selected", self.item_select, 0)
        self.mail.connect("item-selected", self.item_select, 1)
        self.editor.connect("item-selected", self.item_select, 2)
        self.music.connect("item-selected", self.item_select, 3)
        self.movie.connect("item-selected", self.item_select, 4)
        self.pic.connect("item-selected", self.item_select, 5)

    def app_table(self):
        # Labels
        #info_label = Label("您可以根据自己需要对深度系统在默认情况下使用的程序进行设置")
        web_label = Label(_("Web"))
        mail_label = Label(_("Mail"))
        editor_label = Label(_("Editor"))
        music_label = Label(_("Music"))
        movie_label = Label(_("Video"))
        pic_label = Label(_("Photo"))
        terminal_label = Label(_("Terminal"))

        self.web = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.mail = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.editor = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.music = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.movie = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.pic = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH)
        self.terminal = self.get_terminal_combo()

        table = gtk.Table(8, 2, False)
        #table.attach(style.wrap_with_align(info_label), 0, 2, 0, 1)
        table.attach(style.wrap_with_align(web_label, width=self.LEFT_WIDTH),
                     0, 1, 1, 2)
        table.attach(style.wrap_with_align(mail_label, width=self.LEFT_WIDTH),
                     0, 1, 2, 3)
        table.attach(
            style.wrap_with_align(editor_label, width=self.LEFT_WIDTH), 0, 1,
            3, 4)
        table.attach(style.wrap_with_align(music_label, width=self.LEFT_WIDTH),
                     0, 1, 4, 5)
        table.attach(style.wrap_with_align(movie_label, width=self.LEFT_WIDTH),
                     0, 1, 5, 6)
        table.attach(style.wrap_with_align(pic_label, width=self.LEFT_WIDTH),
                     0, 1, 6, 7)
        table.attach(
            style.wrap_with_align(terminal_label, width=self.LEFT_WIDTH), 0, 1,
            7, 8)

        table.attach(style.wrap_with_align(self.web), 1, 2, 1, 2, 0)
        table.attach(style.wrap_with_align(self.mail), 1, 2, 2, 3, 0)
        table.attach(style.wrap_with_align(self.editor), 1, 2, 3, 4)
        table.attach(style.wrap_with_align(self.music), 1, 2, 4, 5)
        table.attach(style.wrap_with_align(self.movie), 1, 2, 5, 6)
        table.attach(style.wrap_with_align(self.pic), 1, 2, 6, 7)
        table.attach(style.wrap_with_align(self.terminal), 1, 2, 7, 8)
        align = style.set_box_with_align(table, "text")
        style.set_table(table)

        self.pack_start(align, False, False)

        all_app_dict = self.get_all_app()
        #print all_app_dict
        apps = [
            self.web, self.mail, self.editor, self.music, self.movie, self.pic
        ]
        for app in apps:
            app.set_size_request(self.ENTRY_WIDTH, 22)
        for key in all_app_dict.iterkeys():
            if self.get_default_app:
                apps[key].add_items(all_app_dict[key])
            else:
                apps[key].add_items(all_app_dict[key], clear_first=False)

    def attach_to(self, table, widget_list, row, width):
        for index, widget in enumerate(widget_list):
            align = style.wrap_with_align(widget, width=width[index])
            table.attach(align, index, index + 1, row, row + 1)

    def get_default_app(self):
        dic = {}
        for index, value in enumerate(self.content_type_list):
            default_app = self.app.get_default_for_type(value)
            if default_app:
                dic[index] = default_app

        return dic

    def get_terminal_combo(self):
        default_terminal = dmenu.get_default_terminal()
        terminal_apps = dmenu.get_terminal_apps()
        try:
            index = terminal_apps.index(default_terminal)
        except Exception, e:
            print e
            index = 0

        combo_box = ComboBox([(exec_.capitalize(), exec_)
                              for exec_ in terminal_apps],
                             select_index=index,
                             fixed_width=self.ENTRY_WIDTH)
        combo_box.connect("item-selected", self.on_terminal_item_selected)
        return combo_box
    def __init__(self):
        '''
        init docs
        '''
        gtk.HBox.__init__(self)

        self.__toggle_id = None
        self.__time_id = None

        self.datetime_settings = deepin_gsettings.new(
            "com.deepin.dde.datetime")

        self.__deepin_dt = DeepinDateTime()
        self.current_tz_gmtoff = self.__deepin_dt.get_gmtoff()

        self.timezone_items = []
        self.timezone_items.append((_("(UTC-11:00)Samoa"), -11))
        self.timezone_items.append((_("(UTC-10:00)Hawaii"), -10))
        self.timezone_items.append((_("(UTC-09:00)Alaska"), -9))
        self.timezone_items.append((_("(UTC-08:00)Lower California"), -8))
        self.timezone_items.append(
            (_("(UTC-07:00)Arizona, Llamas, Mazatlan, Chihuahua"), -7))
        self.timezone_items.append(
            (_("(UTC-06:00)Saskatchewan, Mexico City, Monterrey"), -6))
        self.timezone_items.append(
            (_("(UTC-05:00)Indiana, Bogota, Lima, Quito"), -5))
        self.timezone_items.append(
            (_("(UTC-04:00)San Diego, Georgetown, San Juan"), -4))
        self.timezone_items.append(
            (_("(UTC-03:00)Greenland, Brasilia, Fortaleza"), -3))
        self.timezone_items.append((_("(UTC-02:00)Mid-Atlantic"), -2))
        self.timezone_items.append(
            (_("(UTC-01:00)Cape Verde Islands, Azores"), -1))
        self.timezone_items.append(
            (_("(UTC)London, Dublin, Edinburgh, Lisbon, Casablanca"), 0))
        self.timezone_items.append(
            (_("(UTC+01:00)Paris, Amsterdam, Berlin, Rome, Vienna"), 1))
        self.timezone_items.append(
            (_("(UTC+02:00)Cairo, Athens, Istanbul, Jerusalem"), 2))
        self.timezone_items.append(
            (_("(UTC+03:00)Moscow, St. Petersburg, Baghdad"), 3))
        self.timezone_items.append(
            (_("(UTC+04:00)Port Louis, Abu Dhabi, Muscat, Yerevan"), 4))
        self.timezone_items.append(
            (_("(UTC+05:00)Islamabad, Karachi, Tashkent"), 5))
        self.timezone_items.append((_("(UTC+06:00)Dhaka, Novosibirsk"), 6))
        self.timezone_items.append(
            (_("(UTC+07:00)Bangkok, Hanoi, Jakarta"), 7))
        self.timezone_items.append(
            (_("(UTC+08:00)Beijing, Chongqing, HongKong, Taipei, Urumqi"), 8))
        self.timezone_items.append(
            (_("(UTC+09:00)Osaka, Sapporo, Tokyo, Seoul"), 9))
        self.timezone_items.append(
            (_("(UTC+10:00)Guam, Canberra, Melbourne, Sydney"), 10))
        self.timezone_items.append(
            (_("(UTC+11:00)Magadan, Solomon Islands"), 11))
        self.timezone_items.append((_("(UTC+12:00)New Zealand, Kiribati"), 12))
        self.is_24hour = self.datetime_settings.get_boolean("is-24hour")
        '''
        left align
        '''
        self.left_align = self.__setup_align(
            padding_top=TEXT_WINDOW_TOP_PADDING,
            padding_left=TEXT_WINDOW_LEFT_PADDING)
        '''
        left box
        '''
        self.left_box = gtk.VBox()
        '''
        calendar title
        '''
        self.calendar_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/calendar.png"), _("Calendar"))
        '''
        current date
        '''
        self.cur_date_align = self.__setup_align()
        self.cur_date_label = self.__setup_label(
            _("Current Date: %d-%d-%d") %
            (time.localtime().tm_year, time.localtime().tm_mon,
             time.localtime().tm_mday), 190)
        self.cur_date_align.add(self.cur_date_label)
        '''
        calendar widget
        '''
        self.calendar_align = self.__setup_align(padding_top=BETWEEN_SPACING,
                                                 padding_bottom=10)
        self.calendar = deepin_lunar.new()
        if MAIN_LANG == "en_US":
            self.calendar = dltk_calendar.new()
        self.calendar.mark_day(time.localtime().tm_mday)
        self.calendar.get_handle().set_size_request(300, 280)
        self.calendar.get_handle().connect("day-selected",
                                           self.__on_day_selected,
                                           self.calendar)
        self.calendar_align.add(self.calendar.get_handle())
        self.change_date_box = gtk.HBox(spacing=5)
        self.change_date_box.set_size_request(300, -1)
        self.change_date_align = self.__setup_align()
        self.change_date_button = Button(_("Change Date"))
        self.change_date_button.connect("button-press-event",
                                        self.__on_change_date)
        self.change_date_align.add(self.change_date_button)
        self.edit_date_align = self.__setup_align()
        self.edit_date_box = gtk.HBox(spacing=5)
        self.cancel_date_button = Button(_("Cancel"))
        self.cancel_date_button.connect("button-press-event",
                                        self.__on_cancel_change_date)
        self.confirm_date_button = Button(_("Confirm"))
        self.confirm_date_button.connect("button-press-event",
                                         self.__on_confirm_change_date)
        self.__widget_pack_start(
            self.edit_date_box,
            [self.cancel_date_button, self.confirm_date_button])
        self.edit_date_align.add(self.edit_date_box)

        self.change_date_box.pack_end(self.change_date_align, False, False)
        '''
        left box && align
        '''
        self.__widget_pack_start(self.left_box, [
            self.calendar_title_align, self.cur_date_align,
            self.calendar_align, self.change_date_box
        ])
        self.left_align.add(self.left_box)
        '''
        right align
        '''
        self.right_align = self.__setup_align(
            padding_top=TEXT_WINDOW_TOP_PADDING,
            padding_left=TEXT_WINDOW_LEFT_PADDING)
        '''
        right box
        '''
        self.right_box = gtk.VBox()
        '''
        time title
        '''
        self.time_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/time.png"), _("Time"))
        '''
        current time
        '''
        self.cur_time_align = self.__setup_align()
        if self.is_24hour:
            self.cur_time_label = self.__setup_label(
                _("Current Time: %s %02d:%02d:%02d (%d Hour)") %
                (time.strftime('%p'), time.localtime().tm_hour,
                 time.localtime().tm_min, time.localtime().tm_sec, 24), 260)
        else:
            self.cur_time_label = self.__setup_label(
                _("Current Time: %s %02d:%02d:%02d (%d Hour)") %
                (time.strftime('%p'), time.localtime().tm_hour,
                 time.localtime().tm_min, time.localtime().tm_sec, 12), 260)

        self.cur_time_align.add(self.cur_time_label)
        '''
        DateTime widget
        '''
        self.datetime_widget_align = self.__setup_align(
            padding_top=BETWEEN_SPACING)
        self.datetime_widget = DateTimeHTCStyle(is_24hour=self.is_24hour)
        self.datetime_widget_align.add(self.datetime_widget)
        self.set_time_align = self.__setup_align()
        '''
        auto time get && set
        '''
        self.auto_time_align = self.__setup_align(
            padding_top=TEXT_WINDOW_TOP_PADDING)
        self.auto_time_box = gtk.HBox(spacing=BETWEEN_SPACING)
        self.auto_time_label = self.__setup_label(_("NTP"))
        self.auto_time_toggle = self.__setup_toggle()
        is_auto_set_time = self.datetime_settings.get_boolean("is-auto-set")
        if is_auto_set_time:
            #AutoSetTimeThread(self).start()
            self.__deepin_dt.set_using_ntp(True)
        else:
            self.__deepin_dt.set_using_ntp(False)
        self.auto_time_toggle_align = self.__setup_align(padding_top=4)
        self.auto_time_toggle.set_active(is_auto_set_time)
        self.auto_time_toggle.connect("toggled", self.__toggled,
                                      "auto_time_toggle")
        self.auto_time_toggle_align.add(self.auto_time_toggle)
        '''
        set time
        '''
        self.set_time_spin_align = self.__setup_align(padding_left=10,
                                                      padding_top=1)
        self.set_time_box = gtk.HBox(spacing=BETWEEN_SPACING)
        self.set_time_label = self.__setup_label(_("Set Time"), 60)
        self.set_time_spin = TimeSpinBox(is_24hour=self.is_24hour)
        self.set_time_spin.set_size_request(85, WIDGET_HEIGHT)
        self.set_time_spin.connect("value-changed", self.__time_changed)
        self.__widget_pack_start(self.set_time_box,
                                 [self.set_time_label, self.set_time_spin])
        self.set_time_spin_align.add(self.set_time_box)
        self.__widget_pack_start(self.auto_time_box, [
            self.auto_time_label, self.auto_time_toggle_align,
            self.set_time_spin_align
        ])
        if is_auto_set_time:
            self.set_time_spin_align.set_child_visible(False)
        self.auto_time_align.add(self.auto_time_box)
        '''
        24hour display
        '''
        self.time_display_align = self.__setup_align(
            padding_top=BETWEEN_SPACING)
        self.time_display_box = gtk.HBox(spacing=BETWEEN_SPACING)
        self.time_display_label = self.__setup_label("24 %s" % _("Hour"))
        self.time_display_toggle_align = self.__setup_align()
        self.time_display_toggle = self.__setup_toggle()
        self.time_display_toggle.set_active(self.is_24hour)
        self.time_display_toggle.connect("toggled", self.__toggled,
                                         "time_display_toggle")
        self.time_display_toggle_align.add(self.time_display_toggle)
        self.__widget_pack_start(
            self.time_display_box,
            [self.time_display_label, self.time_display_toggle_align])
        self.time_display_align.add(self.time_display_box)
        '''
        timezone
        '''
        self.timezone_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/globe-green.png"), _("Time Zone"),
            TEXT_WINDOW_TOP_PADDING)
        self.timezone_combo_align = self.__setup_align(padding_top=6)
        self.timezone_combo = ComboBox(self.timezone_items,
                                       max_width=340,
                                       fixed_width=340)
        self.timezone_combo.set_select_index(self.__deepin_dt.get_gmtoff() +
                                             11)
        self.timezone_combo.connect("item-selected",
                                    self.__combo_item_selected)
        self.timezone_combo_align.add(self.timezone_combo)

        self.__widget_pack_start(self.right_box, [
            self.time_title_align, self.cur_time_align,
            self.datetime_widget_align, self.auto_time_align,
            self.time_display_align, self.timezone_title_align,
            self.timezone_combo_align
        ])
        self.right_align.add(self.right_box)

        self.__widget_pack_start(self, [self.left_align, self.right_align])

        self.connect("expose-event", self.__expose)

        self.__send_message("status", ("date_time", ""))

        SecondThread(self).start()
        DateThread(self).start()
示例#18
0
    def __init__(self, connection, set_button_callback, settings_obj=None):
        gtk.VBox.__init__(self)
        self.tab_name = _("Broadband")
        self.connection = connection        
        self.set_button = set_button_callback
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        # Init widgets
        self.table = gtk.Table(12, 4, False)
        
        #self.label_basic = Label(_("Basic"), text_size = TITLE_FONT_SIZE)
        self.label_basic = TitleBar(None, _("Basic"))
        self.label_number = Label(_("Code:"), text_size=CONTENT_FONT_SIZE,
                               enable_select=False,
                               enable_double_click=False)
        self.label_username = Label(_("Username:"******"Password:"******"Show password"), padding_x=0)
        self.button_to_region = Button(_("Regions setting"))


        #self.table = gtk.Table(6, 4, False)
        self.label_advanced = TitleBar(None,_("Advanced"))
        self.label_apn = Label(_("APN:"), text_size=CONTENT_FONT_SIZE,
                               enable_select=False,
                               enable_double_click=False)
        self.label_network = Label(_("Network ID:"), text_size=CONTENT_FONT_SIZE,
                               enable_select=False,
                               enable_double_click=False)
        self.label_type = Label(_("Type:"), text_size=CONTENT_FONT_SIZE,
                               enable_select=False,
                               enable_double_click=False)
        self.label_pin = Label(_("PIN:"), text_size=CONTENT_FONT_SIZE,
                               enable_select=False,
                               enable_double_click=False)

        self.apn = InputEntry()
        self.network_id = InputEntry()
        self.network_type = ComboBox([("Any", None),
                                      ("3G", 0),
                                      ("2G", 1),
                                      ("Prefer 3G", 2),
                                      ("Prefer 2G", 3)],
                                      fixed_width=self.ENTRY_WIDTH)
        self.roam_check = CheckButton(_("Allow roaming if home network is not available"), padding_x=0)
        self.pin = InputEntry()
        
        
        # Connect signals
        self.number.entry.connect("changed", self.save_settings_by, "number")
        self.username.entry.connect("changed", self.save_settings_by, "username")
        self.password.entry.connect("changed", self.save_settings_by, "password")
        self.apn.entry.connect("changed", self.save_settings_by, "apn")
        self.network_id.entry.connect("changed", self.save_settings_by, "network_id")
        self.network_type.connect("item-selected", self.network_type_selected)

        self.password_show.connect("toggled", self.password_show_toggled)
        self.roam_check.connect("toggled", self.roam_check_toggled)


        table_align = gtk.Alignment(0, 0, 0, 0)
        table_align.add(self.table)
        self.pack_start(table_align)

        # wrap with alignment
        
        # Refesh
        self.refresh()
示例#19
0
    def init_table(self):

        table = gtk.Table(8, 3, False)

        #info_label = Label(_("You can choose the operation after plugining media or device"))

        cd_label = Label(_("CD"))
        dvd_label = Label(_("DVD"))
        player_label = Label(_("Audio Player"))
        photo_label = Label(_("Camera"))
        software_label = Label(_("Applications"))
        auto_mount_label = Label(_("Automatically Mount"))

        self.all_label_list = [cd_label, dvd_label, player_label,
                               photo_label, software_label]

        default_list = [(_("Other applications"), "other_app"),
                        (_("Ask"), "ask"),
                        (_("Do nothing"), "do_nothing"),
                        (_("Open folder"),"open_folder")]
        auto_mount_list = [(_("Do nothing"), "do_nothing"), 
                           (_("Ask"), "ask"),
                           (_("Mount"), "mount"),
                           (_("Mount and open folder"), "mount_and_open")]
        #self.auto_mount_box = gtk.HBox(spacing = WIDGET_SPACING)
        #self.auto_mount_label = Label(_("apply auto open for all media and devices"))
        self.auto_mount_label = Label(_("AutoPlay"))
        self.auto_mount_toggle = ToggleButton(app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
            app_theme.get_pixbuf("toggle_button/active_normal.png"))
        #self.auto_mount_box.pack_start(self.auto_mount_label, False, False)
        #self.auto_mount_box.pack_start(self.auto_mount_toggle, False, False)

        self.cd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.dvd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.player= ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.photo = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.software = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.auto_mount = ComboBox(auto_mount_list, fixed_width=self.ENTRY_WIDTH)
        self.auto_mount.set_select_index(self.__get_index_from_value(get_auto_mount(), auto_mount_list))
        #self.more_option = Button(_("more option"))

        ###below content type displayed as more option is clicked"
        self.audio_dvd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.blank_bd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.blank_cd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.blank_hddvd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.video_bluray = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.ebook_reader = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.video_hddvd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.image_picturecd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.video_svcd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)
        self.video_vcd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH)

        #table.attach(style.wrap_with_align(info_label, width=self.LEFT_WIDTH), 0, 3, 0, 1)
        table.attach(style.wrap_with_align(cd_label, width=self.LEFT_WIDTH), 0, 1, 4, 5)
        table.attach(style.wrap_with_align(dvd_label, width=self.LEFT_WIDTH), 0, 1, 5, 6)
        table.attach(style.wrap_with_align(player_label, width=self.LEFT_WIDTH), 0, 1, 6, 7)
        table.attach(style.wrap_with_align(photo_label, width=self.LEFT_WIDTH), 0, 1, 7, 8)
        table.attach(style.wrap_with_align(software_label, width=self.LEFT_WIDTH), 0, 1, 8, 9)
        table.attach(style.wrap_with_align(auto_mount_label, width=self.LEFT_WIDTH), 0, 1, 9, 10)

        #table.attach(style.wrap_with_align(self.auto_mount_box, align = "left", left = 180), 0, 3, 1, 2)
        table.attach(style.wrap_with_align(self.auto_mount_label, width=self.LEFT_WIDTH), 0, 1, 1, 2)
        table.attach(style.wrap_with_align(self.auto_mount_toggle), 1, 3, 1, 2)

        table.attach(style.wrap_with_align(self.cd), 1, 3, 4, 5)
        table.attach(style.wrap_with_align(self.dvd), 1, 3, 5, 6)
        table.attach(style.wrap_with_align(self.player), 1, 3, 6, 7)
        table.attach(style.wrap_with_align(self.photo), 1, 3, 7, 8)
        table.attach(style.wrap_with_align(self.software), 1, 3, 8, 9)
        table.attach(style.wrap_with_align(self.auto_mount), 1, 3, 9, 10)

        # UI style
        table_align = style.set_box_with_align(table, "text")
        style.set_table(table)

        self.pack_start(table_align, False, False)

        combo_list = [self.cd, self.dvd, self.player, self.photo, self.software]
        for combo in combo_list:
            combo.set_size_request(self.ENTRY_WIDTH, 22)

        self.refresh_app_list(default_list)

        self.media_handle.auto_mount = True
        if self.media_handle.automount_open:
            for combo in self.all_app_dict:
                combo.set_sensitive(True)
            for l in self.all_label_list:
                l.set_sensitive(True)
        else:
            for combo in self.all_app_dict:
                combo.set_sensitive(False)
            for l in self.all_label_list:
                l.set_sensitive(False)
    
        self.auto_mount_toggle.set_active(self.media_handle.automount_open)

        self.connect_signal_to_combos()