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


Python Gtk.get_minor_version方法代码示例

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


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

示例1: about

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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: update_preview_carets

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_version [as 别名]
def update_preview_carets(self, colorscheme):
        self.css_providers.caret.load_from_data((
            (Gtk.get_minor_version() >= 20 and """
            * {{
                caret-color: #{primary_caret_color};
                -gtk-secondary-caret-color: #{secondary_caret_color};
                -GtkWidget-cursor-aspect-ratio: {caret_aspect_ratio};
            }}
            """ or """
            * {{
                -GtkWidget-cursor-color: #{primary_caret_color};
                -GtkWidget-secondary-cursor-color: #{secondary_caret_color};
                -GtkWidget-cursor-aspect-ratio: {caret_aspect_ratio};
            }}
            """).format(
                primary_caret_color=colorscheme['CARET1_FG'],
                secondary_caret_color=colorscheme['CARET2_FG'],
                caret_aspect_ratio=colorscheme['CARET_SIZE']
            )
        ).encode('ascii'))
        Gtk.StyleContext.add_provider(
            self.gtk_preview.entry.get_style_context(),
            self.css_providers.caret,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
        ) 
开发者ID:themix-project,项目名称:oomox,代码行数:27,代码来源:preview.py

示例3: get_theme_css_provider

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_version [as 别名]
def get_theme_css_provider(self, theme_plugin):
        css_dir = theme_plugin.gtk_preview_dir

        css_name = "theme{}.css".format(
            '20' if Gtk.get_minor_version() >= 20 else ''
        )
        css_path = os.path.join(css_dir, css_name)
        if not os.path.exists(css_path):
            css_path = os.path.join(css_dir, "theme.css")

        css_provider = self.css_providers.theme.get(css_path)
        if css_provider:
            return css_provider
        css_provider = Gtk.CssProvider()
        try:
            css_provider.load_from_path(css_path)
        except GLib.Error as exc:  # pylint: disable=catching-non-exception
            print(exc)
        self.css_providers.theme[css_path] = css_provider
        return css_provider 
开发者ID:themix-project,项目名称:oomox,代码行数:22,代码来源:preview.py

示例4: _link

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_version [as 别名]
def _link(self, event, obj_type, handle):
        if button_activated(event, _LEFT_BUTTON):
            self.change_active((obj_type, handle))
        elif button_activated(event, _RIGHT_BUTTON):
            self.my_menu = Gtk.Menu()
            self.my_menu.append(self.build_menu_item(obj_type, handle))
            if Gtk.get_minor_version() >= 22:
                self.my_menu.popup_at_pointer(event)
            else:
                self.my_menu.popup(None, None, None, None,
                                   event.button, event.time) 
开发者ID:gramps-project,项目名称:addons-source,代码行数:13,代码来源:combinedview.py

示例5: get_monitor_workarea_at_point

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_version [as 别名]
def get_monitor_workarea_at_point(x, y):
    """Returns the workarea (Gdk.Rectangle) for the monitor at the given point"""
    display = Gdk.Display.get_default()
    if Gtk.get_minor_version() >= 22:
        monitor = display.get_monitor_at_point(x, y)
        return monitor.get_workarea()
    screen = display.get_default_screen()
    monitor_number = screen.get_monitor_at_point(x, y)
    return screen.get_monitor_workarea(monitor_number) 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:11,代码来源:gtk_utils.py

示例6: _setup_app_menu

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例7: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例8: undock

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例9: do_startup

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例10: set_dark_color

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例11: gtk_version

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例12: get_platform_info

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例13: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例14: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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

示例15: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_minor_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


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