当前位置: 首页>>代码示例>>Python>>正文


Python DownloadProgressBox.start方法代码示例

本文整理汇总了Python中lutris.gui.widgets.DownloadProgressBox.start方法的典型用法代码示例。如果您正苦于以下问题:Python DownloadProgressBox.start方法的具体用法?Python DownloadProgressBox.start怎么用?Python DownloadProgressBox.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lutris.gui.widgets.DownloadProgressBox的用法示例。


在下文中一共展示了DownloadProgressBox.start方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DownloadDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class DownloadDialog(Gtk.Dialog):
    """ Dialog showing a download in progress. """

    def __init__(self, url, dest):
        super(DownloadDialog, self).__init__("Downloading file")
        self.set_size_request(560, 100)
        params = {'url': url, 'dest': dest}
        self.download_progress_box = DownloadProgressBox(params)
        self.download_progress_box.connect('complete',
                                           self.download_complete)
        self.download_progress_box.connect('cancelrequested',
                                           self.download_cancelled)
        label = Gtk.Label(label='Downloading %s' % url)
        label.set_selectable(True)
        label.set_padding(0, 0)
        label.set_alignment(0.0, 1.0)
        self.vbox.pack_start(label, True, True, 0)
        self.vbox.pack_start(self.download_progress_box, True, False, 0)
        self.show_all()
        self.download_progress_box.start()

    def download_complete(self, _widget, _data):
        self.destroy()

    def download_cancelled(self, _widget, data):
        self.destroy()
开发者ID:Kehlyos,项目名称:lutris,代码行数:28,代码来源:dialogs.py

示例2: DownloadDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class DownloadDialog(Gtk.Dialog):
    """Dialog showing a download in progress."""
    def __init__(self, url=None, dest=None, title=None, label=None,
                 downloader=None):
        Gtk.Dialog.__init__(self, title or "Downloading file")
        self.set_size_request(485, 104)
        self.set_border_width(12)
        params = {'url': url,
                  'dest': dest,
                  'title': label or "Downloading %s" % url}
        self.download_box = DownloadProgressBox(params, downloader=downloader)

        self.download_box.connect('complete', self.download_complete)
        self.download_box.connect('cancel', self.download_cancelled)
        self.connect('response', self.on_response)

        self.get_content_area().add(self.download_box)
        self.show_all()
        self.download_box.start()

    def download_complete(self, _widget, _data):
        self.response(Gtk.ResponseType.OK)
        self.destroy()

    def download_cancelled(self, _widget, data):
        self.response(Gtk.ResponseType.CANCEL)
        self.destroy()

    def on_response(self, dialog, response):
        if response == Gtk.ResponseType.DELETE_EVENT:
            self.download_box.downloader.cancel()
            self.destroy()
开发者ID:Freso,项目名称:lutris,代码行数:34,代码来源:dialogs.py

示例3: DownloadDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class DownloadDialog(Gtk.Dialog):
    """ Dialog showing a download in progress. """

    def __init__(self, url, dest):
        super(DownloadDialog, self).__init__("Downloading file")
        self.set_size_request(485, 104)
        self.set_border_width(12)
        params = {'url': url, 'dest': dest, 'title': 'Downloading %s' % url}
        self.download_progress_box = DownloadProgressBox(params)
        self.download_progress_box.connect('complete',
                                           self.download_complete)
        self.download_progress_box.connect('cancelrequested',
                                           self.download_cancelled)
        self.vbox.pack_start(self.download_progress_box, True, False, 0)
        self.show_all()
        self.download_progress_box.start()

    def download_complete(self, _widget, _data):
        self.destroy()

    def download_cancelled(self, _widget, data):
        self.destroy()
开发者ID:regoecuaycong,项目名称:lutris,代码行数:24,代码来源:dialogs.py

