Exemple #1
0
 def __init__(self, parent, name_poem, name_poet, text_poem, font):
     self.parent = parent
     self.background_image = daw_config.getv('ornament-file')
     if daw_config.getv('tr') == '1':
         self.colorb = daw_customs.rgb(daw_config.getv('colorb'))
         self.colormp = daw_customs.rgb(daw_config.getv('colormp'))
         self.coloran = daw_customs.rgb(daw_config.getv('coloran'))
         self.fontan = daw_config.getv('fontan')
     else:
         self.colorb = daw_customs.rgb(colorb)
         self.colormp = daw_customs.rgb(colormp)
         self.coloran = daw_customs.rgb(coloran)
         self.fontan = fontan
         
     self.name_poem = name_poem
     self.name_poet = name_poet
     self.text_poem = text_poem
     fdmp = Pango.FontDescription(font)
     self.fontmp_family = fdmp.get_family()
     self.fontmp_size = font[-2:]+'px'
     fdan = Pango.FontDescription(self.fontan)
     self.fontan_family = fdan.get_family()
     self.fontan_size = self.fontan[-2:]+'px'
Exemple #2
0
 def refrech(self, *a):
     self.apply_preference()
     ornament = daw_config.getv('ornament-file')
     p = join(daw_customs.ORNAMENT, ornament)
     bg0 = join(daw_customs.ICON_DIR, 'bg1.png')
     bg1 = join(daw_customs.ICON_DIR, 'bg0.png')
     if daw_config.getv('ornament') == '1': background = 'background-image: url("{}");'.format(p,)
     else: background = 'background-color: {};'.format(daw_customs.rgb(self.colorb),)
     if not exists(p): background = 'background-color: {};'.format(daw_customs.rgb(self.colorb),)
     css_data = '''
         * {
         -GtkPaned-handle-size: 7;
         }
         View-editable:selected,
         View:selected,
         MyView:selected,
         Treepoem:selected,
         Tree:selected  {
         background-color: '''+daw_customs.rgb(self.colorbs)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colorfs)+''';
         }
         View-editable {
         background-color: '''+daw_customs.rgb(self.colorb)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colorch)+''';
         font: Simplified Naskh 15;
         }
         View {
         background-color: '''+daw_customs.rgb(self.colorb)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colorch)+''';
         font: '''+self.fontch+''';
         }
         Tree {
         background-color: '''+daw_customs.rgb(self.colorbp)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colortd)+''';
         font: '''+self.fonttd+''';
         }
         Treepoem {
         background-color: '''+daw_customs.rgb(self.colorb)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colortp)+''';
         font: '''+self.fonttp+''';
         }
         Myscroll, MyView {
         color: '''+daw_customs.rgb(self.colormp)+''';
         font: '''+self.fontmp+''';
         }
         Myscroll, MyView {
         '''+background+'''
         } '''
         
     css_data1 = '''
         GtkToolbar {
         background-image: url("'''+bg1+'''");
         }
         GtkEventbox, GtkWindow, GtkNotebook,
         GtkPaned {
         background-image: url("'''+bg0+'''");
         }
         GtkNotebook tab {
         background-image: none;
         }
         Togglebutton {
         background-image: url("'''+bg1+'''");
         color: #ffffff;
         text-shadow: black 5px 5px 5px;
         border: 1px solid grey;
         }
         Togglebutton:active {
         background-color: grey;
         background-image: none;
         border: 2px solid #555555;
         }
         '''+css_data
         
     screen = Gdk.Screen.get_default()
     css_provider = Gtk.CssProvider()
     context = Gtk.StyleContext()
     try: 
         if daw_config.getv('theme') == '1': css_provider.load_from_data(css_data1)
         else: css_provider.load_from_data(css_data)
     except: css_provider.load_from_data(css_data)
     context.add_provider_for_screen(screen, css_provider,
                                      Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)