From 6de143dc7048a8fe11f271b321d634d2f8589707 Mon Sep 17 00:00:00 2001 From: Thomas-Toulouse Date: Mon, 8 Aug 2022 18:26:40 -0400 Subject: [PATCH] Update MagicEye.py --- MagicEye.py | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/MagicEye.py b/MagicEye.py index e9c74d32..c8f4a06e 100755 --- a/MagicEye.py +++ b/MagicEye.py @@ -14,28 +14,25 @@ gi.require_version('Gdk', '3.0') from gi.repository import Gst, GLib, GObject,Gtk,Gio,GdkPixbuf from gi.repository import Gdk, GstVideo +Gdk.set_allowed_backends("x11") - -#Gdk.set_allowed_backends("x11") +Gst.init(None) -Gst.init(None) -Gtk.init(None) -#print (Gdk.get_display() ) class UI(Gtk.Window): - - os.system['Gdk_BACKEND'] = 'x11' + Gdk.set_allowed_backends("x11") - - - - # print(Gdk.wayland_onscreen_get_surface()) - def __init__(self): + #Gdk.set_allowed_backends("x11") + #icon = Gio.ThemedIcon(name="magiceye-02") + #self.set_icon(icon) + #icon = GdkPixbuf.Pixbuf.new_from_resource("magiceye-02.svg") + #print(icon) + #self.set_icon(icon) tPackage = threading.Thread(target=self.package_check) tPackage.start() - Gdk.set_allowed_backends("x11") + Gdk.set_allowed_backends("wayland,x11") config = configparser.ConfigParser() config.read(Config.full_config_file_path) print(Config.full_config_file_path) @@ -48,7 +45,7 @@ def __init__(self): grid = Gtk.Grid(row_spacing =10,column_spacing = 10,column_homogeneous = True) self.set_border_width(10) - #print(Gdk.get_display()) + print(Gdk.get_display()) clientBtn = Gtk.Button(label="client") clientBtn.connect("clicked",self.loadClient) @@ -100,7 +97,8 @@ def onLoadDialogAbout(self,window): def loadClient(self, window): - #print( os.environ ) + + os.environ['GDK_BACKEND'] = 'x11' client.main() # Gtk.Window.new(Player) #Gtk.WindowType(0) @@ -111,11 +109,7 @@ def loadClient(self, window): #subprocess.Popen(file, shell=shellBool) def loadServer(self, window): - #print( os.environ ) - Gdk.set_allowed_backends("x11") - #os.environ['GDK_BACKEND']="x11" - - ##rint( os.environ ) + os.environ['GDK_BACKEND'] = 'x11' server.main() server.ServerGui.__init__ # file=os.path.dirname(os.path.abspath(__file__))+"/server.py" @@ -226,12 +220,6 @@ def package_check(self): def main(): win = UI() - # if Gdk.get_display() == "wayland-0" : - # print("go here") - # os.environ['GDK_BACKEND']='x11' - # print(os.environ) - # #Gdk.Display.open(":1") - # #os.system="GDK_BACKEND=x11"+str(UI()) icon_app_path ='/home/thomas/.local/share/icons/MagicEye-icon/magiceye-06.svg' pixbuf = GdkPixbuf.Pixbuf.new_from_file(icon_app_path) win.set_icon(pixbuf)