Skip to content

Commit

Permalink
Version 2.3.0 (#24)
Browse files Browse the repository at this point in the history
- Added overlay art for generic errors.
- Added overlays for invalid path errors for Steam and Windows shortcuts.
- Added setting for toggling the visibility of the platform in overlays.
- Added support for executing bangs when a game starts or stops running.
- Added settings for Rainmeter bangs that should be executed when a game starts and when a game stops running.
- Updated tooltips.
- Updated names of tabs in the skin for settings.
- Minor optimization of the GUI.
- Fixed layout of input fields in the skin for settings.
  • Loading branch information
Kapiainen committed Feb 19, 2017
1 parent 9f8e04f commit a11ce89
Show file tree
Hide file tree
Showing 12 changed files with 475 additions and 239 deletions.
2 changes: 2 additions & 0 deletions Lauhdutin/@Resources/Backend/Enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ class GameKeys():
BANNER_ERROR = "bannererror"
BANNER_PATH = "banner"
BANNER_URL = "bannerurl"
ERROR = "error"
HIDDEN = "hidden"
HOURS_LAST_TWO_WEEKS = "hourslast2weeks"
HOURS_TOTAL = "hourstotal"
INVALID_PATH = "invalidpatherror"
LASTPLAYED = "lastplayed"
NAME = "title"
NOT_INSTALLED = "notinstalled"
Expand Down
3 changes: 3 additions & 0 deletions Lauhdutin/@Resources/Backend/Steam.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ def get_shortcuts(self):
game[GameKeys.BANNER_PATH] = "Steam shortcuts\\%s.jpg" % (
game[GameKeys.NAME])
game[GameKeys.PATH], shortcut = self.parse_shortcut_path(shortcut)
if not os.path.isfile(game[GameKeys.PATH]):
game[GameKeys.ERROR] = True
game[GameKeys.INVALID_PATH] = True
game[GameKeys.PATH] = "steam://rungameid/%s" % (
self.parse_shortcut_app_id(game[GameKeys.PATH],
game[GameKeys.NAME]))
Expand Down
9 changes: 3 additions & 6 deletions Lauhdutin/@Resources/Backend/WindowsShortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ def process_shortcut(self, a_shortcut):# a_name, a_path):
return (None, None)
game_dict = {}
game_dict[GameKeys.NAME] = name
#if not os.path.isfile(target_path):
# TODO
# - Add a field to the dictionary, if target_path is no longer valid
# - Create an overlay for Windows shortcuts that are no longer valid
# - Implement overlay in GUI.lua
# - Update test once implemented
if not os.path.isfile(target_path):
game_dict[GameKeys.ERROR] = True
game_dict[GameKeys.INVALID_PATH] = True
game_dict[GameKeys.PATH] = target_path
game_dict[GameKeys.LASTPLAYED] = 0
game_dict[GameKeys.PLATFORM] = Platform.WINDOWS_SHORTCUT
Expand Down
105 changes: 71 additions & 34 deletions Lauhdutin/@Resources/Frontend/GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ function Initialize()
BANNER_ERROR = "bannererror",
BANNER_PATH = "banner",
BANNER_URL = "bannerurl",
ERROR = "error",
HIDDEN = "hidden",
HOURS_LAST_TWO_WEEKS = "hourslast2weeks",
HOURS_TOTAL = "hourstotal",
INVALID_PATH = "invalidpatherror",
LASTPLAYED = "lastplayed",
NAME = "title",
NOT_INSTALLED = "notinstalled",
Expand Down Expand Up @@ -366,45 +368,67 @@ end
if T_FILTERED_GAMES ~= nil then
local nSlotCount = tonumber(T_SETTINGS[S_SETTING_SLOT_COUNT])
local j = N_SCROLL_INDEX
for i = 1, nSlotCount do
if j > 0 and j <= #T_FILTERED_GAMES then
for i = 1, nSlotCount do -- Iterate through each slot.
if j > 0 and j <= #T_FILTERED_GAMES then -- If the scroll index, 'j', is a valid index in the table 'T_FILTERED_GAMES'
SKIN:Bang('[!SetVariable SlotPath' .. i .. ' "' .. tostring(j) .. '"][!SetVariable SlotName' .. i .. ' "' .. T_FILTERED_GAMES[j][GAME_KEYS.NAME] .. '"]')
if BannerExists(T_FILTERED_GAMES[j][GAME_KEYS.BANNER_PATH]) then
SKIN:Bang('!SetVariable SlotImage' .. i .. ' "#@#Banners\\' .. T_FILTERED_GAMES[j][GAME_KEYS.BANNER_PATH] .. '"')
else
SKIN:Bang('!SetVariable SlotImage' .. i .. ' ""')
end
if N_LAUNCH_STATE == T_LAUNCH_STATES.LAUNCH then
if T_SETTINGS['show_hours_played'] and T_FILTERED_GAMES[j][GAME_KEYS.HOURS_TOTAL] then
local totalHoursPlayed = T_FILTERED_GAMES[j][GAME_KEYS.HOURS_TOTAL]
local hoursPlayed = math.floor(totalHoursPlayed)
local minutesPlayed = math.floor((totalHoursPlayed - hoursPlayed) * 60)
if T_FILTERED_GAMES[j][GAME_KEYS.NOT_INSTALLED] == true then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Install via ' .. PLATFORM_DESCRIPTION[T_FILTERED_GAMES[j][GAME_KEYS.PLATFORM]+1] .. '#CRLF##CRLF##CRLF##CRLF##CRLF#' .. hoursPlayed .. ' hours ' .. minutesPlayed .. ' minutes played"]')--[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightInstall.png"]')
if T_SETTINGS['slot_highlight'] then
if N_LAUNCH_STATE == T_LAUNCH_STATES.LAUNCH then
if T_SETTINGS['show_hours_played'] and T_FILTERED_GAMES[j][GAME_KEYS.HOURS_TOTAL] then
local totalHoursPlayed = T_FILTERED_GAMES[j][GAME_KEYS.HOURS_TOTAL]
local hoursPlayed = math.floor(totalHoursPlayed)
local minutesPlayed = math.floor((totalHoursPlayed - hoursPlayed) * 60)
if T_FILTERED_GAMES[j][GAME_KEYS.NOT_INSTALLED] == true then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Install via ' .. PLATFORM_DESCRIPTION[T_FILTERED_GAMES[j][GAME_KEYS.PLATFORM]+1] .. '#CRLF##CRLF##CRLF##CRLF##CRLF#' .. hoursPlayed .. ' hours ' .. minutesPlayed .. ' minutes played"]')
elseif T_FILTERED_GAMES[j][GAME_KEYS.INVALID_PATH] == true then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Invalid path#CRLF##CRLF##CRLF##CRLF##CRLF#' .. hoursPlayed .. ' hours ' .. minutesPlayed .. ' minutes played"]')
else
if T_SETTINGS["show_platform"] then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "' .. PLATFORM_DESCRIPTION[T_FILTERED_GAMES[j][GAME_KEYS.PLATFORM]+1] .. '#CRLF##CRLF##CRLF##CRLF##CRLF#' .. hoursPlayed .. ' hours ' .. minutesPlayed .. ' minutes played"]')
else
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "#CRLF##CRLF##CRLF##CRLF##CRLF#' .. hoursPlayed .. ' hours ' .. minutesPlayed .. ' minutes played"]')
end
end
else
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "' .. PLATFORM_DESCRIPTION[T_FILTERED_GAMES[j][GAME_KEYS.PLATFORM]+1] .. '#CRLF##CRLF##CRLF##CRLF##CRLF#' .. hoursPlayed .. ' hours ' .. minutesPlayed .. ' minutes played"]')--[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightPlay.png"]')
if T_FILTERED_GAMES[j][GAME_KEYS.NOT_INSTALLED] == true then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Install via ' .. PLATFORM_DESCRIPTION[T_FILTERED_GAMES[j][GAME_KEYS.PLATFORM]+1] .. '#CRLF##CRLF##CRLF##CRLF##CRLF#"]')
elseif T_FILTERED_GAMES[j][GAME_KEYS.INVALID_PATH] == true then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Invalid path#CRLF##CRLF##CRLF##CRLF##CRLF#"]')
else
if T_SETTINGS["show_platform"] then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "' .. PLATFORM_DESCRIPTION[T_FILTERED_GAMES[j][GAME_KEYS.PLATFORM]+1] .. '#CRLF##CRLF##CRLF##CRLF##CRLF#"]')
else
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" ""]')
end
end
end
else
if T_FILTERED_GAMES[j][GAME_KEYS.NOT_INSTALLED] == true then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Install via ' .. PLATFORM_DESCRIPTION[T_FILTERED_GAMES[j][GAME_KEYS.PLATFORM]+1] .. '#CRLF##CRLF##CRLF##CRLF##CRLF#"]')--[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightInstall.png"]')
SKIN:Bang('[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightInstall.png"]')
elseif T_FILTERED_GAMES[j][GAME_KEYS.ERROR] == true then
SKIN:Bang('[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightError.png"]')
else
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "' .. PLATFORM_DESCRIPTION[T_FILTERED_GAMES[j][GAME_KEYS.PLATFORM]+1] .. '#CRLF##CRLF##CRLF##CRLF##CRLF#"]')--[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightPlay.png"]')
SKIN:Bang('[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightPlay.png"]')
end
elseif N_LAUNCH_STATE == T_LAUNCH_STATES.HIDE then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Hide"][!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightHide.png"]')
elseif N_LAUNCH_STATE == T_LAUNCH_STATES.UNHIDE then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Unhide"][!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightUnhide.png"]')
end
if T_FILTERED_GAMES[j][GAME_KEYS.NOT_INSTALLED] == true then
SKIN:Bang('[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightInstall.png"]')
else
SKIN:Bang('[!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightPlay.png"]')
end
elseif N_LAUNCH_STATE == T_LAUNCH_STATES.HIDE then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Hide"][!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightHide.png"]')
elseif N_LAUNCH_STATE == T_LAUNCH_STATES.UNHIDE then
SKIN:Bang('[!SetVariable "SlotHighlightMessage' .. i .. '" "Unhide"][!SetOption "SlotHighlight' .. i .. '" "ImageName" "#@#Icons\\SlotHighlightUnhide.png"]')
end
else
SKIN:Bang('[!SetVariable SlotPath' .. i .. ' ""][!SetVariable SlotImage' .. i .. ' ""][!SetVariable SlotName' .. i .. ' ""][!SetVariable "SlotHighlightMessage' .. i .. '" ""]')
else -- Slot has no game to show.
if T_SETTINGS['slot_highlight'] then
SKIN:Bang('[!SetVariable SlotPath' .. i .. ' ""][!SetVariable SlotImage' .. i .. ' ""][!SetVariable SlotName' .. i .. ' ""][!SetVariable "SlotHighlightMessage' .. i .. '" ""]')
else
SKIN:Bang('[!SetVariable SlotPath' .. i .. ' ""][!SetVariable SlotImage' .. i .. ' ""][!SetVariable SlotName' .. i .. ' ""]')
end
end
if T_SETTINGS['slot_highlight'] then
SKIN:Bang('[!UpdateMeterGroup "SlotHighlight' .. i .. '"]')
end
SKIN:Bang('[!UpdateMeterGroup "SlotHighlight' .. i .. '"]')
j = j + 1
end
end
Expand Down Expand Up @@ -443,6 +467,7 @@ end
local sPath = tGame[GAME_KEYS.PATH]
if sPath ~= nil then
tGame[GAME_KEYS.LASTPLAYED] = os.time()
bNotInstalled = tGame[GAME_KEYS.NOT_INSTALLED]
if tGame[GAME_KEYS.HIDDEN] == true then
tGame[GAME_KEYS.HIDDEN] = nil
for i = 1, #T_HIDDEN_GAMES do -- Move game from T_HIDDEN_GAMES to T_ALL_GAMES
Expand All @@ -454,7 +479,7 @@ end
if tGame[GAME_KEYS.NOT_INSTALLED] == true then
tGame[GAME_KEYS.NOT_INSTALLED] = nil
end
elseif tGame[GAME_KEYS.NOT_INSTALLED] == true then
elseif bNotInstalled == true then
tGame[GAME_KEYS.NOT_INSTALLED] = nil
for i = 1, #T_NOT_INSTALLED_GAMES do -- Move game from T_NOT_INSTALLED_GAMES to T_ALL_GAMES
if T_NOT_INSTALLED_GAMES[i] == tGame then
Expand All @@ -467,15 +492,24 @@ end
FilterBy('')
Sort()
PopulateSlots()
T_RECENTLY_LAUNCHED_GAME = tGame
if StartsWith(sPath, 'steam://') then
SKIN:Bang('[!SetOption "ProcessMonitor" "ProcessName" "GameOverlayUI.exe"]')
else
local processPath = string.gsub(string.gsub(sPath, "\\", "/"), "//", "/")
local processName = processPath:reverse():match("(exe%p[^\\/:%*?<>|]+)/"):reverse()
SKIN:Bang('[!SetOption "ProcessMonitor" "ProcessName" "' .. processName .. '"]')
if tGame[GAME_KEYS.ERROR] == true then
SKIN:Bang('[!Log "Error: There is something wrong with ' .. tGame[GAME_KEYS.NAME] .. '"]')
return
end
if bNotInstalled ~= true then
T_RECENTLY_LAUNCHED_GAME = tGame
if StartsWith(sPath, 'steam://') then
SKIN:Bang('[!SetOption "ProcessMonitor" "ProcessName" "GameOverlayUI.exe"]')
else
local processPath = string.gsub(string.gsub(sPath, "\\", "/"), "//", "/")
local processName = processPath:reverse():match("(exe%p[^\\/:%*?<>|]+)/"):reverse()
SKIN:Bang('[!SetOption "ProcessMonitor" "ProcessName" "' .. processName .. '"]')
end
SKIN:Bang('[!UpdateMeasure "ProcessMonitor"]')
if T_SETTINGS['start_game_bang'] ~= nil and T_SETTINGS['start_game_bang'] ~= '' then
SKIN:Bang((T_SETTINGS['start_game_bang']:gsub('`', '"')))
end
end
SKIN:Bang('[!UpdateMeasure "ProcessMonitor"]')
SKIN:Bang('["' .. sPath .. '"]')
end
elseif N_LAUNCH_STATE == T_LAUNCH_STATES.HIDE then
Expand Down Expand Up @@ -569,6 +603,9 @@ end
T_RECENTLY_LAUNCHED_GAME[GAME_KEYS.HOURS_TOTAL] = hoursPlayed + T_RECENTLY_LAUNCHED_GAME[GAME_KEYS.HOURS_TOTAL]
WriteGames()
PopulateSlots()
if T_SETTINGS['stop_game_bang'] ~= nil and T_SETTINGS['stop_game_bang'] ~= '' then
SKIN:Bang((T_SETTINGS['stop_game_bang']:gsub('`', '"')))
end
end
end