示例4: InstallerDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class InstallerDialog(Gtk.Window):
    """ Gtk Dialog used during the install process """
    game_dir = None
    download_progress = None

    def __init__(self, game_ref, parent=None):
        Gtk.Window.__init__(self)
        self.parent = parent
        self.game_ref = game_ref
        # Dialog properties
        self.set_size_request(600, 480)
        self.set_default_size(600, 480)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(False)

        self.vbox = Gtk.VBox()
        self.add(self.vbox)

        # Default signals
        self.connect('destroy', self.on_destroy)

        # Interpreter
        self.interpreter = ScriptInterpreter(game_ref, self)
        if not self.interpreter.script:
            return

        # GUI Setup

        # Title label
        title_label = Gtk.Label()
        game_name = self.interpreter.game_name
        title_label.set_markup("<b>Installing {}</b>".format(game_name))
        self.vbox.pack_start(title_label, False, False, 20)

        self.status_label = Gtk.Label()
        self.status_label.set_max_width_chars(80)
        self.status_label.set_property('wrap', True)
        self.status_label.set_selectable(True)
        self.vbox.pack_start(self.status_label, False, False, 15)

        # Main widget box
        self.widget_box = Gtk.VBox()
        self.widget_box.set_margin_right(25)
        self.widget_box.set_margin_left(25)
        self.vbox.pack_start(self.widget_box, True, True, 15)

        self.location_entry = None

        # Separator
        self.vbox.pack_start(Gtk.HSeparator(), False, False, 0)

        # Buttons
        action_buttons_alignment = Gtk.Alignment.new(0.95, 0, 0.15, 0)
        self.action_buttons = Gtk.HBox()
        action_buttons_alignment.add(self.action_buttons)
        self.vbox.pack_start(action_buttons_alignment, False, True, 20)

        self.install_button = Gtk.Button(label='Install')
        self.install_button.connect('clicked', self.on_install_clicked)
        self.action_buttons.add(self.install_button)

        self.continue_button = Gtk.Button(label='Continue')
        self.continue_button.set_margin_left(20)
        self.continue_button.connect('clicked', self.on_file_selected)
        self.action_buttons.add(self.continue_button)

        self.play_button = Gtk.Button(label="Launch game")
        self.play_button.set_margin_left(20)
        self.play_button.connect('clicked', self.launch_game)
        self.action_buttons.add(self.play_button)

        self.close_button = Gtk.Button(label="Close")
        self.close_button.set_margin_left(20)
        self.close_button.connect('clicked', self.close)
        self.action_buttons.add(self.close_button)

        # Target chooser
        if not self.interpreter.requires and self.interpreter.files:
            self.set_message("Select installation directory")
            default_path = self.interpreter.default_target
            self.set_location_entry(self.on_target_changed, 'folder',
                                    default_path)
            self.non_empty_label = Gtk.Label()
            self.non_empty_label.set_markup(
                "<b>Warning!</b> The selected path "
                "contains files, installation might not work property."
            )
            self.widget_box.pack_start(self.non_empty_label, False, False, 10)
        else:
            self.set_message("Click install to continue")
        self.show_all()
        self.continue_button.hide()
        self.close_button.hide()
        self.play_button.hide()
        self.show_non_empty_warning()

    def on_destroy(self, widget):
        self.interpreter.cleanup()
        if self.parent:
            self.destroy()
#.........这里部分代码省略.........
开发者ID:nsteenv,项目名称:lutris,代码行数:103,代码来源:installer.py

