This commit is contained in:
Hemish 2024-01-28 01:59:09 +05:30
parent 1841046729
commit e9f87f0528
10 changed files with 81 additions and 26 deletions

View File

@ -1,13 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version='1.0' encoding='utf-8'?>
<component type="desktop">
<id>net.hemish.pe.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<description>
<p> WIP </p>
</description>
<custom>
<value key="Purism::form_factor">workstation</value>
<value key="Purism::form_factor">mobile</value>
</custom>
<!--Created with jdAppStreamEdit 6.0-->
<id>net.hemish.pe</id>
<name>Pe</name>
<summary>A USSD based UPI client</summary>
<developer_name>Hemish</developer_name>
<launchable type="desktop-id">net.hemish.pe.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<description>
<p>Pe is an unofficial USSD *99# based UPI client for Linux platforms.</p>
</description>
<url type="homepage">https://github.com/imhemish/pe</url>
<url type="contact">https://hemish.net</url>
<url type="vcs-browser">https://github.com/imhemish/pe</url>
<categories>
<category>GTK</category>
<category>Utility</category>
<category>Economy</category>
<category>Telephony</category>
<category>Finance</category>
</categories>
<supports>
<control>pointing</control>
<control>keyboard</control>
<control>console</control>
<control>touch</control>
</supports>
<content_rating type="oars-1.1"/>
<keywords>
<keyword>upi</keyword>
<keyword>pe</keyword>
<keyword>payment</keyword>
<keyword>finance</keyword>
<keyword>money</keyword>
<keyword>india</keyword>
</keywords>
<custom>
<value key="Purism::form_factor">workstation</value>
<value key="Purism::form_factor">mobile</value>
</custom>
</component>

View File

@ -4,8 +4,11 @@ Exec=pe
Icon=net.hemish.pe
Terminal=false
Type=Application
Categories=GTK;
Categories=GTK;Finance
StartupNotify=true
# For handling UPI links
MimeType=x-scheme-handler/upi
# Translators: Do NOT translate or transliterate this text (these are enum types)!
X-Purism-FormFactor=Workstation;Mobile;

View File

@ -1,5 +1,5 @@
{
"id" : "net.hemish.pe",
"id" : "net.hemish.pe.Testing",
"runtime" : "org.gnome.Platform",
"runtime-version" : "44",
"sdk" : "org.gnome.Sdk",
@ -32,7 +32,7 @@
{
"type": "git",
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
"tag": "v0.6.0"
"tag": "v0.8.0"
}
]
},

View File

@ -20,9 +20,10 @@ def main(version, testing):
class Application(Adw.Application):
def __init__(self):
super().__init__(application_id=APP_ID, flags=Gio.ApplicationFlags.FLAGS_NONE)
super().__init__(application_id=APP_ID, flags=Gio.ApplicationFlags.HANDLES_OPEN)
self.create_action("about", self.about)
self.upi_service = Service(create_ussd_iface(list_modems(SystemMessageBus())[0]), True)
self.connect('open', self.handle_upi_links)
def about(self, *args):
about_window = Gtk.Builder().new_from_resource('/net/hemish/pe/ui/about.ui').get_object("about_window")
@ -41,6 +42,16 @@ def main(version, testing):
self.add_action(action)
if shortcuts:
self.set_accels_for_action(f"app.{name}", shortcuts)
def handle_upi_links(self, application, links, n, hint):
# we dont require n (number) field because at a time we would only process one link
# hint is mostly unused unless your app has a specific usecase
# Activate the window of app
self.do_activate()
print(links[0].get_uri())
app = Application()
return app.run(sys.argv)

View File

@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;
template ApplicationWindow : Adw.ApplicationWindow {
template $ApplicationWindow : Adw.ApplicationWindow {
title: "Pe";
@ -21,14 +21,15 @@ template ApplicationWindow : Adw.ApplicationWindow {
Gtk.Button {
icon-name: "go-previous-symbolic";
action-name: "go_back_to_main_view";
action-name: "win.go_back_to_main_view";
}
[end]
.MenuButton {}
$MenuButton {}
}
Adw.StatusPage success_view_status {
valign: center;
icon-name: "emblem-default-symbolic";
title: "Success";
}
@ -36,7 +37,7 @@ template ApplicationWindow : Adw.ApplicationWindow {
}
Gtk.StackPage processing_view {
name: "processing";
name: "processing_view";
child: Gtk.WindowHandle{
Adw.StatusPage {
title: "Processing";
@ -76,7 +77,7 @@ template ApplicationWindow : Adw.ApplicationWindow {
}
[end]
.MenuButton {}
$MenuButton {}
}

View File

@ -14,7 +14,7 @@ Gtk.Box main_view_box{
};
[end]
.MenuButton {}
$MenuButton {}
}

View File

@ -4,7 +4,7 @@ menu menu {
item ("About Pe", "app.about")
}
template MenuButton : Gtk.MenuButton {
template $MenuButton : Gtk.MenuButton {
menu-model: menu;
icon-name: "open-menu-symbolic";
}

View File

@ -23,6 +23,8 @@ class Service:
def send_money_to_number(self, number, amount, pin, remark='1'):
self.clear_requests()
sleep(6)
return {"name": "name", "refid": "refid"}
@ -30,18 +32,24 @@ class Service:
self.clear_requests()
print('send request received')
sleep(6)
return {"name": "name", "refid": "refid"}
def receive_from_upi_id(self, id, amount, remark='1'):
self.clear_requests()
sleep(6)
return {"name": "name"}
def receive_from_phone_number(self, number, amount, remark='1'):
self.clear_requests()
sleep(6)
return {"name": "name"}
def check_balance(self, pin):

View File

@ -198,10 +198,10 @@ class ApplicationWindow(Adw.ApplicationWindow):
print(self.transaction_view_input_group.active_identifier.get_name())
if self.transaction_view_input_group.active_identifier.get_name() == 'id':
print('active identifier is id')
print(service.send_money_to_upi_id(identifier_raw, amount, pin, remark))
output = service.send_money_to_upi_id(identifier_raw, amount, pin, remark)
elif self.transaction_view_input_group.active_identifier.get_name() == 'number':
print(service.send_money_to_number(identifier_raw, amount, pin, remark))
output = service.send_money_to_number(identifier_raw, amount, pin, remark)
elif button.get_name() == 'receive':
if self.transaction_view_input_group.active_identifier.get_name() == 'id':
@ -209,8 +209,10 @@ class ApplicationWindow(Adw.ApplicationWindow):
elif self.transaction_view_input_group.active_identifier.get_name() == 'number':
print(service.receive_from_phone_number(identifier_raw, amount, remark))
self.root_stack.set_visible_child_name('success_view')
print(output)
self.root_stack.set_visible_child_name('processing_view')
if self.transaction_view_send_receive.get_name() == 'send':
PinEntry(self, ok_callback=submit)

View File

@ -1,7 +1,7 @@
[wrap-git]
directory = blueprint-compiler
url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
revision = v0.6.0
revision = v0.8.0
depth = 1
[provide]