mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 11:30:19 +01:00
* Added eject field in config.
* Added information (written on terminal, where program is runned) about writing configuration in the very first time.
This commit is contained in:
13
config.py
13
config.py
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python
|
# This Python file uses the following encoding: utf-8
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
config parser object
|
config parser object
|
||||||
"""
|
"""
|
||||||
@@ -39,6 +38,7 @@ class Config:
|
|||||||
'v' : 300,
|
'v' : 300,
|
||||||
'exportxls' : False,
|
'exportxls' : False,
|
||||||
'cd' : '/cdrom',
|
'cd' : '/cdrom',
|
||||||
|
'eject' : 'eject -r'
|
||||||
}
|
}
|
||||||
|
|
||||||
dictconf = {
|
dictconf = {
|
||||||
@@ -48,10 +48,11 @@ class Config:
|
|||||||
"vertical panes":"v",
|
"vertical panes":"v",
|
||||||
"export xls":"exportxls",
|
"export xls":"exportxls",
|
||||||
"cd drive":"cd",
|
"cd drive":"cd",
|
||||||
|
"eject command":"eject",
|
||||||
}
|
}
|
||||||
|
|
||||||
dbool = ('exportxls')
|
dbool = ('exportxls')
|
||||||
dstring = ('cd')
|
dstring = ('cd','eject')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
path = os.environ['HOME']
|
path = os.environ['HOME']
|
||||||
@@ -62,7 +63,10 @@ class Config:
|
|||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
self.confd
|
try:
|
||||||
|
os.lstat("%s/.pygtktalog" % self.path)
|
||||||
|
except:
|
||||||
|
print "Saving preferences to %s/.pygtktalog" % self.path
|
||||||
newIni = Ini()
|
newIni = Ini()
|
||||||
newIni.add_section("pyGTKtalog conf")
|
newIni.add_section("pyGTKtalog conf")
|
||||||
for opt in self.dictconf:
|
for opt in self.dictconf:
|
||||||
@@ -92,6 +96,5 @@ class Config:
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
print "No config file"
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user