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


Python Gtk.get_major_version方法代码示例

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


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

示例1: about

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def about(self, *args):
        dialog = Gtk.AboutDialog(transient_for=self)
        dialog.set_logo_icon_name('io.github.ImEditor')
        dialog.set_program_name('ImEditor')
        dialog.set_version('0.9.4')
        dialog.set_website('https://imeditor.github.io')
        dialog.set_authors(['Nathan Seva', 'Hugo Posnic'])
        gtk_version = '{}.{}.{}'.format(Gtk.get_major_version(),
            Gtk.get_minor_version(), Gtk.get_micro_version())
        comment = '{}\n\n'.format(_("Simple & versatile image editor"))
        comment += 'Gtk: {} Pillow: {}'.format(gtk_version, pil_version)
        dialog.set_comments(comment)
        text = _("Distributed under the GNU GPL(v3) license.\n")
        text += 'https://github.com/ImEditor/ImEditor/blob/master/LICENSE\n'
        dialog.set_license(text)
        dialog.run()
        dialog.destroy() 
开发者ID:ImEditor,项目名称:ImEditor,代码行数:19,代码来源:window.py

示例2: _setup_app_menu

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def _setup_app_menu(self):
        """Create the appmenu."""
        # Help section
        help_content = Gio.Menu.new()
        help_content.append_item(Gio.MenuItem.new(_("Night Mode"),
                                                  "app.night_mode"))
        if Gtk.get_major_version() >= 3 and Gtk.get_minor_version() >= 20:
            help_content.append_item(Gio.MenuItem.new(_("Keyboard Shortcuts"),
                                                      "app.shortcuts"))

        help_content.append_item(Gio.MenuItem.new(_("About Audio Cutter"), "app.about"))
        help_section = Gio.MenuItem.new_section(None, help_content)
        self.app_menu.append_item(help_section)

        # Night Mode action
        is_night_mode = Settings.get_default().is_night_mode
        is_night_mode = GLib.Variant.new_boolean(is_night_mode)
        action = Gio.SimpleAction.new_stateful("night_mode", None,
                                               is_night_mode)
        action.connect("change-state", self._on_night_mode)
        self.add_action(action)

        # Shortcuts action
        if Gtk.get_major_version() >= 3 and Gtk.get_minor_version() >= 20:
            action = Gio.SimpleAction.new("shortcuts", None)
            action.connect("activate", self._on_shortcuts)
            self.add_action(action)

        # About action
        action = Gio.SimpleAction.new("about", None)
        action.connect("activate", self._on_about)
        self.add_action(action)

        # Quit action
        action = Gio.SimpleAction.new("quit", None)
        action.connect("activate", self._on_quit)
        self.add_action(action) 
开发者ID:bilelmoussaoui,项目名称:Audio-Cutter,代码行数:39,代码来源:application.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def __init__(self, app):
        """Create the necessary objects and settings.

        Args:
            app: The main vimiv application to interact with.
        """
        datadir = os.path.join(get_user_data_dir(), "vimiv")
        os.makedirs(datadir, exist_ok=True)
        self._filename = os.path.join(datadir, "vimiv.log")
        self._terminal = sys.stderr
        # Redirect stderr in debug mode so it is written to the log file as well
        if app.debug:
            sys.stderr = self
        # Create a new log file at startup
        with open(self._filename, "w") as f:
            f.write("Vimiv log written to "
                    + self._filename.replace(os.getenv("HOME"), "~")
                    + "\n")
        self._write_separator()
        # Header containing version and Gtk version
        self.write_message("Version", app["information"].get_version())
        self.write_message("Python", sys.version.split()[0])
        gtk_version = str(Gtk.get_major_version()) + "." \
            + str(Gtk.get_minor_version()) + "." \
            + str(Gtk.get_micro_version())
        self.write_message("GTK", gtk_version)
        self._write_separator()
        # Start time
        self.write_message("Started", "time") 