示例5: InstallerDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class InstallerDialog(Gtk.Window):
    """ Gtk Dialog used during the install process """
    game_dir = None
    download_progress = None

    def __init__(self, game_ref, parent=None):
        Gtk.Window.__init__(self)
        self.interpreter = None
        self.selected_directory = None  # Latest directory chosen by user
        self.parent = parent
        self.game_ref = game_ref
        # Dialog properties
        self.set_size_request(600, 480)
        self.set_default_size(600, 480)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(False)

        self.vbox = Gtk.VBox()
        self.add(self.vbox)

        # Default signals
        self.connect('destroy', self.on_destroy)

        # GUI Setup

        # Title label
        self.title_label = Gtk.Label()
        self.vbox.pack_start(self.title_label, False, False, 20)

        self.status_label = Gtk.Label()
        self.status_label.set_max_width_chars(80)
        self.status_label.set_property('wrap', True)
        self.status_label.set_selectable(True)
        self.vbox.pack_start(self.status_label, False, False, 15)

        # Main widget box
        self.widget_box = Gtk.VBox()
        self.widget_box.set_margin_right(25)
        self.widget_box.set_margin_left(25)
        self.vbox.pack_start(self.widget_box, True, True, 15)

        self.location_entry = None

        # Separator
        self.vbox.pack_start(Gtk.HSeparator(), False, False, 0)

        # Buttons
        action_buttons_alignment = Gtk.Alignment.new(0.95, 0, 0.15, 0)
        self.action_buttons = Gtk.HBox()
        action_buttons_alignment.add(self.action_buttons)
        self.vbox.pack_start(action_buttons_alignment, False, True, 20)

        self.install_button = Gtk.Button(label='Install')
        self.install_button.connect('clicked', self.on_install_clicked)
        self.action_buttons.add(self.install_button)

        self.continue_button = Gtk.Button(label='Continue')
        self.continue_button.set_margin_left(20)
        self.continue_handler = None
        self.action_buttons.add(self.continue_button)

        self.play_button = Gtk.Button(label="Launch game")
        self.play_button.set_margin_left(20)
        self.play_button.connect('clicked', self.launch_game)
        self.action_buttons.add(self.play_button)

        self.close_button = Gtk.Button(label="Close")
        self.close_button.set_margin_left(20)
        self.close_button.connect('clicked', self.close)
        self.action_buttons.add(self.close_button)

        if os.path.isfile(game_ref):
            # local script
            logger.debug("Opening script: %s", game_ref)
            self.scripts = yaml.safe_load(open(game_ref, 'r').read())
        else:
            self.scripts = installer.fetch_script(self, game_ref)
        if not self.scripts:
            self.destroy()
            return
        if not isinstance(self.scripts, list):
            self.scripts = [self.scripts]
        self.show_all()
        self.close_button.hide()
        self.play_button.hide()
        self.install_button.hide()

        self.choose_installer()

    def launch_install(self, script_index):
        script = self.scripts[script_index]
        self.interpreter = installer.ScriptInterpreter(script, self)
        game_name = self.interpreter.game_name.replace('&', '&amp;')
        self.title_label.set_markup("<b>Installing {}</b>".format(game_name))
        self.continue_install()

    def continue_install(self):
        # Target chooser
        if not self.interpreter.requires and self.interpreter.files:
            self.set_message("Select installation directory")
#.........这里部分代码省略.........
开发者ID:Xodetaetl,项目名称:lutris,代码行数:103,代码来源:installgamedialog.py

示例6: InstallerDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class InstallerDialog(Gtk.Window):
    """GUI for the install process."""
    game_dir = None
    download_progress = None

    def __init__(self, game_slug=None, installer_file=None, revision=None, parent=None):
        Gtk.Window.__init__(self)
        self.set_default_icon_name('lutris')
        self.interpreter = None
        self.selected_directory = None  # Latest directory chosen by user
        self.parent = parent
        self.game_slug = game_slug
        self.installer_file = installer_file
        self.revision = revision
        # Dialog properties
        self.set_size_request(600, 480)
        self.set_default_size(600, 480)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(False)

        self.vbox = Gtk.VBox()
        self.add(self.vbox)

        # Default signals
        self.connect('destroy', self.on_destroy)

        # GUI Setup

        # Title label
        self.title_label = Gtk.Label()
        self.vbox.pack_start(self.title_label, False, False, 20)

        self.status_label = Gtk.Label()
        self.status_label.set_max_width_chars(80)
        self.status_label.set_property('wrap', True)
        self.status_label.set_selectable(True)
        self.vbox.pack_start(self.status_label, False, False, 15)

        # Main widget box
        self.widget_box = Gtk.VBox()
        self.widget_box.set_margin_right(25)
        self.widget_box.set_margin_left(25)
        self.vbox.pack_start(self.widget_box, True, True, 15)

        self.location_entry = None

        # Separator
        self.vbox.pack_start(Gtk.HSeparator(), False, False, 0)

        # Buttons
        action_buttons_alignment = Gtk.Alignment.new(0.95, 0, 0.15, 0)
        self.action_buttons = Gtk.HBox()
        action_buttons_alignment.add(self.action_buttons)
        self.vbox.pack_start(action_buttons_alignment, False, True, 20)

        self.cancel_button = Gtk.Button.new_with_mnemonic("C_ancel")
        self.cancel_button.set_tooltip_text("Abort and revert the "
                                            "installation")
        self.cancel_button.connect('clicked', self.on_cancel_clicked)
        self.action_buttons.add(self.cancel_button)

        self.eject_button = self.add_button("_Eject", self.on_eject_clicked)
        self.install_button = self.add_button("_Install", self.on_install_clicked)
        self.continue_button = self.add_button("_Continue")
        self.play_button = self.add_button("_Launch game", self.launch_game)
        self.close_button = self.add_button("_Close", self.close)

        self.continue_handler = None

        self.get_scripts()

        # l33t haxx to make Window.present() actually work.
        self.set_keep_above(True)
        self.present()
        self.set_keep_above(False)
        self.present()

    def add_button(self, label, handler=None):
        button = Gtk.Button.new_with_mnemonic(label)
        button.set_margin_left(20)
        if handler:
            button.connect('clicked', handler)
        self.action_buttons.add(button)
        return button

    # ---------------------------
    # "Get installer" stage
    # ---------------------------

    def get_scripts(self):
        if system.path_exists(self.installer_file):
            # local script
            logger.debug("Opening script: %s", self.installer_file)
            scripts = yaml.safe_load(open(self.installer_file, 'r').read())
            self.on_scripts_obtained(scripts)
        else:
            jobs.AsyncCall(interpreter.fetch_script, self.on_scripts_obtained,
                           self.game_slug, self.revision)

    def on_scripts_obtained(self, scripts, _error=None):
