changes
This commit is contained in:
parent
1841046729
commit
e9f87f0528
|
@ -1,13 +1,43 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<component type="desktop">
|
<component type="desktop">
|
||||||
<id>net.hemish.pe.desktop</id>
|
<!--Created with jdAppStreamEdit 6.0-->
|
||||||
<metadata_license>CC0-1.0</metadata_license>
|
<id>net.hemish.pe</id>
|
||||||
<project_license>GPL-3.0-or-later</project_license>
|
<name>Pe</name>
|
||||||
<description>
|
<summary>A USSD based UPI client</summary>
|
||||||
<p> WIP </p>
|
<developer_name>Hemish</developer_name>
|
||||||
</description>
|
<launchable type="desktop-id">net.hemish.pe.desktop</launchable>
|
||||||
<custom>
|
<metadata_license>CC0-1.0</metadata_license>
|
||||||
<value key="Purism::form_factor">workstation</value>
|
<project_license>GPL-3.0-or-later</project_license>
|
||||||
<value key="Purism::form_factor">mobile</value>
|
<description>
|
||||||
</custom>
|
<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>
|
</component>
|
||||||
|
|
|
@ -4,8 +4,11 @@ Exec=pe
|
||||||
Icon=net.hemish.pe
|
Icon=net.hemish.pe
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=GTK;
|
Categories=GTK;Finance
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
|
|
||||||
|
# For handling UPI links
|
||||||
|
MimeType=x-scheme-handler/upi
|
||||||
|
|
||||||
# Translators: Do NOT translate or transliterate this text (these are enum types)!
|
# Translators: Do NOT translate or transliterate this text (these are enum types)!
|
||||||
X-Purism-FormFactor=Workstation;Mobile;
|
X-Purism-FormFactor=Workstation;Mobile;
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"id" : "net.hemish.pe",
|
"id" : "net.hemish.pe.Testing",
|
||||||
"runtime" : "org.gnome.Platform",
|
"runtime" : "org.gnome.Platform",
|
||||||
"runtime-version" : "44",
|
"runtime-version" : "44",
|
||||||
"sdk" : "org.gnome.Sdk",
|
"sdk" : "org.gnome.Sdk",
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
{
|
{
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
|
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
|
||||||
"tag": "v0.6.0"
|
"tag": "v0.8.0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
13
src/main.py
13
src/main.py
|
@ -20,9 +20,10 @@ def main(version, testing):
|
||||||
|
|
||||||
class Application(Adw.Application):
|
class Application(Adw.Application):
|
||||||
def __init__(self):
|
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.create_action("about", self.about)
|
||||||
self.upi_service = Service(create_ussd_iface(list_modems(SystemMessageBus())[0]), True)
|
self.upi_service = Service(create_ussd_iface(list_modems(SystemMessageBus())[0]), True)
|
||||||
|
self.connect('open', self.handle_upi_links)
|
||||||
|
|
||||||
def about(self, *args):
|
def about(self, *args):
|
||||||
about_window = Gtk.Builder().new_from_resource('/net/hemish/pe/ui/about.ui').get_object("about_window")
|
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)
|
self.add_action(action)
|
||||||
if shortcuts:
|
if shortcuts:
|
||||||
self.set_accels_for_action(f"app.{name}", 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()
|
app = Application()
|
||||||
return app.run(sys.argv)
|
return app.run(sys.argv)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
using Adw 1;
|
using Adw 1;
|
||||||
|
|
||||||
template ApplicationWindow : Adw.ApplicationWindow {
|
template $ApplicationWindow : Adw.ApplicationWindow {
|
||||||
|
|
||||||
title: "Pe";
|
title: "Pe";
|
||||||
|
|
||||||
|
@ -21,14 +21,15 @@ template ApplicationWindow : Adw.ApplicationWindow {
|
||||||
|
|
||||||
Gtk.Button {
|
Gtk.Button {
|
||||||
icon-name: "go-previous-symbolic";
|
icon-name: "go-previous-symbolic";
|
||||||
action-name: "go_back_to_main_view";
|
action-name: "win.go_back_to_main_view";
|
||||||
}
|
}
|
||||||
|
|
||||||
[end]
|
[end]
|
||||||
.MenuButton {}
|
$MenuButton {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Adw.StatusPage success_view_status {
|
Adw.StatusPage success_view_status {
|
||||||
|
valign: center;
|
||||||
icon-name: "emblem-default-symbolic";
|
icon-name: "emblem-default-symbolic";
|
||||||
title: "Success";
|
title: "Success";
|
||||||
}
|
}
|
||||||
|
@ -36,7 +37,7 @@ template ApplicationWindow : Adw.ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
Gtk.StackPage processing_view {
|
Gtk.StackPage processing_view {
|
||||||
name: "processing";
|
name: "processing_view";
|
||||||
child: Gtk.WindowHandle{
|
child: Gtk.WindowHandle{
|
||||||
Adw.StatusPage {
|
Adw.StatusPage {
|
||||||
title: "Processing";
|
title: "Processing";
|
||||||
|
@ -76,7 +77,7 @@ template ApplicationWindow : Adw.ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
[end]
|
[end]
|
||||||
.MenuButton {}
|
$MenuButton {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Gtk.Box main_view_box{
|
||||||
};
|
};
|
||||||
|
|
||||||
[end]
|
[end]
|
||||||
.MenuButton {}
|
$MenuButton {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ menu menu {
|
||||||
item ("About Pe", "app.about")
|
item ("About Pe", "app.about")
|
||||||
}
|
}
|
||||||
|
|
||||||
template MenuButton : Gtk.MenuButton {
|
template $MenuButton : Gtk.MenuButton {
|
||||||
menu-model: menu;
|
menu-model: menu;
|
||||||
icon-name: "open-menu-symbolic";
|
icon-name: "open-menu-symbolic";
|
||||||
}
|
}
|
|
@ -23,6 +23,8 @@ class Service:
|
||||||
|
|
||||||
def send_money_to_number(self, number, amount, pin, remark='1'):
|
def send_money_to_number(self, number, amount, pin, remark='1'):
|
||||||
self.clear_requests()
|
self.clear_requests()
|
||||||
|
|
||||||
|
sleep(6)
|
||||||
|
|
||||||
return {"name": "name", "refid": "refid"}
|
return {"name": "name", "refid": "refid"}
|
||||||
|
|
||||||
|
@ -30,18 +32,24 @@ class Service:
|
||||||
self.clear_requests()
|
self.clear_requests()
|
||||||
print('send request received')
|
print('send request received')
|
||||||
|
|
||||||
|
sleep(6)
|
||||||
|
|
||||||
|
|
||||||
return {"name": "name", "refid": "refid"}
|
return {"name": "name", "refid": "refid"}
|
||||||
|
|
||||||
def receive_from_upi_id(self, id, amount, remark='1'):
|
def receive_from_upi_id(self, id, amount, remark='1'):
|
||||||
self.clear_requests()
|
self.clear_requests()
|
||||||
|
|
||||||
|
sleep(6)
|
||||||
|
|
||||||
|
|
||||||
return {"name": "name"}
|
return {"name": "name"}
|
||||||
|
|
||||||
def receive_from_phone_number(self, number, amount, remark='1'):
|
def receive_from_phone_number(self, number, amount, remark='1'):
|
||||||
self.clear_requests()
|
self.clear_requests()
|
||||||
|
|
||||||
|
sleep(6)
|
||||||
|
|
||||||
return {"name": "name"}
|
return {"name": "name"}
|
||||||
|
|
||||||
def check_balance(self, pin):
|
def check_balance(self, pin):
|
||||||
|
|
|
@ -198,10 +198,10 @@ class ApplicationWindow(Adw.ApplicationWindow):
|
||||||
print(self.transaction_view_input_group.active_identifier.get_name())
|
print(self.transaction_view_input_group.active_identifier.get_name())
|
||||||
if self.transaction_view_input_group.active_identifier.get_name() == 'id':
|
if self.transaction_view_input_group.active_identifier.get_name() == 'id':
|
||||||
print('active identifier is 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':
|
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':
|
elif button.get_name() == 'receive':
|
||||||
if self.transaction_view_input_group.active_identifier.get_name() == 'id':
|
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':
|
elif self.transaction_view_input_group.active_identifier.get_name() == 'number':
|
||||||
print(service.receive_from_phone_number(identifier_raw, amount, remark))
|
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':
|
if self.transaction_view_send_receive.get_name() == 'send':
|
||||||
PinEntry(self, ok_callback=submit)
|
PinEntry(self, ok_callback=submit)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[wrap-git]
|
[wrap-git]
|
||||||
directory = blueprint-compiler
|
directory = blueprint-compiler
|
||||||
url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
|
url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
|
||||||
revision = v0.6.0
|
revision = v0.8.0
|
||||||
depth = 1
|
depth = 1
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
|
|
Loading…
Reference in New Issue