Commit d299158d authored by GustavoPeredo's avatar GustavoPeredo
Browse files

Added experimental colorful mode

parent 19501583
......@@ -6,6 +6,11 @@
<summary>Dark mode</summary>
<description>Dark mode</description>
</key>
<key name="colorful-mode" type="b">
<default>false</default>
<summary>Colorful mode</summary>
<description>Colorful mode</description>
</key>
<key name="any-alphabet" type="b">
<default>true</default>
<summary>Any alphabet</summary>
......
......@@ -34,6 +34,36 @@ list.sidebar {
box-shadow: inset 0 0 0 2px @theme_selected_bg_color;
}
.color-green:checked {
box-shadow: inset 0 0 0 2px #2ec27e;
}
.green2:selected {
background-color: #2ec27e;
}
.green2 check:checked {
background-image: linear-gradient(to top, #26a269 2px, #2ec27e);
border-color: #239963;
}
.text-green:focus {
border-color: #239963;
text-shadow: 0 -1px rgba(0, 0, 0, 0.719216);
-gtk-icon-shadow: 0 -1px rgba(0, 0, 0, 0.719216);
box-shadow: inset 0 1px rgba(255, 255, 255, 0.02), 0 1px 2px rgba(0, 0, 0, 0.07);
}
.green {
color: white;
outline-color: rgba(255, 255, 255, 0.3);
border-color: #239963;
border-bottom-color: #1a7d50;
background-image: linear-gradient(to top, #26a269 2px, #2ec27e);
text-shadow: 0 -1px rgba(0, 0, 0, 0.719216);
-gtk-icon-shadow: 0 -1px rgba(0, 0, 0, 0.719216);
box-shadow: inset 0 1px rgba(255, 255, 255, 0.02), 0 1px 2px rgba(0, 0, 0, 0.07);
}
/* Menu */
popover > box {
......
......@@ -81,6 +81,7 @@ class FontdownloaderWindow(Handy.Window):
headerbar2 = Gtk.Template.Child()
light_mode_button = Gtk.Template.Child()
dark_mode_button = Gtk.Template.Child()
colorful_switch = Gtk.Template.Child()
settings_button = Gtk.Template.Child()
SettingsWindow = Gtk.Template.Child()
close_settings_button = Gtk.Template.Child()
......@@ -150,6 +151,7 @@ class FontdownloaderWindow(Handy.Window):
self.about_button.connect("clicked", self.on_about)
self.light_mode_button.connect('clicked', self.changeTheme)
self.dark_mode_button.connect('clicked', self.changeTheme)
self.colorful_switch.connect('notify::active', self.flipSwitch)
self.settings_button.connect('clicked', self.presentSettings)
self.close_settings_button.connect('clicked', self.closeSettings)
self.folder_settings_button.connect('clicked', self.on_open)
......@@ -203,6 +205,7 @@ class FontdownloaderWindow(Handy.Window):
self.fontChanged()
self.dark_mode_button.set_active(self.settings.get_boolean('dark-mode'))
self.colorful_switch.set_active(self.settings.get_boolean('colorful-mode'))
self.changeTheme()
#Sets up borders
......@@ -321,7 +324,9 @@ class FontdownloaderWindow(Handy.Window):
self.newBox.installed_box.show()
self.newBox.set_visible(True)
self.fonts_list.add(self.newBox)
self.changeColor(self.settings.get_boolean('colorful-mode'))
self.fonts_list.set_filter_func(self.filterFonts, None, True)
self.fonts_list.select_row(self.fonts_list.get_row_at_index(0))
def filterFonts(self, row, data, notifyDestroy):
#Where the actual filter happens, if it returns True, the row appears
......@@ -335,7 +340,6 @@ class FontdownloaderWindow(Handy.Window):
}
searchBarText = self.search_entry.get_text().lower()
filtered = [filters for filters in self.CurrentFilters if self.CurrentFilters[filters]]
if not self.any_alphabet:
if any(i in self.current_alphabet_list for i in row.get_child().data[3]):
return ((searchBarText == row.get_child().data[0][:len(searchBarText)].lower()) and (row.get_child().data[1] in filtered))
......@@ -414,6 +418,52 @@ class FontdownloaderWindow(Handy.Window):
Gtk.Settings.get_default().set_property('gtk-application-prefer-dark-theme', False)
self.settings.set_boolean('dark-mode', False)
def changeColor(self, toggle, *args, **kwargs):
if toggle:
self.main_install_button.get_style_context().add_class('green')
self.light_mode_button.get_style_context().add_class('color-green')
self.dark_mode_button.get_style_context().add_class('color-green')
self.all_check.get_style_context().add_class('green2')
self.serif_check.get_style_context().add_class('green2')
self.sans_check.get_style_context().add_class('green2')
self.display_check.get_style_context().add_class('green2')
self.handwriting_check.get_style_context().add_class('green2')
self.mono_check.get_style_context().add_class('green2')
self.search_entry.get_style_context().add_class('text-green')
self.text_entry.get_style_context().add_class('text-green')
self.colorful_switch.get_style_context().add_class('green')
for temp_buttons in self.alphabet_buttons:
temp_buttons.get_style_context().add_class('green2')
self.any_alphabet_button.get_style_context().add_class('green2')
for temp_boxes in self.fonts_list:
temp_boxes.get_style_context().add_class('green2')
else:
self.main_install_button.get_style_context().remove_class('green')
self.light_mode_button.get_style_context().remove_class('color-green')
self.dark_mode_button.get_style_context().remove_class('color-green')
self.all_check.get_style_context().remove_class('green2')
self.serif_check.get_style_context().remove_class('green2')
self.sans_check.get_style_context().remove_class('green2')
self.display_check.get_style_context().remove_class('green2')
self.handwriting_check.get_style_context().remove_class('green2')
self.mono_check.get_style_context().remove_class('green2')
self.search_entry.get_style_context().remove_class('text-green')
self.text_entry.get_style_context().remove_class('text-green')
self.colorful_switch.get_style_context().remove_class('green')
for temp_buttons in self.alphabet_buttons:
temp_buttons.get_style_context().remove_class('green2')
self.any_alphabet_button.get_style_context().remove_class('green2')
for temp_boxes in self.fonts_list:
temp_boxes.get_style_context().remove_class('green2')
def flipSwitch(self, button, *args, **kwargs):
if button.get_active():
self.changeColor(True)
self.settings.set_boolean('colorful-mode', True)
else:
self.changeColor(False)
self.settings.set_boolean('colorful-mode', False)
def presentSettings(self, *args, **kwargs):
self.SettingsWindow.show()
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.1 -->
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<requires lib="libhandy" version="2.0"/>
......@@ -1170,6 +1170,84 @@ Extended</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&lt;b&gt; EXPERIMENTAL &lt;/b&gt;</property>
<property name="use-markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">4</property>
<property name="margin-end">4</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Colorful mode</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="colorful_switch">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.1 -->
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<requires lib="libhandy" version="2.0"/>
......@@ -296,7 +296,7 @@
<property name="name">FontdownloaderWindow</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">Font Downloader</property>
<property name="default-width">720</property>
<property name="default-width">960</property>
<property name="default-height">640</property>
<property name="icon-name">org.gustavoperedo.FontDownloader</property>
<child>
......@@ -380,6 +380,7 @@
<property name="receives-default">True</property>
<style>
<class name="suggested-action"/>
<class name="green"/>
</style>
</object>
<packing>
......@@ -1170,6 +1171,84 @@ Extended</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&lt;b&gt; EXPERIMENTAL &lt;/b&gt;</property>
<property name="use-markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">4</property>
<property name="margin-end">4</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Colorful mode</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="colorful_switch">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment