diff --git a/src/kv/meile.kv b/src/kv/meile.kv index b26a77b5..f6dc5a83 100755 --- a/src/kv/meile.kv +++ b/src/kv/meile.kv @@ -1941,6 +1941,15 @@ WindowManager: pos_hint: {'center_x': .5, 'center_y': .5} text: "dvpn" on_release: root.menu.open() + + MDLabel: + id: usd_price + text: "$0.00" + theme_text_color: "Custom" + font_style: "Subtitle2" + font_size: "14sp" + font_name: root.get_font() + text_color: get_color_from_hex(MeileColors.MEILE) orientation: "vertical" diff --git a/src/typedef/konstants.py b/src/typedef/konstants.py index dc737d85..f16188fc 100755 --- a/src/typedef/konstants.py +++ b/src/typedef/konstants.py @@ -554,14 +554,21 @@ class IBCTokens(): 'dvpn' : 'sentinel', 'beam' : 'beam', 'firo' : 'zcoin', - 'pivx' : 'pivx'} + 'pivx' : 'pivx', + 'zec' : 'zcash', + 'sol' : 'solana', + 'btc' : 'bitcoin', + 'xmr' : 'monero', + 'ltc' : 'litecoin', + 'doge' : 'dogecoin'} - NOWCOINS = ["firo", "beam", "pivx"] + NOWCOINS = ["firo", "beam", "pivx", "zec", "sol"] + BTCPAYCOINS = ["xmr", "btc", "ltc", "doge"] #mu_coins = ["tsent", "udvpn", "uscrt", "uosmo", "uatom", "udec"] class TextStrings(): dash = "-" - VERSION = "v2.0.7" - BUILD = "17354365963" + VERSION = "v2.1.0" + BUILD = "17370138213" RootTag = "SENTINEL" PassedHealthCheck = "Passed Sentinel Health Check" FailedHealthCheck = "Failed Sentinel Health Check" diff --git a/src/ui/screens.py b/src/ui/screens.py index 3eae9efc..27b399ad 100755 --- a/src/ui/screens.py +++ b/src/ui/screens.py @@ -799,16 +799,16 @@ def build_meile_map(self): #self.MeileMap.map_source = "osm" self.MeileMap.map_source = source - layout = FloatLayout(size_hint=(1,1)) + layout = FloatLayout(size_hint=(1,1)) bw_label = BandwidthLabel() self.quota = BandwidthBar() self.quota_pct = QuotaPct() self.map_widget_1 = IPAddressTextField() self.map_widget_2 = ConnectedNode() self.map_widget_3 = ProtectedLabel() - self.recenter = MapCenterButton() + recenter = MapCenterButton() - self.recenter.on_release = self.recenter_map + recenter.on_release = self.recenter_map self.MeileMap.bind(lat=self.check_boundaries) self.MeileMap.bind(lon=self.check_boundaries) @@ -820,7 +820,7 @@ def build_meile_map(self): layout.add_widget(bw_label) layout.add_widget(self.quota) layout.add_widget(self.quota_pct) - layout.add_widget(self.recenter) + layout.add_widget(recenter) self.quota.value = 0 diff --git a/src/ui/widgets.py b/src/ui/widgets.py index 5d4ca7d8..43fa7650 100755 --- a/src/ui/widgets.py +++ b/src/ui/widgets.py @@ -387,12 +387,14 @@ def refresh_price(self, mu_coin: str = "dvpn", cache: int = 30): def set_item(self, text_item): self.ids.drop_item.set_item(text_item) self.ids.deposit.text = self.parse_coin_deposit(text_item) + self.get_usd(text_item) try: self.menu.dismiss() except TypeError as e: print(str(e)) def parse_coin_deposit(self, mu_coin): + # Save a copy, so we can edit the value without update the ui price_text = self.price_text # Parse all the coins without u-unit @@ -410,11 +412,12 @@ def parse_coin_deposit(self, mu_coin): if mu_coin == "dvpn": value = float(price_text.rstrip(mu_coin).strip()) else: - value = round(float(price_text.rstrip("dvpn").strip()) * self.price_cache["dvpn"]["price"] / self.price_cache[mu_coin]["price"], 5) + value = round(float(price_text.rstrip("dvpn").strip()) * self.price_cache["dvpn"]["price"] / self.price_cache[mu_coin]["price"], 8) print(f"mu_coin={mu_coin}, month={month}, value={value}, price_cache={self.price_cache}") - self.ids.deposit.text = str(round(month * value, 5)) + # display satoshis for BTC + self.ids.deposit.text = str(format(round(month * value, 8),'8f')) return self.ids.deposit.text @@ -437,7 +440,21 @@ def on_checkbox_active(self, pay_with: str, checkbox, value): ] self.menu.items = menu_items self.set_item(IBCTokens.NOWCOINS[0]) - #self.menu.bind() + + elif pay_with == "btcpay": + self.ids.drop_item.text = "xmr" + menu_items = [ + { + "viewclass": "IconListItem", + "icon": "circle-multiple", + "text": f"{i}", + "height": dp(56), + "on_release": lambda x=f"{i}": self.set_item(x), + } for i in IBCTokens.BTCPAYCOINS + ] + self.menu.items = menu_items + self.set_item(IBCTokens.BTCPAYCOINS[0]) + else: self.ids.drop_item.text = "dvpn" menu_items = [ @@ -451,6 +468,23 @@ def on_checkbox_active(self, pay_with: str, checkbox, value): ] self.menu.items = menu_items self.set_item("dvpn") + + + def get_usd(self, coin): + deposit_ret = self.return_deposit_text() + match = re.match(r"([0-9]+.[0-9]+)", deposit_ret[0], re.I) + if match: + amt = match.groups()[0] + else: + amt = 0.0 + coin = "dvpn" + + self.refresh_price(coin, cache=30) + self.ids.usd_price.text = '$' + str(round(float(self.price_cache[coin]["price"]) * float(amt),3)) + + def get_font(self): + Config = MeileGuiConfig() + return Config.resource_path(MeileColors.FONT_FACE) class ProcessingSubDialog(BoxLayout): moniker = StringProperty()