Python gi.repository.Gtk.STYLE_PROVIDER_PRIORITY_USER Examples
The following are 11
code examples of gi.repository.Gtk.STYLE_PROVIDER_PRIORITY_USER().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gtk
, or try the search function
.
Example #1
Source File: heading.py From kano-toolset with GNU General Public License v2.0 | 9 votes |
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)
Example #2
Source File: application.py From Authenticator with GNU General Public License v2.0 | 5 votes |
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")
Example #3
Source File: top_bar.py From kano-toolset with GNU General Public License v2.0 | 5 votes |
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)
Example #4
Source File: apply_styles.py From kano-toolset with GNU General Public License v2.0 | 5 votes |
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
Example #5
Source File: apply_styles.py From kano-toolset with GNU General Public License v2.0 | 5 votes |
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)
Example #6
Source File: mainwindow.py From lplayer with MIT License | 5 votes |
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)
Example #7
Source File: application.py From Audio-Cutter with GNU General Public License v3.0 | 5 votes |
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))
Example #8
Source File: annotationPanel.py From pychess with GNU General Public License v3.0 | 5 votes |
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
Example #9
Source File: LearnInfoBar.py From pychess with GNU General Public License v3.0 | 5 votes |
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)
Example #10
Source File: alttoolbar_type.py From alternative-toolbar with GNU General Public License v3.0 | 5 votes |
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)
Example #11
Source File: MainWindow.py From kano-apps with GNU General Public License v2.0 | 5 votes |
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()