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


Python Gtk.STYLE_PROVIDER_PRIORITY_USER属性代码示例

本文整理汇总了Python中gi.repository.Gtk.STYLE_PROVIDER_PRIORITY_USER属性的典型用法代码示例。如果您正苦于以下问题:Python Gtk.STYLE_PROVIDER_PRIORITY_USER属性的具体用法?Python Gtk.STYLE_PROVIDER_PRIORITY_USER怎么用?Python Gtk.STYLE_PROVIDER_PRIORITY_USER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gi.repository.Gtk的用法示例。


在下文中一共展示了Gtk.STYLE_PROVIDER_PRIORITY_USER属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def __init__(self, title, description):

        cssProvider = Gtk.CssProvider()
        cssProvider.load_from_path(common_css_dir + "/heading.css")
        styleContext = Gtk.StyleContext()
        styleContext.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)

        self.title = Gtk.Label(title)
        self.title_style = self.title.get_style_context()
        self.title_style.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
        self.title_style.add_class('title')

        self.container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
        self.container.pack_start(self.title, False, False, 0)

        if description != "":
            self.description = Gtk.Label(description)
            self.description.set_justify(Gtk.Justification.CENTER)
            self.description.set_line_wrap(True)
            self.description_style = self.description.get_style_context()
            self.description_style.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
            self.description_style.add_class('description')

            self.container.pack_start(self.description, False, False, 0) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:26,代码来源:heading.py

示例2: __setup_css

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def __setup_css():
        """Setup the CSS and load it."""
        uri = 'resource:///com/github/bilelmoussaoui/Authenticator/style.css'
        provider_file = Gio.File.new_for_uri(uri)
        provider = Gtk.CssProvider()
        screen = Gdk.Screen.get_default()
        context = Gtk.StyleContext()
        provider.load_from_file(provider_file)
        context.add_provider_for_screen(screen, provider,
                                        Gtk.STYLE_PROVIDER_PRIORITY_USER)
        Logger.debug("Loading CSS") 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:13,代码来源:application.py

示例3: add_style

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def add_style(self, widget, app_class):
        style = widget.get_style_context()
        style.add_provider(self.cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
        style.add_class(app_class) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:6,代码来源:top_bar.py

示例4: apply_styling_to_screen

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def apply_styling_to_screen(css_file, priority="USER"):
    css = Gtk.CssProvider()

    if not os.path.exists(css_file):
        sys.exit(css_file + ' CSS file missing!')

    css.load_from_path(css_file)

    screen = Gdk.Screen.get_default()
    styleContext = Gtk.StyleContext()

    if priority == "FALLBACK":
        gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK
    elif priority == "THEME":
        gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_THEME
    elif priority == "SETTINGS":
        gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS
    elif priority == "APPLICATION":
        gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
    elif priority == "USER":
        gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_USER

    styleContext.add_provider_for_screen(screen, css, gtk_priority)


# Apply the styling from a CSS file to a specific widget 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:28,代码来源:apply_styles.py

示例5: apply_styling_to_widget

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def apply_styling_to_widget(widget, path):

    if not os.path.exists(path):
        sys.exit('{} CSS file missing!'.format(path))

    provider = Gtk.CssProvider()
    provider.load_from_path(path)
    styleContext = widget.get_style_context()
    styleContext.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)


# Apply the colour variable names to the widget (useful if you want to refer to kano_green) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:14,代码来源:apply_styles.py

示例6: load_css

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def load_css(self):
        style_provider = Gtk.CssProvider()
        style_provider.load_from_data(CSS.encode())
        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(),
            style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_USER) 
开发者ID:atareao,项目名称:lplayer,代码行数:9,代码来源:mainwindow.py

示例7: _setup_css

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def _setup_css(self):
        """Setup the CSS."""
        resource = 'resource:////com/github/bilelmoussaoui/AudioCutter/style.css'
        css_file = Gio.File.new_for_uri(resource)
        cssProvider = Gtk.CssProvider()
        screen = Gdk.Screen.get_default()
        styleContext = Gtk.StyleContext()
        cssProvider.load_from_file(css_file)
        styleContext.add_provider_for_screen(screen, cssProvider,
                                             Gtk.STYLE_PROVIDER_PRIORITY_USER)
        Logger.debug("Loading css file {}".format(css_file)) 
开发者ID:bilelmoussaoui,项目名称:Audio-Cutter,代码行数:13,代码来源:application.py

示例8: add_provider

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def add_provider(widget):
    screen = widget.get_screen()
    style = widget.get_style_context()
    provider = Gtk.CssProvider()
    provider.load_from_data(css.encode('utf-8'))
    style.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)


# -- Documentation 
开发者ID:pychess,项目名称:pychess,代码行数:11,代码来源:annotationPanel.py

示例9: add_provider

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def add_provider(widget):
    screen = widget.get_screen()
    style = widget.get_style_context()
    provider = Gtk.CssProvider()
    provider.load_from_data(css.encode('utf-8'))
    style.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) 
开发者ID:pychess,项目名称:pychess,代码行数:8,代码来源:LearnInfoBar.py

示例10: on_startup

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def on_startup(self, *args):
        """
          call after RB has completed its initialisation and selected the first
          view
        :param args:
        :return:
        """

        self.startup_completed = True
        self.reset_categories_pos(self.shell.props.selected_page)
        self.reset_toolbar(self.shell.props.selected_page)
        # lets hide the ghastly floating bar in RB 3.4.3
        cssdata = """
        .floating-bar {
            opacity: 0;
        }
        """
        cssprovider = Gtk.CssProvider.new()
        cssprovider.load_from_data(cssdata.encode())
        styleContext = Gtk.StyleContext()
        styleContext.add_provider_for_screen(
            self.shell.props.window.props.screen,
            cssprovider,
            Gtk.STYLE_PROVIDER_PRIORITY_USER,
        )
        self.reset_entryview(self.shell.props.selected_page)

        if self.plugin.prefer_dark_theme:
            settings = Gtk.Settings.get_default()
            settings.set_property('gtk-application-prefer-dark-theme', True) 
开发者ID:fossfreedom,项目名称:alternative-toolbar,代码行数:32,代码来源:alttoolbar_type.py

示例11: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STYLE_PROVIDER_PRIORITY_USER [as 别名]
def __init__(self, install=None, icon_only=False, tutorial=False):
        ApplicationWindow.__init__(self, 'Apps', 755, 588)

        self._install = install
        self._tutorial = tutorial
        self._icon_only = icon_only
        self._last_page = 0

        self.connect("show", self._app_loaded)

        # Destructor
        self.connect('delete-event', Gtk.main_quit)

        self.set_icon_from_file("/usr/share/kano-desktop/icons/apps.png")

        # Styling
        screen = Gdk.Screen.get_default()
        specific_css_provider = Gtk.CssProvider()
        specific_css_provider.load_from_path(Media.media_dir() +
                                             'css/style.css')
        specific_style_context = Gtk.StyleContext()
        specific_style_context.add_provider_for_screen(
            screen,
            specific_css_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_USER
        )
        style = self.get_style_context()
        style.add_class('main_window')

        # Setup widgets
        self.set_decorated(True)
        self._top_bar = TopBar(_("Apps"), self._win_width, False)
        self._top_bar.set_close_callback(Gtk.main_quit)
        self.set_titlebar(self._top_bar)

        self._contents = Contents(self)

        self.set_main_widget(self._contents)

        self.show_apps_view() 
开发者ID:KanoComputing,项目名称:kano-apps,代码行数:42,代码来源:MainWindow.py


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