Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

beebox / crossover   deb

Repository URL to install this package:

Version: 18.5.0-1 

/ opt / cxoffice / lib / python / cxwaitui.py

# (c) Copyright 2009-2015. CodeWeavers, Inc.

import gobject
gobject.threads_init()
import gtk

import cxutils

import cxguitools


class WaitDialogController(object):

    def __init__(self, options, args):
        self.xml = gtk.Builder()
        self.xml.set_translation_domain("crossover")
        self.xml.add_from_file(cxguitools.get_ui_path("cxwait"))
        self.xml.connect_signals(self)

        # We have a c-style string format, and need to convert it.
        message_format = cxutils.cxgettext(args[0])
        try:
            message = message_format % tuple(args[1:])
        except TypeError:
            message = message_format

        window = self.xml.get_object("WaitDialog")
        window.set_property('focus-on-map', not options.nofocus)

        # Set up title
        if options.title:
            window.set_title(cxutils.cxgettext(options.title))

        # Set up image
        if options.image:
            image = self.xml.get_object("WaitImage")
            if '/' in options.image:
                image.set_from_file(options.image)
            else:
                image.set_from_pixbuf(cxguitools.get_std_icon(options.image))

        # Set up progress bar
        prog_bar = self.xml.get_object("ProgBar")
        prog_bar.set_pulse_step(.05)
        gobject.timeout_add(100, self.prog_bar_pulse)
        prog_bar.show()

        # Fill Message Text
        msg_widget = self.xml.get_object("WaitMessage")
        msg_widget.set_text(message)

        cxguitools.set_default_icon()
        window.show()


    def quit_requested(self, caller):
        # pylint: disable=R0201,W0613
        gtk.main_quit()

    def prog_bar_pulse(self):
        prog_bar = self.xml.get_object("ProgBar")
        prog_bar.pulse()
        return True