Skip to content

Commit a6f41c2

Browse files
committed
Merge commits: #635402b,#bcf047b,#862a1a7,#eba1dc1,#33ed123,#7a759de into main
1 parent 45c83cd commit a6f41c2

10 files changed

Lines changed: 100 additions & 73 deletions

File tree

src/coin_api/get_price.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
from adapters import HTTPRequests
22
from typedef.konstants import IBCTokens
33
import coin_api.scrtxxs as scrtxxs
4-
import asyncio
54
import random
65

76
class GetPriceAPI():
87
#DEC_AscenDEX = "https://ascendex.com/api/pro/v1/spot/ticker?symbol=DEC/USDT"
98
CoinStats = "https://openapiv1.coinstats.app/coins/%s"
109

11-
12-
async def get_usd(self, coin):
10+
11+
def get_usd(self, coin):
1312
N = random.randint(0,len(scrtxxs.COINSTATS_API_KEYS)-1)
1413
API_KEY = scrtxxs.COINSTATS_API_KEYS[N]
1514
headers = {
@@ -18,9 +17,9 @@ async def get_usd(self, coin):
1817
}
1918
Request = HTTPRequests.MakeRequest(headers=headers)
2019
http = Request.hadapter()
21-
20+
2221
for key,value in IBCTokens.CSAPPMAP.items():
23-
if coin.lower() == key:
22+
if coin.lower() == key:
2423
try:
2524
r = http.get(self.CoinStats % value)
2625
print(r.json())

src/fonts/DejaVuMathTeXGyre.ttf

-564 KB
Binary file not shown.

src/fonts/arial-unicode-ms.ttf

-22.2 MB
Binary file not shown.

src/geography/continents.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ class OurWorld():
168168
'Lithuania': [55.3500003, 23.7499997],
169169
'Luxembourg': [49.8158683, 6.1296751],
170170
'Macedonia': [41.6171214, 21.7168387],
171+
'North Macedonia': [41.6171214, 21.7168387],
171172
'Malta': [35.8885993, 14.4476911],
172173
'Moldova': [47.2879608, 28.5670941],
173174
'Monaco': [43.7323492, 7.4276832],

src/imgs/72x54.zip

-534 KB
Binary file not shown.

src/kv/meile.kv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ WindowManager:
177177
NodeRV:
178178
md_bg_color: get_color_from_hex("#121212")
179179
id: rv
180-
size_hint: (.3,1)
180+
size_hint: (.2,1)
181181

182182
MDBottomNavigation:
183183
size_hint_y: 0.125
@@ -232,7 +232,7 @@ WindowManager:
232232
ActionView:
233233
ActionPrevious:
234234
icon: "arrow-left-circle"
235-
title: 'Go Back'
235+
title: 'Map'
236236
with_previous: True
237237
on_release: root.set_previous_screen()
238238
<SubscriptionScreen>
@@ -248,7 +248,7 @@ WindowManager:
248248
ActionView:
249249
ActionPrevious:
250250
icon: "arrow-left-circle"
251-
title: 'Go Back'
251+
title: 'Map'
252252
with_previous: True
253253
on_release: root.set_previous_screen()
254254

@@ -542,7 +542,7 @@ WindowManager:
542542
num_text: ""
543543
country_text: " "
544544
source_image: " "
545-
on_press: root.show_country_nodes(root.country_text)
545+
on_press: root.switch_window(root.country_text)
546546
md_bg_color: get_color_from_hex("#121212")
547547
MDBoxLayout:
548548
DisplayPic:

src/main/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MyMainApp(MDApp):
2323
def __init__(self,**kwargs):
2424
super(MyMainApp,self).__init__(**kwargs)
2525
from kivy.core.window import Window
26-
Window.size = (1010, 710)
26+
Window.size = (1280, 800)
2727

2828
# Get Primary Monitor Resolution
2929
# Scaled down and not using tkinter library
@@ -40,8 +40,8 @@ def __init__(self,**kwargs):
4040
dim.append(primary_monitor.width)
4141
dim.append(primary_monitor.height)
4242

43-
Window.left = int((dim[0] - 1010)/2)
44-
Window.top = int((dim[1] - 710)/2)
43+
Window.left = int((dim[0] - 1280)/2)
44+
Window.top = int((dim[1] - 800)/2)
4545

4646

4747

