本文整理汇总了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)
示例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")
示例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)
示例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
示例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)
示例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)
示例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))
示例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
示例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)
示例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)
示例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()