当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.Overlay方法代码示例

本文整理汇总了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) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:13,代码来源:blur_overlay.py

示例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? 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:32,代码来源:application_window.py

示例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) 
开发者ID:karlch,项目名称:vimiv,代码行数:37,代码来源:app.py

示例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) 
开发者ID:GabMus,项目名称:HydraPaper,代码行数:29,代码来源:wallpaper_flowbox_item.py

示例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) 
开发者ID:bilelmoussaoui,项目名称:Audio-Cutter,代码行数:46,代码来源:window.py

示例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)) 
开发者ID:Cimbali,项目名称:pympress,代码行数:62,代码来源:extras.py

示例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() 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:52,代码来源:message_bar.py


注:本文中的gi.repository.Gtk.Overlay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。