mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 19:40:21 +01:00
* Added __str__ method.
This commit is contained in:
36
config.py
36
config.py
@@ -46,7 +46,10 @@ class Config:
|
|||||||
'gthumb':False,
|
'gthumb':False,
|
||||||
'exif':False,
|
'exif':False,
|
||||||
'confirmquit':True,
|
'confirmquit':True,
|
||||||
'confirmunsaved':True,
|
'mntwarn':True,
|
||||||
|
'confirmabandon':True,
|
||||||
|
'showtoolbar':True,
|
||||||
|
'showstatusbar':True,
|
||||||
}
|
}
|
||||||
|
|
||||||
dictconf = {
|
dictconf = {
|
||||||
@@ -61,10 +64,27 @@ class Config:
|
|||||||
"eject command":"eject",
|
"eject command":"eject",
|
||||||
"image support":"pil",
|
"image support":"pil",
|
||||||
'confirm quit':'confirmquit',
|
'confirm quit':'confirmquit',
|
||||||
'warn unsaved':'confirmunsaved',
|
'warn mount/umount errors':'mntwarn',
|
||||||
|
'confirm abandon current catalog':'confirmabandon',
|
||||||
|
'show toolbar':'showtoolbar',
|
||||||
|
'show statusbar and progress bar':'showstatusbar',
|
||||||
}
|
}
|
||||||
|
|
||||||
dbool = ('exportxls','pil','savewin','savepan','eject','gthumb','exif')
|
dbool = (
|
||||||
|
'exportxls',
|
||||||
|
'pil',
|
||||||
|
'savewin',
|
||||||
|
'savepan',
|
||||||
|
'eject',
|
||||||
|
'gthumb',
|
||||||
|
'exif',
|
||||||
|
'confirmquit',
|
||||||
|
'mntwarn',
|
||||||
|
'confirmabandon',
|
||||||
|
'showtoolbar',
|
||||||
|
'showstatusbar',
|
||||||
|
)
|
||||||
|
|
||||||
dstring = ('cd','eject')
|
dstring = ('cd','eject')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -86,10 +106,13 @@ class Config:
|
|||||||
newIni.add_key(opt,self.confd[self.dictconf[opt]])
|
newIni.add_key(opt,self.confd[self.dictconf[opt]])
|
||||||
try:
|
try:
|
||||||
f = open("%s/.pygtktalog" % self.path,"w")
|
f = open("%s/.pygtktalog" % self.path,"w")
|
||||||
|
success = True
|
||||||
except:
|
except:
|
||||||
print "Cannot open config file %s for writing." % (self.path, "/.pygtktalog")
|
print "Cannot open config file %s for writing." % (self.path, "/.pygtktalog")
|
||||||
|
success = False
|
||||||
f.write(newIni.show())
|
f.write(newIni.show())
|
||||||
f.close()
|
f.close()
|
||||||
|
return success
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
try:
|
try:
|
||||||
@@ -110,4 +133,9 @@ class Config:
|
|||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
def __str__(self):
|
||||||
|
"""show prefs in string way"""
|
||||||
|
string = "[varname]\tvalue\n"
|
||||||
|
for i in self.confd:
|
||||||
|
string+="%s\t%s\n" % (i,self.confd[i])
|
||||||
|
return string
|
||||||
|
|||||||
Reference in New Issue
Block a user