Configure IDLE feature extensions and help menu extensions. List the feature extensions and a configuration box for the selected extension. Help menu extensions are in a HelpFrame. This code reads the current configuration using idleConf, supplies a GUI interface t
(self)
| 1895 | self.create_page_extensions() # Requires extension names. |
| 1896 | |
| 1897 | def create_page_extensions(self): |
| 1898 | """Configure IDLE feature extensions and help menu extensions. |
| 1899 | |
| 1900 | List the feature extensions and a configuration box for the |
| 1901 | selected extension. Help menu extensions are in a HelpFrame. |
| 1902 | |
| 1903 | This code reads the current configuration using idleConf, |
| 1904 | supplies a GUI interface to change the configuration values, |
| 1905 | and saves the changes using idleConf. |
| 1906 | |
| 1907 | Some changes may require restarting IDLE. This depends on each |
| 1908 | extension's implementation. |
| 1909 | |
| 1910 | All values are treated as text, and it is up to the user to |
| 1911 | supply reasonable values. The only exception to this are the |
| 1912 | 'enable*' options, which are boolean, and can be toggled with a |
| 1913 | True/False button. |
| 1914 | |
| 1915 | Methods: |
| 1916 | extension_selected: Handle selection from list. |
| 1917 | create_extension_frame: Hold widgets for one extension. |
| 1918 | set_extension_value: Set in userCfg['extensions']. |
| 1919 | save_all_changed_extensions: Call extension page Save(). |
| 1920 | """ |
| 1921 | self.extension_names = StringVar(self) |
| 1922 | |
| 1923 | frame_ext = LabelFrame(self, borderwidth=2, relief=GROOVE, |
| 1924 | text=' Feature Extensions ') |
| 1925 | self.frame_help = HelpFrame(self, borderwidth=2, relief=GROOVE, |
| 1926 | text=' Help Menu Extensions ') |
| 1927 | |
| 1928 | frame_ext.rowconfigure(0, weight=1) |
| 1929 | frame_ext.columnconfigure(2, weight=1) |
| 1930 | self.extension_list = Listbox(frame_ext, listvariable=self.extension_names, |
| 1931 | selectmode='browse') |
| 1932 | self.extension_list.bind('<<ListboxSelect>>', self.extension_selected) |
| 1933 | scroll = Scrollbar(frame_ext, command=self.extension_list.yview) |
| 1934 | self.extension_list.yscrollcommand=scroll.set |
| 1935 | self.details_frame = LabelFrame(frame_ext, width=250, height=250) |
| 1936 | self.extension_list.grid(column=0, row=0, sticky='nws') |
| 1937 | scroll.grid(column=1, row=0, sticky='ns') |
| 1938 | self.details_frame.grid(column=2, row=0, sticky='nsew', padx=[10, 0]) |
| 1939 | frame_ext.configure(padding=10) |
| 1940 | self.config_frame = {} |
| 1941 | self.current_extension = None |
| 1942 | |
| 1943 | self.outerframe = self # TEMPORARY |
| 1944 | self.tabbed_page_set = self.extension_list # TEMPORARY |
| 1945 | |
| 1946 | # Create the frame holding controls for each extension. |
| 1947 | ext_names = '' |
| 1948 | for ext_name in sorted(self.extensions): |
| 1949 | self.create_extension_frame(ext_name) |
| 1950 | ext_names = ext_names + '{' + ext_name + '} ' |
| 1951 | self.extension_names.set(ext_names) |
| 1952 | self.extension_list.selection_set(0) |
| 1953 | self.extension_selected(None) |
| 1954 |
no test coverage detected