Пример #1
0
def play_audio(sFile):
    global gPlayer, gPlayType
    stop()
    print("INFO:CM:PlayA", sFile)
    gPlayer = ClutterGst.Playback()
    gPlayer.set_filename(sFile)
    gPlayer.set_audio_volume(0.6)
    gPlayer.set_playing(True)
    gPlayType = 'A'
Пример #2
0
def play_video(sFile, ui):
    global gPlayer, gPlayType
    stop()
    print("INFO:CM:PlayV", sFile)
    gPlayer = ClutterGst.Playback()
    gPlayer.set_filename(sFile)
    gPlayer.set_audio_volume(0.6)
    cgstContent = ClutterGst.Aspectratio()
    cgstContent.set_player(gPlayer)
    ui.set_content(cgstContent)
    gVideoContentUI = cgstContent
    #ui.show()
    # default content gravity is resize fill, so things should be fine.
    # need to check, if I require to set the scaling filters explicitly or default is good enough.
    gPlayer.set_playing(True)
    gPlayType = 'V'
Пример #3
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.embed = GtkClutter.Embed()
        self.mainActor = self.embed.get_stage()

        self.videoPlayback = ClutterGst.Playback()
        self.videoContent = ClutterGst.Content()
        self.videoPlayback.set_seek_flags(ClutterGst.SeekFlags.ACCURATE)

        self.videoContent.set_player(self.videoPlayback)
        self.videoPlayback.connect("notify::progress", rewind_progress)

        self.set_startup_id('Oboi')
        self.set_type_hint(Gdk.WindowTypeHint.DESKTOP)
        self.set_skip_pager_hint(True)
        self.set_skip_taskbar_hint(True)
        self.set_accept_focus(True)
        self.stick()
        self.set_resizable(False)
        self.set_keep_below(True)
        self.set_decorated(False)

        self.drag_dest_set(Gtk.DestDefaults.MOTION | Gtk.DestDefaults.DROP,
                           None, Gdk.DragAction.MOVE)

        self.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK
                        | Gdk.EventMask.POINTER_MOTION_MASK
                        | Gdk.EventMask.SMOOTH_SCROLL_MASK)

        self.mainActor.set_background_color(
            Clutter.color_from_string("#000")[1])
        self.wallpaperActor = Clutter.Actor()

        self.videoPath = "file:///home/qwerty/Downloads/videoplayback.mp4"
        self.videoPlayback.set_uri(self.videoPath)
        print("Video path:", self.videoPlayback.get_uri())
        self.videoPlayback.set_playing(True)
        print("Is paying:", self.videoPlayback.get_playing())
        self.wallpaperActor.set_content(self.videoContent)
        # size = get_desktop_size()

        self.wallpaperActor.set_pivot_point(0.5, 0.5)
        self.wallpaperActor.scale_y = 1
        self.wallpaperActor.scale_x = 1

        self.mainActor.add_child(self.wallpaperActor)
        self.add(self.embed)
Пример #4
0
    def __init__(self):
        signal.signal(signal.SIGINT, self._quit)
        signal.signal(signal.SIGTERM, self._quit)
        # SIGSEGV as a fail-safe
        signal.signal(signal.SIGSEGV, self._quit)

        # Initialize
        GtkClutter.init()
        ClutterGst.init()
        create_dir(VIDEO_WALLPAPER_PATH)

        self.config_handler = ConfigHandler(self._on_config_modified)
        self.config = self.config_handler.config
        self.current_video_path = self.config.video_path
        self.user_pause_playback = False
        self.is_any_maximized, self.is_any_fullscreen = False, False

        # Monitor Detect
        self.width, self.height = self.monitor_detect()

        # Actors initialize
        self.embed = GtkClutter.Embed()
        self.main_actor = self.embed.get_stage()
        self.main_actor.set_background_color(Clutter.Color.get_static(Clutter.StaticColor.BLACK))

        # Video initialize
        self.video_playback = ClutterGst.Playback()
        self.video_content = ClutterGst.Content()
        self.video_content.set_player(self.video_playback)

        # Playback settings
        self.video_playback.set_filename(self.config.video_path)
        self.video_playback.set_audio_volume(0.0 if self.config.mute_audio else self.config.audio_volume)
        self.video_playback.set_playing(True)
        self.video_playback.connect('eos', self._on_eos)
        self.main_actor.set_content(self.video_content)

        # Window settings
        self.window = Gtk.Window()
        self.window.add(self.embed)
        self.window.set_type_hint(Gdk.WindowTypeHint.DESKTOP)
        self.window.set_size_request(self.width, self.height)

        # button event
        self._build_context_menu()
        self.window.connect('button-press-event', self._on_button_press_event)
        self.window.show_all()

        self.active_handler = ActiveHandler(self._on_active_changed)
        self.window_handler = WindowHandler(self._on_window_state_changed)
        self.static_wallpaper_handler = StaticWallpaperHandler()
        self.static_wallpaper_handler.set_static_wallpaper()

        if self.config.video_path == '':
            # First time
            ControlPanel().run()
        elif not os.path.isfile(self.config.video_path):
            self._on_file_not_found(self.config.video_path)

        self.file_list = scan_dir()
        random.shuffle(self.file_list)
        self.current = 0
        if self.config.video_path in self.file_list:
            self.current = self.file_list.index(self.config.video_path)
        Gtk.main()