Skip to content

Commit 8a0a723

Browse files
committed
Refactored variables to better reflect function and improve readability
1 parent a534a88 commit 8a0a723

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

mlapptools.m

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
%
44
% MLAPPTOOLS methods:
55

6-
properties (Constant)
7-
querytimeout = 5; % Dojo query timeout period, seconds
6+
properties (Access = private, Constant = true)
7+
QUERY_TIMEOUT = 5; % Dojo query timeout period, seconds
88
end
99

1010
methods
@@ -22,8 +22,8 @@ function textAlign(uielement, alignment)
2222

2323
[win, widgetID] = mlapptools.getWebElements(uielement);
2424

25-
alignsetstr = sprintf('dojo.style(dojo.query("#%s")[0], "textAlign", "%s")', widgetID, alignment);
26-
win.executeJS(alignsetstr);
25+
alignSetStr = sprintf('dojo.style(dojo.query("#%s")[0], "textAlign", "%s")', widgetID, alignment);
26+
win.executeJS(alignSetStr);
2727
end
2828

2929

@@ -32,8 +32,8 @@ function fontWeight(uielement, weight)
3232

3333
[win, widgetID] = mlapptools.getWebElements(uielement);
3434

35-
fontwtsetstr = sprintf('dojo.style(dojo.query("#%s")[0], "font-weight", "%s")', widgetID, weight);
36-
win.executeJS(fontwtsetstr);
35+
fontWeightSetStr = sprintf('dojo.style(dojo.query("#%s")[0], "font-weight", "%s")', widgetID, weight);
36+
win.executeJS(fontWeightSetStr);
3737
end
3838

3939

@@ -42,8 +42,8 @@ function fontColor(uielement, newcolor)
4242

4343
[win, widgetID] = mlapptools.getWebElements(uielement);
4444

45-
fontwtsetstr = sprintf('dojo.style(dojo.query("#%s")[0], "color", "%s")', widgetID, newcolor);
46-
win.executeJS(fontwtsetstr);
45+
fontColorSetStr = sprintf('dojo.style(dojo.query("#%s")[0], "color", "%s")', widgetID, newcolor);
46+
win.executeJS(fontColorSetStr);
4747
end
4848
end
4949

@@ -54,7 +54,7 @@ function fontColor(uielement, newcolor)
5454
mlapptools.togglewarnings('off')
5555

5656
tic
57-
while true && (toc < mlapptools.querytimeout)
57+
while true && (toc < mlapptools.TIMEOUT)
5858
try
5959
% Add check for container change in R2017a (version 9.2)
6060
if verLessThan('matlab', '9.2')
@@ -74,11 +74,11 @@ function fontColor(uielement, newcolor)
7474
end
7575
mlapptools.togglewarnings('on')
7676

77-
if toc >= mlapptools.querytimeout
77+
if toc >= mlapptools.QUERY_TIMEOUT
7878
msgID = 'mlapptools:getWidgetID:QueryTimeout';
7979
error(msgID, ...
8080
'WidgetID query timed out after %u seconds, UI needs more time to load', ...
81-
mlapptools.querytimeout);
81+
mlapptools.QUERY_TIMEOUT);
8282
end
8383
end
8484

@@ -94,7 +94,7 @@ function fontColor(uielement, newcolor)
9494
widgetquerystr = sprintf('dojo.getAttr(dojo.query("[data-tag^=''%s''] > div")[0], "widgetid")', data_tag);
9595

9696
tic
97-
while true && (toc < mlapptools.querytimeout)
97+
while true && (toc < mlapptools.QUERY_TIMEOUT)
9898
try
9999
widgetID = win.executeJS(widgetquerystr);
100100
widgetID = widgetID(2:end-1);
@@ -111,11 +111,11 @@ function fontColor(uielement, newcolor)
111111
end
112112
mlapptools.togglewarnings('on')
113113

114-
if toc >= mlapptools.querytimeout
114+
if toc >= mlapptools.QUERY_TIMEOUT
115115
msgID = 'mlapptools:getWidgetID:QueryTimeout';
116116
error(msgID, ...
117117
'WidgetID query timed out after %u seconds, UI needs more time to load', ...
118-
mlapptools.querytimeout);
118+
mlapptools.QUERY_TIMEOUT);
119119
end
120120
end
121121

0 commit comments

Comments
 (0)