@@ -27,7 +27,7 @@ def show_tip(self, text, index):
2727
2828 # Calculate the bbox for the specified index
2929 bbox = self .widget .bbox (index )
30- if not bbox : # Check if bbox is None
30+ if not bbox :
3131 return
3232 x , y , width , height = bbox
3333 x = x + self .widget .winfo_rootx () + 25
@@ -88,7 +88,7 @@ def initialize_ui(self):
8888 self .maps_listbox .bind ("<Leave>" , self .on_leave )
8989 self .maps_listbox .bind ("<<ListboxSelect>>" , self .on_select )
9090 script_dir = os .path .dirname (os .path .realpath (__file__ )) # Directory of the current script
91- icon_path = os .path .join (script_dir , 'MonuteaProjectLauncher.ico' ) # 'your_icon.ico' should be in the same directory as your script
91+ icon_path = os .path .join (script_dir , 'MonuteaProjectLauncher.ico' )
9292 if os .path .exists (icon_path ):
9393 self .root .iconbitmap (icon_path )
9494 self .detect_unreal_versions ()
@@ -153,78 +153,64 @@ def on_select(self, event=None):
153153
154154
155155 def setup_main_page (self ):
156- # Main paned window
156+
157157 main_paned_window = tk .PanedWindow (self .root , orient = tk .VERTICAL , sashrelief = tk .RAISED )
158158 main_paned_window .pack (fill = tk .BOTH , expand = True , pady = 10 , padx = 10 )
159159
160- # Upper paned window to contain maps and right-side elements
161160 self .upper_paned_window = tk .PanedWindow (main_paned_window , orient = tk .HORIZONTAL , sashrelief = tk .RAISED )
162161 self .upper_paned_window .pack (padx = 10 , pady = 10 )
163162 main_paned_window .add (self .upper_paned_window , stretch = 'always' )
164-
165- # Frame for maps listbox and scrollbar
163+
166164 maps_frame = tk .Frame (self .upper_paned_window )
167165 maps_frame .pack (padx = 10 , pady = 10 )
168166 self .upper_paned_window .add (maps_frame , stretch = 'always' )
169167
170168 maps_label = tk .Label (maps_frame , text = "MAPS" )
171169 maps_label .pack (fill = tk .X , expand = False )
172170
173- # Button to load maps, placed at the top of the maps frame
174171 self .load_button = Button (maps_frame , text = "Load Maps" , command = self .load_maps )
175172 self .load_button .pack (pady = 10 )
176173
177- # The maps listbox and scrollbar
178174 self .maps_listbox = Listbox (maps_frame , width = 50 , height = 10 )
179175 scrollbar = tk .Scrollbar (maps_frame , orient = "vertical" , command = self .maps_listbox .yview )
180176 self .maps_listbox .configure (yscrollcommand = scrollbar .set )
181177 self .maps_listbox .pack (side = tk .LEFT , fill = tk .BOTH , expand = True )
182178 scrollbar .pack (side = tk .RIGHT , fill = tk .Y )
183179
184- # Frame for right-side elements (engine versions and launch modes)
185180 self .right_side_frame = tk .Frame (self .upper_paned_window )
186181 self .upper_paned_window .add (self .right_side_frame , stretch = 'always' )
187182
188- # Engine versions listbox or another widget for engine versions
189- # Here is just a placeholder, you might use dynamic widgets as you already have
190183 launch_modes_frame = tk .Frame (self .right_side_frame )
191184 launch_modes_label = tk .Label (self .right_side_frame , text = "LAUNCH MODES" )
192185 launch_modes_label .pack (fill = tk .BOTH , expand = False )
193186
194- # Launch modes frame with radiobuttons
195187 launch_modes_frame .pack (fill = tk .BOTH , expand = True )
196188 Radiobutton (launch_modes_frame , text = "Server" , variable = self .launch_options , value = "Server" , command = self .update_command_display ).pack (anchor = tk .W )
197189 Radiobutton (launch_modes_frame , text = "Client" , variable = self .launch_options , value = "Client" , command = self .update_command_display ).pack (anchor = tk .W )
198190 Radiobutton (launch_modes_frame , text = "Standalone" , variable = self .launch_options , value = "Standalone" , command = self .update_command_display ).pack (anchor = tk .W )
199191
200- # Engine versions listbox or another widget for engine versions
201- # Here is just a placeholder, you might use dynamic widgets as you already have
202192 engine_versions_label = tk .Label (self .right_side_frame , text = "ENGINE VERSIONS" )
203193 engine_versions_label .pack (fill = tk .BOTH , expand = False )
204194
205- # Bottom frame for launch and command buttons
206195 bottom_frame = tk .Frame (main_paned_window )
207196 main_paned_window .add (bottom_frame , stretch = 'never' )
208197
209- # Command display label
210198 self .command_display_var = tk .StringVar ()
211199 self .command_display_label = tk .Label (bottom_frame , textvariable = self .command_display_var , bg = "white" , anchor = "w" , relief = "sunken" )
212200 self .command_display_label .pack (fill = tk .X , padx = 5 , pady = 5 )
213201
214202 self .copy_command_button = Button (bottom_frame , text = "Copy Command" , command = self .copy_text_to_clipboard )
215203 self .copy_command_button .pack (side = tk .LEFT , padx = 5 )
216204
217- # Launch and Copy Command buttons in the bottom frame
218205 self .launch_button = Button (bottom_frame , text = "Launch" , state = 'disabled' , command = self .launch_project )
219206 self .launch_button .pack (side = tk .LEFT , padx = 5 )
220207
221208
222209 def copy_text_to_clipboard (self , event = None ):
223210 """Copy the command display label's text to the clipboard."""
224211 command_text = self .command_display_var .get ()
225- self .root .clipboard_clear () # Clear the clipboard
226- self .root .clipboard_append (command_text ) # Append the text to the clipboard
227- # Optionally, you can provide feedback to the user that the text has been copied
212+ self .root .clipboard_clear ()
213+ self .root .clipboard_append (command_text )
228214 messagebox .showinfo ("Info" , "Command copied to clipboard" )
229215
230216
@@ -237,14 +223,12 @@ def load_maps(self):
237223 project_content_dir = os .path .join (self .project_directory , 'Content' )
238224 plugin_dirs = glob .glob (os .path .join (self .project_directory , 'Plugins' , '*' , 'Content' ), recursive = True )
239225
240- # Search for .umap files in the project's Content directory
241226 project_umap_files = glob .glob (os .path .join (project_content_dir , '**/*.umap' ), recursive = True )
242- # Search for .umap files in each plugin's Content directory
227+
243228 plugin_umap_files = []
244229 for plugin_dir in plugin_dirs :
245230 plugin_umap_files .extend (glob .glob (os .path .join (plugin_dir , '**/*.umap' ), recursive = True ))
246231
247- # Combine all found .umap files
248232 all_umap_files = project_umap_files + plugin_umap_files
249233 self .maps_with_paths = {}
250234 self .maps_listbox .delete (0 , tk .END )
@@ -298,7 +282,7 @@ def update_command_display(self, *args):
298282
299283 command = self .construct_command (selected_map , selected_mode )
300284 if command :
301- self .command_display_var .set (command ) # Assuming you have a StringVar for the Entry widget
285+ self .command_display_var .set (command )
302286 else :
303287 self .command_display_var .set ("Unable to construct command." )
304288 else :
@@ -337,6 +321,7 @@ def construct_command(self, selected_map, selected_mode, preview=False):
337321 map_path = selected_map .replace ('\\ ' , '/' )
338322
339323 # Depending on the launch mode, construct the command using the selected editor executable
324+ # TODO: load from config!
340325 if selected_mode == "Server" :
341326 command = f'"{ editor_executable } " "{ uproject_path } " { map_path } -server -log'
342327 elif selected_mode == "Client" :
@@ -360,13 +345,14 @@ def update_launch_option(self, mode):
360345
361346
362347 def detect_unreal_versions (self ):
363- # Assume you have already created a frame for engine versions in the upper right pane
348+
364349 engine_versions_frame = tk .Frame (self .right_side_frame )
365350 engine_versions_frame .pack (fill = tk .BOTH , expand = True )
366351
367352 # List of default installation paths for Unreal Engine
353+ # TODO: load from config!
368354 default_install_paths = [
369- Path ("C:/Program Files/Epic Games" ), # The common installation path
355+ Path ("C:/Program Files/Epic Games" ),
370356 Path ("D:/Program Files/Epic Games" ),
371357 # Add any other common paths where UE might be installed on your system
372358 ]
0 commit comments