added burger menu, About section and Preferences menu item, which is WIP
This commit is contained in:
@@ -81,6 +81,7 @@ modules:
|
||||
- install -Dm755 rdpconnect.sh /app/bin/rdpconnect
|
||||
- install -Dm755 main.py /app/
|
||||
- install com.angoosh.RDPConnect.ui /app/
|
||||
- install menu.ui /app/
|
||||
- install style-dark.css /app/
|
||||
- install style-light.css /app/
|
||||
- install -Dm644 com.angoosh.RDPConnect.svg /app/share/icons/hicolor/scalable/apps/
|
||||
@@ -105,3 +106,5 @@ modules:
|
||||
path: com.angoosh.RDPConnect.desktop
|
||||
- type: file
|
||||
path: com.angoosh.RDPConnect.metainfo.xml
|
||||
- type: file
|
||||
path: menu.ui
|
||||
@@ -4,6 +4,10 @@
|
||||
Created on Mon Nov 18 12:04:53 2024
|
||||
|
||||
@author: angoosh
|
||||
|
||||
references:
|
||||
https://pygobject.gnome.org/tutorials/gtk4/introduction.html
|
||||
https://docs.gtk.org/gtk3/index.html#classes
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
@@ -18,6 +22,8 @@ from gi.repository import Gtk, Adw, Gdk, Gio
|
||||
APPID = "com.angoosh.RDPConnect"
|
||||
HOMEDIR = os.path.expanduser('~')
|
||||
|
||||
VERSION = "1.0.5rc1"
|
||||
|
||||
conn_info = {}
|
||||
settings = {}
|
||||
fernet = ""
|
||||
@@ -70,6 +76,9 @@ class MyApp(Adw.Application):
|
||||
def on_activate(self, app):
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file("/app/"+APPID+".ui")
|
||||
buildermenu = Gtk.Builder()
|
||||
buildermenu.add_from_file("/app/menu.ui")
|
||||
menu_model = buildermenu.get_object('app-menu')
|
||||
|
||||
css_provider = Gtk.CssProvider()
|
||||
if Adw.StyleManager().get_default().get_dark():
|
||||
@@ -97,10 +106,43 @@ class MyApp(Adw.Application):
|
||||
except:
|
||||
pass
|
||||
|
||||
#menu config
|
||||
self.win = builder.get_object("main_window")
|
||||
header_bar = Gtk.HeaderBar()
|
||||
self.win.set_titlebar(header_bar)
|
||||
|
||||
menubutton = Gtk.MenuButton(menu_model=menu_model, icon_name='open-menu-symbolic')
|
||||
header_bar.pack_end(menubutton)
|
||||
|
||||
self.win.set_application(self)
|
||||
self.win.present()
|
||||
|
||||
def do_startup(self):
|
||||
Gtk.Application.do_startup(self)
|
||||
|
||||
action = Gio.SimpleAction(name='preferences')
|
||||
action.connect('activate', self.on_preferences)
|
||||
self.add_action(action)
|
||||
|
||||
action = Gio.SimpleAction(name='about')
|
||||
action.connect('activate', self.on_about)
|
||||
self.add_action(action)
|
||||
|
||||
def on_about(self, action, param):
|
||||
about_dialog = Gtk.AboutDialog(transient_for=self.win, modal=True)
|
||||
about_dialog.set_copyright("Antonin Kaplan")
|
||||
about_dialog.set_program_name("RDP Connect")
|
||||
about_dialog.set_license_type(Gtk.License(16))
|
||||
about_dialog.set_logo_icon_name("com.angoosh.RDPConnect")
|
||||
about_dialog.set_version(VERSION)
|
||||
about_dialog.set_website("https://gitea.farmdash.org/angoosh/Flatpaks")
|
||||
about_dialog.present()
|
||||
|
||||
def on_preferences(self, action, param):
|
||||
pref_window = Gtk.Window(title="Preferences")
|
||||
pref_window.show()
|
||||
print("Preferences")
|
||||
|
||||
def saveConnConf(self):
|
||||
if settings["save_conn"]:
|
||||
password = conn_info["passwd"]
|
||||
@@ -141,7 +183,6 @@ class MyApp(Adw.Application):
|
||||
subprocess.Popen([settings["rdp_bin"], "/v:"+str(conn_info["ip"]), "/u:"+str(conn_info["user"]), "/p:"+str(conn_info["passwd"])]+settings["extra_params"])
|
||||
except:
|
||||
subprocess.Popen(["sdl-freerdp", "/v:"+str(conn_info["ip"]), "/u:"+str(conn_info["user"]), "/p:"+str(conn_info["passwd"])]+settings["extra_params"])
|
||||
#subprocess.run(["xfreerdp", "/v:"+str(ip), "/u:"+str(user), "/p:"+str(passwd)])
|
||||
|
||||
if not os.path.isdir(HOMEDIR+"/.config/rdpconnect"):
|
||||
os.makedirs(HOMEDIR+"/.config/rdpconnect")
|
||||
|
||||
16
com.angoosh.RDPConnect/menu.ui
Normal file
16
com.angoosh.RDPConnect/menu.ui
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<interface>
|
||||
<menu id='app-menu'>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name='label'>Preferences</attribute>
|
||||
<attribute name='action'>app.preferences</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name='label'>About</attribute>
|
||||
<attribute name='action'>app.about</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
</interface>
|
||||
|
||||
@@ -1 +1 @@
|
||||
9428c06df79e34ced50b30da7348cc491dc8079b34898598a6c78424405839ce
|
||||
c85d2b15939555943d6b112b19ea5c08212f7fcaceb16f625d893379cf4b1099
|
||||
|
||||
@@ -1 +1 @@
|
||||
2fdcf76a694b1f6cebc310c5f85ce998aa678ffb6558a4f1bbd075cd1640feab
|
||||
f3ef1294b654475b4a5acda3a7d56f3013ac3ec6ddebf1c900717c45ccaa3781
|
||||
|
||||
@@ -1 +1 @@
|
||||
e0461f34512c2cb7a0dae63db3d82588f59df34419ddd191c279714512dd3789
|
||||
42cff0ba2f3cc77988cd5bb0542221818fc3937c4e7c8c8539b385d728e63b0d
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
repo/summary
BIN
repo/summary
Binary file not shown.
BIN
repo/summary.idx
BIN
repo/summary.idx
Binary file not shown.
Reference in New Issue
Block a user