本文整理汇总了Python中gi.repository.Gio.Settings方法的典型用法代码示例。如果您正苦于以下问题:Python Gio.Settings方法的具体用法?Python Gio.Settings怎么用?Python Gio.Settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gio
的用法示例。
在下文中一共展示了Gio.Settings方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_defaults
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def get_defaults(self):
"""
Loads the defaults from the Gio.Settings and applies them to the GUI.
"""
self.switch_def_legend.set_active(self.g_settings.get_boolean("show-legend"))
self.switch_def_grid.set_active(self.g_settings.get_boolean("draw-grid"))
self.switch_def_cross.set_active(self.g_settings.get_boolean("center-cross"))
projection = self.g_settings.get_boolean("stereonet-projection")
if projection == True:
self.radiobutton_def_area.set_active(True)
else:
self.radiobutton_def_angle.set_active(True)
self.switch_def_night_mode.set_active(self.g_settings.get_boolean("night-mode"))
pixel_density = self.g_settings.get_value("pixel-density")
pixel_density = pixel_density.get_int32()
self.adjustment_def_pixeldens.set_value(pixel_density)
self.switch_def_highlight.set_active(self.g_settings.get_boolean("highlight-mode"))
示例2: __init__
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def __init__(self):
Gio.Settings.__init__(self)
示例3: new
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def new():
"""Create a new Settings object"""
g_settings = Gio.Settings.new(Settings.SCHEMA)
g_settings.__class__ = Settings
return g_settings
示例4: get_default
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def get_default():
"""Return the default instance of Settings."""
if Settings.instance is None:
Settings.instance = Settings.new()
return Settings.instance
示例5: __init__
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def __init__(self, main_window):
"""
Initalizes the GUI. Connects to Gio.Settings. Loads the defaults.
"""
self.builder = Gtk.Builder()
self.builder.set_translation_domain(i18n().get_ts_domain())
script_dir = os.path.dirname(__file__)
rel_path = "gui_layout.glade"
abs_path = os.path.join(script_dir, rel_path)
self.builder.add_objects_from_file(abs_path,
("settings_window", "adjustment_def_pixeldens"))
self.set_win = self.builder.get_object("settings_window")
self.switch_def_legend = self.builder.get_object("switch_def_legend")
self.switch_def_grid = self.builder.get_object("switch_def_grid")
self.switch_def_cross = self.builder.get_object("switch_def_cross")
self.radiobutton_def_area = self.builder.get_object("radiobutton_def_area")
self.radiobutton_def_angle = self.builder.get_object("radiobutton_def_angle")
self.switch_def_night_mode = self.builder.get_object("switch_def_night_mode")
self.spinbutton_def_pixeldens = self.builder.get_object("spinbutton_def_pixeldens")
self.adjustment_def_pixeldens = self.builder.get_object("adjustment_def_pixeldens")
self.switch_def_highlight = self.builder.get_object("switch_def_highlight")
self.set_win.set_transient_for(main_window)
self.builder.connect_signals(self)
self.g_settings = Gio.Settings.new("org.gtk.innstereo")
self.get_defaults()
if sys.platform == "win32":
translate_gui(self.builder)
示例6: __init__
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def __init__(self):
self._settings = Gio.Settings("apps.volctl", path="/apps/volctl/")
self._settings.connect("changed", self._cb_settings_changed)
self._mouse_wheel_step = self._settings.get_int("mouse-wheel-step")
self._pa_mgr = PulseAudioManager(self)
# GUI
self._tray_icon = TrayIcon(self)
self._sliders_win = None
self._about_win = None
self._preferences = None
self._mixer_process = None
示例7: new
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def new():
"""Create a new instance of Gio.Settings."""
gsettings = Gio.Settings.new("com.github.bilelmoussaoui.AudioCutter")
gsettings.__class__ = Settings
return gsettings
示例8: window_position
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def window_position(self):
"""Return a tuple (x, y) for the window's latest position."""
window_position = tuple(self.get_value('window-position'))
Logger.debug("[Settings] Window position: "
"{}".format(list(window_position)))
return window_position
示例9: is_night_mode
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def is_night_mode(self, status):
"""Switch the night mode."""
Logger.debug("[Settings] Night mode is set to: "
"{}".format(str(status)))
self.set_boolean('night-mode', status)
示例10: last_file
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def last_file(self):
"""Return the latest opened file path."""
last_file = self.get_string('last-file')
Logger.debug("[Settings] Last opened file: "
"{}".format(last_file))
return last_file
示例11: get_setting
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def get_setting(self, path):
"""
Return an instance of Gio.Settings pointing at the selected path.
"""
try:
setting = self.setting[path]
except:
self.setting[path] = Gio.Settings.new(path)
setting = self.setting[path]
return setting
示例12: get_fontname
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def get_fontname(self):
if self.font_use_system_font:
schema = 'org.gnome.desktop.interface'
if schema in Gio.Settings.list_schemas():
settings = Gio.Settings(schema)
font_name = settings.get_string('monospace-font-name')
else:
font_name = 'Monospace 13'
return font_name
else:
return self.font_fontname
示例13: __init__
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def __init__(self):
"""
Init Settings
"""
Gio.Settings.__init__(self)
示例14: new
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import Settings [as 别名]
def new(cls):
"""
Return a new Settings object
"""
settings = Gio.Settings.new("org.gnome.gitlab.somas.Apostrophe")
settings.__class__ = Settings
return settings