Skip to content

Commit 1242eac

Browse files
freQniKMathNodes
authored andcommitted
Fix MainWindow layout to prevent floating widgets and improve resize UX
1 parent 3d38327 commit 1242eac

1 file changed

Lines changed: 133 additions & 59 deletions

File tree

src/kv/meile.kv

Lines changed: 133 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,33 @@ WindowManager:
4444
MDBoxLayout:
4545
orientation: 'vertical'
4646
md_bg_color: get_color_from_hex("#121212")
47-
MDFloatLayout:
48-
size_hint_y: .1
49-
47+
48+
# ── Top Bar ──
49+
MDBoxLayout:
50+
orientation: 'horizontal'
51+
size_hint_y: None
52+
height: dp(56)
53+
padding: [dp(8), 0, dp(8), 0]
54+
55+
# Left: logo icon
5056
Image:
5157
source: root.get_logo()
5258
size_hint: None, None
53-
height: sp(50)
54-
pos_hint: {'x' : .0001, 'center_y' : .5}
59+
size: dp(50), dp(50)
60+
pos_hint: {'center_y': .5}
61+
62+
# Left: logo text
5563
Image:
5664
source: root.get_logo_text()
65+
size_hint_x: None
66+
width: dp(150)
5767
size_hint_y: .6
58-
size_hint_x: .6
59-
pos_hint: {'x' : -.15, 'center_y' : .5}
68+
pos_hint: {'center_y': .5}
69+
70+
# Spacer pushes right-side icons to the end
71+
Widget:
72+
size_hint_x: 1
73+
6074
ToolTipMDIconButton:
6175
id: doh
6276
opacity: 0
@@ -65,98 +79,113 @@ WindowManager:
6579
theme_text_color: "Custom"
6680
text_color: get_color_from_hex(MeileColors.INDICATOR)
6781
on_release: root.menu_open()
68-
pos_hint: {'x' : .90, 'center_y' : .5}
82+
pos_hint: {'center_y': .5}
83+
6984
ToolTipMDIconButton:
7085
id: settings_menu
7186
tooltip_text: "Menu"
7287
icon: "menu"
7388
theme_text_color: "Custom"
7489
text_color: get_color_from_hex(MeileColors.MEILE)
7590
on_release: root.menu_open()
76-
pos_hint: {'x' : .95, 'center_y' : .5}
77-
91+
pos_hint: {'center_y': .5}
92+
93+
# ── Main Content ──
7894
MDBoxLayout:
7995
id: country_map
8096
orientation: "horizontal"
97+
98+
# Left sidebar
8199
MDBoxLayout:
82100
orientation: "vertical"
83-
size_hint: (.25, 1)
84-
MDFloatLayout:
85-
size_hint: None,.175
101+
size_hint_x: .25
102+
103+
# ── Connect button + Search area ──
104+
MDBoxLayout:
105+
orientation: 'vertical'
106+
size_hint_y: None
107+
height: dp(110)
108+
padding: [dp(8), dp(16), dp(8), dp(4)]
109+
spacing: dp(4)
110+
111+
# Connect button — own row, centered, large
86112
TooltipMDFlatButton:
87-
#tooltip_text: "Connect to Node"
88-
#md_bg_color: get_color_from_hex("#121212")
89-
pos_hint: {'x' : .4, 'y': .6}
113+
size_hint: None, None
114+
size: dp(70), dp(40)
115+
pos_hint: {'center_x': .2}
90116
on_release: root.connect_routine()
91-
opacity: 1
92117
Image:
93118
id: connect_button
94-
size_hint: 3,3
119+
size_hint: 2.2, 2.2
120+
pos: self.parent.pos
121+
size: self.parent.size
95122
source: root.return_connect_button("c")
96-
97-
98-
MDTextField:
99-
opacity: 1
100-
id: search_box
101-
hint_text: "key: , value:"
102-
icon_right: "magnify"
103-
pos_hint: {'x' : .1, 'y': 0}
104-
size_hint_x: 1.9
105-
size_hint_y: .6
106-
font_size: sp(12)
107-
on_text_validate: root.on_enter_search()
108-
109-
ToolTipMDIconButton:
110-
tooltip_text: "Clear"
111-
pos_hint: {'x' : 2.1, 'y': .145}
112-
on_release: root.restore_results()
113-
icon: "restore"
114-
theme_text_color: "Custom"
115-
text_color: get_color_from_hex(MeileColors.MEILE)
123+
124+
# Search row: text field + clear button
125+
MDBoxLayout:
126+
orientation: 'horizontal'
127+
size_hint_y: None
128+
height: dp(48)
129+
spacing: dp(4)
130+
131+
MDTextField:
132+
id: search_box
133+
hint_text: "key: , value:"
134+
icon_right: "magnify"
135+
size_hint_x: 1
136+
font_size: sp(12)
137+
on_text_validate: root.on_enter_search()
138+
139+
ToolTipMDIconButton:
140+
tooltip_text: "Clear"
141+
on_release: root.restore_results()
142+
icon: "restore"
143+
size_hint_x: None
144+
width: dp(48)
145+
theme_text_color: "Custom"
146+
text_color: get_color_from_hex(MeileColors.MEILE)
147+
148+
# ── Node list ──
116149
NodeRV:
117-
md_bg_color: get_color_from_hex("#121212")
150+
md_bg_color: get_color_from_hex("#121212")
118151
id: rv
119-
size_hint: (1,1)
120-
MDBoxLayout:
121-
size_hint: (1,None)
122-
height: 50
123-
spacing: 6
124-
152+
size_hint_y: 1 # fills remaining vertical space
153+
154+
# ── Bottom toolbar ──
155+
MDBoxLayout:
156+
orientation: 'horizontal'
157+
size_hint_y: None
158+
height: dp(48)
159+
spacing: dp(6)
160+
125161
ToolTipMDIconButton:
126162
tooltip_text: "Wallet"
127163
icon: "wallet-outline"
128164
theme_text_color: "Custom"
129165
text_color: get_color_from_hex(MeileColors.MEILE)
130166
on_release: root.build_wallet_interface()
131-
132-
#ToolTipMDIconButton:
133-
# tooltip_text: "Subscriptions"
134-
# icon: "book-open-outline"
135-
# theme_text_color: "Custom"
136-
# text_color: get_color_from_hex(MeileColors.MEILE)
137-
# on_release: root.switch_to_sub_window()
138-
167+
139168
ToolTipMDIconButton:
140169
tooltip_text: "Plans"
141170
icon: "ballot-outline"
142171
theme_text_color: "Custom"
143172
text_color: get_color_from_hex(MeileColors.MEILE)
144173
on_release: root.switch_to_plan_window()
145-
146-
ToolTipMDIconButton:
174+
175+
ToolTipMDIconButton:
147176
tooltip_text: "Connection Sharing"
148177
icon: "qrcode"
149178
theme_text_color: "Custom"
150179
text_color: get_color_from_hex(MeileColors.MEILE)
151180
on_release: root.qrcode_connection_sharing()
152-
181+
153182
ToolTipMDIconButton:
154183
tooltip_text: "Settings"
155184
icon: "cog-outline"
156185
theme_text_color: "Custom"
157186
text_color: get_color_from_hex(MeileColors.MEILE)
158187
on_release: root.build_settings_screen_interface()
159-
188+
160189
ToolTipMDIconButton:
161190
tooltip_text: "Help"
162191
icon: "help-circle-outline"
@@ -2961,7 +2990,52 @@ WindowManager:
29612990
mode: "rectangle"
29622991
MDLabel:
29632992
id: warning_comment
2964-
text: 'Scan the QR code or import the URI string into the V2RayNG mobile app. You must do this before you disconnect in Meile. https://dvpn.my/v2ray'
2993+
text: ""
29652994
theme_text_color: "Custom"
29662995
text_color: get_color_from_hex(MeileColors.MEILE)
2967-
font_size: "13sp"
2996+
font_size: "13sp"
2997+
2998+
<ShareTypeDialog>
2999+
orientation: "vertical"
3000+
spacing: "1sp"
3001+
size_hint_y: None
3002+
height: "130sp"
3003+
price_text: ""
3004+
naddress: " "
3005+
moniker: " "
3006+
deposit: " "
3007+
MDFloatLayout:
3008+
MDLabel:
3009+
id: sub_type
3010+
text: "Select Protocol"
3011+
theme_text_color: "Custom"
3012+
font_style: "Subtitle2"
3013+
font_size: "20sp"
3014+
text_color: get_color_from_hex(MeileColors.MEILE)
3015+
pos_hint: {"x" : 0, "top" : 1.35}
3016+
MDLabel:
3017+
id: bandwidth_text
3018+
text: "Wireguard"
3019+
theme_text_color: "Custom"
3020+
font_style: "Subtitle2"
3021+
font_size: "14sp"
3022+
text_color: get_color_from_hex("#ffffff")
3023+
pos_hint: {"x" : 0, "top" : 1}
3024+
Check:
3025+
group: 'proto'
3026+
on_active: root.select_share_type(self, self.active, "wg")
3027+
pos_hint: {"x": .5, "y" : .30}
3028+
MDLabel:
3029+
pos_hint: {"x" : 0, "top" : .9}
3030+
MDLabel:
3031+
id: hourly_text
3032+
text: "V2Ray"
3033+
theme_text_color: "Custom"
3034+
font_style: "Subtitle2"
3035+
font_size: "14sp"
3036+
text_color: get_color_from_hex("#ffffff")
3037+
pos_hint: {"x" : 0, "top" : .7}
3038+
Check:
3039+
group: 'proto'
3040+
on_active: root.select_share_type(self, self.active, "v2")
3041+
pos_hint: {"x": .5, "y" : .025}

0 commit comments

Comments
 (0)