29
29
import time
30
30
import json
31
31
import threading
32
- from os import environ , kill , rename , mkdir , uname , getpid
32
+ from os import environ , kill , rename , mkdir , uname , getpid , chdir
33
33
from tkinter import *
34
34
from tkinter import ttk
35
35
from tkinter import simpledialog
42
42
43
43
descriptions = [
44
44
"Classic Miecraft Pi Edition.\n No mods." ,
45
- "Modded Miecraft Pi Edition.\n ModPi + libmcpi-docker without Survival or Touch GUI." ,
46
- "Minecraft Pocket Edition.\n libmcpi-docker ." ,
45
+ "Modded Miecraft Pi Edition.\n ModPi + MCPI-Docker mods without Survival or Touch GUI." ,
46
+ "Minecraft Pocket Edition.\n MCPI-Docker mods ." ,
47
47
"Custom Profile.\n Modify its settings in the Profile tab." ,
48
48
];
49
49
preset_features = [
50
50
str (),
51
- "Fix Bow & Arrow|Fix Attacking|Mob Spawning|Show Clouds|ModPi" ,
52
- "Touch GUI|Survival Mode|Fix Bow & Arrow|Fix Attacking|Mob Spawning|Show Clouds"
51
+ "Fix Bow & Arrow|Fix Attacking|Mob Spawning|Fancy Graphics|Fix Sign Placement|ModPi" ,
52
+ "Touch GUI|Survival Mode|Fix Bow & Arrow|Fix Attacking|Mob Spawning|Fancy Graphics|Disable Autojump By Default|Fix Sign Placement|Show Block Outlines"
53
+ ];
54
+
55
+ features = [
56
+ "Touch GUI" ,
57
+ "Survival Mode" ,
58
+ "Fix Bow & Arrow" ,
59
+ "Fix Attacking" ,
60
+ "Mob Spawning" ,
61
+ "Fancy Graphics" ,
62
+ "Disable Autojump By Default" ,
63
+ "Fix Sign Placement" ,
64
+ "Show Block Outlines" ,
65
+ "ModPi"
53
66
];
54
- features = ["Touch GUI" , "Survival Mode" , "Fix Bow & Arrow" , "Fix Attacking" , "Mob Spawning" , "Show Clouds" , "ModPi" ];
55
67
enabled_features = str ();
56
68
home = environ ["HOME" ];
57
69
api_client = APIClient (None );
61
73
62
74
class Checkbox (ttk .Checkbutton ):
63
75
def __init__ (self , * args , ** kwargs ):
64
- super ().__init__ (* args , ** kwargs )
76
+ super ().__init__ (* args , ** kwargs );
65
77
self .state = BooleanVar (self );
66
78
self .configure (variable = self .state );
67
79
@@ -71,6 +83,15 @@ def checked(self):
71
83
def check (self , val ):
72
84
return self .state .set (val );
73
85
86
+ class HyperLink (Label ):
87
+ def __init__ (self , parent , url , text = None , fg = None , cursor = None , * args , ** kwargs ):
88
+ self .url = url ;
89
+ super ().__init__ (parent , text = (text or url ), fg = (fg or "blue" ), cursor = (cursor or "hand2" ), * args , ** kwargs );
90
+ self .bind ("<Button-1>" , self .web_open );
91
+
92
+ def web_open (self , event ):
93
+ return webbrowser .open (self .url );
94
+
74
95
def basename (path ):
75
96
return path .split ("/" )[- 1 ];
76
97
@@ -99,6 +120,7 @@ def launch():
99
120
environ .update ({
100
121
"LD_PRELOAD" : f"/usr/lib/libmodpi.so:{ bk } "
101
122
});
123
+ chdir ("/opt/minecraft-pi" );
102
124
mcpi_process = subprocess .Popen (["/opt/minecraft-pi/minecraft-pi" ]);
103
125
environ .update ({
104
126
"LD_PRELOAD" : bk
@@ -171,10 +193,10 @@ def update_dlls():
171
193
global dll_files ;
172
194
173
195
dll_files = list ();
174
- dll_files = glob ("/usr/lib/mcpi -docker/mods /lib*.so" );
196
+ dll_files = glob ("/usr/lib/libmcpi -docker/lib*.so" );
175
197
bk = environ .get ("LD_LIBRARY_PATH" ) or str ();
176
198
environ .update ({
177
- "LD_LIBRARY_PATH" : f"/usr/lib/mcpi -docker:/usr/arm-linux-gnueabihf/lib:{ bk } " ,
199
+ "LD_LIBRARY_PATH" : f"/opt/minecraft-pi/minecraft-pi/lib/brcm:/ usr/lib/libmcpi -docker:/usr/arm-linux-gnueabihf/lib:{ bk } " ,
178
200
"LD_PRELOAD" : ":" .join (dll_files )
179
201
});
180
202
return 0 ;
@@ -206,10 +228,6 @@ def enable_central_server():
206
228
proxy_thread .start ();
207
229
return 0 ;
208
230
209
- def web_open (event ):
210
- webbrowser .open (event .widget .cget ("text" ));
211
- return 0 ;
212
-
213
231
def save_world ():
214
232
old_world_name = old_worldname_entry .get ();
215
233
new_world_name = new_worldname_entry .get ();
@@ -275,11 +293,15 @@ def restore_profile():
275
293
def add_checkboxes (parent ):
276
294
global profile_settings ;
277
295
296
+ i = 0 ;
278
297
profile_settings = list ();
298
+ checkbox_frame = Frame (parent );
279
299
for feature in features :
280
- tmp = Checkbox (parent , text = feature );
281
- tmp .pack (fill = BOTH , pady = 2 , padx = 160 );
300
+ tmp = Checkbox (checkbox_frame , text = feature );
301
+ tmp .pack (fill = BOTH , anchor = N , padx = 8 );
282
302
profile_settings .append (tmp );
303
+ i += 1 ;
304
+ checkbox_frame .pack (fill = X );
283
305
return 0 ;
284
306
285
307
def init ():
@@ -500,10 +522,7 @@ def profile_tab(parent):
500
522
title .config (font = ("" , 24 ));
501
523
title .pack ();
502
524
503
- checkbox_frame = Frame (tab );
504
- add_checkboxes (checkbox_frame );
505
- checkbox_frame .pack (fill = BOTH , pady = 8 , padx = 16 );
506
-
525
+ add_checkboxes (tab );
507
526
restore_profile ();
508
527
509
528
buttons_frame = Frame (tab );
@@ -519,18 +538,17 @@ def about_tab(parent):
519
538
title .config (font = ("" , 24 ));
520
539
title .pack ();
521
540
522
- version = Label (tab , text = "v0.6.2 " );
541
+ version = Label (tab , text = "v0.7.1 " );
523
542
version .config (font = ("" , 10 ));
524
543
version .pack ();
525
544
526
- author = Label (tab , text = "by @Alvarito050506" );
545
+ author = HyperLink (tab , "https://github.com/Alvarito050506" , text = "by @Alvarito050506" , fg = "black " );
527
546
author .config (font = ("" , 10 ));
528
547
author .pack ();
529
548
530
- url = Label (tab , text = "https://github.com/MCPI-Devs/MCPIL" , fg = "blue" , cursor = "hand2 " );
549
+ url = HyperLink (tab , "https://github.com/MCPI-Devs/MCPIL" );
531
550
url .config (font = ("" , 10 ));
532
551
url .pack ();
533
- author .bind ("<Button-1>" , web_open );
534
552
return tab ;
535
553
536
554
def main (args ):
0 commit comments