예제 #1
0
파일: App.py 프로젝트: wangjiezhe/kwplayer
    def load_styles(self):
        '''Load default CssStyle.'''
        if Config.GTK_LE_36:
            css = '\n'.join([
                'GtkScale {',
                    'outline-color: transparent;',
                    'outline-offset: 0;',
                    'outline-style: none;',
                    'outline-width: 0;',
                '}',
                'GtkTextView.lrc_tv {',
                    'font-size: {0};'.format(self.conf['lrc-text-size']),
                    'color: {0};'.format(self.conf['lrc-text-color']),
                    'border-radius: 0 25 0 50;',
                    'border-width: 5;',
                    'background-color: {0};'.format(
                        self.conf['lrc-back-color']),
                '}',
                '.info-label {',
                    'color: rgb(136, 139, 132);',
                    'font-size: 9;',
                '}',
                ])
        else:
            css = '\n'.join([
                'GtkScrolledWindow.lrc_window {',
                    'transition-property: background-image;',
                    'transition-duration: 1s;',
                '}',
                'GtkScale {',
                    'outline-color: transparent;',
                    'outline-offset: 0;',
                    'outline-style: none;',
                    'outline-width: 0;',
                '}',
                'GtkTextView.lrc_tv {',
                    'transition-property: font-size;',
                    'transition: 500ms ease-in-out;',
                    'font-size: {0}px;'.format(self.conf['lrc-text-size']),
                    'color: {0};'.format(self.conf['lrc-text-color']),
                    'border-radius: 0px 25px 0px 50px;',
                    'border-width: 5px;',
                    'background-color: {0};'.format(
                        self.conf['lrc-back-color']),
                '}',
                '.info-label {',
                    'color: rgb(136, 139, 132);',
                    'font-size: 9px;',
                '}',
                ])

        Widgets.apply_css(self.window, css, overall=True)

        settings = Gtk.Settings.get_default()
        settings.props.gtk_application_prefer_dark_theme = \
                self.conf.get('use-dark-theme', False)
예제 #2
0
파일: App.py 프로젝트: zihua/kwplayer
    def load_styles(self):
        '''Load default CssStyle.'''
        if Config.GTK_LE_36:
            css = '\n'.join([
                'GtkScale {',
                    'outline-color: transparent;',
                    'outline-offset: 0;',
                    'outline-style: none;',
                    'outline-width: 0;',
                '}',
                'GtkTextView.lrc_tv {',
                    'font-size: {0};'.format(self.conf['lrc-text-size']),
                    'color: {0};'.format(self.conf['lrc-text-color']),
                    'border-radius: 0 25 0 50;',
                    'border-width: 5;',
                    'background-color: {0};'.format(
                        self.conf['lrc-back-color']),
                '}',
                '.info-label {',
                    'color: rgb(136, 139, 132);',
                    'font-size: 9;',
                '}',
                ])
        else:
            css = '\n'.join([
                'GtkScrolledWindow.lrc_window {',
                    'transition-property: background-image;',
                    'transition-duration: 1s;',
                '}',
                'GtkScale {',
                    'outline-color: transparent;',
                    'outline-offset: 0;',
                    'outline-style: none;',
                    'outline-width: 0;',
                '}',
                'GtkTextView.lrc_tv {',
                    'transition-property: font-size;',
                    'transition: 500ms ease-in-out;',
                    'font-size: {0}px;'.format(self.conf['lrc-text-size']),
                    'color: {0};'.format(self.conf['lrc-text-color']),
                    'border-radius: 0px 25px 0px 50px;',
                    'border-width: 5px;',
                    'background-color: {0};'.format(
                        self.conf['lrc-back-color']),
                '}',
                '.info-label {',
                    'color: rgb(136, 139, 132);',
                    'font-size: 9px;',
                '}',
                ])

        Widgets.apply_css(self.window, css, overall=True)

        settings = Gtk.Settings.get_default()
        settings.props.gtk_application_prefer_dark_theme = \
                self.conf.get('use-dark-theme', False)
예제 #3
0
파일: Lrc.py 프로젝트: srrcboy/kwplayer
 def update_background(self, filepath):
     if filepath is None or filepath == self.lrc_background:
         return
     if os.path.exists(filepath):
         self.lrc_background = filepath
     else:
         self.lrc_background = self.lrc_default_background
     css = '\n'.join([
         'GtkScrolledWindow.lrc_window {',
             "background-image: url('{0}');".format(self.lrc_background),
         '}',
     ])
     self.old_provider = Widgets.apply_css(self.lrc_window, css,
                                           old_provider=self.old_provider)
