def _init_dialog(self):
        self.dialog = self.builder.get_object("PreferencesDialog")

        self.general_clear_cache_on_exit_check_button = self.builder.get_object(
            "PrefsGeneralClearCacheOnExitCheckButton"
        )
        self.general_compact_toolbar_check_button = self.builder.get_object("PrefsGeneralCompactToolBarCheckButton")
        self.general_compact_treeview_check_button = self.builder.get_object("PrefsGeneralCompactTreeViewCheckButton")
        self.general_disable_presets_check_button = self.builder.get_object("PrefsGeneralDisablePresetsCheckButton")
        self.general_disable_proxy_check_button = self.builder.get_object("PrefsGeneralDisableProxyCheckButton")
        self.general_refresh_cache_on_startup_check_button = self.builder.get_object(
            "PrefsGeneralRefreshCacheOnStartupCheckButton"
        )
        self.general_show_buttonmenu_check_button = self.builder.get_object("PrefsGeneralShowButtonMenuCheckButton")
        self.general_show_menubar_check_button = self.builder.get_object("PrefsGeneralShowMenuBarCheckButton")
        self.general_show_tooltip_check_button = self.builder.get_object("PrefsGeneralShowTooltipCheckButton")
        self.general_start_maximized_check_button = self.builder.get_object("PrefsGeneralStartMaximizedCheckButton")
        self.general_terminal_emulator_entry = self.builder.get_object("PrefsGeneralTerminalEmulatorEntry")

        self.radio_channels_entry = self.builder.get_object("PrefsRadioChannelsEntry")
        self.radio_download_path_entry = self.builder.get_object("PrefsRadioDownloadPathEntry")
        self.radio_download_file_chooser_button = self.builder.get_object("PrefsRadioDownloadFileChooserButton")
        self.radio_preset_file_entry = self.builder.get_object("PrefsRadioPresetFileEntry")
        self.radio_recording_modes_entry = self.builder.get_object("PrefsRadioRecordingModesEntry")
        self.radio_run_in_terminal_check_button = self.builder.get_object("PrefsRadioRunInTerminalCheckButton")

        self.tv_channels_entry = self.builder.get_object("PrefsTvChannelsEntry")
        self.tv_download_path_entry = self.builder.get_object("PrefsTvDownloadPathEntry")
        self.tv_download_file_chooser_button = self.builder.get_object("PrefsTvDownloadFileChooserButton")
        self.tv_preset_file_entry = self.builder.get_object("PrefsTvPresetFileEntry")
        self.tv_recording_modes_entry = self.builder.get_object("PrefsTvRecordingModesEntry")
        self.tv_run_in_terminal_check_button = self.builder.get_object("PrefsTvRunInTerminalCheckButton")

        ####

        filepath = os.path.join(os.path.expanduser("~"), ".get_iplayer", "pvr")
        url = file.files2urls(filepath)
        url += "      "
        filepath = os.path.join(os.path.expanduser("~"), ".get_iplayer", "presets")
        url += file.files2urls(filepath)

        label = self.builder.get_object("PrefsAdvGetIPlayerConfLabel")
        label.set_markup(url)

        ####

        self.dialog.set_icon(self.icon)
        self.dialog.set_title("preferences - " + get_iplayer_downloader.PROGRAM_NAME)
        self._display_settings()

        self.builder.connect_signals(self)
        self.dialog.connect("response", self._response)
    def _init_grid(self, controller, prop_table):
        ##min_content_height=600, min_content_width=600
        ##visible=True, can_focus=True, hscrollbar_policy=Gtk.Policy.AUTOMATIC,
        #                               vscrollbar_policy=Gtk.Policy.AUTOMATIC
        scrolled_window = Gtk.ScrolledWindow()
        ##scrolled_window.min_content_height(700)
        ##scrolled_window.min_content_width(800)
        #scrolled_window.set_property("min-content-height", 5800)
        #scrolled_window.set_property("min-content-width", 400)
        ##self.set_default_size(400, 400)
        #scrolled_window.set_hexpand(True)
        #scrolled_window.set_vexpand(True)
        self.add(scrolled_window)

        self.grid = Gtk.Grid(
            orientation=Gtk.Orientation.VERTICAL,
            margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        ##self.grid.set_row_homogeneous(False)
        ##self.grid.set_column_homogeneous(False)
        scrolled_window.add_with_viewport(self.grid)

        ##

        # Find property values
        episode = None
        longname = None
        name = None
        image_url = None
        pid = None
        title = None
        for prop_label, prop_value in prop_table:
            if prop_label == "episode":
                episode = prop_value
            if prop_label == "longname":
                longname = prop_value
            if prop_label == "name":
                name = prop_value
            #OLD if prop_label == "thumbnail" or prop_label == "thumbnail4":
            if prop_label == "thumbnail":
                image_url = prop_value
            if prop_label == "pid":
                pid = prop_value
            if prop_label == "title":
                title = prop_value

        locate_search_term = name

        #### Thumbnail, title, play button

        ##ALTERNATIVE
        #for i in range(len(prop_table)):
        #    if prop_table[i][InfoResultColumn.PROP_LABEL /* 0 */] == "thumbnail4":
        #        break
        #if i < len(prop_table):
        #    image_url = prop_table[i][InfoResultColumn.PROP_VALUE /* 1 */]

        if image_url is not None:
            #WORKAROUND for getting a larger image (used to be "thumbnail4")
            #image_url = re.sub("/[0-9]+x[0-9]+/", "/640x360/", image_url)

            if string.str2bool(settings.get_config().get(
                    config.NOSECTION, "show-images")):
                timeout = string.str2float(settings.get_config().get(
                    config.NOSECTION, "load-image-timeout-seconds"))
                image = Image.image(image_url,
                                    relpath="large",
                                    timeout=timeout,
                                    max_width=get_iplayer_downloader.ui.
                                    main_window.IMAGE_MAX_WIDTH,
                                    max_height=get_iplayer_downloader.ui.
                                    main_window.IMAGE_MAX_HEIGHT)
                if image is not None:
                    self.grid.add(image)

        if title is not None:
            props_title = title
        else:
            # Episode info is not available
            if longname is not None and episode is not None:
                props_title = longname + " : " + episode
            else:
                props_title = episode
        if props_title is not None:
            TITLE_MAX_LENGTH = int(
                get_iplayer_downloader.ui.main_window.WINDOW_LARGE_WIDTH /
                8) + 3  # 8: gestimated character width
            if len(props_title) > TITLE_MAX_LENGTH:
                # Label1 should not exceed the grid width
                props_title = props_title[:TITLE_MAX_LENGTH] + "..."
            label1 = Gtk.Label(props_title, halign=Gtk.Align.CENTER)
            #label1.set_selectable(False)
            self.grid.add(label1)

        #NOTE Do not expand/fill the button in the grid: halign=Gtk.Align.CENTER
        button = Gtk.Button(relief=Gtk.ReliefStyle.NONE,
                            image_position=Gtk.PositionType.TOP,
                            halign=Gtk.Align.CENTER)
        button.set_image(Gtk.Image(icon_name=Gtk.STOCK_MEDIA_PLAY))
        #button.set_label("Play")
        #if title is not None:
        #    button.set_label(title)
        button.set_tooltip_text(
            get_iplayer_downloader.ui.main_window.TOOLTIP_VIEW_PLAYER)
        button.connect("clicked", controller.on_button_play_clicked_by_pid,
                       pid)
        self.grid.add(button)

        #### Property table

        #NOTE To expand the main grid (self.grid), expand one of its child widgets: hexpand=True
        frame = Gtk.Frame(
            label="Properties",
            label_xalign=0.01,
            hexpand=True,
            margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        self.grid.add(frame)

        ##

        PROP_LABEL_LIST = [
            "available", "categories", "channel", "desclong", "dir",
            "duration", "episode", "expiry", "expiryrel", "firstbcast",
            "firstbcastrel", "index", "lastbcast", "lastbcastrel", "longname",
            "modes", "modesizes", "pid", "player", "senum", "timeadded",
            "title", "type", "versions", "web"
        ]

        prop_grid = Gtk.Grid(column_homogeneous=False,
                             row_homogeneous=False,
                             margin_top=get_iplayer_downloader.ui.main_window.
                             WIDGET_BORDER_WIDTH,
                             margin_bottom=get_iplayer_downloader.ui.
                             main_window.WIDGET_BORDER_WIDTH)
        frame.add(prop_grid)

        #focused_label = None
        #for prop_row in prop_table:
        #for i, prop_row in enumerate(prop_table):
        for i, (prop_label, prop_value) in enumerate(prop_table):
            if prop_label in PROP_LABEL_LIST:
                if prop_label == "duration":
                    try:
                        # Convert into hours and minutes
                        #NOTE // is the integer division operator
                        #DUPLICATE
                        duration_mins = int(prop_value) // 60
                        prop_value = "{0:2}".format(duration_mins // 60) + ":" + \
                                     "{0:02}".format(duration_mins % 60)
                        prop_value = prop_value.strip()
                    except ValueError:
                        #NOTE prop_value still has its original value
                        pass

                label1 = Gtk.Label(prop_label,
                                   valign=Gtk.Align.START,
                                   halign=Gtk.Align.START)
                label1.set_padding(
                    get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH,
                    0)
                label1.set_line_wrap(True)
                #label1.set_selectable(False)
                prop_grid.attach(label1, 0, i, 1, 1)

                label2 = Gtk.Label(markup.text2html(prop_value),
                                   margin_start=40,
                                   valign=Gtk.Align.START,
                                   halign=Gtk.Align.START,
                                   use_markup=True)
                label2.set_padding(
                    get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH,
                    0)
                label2.set_line_wrap(True)
                label2.set_selectable(True)
                label2.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
                # Avoid centering of text, when line wrap warps at word boundaries (WORD, WORD_CHAR)
                label2.set_alignment(0, 0)
                prop_grid.attach(label2, 1, i, 1, 1)

                #if prop_label == "index" or prop_label == "title":
                #    focused_label = label2

        #if focused_label:
        #    focused_label.grab_focus()
        #    # Avoid highlighted text
        #    focused_label.select_region(0, 0)

        ##

        ##ALTERNATIVE array indexing and populating Gtk.Grid
        #self.table = Gtk.Table()
        #self.add(self.table)
        #for y in range((len(prop_list)):
        #    for x in range(len(prop_list[y])):
        #        label = Gtk.Label()
        #        ...
        #        self.table.attach(label, x, x+1, y, y+1)

        ##

        ##ALTERNATIVE however, Gtk.Grid has better geometry management
        #prop_table = Gtk.Table(len(prop_list), len(prop_list[0]), False)
        #frame.add(prop_table)
        #
        #i = 0
        #for prop_row in prop_list:
        #    label = Gtk.Label(prop_row[InfoResultColumn.PROP_LABEL /* 0 */], valign=Gtk.Align.START, halign=Gtk.Align.START)
        #    label.set_padding(4, 0)
        #    label.set_line_wrap(True)
        #    prop_table.attach(label, 0, 1, i, i+1)
        #
        #    #, use_markup=True
        #    label = Gtk.Label(prop_row[InfoResultColumn.PROP_VALUE /* 1 */], valign=Gtk.Align.START, halign=Gtk.Align.START)
        #    label.set_padding(4, 0)
        #    label.set_line_wrap(True)
        #    prop_table.attach(label, 1, 2, i, i+1)
        #
        #    i += 1

        #### Additional Links

        frame = Gtk.Frame(
            label="Additional links",
            label_xalign=0.01,
            margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        self.grid.add(frame)

        #TODO if prog_type not in [get_iplayer.Channels.CH4, get_iplayer.Channels.ITV]:
        url = "<a href=\"https://www.bbc.co.uk/iplayer\" title=\"BBC iPlayer\">BBC iPlayer</a>"
        url += "      "

        # Add URLs to get_iplayer's pvr configuration folder and filenames
        filepath = os.path.join(os.path.expanduser("~"), ".get_iplayer", "pvr")
        url += file.files2urls(filepath)
        url += "      "

        # Add URLs to get_iplayer's presets configuration folder and filenames
        filepath = os.path.join(os.path.expanduser("~"), ".get_iplayer",
                                "presets")
        url += file.files2urls(filepath)

        label1 = Gtk.Label(url,
                           valign=Gtk.Align.START,
                           halign=Gtk.Align.START,
                           use_markup=True,
                           margin_top=get_iplayer_downloader.ui.main_window.
                           WIDGET_BORDER_WIDTH,
                           margin_bottom=get_iplayer_downloader.ui.main_window.
                           WIDGET_BORDER_WIDTH)
        label1.set_padding(
            get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH, 0)
        label1.set_line_wrap(True)
        #WORD_CHAR
        label1.set_line_wrap_mode(Pango.WrapMode.CHAR)
        #label1.set_selectable(False)
        frame.add(label1)

        #### Buttons

        box = Gtk.Box(
            spacing=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        self.grid.add(box)

        button = Gtk.Button(
            "Close",
            margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        button.set_image(Gtk.Image(icon_name=Gtk.STOCK_CLOSE))
        button.connect("clicked", lambda user_data: self.destroy())
        box.pack_end(button, False, False, 0)

        button.grab_focus()

        if os.name == "posix":
            button = Gtk.Button("Similar",
                                margin=get_iplayer_downloader.ui.main_window.
                                WIDGET_BORDER_WIDTH)
            button.set_image(Gtk.Image(icon_name=Gtk.STOCK_FIND))
            button.set_tooltip_text(get_iplayer_downloader.ui.main_window.
                                    TOOLTIP_SEARCH_LOCATE_SIMILAR)
            button.connect("clicked", controller.on_button_similar_clicked,
                           locate_search_term)
            box.pack_end(button, False, False, 0)
    def _init_grid(self, controller, prop_table):
        ##min_content_height=600, min_content_width=600
        ##visible=True, can_focus=True, hscrollbar_policy=Gtk.Policy.AUTOMATIC, 
        #                               vscrollbar_policy=Gtk.Policy.AUTOMATIC
        scrolled_window = Gtk.ScrolledWindow()
        ##scrolled_window.min_content_height(700)
        ##scrolled_window.min_content_width(800)
        #scrolled_window.set_property("min-content-height", 5800)
        #scrolled_window.set_property("min-content-width", 400)
        ##self.set_default_size(400, 400)
        #scrolled_window.set_hexpand(True)
        #scrolled_window.set_vexpand(True)
        self.add(scrolled_window)

        self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL, 
                             margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        ##self.grid.set_row_homogeneous(False)
        ##self.grid.set_column_homogeneous(False)
        scrolled_window.add_with_viewport(self.grid)

        ##

        # Find property values        
        episode = None
        longname = None
        name = None
        image_url = None
        pid = None
        title = None
        for prop_label, prop_value in prop_table:
            if prop_label == "episode":
                episode = prop_value
            if prop_label == "longname":
                longname = prop_value
            if prop_label == "name":
                name = prop_value
            #OLD if prop_label == "thumbnail" or prop_label == "thumbnail4":
            if prop_label == "thumbnail":
                image_url = prop_value
            if prop_label == "pid":
                pid = prop_value
            if prop_label == "title":
                title = prop_value
        
        locate_search_term = name
        
        #### Thumbnail, title, play button
        
        ##ALTERNATIVE
        #for i in range(len(prop_table)):
        #    if prop_table[i][InfoResultColumn.PROP_LABEL /* 0 */] == "thumbnail4":
        #        break
        #if i < len(prop_table):
        #    image_url = prop_table[i][InfoResultColumn.PROP_VALUE /* 1 */]

        if image_url is not None:
            #WORKAROUND for getting a larger image (used to be "thumbnail4")
            #image_url = re.sub("/[0-9]+x[0-9]+/", "/640x360/", image_url)
            
            if string.str2bool(settings.get_config().get(config.NOSECTION, "show-images")):
                timeout = string.str2float(settings.get_config().get(config.NOSECTION, "load-image-timeout-seconds"))
                image = Image.image(image_url, relpath="large", timeout=timeout,
                                    max_width=get_iplayer_downloader.ui.main_window.IMAGE_MAX_WIDTH,
                                    max_height=get_iplayer_downloader.ui.main_window.IMAGE_MAX_HEIGHT)
                if image is not None:
                    self.grid.add(image)

        if title is not None:
            props_title = title
        else:
            # Programme type is "podcast" or episode info is not available
            if longname is not None and episode is not None:
                props_title = longname + " : " + episode
            else:
                props_title = episode
        if props_title is not None:
            TITLE_MAX_LENGTH = int(get_iplayer_downloader.ui.main_window.WINDOW_LARGE_WIDTH / 8) + 3        # 8: gestimated character width
            if len(props_title) > TITLE_MAX_LENGTH:
                # Label1 should not exceed the grid width
                props_title = props_title[:TITLE_MAX_LENGTH] + "..."
            label1 = Gtk.Label(props_title, halign=Gtk.Align.CENTER)
            #label1.set_selectable(False)
            self.grid.add(label1)

        # The play button URL is the same as the "player" property URL
        #NOTE Do not expand/fill the button in the grid: halign=Gtk.Align.CENTER
        button = Gtk.Button(relief=Gtk.ReliefStyle.NONE, image_position=Gtk.PositionType.TOP, halign=Gtk.Align.CENTER)
        button.set_image(Gtk.Image(icon_name=Gtk.STOCK_MEDIA_PLAY))
        #button.set_label("Play")
        #if title is not None:
        #    button.set_label(title)
        button.set_tooltip_text(get_iplayer_downloader.ui.main_window.TOOLTIP_VIEW_PLAYER)
        button.connect("clicked", controller.on_button_play_clicked_by_pid, pid)
        self.grid.add(button)

        #### Property table
        
        #NOTE To expand the main grid (self.grid), expand one of its child widgets: hexpand=True
        frame = Gtk.Frame(label="Properties", label_xalign=0.01, hexpand=True,
                          margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        self.grid.add(frame)

        ##
        
        PROP_LABEL_LIST = ["available", "categories", "channel", "desclong", "dir",
                           "duration", "episode", "expiry", "expiryrel",
                           "firstbcast", "firstbcastrel", "index", "lastbcast",
                           "lastbcastrel", "longname", "modes", "modesizes",
                           "pid", "player", "senum", "timeadded", "title",
                           "type", "versions", "web"]

        prop_grid = Gtk.Grid(column_homogeneous=False, row_homogeneous=False,
                             margin_top=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH, 
                             margin_bottom=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        frame.add(prop_grid)
        
        #focused_label = None
        #for prop_row in prop_table:
        #for i, prop_row in enumerate(prop_table):
        for i, (prop_label, prop_value) in enumerate(prop_table):
            if prop_label in PROP_LABEL_LIST:
                if prop_label == "duration":
                    try:
                        # Convert into hours and minutes
                        #NOTE // is the integer division operator
                        #DUPLICATE
                        duration_mins = int(prop_value) // 60
                        prop_value = "{0:2}".format(duration_mins // 60) + ":" + \
                                     "{0:02}".format(duration_mins % 60)
                        prop_value = prop_value.strip()
                    except ValueError:
                        #NOTE prop_value still has its original value
                        pass
                
                label1 = Gtk.Label(prop_label, valign=Gtk.Align.START, halign=Gtk.Align.START)
                label1.set_padding(get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH, 0)
                label1.set_line_wrap(True)
                #label1.set_selectable(False)
                prop_grid.attach(label1, 0, i, 1, 1)

                label2 = Gtk.Label(markup.text2html(prop_value), margin_start=40,
                                   valign=Gtk.Align.START, halign=Gtk.Align.START, use_markup=True)
                label2.set_padding(get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH, 0)
                label2.set_line_wrap(True)
                label2.set_selectable(True)
                label2.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
                # Avoid centering of text, when line wrap warps at word boundaries (WORD, WORD_CHAR)
                label2.set_alignment(0, 0)
                prop_grid.attach(label2, 1, i, 1, 1)

                #if prop_label == "index" or prop_label == "title":
                #    focused_label = label2

        #if focused_label:
        #    focused_label.grab_focus()
        #    # Avoid highlighted text
        #    focused_label.select_region(0, 0)
        
        ##

        ##ALTERNATIVE array indexing and populating Gtk.Grid
        #self.table = Gtk.Table()
        #self.add(self.table)
        #for y in range((len(prop_list)):
        #    for x in range(len(prop_list[y])):
        #        label = Gtk.Label()
        #        ...
        #        self.table.attach(label, x, x+1, y, y+1)

        ##
        
        ##ALTERNATIVE however, Gtk.Grid has better geometry management
        #prop_table = Gtk.Table(len(prop_list), len(prop_list[0]), False)
        #frame.add(prop_table)
        #
        #i = 0
        #for prop_row in prop_list:
        #    label = Gtk.Label(prop_row[InfoResultColumn.PROP_LABEL /* 0 */], valign=Gtk.Align.START, halign=Gtk.Align.START)
        #    label.set_padding(4, 0)
        #    label.set_line_wrap(True)
        #    prop_table.attach(label, 0, 1, i, i+1)
        #
        #    #, use_markup=True
        #    label = Gtk.Label(prop_row[InfoResultColumn.PROP_VALUE /* 1 */], valign=Gtk.Align.START, halign=Gtk.Align.START)
        #    label.set_padding(4, 0)
        #    label.set_line_wrap(True)
        #    prop_table.attach(label, 1, 2, i, i+1)
        #    
        #    i += 1

        #### Additional Links

        frame = Gtk.Frame(label="Additional links", label_xalign=0.01, 
                          margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        self.grid.add(frame)

        #TODO if prog_type not in [get_iplayer.Channels.CH4, get_iplayer.Channels.ITV]:
        url = "<a href=\"http://www.bbc.co.uk/iplayer\" title=\"BBC iPlayer\">BBC iPlayer</a>"
        url += "      "

        # Add URLs to get_iplayer's pvr configuration folder and filenames
        filepath = os.path.join(os.path.expanduser("~"), ".get_iplayer", "pvr")
        url += file.files2urls(filepath)
        url += "      "

        # Add URLs to get_iplayer's presets configuration folder and filenames
        filepath = os.path.join(os.path.expanduser("~"), ".get_iplayer", "presets")
        url += file.files2urls(filepath)

        label1 = Gtk.Label(url, valign=Gtk.Align.START, halign=Gtk.Align.START, use_markup=True,
                           margin_top=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH, 
                           margin_bottom=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        label1.set_padding(get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH, 0)
        label1.set_line_wrap(True)
        #WORD_CHAR
        label1.set_line_wrap_mode(Pango.WrapMode.CHAR)
        #label1.set_selectable(False)
        frame.add(label1)

        #### Buttons
        
        box = Gtk.Box(spacing=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        self.grid.add(box)
        
        button = Gtk.Button("Close", margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
        button.set_image(Gtk.Image(icon_name=Gtk.STOCK_CLOSE))
        button.connect("clicked", lambda user_data: self.destroy())
        box.pack_end(button, False, False, 0)

        button.grab_focus()

        if os.name == "posix":
            button = Gtk.Button("Similar", margin=get_iplayer_downloader.ui.main_window.WIDGET_BORDER_WIDTH)
            button.set_image(Gtk.Image(icon_name=Gtk.STOCK_FIND))
            button.set_tooltip_text(get_iplayer_downloader.ui.main_window.TOOLTIP_SEARCH_LOCATE_SIMILAR)
            button.connect("clicked", controller.on_button_similar_clicked, locate_search_term)
            box.pack_end(button, False, False, 0)
Пример #4
0
    def _init_dialog(self):
        self.dialog = self.builder.get_object("PreferencesDialog")

        self.general_clear_cache_on_exit_check_button = self.builder.get_object(
            "PrefsGeneralClearCacheOnExitCheckButton")
        self.general_compact_toolbar_check_button = self.builder.get_object(
            "PrefsGeneralCompactToolBarCheckButton")
        self.general_compact_treeview_check_button = self.builder.get_object(
            "PrefsGeneralCompactTreeViewCheckButton")
        self.general_disable_presets_check_button = self.builder.get_object(
            "PrefsGeneralDisablePresetsCheckButton")
        self.general_disable_proxy_check_button = self.builder.get_object(
            "PrefsGeneralDisableProxyCheckButton")
        self.general_refresh_cache_on_startup_check_button = self.builder.get_object(
            "PrefsGeneralRefreshCacheOnStartupCheckButton")
        self.general_show_buttonmenu_check_button = self.builder.get_object(
            "PrefsGeneralShowButtonMenuCheckButton")
        self.general_show_menubar_check_button = self.builder.get_object(
            "PrefsGeneralShowMenuBarCheckButton")
        self.general_show_tooltip_check_button = self.builder.get_object(
            "PrefsGeneralShowTooltipCheckButton")
        self.general_start_maximized_check_button = self.builder.get_object(
            "PrefsGeneralStartMaximizedCheckButton")
        self.general_terminal_emulator_entry = self.builder.get_object(
            "PrefsGeneralTerminalEmulatorEntry")

        self.radio_channels_entry = self.builder.get_object(
            "PrefsRadioChannelsEntry")
        self.radio_download_path_entry = self.builder.get_object(
            "PrefsRadioDownloadPathEntry")
        self.radio_download_file_chooser_button = self.builder.get_object(
            "PrefsRadioDownloadFileChooserButton")
        self.radio_preset_file_entry = self.builder.get_object(
            "PrefsRadioPresetFileEntry")
        self.radio_recording_modes_entry = self.builder.get_object(
            "PrefsRadioRecordingModesEntry")
        self.radio_run_in_terminal_check_button = self.builder.get_object(
            "PrefsRadioRunInTerminalCheckButton")

        self.tv_channels_entry = self.builder.get_object(
            "PrefsTvChannelsEntry")
        self.tv_download_path_entry = self.builder.get_object(
            "PrefsTvDownloadPathEntry")
        self.tv_download_file_chooser_button = self.builder.get_object(
            "PrefsTvDownloadFileChooserButton")
        self.tv_preset_file_entry = self.builder.get_object(
            "PrefsTvPresetFileEntry")
        self.tv_recording_modes_entry = self.builder.get_object(
            "PrefsTvRecordingModesEntry")
        self.tv_run_in_terminal_check_button = self.builder.get_object(
            "PrefsTvRunInTerminalCheckButton")

        ####

        filepath = os.path.join(os.path.expanduser("~"), ".get_iplayer", "pvr")
        url = file.files2urls(filepath)
        url += "      "
        filepath = os.path.join(os.path.expanduser("~"), ".get_iplayer",
                                "presets")
        url += file.files2urls(filepath)

        label = self.builder.get_object("PrefsAdvGetIPlayerConfLabel")
        label.set_markup(url)

        ####

        self.dialog.set_icon(self.icon)
        self.dialog.set_title("preferences - " +
                              get_iplayer_downloader.PROGRAM_NAME)
        self._display_settings()

        self.builder.connect_signals(self)
        self.dialog.connect("response", self._response)