本文整理汇总了Python中gi.repository.Gtk.get_micro_version方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.get_micro_version方法的具体用法?Python Gtk.get_micro_version怎么用?Python Gtk.get_micro_version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.get_micro_version方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: about
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_micro_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()
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_micro_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")
示例3: do_startup
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_micro_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()))
示例4: get_platform_info
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_micro_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)
示例5: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_micro_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))
示例6: main
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import get_micro_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()