#.........这里部分代码省略.........
开发者ID:RobLoach,项目名称:lutris,代码行数:103,代码来源:installgamedialog.py

示例7: InstallerDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class InstallerDialog(Gtk.Window):
    """GUI for the install process."""

    game_dir = None
    download_progress = None

    def __init__(self, game_ref, parent=None):
        Gtk.Window.__init__(self)
        self.interpreter = None
        self.selected_directory = None  # Latest directory chosen by user
        self.parent = parent
        self.game_ref = game_ref
        # Dialog properties
        self.set_size_request(600, 480)
        self.set_default_size(600, 480)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(False)

        self.vbox = Gtk.VBox()
        self.add(self.vbox)

        # Default signals
        self.connect("destroy", self.on_destroy)

        # GUI Setup

        # Title label
        self.title_label = Gtk.Label()
        self.vbox.pack_start(self.title_label, False, False, 20)

        self.status_label = Gtk.Label()
        self.status_label.set_max_width_chars(80)
        self.status_label.set_property("wrap", True)
        self.status_label.set_selectable(True)
        self.vbox.pack_start(self.status_label, False, False, 15)

        # Main widget box
        self.widget_box = Gtk.VBox()
        self.widget_box.set_margin_right(25)
        self.widget_box.set_margin_left(25)
        self.vbox.pack_start(self.widget_box, True, True, 15)

        self.location_entry = None

        # Separator
        self.vbox.pack_start(Gtk.HSeparator(), False, False, 0)

        # Buttons
        action_buttons_alignment = Gtk.Alignment.new(0.95, 0, 0.15, 0)
        self.action_buttons = Gtk.HBox()
        action_buttons_alignment.add(self.action_buttons)
        self.vbox.pack_start(action_buttons_alignment, False, True, 20)

        self.cancel_button = Gtk.Button.new_with_mnemonic("C_ancel")
        self.cancel_button.set_tooltip_text("Abort and revert the " "installation")
        self.cancel_button.connect("clicked", self.on_cancel_clicked)
        self.action_buttons.add(self.cancel_button)

        self.install_button = Gtk.Button.new_with_mnemonic("_Install")
        self.install_button.set_margin_left(20)
        self.install_button.connect("clicked", self.on_install_clicked)
        self.action_buttons.add(self.install_button)

        self.continue_button = Gtk.Button.new_with_mnemonic("_Continue")
        self.continue_button.set_margin_left(20)
        self.continue_handler = None
        self.action_buttons.add(self.continue_button)

        self.play_button = Gtk.Button.new_with_mnemonic("_Launch game")
        self.play_button.set_margin_left(20)
        self.play_button.connect("clicked", self.launch_game)
        self.action_buttons.add(self.play_button)

        self.close_button = Gtk.Button.new_with_mnemonic("_Close")
        self.close_button.set_margin_left(20)
        self.close_button.connect("clicked", self.close)
        self.action_buttons.add(self.close_button)

        self.get_scripts()

    # ---------------------------
    # "Get installer" stage
    # ---------------------------

    def get_scripts(self):
        if os.path.isfile(self.game_ref):
            # local script
            logger.debug("Opening script: %s", self.game_ref)
            scripts = yaml.safe_load(open(self.game_ref, "r").read())
            self.on_scripts_obtained(scripts)
        else:
            jobs.AsyncCall(interpreter.fetch_script, self.on_scripts_obtained, self.game_ref)

    def on_scripts_obtained(self, scripts, _error=None):
        if self.parent:
            display.set_cursor("default", self.parent.window.get_window())
        if not scripts:
            self.destroy()
            self.run_no_installer_dialog()
            return
