2323import src .settings as settings
2424import cv2
2525import plugins .TruckSimAPI .main as api
26+ import webview
2627
2728try :
2829 import dxcam
@@ -64,7 +65,7 @@ def page0(self):
6465
6566 helpers .MakeButton (self .root , "Quit" , lambda : quit (), 3 ,0 )
6667 # REMEMBER TO CHANGE BACK TO PAGE1
67- helpers .MakeButton (self .root , "Next" , lambda : self .page1 (), 3 ,1 )
68+ helpers .MakeButton (self .root , "Next" , lambda : self .detectionselection (), 3 ,1 )
6869
6970 helpers .MakeButton (self .root , "Tutorial Video" , lambda : helpers .OpenWebView ("Tutorial" ,"plugins/FirstTimeSetup/tutorialEmbed.html" , width = 1290 , height = 730 ), 3 ,2 )
7071
@@ -80,7 +81,45 @@ def page0(self):
8081 self .root .pack (anchor = "center" )
8182
8283 self .root .update ()
84+
85+
86+ def detectionselection (self ):
87+ def openwiki ():
88+ webview .create_window ("Lane Assist Wiki" , "https://wiki.tumppi066.fi/en/LaneAssist/DetectionTypes" )
89+ webview .start ()
90+ self .root .destroy ()
91+ del self .root
92+ self .root = tk .Canvas (self .master )
93+ helpers .MakeLabel (self .root , "Select which type of lane detection you want to use" , 0 ,0 , font = ("Roboto" , 15 , "bold" ), padx = 30 , pady = 10 , columnspan = 3 ,)
94+ helpers .MakeLabel (self .root , "TLDR: LSTR is the reccomeneded model for most people." , 1 ,0 , font = ("Segoe UI" , 12 ), padx = 30 , pady = 0 , columnspan = 3 )
95+ ttk .Label (self .root , text = "" ).grid (columnspan = 3 , row = 2 , column = 0 , ipadx = 0 , ipady = 0 , pady = 0 )
96+ helpers .MakeLabel (self .root , "If you want to see all the options, it is reccomended to check the Wiki" , 3 ,0 , font = ("Segoe UI" , 10 ), padx = 30 , pady = 2 , columnspan = 3 )
97+ helpers .MakeLabel (self .root , "to see what the best option for you is." , 4 ,0 , font = ("Segoe UI" , 10 ), padx = 30 , pady = 0 , columnspan = 3 )
98+ ttk .Label (self .root , text = "" ).grid (columnspan = 3 , row = 5 , column = 0 , ipadx = 0 , ipady = 0 , pady = 0 )
99+ detectionmethod = tk .StringVar ()
100+ ttk .Radiobutton (master = self .root , variable = detectionmethod , text = "LSTR Lane Detection (Recomended)" , value = "lstr" ).grid (columnspan = 3 , row = 6 , column = 0 , sticky = 'w' , padx = 5 , pady = 5 )
101+ ttk .Radiobutton (master = self .root , variable = detectionmethod , text = "UFLD Lane Detection (Only for use with Nvidia GPU > GTX 1060)" , value = "ufld" ).grid (columnspan = 3 , row = 7 , column = 0 , sticky = 'w' , padx = 5 , pady = 5 )
102+ detectionmethod .set ("lstr" )
103+ ttk .Label (self .root , text = "" ).grid (columnspan = 3 , row = 9 , column = 0 , ipadx = 0 , ipady = 0 , pady = 0 )
104+
105+ def detectionsettings ():
106+ if detectionmethod .get () == "lstr" :
107+ print ("LSTR Selected" )
108+ settings .AddToList ("Plugins" , "Enabled" , ["LSTRDrawLanes" ])
109+ settings .AddToList ("Plugins" , "Enabled" , ["LSTRLaneDetection" ])
110+ elif detectionmethod .get () == "ufld" :
111+ print ("UFLD Selected" )
112+ settings .AddToList ("Plugins" , "Enabled" , ["UFLDrawLanes" ])
113+ settings .AddToList ("Plugins" , "Enabled" , ["UFLDLaneDetection" ])
114+ else :
115+ print ("Please select a detection method" )
116+ return
117+ self .page1 ()
83118
119+ helpers .MakeButton (self .root , "Back" , lambda : self .page0 (), 10 ,0 )
120+ helpers .MakeButton (self .root , "Wiki" , openwiki , 10 ,1 )
121+ helpers .MakeButton (self .root , "Confirm" , detectionsettings , 10 ,2 )
122+ self .root .pack ()
84123
85124 def page1 (self ):
86125 self .root .destroy ()
@@ -94,7 +133,8 @@ def page1(self):
94133 helpers .MakeButton (self .root , "Gamepad" , lambda : self .gamepadPage (), 3 ,0 )
95134 helpers .MakeButton (self .root , "Wheel" , lambda : self .wheelPage (), 3 ,1 )
96135 helpers .MakeButton (self .root , "Keyboard" , lambda : self .keyboardPage (), 3 ,2 )
97-
136+ helpers .MakeButton (self .root , "Back" , lambda : self .detectionselection (), 4 ,1 )
137+
98138 self .root .pack ()
99139
100140
0 commit comments