-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
582 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ dist/ | |
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import lib.var as var | ||
import json | ||
|
||
# Load preferences | ||
if not os.path.exists(var.PREFERENCE_DIR): | ||
os.makedirs(var.PREFERENCE_DIR) | ||
|
||
# Set default preferences | ||
app_preferences = { | ||
"tray" : False, | ||
"log" : True, | ||
"profiles" : True, | ||
"preview" : True, | ||
"startMinimized": False, | ||
"closeToTray" : False, | ||
"applyStart" : False, | ||
"extendSpeed" : False, | ||
"language" : "" | ||
} | ||
|
||
# Get path to preference file | ||
pref_file = os.path.join(var.PREFERENCE_DIR, var.PREFERENCE_FILE) | ||
|
||
if os.path.isfile(pref_file): | ||
# Read preferences from file and merge with default preferences | ||
with open(f"{pref_file}", 'rt') as file: | ||
app_preferences = {**app_preferences, **json.load(file)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import wx | ||
from wx.adv import TaskBarIcon | ||
|
||
import gettext | ||
_ = gettext.gettext | ||
|
||
DYNAMIC_TRAY_START = 5 | ||
|
||
####################### | ||
# class AcerRGBGUI_Tray | ||
#---------------------- | ||
# Handles tray icon | ||
class AcerRGBGUI_Tray(TaskBarIcon): | ||
def __init__(self, parent): | ||
TaskBarIcon.__init__(self) | ||
|
||
self.parent = parent | ||
|
||
# Set tray icon | ||
self.SetIcon(wx.Icon('./assets/icon.png', wx.BITMAP_TYPE_PNG), _("RGB Config")) | ||
|
||
# Static bindings for hide / restore and quit | ||
self.Bind(wx.EVT_MENU, self.on_toggle_gui , id=1) | ||
self.Bind(wx.EVT_MENU, self.parent.on_force_close, id=2) | ||
|
||
# Hide / restore main window on left click | ||
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.on_toggle_gui) | ||
|
||
def CreatePopupMenu(self): | ||
menu = wx.Menu() | ||
menuID = DYNAMIC_TRAY_START | ||
|
||
# Add available profiles dynamically | ||
for profile in self.parent.profiles: | ||
menu.Append(menuID, profile) | ||
self.Bind(wx.EVT_MENU, self.on_quick_profile, id=menuID) | ||
|
||
menuID += 1 | ||
|
||
# Separate profiles from static menu items | ||
menu.AppendSeparator() | ||
|
||
# Add static menu items | ||
menu.Append(1, _("RGB Config")) | ||
menu.Append(2, _("Close")) | ||
|
||
return menu | ||
|
||
def on_toggle_gui(self, event): | ||
if self.parent.IsShown(): | ||
self.parent.Hide() | ||
|
||
# Destroy about dialog if open | ||
if self.parent.aboutDlg: | ||
self.parent.aboutDlg.Destroy() | ||
self.parent.aboutDlg = None | ||
else: | ||
self.parent.Show() | ||
|
||
def on_quick_profile(self, event): | ||
self.parent.loadProfile(self.parent.profiles[event.Id-DYNAMIC_TRAY_START]) | ||
self.parent.apply() |
Oops, something went wrong.