forked from chrisbura/pythoncad-legacy-layertable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MATTEO_BOSCOLO_TODO.TXT
53 lines (46 loc) · 1.99 KB
/
MATTEO_BOSCOLO_TODO.TXT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def addRecentFiles(self,fPath):
#-- - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=
# S-PM 110400
#Method to add the given full file name on top of the "Open history list",
#provided it is different from the one already present on top of the list.
#
#--Req-global
#MAX_RECENT_FILE local default max. history list length
#
#--Req
#fPath full file name to add to the list
#-- - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=
#--standard "Documentation String"
"""Add a new file name on top of the history list"""
#--Register
rgO=None #Object
rgN=None #Integer
rgL=None #List
#--Action
rgO=self.getApplicationSetting() #get current settings
#--get and consider history list lenght parameter
rgN=rgO.getVariable("MAX_RECENT_FILE")
#--work-around for we don't (yet) know exactly what "(not rgN)" means
if (not rgN): rgN=0
if (rgN<1): #<-force a local default value, if not given
rgN=MAX_RECENT_FILE
if (rgN<1): rgN=1 #force anyhow at least a length=1
rgO.setVariable("MAX_RECENT_FILE",rgN)
#>
#--get and consider current history list
rgL=rgO.getVariable("RECENT_FILE_ARRAY")
if (not rgL): #<-assign an empty list, if not given
rgL=[]
#>
#--conditioned addition of the given full file name
if (len(rgL)==0): #<-empty list:
rgL.insert(0,fPath) #add given file path
elif (rgL[0]!=fPath): #=-last recorded path is not the same:
rgL.insert(0,fPath) #add given file path
#>
while(len(rgL)>(rgN)): #--chop the list to the desired length
rgL.pop(-1)
#>
rgO.setVariable("RECENT_FILE_ARRAY", rgL) #--update current settings
self.updateApplicationSetting(rgO)
#addRecentFiles>