Refactor: Improve Pythonic code style
- Replace len() > 0 with direct boolean check for better Pythonic code - Optimize dictionary iteration by removing unnecessary .keys() calls These changes improve code readability and follow Python best practices by using more idiomatic patterns.
This commit is contained in:
parent
26bca526c3
commit
f720789c95
@ -860,7 +860,7 @@ class MyTimelineView(NavigationView):
|
||||
category_event_types = {} # Map category to list of event types
|
||||
|
||||
# First pass: collect event types by category
|
||||
for event_type_obj in EVENT_COLORS.keys():
|
||||
for event_type_obj in EVENT_COLORS:
|
||||
if event_type_obj not in EVENT_CATEGORIES:
|
||||
continue
|
||||
category = EVENT_CATEGORIES[event_type_obj]
|
||||
@ -869,7 +869,7 @@ class MyTimelineView(NavigationView):
|
||||
category_event_types[category].append(event_type_obj)
|
||||
|
||||
# Second pass: create UI with category checkboxes
|
||||
for category in sorted(category_event_types.keys()):
|
||||
for category in sorted(category_event_types):
|
||||
event_types_in_category = category_event_types[category]
|
||||
|
||||
# Create category checkbox with three-state support
|
||||
@ -1243,7 +1243,7 @@ class MyTimelineView(NavigationView):
|
||||
add_person_checkbox(child_ref.ref, _('Child'))
|
||||
|
||||
# Only add expander if there are members to show
|
||||
if len(members_box.get_children()) > 0:
|
||||
if members_box.get_children():
|
||||
# Create family checkbox with three-state support
|
||||
family_checkbox = Gtk.CheckButton(label=family_name)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user