开发者ID:karlch,项目名称:vimiv,代码行数:31,代码来源:log.py

示例4: undock

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def undock(self, widget):
        """ remove the widget from the leaf-notebook
            if this was the only widget, remove this leaf from its owner """

        gtk_version = (Gtk.get_major_version(), Gtk.get_minor_version())
        if gtk_version >= (3, 16):
            self.book.detach_tab(widget)
        else:
            # To not destroy accidentally our panel widget we need to add a reference to it
            # https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Container.html#Gtk.Container.remove
            widget._ref()
            self.book.remove(widget)

        for i, (widget_, title, id) in enumerate(self.panels):
            if widget_ == widget:
                break
        else:
            raise KeyError("No %s in %s" % (widget, self))
        del self.panels[i]

        if self.book.get_n_pages() == 0:
            parent = self.get_parent()
            while not isinstance(parent, PyDockComposite):
                parent = parent.get_parent()
            parent.removeComponent(self)
            self._del()

        return title, id 
开发者ID:pychess,项目名称:pychess,代码行数:30,代码来源:PyDockLeaf.py

示例5: do_startup

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def do_startup(self):
        Gtk.Application.do_startup(self)

        if self.purge_recent:
            items = recent_manager.get_items()
            for item in items:
                uri = item.get_uri()
                if item.get_application_info("pychess"):
                    recent_manager.remove_item(uri)

        self.git_rev = ""

        self.initGlade(self.log_viewer)
        self.addPerspectives()
        self.handleArgs(self.chess_file)
        if self.version_check:
            create_task(checkversion())

        self.loaded_cids = {}
        self.saved_cids = {}
        self.terminated_cids = {}

        log.info("PyChess %s %s git %s" % (VERSION_NAME, VERSION, self.git_rev))
        log.info("Command line args: '%s'" % self.chess_file)
        log.info("Platform: %s" % platform.platform())
        log.info("Python version: %s.%s.%s" % sys.version_info[0:3])
        log.info("Pyglib version: %s.%s.%s" % GLib.pyglib_version)
        log.info("Gtk version: %s.%s.%s" % (Gtk.get_major_version(),
                                            Gtk.get_minor_version(),
                                            Gtk.get_micro_version())) 
开发者ID:pychess,项目名称:pychess,代码行数:32,代码来源:Main.py

示例6: set_dark_color

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def set_dark_color(self, r, g, b, a):
		""" 
		Overrides background color, inverts icon colors and darkens some borders
		"""
		# Override background
		self.background = self.dark_color = (r, g, b, a)
		self.set_bg_color(*self.background)
		# Recolor existing widgets
		self.text_color = (1, 1, 1, 1)
		col = Gdk.RGBA(*self.text_color)
		for key in self.value_widgets:
			for w in self.value_widgets[key]:
				if isinstance(w, Gtk.Image):
					if (Gtk.get_major_version(), Gtk.get_minor_version()) <= (3, 10):
						# Mint....
						v1 = GObject.Value(int, 0)
						v2 = GObject.Value(int, 0)
						self.grid.child_get_property(w, "left-attach", v1)
						self.grid.child_get_property(w, "top-attach", v2)
						la, ta = v1.get_int(), v2.get_int()
					else:
						la = self.grid.child_get_property(w, "left-attach")
						ta = self.grid.child_get_property(w, "top-attach")
					vis = not w.get_no_show_all()
					wIcon = self._prepare_icon(self.icons[key])
					w.get_parent().remove(w)
					self.grid.attach(wIcon, la, ta, 1, 1)
					if not vis:
						wIcon.set_no_show_all(True)
						wIcon.set_visible(False)
					wValue, trash, wTitle = self.value_widgets[key]
					self.value_widgets[key] = (wValue, wIcon, wTitle)
				else:
					w.override_color(Gtk.StateFlags.NORMAL, col)
		# Recolor borders
		self.recolor()
		# Recolor header
		self.set_title(self.str_title) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:40,代码来源:infobox.py