src/typedef/konstants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class TextStrings():
7272
class MeileColors():
7373
DIALOG_BG_COLOR = "#121212"
7474
INACTIVE_DIALOG_BG_COLOR = "#50507c"
75+
ROW_HOVER = "#39363c"
7576
FONT_FACE = "../fonts/mplus-2c-bold.ttf"
7677
MAP_MARKER = "../imgs/location_pin.png"
7778
HEALTH_ICON = "shield-plus"

src/ui/screens.py

Lines changed: 81 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
3333
from kivy_garden.mapview import MapMarkerPopup, MapView, MapSource
3434
from kivymd.toast import toast
35+
from kivy.uix.carousel import Carousel
36+
from kivymd.uix.boxlayout import MDBoxLayout
3537

3638

3739
import requests
@@ -337,6 +339,8 @@ class MainWindow(Screen):
337339
clock = None
338340
PersistentBandwidth = {}
339341
ConnectedDict = {'v2ray_pid' : None, 'result' : False}
342+
NodeWidget = None
343+
Markers = []
340344

341345

342346
def __init__(self, node_tree, **kwargs):
@@ -372,31 +376,33 @@ def build(self, dt):
372376

373377
for name_tab in OurWorld.CONTINENTS:
374378
tab = Tab(tab_label_text=name_tab)
375-
self.manager.get_screen(WindowNames.MAIN_WINDOW).ids.android_tabs.add_widget(tab)
379+
self.ids.android_tabs.add_widget(tab)
376380

377381
self.get_ip_address(None)
378382

379383
self.on_tab_switch(
380384
None,
381385
None,
382386
None,
383-
self.manager.get_screen(WindowNames.MAIN_WINDOW).ids.android_tabs.ids.layout.children[-1].text
387+
self.ids.android_tabs.ids.layout.children[-1].text
384388
)
385389

386390

387391
def build_meile_map(self):
388-
if not self.MeileMapBuilt:
392+
393+
if not self.MeileMapBuilt:
389394
self.MeileMap = MapView(lat=50.6394, lon=3.057, zoom=2)
390395
source = MapSource(url="https://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}.png",
391-
cache_key="meile-map-canvas-dark-grey-base",
396+
cache_key="meile-map-canvas-dark-grey-base",
392397
tile_size=512,
393398
image_ext="png",
394399
attribution="@ Meile",
395400
size_hint=(.7,1))
396401
#self.MeileMap.map_source = "osm"
397402
self.MeileMap.map_source = source
398-
399-
self.ids.country_map.add_widget(self.MeileMap)
403+
self.carousel = Carousel(direction='right')
404+
self.ids.country_map.add_widget(self.carousel)
405+
self.carousel.add_widget(self.MeileMap)
400406
self.AddCountryNodePins(False)
401407
self.MeileMapBuilt = True
402408

@@ -407,23 +413,32 @@ def get_font(self):
407413
def AddCountryNodePins(self, clear):
408414
Config = MeileGuiConfig()
409415
try:
416+
417+
if clear:
418+
for m in self.Makers:
419+
self.MeileMap.remove_marker(m)
420+
self.Markers.clear()
421+
410422
for continent in self.MeileLand.CONTINENTS:
411423
for ncountry in self.NodeTree.NodeTree.children(continent):
412-
loc = self.MeileLand.CountryLatLong[ncountry.tag]
413-
marker = MapMarkerPopup(lat=loc[0], lon=loc[1], source=Config.resource_path(MeileColors.MAP_MARKER))
414-
marker.add_widget(MDMapCountryButton(text='%s - %s' %(ncountry.tag, len(self.NodeTree.NodeTree.children(ncountry.tag))),
415-
theme_text_color="Custom",
416-
md_bg_color=get_color_from_hex(MeileColors.DIALOG_BG_COLOR),
417-
text_color=(1,1,1,1),
418-
on_release=partial(self.load_country_nodes, ncountry.tag)
419-
))
420-
if not clear:
424+
try:
425+
loc = self.MeileLand.CountryLatLong[ncountry.tag]
426+
marker = MapMarkerPopup(lat=loc[0], lon=loc[1], source=Config.resource_path(MeileColors.MAP_MARKER))
427+
marker.add_widget(MDMapCountryButton(text='%s - %s' %(ncountry.tag, len(self.NodeTree.NodeTree.children(ncountry.tag))),
428+
theme_text_color="Custom",
429+
md_bg_color=get_color_from_hex(MeileColors.DIALOG_BG_COLOR),
430+
text_color=(1,1,1,1),
431+
on_release=partial(self.load_country_nodes, ncountry.tag)
432+
))
433+
434+
self.Markers.append(marker)
421435
self.MeileMap.add_marker(marker)
422-
else:
423-
self.MeileMap.remove_marker(marker)
436+
except:
437+
continue
424438
except Exception as e:
425439
print(str(e))
426440
pass
441+
427442
self.get_continent_coordinates(self.MeileLand.CONTINENTS[0])
428443

