本文整理汇总了Python中gi.repository.GObject.pygobject_version方法的典型用法代码示例。如果您正苦于以下问题:Python GObject.pygobject_version方法的具体用法?Python GObject.pygobject_version怎么用?Python GObject.pygobject_version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GObject
的用法示例。
在下文中一共展示了GObject.pygobject_version方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _configure_settings_server
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import pygobject_version [as 别名]
def _configure_settings_server(self):
cb_subscribed = self.gtk_builder_get('checkbutton_alert_subscribe')
cb_reject_after_creds = self.gtk_builder_get('checkbutton_reject_after_credentials')
entry_beef_hook = self.gtk_builder_get('entry_server_beef_hook')
server_config = self.application.rpc('config/get', ['beef.hook_url', 'server.require_id', 'server.secret_id'])
entry_beef_hook.set_property('text', server_config.get('beef.hook_url', ''))
self.config['server_config']['server.require_id'] = server_config['server.require_id']
self.config['server_config']['server.secret_id'] = server_config['server.secret_id']
# older versions of GObject.signal_handler_find seem to have a bug which cause a segmentation fault in python
if GObject.pygobject_version < (3, 10):
cb_subscribed.set_property('active', self.application.rpc('campaign/alerts/is_subscribed', self.config['campaign_id']))
cb_reject_after_creds.set_property('active', self.application.get_graphql_campaign()['maxCredentials'])
else:
with gui_utilities.gobject_signal_blocked(cb_subscribed, 'toggled'):
cb_subscribed.set_property('active', self.application.rpc('campaign/alerts/is_subscribed', self.config['campaign_id']))
cb_reject_after_creds.set_property('active', self.application.get_graphql_campaign()['maxCredentials'])
cb_reject_after_creds.set_sensitive(self.config['server_config']['server.require_id'])
示例2: compare_pygobject_version
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import pygobject_version [as 别名]
def compare_pygobject_version(version):
"""
return True if version is less than pygobject_version
i.e. 3.9 < 3.11
"""
to_number = lambda t: ".".join(str(v) for v in t)
str_version = to_number(GObject.pygobject_version)
split = str_version.rsplit('.', 2)
split_compare = version.rsplit('.', 2)
if int(split_compare[0]) < int(split[0]):
return True
if int(split_compare[1]) < int(split[1]):
return True
return False
示例3: pygobject_version
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import pygobject_version [as 别名]
def pygobject_version():
"""
returns float of the major and minor parts of a pygobject version
e.g. version (3, 9, 5) return float(3.9)
"""
to_number = lambda t: ".".join(str(v) for v in t)
str_version = to_number(GObject.pygobject_version)
return float(str_version.rsplit('.', 1)[0])
示例4: get_debug_text
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import pygobject_version [as 别名]
def get_debug_text(self, exc_info=None):
'''Get the text to show in the log of a "You found a bug" dialog.
Includes zim version info and traceback info.
@param exc_info: this is an optional argument that takes the
result of C{sys.exc_info()}
@returns: debug log as string
'''
from gi.repository import GObject
import zim
import traceback
if not exc_info:
exc_info = sys.exc_info()
if exc_info[2]:
tb = exc_info[2]
else:
tb = None
text = 'This is zim %s\n' % zim.__version__ + \
'Platform: %s\n' % os.name + \
'Locale: %s %s\n' % locale.getdefaultlocale() + \
'FS encoding: %s\n' % sys.getfilesystemencoding() + \
'Python: %s\n' % str(tuple(sys.version_info)) + \
'PyGObject: %s\n' % str(GObject.pygobject_version)
text += '\n======= Traceback =======\n'
if tb:
lines = traceback.format_tb(tb)
text += ''.join(lines)
else:
text += '<Could not extract stack trace>\n'
text += self.error.__class__.__name__ + ': ' + str(self.error)
del exc_info # recommended by manual
return text
示例5: get_platform_info
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import pygobject_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)
示例6: check3_pygobject
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import pygobject_version [as 别名]
def check3_pygobject(self):
'''Check for pygobject
pygobject 3.12 or greater - Python Bindings for GLib/GObject/GIO/GTK+
https://wiki.gnome.org/Projects/PyGObject
# pygobject 3.12+
'''
# Start check
MIN_PYGOBJECT_VERSION = (3, 12, 0)
try:
from gi.repository import GObject
try:
pygobjectver_str = verstr(GObject.pygobject_version)
pygobject_result = GObject.pygobject_version
except Exception: # any failure to 'get' the version
pygobjectver_str = 'unknown version'
pygobject_result = (0, 0, 0)
except ImportError:
pygobjectver_str = 'not found'
pygobject_result = (0, 0, 0)
'''
# test for older pygobject for gtk 2
# https://github.com/gramps-project/gramps/blob/maintenance/gramps34/src/gramps.py
try:
import gobject
try:
gobjectver_str = '%d.%d.%d' % gobject.pygobject_version
except :# any failure to 'get' the version
gobjectver_str = 'unknown version'
except ImportError:
gobjectver_str = 'not found'
'''
# Test
if not pygobject_result >= MIN_PYGOBJECT_VERSION:
#print("Failed")
result = ("* PyGObject " + pygobjectver_str +
" (Requires version " +
verstr(MIN_PYGOBJECT_VERSION) + " or greater.)\n")
else:
#print("Success")
result = ("* PyGObject " + pygobjectver_str +
" (Success version " +
verstr(MIN_PYGOBJECT_VERSION) +
" or greater installed.)\n")
# End check
self.append_text(result)