read and save config file taken from command-line
This commit is contained in:
1 parent
19e8ac95ed
commit
7d84b64c79
2 files changed
+15
-2
No files matched your search
@@ -2,7 +2,9 @@
|
||||
import gtk
|
||||
|
||||
class Window(object):
|
||||
def __init__(self):
|
||||
def __init__(self, conf):
|
||||
self.conf = conf
|
||||
|
||||
self.window = gtk.Window()
|
||||
self.window.set_decorated(False)
|
||||
self.window.connect('destroy', self.destroy_event)
|
||||
|
||||
+12
-1
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import gtk
|
||||
import imaplib
|
||||
@@ -35,8 +36,18 @@ def save_config(fname, conf):
|
||||
fh.close()
|
||||
|
||||
def main(argv):
|
||||
window = Window()
|
||||
if len(argv) < 2:
|
||||
sys.stderr.write('Specify config file as an argument\n')
|
||||
return 2
|
||||
|
||||
config_fname = argv[1]
|
||||
|
||||
conf = get_config(config_fname)
|
||||
|
||||
window = Window(conf)
|
||||
window.run()
|
||||
|
||||
save_config(config_fname, window.conf)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
Reference in new issue
Block a user