429444
def set_item(self, text_item):
@@ -745,8 +760,9 @@ def refresh_nodes_and_subs(self):
745760
def Refresh(self, latency, *kwargs):
746761
self.remove_loading_widget(None)
747762
self.AddCountryNodePins(True)
763+
yield 0.314
748764
self.add_loading_popup("Reloading Nodes...")
749-
yield 0.5
765+
yield 0.314
750766
try:
751767
self.NodeTree.NodeTree = None
752768
thread = ThreadWithResult(target=self.NodeTree.get_nodes, args=(latency.return_latency(),))
@@ -764,7 +780,7 @@ def Refresh(self, latency, *kwargs):
764780

765781
@mainthread
766782
def on_tab_switch(self, instance_tabs, instance_tab, instance_tabs_label, tab_text):
767-
self.manager.get_screen(WindowNames.MAIN_WINDOW).ids.rv.data = []
783+
self.ids.rv.data = []
768784
if not tab_text:
769785
tab_text = OurWorld.CONTINENTS[0]
770786

@@ -848,24 +864,29 @@ def switch_window(self, window):
848864
Meile.app.root.current = window
849865

850866
def switch_to_sub_window(self):
851-
Meile.app.root.add_widget(SubscriptionScreen(name=WindowNames.SUBSCRIPTIONS, node_tree=self.NodeTree))
852-
Meile.app.root.transition = SlideTransition(direction = "left")
853-
Meile.app.root.current = WindowNames.SUBSCRIPTIONS
867+
try:
868+
self.carousel.remove_widget(self.NodeWidget)
869+
except Exception as e:
870+
print(str(e))
871+
self.NodeWidget = SubscriptionScreen(name=WindowNames.SUBSCRIPTIONS, node_tree=self.NodeTree)
872+
self.carousel.add_widget(self.NodeWidget)
873+
self.carousel.load_slide(self.NodeWidget)
854874

855875
def load_country_nodes(self, country, *kwargs):
876+
mw = Meile.app.root.get_screen(WindowNames.MAIN_WINDOW)
856877
NodeTree = NodeTreeData(Meile.app.root.get_screen(WindowNames.MAIN_WINDOW).NodeTree.NodeTree)
857878
try:
858-
Meile.app.root.remove_widget(Meile.app.root.get_screen(WindowNames.NODES))
879+
mw.carousel.remove_widget(self.NodeWidget)
859880
except Exception as e:
860881
print(str(e))
861882
pass
862-
Meile.app.root.add_widget(NodeScreen(name="nodes",
863-
node_tree=NodeTree,
864-
country=country,
865-
sort=Meile.app.root.get_screen(WindowNames.MAIN_WINDOW).Sort))
866-
867-
Meile.app.root.transition = SlideTransition(direction = "up")
868-
Meile.app.root.current = WindowNames.NODES
883+
884+
self.NodeWidget = NodeScreen(name="nodes",
885+
node_tree=NodeTree,
886+
country=country,
887+
sort=self.Sort)
888+
self.carousel.add_widget(self.NodeWidget)
889+
self.carousel.load_slide(self.NodeWidget)
869890

870891

871892
class WalletScreen(Screen):
@@ -1038,7 +1059,7 @@ def set_previous_screen(self):
10381059
Meile.app.root.current = WindowNames.MAIN_WINDOW
10391060

10401061

1041-
class SubscriptionScreen(Screen):
1062+
class SubscriptionScreen(MDBoxLayout):
10421063
SubResult = None
10431064

10441065
def __init__(self, node_tree, **kwargs):
@@ -1057,7 +1078,7 @@ def __init__(self, node_tree, **kwargs):
10571078
return
10581079

