It is currently May 2nd, 2024, 2:42 am

[RESOLVED] 3.0 beta skin windows not resizing correctly

Report bugs with the Rainmeter application and suggest features.
FlyingHyrax
Posts: 232
Joined: July 1st, 2011, 1:32 am
Location: US

[RESOLVED] 3.0 beta skin windows not resizing correctly

Post by FlyingHyrax »

[update 2]
This issue is resolved in beta r1995. (Looking at the change log, it may have been fixed in r1990 - but I neglected to check that revision when it was released.
Thanks guys!
[/update]

[update]
I retested with a newer beta (r1950) and the problem still occurs on my systems (both Windows 7 x64 sp1). Besides the resizing problem, I have also noticed that compared to 2.5, the skin "flickers" more severely when switching pages. The original video showing the problem was taken down from Sta.sh so I uploaded a new one.
[/update]

Hello,

I have found what I think is a bug in 3.0 beta (r1930, r1950). When the size of a skin changes, the display window for the skin is not redrawn correctly after a single refresh. (So if the skin gets larger and is refreshed once, the display window is the same size as it was previously and skin elements outside that area are not displayed.) After being refreshed again, the skin will display correctly.

I have a "tabbed" settings/configuration skin -when the user clicks on some text, I use !WriteKeyValue to change a "page" variable (which is used with @include to show the correct page) and fire a !Refresh bang. Each of the page files which are used with @include contain a different height variable, so the skin height changes per page (behaviorally like Kaelri's Enigma options skin).

The skin functioned fine on version 2.5 final - but a user on DeviantArt noticed the problem on the latest 3.0 beta, and it happens on my system as well after updating to 3.0 r1930 (also r1950). He actually made a video documenting the problem New video here.

Interestingly, the problem does not occur with Kaelri's Enigma Options skin - leading me to think the devil is somewhere in my ridiculously complex page switching system (which involves Lua) - but it worked on 2.5...
:???:

Code for the settings skin specifically:
Settings.ini

Code: Select all

[Rainmeter]
Update=1000
Group=circa2

[Metadata]
Name=Settings Configuration Skin
Author=Flying Hyrax | flyinghyrax.deviantart.com
Information=This skin can be used to change appearance, system, and other settings for Circuitous Two. | The "info" tab shows general skin information, like the version, license, and credits. | The "appearance" sectoion is used to change how the skin looks, like the orientation, font, and colors. | The "system" section contains general system settings, like those for hard drives and network speeds. | The "time" section contains the settings for the clock skin. | The "weather" section holds the settings for the Weather skin.
Version=beta 2
License=Creative Commons BY-NC-SA 3.0

@include1=#@#Settings.txt
@include2=#@#Appearance.txt

[Variables]
page=2
textColor=250,250,250,210
highlightColor=254,210,70,230
dimColor=120,120,120,100
bgColor=10,10,10,220
displayVersion=2.0

; ============================================================
; Text input and script measures

[mAppearanceInput]
Measure=Plugin
Plugin=InputText
W=120
H=15
SolidColor=100,100,100
FontColor=#textColor#
FontFace=Arial
FontSize=10
StringStyle=Normal
StringAlign=Left
FocusDismiss=1
DefaultValue="..."
X=160
Command1=[!WriteKeyValue "Variables" "pieColor" "$UserInput$" "#@#Appearance.txt"][!RefreshGroup circa2] DefaultValue="#pieColor#" Y=290
COmmand2=[!WriteKeyValue "Variables" "innerRingColor" "$UserInput$" "#@#Appearance.txt"][!RefreshGroup circa2] DefaultValue="#innerRingColor#" Y=325
Command3=[!WriteKeyValue "Variables" "pieBgColor" "$UserInput$" "#@#Appearance.txt"][!RefreshGroup circa2] DefaultValue="#pieBgColor#" Y=360
Command4=[!WriteKeyValue "variables" "radius" "$UserInput$" "#@#Appearance.txt"][!RefreshGroup circa2] DefaultValue="#radius#" FontSize=11 X=300 Y=115 W=70 H=18
Command5=[!WriteKeyValue "variables" "edging" "(#*radius*#*$UserInput$)" "#@#Appearance.txt"][!RefreshGroup circa2] DefaultValue="ex: 0.15" FontSize=11 X=300 Y=170 W=70 H=18
Command6=[!WriteKeyValue "variables" "mainFont" "$UserInput$" "#@#Appearance.txt"][!RefreshGroup circa2] DefaultValue="#mainFont#" FontSize=11 X=130 Y=225 W=100 H=18

[mSettingsInput]
Measure=Plugin
Plugin=InputText
X=130
W=70
H=18
SolidColor=100,100,100
FontColor=#textColor#
FontFace=Arial
FontSize=10
StringStyle=Normal
StringAlign=Left
FocusDismiss=1
DefaultValue=""
Command1=[!WriteKeyValue "Variables" "hd1" "$UserInput$" "#@#Settings.txt"][!Refresh "CircuitousTwo\Disks\disk1"][!Refresh #CURRENTCONFIG#] DefaultValue="#hd1#" Y=40 W=25
Command2=[!WriteKeyValue "Variables" "hd2" "$UserInput$" "#@#Settings.txt"][!Refresh "CircuitousTwo\Disks\disk2"][!Refresh #CURRENTCONFIG#] DefaultValue="#hd2#" X=170 Y=40 W=25
Command3=[!WriteKeyValue "Variables" "hd3" "$UserInput$" "#@#Settings.txt"][!Refresh "CircuitousTwo\Disks\disk3"][!Refresh #CURRENTCONFIG#] DefaultValue="#hd3#" X=210 Y=40 W=25
Command4=[!CommandMeasure "mSettingsScript" "setNetworkSpeed('uploadMax', '$UserInput$')"][!Refresh "CircuitousTwo\Network\upload"][!Refresh #CURRENTCONFIG#] X=185 Y=150 W=75 
Command5=[!CommandMeasure "mSettingsScript" "setNetworkSpeed('downloadMax', '$UserInput$')"][!Refresh "CircuitousTwo\Network\download"][!Refresh #CURRENTCONFIG#] X=205 Y=167 W=75
Command6=[!WriteKeyValue "Variables" "timeFormat" "$UserInput$" "#@#Settings.txt"][!Refresh "CircuitousTwo\Time"][!Refresh #CURRENTCONFIG#] DefaultValue="#timeFormat#" X=170 Y=133 W=90
Command7=[!WriteKeyValue "Variables" "dateFormat" "$UserInput$" "#@#Settings.txt"][!Refresh "CircuitousTwo\Time"][!Refresh #CURRENTCONFIG#] DefaultValue="#dateFormat#" X=170 Y=190 W=90 
Command8=[!WriteKeyValue "Variables" "woeid" "$UserInput$" "#@#Settings.txt"][!Refresh "CircuitousTwo\Weather"][!Refresh #CURRENTCONFIG#] DefaultValue="#woeid#" X=190 Y=40

[mSettingsScript]
Measure=Script
ScriptFile="#@#Scripts\Settings.lua"

; ============================================================
; Common Styles

[allText]
AntiAlias=1
FontFace=Sansation

[pageSwitcher]
FontColor=#textColor#
StringAlign=RightCenter
SolidColor=0,0,0,1
FontSize=12
Group=pButtons
X=110
Y=25r

[headerText]
FontColor=#highlightColor#
FontSize=13
SolidColor=0,0,0,1
AntiAlias=1
FontFace=Sansation
StringAlign=LeftBottom
ToolTipWidth=300
X=130

[subText]
FontColor=#textColor#
FontSize=11
AntiAlias=1
FontFace=Sansation
SolidColor=0,0,0,1
ToolTipWidth=200
X=r
Y=r

; ============================================================
; Background meters

[bg]
Meter=IMAGE
SolidColor=#bgColor#
X=0
Y=0
W=400
H=#bgH#

[bgTopEdge]
Meter=Image
SolidColor=#dimColor#
X=1
Y=0
W=398
H=1

[bgBottomEdge]
Meter=Image
SolidColor=#dimColor#
X=1
Y=(#bgH#-1)
W=398
H=1

[bgLeftEdge]
Meter=Image
SolidColor=#dimColor#
X=0
Y=0
W=1
H=#bgH#

[bgRightEdge]
Meter=Image
SolidColor=#dimColor#
X=399
Y=0
W=1
H=#bgH#

; ============================================================
; Current page

@include5="#@#SettingsPages\page#page#.inc"

; ============================================================
; Page switchers

[divider1]
Meter=IMAGE
SolidColor=#dimColor#
X=115
Y=10
W=1
H=(#bgH#-20)

[markerTop]
Meter=Image
SolidColor=#highlightColor#
SolidColor2=0,0,0,1
GradientAngle=270
X=115
Y=(#dotY#-5)
W=1
H=5

[markerBottom]
Meter=Image
SolidColor=#highlightColor#
SolidColor2=0,0,0,1
GradientAngle=90
X=115
Y=#dotY#
W=1
H=5

[page1]
Meter=String
MeterStyle=allText | pageSwitcher
Text="info"
Y=30
LeftMouseUpAction=[!WriteKeyValue Variables page 1][!Refresh]

[page2]
Meter=String
MeterStyle=allText | pageSwitcher
Text="appearance"
LeftMouseUpAction=[!WriteKeyValue Variables page 2][!Refresh]

[page3]
Meter=String
MeterStyle=allText | pageSwitcher
Text="system"
LeftMouseUpAction=[!WriteKeyValue Variables page 3][!Refresh]

[page4]
Meter=String
MeterStyle=allText | pageSwitcher
Text="time"
LeftMouseUpAction=[!WriteKeyValue Variables page 4][!Refresh]

[page5]
Meter=String
MeterStyle=allText | pageSwitcher
Text="weather"
LeftMouseUpAction=[!WriteKeyValue Variables page 5][!Refresh]

; ============================================================
; quick links

[readme]
Meter=String
MeterStyle=allText
StringAlign=RightCenter
SolidColor=0,0,0,1
FontColor=#textColor#
FontSize=11
X=110
Y=(#bgH#-70)
Text=readme
LeftMouseUpaction=["#@#ReadMe.rtf"]
ToolTipText="opens the file ReadMe.rtf"

[advanced]
Meter=String
MeterStyle=allText | readme
Y=25r
Text=advanced
LeftMouseUpaction=["#@#Appearance.txt"]["#@#Settings.txt"]
ToolTipText="opens appearance.txt and settings.txt to manually edit settings"

[reset]
Meter=String
MeterStyle=allText | readme
Y=25r
Text=reset all
LeftMouseUpaction=!CommandMeasure "mSettingsScript" "resetAllVariables()"
ToolTipText="changes ALL settings back to defaults"
Settings.lua (If you squint and turn your head a little bit, it doesn't look so bad...)

Code: Select all

isDbg = false

function Initialize()
	
	hexChars = { 	[0]='0', [1]='1', [2]='2', [3]='3', 
				[4]='4', [5]='5', [6]='6', [7]='7', 
				[8]='8', [9]='9', [10]='a', [11]='b', 
				[12]='c', [13]='d', [14]='e', [15]='f' }
	
	page = tonumber(SKIN:GetVariable('page',1))
	
	ulBytes = SKIN:GetVariable('uploadMax')
	dlBytes = SKIN:GetVariable('downloadMax')
	
	SKIN:Bang('!SetOptionGroup','pButtons','FontColor','#*textColor*#')
	
	if (page == 1) then
		SKIN:Bang('!SetOption','page1','FontColor','#*highlightColor*#')
	
	elseif page == 2 then
		SKIN:Bang('!SetOption','page2','FontColor','#*highlightColor*#')
	
		colors = { 	SKIN:GetVariable('pieColor'), 
					SKIN:GetVariable('innerRingColor'), 
					SKIN:GetVariable('pieBgColor') }
		
		bars = {	SKIN:GetMeter('1ColorAlpha'), 
					SKIN:GetMeter('2ColorAlpha'), 
					SKIN:GetMeter('3ColorAlpha') }
		
		maxBarW = SKIN:GetMeter('1ColorAlphaBg'):GetW()
		
		-- set the width of the bars that show the alpha of the three colors
		for i=1,#colors do
			tempW = math.floor(getStringAlphaPercent(colors[i]) * maxBarW)
			SKIN:Bang('!SetOption', bars[i]:GetName(), 'W', tempW)
		end
	
	elseif page == 3 then
		SKIN:Bang('!SetOption','page3','FontColor','#*highlightColor*#')
		
		SKIN:Bang('!SetOption', 'uploadMaxDisplay', 'Text', string.format("%.2f", bytesToMegabits(ulBytes)))
		SKIN:Bang('!SetOption', 'downloadMaxDisplay', 'Text', string.format("%.2f", bytesToMegabits(dlBytes)))
	
	elseif page == 4 then
		SKIN:Bang('!SetOption','page4','FontColor','#*highlightColor*#')
	
	elseif page == 5 then
		SKIN:Bang('!SetOption','page5','FontColor','#*highlightColor*#')
	
	else 
		print('C2: wtf? invalid page number in settings skin')
	end
	SKIN:Bang('!Redraw')
end

function Update()
	
	
end

-- ==========================================================================================
-- Functions used for displaying and changing the transparency of the colors on page 2

-- called from skin - changes alpha value on a color in Appearance.txt
function changeAlpha(color, percent)
	baseColor = SKIN:GetVariable(color)
	alpha = math.floor(percent*0.01*255)
	if (string.find(baseColor, ",") ~= nil) then 
		rgb = string.match(baseColor, "%d+,%d+,%d+")
		newColor = rgb .. ',' .. alpha
	else
		rgb = string.sub(baseColor,1,6)
		alpha = decToHex(alpha)
		newColor = rgb .. alpha
	end
	SKIN:Bang('!WriteKeyValue','Variables',color,newColor,'#@#Appearance.txt')
end

-- intended to retreive the alpha component of an RGBA or hex color and return as a percent 0.0 to 1.0
function getStringAlphaPercent(color)
	local alpha
	if (string.find(color, ",") ~= nil) then
		
		rgbIt = string.gmatch(color,"%d+")
		rgbTable = {}
		for match in rgbIt do
			table.insert(rgbTable, match)
		end
		
		if (#rgbTable < 4) then
			alpha = 1
		else
			alpha = (rgbTable[4] / 255)
			alpha = string.format("%.2f",alpha)
		end
	else
		if (string.len(color)) > 6 then
			alpha = hexToDec(string.sub(color,7,8))
			alpha = (alpha / 255)
			alpha = string.format("%.2f",alpha)
		else
			alpha = 1
		end
	end
	return tonumber(alpha)
end

-- converts a hexadecimal string to a decimal number
function hexToDec(hexNum)
	hexNum = string.lower(hexNum)
	sum = 0
	for i=1,#hexNum,1 do
		sum = sum + (findHexChar(string.sub(hexNum,i,i)) * 16^(#hexNum-i))
	end
	return sum
end

-- converts decimal number to hexadecimal string
function decToHex(decNum)
	local result = {}
	while (decNum > 0) do
		table.insert(result, 1, hexChars[math.fmod(decNum, 16)])
		decNum = math.floor(decNum / 16)
	end
	return table.concat(result,'',1,#result)
end

-- linearly searches hexChar array for a given character and returns its index
function findHexChar(char)
	for i=0,#hexChars do
		if hexChars[i] == char then
			return i
		end
	end
	return -1
end

-- ==========================================================================================
-- Functions for audjusting maximum network speeds on page 3

function setNetworkSpeed(variable, speed)
	SKIN:Bang('!WriteKeyValue', 'Variables', variable, megabitsToBytes(speed), "#@#Settings.txt")
end

function megabitsToBytes(mbits)
	return math.floor((mbits*1024*1024)/8)
end

function bytesToMegabits(bytes)
	return ((bytes*8)/1024/1024)
end

-- ==========================================================================================
-- switched weather unit

function toggleWeatherUnit()
	oldUnit = SKIN:GetVariable('unit','f')
	if (string.lower(oldUnit) == 'f') then 
		SKIN:Bang('!WriteKeyValue', 'Variables', 'unit', 'c', '#@#Settings.txt')	
	elseif (string.lower(oldUnit) == 'c') then
		SKIN:Bang('!WriteKeyValue', 'Variables', 'unit', 'f', '#@#Settings.txt')
	else
		print('C2: error changing weather unit')
	end
	SKIN:Bang('!Refresh', 'CircuitousTwo\\Weather')
	SKIN:Bang('!Refresh', '#CURRENTCONFIG#')
end

-- ==========================================================================================
-- function rewrites appearance.txt and settings.txt with default values

function resetAllVariables()
	
	settingsDefaults = { 
		{ 'hd1', 'C' }, 
		{ 'hd2', 'D' }, 
		{ 'hd3', 'E' },
		{ 'mediaPlayer', 'CAD' },
		{ 'trashMax', '2147483648' },
		{ 'timeFormat', '\"%#H:%M\"' },
		{ 'dateFormat', '"%a, %#d %B"' },
		{ 'timeRoundline', '3' },
		{ 'uploadMax', '393216' },
		{ 'downloadMax', '655360' },
		{ 'woeid', '615702' },
		{ 'unit', 'c' },
		{'sfTempIndex', '2'},
		{'sfVoltIndex', '2'},
		{'sfMaxTemp', '100'}
	}
	
	appearanceDefaults = {
		{ 'innerRingColor', '250,250,250,155' },
		{ 'outerRingColor', '#*innerRingColor*#' },
		{ 'pieBgColor', '100,100,100,51' },
		{ 'pieColor', '250,250,250,230' },
		{ 'TextMainColor', '#*pieColor*#' },
		{ 'TextSubColor', '#*innerRingColor*#' },
		{ 'radius', '36' },
		{ 'innerRadius', '(#*radius*#*0.55)' },
		{ 'edging', '(#*radius*#*0.3)' },
		{ 'orient', 'left' },
		{ 'pieSize', '1.0' },
		{ 'pieStart', '0' },
		{ 'hideInnerEdge', '0' },
		{ 'hideOuterEdge', '0' },
		{ 'hidePieBg', '0' },
		{ 'hideDivider', '0' },
		{ 'hideSubText', '0' },
		{ 'mainFont', 'Sansation' },
		{ 'subFont', '#*mainFont*#' },
		{ 'subTwoLines', '0' },
		{ 'fontStyle', 'Normal' }
	}

	for _,t in pairs(settingsDefaults) do
		SKIN:Bang('!WriteKeyValue', 'Variables', t[1], t[2], '#@#Settings.txt')
	end
	
	for _,t in pairs(appearanceDefaults) do
		SKIN:Bang('!WriteKeyValue', 'Variables', t[1], t[2], '#@#Appearance.txt')
	end
	
	SKIN:Bang('!RefreshGroup', 'circa2')
	
	print('C2: all user settings reset to default')
end
Screenshots:
Initial state:
Image
After clicking the "Appearance" link:
Image
After clicking the "Appearance" link a second time, or refreshing the skin via the context menu:
Image
Version info:
3.0.0 beta r1930 64-bit (May 19 2013) & 3.0.0 beta r1950 64-bit (June 9 2013)
Path: C:\Program Files\Rainmeter\
IniFile: C:\Users\...\AppData\Roaming\Rainmeter\Rainmeter.ini
SkinPath: C:\Users\...\Rainmeter\
Windows 7 sp1 64-bit
D2D off (problem occurs with D2D on as well)
Last edited by FlyingHyrax on July 3rd, 2013, 3:13 pm, edited 5 times in total.
Flying Hyrax on DeviantArt
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: [BUG] 3.0 r1930 skin windows not resizing correctly

Post by eclectic-tech »

I downloaded your skin and tried it on my system and it worked fine; RM 3.0.0 beta r1946, so I could not duplicate your issue.

Have tried adding:

Code: Select all

DynamicWindowSize=1

to the [Rainmeter] section to see if that corrects the issue (just a thought)?
FlyingHyrax
Posts: 232
Joined: July 1st, 2011, 1:32 am
Location: US

Re: [BUG] 3.0 r1930 skin windows not resizing correctly

Post by FlyingHyrax »

On r1930 DynamicWindowSize did not fix the problem.
I have not checked for the issue on later beta versions since I first posted this topic. Probably the issue is resolved on r1946 - I will check tomorrow to confirm and edit my original post if needed.

[update]
I tested again using the latest beta revision 1950 and the problem still occurs on both of my computers. DynamicWindowSize appears to have no effect. I have also noticed that compared to 2.5, on 3.0 the skin "flickers" more severely when the page changes.
(9 June)
Flying Hyrax on DeviantArt
FlyingHyrax
Posts: 232
Joined: July 1st, 2011, 1:32 am
Location: US

Re: [BUG] 3.0 beta skin windows not resizing correctly

Post by FlyingHyrax »

More fun - I noticed today that the display of the alpha/transparency bars is not functioning correctly for me either. (Not sure how I missed it originally, but you can see it in the video from the first post - the bars above the color strings on the "Appearance" page should show the transparency level.)

This confirms for me (imho) that there is something wonky in the way that bangs fired from Lua is handled in 3.0 - much of the page switching and the code that sets the size of the transparency sliders is in my Lua script.

Again, I would assume that this is a problem with my code, except that the skin functions flawlessly on 2.5. I suppose it is possible (or probable, since eclectic-tech could not reproduce the bug) that there is something specific to my system or installation that is causing this. I have no idea what that might be, though.
Flying Hyrax on DeviantArt
FlyingHyrax
Posts: 232
Joined: July 1st, 2011, 1:32 am
Location: US

Re: [RESOLVED] 3.0 beta skin windows not resizing correctly

Post by FlyingHyrax »

Updated original post - the issue appears to be resolved in revision 1995. :D Taking a gander at the release notes, it is probable that it was actually fixed in r1990, but I was busy playing Kerbal Space Program and neglected to check that release... :oops:
Thanks and have a great day! :thumbup:
Flying Hyrax on DeviantArt