summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Sivak <msivak@redhat.com>2010-09-07 18:14:59 +0200
committerMartin Sivak <msivak@redhat.com>2010-09-07 18:14:59 +0200
commit5a3ce15d8ce2039bbfcc871eeb1b5d9f25c8519d (patch)
tree5500211efa53d0911538dea337463d82607f518a
parentf2477f2f404edb1cc8bbafc490a203f9905bcde1 (diff)
downloadfirstaidkit-5a3ce15d8ce2039bbfcc871eeb1b5d9f25c8519d.zip
firstaidkit-5a3ce15d8ce2039bbfcc871eeb1b5d9f25c8519d.tar.gz
firstaidkit-5a3ce15d8ce2039bbfcc871eeb1b5d9f25c8519d.tar.xz
Saving and resetting Info object
-rw-r--r--frontend/frontend_gtk.py2
-rw-r--r--pyfirstaidkit/configuration.py20
2 files changed, 16 insertions, 6 deletions
diff --git a/frontend/frontend_gtk.py b/frontend/frontend_gtk.py
index 3cb7665..679fd9a 100644
--- a/frontend/frontend_gtk.py
+++ b/frontend/frontend_gtk.py
@@ -26,6 +26,7 @@ import copy
import logging
from pyfirstaidkit import reporting
from pyfirstaidkit.returns import *
+from pyfirstaidkit.configuration import resetInfo
import pprint
import os.path
import thread
@@ -320,6 +321,7 @@ class CallbacksMainWindow(object):
self._data.result_list_store.clear()
del self._data.result_list_iter
self._data.result_list_iter = dict()
+ resetInfo()
return True
def on_b_StopResults_activate(self, widget, *args):
diff --git a/pyfirstaidkit/configuration.py b/pyfirstaidkit/configuration.py
index fc534fb..85110d4 100644
--- a/pyfirstaidkit/configuration.py
+++ b/pyfirstaidkit/configuration.py
@@ -96,8 +96,8 @@ class FAKConfigSection(object):
def unlock(self):
self.__dict__["__use_lock"] = False
- def attach(self, file):
- self.__dict__["__configuration"].attach(file)
+ def attach(self, file, saveas = None):
+ self.__dict__["__configuration"].attach(file, saveas)
def __getattr__(self, key):
if not self.__dict__["__configuration"]. \
@@ -198,12 +198,20 @@ class FAKInfo(ConfigParser.SafeConfigParser, FAKConfigMixIn):
temp = StringIO()
ConfigParser.SafeConfigParser.write(self, temp)
fd.writestr("results.ini", temp.getvalue())
- for f in self._attachments:
- fd.write(f)
+ for f,fas in self._attachments:
+ fd.write(f, fas)
fd.close()
- def attach(self, file):
- self._attachments.append(file)
+ def attach(self, file, saveas = None):
+ if saveas is None:
+ saveas = file
+ self._attachments.append((file, saveas))
Info = FAKInfo()
Info.lock()
+
+def resetInfo():
+ global Info
+ Info = FAKInfo()
+ Info.lock()
+