Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mostypc123 committed Dec 27, 2024
1 parent bbe2ea7 commit 0206d6b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ def __init__(self, *args, **kwargs):
self.inactive_color = config.get("headerInactive", "#b3d0e4") # Default values if not found

# Apply style and set initial header color
pywinstyles.apply_style(self, "mica")
pywinstyles.change_header_color(self, color=self.active_color)
try:
pywinstyles.apply_style(self, "mica")
pywinstyles.change_header_color(self, color=self.active_color)
except Exception as e:
pass

# Bind focus events for dynamic color change
self.Bind(wx.EVT_ACTIVATE, self.on_activate)
Expand Down Expand Up @@ -62,10 +65,13 @@ def load_config(filepath):
return config

def on_activate(self, event):
if event.GetActive():
pywinstyles.change_header_color(self, color=self.active_color)
else:
pywinstyles.change_header_color(self, color=self.inactive_color)
try:
if event.GetActive():
pywinstyles.change_header_color(self, color=self.active_color)
else:
pywinstyles.change_header_color(self, color=self.inactive_color)
except Exception as e:
pass

# Ensure event is processed further
event.Skip()
Expand Down Expand Up @@ -866,13 +872,7 @@ def OnNewFile(self, event):

# Call OnFileOpen to handle everything else
self.OnFileOpen(None)

def ApplyTextAreaDarkMode(self, text_area):
dark_bg_color = wx.Colour(67, 66, 67)
text_color = wx.Colour(255, 255, 255)
text_area.SetBackgroundColour(dark_bg_color)
text_area.SetForegroundColour(text_color)


def OnRunCode(self, event):
"""Runs the code in the current text area"""
# Get the current tab
Expand Down

0 comments on commit 0206d6b

Please sign in to comment.