Refactor: Extract drawing area event masks as constant
- Extract DRAWING_AREA_EVENT_MASKS constant to consolidate event mask combination - Improves maintainability by centralizing event mask configuration This change makes it easier to modify event handling behavior in one place.
This commit is contained in:
parent
b9c9951487
commit
0ae8e80db1
@ -89,6 +89,15 @@ CLICKABLE_AREA_HEIGHT = 30
|
||||
YEAR_LABEL_WIDTH = 100
|
||||
YEAR_MARKER_STEP_DIVISOR = 10 # Divisor for calculating year marker step (every Nth year)
|
||||
TOOLTIP_DELAY = 500 # milliseconds
|
||||
|
||||
# Drawing Area Event Masks
|
||||
DRAWING_AREA_EVENT_MASKS = (
|
||||
Gdk.EventMask.BUTTON_PRESS_MASK
|
||||
| Gdk.EventMask.BUTTON_RELEASE_MASK
|
||||
| Gdk.EventMask.POINTER_MOTION_MASK
|
||||
| Gdk.EventMask.LEAVE_NOTIFY_MASK
|
||||
| Gdk.EventMask.SCROLL_MASK
|
||||
)
|
||||
TOOLTIP_MAX_WIDTH = 500
|
||||
LABEL_BACKGROUND_PADDING = 8
|
||||
LABEL_BACKGROUND_RADIUS = 5
|
||||
@ -644,13 +653,7 @@ class MyTimelineView(NavigationView):
|
||||
self.drawing_area = Gtk.DrawingArea()
|
||||
self.drawing_area.set_size_request(800, 600)
|
||||
self.drawing_area.connect("draw", self.on_draw)
|
||||
self.drawing_area.add_events(
|
||||
Gdk.EventMask.BUTTON_PRESS_MASK
|
||||
| Gdk.EventMask.BUTTON_RELEASE_MASK
|
||||
| Gdk.EventMask.POINTER_MOTION_MASK
|
||||
| Gdk.EventMask.LEAVE_NOTIFY_MASK
|
||||
| Gdk.EventMask.SCROLL_MASK
|
||||
)
|
||||
self.drawing_area.add_events(DRAWING_AREA_EVENT_MASKS)
|
||||
|
||||
# Connect mouse events
|
||||
self.drawing_area.connect("button-press-event", self.on_button_press)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user