예제 #4
0
파일: Lrc.py 프로젝트: xushao1990/kwplayer
 def update_background(self, filepath):
     if filepath is None or filepath == self.lrc_background:
         return
     if os.path.exists(filepath):
         self.lrc_background = filepath
     else:
         self.lrc_background = self.lrc_default_background
     css = '\n'.join([
         'GtkScrolledWindow.lrc_window {',
         "background-image: url('{0}');".format(self.lrc_background),
         '}',
     ])
     self.old_provider = Widgets.apply_css(self.lrc_window,
                                           css,
                                           old_provider=self.old_provider)
예제 #5
0
파일: Lrc.py 프로젝트: wangjiezhe/kwplayer
 def update_background(self, filepath):
     if filepath is None or filepath == self.lrc_background:
         return
     if os.path.exists(filepath):
         self.lrc_background = filepath
     else:
         self.lrc_background = self.lrc_default_background
     css = '\n'.join([
         'GtkScrolledWindow.lrc_window {',
             "background-image: url('{0}');".format(self.lrc_background),
             "background-size:{0};".format(self.app.conf['background-img-size']),
             "background-position:center;",
     ])
     if not self.app.conf['background-img-repeat']:
         css = '\n'.join([
             css,
             "background-repeat:no-repeat;",
             ])
     css = '\n'.join([
         css,
         '}',
         ])
     self.old_provider = Widgets.apply_css(self.lrc_window, css,
                                           old_provider=self.old_provider)
예제 #6
0
 def update_background(self, filepath):
     if filepath is None or filepath == self.lrc_background:
         return
     if os.path.exists(filepath):
         self.lrc_background = filepath
     else:
         self.lrc_background = self.lrc_default_background
     css = '\n'.join([
         'GtkScrolledWindow.lrc_window {',
             "background-image: url('{0}');".format(self.lrc_background),
             "background-size:{0};".format(self.app.conf['background-img-size']),
             "background-position:center;",
     ])
     if not self.app.conf['background-img-repeat']:
         css = '\n'.join([
             css,
             "background-repeat:no-repeat;",
             ])
     css = '\n'.join([
         css,
         '}',
         ])
     self.old_provider = Widgets.apply_css(self.lrc_window, css,
                                           old_provider=self.old_provider)
예제 #7
0
 def update_style(self):
     conf = self.app.conf
     if Config.GTK_LE_36:
         css = '\n'.join([
             'GtkWindow {',
                 'background-color:{0};'.format(
                     conf['osd-background-color']),
             '}',
             '.activated {',
                 'color: {0};'.format(conf['osd-activated-color']),
                 'font-size: {0};'.format(conf['osd-activated-size']),
                 'text-shadow: {0} {1} {2} {3};'.format(
                     conf['osd-activated-shadow-x'],
                     conf['osd-activated-shadow-y'],
                     conf['osd-activated-shadow-radius'],
                     conf['osd-activated-shadow-color']),
             '}',
             'GtkLabel {',
                 'color: {0};'.format(conf['osd-inactivated-color']),
                 'font-size: {0};'.format(conf['osd-inactivated-size']),
                 'text-shadow: {0} {1} {2} {3};'.format(
                     conf['osd-inactivated-shadow-x'],
                     conf['osd-inactivated-shadow-y'],
                     conf['osd-inactivated-shadow-radius'],
                     conf['osd-inactivated-shadow-color']),
             '}',
         ])
     else:
         css = '\n'.join([
             'GtkWindow {',
                 'background-color:{0};'.format(
                     conf['osd-background-color']),
             '}',
             '.activated {',
                 'color: {0};'.format(conf['osd-activated-color']),
                 'font-size: {0}px;'.format(conf['osd-activated-size']),
                 'text-shadow: {0}px {1}px {2}px {3};'.format(
                     conf['osd-activated-shadow-x'],
                     conf['osd-activated-shadow-y'],
                     conf['osd-activated-shadow-radius'],
                     conf['osd-activated-shadow-color']),
             '}',
             'GtkLabel {',
                 'color: {0};'.format(conf['osd-inactivated-color']),
                 'font-size: {0}px;'.format(conf['osd-inactivated-size']),
                 'transition-property: font-size;',
                 'transition: 200ms ease-in;',
                 'text-shadow: {0}px {1}px {2}px {3};'.format(
                     conf['osd-inactivated-shadow-x'],
                     conf['osd-inactivated-shadow-y'],
                     conf['osd-inactivated-shadow-radius'],
                     conf['osd-inactivated-shadow-color']),
             '}',
         ])
     self.old_provider = Widgets.apply_css(self, css,
             old_provider=self.old_provider)
     self.da.old_provider = Widgets.apply_css(self.da, css,
             old_provider=self.da.old_provider)
     self.da2.old_provider = Widgets.apply_css(self.da2, css,
             old_provider=self.da2.old_provider)
     if self.app.conf['osd-three']:
         self.da3.show_all()
         self.da3.old_provider = Widgets.apply_css(self.da3, css,
                 old_provider=self.da3.old_provider)
         self.da.get_style_context().remove_class(ACTIVATE)
         self.da2.get_style_context().add_class(ACTIVATE)
         self.da3.get_style_context().remove_class(ACTIVATE)
     else:
         self.da3.hide()