示例7: gtk_version

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def gtk_version():
    """
    returns float of the major and minor parts of the GTK version
    e.g. return float(3.10)
    """

    return float(str(Gtk.get_major_version()) + "." +
                 str(Gtk.get_minor_version())) 
开发者ID:fossfreedom,项目名称:alternative-toolbar,代码行数:10,代码来源:alttoolbar_rb3compat.py

示例8: fill_clipboard

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def fill_clipboard(self, contents):
        """
        Copy text into the clipboard
        
        Usage: C{clipboard.fill_clipboard(contents)}
        
        @param contents: string to be placed in the selection
        """
        Gdk.threads_enter()
        if Gtk.get_major_version() >= 3:
            self.clipBoard.set_text(contents, -1)
        else:
            self.clipBoard.set_text(contents)
        Gdk.threads_leave() 
开发者ID:autokey,项目名称:autokey,代码行数:16,代码来源:scripting.py

示例9: get_platform_info

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def get_platform_info():
    from gi.repository import GObject
    from gi.repository import Gtk
    import yaml

    functions = [
        platform.machine,
        platform.platform,
        platform.processor,
        platform.python_version,
        platform.release,
        platform.system,
    ]
    names_values = [(func.__name__, func()) for func in functions]

    names_values.extend(
        [
            (
                "GTK",
                (
                    Gtk.get_major_version(),
                    Gtk.get_minor_version(),
                    Gtk.get_micro_version(),
                ),
            ),
            ("Glib", GObject.glib_version),
            ("PyGObject", GObject.pygobject_version),
            ("YAML", yaml.__version__),
        ]
    )

    vals = ["{}: {}".format(name, val) for name, val in names_values]
    return "System info: " + ", ".join(vals) 
开发者ID:jendrikseipp,项目名称:rednotebook,代码行数:35,代码来源:filesystem.py

示例10: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def __init__(self):

        setproctitle.setproctitle("GPT")
        self.install_dir = os.getcwd()
        self.user_app_dir = os.path.join(os.path.expanduser("~"),
                                         ".config",
                                         "gpt",
                                         )
        # create hidden app folder in user"s home directory if it does
        # not exist
        if not os.path.isdir(self.user_app_dir):
            os.makedirs(self.user_app_dir)

        # initiate GTK+ application
        GLib.set_prgname("GPT")

        # set up logging
        os.chdir(self.user_app_dir)
        self.log = logging.getLogger("gpt")
        with open(os.path.join(self.install_dir, "logging.yaml")) as f:
            config = yaml.load(f)
            logging.config.dictConfig(config)

        self.loglevels = {"critical": 50,
                          "error": 40,
                          "warning": 30,
                          "info": 20,
                          "debug": 10,
                          }

        # log version info for debugging
        self.log.debug("Application version: {}".format(__version__))
        self.log.debug("GTK+ version: {}.{}.{}".format(Gtk.get_major_version(),
                                                          Gtk.get_minor_version(),
                                                          Gtk.get_micro_version(),
                                                          ))
        self.log.debug(_("Application executed from {}").format(self.install_dir))

        self.locales_dir = os.path.join(self.install_dir, "po", "locale")
        self.appname = "GPT"

        # setting up localization
        locale.bindtextdomain(self.appname, self.locales_dir)
        locale.textdomain(self.locales_dir)
        gettext.bindtextdomain(self.appname, self.locales_dir)
        gettext.textdomain(self.appname)

        # check for config file to set up working directory
        # create file in case it does not exist
        self.config = os.path.join(self.user_app_dir, "config.py")
        self.defaultwdir = os.path.join(os.path.expanduser("~"), "GP")

        if os.path.isfile(self.config):
            self.readconfig()
        else:
            self.stdir = self.defaultwdir
            self.chkdir(self.stdir)
            self.createconfig(self.stdir)
            self.kd_supp = True

        self.show_message(_("Working directory: {}").format(self.stdir)) 
