added com.angoosh.RDPConnect app WIP
This commit is contained in:
53
com.angoosh.RDPConnect/main.py
Normal file
53
com.angoosh.RDPConnect/main.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Mon Nov 18 12:04:53 2024
|
||||
|
||||
@author: angoosh
|
||||
"""
|
||||
import sys
|
||||
import gi
|
||||
import subprocess
|
||||
gi.require_version('Gtk', '4.0')
|
||||
gi.require_version('Adw', '1')
|
||||
from gi.repository import Gtk, Adw, Gdk, Gio
|
||||
|
||||
APPID = "com.angoosh.RDPConnect"
|
||||
|
||||
|
||||
class MyApp(Adw.Application):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.connect('activate', self.on_activate)
|
||||
|
||||
def on_activate(self, app):
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(APPID+".ui")
|
||||
|
||||
css_provider = Gtk.CssProvider()
|
||||
css_provider.load_from_file(Gio.File.new_for_path("style.css"))
|
||||
Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
|
||||
connect = builder.get_object("connect")
|
||||
connect.connect("clicked", self.hello)
|
||||
|
||||
self.ip = builder.get_object("ip")
|
||||
self.user = builder.get_object("user")
|
||||
self.passwd = builder.get_object("pass")
|
||||
|
||||
self.win = builder.get_object("main_window")
|
||||
self.win.set_application(self)
|
||||
self.win.present()
|
||||
|
||||
def hello(self, button):
|
||||
print("Hello world")
|
||||
ip = self.ip.get_buffer().get_text()
|
||||
user = self.user.get_buffer().get_text()
|
||||
passwd = self.passwd.get_buffer().get_text()
|
||||
|
||||
#subprocess.run(["flatpak", "run", "com.freerdp.FreeRDP", "/v:"+str(ip), "/u:"+str(user), "/p:"+str(passwd)])
|
||||
subprocess.run(["xfreerdp", "/v:"+str(ip), "/u:"+str(user), "/p:"+str(passwd)])
|
||||
|
||||
|
||||
app = MyApp(application_id=APPID)
|
||||
app.run(sys.argv)
|
||||
Reference in New Issue
Block a user