本文整理汇总了Python中gi.repository.Gtk.Scale方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Scale方法的具体用法?Python Gtk.Scale怎么用?Python Gtk.Scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.Scale方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_auto_hide_timeout
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Scale [as 别名]
def _setup_auto_hide_timeout(self):
key = self._schema.get_key("timeout")
row = Gtk.ListBoxRow()
row.set_tooltip_text(key.get_description())
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
row.add(hbox)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
hbox.pack_start(vbox, True, True, 10)
label = Gtk.Label(" " + key.get_summary(), xalign=0)
vbox.pack_start(label, True, True, 0)
scale = Gtk.Scale().new(Gtk.Orientation.HORIZONTAL)
key_range = key.get_range()
scale.set_range(key_range[1][0], key_range[1][1])
scale.set_digits(False)
scale.set_size_request(128, 24)
scale.connect("format_value", self._scale_timeout_format)
self._settings.bind(
"timeout", scale.get_adjustment(), "value", Gio.SettingsBindFlags.DEFAULT,
)
hbox.pack_start(scale, False, True, 10)
self._row_timeout = row
self.listbox.add(row)
示例2: _add_scale
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Scale [as 别名]
def _add_scale(self, sink):
# scale
scale = Gtk.Scale().new(Gtk.Orientation.VERTICAL)
scale.set_draw_value(False)
scale.set_value_pos(Gtk.PositionType.BOTTOM)
scale.set_range(PA_VOLUME_MUTED, PA_VOLUME_NORM)
scale.set_inverted(True)
scale.set_size_request(24, 128)
scale.set_tooltip_text(sink.name)
self._set_increments_on_scale(scale)
# icon
icon = Gtk.Image()
icon.set_tooltip_text(sink.name)
icon.set_from_icon_name(sink.icon_name, Gtk.IconSize.SMALL_TOOLBAR)
return scale, icon
示例3: enable_screensaver_scale
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Scale [as 别名]
def enable_screensaver_scale(self, button):
'''This is the callback for the Turn On checkbutton
Depending on the value of the checkbutton, this will turn on or off
the screensaver and disable the Gtk.Scale
'''
check_screensaver = button.get_active()
self.scale.set_sensitive(check_screensaver)
示例4: _setup_mouse_wheel_step
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Scale [as 别名]
def _setup_mouse_wheel_step(self):
key = self._schema.get_key("mouse-wheel-step")
row = Gtk.ListBoxRow()
row.set_tooltip_text(key.get_description())
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
row.add(hbox)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
hbox.pack_start(vbox, True, True, 10)
label = Gtk.Label(key.get_summary(), xalign=0)
vbox.pack_start(label, True, True, 0)
scale = Gtk.Scale().new(Gtk.Orientation.HORIZONTAL)
key_range = key.get_range()
scale.set_range(key_range[1][0], key_range[1][1])
scale.set_digits(False)
scale.set_size_request(128, 24)
scale.connect("format_value", self._scale_mouse_wheel_step_format)
self._settings.bind(
"mouse-wheel-step",
scale.get_adjustment(),
"value",
Gio.SettingsBindFlags.DEFAULT,
)
hbox.pack_start(scale, False, True, 10)
self.listbox.add(row)
示例5: _set_slider_value
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Scale [as 别名]
def _set_slider_value(self, slider, name):
"""Set value of self._manipulations according to slider value.
Args:
slider: Gtk.Scale on which to operate.
name: Name of slider to operate on.
"""
val = slider.get_value()
val /= 127
# Change brightness, contrast or saturation
self._manipulations[name] = val
# Run the manipulation function
self._apply()
示例6: update_width
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Scale [as 别名]
def update_width(self, widget, event, value):
""" Callback for the width chooser slider, to set scribbling width.
Args:
widget (:class:`~Gtk.Scale`): The slider control used to select the scribble width
event (:class:`~Gdk.Event`): the GTK event triggering this update.
value (`int`): the width of the scribbles to be drawn
"""
self.scribble_width = int(value)
self.config.set('scribble', 'width', str(self.scribble_width))
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Scale [as 别名]
def __init__(self, win):
title = _("Screensaver - advanced")
description = ''
kano_label = _("APPLY CHANGES")
Template.__init__(self, title, description, kano_label)
self.win = win
self.win.set_main_widget(self)
self.win.top_bar.enable_prev()
self.win.change_prev_callback(self.go_to_set_style)
self.kano_button.connect('button-release-event', self.apply_changes)
self.kano_button.connect('key-release-event', self.apply_changes)
# Want a label to the left, so we need to pack it separately
checkbutton_box = Gtk.Box(
orientation=Gtk.Orientation.HORIZONTAL,
spacing=35
)
self.checkbutton = Gtk.CheckButton()
label = Gtk.Label(_("Turn on screensaver"))
label.get_style_context().add_class('checkbutton_label')
checkbutton_box.pack_start(label, False, False, 0)
checkbutton_box.pack_start(self.checkbutton, False, False, 0)
self.checkbutton.connect('toggled', self.enable_screensaver_scale)
scalebox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=20)
label = Gtk.Label(_("Length of time in minutes\nbefore screensaver launches"))
label.get_style_context().add_class('checkbutton_label')
label.set_margin_top(25)
self.scale = Gtk.Scale.new_with_range(
orientation=Gtk.Orientation.HORIZONTAL,
min=1,
max=60,
step=1
)
self.scale.get_style_context().add_class('normal_label')
self.scale.set_size_request(200, 1)
scalebox.pack_start(label, False, False, 0)
scalebox.pack_start(self.scale, False, False, 0)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
vbox.pack_start(checkbutton_box, True, True, 0)
vbox.pack_start(scalebox, True, True, 0)
vbox.set_margin_top(20)
self.box.pack_start(vbox, True, True, 0)
self.scale.set_sensitive(False)
self.show_config_on_loading_page()
self.win.show_all()
示例8: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Scale [as 别名]
def __init__(self, parent, current_file, gcolor):
Gtk.Dialog.__init__(self, "Pick a Color", parent, 0,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK))
self.set_default_size(150, 100)
box = self.get_content_area()
box.set_border_width(10)
box.set_spacing(10)
sat_box = Gtk.Box(spacing=10, orientation=Gtk.Orientation.HORIZONTAL)
light_box = Gtk.Box(spacing=10, orientation=Gtk.Orientation.HORIZONTAL)
self.colorchooser = Gtk.ColorChooserWidget(show_editor=True)
self.colorchooser.set_use_alpha(False)
self.colorchooser.set_rgba(gcolor)
r, g, b, _ = list(map(lambda x: round(x*100*2.55), gcolor))
hue, light, sat = util.rgb_to_hls(r, g, b)
self.sat_lbl = Gtk.Label('Saturation')
self.light_lbl = Gtk.Label('Light ')
sat_range = Gtk.Adjustment(0, 0, 1, 0.1, 0.1, 0)
self.sat_slider = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL,
adjustment=sat_range)
self.sat_slider.set_value(-sat)
self.sat_slider.set_digits(2)
self.sat_slider.connect('value-changed', self.slider_changed, 'sat')
light_range = Gtk.Adjustment(5, 0, 255, 1, 10, 0)
self.light_slider = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL,
adjustment=light_range)
self.light_slider.set_value(light)
self.light_slider.connect('value-changed',
self.slider_changed, 'light')
box.add(self.colorchooser)
sat_box.pack_start(self.sat_lbl, True, True, 0)
sat_box.pack_start(self.sat_slider, True, True, 0)
light_box.pack_start(self.light_lbl, True, True, 0)
light_box.pack_start(self.light_slider, True, True, 0)
box.add(light_box)
box.add(sat_box)
self.show_all()