예제 #8
0
파일: OSDLrc.py 프로젝트: zihua/kwplayer
 def update_style(self):
     conf = self.app.conf
     if Config.GTK_LE_36:
         css = '\n'.join([
             'GtkWindow {',
             'background-color:{0};'.format(conf['osd-background-color']),
             '}',
             '.activated {',
             'color: {0};'.format(conf['osd-activated-color']),
             'font-size: {0};'.format(conf['osd-activated-size']),
             'text-shadow: {0} {1} {2} {3};'.format(
                 conf['osd-activated-shadow-x'],
                 conf['osd-activated-shadow-y'],
                 conf['osd-activated-shadow-radius'],
                 conf['osd-activated-shadow-color']),
             '}',
             'GtkLabel {',
             'color: {0};'.format(conf['osd-inactivated-color']),
             'font-size: {0};'.format(conf['osd-inactivated-size']),
             'text-shadow: {0} {1} {2} {3};'.format(
                 conf['osd-inactivated-shadow-x'],
                 conf['osd-inactivated-shadow-y'],
                 conf['osd-inactivated-shadow-radius'],
                 conf['osd-inactivated-shadow-color']),
             '}',
         ])
     else:
         css = '\n'.join([
             'GtkWindow {',
             'background-color:{0};'.format(conf['osd-background-color']),
             '}',
             '.activated {',
             'color: {0};'.format(conf['osd-activated-color']),
             'font-size: {0}px;'.format(conf['osd-activated-size']),
             'text-shadow: {0}px {1}px {2}px {3};'.format(
                 conf['osd-activated-shadow-x'],
                 conf['osd-activated-shadow-y'],
                 conf['osd-activated-shadow-radius'],
                 conf['osd-activated-shadow-color']),
             '}',
             'GtkLabel {',
             'color: {0};'.format(conf['osd-inactivated-color']),
             'font-size: {0}px;'.format(conf['osd-inactivated-size']),
             'transition-property: font-size;',
             'transition: 200ms ease-in;',
             'text-shadow: {0}px {1}px {2}px {3};'.format(
                 conf['osd-inactivated-shadow-x'],
                 conf['osd-inactivated-shadow-y'],
                 conf['osd-inactivated-shadow-radius'],
                 conf['osd-inactivated-shadow-color']),
             '}',
         ])
     self.old_provider = Widgets.apply_css(self,
                                           css,
                                           old_provider=self.old_provider)
     self.da.old_provider = Widgets.apply_css(
         self.da, css, old_provider=self.da.old_provider)
     self.da2.old_provider = Widgets.apply_css(
         self.da2, css, old_provider=self.da2.old_provider)
     if self.app.conf['osd-three']:
         self.da3.show_all()
         self.da3.old_provider = Widgets.apply_css(
             self.da3, css, old_provider=self.da3.old_provider)
         self.da.get_style_context().remove_class(ACTIVATE)
         self.da2.get_style_context().add_class(ACTIVATE)
         self.da3.get_style_context().remove_class(ACTIVATE)
     else:
         self.da3.hide()