Python gi.repository.GObject.pygobject_version() Examples
The following are 6
code examples of gi.repository.GObject.pygobject_version().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.GObject
, or try the search function
.
Example #1
Source File: configuration.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 6 votes |
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'])
Example #2
Source File: alttoolbar_rb3compat.py From alternative-toolbar with GNU General Public License v3.0 | 6 votes |
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
Example #3
Source File: alttoolbar_rb3compat.py From alternative-toolbar with GNU General Public License v3.0 | 5 votes |
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])
Example #4
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
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
Example #5
Source File: filesystem.py From rednotebook with GNU General Public License v2.0 | 5 votes |
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)
Example #6
Source File: PrerequisitesCheckerGramplet.py From addons-source with GNU General Public License v2.0 | 4 votes |
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)