开发者ID:encarsia,项目名称:gpt,代码行数:63,代码来源:modules.py

示例11: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def __init__(self):
        self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL, title=_("Ask for permissions"))
        self.window.set_transient_for(mainwindow())
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        gtk_version = (Gtk.get_major_version(), Gtk.get_minor_version())
        if gtk_version >= (3, 12):
            vbox.props.margin_start = 9
            vbox.props.margin_end = 9
        else:
            vbox.props.margin_left = 9
            vbox.props.margin_right = 9
        vbox.props.margin_bottom = 9
        self.window.add(vbox)
        uistuff.keepWindowSize("externalsdialog", self.window, (320, 240), uistuff.POSITION_CENTER)

        label = Gtk.Label(_("Some PyChess features require further permission in order to download external components"))
        vbox.pack_start(label, True, True, 0)

        box = Gtk.Box()
        check_button = Gtk.CheckButton(_("database querying needs scoutfish"))
        check_button.set_active(conf.get("download_scoutfish"))
        check_button.connect("toggled", lambda w: conf.set("download_scoutfish", w.get_active()))
        box.add(check_button)
        link = "https://github.com/pychess/scoutfish"
        link_button = Gtk.LinkButton(link, link)
        box.add(link_button)
        vbox.pack_start(box, False, False, 0)

        box = Gtk.Box()
        check_button = Gtk.CheckButton(_("database opening tree needs chess_db"))
        check_button.set_active(conf.get("download_chess_db"))
        check_button.connect("toggled", lambda w: conf.set("download_chess_db", w.get_active()))
        box.add(check_button)
        link = "https://github.com/pychess/chess_db"
        link_button = Gtk.LinkButton(link, link)
        box.add(link_button)
        vbox.pack_start(box, False, False, 0)

        box = Gtk.Box()
        check_button = Gtk.CheckButton(_("ICC lag compensation needs timestamp"))
        check_button.set_active(conf.get("download_timestamp"))
        check_button.connect("toggled", lambda w: conf.set("download_timestamp", w.get_active()))
        box.add(check_button)
        link = "http://download.chessclub.com/timestamp/"
        link_button = Gtk.LinkButton(link, link)
        box.add(link_button)
        vbox.pack_start(box, False, False, 0)

        check_button = Gtk.CheckButton(_("Don't show this dialog on startup."))
        check_button.set_active(conf.get("dont_show_externals_at_startup"))
        check_button.connect("toggled", lambda w: conf.set("dont_show_externals_at_startup", w.get_active()))
        vbox.pack_start(check_button, True, True, 0)

        buttonbox = Gtk.ButtonBox()
        close_button = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
        close_button.connect("clicked", self.on_close_clicked)
        self.window.connect("delete_event", lambda w, a: self.window.destroy())
        buttonbox.add(close_button)
        vbox.pack_start(buttonbox, False, False, 0) 
开发者ID:pychess,项目名称:pychess,代码行数:61,代码来源:ExternalsDialog.py

