Create a frame holding the widgets to configure one extension
(self, ext_name)
| 2019 | self.current_extension = newsel |
| 2020 | |
| 2021 | def create_extension_frame(self, ext_name): |
| 2022 | """Create a frame holding the widgets to configure one extension""" |
| 2023 | f = VerticalScrolledFrame(self.details_frame, height=250, width=250) |
| 2024 | self.config_frame[ext_name] = f |
| 2025 | entry_area = f.interior |
| 2026 | # Create an entry for each configuration option. |
| 2027 | for row, opt in enumerate(self.extensions[ext_name]): |
| 2028 | # Create a row with a label and entry/checkbutton. |
| 2029 | label = Label(entry_area, text=opt['name']) |
| 2030 | label.grid(row=row, column=0, sticky=NW) |
| 2031 | var = opt['var'] |
| 2032 | if opt['type'] == 'bool': |
| 2033 | Checkbutton(entry_area, variable=var, |
| 2034 | onvalue='True', offvalue='False', width=8 |
| 2035 | ).grid(row=row, column=1, sticky=W, padx=7) |
| 2036 | elif opt['type'] == 'int': |
| 2037 | Entry(entry_area, textvariable=var, validate='key', |
| 2038 | validatecommand=(self.is_int, '%P'), width=10 |
| 2039 | ).grid(row=row, column=1, sticky=NSEW, padx=7) |
| 2040 | |
| 2041 | else: # type == 'str' |
| 2042 | # Limit size to fit non-expanding space with larger font. |
| 2043 | Entry(entry_area, textvariable=var, width=15 |
| 2044 | ).grid(row=row, column=1, sticky=NSEW, padx=7) |
| 2045 | return |
| 2046 | |
| 2047 | def set_extension_value(self, section, opt): |
| 2048 | """Return True if the configuration was added or changed. |
no test coverage detected