Skip to content

Commit

Permalink
Add search feature
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktelindert committed Aug 3, 2021
1 parent 844efb6 commit 9a04d0c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 7 additions & 3 deletions Crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, path):
icon_file = game_path + config['Gameinfo']['icon']
exec_cmd = "dosbox -conf " + cfg_file
game_info = GameInfo(game_name, icon_file)
self.game_exec.append(exec_cmd)
self.game_exec.append([game_name, exec_cmd])

self.games_list.append(game_info.get_row())
self.games_list_original.append(game_info.get_row())
Expand All @@ -57,7 +57,11 @@ def get_list(self):
def get_original_list(self):
return self.games_list_original

def get_exec(self, idx):
return self.game_exec[idx]
def get_exec(self, name):
for item in self.game_exec:
if item[0] == name:
print(item[0])
return item[1]



4 changes: 2 additions & 2 deletions Handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def btn_quit_clicked(self, widget):
Gtk.main_quit()

def launch_application(self, widget, idx):
os.system(self.crawler.get_exec(self.crawler, idx[0]))
iter = widget.get_model().get_iter_from_string(idx.to_string())
os.system(self.crawler.get_exec(self.crawler, widget.get_model().get_value(iter, 1)))

def set_search_term(self, widget):
self.search_term = widget.get_text()
Expand All @@ -29,6 +30,5 @@ def search_list(self, button):
self.crawler.games_list.clear()
for game_icon in self.crawler.get_original_list(self.crawler):
matches = re.match(regex, game_icon[1].lower())
print(matches)
if matches:
self.crawler.games_list.append([game_icon[0], game_icon[1]])
3 changes: 0 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,5 @@ def main(self):
win.show_all()
Gtk.main()

def handlers(self, widget):
print(widget)


main = GameDotExe()

0 comments on commit 9a04d0c

Please sign in to comment.