Expand Down
37 changes: 37 additions & 0 deletions Lauhdutin/@Resources/Frontend/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ function Initialize()
if SETTINGS['show_hours_played'] == nil then
SETTINGS['show_hours_played'] = true
end
if SETTINGS['show_platform'] == nil then
SETTINGS['show_platform'] = true
end
if SETTINGS['steam_path'] == nil then
SETTINGS['steam_path'] = ""
end
Expand All @@ -41,6 +44,12 @@ function Initialize()
if SETTINGS['steam_id64'] == nil then
SETTINGS['steam_id64'] = ""
end
if SETTINGS['start_game_bang'] == nil then
SETTINGS['start_game_bang'] = ""
end
if SETTINGS['stop_game_bang'] == nil then
SETTINGS['stop_game_bang'] = ""
end
if SETTINGS['sortstate'] == nil then
SETTINGS['sortstate'] = "0"
end
Expand Down Expand Up @@ -133,6 +142,10 @@ function UpdateSettings()
SKIN:Bang('[!SetOption "GalaxyPathInput" "DefaultValue" "' .. SETTINGS['galaxy_path'] ..'"]')
SKIN:Bang('[!SetOption "PythonPathStatus" "Text" "' .. tostring(SETTINGS['python_path']) .. '"]')
SKIN:Bang('[!SetOption "PythonPathInput" "DefaultValue" "' .. SETTINGS['python_path'] ..'"]')
SKIN:Bang('[!SetOption "StartGameBangStatus" "Text" "' .. tostring(SETTINGS['start_game_bang']) .. '"]')
SKIN:Bang('[!SetOption "StartGameBangInput" "DefaultValue" "' .. SETTINGS['start_game_bang'] ..'"]')
SKIN:Bang('[!SetOption "StopGameBangStatus" "Text" "' .. tostring(SETTINGS['stop_game_bang']) .. '"]')
SKIN:Bang('[!SetOption "StopGameBangInput" "DefaultValue" "' .. SETTINGS['stop_game_bang'] ..'"]')
if SETTINGS['orientation'] == 'vertical' then
SKIN:Bang('[!SetOption "SkinOrientationStatus" "Text" "Vertical"]')
else
Expand All @@ -148,6 +161,11 @@ function UpdateSettings()
else
SKIN:Bang('[!SetOption "ShowHoursPlayedStatus" "Text" "Disabled"]')
end
if SETTINGS['show_platform'] == true then
SKIN:Bang('[!SetOption "ShowPlatformStatus" "Text" "Enabled"]')
else
SKIN:Bang('[!SetOption "ShowPlatformStatus" "Text" "Disabled"]')
end
SKIN:Bang('[!Update]')
SKIN:Bang('[!Redraw]')
end
Expand Down Expand Up @@ -311,6 +329,16 @@ function AcceptPythonPath(aPath)
UpdateSettings()
end

function AcceptStartGameBang(aPath)
SETTINGS['start_game_bang'] = aPath
UpdateSettings()
end

function AcceptStopGameBang(aPath)
SETTINGS['stop_game_bang'] = aPath
UpdateSettings()
end

function ToggleOrientation()
if SETTINGS['orientation'] == 'vertical' then
SETTINGS['orientation'] = 'horizontal'
Expand Down Expand Up @@ -338,6 +366,15 @@ function ToggleShowHoursPlayed()
UpdateSettings()
end

function ToggleShowPlatform()
if SETTINGS['show_platform'] == true then
SETTINGS['show_platform'] = false
else
SETTINGS['show_platform'] = true
end
UpdateSettings()
end

function ReadJSON(asPath)
local f = io.open(asPath, 'r')
if f ~= nil then
Expand Down
Binary file added Lauhdutin/@Resources/Icons/SlotHighlightError.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Lauhdutin/Main.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Name=Lauhdutin
Author=Kapiainen
Information=A Rainmeter skin for launching games.
Version=2.2.0
Version=2.3.0
License=MIT

[Rainmeter]
Expand Down
Loading

0 comments on commit a11ce89

Please sign in to comment.