Merge branch 'main' of https://github.com/Faugus/faugus-launcher
This commit is contained in:
@@ -703,14 +703,11 @@ class Main(Gtk.Window):
|
||||
|
||||
selected_children = self.flowbox.get_selected_children()
|
||||
selected_child = selected_children[0]
|
||||
hbox = selected_child.get_child()
|
||||
game_label = hbox.get_children()[1]
|
||||
title = game_label.get_text()
|
||||
game = selected_child.game
|
||||
title = game.title
|
||||
|
||||
self.menu_item_title.get_child().set_text(title)
|
||||
|
||||
game = next((j for j in self.games if j.title == title), None)
|
||||
|
||||
with open(games_json, "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
@@ -826,8 +823,7 @@ class Main(Gtk.Window):
|
||||
if not selected:
|
||||
return
|
||||
|
||||
title = selected[0].get_child().get_children()[1].get_text()
|
||||
game = next((g for g in self.games if g.title == title), None)
|
||||
game = selected[0].game
|
||||
if not game:
|
||||
return
|
||||
|
||||
@@ -955,15 +951,12 @@ class Main(Gtk.Window):
|
||||
def on_duplicate_clicked(self, widget):
|
||||
selected_children = self.flowbox.get_selected_children()
|
||||
selected_child = selected_children[0]
|
||||
hbox = selected_child.get_child()
|
||||
game_label = hbox.get_children()[1]
|
||||
title = game_label.get_text()
|
||||
game = selected_child.game
|
||||
title = game.title
|
||||
|
||||
# Display duplicate dialog
|
||||
duplicate_dialog = DuplicateDialog(self, title)
|
||||
|
||||
game = next((g for g in self.games if g.title == title), None)
|
||||
|
||||
while True:
|
||||
response = duplicate_dialog.run()
|
||||
|
||||
@@ -1506,27 +1499,24 @@ class Main(Gtk.Window):
|
||||
game_label.set_no_show_all(True)
|
||||
|
||||
self.flowbox_child.add(hbox)
|
||||
self.flowbox_child.game = game
|
||||
self.flowbox.add(self.flowbox_child)
|
||||
|
||||
def on_search_changed(self, entry):
|
||||
search_text = entry.get_text().lower()
|
||||
self.filtered_games = [game for game in self.games if search_text in game.title.lower()]
|
||||
first_visible = None
|
||||
|
||||
for child in self.flowbox.get_children():
|
||||
self.flowbox.remove(child)
|
||||
game = child.game
|
||||
is_match = search_text in game.title.lower()
|
||||
|
||||
if self.filtered_games:
|
||||
for game in self.filtered_games:
|
||||
self.add_item_list(game)
|
||||
child.set_visible(is_match)
|
||||
if is_match and first_visible is None:
|
||||
first_visible = child
|
||||
|
||||
first_child = self.flowbox.get_children()[0]
|
||||
self.flowbox.select_child(first_child)
|
||||
self.on_item_selected(self.flowbox, first_child)
|
||||
|
||||
else:
|
||||
pass
|
||||
|
||||
self.flowbox.show_all()
|
||||
if first_visible:
|
||||
self.flowbox.select_child(first_visible)
|
||||
self.on_item_selected(self.flowbox, first_visible)
|
||||
|
||||
def on_item_selected(self, flowbox, child):
|
||||
if child is not None:
|
||||
@@ -1694,9 +1684,8 @@ class Main(Gtk.Window):
|
||||
return
|
||||
|
||||
selected_child = selected_children[0]
|
||||
hbox = selected_child.get_child()
|
||||
game_label = hbox.get_children()[1]
|
||||
title = game_label.get_text()
|
||||
game = selected_child.game
|
||||
title = game.title
|
||||
|
||||
processos = self.load_processes_from_file()
|
||||
self.button_locked[title] = True
|
||||
@@ -1712,8 +1701,6 @@ class Main(Gtk.Window):
|
||||
|
||||
return
|
||||
|
||||
# Find the selected game object
|
||||
game = next((j for j in self.games if j.title == title), None)
|
||||
if game:
|
||||
# Format the title for command execution
|
||||
game_directory = os.path.dirname(game.path)
|
||||
@@ -1847,11 +1834,10 @@ class Main(Gtk.Window):
|
||||
|
||||
selected_children = self.flowbox.get_selected_children()
|
||||
selected_child = selected_children[0]
|
||||
hbox = selected_child.get_child()
|
||||
game_label = hbox.get_children()[1]
|
||||
title = game_label.get_text()
|
||||
game = selected_child.game
|
||||
title = game.title
|
||||
|
||||
if game := next((j for j in self.games if j.title == title), None):
|
||||
if game:
|
||||
processos = self.load_processes_from_file()
|
||||
if game.title in processos:
|
||||
self.game_running = True
|
||||
@@ -1992,11 +1978,10 @@ class Main(Gtk.Window):
|
||||
self.reload_playtimes()
|
||||
selected_children = self.flowbox.get_selected_children()
|
||||
selected_child = selected_children[0]
|
||||
hbox = selected_child.get_child()
|
||||
game_label = hbox.get_children()[1]
|
||||
title = game_label.get_text()
|
||||
game = selected_child.game
|
||||
title = game.title
|
||||
|
||||
if game := next((j for j in self.games if j.title == title), None):
|
||||
if game:
|
||||
# Display confirmation dialog
|
||||
confirmation_dialog = ConfirmationDialog(self, title, game.prefix, game.runner)
|
||||
response = confirmation_dialog.run()
|
||||
|
||||
Reference in New Issue
Block a user