#.........这里部分代码省略.........
开发者ID:dacp17,项目名称:lutris,代码行数:103,代码来源:installgamedialog.py

示例8: InstallerDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class InstallerDialog(Gtk.Window):
    """ Gtk Dialog used during the install process """
    game_dir = None
    download_progress = None

    # # Fetch assets
    # banner_url = settings.INSTALLER_URL + '%s.jpg' % self.game_slug
    # banner_dest = join(settings.DATA_DIR, "banners/%s.jpg" % self.game_slug)
    # http.download_asset(banner_url, banner_dest, True)
    # icon_url = settings.INSTALLER_URL + 'icon/%s.jpg' % self.game_slug
    # icon_dest = join(settings.DATA_DIR, "icons/%s.png" % self.game_slug)
    # http.download_asset(icon_url, icon_dest, True)

    def __init__(self, game_ref, parent=None):
        Gtk.Window.__init__(self)
        self.parent = parent
        self.game_ref = game_ref
        # Dialog properties
        self.set_size_request(600, 480)
        self.set_default_size(600, 480)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(False)

        self.vbox = Gtk.VBox()
        self.add(self.vbox)

        # Default signals
        self.connect('destroy', self.on_destroy)

        # Interpreter
        self.interpreter = ScriptInterpreter(game_ref, self)

        ## GUI Setup

        # Title label
        title_label = Gtk.Label()
        game_name = self.interpreter.game_name
        title_label.set_markup("<b>Installing {}</b>".format(game_name))
        self.vbox.pack_start(title_label, False, False, 20)

        self.status_label = Gtk.Label()
        self.vbox.pack_start(self.status_label, False, False, 15)

        # Main widget box
        self.widget_box = Gtk.VBox()
        self.widget_box.set_margin_right(25)
        self.widget_box.set_margin_left(25)
        self.vbox.pack_start(self.widget_box, True, True, 15)

        # Separator
        self.vbox.pack_start(Gtk.HSeparator(), False, False, 0)

        # Install button
        self.install_button = Gtk.Button('Install')
        self.install_button.connect('clicked', self.on_install_clicked)

        action_buttons_alignment = Gtk.Alignment.new(0.95, 0, 0.15, 0)
        self.action_buttons = Gtk.HBox()
        action_buttons_alignment.add(self.action_buttons)
        self.action_buttons.add(self.install_button)

        self.vbox.pack_start(action_buttons_alignment, False, False, 25)

        # Target chooser
        if not self.interpreter.requires and self.interpreter.files:
            # Top label
            label = Gtk.Label()
            label.set_markup('<b>Select installation directory:</b>')
            label.set_alignment(0, 0)
            self.widget_box.pack_start(label, False, False, 10)
            default_path = self.interpreter.default_target
            location_entry = FileChooserEntry(default=default_path)
            location_entry.entry.connect('changed', self.on_target_changed)
            self.widget_box.pack_start(location_entry, False, False, 0)
        else:
            label = Gtk.Label("Click install to continue")
        self.show_all()

    def on_destroy(self, widget):
        if self.parent:
            self.destroy()
        else:
            Gtk.main_quit()

    def on_target_changed(self, text_entry):
        """ Sets the installation target for the game """
        self.interpreter.target_path = text_entry.get_text()

    def on_install_clicked(self, button):
        button.set_sensitive(False)
        self.interpreter.iter_game_files()

    def ask_user_for_file(self, message=None):
        dlg = FileDialog(message)
        filename = getattr(dlg, 'filename', '')
        return filename

    def clean_widgets(self):
        for child_widget in self.widget_box.get_children():
            child_widget.destroy()
