added transparancey scale; added interactive debug button
This commit is contained in:
parent
f27f738351
commit
dbc198513f
@ -16,8 +16,11 @@ class BaseContainer(Gtk.Box):
|
||||
def __init__(self):
|
||||
super(BaseContainer, self).__init__()
|
||||
|
||||
self.ctx = self.get_style_context()
|
||||
|
||||
self._setup_styling()
|
||||
self._setup_signals()
|
||||
self._subscribe_to_events()
|
||||
self._load_widgets()
|
||||
|
||||
self.show_all()
|
||||
@ -25,13 +28,22 @@ class BaseContainer(Gtk.Box):
|
||||
|
||||
def _setup_styling(self):
|
||||
self.set_orientation(Gtk.Orientation.VERTICAL)
|
||||
ctx = self.get_style_context()
|
||||
ctx.add_class("base-container")
|
||||
self.ctx.add_class("base-container")
|
||||
|
||||
def _setup_signals(self):
|
||||
...
|
||||
|
||||
def _subscribe_to_events(self):
|
||||
event_system.subscribe("update_transparency", self._update_transparency)
|
||||
event_system.subscribe("remove_transparency", self._remove_transparency)
|
||||
|
||||
def _load_widgets(self):
|
||||
self.add(LeftContainer())
|
||||
self.add(CenterContainer())
|
||||
self.add(RightContainer())
|
||||
|
||||
def _update_transparency(self):
|
||||
self.ctx.add_class(f"mw_transparency_{settings.theming.transparency}")
|
||||
|
||||
def _remove_transparency(self):
|
||||
self.ctx.remove_class(f"mw_transparency_{settings.theming.transparency}")
|
||||
|
@ -6,7 +6,7 @@ gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
|
||||
from ..widgets.transparency_scale import TransparencyScale
|
||||
|
||||
|
||||
class CenterContainer(Gtk.Box):
|
||||
@ -35,13 +35,21 @@ class CenterContainer(Gtk.Box):
|
||||
|
||||
def _load_widgets(self):
|
||||
glade_box = self._builder.get_object("glade_box")
|
||||
button = Gtk.Button(label="Click Me!")
|
||||
glade_box = self._builder.get_object("glade_box")
|
||||
button = Gtk.Button(label = "Interactive Debug")
|
||||
button2 = Gtk.Button(label = "Click Me!")
|
||||
|
||||
button.connect("clicked", self._hello_world)
|
||||
button.connect("clicked", self._interactive_debug)
|
||||
button2.connect("clicked", self._hello_world)
|
||||
|
||||
self.add(TransparencyScale())
|
||||
self.add(button)
|
||||
self.add(button2)
|
||||
self.add(glade_box)
|
||||
|
||||
|
||||
def _hello_world(self, widget=None, eve=None):
|
||||
def _interactive_debug(self, widget = None, eve = None):
|
||||
event_system.emit("load_interactive_debug")
|
||||
|
||||
def _hello_world(self, widget = None, eve = None):
|
||||
logger.debug("Hello, World!")
|
||||
|
48
src/core/widgets/transparency_scale.py
Normal file
48
src/core/widgets/transparency_scale.py
Normal file
@ -0,0 +1,48 @@
|
||||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
class TransparencyScale(Gtk.Scale):
|
||||
def __init__(self):
|
||||
super(TransparencyScale, self).__init__()
|
||||
|
||||
|
||||
self._setup_styling()
|
||||
self._setup_signals()
|
||||
self._subscribe_to_events()
|
||||
self._load_widgets()
|
||||
|
||||
self.show_all()
|
||||
|
||||
|
||||
def _setup_styling(self):
|
||||
self.set_digits(0)
|
||||
self.set_value_pos(Gtk.PositionType.RIGHT)
|
||||
self.add_mark(50.0, Gtk.PositionType.TOP, "50%")
|
||||
|
||||
|
||||
def _setup_signals(self):
|
||||
self.connect("value-changed", self._update_transparency)
|
||||
|
||||
def _subscribe_to_events(self):
|
||||
...
|
||||
|
||||
def _load_widgets(self):
|
||||
adjust = self.get_adjustment()
|
||||
adjust.set_lower(0)
|
||||
adjust.set_upper(99)
|
||||
adjust.set_value(settings.theming.transparency)
|
||||
adjust.set_step_increment(1.0)
|
||||
|
||||
def _update_transparency(self, range):
|
||||
event_system.emit("remove_transparency")
|
||||
tp = int(range.get_value())
|
||||
settings.theming.transparency = tp
|
||||
event_system.emit("update_transparency")
|
@ -45,12 +45,17 @@ class Window(Gtk.ApplicationWindow):
|
||||
self.set_gravity(5) # 5 = CENTER
|
||||
self.set_position(1) # 1 = CENTER, 4 = CENTER_ALWAYS
|
||||
|
||||
ctx = self.get_style_context()
|
||||
ctx.add_class("main-window")
|
||||
ctx.add_class(f"mw_transparency_{settings.theming.transparency}")
|
||||
|
||||
def _setup_signals(self):
|
||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self._tear_down)
|
||||
self.connect("delete-event", self._tear_down)
|
||||
|
||||
def _subscribe_to_events(self):
|
||||
event_system.subscribe("tear_down", self._tear_down)
|
||||
event_system.subscribe("load_interactive_debug", self._load_interactive_debug)
|
||||
|
||||
def _load_widgets(self, args, unknownargs):
|
||||
if settings_manager.is_debug():
|
||||
@ -96,6 +101,9 @@ class Window(Gtk.ApplicationWindow):
|
||||
cr.paint()
|
||||
cr.set_operator(cairo.OPERATOR_OVER)
|
||||
|
||||
def _load_interactive_debug(self):
|
||||
self.set_interactive_debugging(True)
|
||||
|
||||
|
||||
def _tear_down(self, widget = None, eve = None):
|
||||
event_system.emit("shutting_down")
|
||||
|
@ -94,13 +94,13 @@ class SettingsManager(StartCheckMixin, Singleton):
|
||||
bindings = json.load(file)["keybindings"]
|
||||
keybindings.configure(bindings)
|
||||
except Exception as e:
|
||||
print( f"Settings: {self._KEY_BINDINGS_FILE}\n\t\t{repr(e)}" )
|
||||
print( f"Settings Manager: {self._KEY_BINDINGS_FILE}\n\t\t{repr(e)}" )
|
||||
|
||||
try:
|
||||
with open(self._CONTEXT_MENU) as file:
|
||||
self._context_menu_data = json.load(file)
|
||||
except Exception as e:
|
||||
print( f"Settings: {self._CONTEXT_MENU}\n\t\t{repr(e)}" )
|
||||
print( f"Settings Manager: {self._CONTEXT_MENU}\n\t\t{repr(e)}" )
|
||||
|
||||
|
||||
self.settings: Settings = None
|
||||
@ -187,4 +187,4 @@ class SettingsManager(StartCheckMixin, Singleton):
|
||||
|
||||
def save_settings(self):
|
||||
with open(self._CONFIG_FILE, 'w') as outfile:
|
||||
json.dump(self.settings.as_dict(), outfile, separators=(',', ':'), indent=4)
|
||||
json.dump(self.settings.as_dict(), outfile, separators=(',', ':'), indent=4)
|
@ -8,6 +8,7 @@ from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class Theming:
|
||||
success_color: str = "#88cc27"
|
||||
warning_color: str = "#ffa800"
|
||||
error_color: str = "#ff0000"
|
||||
transparency: int = 64
|
||||
success_color: str = "#88cc27"
|
||||
warning_color: str = "#ffa800"
|
||||
error_color: str = "#ff0000"
|
||||
|
@ -1,10 +1,3 @@
|
||||
* {
|
||||
/* background: rgba(0, 0, 0, 0.14); */
|
||||
background: rgba(39, 43, 52, 0.24);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
border: 2px solid rgba(0, 0, 0, 0.0);
|
||||
}
|
||||
|
||||
.base-container {
|
||||
margin: 10px;
|
||||
}
|
||||
@ -32,3 +25,106 @@ XfdesktopIconView.view .rubberband {
|
||||
XfdesktopIconView.view:active {
|
||||
background-color: rgba(172, 102, 21, 1);
|
||||
} */
|
||||
|
||||
|
||||
|
||||
|
||||
.mw_transparency_1 { background: rgba(39, 43, 52, 0.1); }
|
||||
.mw_transparency_2 { background: rgba(39, 43, 52, 0.2); }
|
||||
.mw_transparency_3 { background: rgba(39, 43, 52, 0.3); }
|
||||
.mw_transparency_4 { background: rgba(39, 43, 52, 0.4); }
|
||||
.mw_transparency_5 { background: rgba(39, 43, 52, 0.5); }
|
||||
.mw_transparency_6 { background: rgba(39, 43, 52, 0.6); }
|
||||
.mw_transparency_7 { background: rgba(39, 43, 52, 0.7); }
|
||||
.mw_transparency_8 { background: rgba(39, 43, 52, 0.8); }
|
||||
.mw_transparency_9 { background: rgba(39, 43, 52, 0.9); }
|
||||
.mw_transparency_10 { background: rgba(39, 43, 52, 0.10); }
|
||||
.mw_transparency_11 { background: rgba(39, 43, 52, 0.11); }
|
||||
.mw_transparency_12 { background: rgba(39, 43, 52, 0.12); }
|
||||
.mw_transparency_13 { background: rgba(39, 43, 52, 0.13); }
|
||||
.mw_transparency_14 { background: rgba(39, 43, 52, 0.14); }
|
||||
.mw_transparency_15 { background: rgba(39, 43, 52, 0.15); }
|
||||
.mw_transparency_16 { background: rgba(39, 43, 52, 0.16); }
|
||||
.mw_transparency_17 { background: rgba(39, 43, 52, 0.17); }
|
||||
.mw_transparency_18 { background: rgba(39, 43, 52, 0.18); }
|
||||
.mw_transparency_19 { background: rgba(39, 43, 52, 0.19); }
|
||||
.mw_transparency_20 { background: rgba(39, 43, 52, 0.20); }
|
||||
.mw_transparency_21 { background: rgba(39, 43, 52, 0.21); }
|
||||
.mw_transparency_22 { background: rgba(39, 43, 52, 0.22); }
|
||||
.mw_transparency_23 { background: rgba(39, 43, 52, 0.23); }
|
||||
.mw_transparency_24 { background: rgba(39, 43, 52, 0.24); }
|
||||
.mw_transparency_25 { background: rgba(39, 43, 52, 0.25); }
|
||||
.mw_transparency_26 { background: rgba(39, 43, 52, 0.26); }
|
||||
.mw_transparency_27 { background: rgba(39, 43, 52, 0.27); }
|
||||
.mw_transparency_28 { background: rgba(39, 43, 52, 0.28); }
|
||||
.mw_transparency_29 { background: rgba(39, 43, 52, 0.29); }
|
||||
.mw_transparency_30 { background: rgba(39, 43, 52, 0.30); }
|
||||
.mw_transparency_31 { background: rgba(39, 43, 52, 0.31); }
|
||||
.mw_transparency_32 { background: rgba(39, 43, 52, 0.32); }
|
||||
.mw_transparency_33 { background: rgba(39, 43, 52, 0.33); }
|
||||
.mw_transparency_34 { background: rgba(39, 43, 52, 0.34); }
|
||||
.mw_transparency_35 { background: rgba(39, 43, 52, 0.35); }
|
||||
.mw_transparency_36 { background: rgba(39, 43, 52, 0.36); }
|
||||
.mw_transparency_37 { background: rgba(39, 43, 52, 0.37); }
|
||||
.mw_transparency_38 { background: rgba(39, 43, 52, 0.38); }
|
||||
.mw_transparency_39 { background: rgba(39, 43, 52, 0.39); }
|
||||
.mw_transparency_40 { background: rgba(39, 43, 52, 0.40); }
|
||||
.mw_transparency_41 { background: rgba(39, 43, 52, 0.41); }
|
||||
.mw_transparency_42 { background: rgba(39, 43, 52, 0.42); }
|
||||
.mw_transparency_43 { background: rgba(39, 43, 52, 0.43); }
|
||||
.mw_transparency_44 { background: rgba(39, 43, 52, 0.44); }
|
||||
.mw_transparency_45 { background: rgba(39, 43, 52, 0.45); }
|
||||
.mw_transparency_46 { background: rgba(39, 43, 52, 0.46); }
|
||||
.mw_transparency_47 { background: rgba(39, 43, 52, 0.47); }
|
||||
.mw_transparency_48 { background: rgba(39, 43, 52, 0.48); }
|
||||
.mw_transparency_49 { background: rgba(39, 43, 52, 0.49); }
|
||||
.mw_transparency_50 { background: rgba(39, 43, 52, 0.50); }
|
||||
.mw_transparency_51 { background: rgba(39, 43, 52, 0.51); }
|
||||
.mw_transparency_52 { background: rgba(39, 43, 52, 0.52); }
|
||||
.mw_transparency_53 { background: rgba(39, 43, 52, 0.53); }
|
||||
.mw_transparency_54 { background: rgba(39, 43, 52, 0.54); }
|
||||
.mw_transparency_55 { background: rgba(39, 43, 52, 0.55); }
|
||||
.mw_transparency_56 { background: rgba(39, 43, 52, 0.56); }
|
||||
.mw_transparency_57 { background: rgba(39, 43, 52, 0.57); }
|
||||
.mw_transparency_58 { background: rgba(39, 43, 52, 0.58); }
|
||||
.mw_transparency_59 { background: rgba(39, 43, 52, 0.59); }
|
||||
.mw_transparency_60 { background: rgba(39, 43, 52, 0.60); }
|
||||
.mw_transparency_61 { background: rgba(39, 43, 52, 0.61); }
|
||||
.mw_transparency_62 { background: rgba(39, 43, 52, 0.62); }
|
||||
.mw_transparency_63 { background: rgba(39, 43, 52, 0.63); }
|
||||
.mw_transparency_64 { background: rgba(39, 43, 52, 0.64); }
|
||||
.mw_transparency_65 { background: rgba(39, 43, 52, 0.65); }
|
||||
.mw_transparency_66 { background: rgba(39, 43, 52, 0.66); }
|
||||
.mw_transparency_67 { background: rgba(39, 43, 52, 0.67); }
|
||||
.mw_transparency_68 { background: rgba(39, 43, 52, 0.68); }
|
||||
.mw_transparency_69 { background: rgba(39, 43, 52, 0.69); }
|
||||
.mw_transparency_70 { background: rgba(39, 43, 52, 0.70); }
|
||||
.mw_transparency_71 { background: rgba(39, 43, 52, 0.71); }
|
||||
.mw_transparency_72 { background: rgba(39, 43, 52, 0.72); }
|
||||
.mw_transparency_73 { background: rgba(39, 43, 52, 0.73); }
|
||||
.mw_transparency_74 { background: rgba(39, 43, 52, 0.74); }
|
||||
.mw_transparency_75 { background: rgba(39, 43, 52, 0.75); }
|
||||
.mw_transparency_76 { background: rgba(39, 43, 52, 0.76); }
|
||||
.mw_transparency_77 { background: rgba(39, 43, 52, 0.77); }
|
||||
.mw_transparency_78 { background: rgba(39, 43, 52, 0.78); }
|
||||
.mw_transparency_79 { background: rgba(39, 43, 52, 0.79); }
|
||||
.mw_transparency_80 { background: rgba(39, 43, 52, 0.80); }
|
||||
.mw_transparency_81 { background: rgba(39, 43, 52, 0.81); }
|
||||
.mw_transparency_82 { background: rgba(39, 43, 52, 0.82); }
|
||||
.mw_transparency_83 { background: rgba(39, 43, 52, 0.83); }
|
||||
.mw_transparency_84 { background: rgba(39, 43, 52, 0.84); }
|
||||
.mw_transparency_85 { background: rgba(39, 43, 52, 0.85); }
|
||||
.mw_transparency_86 { background: rgba(39, 43, 52, 0.86); }
|
||||
.mw_transparency_87 { background: rgba(39, 43, 52, 0.87); }
|
||||
.mw_transparency_88 { background: rgba(39, 43, 52, 0.88); }
|
||||
.mw_transparency_89 { background: rgba(39, 43, 52, 0.89); }
|
||||
.mw_transparency_90 { background: rgba(39, 43, 52, 0.90); }
|
||||
.mw_transparency_91 { background: rgba(39, 43, 52, 0.91); }
|
||||
.mw_transparency_92 { background: rgba(39, 43, 52, 0.92); }
|
||||
.mw_transparency_93 { background: rgba(39, 43, 52, 0.93); }
|
||||
.mw_transparency_94 { background: rgba(39, 43, 52, 0.94); }
|
||||
.mw_transparency_95 { background: rgba(39, 43, 52, 0.95); }
|
||||
.mw_transparency_96 { background: rgba(39, 43, 52, 0.96); }
|
||||
.mw_transparency_97 { background: rgba(39, 43, 52, 0.97); }
|
||||
.mw_transparency_98 { background: rgba(39, 43, 52, 0.98); }
|
||||
.mw_transparency_99 { background: rgba(39, 43, 52, 0.99); }
|
||||
|
Loading…
Reference in New Issue
Block a user