Skip to content

Commit c25befb

Browse files
committed
Define map background color. Create Resolution helper class. Set dimensions at 3/4 visual space, centered.
1 parent c0d2fef commit c25befb

File tree

6 files changed

+92
-37
lines changed

6 files changed

+92
-37
lines changed

src/helpers/res.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from screeninfo import get_monitors
2+
3+
class Resolution():
4+
DAR = float(16/10)
5+
scalar = 0.75 # visual space scalar of app
6+
hscalar = 0.9 # map height
7+
8+
def get_primary_display(self):
9+
if len(get_monitors()) == 1:
10+
print("ONE MONITOR")
11+
primary_monitor = get_monitors()[0]
12+
else:
13+
for m in get_monitors():
14+
print(str(m))
15+
if m.is_primary:
16+
primary_monitor = m
17+
18+
return primary_monitor
19+
20+
'''
21+
returns a tuple of (width,height,left,top)
22+
'''
23+
def set_dimensions(self):
24+
m = self.get_primary_display()
25+
26+
dim = []
27+
dim.append(m.width)
28+
dim.append(m.height)
29+
30+
w = int(m.width*self.scalar)
31+
h = int(w*(1/self.DAR))
32+
l = int((dim[0] - w)/2)
33+
t = int((dim[1] - h)/2)
34+
35+
return (w,h,l,t)

src/imgs/logo.png

13.2 KB
Loading

src/kv/meile.kv

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ WindowManager:
4545
orientation: 'vertical'
4646
md_bg_color: get_color_from_hex("#121212")
4747
MDFloatLayout:
48-
size_hint_y: .11
48+
size_hint_y: .1
4949

5050
Image:
5151
source: root.get_logo()
@@ -2391,12 +2391,12 @@ WindowManager:
23912391

23922392
MDFloatLayout:
23932393

2394-
CheckBox:
2394+
Check:
23952395
on_active: root.terms_agreement(self.active)
23962396
pos_hint: {"x": .36, "center_y": .54}
2397-
color: get_color_from_hex("f42121")
2398-
size_hint: None, None
2399-
size: dp(30), dp(30)
2397+
color: get_color_from_hex(MeileColors.MEILE)
2398+
#size_hint: None, None
2399+
#size: dp(30), dp(30)
24002400
MDLabel:
24012401
text: "I agree to the terms of the MathNodes purchasing policy."
24022402
font_size: 10

src/main/main.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
from ui.screens import MainWindow, PreLoadWindow, WalletRestore
33
from typedef.win import WindowNames
44
from conf.meile_config import MeileGuiConfig
5-
5+
from helpers.res import Resolution
66

77
from kivy.lang import Builder
88
from kivymd.theming import ThemeManager
99
from kivy.utils import get_color_from_hex
1010
from kivy.config import Config
11-
MeileConfig = MeileGuiConfig()
1211
from kivymd.app import MDApp
13-
from screeninfo import get_monitors
12+
1413

1514

1615

@@ -20,7 +19,9 @@ class MyMainApp(MDApp):
2019
def __init__(self,**kwargs):
2120
super(MyMainApp,self).__init__(**kwargs)
2221
from kivy.core.window import Window
23-
#Window.size = (1280, 800)
22+
23+
if Window.size[0] != dim[0] and Window.size[1] != dim[1]:
24+
Window.size = (dim[0], dim[1])
2425

2526
'''
2627
# Get Primary Monitor Resolution
@@ -60,30 +61,16 @@ def build(self):
6061
#MeileConfig.read_configuration(MeileGuiConfig, MeileGuiConfig.CONFFILE)
6162
return self.manager
6263

64+
MeileConfig = MeileGuiConfig()
6365

64-
# Get Primary Monitor Resolution
65-
# Scaled down and not using tkinter library
66-
if len(get_monitors()) == 1:
67-
print("ONE MONITOR")
68-
primary_monitor = get_monitors()[0]
69-
else:
70-
for m in get_monitors():
71-
print(str(m))
72-
if m.is_primary:
73-
primary_monitor = m
74-
75-
dim = []
76-
dim.append(primary_monitor.width)
77-
dim.append(primary_monitor.height)
78-
l = int((dim[0] - 1280)/2)
79-
t = int((dim[1] - 800)/2)
66+
dim = Resolution().set_dimensions()
8067

8168
Config.set('kivy','window_icon',MeileConfig.resource_path("imgs/icon.png"))
8269
Config.set('input', 'mouse', 'mouse,disable_multitouch')
83-
Config.set('graphics', 'width', '1280')
84-
Config.set('graphics', 'height', '800')
85-
Config.set('graphics', 'left', l)
86-
Config.set('graphics', 'top', t)
70+
Config.set('graphics', 'width', dim[0])
71+
Config.set('graphics', 'height', dim[1])
72+
Config.set('graphics', 'left', dim[2])
73+
Config.set('graphics', 'top', dim[3])
8774
Config.write()
8875

8976
app = MyMainApp()

src/typedef/konstants.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,8 @@ class IBCTokens():
565565
#mu_coins = ["tsent", "udvpn", "uscrt", "uosmo", "uatom", "udec"]
566566
class TextStrings():
567567
dash = "-"
568-
VERSION = "v2.0.9"
569-
BUILD = "1737460019911"
568+
VERSION = "v2.1.1"
569+
BUILD = "1738137472380"
570570
RootTag = "SENTINEL"
571571
PassedHealthCheck = "Passed Sentinel Health Check"
572572
FailedHealthCheck = "Failed Sentinel Health Check"
@@ -579,6 +579,7 @@ class MeileColors():
579579
DIALOG_BG_COLOR2 = "#181818"
580580
INDICATOR = "#00DD21"
581581
INACTIVE_DIALOG_BG_COLOR = "#50507c"
582+
MAP_BG_COLOR = "#232227"
582583
ROW_HOVER = "#39363c"
583584
FONT_FACE = "fonts/mplus-2c-bold.ttf"
584585
FONT_FACE_ARIAL = "fonts/arial-unicode-ms.ttf"
@@ -750,6 +751,37 @@ class NodeKeys():
750751

751752

752753

754+
755+
756+
757+
758+
759+
760+
761+
762+
763+
764+
765+
766+
767+
768+
769+
770+
771+
772+
773+
774+
775+
776+
777+
778+
779+
780+
781+
782+
783+
784+
753785

754786

755787

src/ui/screens.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from adapters.DNSCryptproxy import HandleDNSCryptProxy as dcp
2020
from helpers.helpers import format_byte_size
2121
from helpers.bandwidth import compute_consumed_data, compute_consumed_hours, init_GetConsumedWhileConnected, GetConsumedWhileConnected
22+
from helpers.res import Resolution
2223

2324
from kivy.properties import BooleanProperty, StringProperty, ColorProperty, NumericProperty
2425
from kivy.uix.screenmanager import Screen, SlideTransition
@@ -775,15 +776,15 @@ def build_node_data(self, ncountry):
775776
def build_meile_map(self):
776777

777778
if not self.MeileMapBuilt:
778-
self.MeileMap = MapView(zoom=2)
779+
self.MeileMap = MapView(zoom=2,
780+
background_color=get_color_from_hex(MeileColors.MAP_BG_COLOR))
779781
source = MapSource(url=MeileColors.ARCGIS_MAP,
780782
cache_key="meile-map-canvas-dark-grey-base-2",
781783
tile_size=256,
782784
image_ext="png",
783785
attribution="@ Meile",
784-
size_hint=(.7,1),
785-
min_zoom=2)
786-
#self.MeileMap.map_source = "osm"
786+
min_zoom=1)
787+
787788
self.MeileMap.map_source = source
788789

789790
layout = FloatLayout(size_hint=(1,1))
@@ -819,7 +820,7 @@ def build_meile_map(self):
819820
self.MeileMapBuilt = True
820821

821822
def check_boundaries(self, instance, value):
822-
if self.MeileMap.zoom == 2:
823+
if self.MeileMap.zoom == 1:
823824
self.recenter_map()
824825

825826
def add_country_rv_data(self, NodeCountries, index):
@@ -1275,7 +1276,7 @@ def Refresh(self):
12751276

12761277
def recenter_map(self):
12771278
self.MeileMap.zoom = 2
1278-
self.MeileMap.center_on(0.0, 0.0)
1279+
self.MeileMap.center_on(0, 0)
12791280

12801281
def get_continent_coordinates(self, c):
12811282
loc = self.MeileLand.ContinentLatLong[c]

0 commit comments

Comments
 (0)