def __init__(self, service): super(ServiceSyncRow, self).__init__() self.set_spacing(20) self.identifier = service.__name__.split('.')[-1] name = service.NAME icon = get_runner_icon(self.identifier) self.pack_start(icon, False, False, 0) label = Gtk.Label(xalign=0) label.set_markup("<b>{}</b>".format(name)) self.pack_start(label, True, True, 0) actions = Gtk.VBox() self.pack_start(actions, False, False, 0) sync_switch = Gtk.Switch() sync_switch.set_tooltip_text("Sync when Lutris starts") sync_switch.props.valign = Gtk.Align.CENTER sync_switch.connect('notify::active', self.on_switch_changed) if read_setting('sync_at_startup', self.identifier) == 'True': sync_switch.set_state(True) actions.pack_start(sync_switch, False, False, 0) sync_button = Gtk.Button("Sync") sync_button.set_tooltip_text("Sync now") sync_button.connect('clicked', self.on_sync_button_clicked, service.sync_with_lutris) actions.pack_start(sync_button, False, False, 0)
def get_runner_hbox(self, runner_name): # Get runner details runner = runners.import_runner(runner_name)() platform = ', '.join(sorted(list(set(runner.platforms)))) description = runner.description hbox = Gtk.HBox() hbox.show() # Icon icon = get_runner_icon(runner_name) icon.show() icon.set_alignment(0.5, 0.1) hbox.pack_start(icon, False, False, 10) # Label runner_label = Gtk.Label() runner_label.show() if not runner.is_installed(): runner_label.set_sensitive(False) runner_label.set_markup( "<b>%s</b>\n%s\n <i>Supported platforms : %s</i>" % (runner.human_name, description, platform) ) runner_label.set_width_chars(40) runner_label.set_max_width_chars(40) runner_label.set_property('wrap', True) runner_label.set_line_wrap(True) runner_label.set_alignment(0.0, 0.1) runner_label.set_padding(5, 0) self.runner_labels[runner] = runner_label hbox.pack_start(runner_label, True, True, 5) # Buttons self.versions_button = Gtk.Button("Manage versions") self.versions_button.set_size_request(120, 30) self.versions_button.set_valign(Gtk.Align.CENTER) self.versions_button.connect("clicked", self.on_versions_clicked, runner, runner_label) hbox.pack_start(self.versions_button, False, False, 5) self.install_button = Gtk.Button("Install") self.install_button.set_size_request(80, 30) self.install_button.set_valign(Gtk.Align.CENTER) self.install_button.connect("clicked", self.on_install_clicked, runner, runner_label) hbox.pack_start(self.install_button, False, False, 5) self.configure_button = Gtk.Button("Configure") self.configure_button.set_size_request(90, 30) self.configure_button.set_valign(Gtk.Align.CENTER) self.configure_button.connect("clicked", self.on_configure_clicked, runner, runner_label) hbox.pack_start(self.configure_button, False, False, 5) self.set_button_display(runner) return hbox
def get_runner_hbox(self, runner_name): # Get runner details runner = runners.import_runner(runner_name)() platform = ', '.join(sorted(list(set(runner.platforms)))) description = runner.description hbox = Gtk.HBox() hbox.show() # Icon icon = get_runner_icon(runner_name) icon.show() icon.set_alignment(0.5, 0.1) hbox.pack_start(icon, False, False, 10) # Label runner_label = Gtk.Label() runner_label.show() if not runner.is_installed(): runner_label.set_sensitive(False) runner_label.set_markup( "<b>%s</b>\n%s\n <i>Supported platforms : %s</i>" % (runner.human_name, description, platform)) runner_label.set_width_chars(40) runner_label.set_max_width_chars(40) runner_label.set_property('wrap', True) runner_label.set_line_wrap(True) runner_label.set_alignment(0.0, 0.1) runner_label.set_padding(5, 0) self.runner_labels[runner] = runner_label hbox.pack_start(runner_label, True, True, 5) # Buttons self.versions_button = Gtk.Button("Manage versions") self.versions_button.set_size_request(120, 30) self.versions_button.set_valign(Gtk.Align.CENTER) self.versions_button.connect("clicked", self.on_versions_clicked, runner, runner_label) hbox.pack_start(self.versions_button, False, False, 5) self.install_button = Gtk.Button("Install") self.install_button.set_size_request(80, 30) self.install_button.set_valign(Gtk.Align.CENTER) self.install_button.connect("clicked", self.on_install_clicked, runner, runner_label) hbox.pack_start(self.install_button, False, False, 5) self.configure_button = Gtk.Button("Configure") self.configure_button.set_size_request(90, 30) self.configure_button.set_valign(Gtk.Align.CENTER) self.configure_button.connect("clicked", self.on_configure_clicked, runner, runner_label) hbox.pack_start(self.configure_button, False, False, 5) self.set_button_display(runner) return hbox
def add_runners(self): """Why the hell""" self.installed_runners = runners.get_installed() for runner in self.installed_runners: menu_item = Gtk.ImageMenuItem() menu_item.set_label(runner.human_name) runner_icon = get_runner_icon(runner.name, format='pixbuf', size=(16, 16)) menu_item.set_image(Gtk.Image.new_from_pixbuf(runner_icon)) menu_item.connect('activate', self.on_runner_selected, runner.name) self.menu.append(menu_item)
def add_runner(self, slug): name = runners.import_runner(slug).human_name icon = get_runner_icon(slug, format='pixbuf', size=(16, 16)) self.model.append(self.runner_node, ['runners', slug, icon, name, None])
def add_runner(self, slug): name = runners.import_runner(slug).human_name icon = get_runner_icon(slug, format='pixbuf', size=(16, 16)) self.model.append(self.runner_node, ['runners', slug, icon, name])