Skip to content

Commit f14b41a

Browse files
committed
Add Solana & ZCash payment options. Add USD value to Plan Subscription UI. Format btc. Add Coin options in BTCPay. v2.1.0-rc1
1 parent 2a01028 commit f14b41a

File tree

4 files changed

+61
-11
lines changed

4 files changed

+61
-11
lines changed

src/kv/meile.kv

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,6 +1941,15 @@ WindowManager:
19411941
pos_hint: {'center_x': .5, 'center_y': .5}
19421942
text: "dvpn"
19431943
on_release: root.menu.open()
1944+
1945+
MDLabel:
1946+
id: usd_price
1947+
text: "$0.00"
1948+
theme_text_color: "Custom"
1949+
font_style: "Subtitle2"
1950+
font_size: "14sp"
1951+
font_name: root.get_font()
1952+
text_color: get_color_from_hex(MeileColors.MEILE)
19441953

19451954
<ProcessingSubDialog>
19461955
orientation: "vertical"

src/typedef/konstants.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,14 +554,21 @@ class IBCTokens():
554554
'dvpn' : 'sentinel',
555555
'beam' : 'beam',
556556
'firo' : 'zcoin',
557-
'pivx' : 'pivx'}
557+
'pivx' : 'pivx',
558+
'zec' : 'zcash',
559+
'sol' : 'solana',
560+
'btc' : 'bitcoin',
561+
'xmr' : 'monero',
562+
'ltc' : 'litecoin',
563+
'doge' : 'dogecoin'}
558564

559-
NOWCOINS = ["firo", "beam", "pivx"]
565+
NOWCOINS = ["firo", "beam", "pivx", "zec", "sol"]
566+
BTCPAYCOINS = ["xmr", "btc", "ltc", "doge"]
560567
#mu_coins = ["tsent", "udvpn", "uscrt", "uosmo", "uatom", "udec"]
561568
class TextStrings():
562569
dash = "-"
563-
VERSION = "v2.0.7"
564-
BUILD = "17354365963"
570+
VERSION = "v2.1.0"
571+
BUILD = "17370138213"
565572
RootTag = "SENTINEL"
566573
PassedHealthCheck = "Passed Sentinel Health Check"
567574
FailedHealthCheck = "Failed Sentinel Health Check"

src/ui/screens.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,16 +799,16 @@ def build_meile_map(self):
799799
#self.MeileMap.map_source = "osm"
800800
self.MeileMap.map_source = source
801801

802-
layout = FloatLayout(size_hint=(1,1))
802+
layout = FloatLayout(size_hint=(1,1))
803803
bw_label = BandwidthLabel()
804804
self.quota = BandwidthBar()
805805
self.quota_pct = QuotaPct()
806806
self.map_widget_1 = IPAddressTextField()
807807
self.map_widget_2 = ConnectedNode()
808808
self.map_widget_3 = ProtectedLabel()
809-
self.recenter = MapCenterButton()
809+
recenter = MapCenterButton()
810810

811-
self.recenter.on_release = self.recenter_map
811+
recenter.on_release = self.recenter_map
812812

813813
self.MeileMap.bind(lat=self.check_boundaries)
814814
self.MeileMap.bind(lon=self.check_boundaries)
@@ -820,7 +820,7 @@ def build_meile_map(self):
820820
layout.add_widget(bw_label)
821821
layout.add_widget(self.quota)
822822
layout.add_widget(self.quota_pct)
823-
layout.add_widget(self.recenter)
823+
layout.add_widget(recenter)
824824

825825

826826
self.quota.value = 0

src/ui/widgets.py

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,14 @@ def refresh_price(self, mu_coin: str = "dvpn", cache: int = 30):
387387
def set_item(self, text_item):
388388
self.ids.drop_item.set_item(text_item)
389389
self.ids.deposit.text = self.parse_coin_deposit(text_item)
390+
self.get_usd(text_item)
390391
try:
391392
self.menu.dismiss()
392393
except TypeError as e:
393394
print(str(e))
394395

395396
def parse_coin_deposit(self, mu_coin):
397+
396398
# Save a copy, so we can edit the value without update the ui
397399
price_text = self.price_text
398400
# Parse all the coins without u-unit
@@ -410,11 +412,12 @@ def parse_coin_deposit(self, mu_coin):
410412
if mu_coin == "dvpn":
411413
value = float(price_text.rstrip(mu_coin).strip())
412414
else:
413-
value = round(float(price_text.rstrip("dvpn").strip()) * self.price_cache["dvpn"]["price"] / self.price_cache[mu_coin]["price"], 5)
415+
value = round(float(price_text.rstrip("dvpn").strip()) * self.price_cache["dvpn"]["price"] / self.price_cache[mu_coin]["price"], 8)
414416

415417
print(f"mu_coin={mu_coin}, month={month}, value={value}, price_cache={self.price_cache}")
416418

417-
self.ids.deposit.text = str(round(month * value, 5))
419+
# display satoshis for BTC
420+
self.ids.deposit.text = str(format(round(month * value, 8),'8f'))
418421
return self.ids.deposit.text
419422

420423

@@ -437,7 +440,21 @@ def on_checkbox_active(self, pay_with: str, checkbox, value):
437440
]
438441
self.menu.items = menu_items
439442
self.set_item(IBCTokens.NOWCOINS[0])
440-
#self.menu.bind()
443+
444+
elif pay_with == "btcpay":
445+
self.ids.drop_item.text = "xmr"
446+
menu_items = [
447+
{
448+
"viewclass": "IconListItem",
449+
"icon": "circle-multiple",
450+
"text": f"{i}",
451+
"height": dp(56),
452+
"on_release": lambda x=f"{i}": self.set_item(x),
453+
} for i in IBCTokens.BTCPAYCOINS
454+
]
455+
self.menu.items = menu_items
456+
self.set_item(IBCTokens.BTCPAYCOINS[0])
457+
441458
else:
442459
self.ids.drop_item.text = "dvpn"
443460
menu_items = [
@@ -451,6 +468,23 @@ def on_checkbox_active(self, pay_with: str, checkbox, value):
451468
]
452469
self.menu.items = menu_items
453470
self.set_item("dvpn")
471+
472+
473+
def get_usd(self, coin):
474+
deposit_ret = self.return_deposit_text()
475+
match = re.match(r"([0-9]+.[0-9]+)", deposit_ret[0], re.I)
476+
if match:
477+
amt = match.groups()[0]
478+
else:
479+
amt = 0.0
480+
coin = "dvpn"
481+
482+
self.refresh_price(coin, cache=30)
483+
self.ids.usd_price.text = '$' + str(round(float(self.price_cache[coin]["price"]) * float(amt),3))
484+
485+
def get_font(self):
486+
Config = MeileGuiConfig()
487+
return Config.resource_path(MeileColors.FONT_FACE)
454488

455489
class ProcessingSubDialog(BoxLayout):
456490
moniker = StringProperty()

0 commit comments

Comments
 (0)