本文整理汇总了Python中gi.repository.Gtk.Overlay方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Overlay方法的具体用法?Python Gtk.Overlay怎么用?Python Gtk.Overlay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.Overlay方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Overlay [as 别名]
def __init__(self):
Gtk.Overlay.__init__(self)
self._loading = False
self._blur = Gtk.EventBox()
self._blur.get_style_context().add_class('blur')
self._spinner = Gtk.Spinner()
self._spinner.props.active = True
apply_styling_to_widget(self._spinner, KanoButton.SPINNER_CSS)
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Overlay [as 别名]
def __init__(self, title="Application", width=None, height=None):
Gtk.Window.__init__(self, title=title)
self.set_decorated(False)
self.set_resizable(False)
screen = Gdk.Screen.get_default()
self._win_width = width
if width <= 1:
self._win_width = int(screen.get_width() * width)
self._win_height = height
if height <= 1:
self._win_height = int(screen.get_height() * height)
self.set_size_request(self._win_width, self._win_height)
self.set_position(Gtk.WindowPosition.CENTER)
self.connect('delete-event', Gtk.main_quit)
apply_common_to_screen()
self._overlay = Gtk.Overlay()
self.add(self._overlay)
self._blur = Gtk.EventBox()
self._blur.get_style_context().add_class('blur')
self._blurred = False
# TODO: Maybe handle the taskbar here to avoid even more code duplication?
示例3: _create_window_structure
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Overlay [as 别名]
def _create_window_structure(self):
"""Generate the structure of all the widgets and add it to the window.
There is a large Gtk.Grid() to organize the widgets packed into a
Gtk.Overlay(). The commandline is added as overlay.
"""
main_grid = Gtk.Grid()
main_grid.attach(self["library"].grid, 0, 0, 1, 1)
main_grid.attach(self["main_window"], 1, 0, 1, 1)
main_grid.attach(self["manipulate"], 0, 1, 2, 1)
main_grid.attach(self["statusbar"].separator, 0, 2, 2, 1)
overlay_grid = Gtk.Grid()
overlay_grid.attach(self["statusbar"], 0, 0, 1, 1)
overlay_grid.attach(self["completions"].info, 0, 1, 1, 1)
overlay_grid.attach(self["commandline"], 0, 2, 1, 1)
overlay_grid.set_valign(Gtk.Align.END)
# Make it nice using CSS
overlay_grid.set_name("OverLay")
style = Gtk.Window().get_style_context()
bg = style.get_background_color(Gtk.StateType.NORMAL)
color_str = "#OverLay { background: " + bg.to_string() + "; }"
command_provider = Gtk.CssProvider()
command_css = color_str.encode()
command_provider.load_from_data(command_css)
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(), command_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
# Overlay contains grid mainly and adds commandline as floating
overlay = Gtk.Overlay()
overlay.add(main_grid)
overlay.add_overlay(overlay_grid)
self["window"].add(overlay)
示例4: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Overlay [as 别名]
def __init__(self, wp_path, *args, **kwds):
super().__init__(*args, **kwds)
self.set_halign(Gtk.Align.CENTER)
self.set_valign(Gtk.Align.CENTER)
self.wallpaper_path = wp_path
self.is_fav = False
self.container_box = Gtk.Overlay()
self.container_box.set_halign(Gtk.Align.CENTER)
self.container_box.set_valign(Gtk.Align.CENTER)
self.wp_image = Gtk.Image.new_from_icon_name('image-x-generic', Gtk.IconSize.DIALOG)
self.heart_icon = Gtk.Image.new_from_icon_name('emblem-favorite', Gtk.IconSize.DIALOG)
self.heart_icon.set_no_show_all(True)
self.heart_icon.set_halign(Gtk.Align.END)
self.heart_icon.set_valign(Gtk.Align.END)
self.heart_icon.set_margin_bottom(6)
self.heart_icon.set_margin_right(6)
self.container_box.add(self.wp_image)
self.container_box.set_margin_left(12)
self.container_box.set_margin_right(12)
self.container_box.wallpaper_path = wp_path
self.container_box.add_overlay(self.heart_icon)
self.heart_icon.hide()
self.add(self.container_box)
示例5: _setup_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Overlay [as 别名]
def _setup_widgets(self):
"""Setup the main widgets."""
# Main widget
self.add(self._main)
# Headerbar
headerbar = HeaderBar.get_default()
headerbar.connect("open-file", self._open_file)
headerbar.play_btn.connect("clicked", self._play)
# Set up the app menu in other DE than GNOME
from ..application import Application
app_menu = Application.get_default().app_menu
menu_btn = headerbar.menu_btn
popover = Gtk.Popover.new_from_model(menu_btn, app_menu)
menu_btn.connect("clicked", self._toggle_popover, popover)
self.set_titlebar(headerbar)
# Action Bar
actionbar = ActionBar.get_default()
actionbar.connect("selected-format", self._on_export)
self._main.pack_end(actionbar, False, False, 0)
# Notification
notification = Notification.get_default()
self._main.pack_start(notification, False, False, 0)
# Audio Graph
self.main_stack = Gtk.Stack()
self.audio_graph_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.audio_graph_box.get_style_context().add_class("audio-graph-container")
self.zoombox = ZoomBox()
overlay = Gtk.Overlay()
overlay.add(self.audio_graph_box)
overlay.add_overlay(self.zoombox)
self.main_stack.add_named(overlay, "wave")
loading = Loading()
self.main_stack.add_named(loading, "loading")
self._main.pack_start(self.main_stack, True, True, 0)
# Config Box
sound_config = SoundConfig.get_default()
self._main.pack_end(sound_config, False, False, 0)
示例6: _setup_backends
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Overlay [as 别名]
def _setup_backends(cls, conf = None):
""" Load the backends for video overlays.
"""
if cls._backends_setup:
return
cls._backends_setup = True
if conf is None:
conf = config.Config()
try:
from pympress.media_overlays.gif_backend import GifOverlay
version = GifOverlay.setup_backend()
cls._backends['image/gif'] = GifOverlay
cls._backends['image/svg+xml'] = GifOverlay
cls._backend_versions.append(version)
except Exception as e:
logger.error(_('Video support using {} is disabled.').format('Overlay'))
logger.info(_('Caused by ') + type(e).__name__ + ': ' + str(e))
try:
if conf.getboolean('gst', 'enabled'):
from pympress.media_overlays.gst_backend import GstOverlay
version = GstOverlay.setup_backend(conf.getlist('gst', 'init_options'))
types_list = conf.getlist('gst', 'mime_types')
cls._backends.update({mt: GstOverlay for mt in types_list})
cls._backend_versions.append(version)
# make GstOverlay the default
if not types_list:
cls._backends = defaultdict(lambda: GstOverlay, cls._backends)
except Exception as e:
logger.error(_("Video support using {} is disabled.").format('GStreamer'))
logger.info(_('Caused by ') + type(e).__name__ + ': ' + str(e))
try:
if conf.getboolean('vlc', 'enabled'):
from pympress.media_overlays.vlc_backend import VlcOverlay
version = VlcOverlay.setup_backend(conf.getlist('vlc', 'init_options'))
types_list = conf.getlist('vlc', 'mime_types')
cls._backends.update({mt: VlcOverlay for mt in types_list})
cls._backend_versions.append(version)
# make VlcOverlay the (new) default
if not types_list:
cls._backends = defaultdict(lambda: VlcOverlay, cls._backends)
except Exception as e:
logger.error(_("Video support using {} is disabled.").format('VLC'))
logger.info(_('Caused by ') + type(e).__name__ + ': ' + str(e))
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Overlay [as 别名]
def __init__(self):
Gtk.Window.__init__(self, title='MessageBar Demo')
self.set_default_size(400, 200)
self.connect('destroy', Gtk.main_quit)
style_provider = Gtk.CssProvider()
style_provider.load_from_path(os.path.join('..', "themes/style.css"))
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(), style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
self.overlay = Gtk.Overlay()
self.add(self.overlay)
button_box = Gtk.ButtonBox()
button_box.set_halign(Gtk.Align.FILL)
button_box.set_valign(Gtk.Align.END)
button_box.set_layout(Gtk.ButtonBoxStyle.EXPAND)
button_box.set_margin_bottom(5)
# Show info message button
btn = Gtk.Button('Info')
btn.connect('clicked', self.show_info)
button_box.add(btn)
# Show warning message button
btn = Gtk.Button('Warning')
btn.connect('clicked', self.show_warning)
button_box.add(btn)
# Show error message button
btn = Gtk.Button('Error')
btn.connect('clicked', self.show_error)
button_box.add(btn)
# Show question message button
btn = Gtk.Button('Question')
btn.connect('clicked', self.show_question)
button_box.add(btn)
self.overlay.add(button_box)
self.message_bar = MessageBar()
self.overlay.add_overlay(self.message_bar)
self.show_all()
Gtk.main()