Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_userpref.py
| Show First 20 Lines • Show All 553 Lines • ▼ Show 20 Lines | |||||
| class USERPREF_PT_theme(Panel): | class USERPREF_PT_theme(Panel): | ||||
| bl_space_type = 'USER_PREFERENCES' | bl_space_type = 'USER_PREFERENCES' | ||||
| bl_label = "Themes" | bl_label = "Themes" | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_options = {'HIDE_HEADER'} | bl_options = {'HIDE_HEADER'} | ||||
| ui_delimiters = { | |||||
| "VIEW_3D": {"text_grease_pencil", "text_keyframe","speaker", | |||||
| "freestyle_face_mark", "split_normal", "bone_solid", | |||||
| "paint_curve_pivot"}, | |||||
| } | |||||
| @staticmethod | @staticmethod | ||||
| def _theme_generic(split, themedata): | def _theme_generic(split, themedata, theme_area): | ||||
| col = split.column() | col = split.column() | ||||
| def theme_generic_recurse(data): | def theme_generic_recurse(data, area_name): | ||||
| col.label(data.rna_type.name) | col.label(data.rna_type.name) | ||||
| row = col.row() | row = col.row() | ||||
| subsplit = row.split(percentage=0.95) | subsplit = row.split(percentage=0.95) | ||||
| padding1 = subsplit.split(percentage=0.15) | padding1 = subsplit.split(percentage=0.15) | ||||
| padding1.column() | padding1.column() | ||||
| subsplit = row.split(percentage=0.85) | subsplit = row.split(percentage=0.85) | ||||
| Show All 9 Lines | def _theme_generic(split, themedata, theme_area): | ||||
| if prop.identifier == "rna_type": | if prop.identifier == "rna_type": | ||||
| continue | continue | ||||
| props_type.setdefault((prop.type, prop.subtype), []).append(prop) | props_type.setdefault((prop.type, prop.subtype), []).append(prop) | ||||
| for props_type, props_ls in sorted(props_type.items()): | for props_type, props_ls in sorted(props_type.items()): | ||||
| if props_type[0] == 'POINTER': | if props_type[0] == 'POINTER': | ||||
| for i, prop in enumerate(props_ls): | for i, prop in enumerate(props_ls): | ||||
| theme_generic_recurse(getattr(data, prop.identifier)) | theme_generic_recurse(getattr(data, prop.identifier), theme_area) | ||||
| else: | else: | ||||
| for i, prop in enumerate(props_ls): | i = 0 | ||||
campbellbarton: Rather keep separate logic here, so common case can be kept understandable.
if… | |||||
| colsub_pair[i % 2].row().prop(data, prop.identifier) | for prop in props_ls: | ||||
| colsub = colsub_pair[i % 2] | |||||
| colsub.row().prop(data, prop.identifier) | |||||
| i += 1 | |||||
| if prop.identifier in USERPREF_PT_theme.ui_delimiters.get(theme_area): | |||||
| if i%2 : | |||||
| colsub = colsub_pair[1] | |||||
| colsub.row().label('') | |||||
| i += 1 | |||||
| colsub_pair[0].row().label('') | |||||
| colsub_pair[1].row().label('') | |||||
| theme_generic_recurse(themedata) | theme_generic_recurse(themedata, theme_area) | ||||
| @staticmethod | @staticmethod | ||||
| def _theme_widget_style(layout, widget_style): | def _theme_widget_style(layout, widget_style): | ||||
| row = layout.row() | row = layout.row() | ||||
| subsplit = row.split(percentage=0.95) | subsplit = row.split(percentage=0.95) | ||||
| ▲ Show 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| col.label(text="Widget:") | col.label(text="Widget:") | ||||
| self._ui_font_style(col, style.widget) | self._ui_font_style(col, style.widget) | ||||
| col.separator() | col.separator() | ||||
| col.label(text="Widget Label:") | col.label(text="Widget Label:") | ||||
| self._ui_font_style(col, style.widget_label) | self._ui_font_style(col, style.widget_label) | ||||
| else: | else: | ||||
| self._theme_generic(split, getattr(theme, theme.theme_area.lower())) | self._theme_generic(split, getattr(theme, theme.theme_area.lower()), theme.theme_area) | ||||
| class USERPREF_PT_file(Panel): | class USERPREF_PT_file(Panel): | ||||
| bl_space_type = 'USER_PREFERENCES' | bl_space_type = 'USER_PREFERENCES' | ||||
| bl_label = "Files" | bl_label = "Files" | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_options = {'HIDE_HEADER'} | bl_options = {'HIDE_HEADER'} | ||||
| ▲ Show 20 Lines • Show All 550 Lines • Show Last 20 Lines | |||||
Rather keep separate logic here, so common case can be kept understandable.
if th_delimiters is None: old logic else: new complicated logicThis will help make it more clear whats going on if we ever want to re-work the code later.