#.........这里部分代码省略.........
开发者ID:Cybolic,项目名称:lutris,代码行数:103,代码来源:installer.py

示例9: InstallerDialog

# 需要导入模块: from lutris.gui.widgets import DownloadProgressBox [as 别名]
# 或者: from lutris.gui.widgets.DownloadProgressBox import start [as 别名]
class InstallerDialog(Gtk.Window):
    """ Gtk Dialog used during the install process """
    game_dir = None
    download_progress = None

    def __init__(self, game_ref, parent=None):
        Gtk.Window.__init__(self)
        self.interpreter = None
        self.selected_directory = None  # Latest directory chosen by user
        self.parent = parent
        self.game_ref = game_ref
        # Dialog properties
        self.set_size_request(600, 480)
        self.set_default_size(600, 480)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(False)

        self.vbox = Gtk.VBox()
        self.add(self.vbox)

        # Default signals
        self.connect('destroy', self.on_destroy)

        # GUI Setup

        # Title label
        self.title_label = Gtk.Label()
        self.vbox.pack_start(self.title_label, False, False, 20)

        self.status_label = Gtk.Label()
        self.status_label.set_max_width_chars(80)
        self.status_label.set_property('wrap', True)
        self.status_label.set_selectable(True)
        self.vbox.pack_start(self.status_label, False, False, 15)

        # Main widget box
        self.widget_box = Gtk.VBox()
        self.widget_box.set_margin_right(25)
        self.widget_box.set_margin_left(25)
        self.vbox.pack_start(self.widget_box, True, True, 15)

        self.location_entry = None

        # Separator
        self.vbox.pack_start(Gtk.HSeparator(), False, False, 0)

        # Buttons
        action_buttons_alignment = Gtk.Alignment.new(0.95, 0, 0.15, 0)
        self.action_buttons = Gtk.HBox()
        action_buttons_alignment.add(self.action_buttons)
        self.vbox.pack_start(action_buttons_alignment, False, True, 20)

        self.install_button = Gtk.Button(label='Install')
        self.install_button.connect('clicked', self.on_install_clicked)
        self.action_buttons.add(self.install_button)

        self.continue_button = Gtk.Button(label='Continue')
        self.continue_button.set_margin_left(20)
        self.continue_handler = None
        self.action_buttons.add(self.continue_button)

        self.play_button = Gtk.Button(label="Launch game")
        self.play_button.set_margin_left(20)
        self.play_button.connect('clicked', self.launch_game)
        self.action_buttons.add(self.play_button)

        self.close_button = Gtk.Button(label="Close")
        self.close_button.set_margin_left(20)
        self.close_button.connect('clicked', self.close)
        self.action_buttons.add(self.close_button)

        if os.path.exists(game_ref):
            # local script
            logger.debug("Opening script: %s", game_ref)
            self.scripts = yaml.safe_load(open(game_ref, 'r').read())
        else:
            self.scripts = fetch_script(self, game_ref)
        if not self.scripts:
            return

        self.show_all()
        self.close_button.hide()
        self.play_button.hide()
        self.install_button.hide()

        self.choose_installer()

    def launch_install(self, script_index):
        script = self.scripts[script_index]
        self.interpreter = ScriptInterpreter(script, self)
        game_name = self.interpreter.game_name.replace('&', '&amp;')
        self.title_label.set_markup("<b>Installing {}</b>".format(game_name))

        # CDrom check
        if self.interpreter.requires_disc:
            self.insert_disc()
        else:
            self.continue_install()

    def insert_disc(self):
#.........这里部分代码省略.........
开发者ID:Kehlyos,项目名称:lutris,代码行数:103,代码来源:installer.py


注:本文中的lutris.gui.widgets.DownloadProgressBox.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。