10591080
def GetSubscriptions(self):
1060-
mw = self.manager.get_screen(WindowNames.MAIN_WINDOW)
1081+
mw = Meile.app.root.get_screen(WindowNames.MAIN_WINDOW)
10611082
try:
10621083
thread = ThreadWithResult(target=self.NodeTree.get_subscriptions, args=(self.address,))
10631084
thread.start()
@@ -1071,7 +1092,7 @@ def GetSubscriptions(self):
10711092
def subs_callback(self, dt):
10721093
floc = "../imgs/"
10731094
yield 0.314
1074-
mw = self.manager.get_screen(WindowNames.MAIN_WINDOW)
1095+
mw = Meile.app.root.get_screen(WindowNames.MAIN_WINDOW)
10751096

10761097
if not mw.SubResult:
10771098
self.GetSubscriptions()
@@ -1201,12 +1222,15 @@ def sub_address_error(self):
12011222
self.dialog.open()
12021223

12031224
def set_previous_screen(self):
1204-
Meile.app.root.remove_widget(self)
1205-
Meile.app.root.transistion = SlideTransition(direction="right")
1206-
Meile.app.root.current = WindowNames.MAIN_WINDOW
1207-
1208-
1209-
class NodeScreen(Screen):
1225+
mw = Meile.app.root.get_screen(WindowNames.MAIN_WINDOW)
1226+
mw.carousel.remove_widget(mw.NodeWidget)
1227+
mw.carousel.load_previous()
1228+
1229+
'''
1230+
Main widget of country cards in carousel.
1231+
Contains: widgets.RecyclerViewRow, RecyclerViewCountryRow
1232+
'''
1233+
class NodeScreen(MDBoxLayout):
12101234
NodeTree = None
12111235
Country = None
12121236
MeileConfig = None
@@ -1428,42 +1452,41 @@ def add_rv_data(self, node, flagloc):
14281452
)
14291453

14301454
def set_previous_screen(self):
1455+
mw = Meile.app.root.get_screen(WindowNames.MAIN_WINDOW)
1456+
mw.carousel.remove_widget(mw.NodeWidget)
1457+
mw.carousel.load_previous()
14311458

1432-
Meile.app.root.remove_widget(self)
1433-
Meile.app.root.transistion = SlideTransition(direction="down")
1434-
Meile.app.root.current = WindowNames.MAIN_WINDOW
1435-
1436-
1459+
'''
1460+
This is the card class of the country cards on the left panel
1461+
'''
14371462
class RecycleViewCountryRow(MDCard,RectangularElevationBehavior,ThemableBehavior, HoverBehavior):
14381463
text = StringProperty()
14391464

14401465
def on_enter(self, *args):
1441-
self.md_bg_color = get_color_from_hex("#200c3a")
1466+
self.md_bg_color = get_color_from_hex(MeileColors.ROW_HOVER)
14421467
Window.set_system_cursor('hand')
14431468

14441469
def on_leave(self, *args):
14451470
self.md_bg_color = get_color_from_hex(MeileColors.DIALOG_BG_COLOR)
14461471
Window.set_system_cursor('arrow')
14471472

1448-
def show_country_nodes(self, country):
1449-
print(country)
1450-
self.switch_window(country)
1451-
14521473
def switch_window(self, country):
1474+
print(country)
14531475
NodeTree = NodeTreeData(Meile.app.root.get_screen(WindowNames.MAIN_WINDOW).NodeTree.NodeTree)
1476+
mw = Meile.app.root.get_screen(WindowNames.MAIN_WINDOW)
1477+
14541478
try:
1455-
Meile.app.root.remove_widget(Meile.app.root.get_screen(WindowNames.NODES))
1479+
mw.carousel.remove_widget(mw.NodeWidget)
14561480
except Exception as e:
14571481
print(str(e))
14581482
pass
1459-
Meile.app.root.add_widget(NodeScreen(name="nodes",
1460-
node_tree=NodeTree,
1461-
country=country,
1462-
sort=Meile.app.root.get_screen(WindowNames.MAIN_WINDOW).Sort))
1463-
1464-
Meile.app.root.transition = SlideTransition(direction = "up")
1465-
Meile.app.root.current = WindowNames.NODES
1466-
1483+
1484+
mw.NodeWidget = NodeScreen(name="nodes",
1485+
node_tree=NodeTree,
1486+
country=country,
1487+
sort=mw.Sort)
1488+
mw.carousel.add_widget(mw.NodeWidget)
1489+
mw.carousel.load_next()
14671490

14681491
class HelpScreen(Screen):
14691492

0 commit comments

Comments
 (0)