示例12: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def __init__(self, gladepath="/usr/share/syncthing-gtk",
						iconpath="/usr/share/syncthing-gtk/icons"):
		Gtk.Application.__init__(self,
				application_id="me.kozec.syncthingtk",
				flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
		TimerManager.__init__(self)
		# Setup Gtk.Application
		self.setup_commandline()
		# Set variables
		self.gladepath = gladepath
		self.iconpath = iconpath
		self.builder = None
		self.rightclick_box = None
		self.config = Configuration()
		self.process = None
		self.hide_window = self.config["minimize_on_start"]
		self.show_status_icon = True
		self.exit_after_wizard = False
		self.last_restart_time = 0.0
		# Can be changed by --force-update=vX.Y.Z argument
		self.force_update_version = None
		# Determine if header bar should be shown
		# User setting is not visible under Unity/Gnome
		self.use_headerbar = (
			not IS_UNITY and (not self.config["use_old_header"] or IS_GNOME)
			and (Gtk.get_major_version(), Gtk.get_minor_version()) >= (3, 10) )

		self.daemon = None	# Created by setup_connection method
		# If enabled (by -o argument), daemon output is captured and printed
		# to stdout
		self.dump_daemon_output = None
		self.notifications = None
		# connect_dialog may be displayed during initial communication
		# or if daemon shuts down.
		self.connect_dialog = None
		# Used when upgrading from incompatible version
		self.restart_after_update = None
		self.dark_color = None			# RGBA. None by default, changes with dark themes
		self.recv_limit = -1			# Used mainly to prevent menu handlers from recursing
		self.send_limit = -1			# -//-
		self.ur_question_shown = False	# Used to prevent showing 'Do you want usage reporting'
										# question more than once until ST-GTK is restarted.
		self.home_dir_override = None	# If set by '--home'
		self.wizard = None
		self.widgets = {}
		self.error_boxes = []
		self.error_messages = set([])	# Holds set of already displayed error messages
		self.folders = {}
		self.devices = {}
		self.open_boxes = set([])		# Holds set of expanded device/folder boxes
		self.devices_never_loaded = True
		self.folders_never_loaded = True
		self.sync_animation = 0

		self.editor_device = None
		self.editor_folder = None 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:58,代码来源:app.py

示例13: setup_widgets

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def setup_widgets(self):
		self.builder = UIBuilder()
		# Set conditions for UIBuilder
		old_gtk = ((Gtk.get_major_version(), Gtk.get_minor_version()) < (3, 12)) and not IS_WINDOWS
		icons_in_menu = self.config["icons_in_menu"]
		if self.use_headerbar: 		self.builder.enable_condition("header_bar")
		if not self.use_headerbar:	self.builder.enable_condition("traditional_header")
		if IS_WINDOWS: 				self.builder.enable_condition("is_windows")
		if IS_GNOME:  				self.builder.enable_condition("is_gnome")
		if old_gtk:					self.builder.enable_condition("old_gtk")
		if icons_in_menu:			self.builder.enable_condition("icons_in_menu")
		# Fix icon path
		self.builder.replace_icon_path("icons/", self.iconpath)
		# Load glade file
		self.builder.add_from_file(os.path.join(self.gladepath, "app.glade"))
		self.builder.connect_signals(self)
		# Dunno how to do this from glade
		if self.use_headerbar and IS_GNOME:
			self.set_app_menu(self["app-menu"])
		
		# Create speedlimit submenus for incoming and outcoming speeds
		L_MEH = [("menu-si-sendlimit", self.cb_menu_sendlimit),
				 ("menu-si-recvlimit", self.cb_menu_recvlimit)]
		for limitmenu, eventhandler in L_MEH:
			submenu = self["%s-sub" % (limitmenu,)]
			for speed in SPEED_LIMIT_VALUES:
				menuitem = Gtk.CheckMenuItem(_("%s kB/s") % (speed,))
				item_id = "%s-%s" % (limitmenu, speed)
				menuitem.connect('activate', eventhandler, speed)
				self[item_id] = menuitem
				submenu.add(menuitem)
			self[limitmenu].show_all()
		
		if not old_gtk:
			if not self["edit-menu-icon"] is None:
				if not Gtk.IconTheme.get_default().has_icon(self["edit-menu-icon"].get_icon_name()[0]):
					# If requested icon is not found in default theme, replace it with emblem-system-symbolic
					self["edit-menu-icon"].set_from_icon_name("emblem-system-symbolic", self["edit-menu-icon"].get_icon_name()[1])
		
		# Set window title in way that even Gnome can understand
		icon = os.path.join(self.iconpath, "syncthing-gtk.png")
		self["window"].set_title(_("Syncthing-GTK"))
		self["window"].set_wmclass("Syncthing GTK", "Syncthing GTK")
		if os.path.exists(icon):
			self["window"].set_icon(GdkPixbuf.Pixbuf.new_from_file(icon))
		self.add_window(self["window"]) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:48,代码来源:app.py

示例14: main

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def main(argv = sys.argv[1:]):
    """ Entry point of pympress. Parse command line arguments, instantiate the UI, and start the main loop.
    """
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    # prefere X11 on posix systems because Wayland still has some shortcomings for us,
    # specifically libVLC and the ability to disable screensavers
    if util.IS_POSIX:
        Gdk.set_allowed_backends('x11,*')
    Gtk.init(argv)

    pympress_meta = util.get_pympress_meta()['version']
    logger.info(' '.join([
        'Pympress:', pympress_meta,
        '; Python:', platform.python_version(),
        '; OS:', platform.system(), platform.release(), platform.version(),
        '; Gtk {}.{}.{}'.format(Gtk.get_major_version(), Gtk.get_minor_version(), Gtk.get_micro_version()),
        '; GLib {}.{}.{}'.format(GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION),
        '; Poppler', document.Poppler.get_version(), document.Poppler.get_backend().value_nick,
        '; Cairo', ui.cairo.cairo_version_string(), ', pycairo', ui.cairo.version,
        '; Media:', extras.Media.backend_version()
    ]))

    try:
        opts, args = getopt.getopt(argv, "hn:t:", ["help", "notes=", "talk-time=", "log="])
        opts = dict(opts)
    except getopt.GetoptError:
        usage()
        sys.exit(2)

    ett, log_level, notes_pos = parse_opts(opts)
    logger.setLevel(log_level)

    # Create windows
    gui = ui.UI()

    # Connect proper exit function to interrupt
    signal.signal(signal.SIGINT, gui.save_and_quit)

    # pass command line args
    if ett:
        gui.est_time.set_time(ett)

    gui.swap_document(os.path.abspath(args[0])) if args else gui.pick_file()

    if notes_pos is not None:
        gui.change_notes_pos(notes_pos, force_change = True)

    gui.run() 
开发者ID:Cimbali,项目名称:pympress,代码行数:51,代码来源:__main__.py

示例15: gtkui_dependency_check

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_major_version [as 别名]
def gtkui_dependency_check():
    '''
    This function verifies that the dependencies that are needed by the GTK user interface are met.
    '''

    print('\tGTK UI dependencies...', end='')

    # Check Gtk
    try:
        import gi
        gi.require_version('Gtk', '3.0')
        from gi.repository import Gtk
        from gi.repository import GObject
        assert Gtk.get_major_version() >= 3
        print(common.console_color('\tOK', 'green'))
    except:
        print(common.console_color("\tD'oh!", 'red'))
        print('You have to install GTK+3 and PyGObject version >= 3.0 to be able to '
                'run the GTK user interface.\n'
                '    - On Debian-based distributions: apt-get install python-gi\n'
                '    - On Mac: brew install pygobject3')
        sys.exit(1)

    # Check GtkSourceView
    try:
        print('\tGtkSourceView3...', end='')
        gi.require_version('GtkSource', '3.0')
        from gi.repository import GtkSource
        print(common.console_color('\tOK', 'green'))
    except:
        print(common.console_color("\tD'oh!", 'red'))
        print('GtkSourceView3 not installed! Install it for your platform:\n'
                '    - On Debian-based distributions: apt-get install gir1.2-gtksource-3.0')
        sys.exit(1)

    # Check PyCairo for GTK+.
    try:
        print('\tPython Cairo bindings...', end='')
        gi.require_version('PangoCairo', '1.0')
        from gi.repository import PangoCairo
        print(common.console_color('\tOK', 'green'))
    except:
        print(common.console_color("\tD'oh!", 'red'))
        print('Python Cairo bindings for GObject not installed! Install them for your platform:\n'
                '    - On Debian-based distributions: apt-get install python-gi-cairo')
        sys.exit(1) 
开发者ID:inguma,项目名称:bokken,代码行数:48,代码来源:dependency_check.py


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