@@ -576,6 +576,49 @@ def handle_osd(self, obj):
576
576
return
577
577
self .osd_elements [obj .label ] = obj
578
578
579
+ def process_event (self , obj ):
580
+ """Process a single event"""
581
+ if isinstance (obj , MPImageOSD_Element ):
582
+ self .handle_osd (obj )
583
+ if isinstance (obj , MPImageData ):
584
+ self .set_image_data (obj .data , obj .width , obj .height )
585
+ if isinstance (obj , MPImageTitle ):
586
+ state .frame .SetTitle (obj .title )
587
+ if isinstance (obj , MPImageRecenter ):
588
+ self .on_recenter (obj .location )
589
+ if isinstance (obj , MPImageMenu ):
590
+ self .set_menu (obj .menu )
591
+ if isinstance (obj , MPImagePopupMenu ):
592
+ self .set_popup_menu (obj .menu )
593
+ if isinstance (obj , MPImageBrightness ):
594
+ state .brightness = obj .brightness
595
+ self .need_redraw = True
596
+ if isinstance (obj , MPImageFullSize ):
597
+ self .full_size ()
598
+ if isinstance (obj , MPImageFitToWindow ):
599
+ self .fit_to_window ()
600
+ if isinstance (obj , win_layout .WinLayout ):
601
+ win_layout .set_wx_window_layout (state .frame , obj )
602
+ if isinstance (obj , MPImageGStreamer ):
603
+ self .start_gstreamer (obj .pipeline )
604
+ if isinstance (obj , MPImageVideo ):
605
+ self .start_video (obj .filename )
606
+ if isinstance (obj , MPImageFPSMax ):
607
+ self .fps_max = obj .fps_max
608
+ print ("FPS_MAX: " , self .fps_max )
609
+ if isinstance (obj , MPImageSeekPercent ):
610
+ self .seek_video (obj .percent )
611
+ if isinstance (obj , MPImageSeekFrame ):
612
+ self .seek_video_frame (obj .frame )
613
+ if isinstance (obj , MPImageColormap ):
614
+ self .colormap = obj .colormap
615
+ if isinstance (obj , MPImageColormapIndex ):
616
+ self .colormap_index = obj .colormap_index
617
+ if isinstance (obj , MPImageStartTracker ):
618
+ self .start_tracker (obj )
619
+ if isinstance (obj , MPImageEndTracker ):
620
+ self .tracker = None
621
+
579
622
def on_redraw_timer (self , event ):
580
623
'''the redraw timer ensures we show new map tiles as they
581
624
are downloaded'''
@@ -586,46 +629,8 @@ def on_redraw_timer(self, event):
586
629
except Exception :
587
630
time .sleep (0.05 )
588
631
return
589
- if isinstance (obj , MPImageOSD_Element ):
590
- self .handle_osd (obj )
591
- if isinstance (obj , MPImageData ):
592
- self .set_image_data (obj .data , obj .width , obj .height )
593
- if isinstance (obj , MPImageTitle ):
594
- state .frame .SetTitle (obj .title )
595
- if isinstance (obj , MPImageRecenter ):
596
- self .on_recenter (obj .location )
597
- if isinstance (obj , MPImageMenu ):
598
- self .set_menu (obj .menu )
599
- if isinstance (obj , MPImagePopupMenu ):
600
- self .set_popup_menu (obj .menu )
601
- if isinstance (obj , MPImageBrightness ):
602
- state .brightness = obj .brightness
603
- self .need_redraw = True
604
- if isinstance (obj , MPImageFullSize ):
605
- self .full_size ()
606
- if isinstance (obj , MPImageFitToWindow ):
607
- self .fit_to_window ()
608
- if isinstance (obj , win_layout .WinLayout ):
609
- win_layout .set_wx_window_layout (state .frame , obj )
610
- if isinstance (obj , MPImageGStreamer ):
611
- self .start_gstreamer (obj .pipeline )
612
- if isinstance (obj , MPImageVideo ):
613
- self .start_video (obj .filename )
614
- if isinstance (obj , MPImageFPSMax ):
615
- self .fps_max = obj .fps_max
616
- print ("FPS_MAX: " , self .fps_max )
617
- if isinstance (obj , MPImageSeekPercent ):
618
- self .seek_video (obj .percent )
619
- if isinstance (obj , MPImageSeekFrame ):
620
- self .seek_video_frame (obj .frame )
621
- if isinstance (obj , MPImageColormap ):
622
- self .colormap = obj .colormap
623
- if isinstance (obj , MPImageColormapIndex ):
624
- self .colormap_index = obj .colormap_index
625
- if isinstance (obj , MPImageStartTracker ):
626
- self .start_tracker (obj )
627
- if isinstance (obj , MPImageEndTracker ):
628
- self .tracker = None
632
+
633
+ self .process_event (obj )
629
634
630
635
if self .need_redraw :
631
636
self .redraw ()
0 commit comments