def create_main_window(self): self.get_banner() self.monitors_list, self.monitor_primary = monitors.get_monitors() self.main_window = Gtk.Window( title = _("Games Nebula"), type = Gtk.WindowType.TOPLEVEL, window_position = Gtk.WindowPosition.CENTER_ALWAYS, resizable = False, icon = app_icon, ) self.main_window.connect('delete-event', self.quit_app) self.grid = Gtk.Grid( margin_left = 10, margin_right = 10, margin_top = 10, margin_bottom = 10, row_spacing = 10, column_spacing = 10, column_homogeneous = True, ) self.banner = Gtk.Image( file = self.banner_path, no_show_all = True ) self.banner.set_visible(self.show_banner) self.expander = Gtk.Expander( label = _("ScummVM") ) self.frame = Gtk.Frame( #label = _("ScummVM"), label_xalign = 0.5, #margin_bottom = 10, margin_left = 10, margin_right = 10, ) self.frame_grid = Gtk.Grid( column_homogeneous = True, #row_homogeneous = True, row_spacing = 10, column_spacing = 10, margin_top = 10, margin_bottom = 10, margin_left = 10, margin_right = 10, ) self.rbutton_global = Gtk.RadioButton( name = 'global', label = _("Global settings") ) self.rbutton_sys = Gtk.RadioButton( name = 'system', label = _("System version") ) self.rbutton_sys.join_group(self.rbutton_global) self.rbutton_path = Gtk.RadioButton( name = 'path', label = _("From directory"), ) self.rbutton_path.join_group(self.rbutton_global) if self.scummvm == 'global': self.rbutton_global.set_active(True) elif self.scummvm == 'system': self.rbutton_sys.set_active(True) if self.scummvm == 'path': self.rbutton_path.set_label(_("From directory:")) self.rbutton_path.set_active(True) self.filechooser_button = Gtk.FileChooserButton( title = _("Select a directory"), action = Gtk.FileChooserAction.SELECT_FOLDER, no_show_all = True ) self.filechooser_button.set_filename(self.scummvm_path) self.combobox_version = Gtk.ComboBoxText( no_show_all = True ) self.populate_scummvm_versions_combobox() self.filechooser_button.connect('file-set', self.cb_filechooser_button) self.combobox_version.connect('changed', self.cb_combobox_version) self.label_version = Gtk.Label( label = _("Version:"), halign = Gtk.Align.CENTER, ) self.button_settings = Gtk.Button( label = _("Game specific ScummVM settings"), ) self.button_settings.connect('clicked', self.cb_button_settings) self.frame_grid.attach(self.label_version, 0, 0, 2, 1) self.frame_grid.attach(self.rbutton_global, 0, 1, 2, 1) self.frame_grid.attach(self.rbutton_sys, 0, 2, 2, 1) self.frame_grid.attach(self.rbutton_path, 0, 3, 2, 1) self.frame_grid.attach(self.filechooser_button, 0, 4, 1, 1) self.frame_grid.attach(self.combobox_version, 1, 4, 1, 1) self.frame_grid.attach(self.button_settings, 0, 5, 2, 1) self.frame.add(self.frame_grid) self.expander.add(self.frame) self.rbutton_global.connect('toggled', self.cb_rbuttons) self.rbutton_sys.connect('toggled', self.cb_rbuttons) self.rbutton_path.connect('toggled', self.cb_rbuttons) if (self.scummvm == 'global') or (self.scummvm == 'system'): self.filechooser_button.set_visible(False) self.combobox_version.set_visible(False) else: self.filechooser_button.set_visible(True) self.combobox_version.set_visible(True) self.label_monitor = Gtk.Label( label = _("Monitor"), ) self.combobox_monitor = Gtk.ComboBoxText() for output in self.monitors_list: self.combobox_monitor.append_text(output.translate(None, '\n')) self.combobox_monitor.set_active(self.monitor) self.combobox_monitor.connect('changed', self.cb_combobox_monitor) expander_before = Gtk.Expander( label = _("Execute before launching the game") ) grid_before = Gtk.Grid( margin_top = 10, row_spacing = 10, column_spacing = 5, ) entry_before = Gtk.Entry( name = 'command_before', hexpand = True, text = self.command_before, sensitive = False ) entry_before.connect('changed', self.cb_entries) def cb_button_edit_before(button): if entry_before.get_sensitive(): entry_before.set_sensitive(False) else: entry_before.set_sensitive(True) img = Gtk.Image.new_from_icon_name("document-new", Gtk.IconSize.SMALL_TOOLBAR) button_edit_before = Gtk.Button( image = img, tooltip_text = _("Edit") ) button_edit_before.connect('clicked', cb_button_edit_before) combobox_before = Gtk.ComboBoxText( hexpand = True, tooltip_text = _("Commands templates") ) for command in sample_commands_list: combobox_before.append_text(command) combobox_before.set_active(0) def cb_button_add_before(button): new_command = sample_commands[combobox_before.get_active_text()] current_command = entry_before.get_text() if current_command == '': entry_before.set_text(new_command) else: entry_before.set_text(current_command + ' && ' + new_command) img = Gtk.Image.new_from_icon_name("go-up", Gtk.IconSize.SMALL_TOOLBAR) button_add_before = Gtk.Button( image = img, tooltip_text = _("Add command template") ) button_add_before.connect('clicked', cb_button_add_before) grid_before.attach(entry_before, 0, 0, 1, 1) grid_before.attach(button_edit_before, 1, 0, 1, 1) grid_before.attach(combobox_before, 0, 1, 1, 1) grid_before.attach(button_add_before, 1, 1, 1, 1) expander_before.add(grid_before) expander_after = Gtk.Expander( label = _("Execute after exiting the game") ) grid_after = Gtk.Grid( margin_top = 10, row_spacing = 10, column_spacing = 5, ) entry_after = Gtk.Entry( name = 'command_after', hexpand = True, text = self.command_after, sensitive = False ) entry_after.connect('changed', self.cb_entries) def cb_button_edit_after(button): if entry_after.get_sensitive(): entry_after.set_sensitive(False) else: entry_after.set_sensitive(True) img = Gtk.Image.new_from_icon_name("document-new", Gtk.IconSize.SMALL_TOOLBAR) button_edit_after = Gtk.Button( image = img, tooltip_text = _("Edit") ) button_edit_after.connect('clicked', cb_button_edit_after) combobox_after = Gtk.ComboBoxText( hexpand = True, tooltip_text = _("Commands templates") ) for command in sample_commands_list: combobox_after.append_text(command) combobox_after.set_active(0) def cb_button_add_after(button): new_command = sample_commands[combobox_after.get_active_text()] current_command = entry_after.get_text() if current_command == '': entry_after.set_text(new_command) else: entry_after.set_text(current_command + ' && ' + new_command) img = Gtk.Image.new_from_icon_name("go-up", Gtk.IconSize.SMALL_TOOLBAR) button_add_after = Gtk.Button( image = img, tooltip_text = _("Add command template") ) button_add_after.connect('clicked', cb_button_add_after) grid_after.attach(entry_after, 0, 0, 1, 1) grid_after.attach(button_edit_after, 1, 0, 1, 1) grid_after.attach(combobox_after, 0, 1, 1, 1) grid_after.attach(button_add_after, 1, 1, 1, 1) expander_after.add(grid_after) self.button_game = Gtk.Button( label = _("Launch game") ) self.button_game.connect('clicked', self.cb_button_game) self.checkbutton_show_launcher = Gtk.CheckButton( label = _("Always show launcher") ) if self.launcher == True: self.checkbutton_show_launcher.set_active(True) else: self.checkbutton_show_launcher.set_active(False) self.checkbutton_show_launcher.connect('clicked', self.cb_checkbutton_show_launcher) self.checkbutton_show_banner = Gtk.CheckButton( halign = Gtk.Align.END, valign = Gtk.Align.START, active = self.show_banner ) self.checkbutton_show_banner.connect('toggled', self.cb_checkbutton_show_banner) self.grid.attach(self.checkbutton_show_banner, 0, 0, 2, 1) self.grid.attach(self.banner, 0, 0, 2, 1) self.grid.attach(self.expander, 0, 1, 2, 1) self.grid.attach(expander_before, 0, 2, 2, 1) self.grid.attach(expander_after, 0, 3, 2, 1) self.grid.attach(self.label_monitor, 0, 4, 1, 1) self.grid.attach(self.combobox_monitor, 1, 4, 1, 1) self.grid.attach(self.button_game, 0, 5, 2, 1) self.grid.attach(self.checkbutton_show_launcher, 0, 6, 2, 1) self.main_window.add(self.grid) if self.launcher == True: self.main_window.show_all() else: self.launch_game()
def create_main_window(self): self.get_banner() self.monitors_list, self.monitor_primary = monitors.get_monitors() self.main_window = Gtk.Window( title=_("Games Nebula"), type=Gtk.WindowType.TOPLEVEL, window_position=Gtk.WindowPosition.CENTER_ALWAYS, resizable=False, icon=app_icon, ) self.main_window.connect('delete-event', self.quit_app) self.grid = Gtk.Grid( margin_left=10, margin_right=10, margin_top=10, margin_bottom=10, row_spacing=10, column_spacing=10, column_homogeneous=True, ) self.banner = Gtk.Image(file=self.banner_path, no_show_all=True) self.banner.set_visible(self.show_banner) self.label_monitor = Gtk.Label(label=_("Primary output:"), ) self.combobox_monitor = Gtk.ComboBoxText() for output in self.monitors_list: self.combobox_monitor.append_text(output.translate(None, '\n')) self.combobox_monitor.set_active(self.monitor) self.combobox_monitor.connect('changed', self.cb_combobox_monitor) self.button_settings = Gtk.Button(label=_("Game settings"), no_show_all=True) if not os.path.exists(self.install_dir + '/' + self.game_name + '/settings.sh'): self.button_settings.set_visible(False) else: self.button_settings.set_visible(True) self.button_settings.connect('clicked', self.cb_button_settings) self.label_launcher = Gtk.Label(label=_("Use:"), no_show_all=True) self.radiobutton_gog_launcher = Gtk.RadioButton( label=_("GOG launcher"), name='gog', no_show_all=True) self.radiobutton_gn_launcher = Gtk.RadioButton( label=_("Games Nebula launcher"), name='gn', no_show_all=True) self.radiobutton_gn_launcher.join_group(self.radiobutton_gog_launcher) if self.launcher_type == 'gog': self.radiobutton_gog_launcher.set_active(True) else: self.radiobutton_gn_launcher.set_active(True) self.radiobutton_gog_launcher.connect('toggled', self.cb_radiobuttons) self.radiobutton_gn_launcher.connect('toggled', self.cb_radiobuttons) if self.start_gog_exists and self.start_gn_exists: self.label_launcher.set_visible(True) self.radiobutton_gn_launcher.set_visible(True) self.radiobutton_gog_launcher.set_visible(True) else: self.label_launcher.set_visible(False) self.radiobutton_gn_launcher.set_visible(False) self.radiobutton_gog_launcher.set_visible(False) expander_before = Gtk.Expander( label=_("Execute before launching the game")) grid_before = Gtk.Grid( margin_top=10, row_spacing=10, column_spacing=5, ) entry_before = Gtk.Entry(name='command_before', hexpand=True, text=self.command_before, sensitive=False) entry_before.connect('changed', self.cb_entries) def cb_button_edit_before(button): if entry_before.get_sensitive(): entry_before.set_sensitive(False) else: entry_before.set_sensitive(True) img = Gtk.Image.new_from_icon_name("document-new", Gtk.IconSize.SMALL_TOOLBAR) button_edit_before = Gtk.Button(image=img, tooltip_text=_("Edit")) button_edit_before.connect('clicked', cb_button_edit_before) combobox_before = Gtk.ComboBoxText( hexpand=True, tooltip_text=_("Commands templates")) for command in sample_commands_list: combobox_before.append_text(command) combobox_before.set_active(0) def cb_button_add_before(button): new_command = sample_commands[combobox_before.get_active_text()] current_command = entry_before.get_text() if current_command == '': entry_before.set_text(new_command) else: entry_before.set_text(current_command + ' && ' + new_command) img = Gtk.Image.new_from_icon_name("go-up", Gtk.IconSize.SMALL_TOOLBAR) button_add_before = Gtk.Button(image=img, tooltip_text=_("Add command template")) button_add_before.connect('clicked', cb_button_add_before) grid_before.attach(entry_before, 0, 0, 1, 1) grid_before.attach(button_edit_before, 1, 0, 1, 1) grid_before.attach(combobox_before, 0, 1, 1, 1) grid_before.attach(button_add_before, 1, 1, 1, 1) expander_before.add(grid_before) expander_after = Gtk.Expander( label=_("Execute after exiting the game")) grid_after = Gtk.Grid( margin_top=10, row_spacing=10, column_spacing=5, ) entry_after = Gtk.Entry(name='command_after', hexpand=True, text=self.command_after, sensitive=False) entry_after.connect('changed', self.cb_entries) def cb_button_edit_after(button): if entry_after.get_sensitive(): entry_after.set_sensitive(False) else: entry_after.set_sensitive(True) img = Gtk.Image.new_from_icon_name("document-new", Gtk.IconSize.SMALL_TOOLBAR) button_edit_after = Gtk.Button(image=img, tooltip_text=_("Edit")) button_edit_after.connect('clicked', cb_button_edit_after) combobox_after = Gtk.ComboBoxText(hexpand=True, tooltip_text=_("Commands templates")) for command in sample_commands_list: combobox_after.append_text(command) combobox_after.set_active(0) def cb_button_add_after(button): new_command = sample_commands[combobox_after.get_active_text()] current_command = entry_after.get_text() if current_command == '': entry_after.set_text(new_command) else: entry_after.set_text(current_command + ' && ' + new_command) img = Gtk.Image.new_from_icon_name("go-up", Gtk.IconSize.SMALL_TOOLBAR) button_add_after = Gtk.Button(image=img, tooltip_text=_("Add command template")) button_add_after.connect('clicked', cb_button_add_after) grid_after.attach(entry_after, 0, 0, 1, 1) grid_after.attach(button_edit_after, 1, 0, 1, 1) grid_after.attach(combobox_after, 0, 1, 1, 1) grid_after.attach(button_add_after, 1, 1, 1, 1) expander_after.add(grid_after) self.button_game = Gtk.Button(label=_("Launch game")) self.button_game.connect('clicked', self.cb_button_game) self.checkbutton_show_launcher = Gtk.CheckButton( label=_("Always show launcher")) if self.launcher == True: self.checkbutton_show_launcher.set_active(True) else: self.checkbutton_show_launcher.set_active(False) self.checkbutton_show_launcher.connect( 'clicked', self.cb_checkbutton_show_launcher) self.checkbutton_show_banner = Gtk.CheckButton(halign=Gtk.Align.END, valign=Gtk.Align.START, active=self.show_banner) self.checkbutton_show_banner.connect('toggled', self.cb_checkbutton_show_banner) self.grid.attach(self.checkbutton_show_banner, 0, 0, 2, 1) self.grid.attach(self.banner, 0, 0, 2, 1) self.grid.attach(expander_before, 0, 1, 2, 1) self.grid.attach(expander_after, 0, 2, 2, 1) self.grid.attach(self.label_monitor, 0, 3, 1, 1) self.grid.attach(self.combobox_monitor, 1, 3, 1, 1) self.grid.attach(self.label_launcher, 0, 4, 1, 1) self.grid.attach(self.radiobutton_gog_launcher, 1, 4, 1, 1) self.grid.attach(self.radiobutton_gn_launcher, 1, 5, 1, 1) self.grid.attach(self.button_settings, 0, 6, 2, 1) self.grid.attach(self.button_game, 0, 7, 2, 1) self.grid.attach(self.checkbutton_show_launcher, 0, 8, 2, 1) self.main_window.add(self.grid) if self.launcher == True: self.main_window.show_all() else: self.launch_game()
def create_main_window(self): self.get_banner() self.monitors_list, self.monitor_primary = monitors.get_monitors() self.main_window = Gtk.Window( title = _("Games Nebula"), type = Gtk.WindowType.TOPLEVEL, window_position = Gtk.WindowPosition.CENTER_ALWAYS, resizable = False, icon = app_icon, ) self.main_window.connect('delete-event', self.quit_app) self.grid = Gtk.Grid( margin_left = 10, margin_right = 10, margin_top = 10, margin_bottom = 10, row_spacing = 10, column_spacing = 10, column_homogeneous = True, ) self.banner = Gtk.Image( file = self.banner_path, no_show_all = True ) self.banner.set_visible(self.show_banner) self.expander = Gtk.Expander( label = _("Wine") ) self.frame = Gtk.Frame( #label = _("Wine"), label_xalign = 0.5, #margin_bottom = 10, margin_left = 10, margin_right = 10, ) self.frame_grid = Gtk.Grid( column_homogeneous = True, #row_homogeneous = True, row_spacing = 10, column_spacing = 10, margin_top = 10, margin_bottom = 10, margin_left = 10, margin_right = 10, ) self.rbutton_global = Gtk.RadioButton( name = 'global', label = _("Global settings") ) self.rbutton_sys = Gtk.RadioButton( name = 'system', label = _("System version") ) self.rbutton_sys.join_group(self.rbutton_global) self.rbutton_path = Gtk.RadioButton( name = 'path', label = _("From directory") ) self.rbutton_path.join_group(self.rbutton_global) if self.wine == 'global': self.rbutton_global.set_active(True) elif self.wine == 'system': self.rbutton_sys.set_active(True) if self.wine == 'path': self.rbutton_path.set_label(_("From directory:")) self.rbutton_path.set_active(True) self.filechooser_button = Gtk.FileChooserButton( title = _("Select a directory"), action = Gtk.FileChooserAction.SELECT_FOLDER, no_show_all = True ) self.filechooser_button.set_filename(self.wine_path) self.combobox_version = Gtk.ComboBoxText( no_show_all = True ) self.populate_wine_versions_combobox() self.filechooser_button.connect('file-set', self.cb_filechooser_button) self.combobox_version.connect('changed', self.cb_combobox_version) self.label_win_ver = Gtk.Label( label = _("Windows version") ) self.combobox_win_ver = Gtk.ComboBoxText() self.populate_win_ver_combobox() self.combobox_win_ver.connect('changed', self.cb_combobox_win_ver) self.checkbutton_prefix = Gtk.CheckButton( label = _("Use own wine prefix"), active = self.own_prefix ) self.checkbutton_prefix.connect('toggled', self.cb_checkbutton_prefix) self.combobox_winearch = Gtk.ComboBoxText( tooltip_text = _("WINEARCH"), no_show_all = True ) self.combobox_winearch.connect('changed', self.cb_combobox_winearch) self.win64_available() self.combobox_winearch.append_text('win32') self.combobox_winearch.append_text('win64') if self.winearch == 'win32': self.combobox_winearch.set_active(0) elif self.winearch == 'win64': self.combobox_winearch.set_active(1) self.checkbutton_mouse = Gtk.CheckButton( label = _("Capture the mouse in fullscreen windows"), active = self.mouse_capture ) self.checkbutton_mouse.connect('toggled', self.cb_checkbutton_mouse) self.checkbutton_virtual_desktop = Gtk.CheckButton( label = _("Emulate a virtual desktop"), active = self.virtual_desktop ) self.checkbutton_virtual_desktop.connect('toggled', self.cb_checkbutton_virtual_desktop) self.entry_virt_width = Gtk.Entry( placeholder_text = _("Width"), max_length = 4, max_width_chars = 4, xalign = 0.5, text = self.virtual_desktop_width, no_show_all = True ) self.entry_virt_width.set_visible(self.virtual_desktop) self.entry_virt_width.connect('changed', self.cb_entry_virt_width) self.entry_virt_height = Gtk.Entry( placeholder_text = _("Height"), max_length = 4, max_width_chars = 4, xalign = 0.5, text = self.virtual_desktop_height, no_show_all = True ) self.entry_virt_height.set_visible(self.virtual_desktop) self.entry_virt_height.connect('changed', self.cb_entry_virt_height) self.label_version = Gtk.Label( label = _("Version:"), halign = Gtk.Align.CENTER, ) self.label_specific_settings = Gtk.Label( label = _("Game specific Wine settings:"), halign = Gtk.Align.CENTER, ) self.button_wine_settings = Gtk.Button( label = _("Current wine prefix settings") ) self.button_wine_settings.connect('clicked', self.cb_button_wine_settings) self.frame_grid.attach(self.label_version, 0, 0, 2, 1) self.frame_grid.attach(self.rbutton_global, 0, 1, 2, 1) self.frame_grid.attach(self.rbutton_sys, 0, 2, 2, 1) self.frame_grid.attach(self.rbutton_path, 0, 3, 2, 1) self.frame_grid.attach(self.filechooser_button, 0, 4, 1, 1) self.frame_grid.attach(self.combobox_version, 1, 4, 1, 1) self.frame_grid.attach(self.label_specific_settings, 0, 5, 2, 1) self.frame_grid.attach(self.checkbutton_prefix, 0, 6, 1, 1) self.frame_grid.attach(self.combobox_winearch, 1, 6, 1, 1) self.frame_grid.attach(self.checkbutton_mouse, 0, 7, 2, 1) self.frame_grid.attach(self.checkbutton_virtual_desktop, 0, 8, 2, 1) self.frame_grid.attach(self.entry_virt_width, 0, 9, 1, 1) self.frame_grid.attach(self.entry_virt_height, 1, 9, 1, 1) self.frame_grid.attach(self.label_win_ver, 0, 10, 1, 1) self.frame_grid.attach(self.combobox_win_ver, 1, 10, 1, 1) self.frame_grid.attach(self.button_wine_settings, 0, 11, 2, 1) self.frame.add(self.frame_grid) self.expander.add(self.frame) self.rbutton_global.connect('toggled', self.cb_rbuttons) self.rbutton_sys.connect('toggled', self.cb_rbuttons) self.rbutton_path.connect('toggled', self.cb_rbuttons) if (self.wine == 'global') or (self.wine == 'system'): self.filechooser_button.set_visible(False) self.combobox_version.set_visible(False) else: self.filechooser_button.set_visible(True) self.combobox_version.set_visible(True) self.label_monitor = Gtk.Label( label = _("Monitor"), ) self.combobox_monitor = Gtk.ComboBoxText() for output in self.monitors_list: try: self.combobox_monitor.append_text(output.translate(None, '\n')) except: char_map = str.maketrans('', '', '\n') self.combobox_monitor.append_text(output.translate(char_map)) self.combobox_monitor.set_active(self.monitor) self.combobox_monitor.connect('changed', self.cb_combobox_monitor) self.button_settings = Gtk.Button( label = _("Game settings"), no_show_all = True ) if not os.path.exists(self.install_dir + '/' + self.game_name + '/settings.sh'): self.button_settings.set_visible(False) else: self.button_settings.set_visible(True) self.button_settings.connect('clicked', self.cb_button_settings) expander_before = Gtk.Expander( label = _("Execute before launching the game") ) grid_before = Gtk.Grid( margin_top = 10, row_spacing = 10, column_spacing = 5, ) entry_before = Gtk.Entry( name = 'command_before', hexpand = True, text = self.command_before, sensitive = False ) entry_before.connect('changed', self.cb_entries) def cb_button_edit_before(button): if entry_before.get_sensitive(): entry_before.set_sensitive(False) else: entry_before.set_sensitive(True) img = Gtk.Image.new_from_icon_name("document-new", Gtk.IconSize.SMALL_TOOLBAR) button_edit_before = Gtk.Button( image = img, tooltip_text = _("Edit") ) button_edit_before.connect('clicked', cb_button_edit_before) combobox_before = Gtk.ComboBoxText( hexpand = True, tooltip_text = _("Commands templates") ) for command in sample_commands_list: combobox_before.append_text(command) combobox_before.set_active(0) def cb_button_add_before(button): new_command = sample_commands[combobox_before.get_active_text()] current_command = entry_before.get_text() if current_command == '': entry_before.set_text(new_command) else: entry_before.set_text(current_command + ' && ' + new_command) img = Gtk.Image.new_from_icon_name("go-up", Gtk.IconSize.SMALL_TOOLBAR) button_add_before = Gtk.Button( image = img, tooltip_text = _("Add command template") ) button_add_before.connect('clicked', cb_button_add_before) grid_before.attach(entry_before, 0, 0, 1, 1) grid_before.attach(button_edit_before, 1, 0, 1, 1) grid_before.attach(combobox_before, 0, 1, 1, 1) grid_before.attach(button_add_before, 1, 1, 1, 1) expander_before.add(grid_before) expander_after = Gtk.Expander( label = _("Execute after exiting the game") ) grid_after = Gtk.Grid( margin_top = 10, row_spacing = 10, column_spacing = 5, ) entry_after = Gtk.Entry( name = 'command_after', hexpand = True, text = self.command_after, sensitive = False ) entry_after.connect('changed', self.cb_entries) def cb_button_edit_after(button): if entry_after.get_sensitive(): entry_after.set_sensitive(False) else: entry_after.set_sensitive(True) img = Gtk.Image.new_from_icon_name("document-new", Gtk.IconSize.SMALL_TOOLBAR) button_edit_after = Gtk.Button( image = img, tooltip_text = _("Edit") ) button_edit_after.connect('clicked', cb_button_edit_after) combobox_after = Gtk.ComboBoxText( hexpand = True, tooltip_text = _("Commands templates") ) for command in sample_commands_list: combobox_after.append_text(command) combobox_after.set_active(0) def cb_button_add_after(button): new_command = sample_commands[combobox_after.get_active_text()] current_command = entry_after.get_text() if current_command == '': entry_after.set_text(new_command) else: entry_after.set_text(current_command + ' && ' + new_command) img = Gtk.Image.new_from_icon_name("go-up", Gtk.IconSize.SMALL_TOOLBAR) button_add_after = Gtk.Button( image = img, tooltip_text = _("Add command template") ) button_add_after.connect('clicked', cb_button_add_after) grid_after.attach(entry_after, 0, 0, 1, 1) grid_after.attach(button_edit_after, 1, 0, 1, 1) grid_after.attach(combobox_after, 0, 1, 1, 1) grid_after.attach(button_add_after, 1, 1, 1, 1) expander_after.add(grid_after) self.button_game = Gtk.Button( label = _("Launch game") ) self.button_game.connect('clicked', self.cb_button_game) self.checkbutton_show_launcher = Gtk.CheckButton( label = _("Always show launcher") ) self.checkbutton_show_launcher.set_active(self.launcher) self.checkbutton_show_launcher.connect('clicked', self.cb_checkbutton_show_launcher) self.checkbutton_show_banner = Gtk.CheckButton( halign = Gtk.Align.END, valign = Gtk.Align.START, active = self.show_banner ) self.checkbutton_show_banner.connect('toggled', self.cb_checkbutton_show_banner) self.grid.attach(self.checkbutton_show_banner, 0, 0, 2, 1) self.grid.attach(self.banner, 0, 0, 2, 1) self.grid.attach(self.expander, 0, 1, 2, 1) self.grid.attach(expander_before, 0, 2, 2, 1) self.grid.attach(expander_after, 0, 3, 2, 1) self.grid.attach(self.label_monitor, 0, 4, 1, 1) self.grid.attach(self.combobox_monitor, 1, 4, 1, 1) self.grid.attach(self.button_settings, 0, 5, 2, 1) self.grid.attach(self.button_game, 0, 6, 2, 1) self.grid.attach(self.checkbutton_show_launcher, 0, 7, 2, 1) self.main_window.add(self.grid) if self.launcher == True: self.main_window.show_all() else: self.launch_game()