|
|
|
@ -5,6 +5,8 @@ import socket
|
|
|
|
|
import time |
|
|
|
|
import re |
|
|
|
|
|
|
|
|
|
import json |
|
|
|
|
|
|
|
|
|
from subprocess import * |
|
|
|
|
|
|
|
|
|
import gi |
|
|
|
@ -51,12 +53,14 @@ class MainWindow ( object ):
|
|
|
|
|
self.showPlaylist = True; |
|
|
|
|
## width of the playlist-view panel, last time it was closed |
|
|
|
|
self.paneState = -150; |
|
|
|
|
|
|
|
|
|
self.title = "GTPlay" |
|
|
|
|
|
|
|
|
|
# set destructor, when the window closes and window title |
|
|
|
|
self.window = self.builder.get_object ( "gtplayer" ); |
|
|
|
|
self.window.connect ( "destroy", self.destroy ); |
|
|
|
|
self.window.connect ( "window-state-event", self.WindowStateTrigger ); |
|
|
|
|
self.window.set_title ("GTPlay"); |
|
|
|
|
self.window.set_title ( self.title ); |
|
|
|
|
|
|
|
|
|
# set callbacks for buttons, dials, switches and toggles |
|
|
|
|
va=self.builder.get_object ( "videoArea" ) |
|
|
|
@ -162,7 +166,8 @@ class MainWindow ( object ):
|
|
|
|
|
x = self.playlist.current().url; |
|
|
|
|
|
|
|
|
|
window = self.builder.get_object ( "gtplayer" ); |
|
|
|
|
window.set_title(x + " | GTPlay"); |
|
|
|
|
self.title = x + " | GTPlay"; |
|
|
|
|
window.set_title( self.title ); |
|
|
|
|
|
|
|
|
|
def WindowStateTrigger( self, widget, event, data=None ): |
|
|
|
|
#print (" ---- Window State event") |
|
|
|
@ -391,7 +396,33 @@ class MainWindow ( object ):
|
|
|
|
|
#if ( self.player != None ): |
|
|
|
|
# self.player.updatePosition(self.getWindowSpace()); |
|
|
|
|
|
|
|
|
|
def getWindowSpaceSwayInternal ( self, tree, name ): |
|
|
|
|
for t in tree["nodes"]: |
|
|
|
|
if t["name"] == name: |
|
|
|
|
return t["rect"]; |
|
|
|
|
|
|
|
|
|
if "nodes" in t: |
|
|
|
|
rect = self.getWindowSpaceSwayInternal ( t, name ); |
|
|
|
|
if rect != None: |
|
|
|
|
return rect; |
|
|
|
|
|
|
|
|
|
return None; |
|
|
|
|
|
|
|
|
|
def getWindowSpaceSway ( self ): |
|
|
|
|
p = Popen ( ['swaymsg', '-t', "get_tree" ], stdout=PIPE) |
|
|
|
|
|
|
|
|
|
hwnd = p.communicate()[0] |
|
|
|
|
hwnd = hwnd.decode ( "utf-8" ) |
|
|
|
|
|
|
|
|
|
tree = json.loads ( hwnd ); |
|
|
|
|
rect = self.getWindowSpaceSwayInternal ( tree, self.title ); |
|
|
|
|
print ( rect ) |
|
|
|
|
if rect == None: |
|
|
|
|
return { "x": 0, "y": 0, "width": 1280, "height": 720 } |
|
|
|
|
return rect; |
|
|
|
|
|
|
|
|
|
def getWindowSpace ( self ): |
|
|
|
|
return self.getWindowSpaceSway() |
|
|
|
|
p = Popen ( ['xwininfo', '-id', str(self.window.get_window().get_xid()) ], stdout=PIPE) |
|
|
|
|
|
|
|
|
|
hwnd = p.communicate()[0] |
|
|
|
|