diff --git a/lutris/gui/config_boxes.py b/lutris/gui/config_boxes.py index 93211453d..bbcf4db9c 100644 --- a/lutris/gui/config_boxes.py +++ b/lutris/gui/config_boxes.py @@ -350,12 +350,12 @@ class ConfigBox(VBox): config_key = option['default_path'] default_path = self.lutris_config.system_config.get(config_key) if default_path and os.path.exists(default_path): - file_chooser.set_current_folder(default_path) + file_chooser.entry.set_text(default_path) if path: # If path is relative, complete with game dir if not os.path.isabs(path): - path = os.path.expanduser(path) + path = os.path.expanduser(path) file_chooser.entry.set_text(path) file_chooser.set_valign(Gtk.Align.CENTER) diff --git a/lutris/gui/widgets/common.py b/lutris/gui/widgets/common.py index 14797e1b0..6a84eba50 100644 --- a/lutris/gui/widgets/common.py +++ b/lutris/gui/widgets/common.py @@ -80,6 +80,9 @@ class FileChooserEntry(Gtk.Box): def get_text(self): return self.entry.get_text() + def get_filename(self): + return self.entry.get_text() + def _open_filechooser(self, widget, default_path): if default_path: self.file_chooser_dlg.set_current_folder( diff --git a/tests/test_dialogs.py b/tests/test_dialogs.py index 1c26d9266..cb6d4207d 100644 --- a/tests/test_dialogs.py +++ b/tests/test_dialogs.py @@ -37,7 +37,13 @@ class TestGameDialog(TestCase): return self.dlg.vbox.get_children()[0] def get_viewport(self, index): - scrolled_window = self.get_notebook().get_children()[index] + children = self.get_notebook().get_children() + try: + scrolled_window = children[index] + except IndexError: + print("No viewport for index %s" % index) + print(children) + raise viewport = scrolled_window.get_children()[0] return viewport.get_children()[0] @@ -72,7 +78,7 @@ class TestGameDialog(TestCase): self.assertEqual(game_box.game.runner_name, 'linux') exe_box = game_box.get_children()[0].get_children()[0] exe_field = exe_box.get_children()[1] - self.assertEqual(exe_field.__class__.__name__, 'FileChooserButton') + self.assertEqual(exe_field.__class__.__name__, 'FileChooserEntry') def test_can_add_game(self): name_entry = self.dlg.name_entry @@ -85,8 +91,7 @@ class TestGameDialog(TestCase): self.assertEqual(exe_label.get_text(), "Executable") test_exe = os.path.abspath(__file__) exe_field = exe_box.get_children()[1] - exe_field.set_file(Gio.File.new_for_path(test_exe)) - exe_field.emit('file-set') + exe_field.entry.set_text(test_exe) self.assertEqual(exe_field.get_filename(), test_exe) add_button = self.get_buttons().get_children()[1]