summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Oros <poros@redhat.com>2013-07-24 11:53:40 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-07-24 12:01:47 -0300
commitbd9c06255f16259c4c9ea385bb15dc21a3140f0e (patch)
tree8e9c51c6865660773c1d659632198675ceb8516d
parent1a2ab6189efde589265daeae6cf1506ea1e8efa1 (diff)
downloadtuna-bd9c06255f16259c4c9ea385bb15dc21a3140f0e.tar.gz
gui: edittab - hide man. tab if profile contain errors
Signed-off-by: Petr Oros <poros@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tuna/gui/commonview.py12
-rw-r--r--tuna/gui/profileview.py22
2 files changed, 28 insertions, 6 deletions
diff --git a/tuna/gui/commonview.py b/tuna/gui/commonview.py
index 0e37d6e..a8b475b 100644
--- a/tuna/gui/commonview.py
+++ b/tuna/gui/commonview.py
@@ -37,7 +37,15 @@ class commonview:
cur = self.profileview.configFileCombo.get_model()
for val in cur:
if val[0] == self.config.cacheFileName:
- self.profileview.configFileCombo.set_active(val.path[0])
+ try:
+ self.configFileCombo.handler_block_by_func(self.on_profileSelector_changed)
+ except TypeError as e:
+ pass
+ self.configFileCombo.set_active(val.path[0])
+ try:
+ self.configFileCombo.handler_unblock_by_func(self.on_profileSelector_changed)
+ except TypeError as e:
+ pass
while catCntr < catListlenght:
frames[catCntr] = gtk.Frame()
tLabel = gtk.Label('<b>'+self.config.categories[catCntr]+'</b>')
@@ -154,7 +162,7 @@ class commonview:
ret = self.guiSnapshot()
self.config.saveSnapshot(self.ret)
old_name = self.get_current_combo_selection()
- if self.profileview.setProfileFileList() and old_name[0] > 0:
+ if self.profileview.setProfileFileList():
self.profileview.set_current_tree_selection(old_name[1])
self.set_current_combo_selection(old_name[1])
diff --git a/tuna/gui/profileview.py b/tuna/gui/profileview.py
index 4fd99da..84ac45a 100644
--- a/tuna/gui/profileview.py
+++ b/tuna/gui/profileview.py
@@ -77,7 +77,6 @@ class profileview:
cell = gtk.CellRendererText()
self.configFileCombo.pack_start(cell, True)
self.configFileCombo.add_attribute(cell, "text", 0)
- self.comboHandler = self.configFileCombo.connect('changed', self.commonview.on_profileSelector_changed)
self.config_store.append([config])
self.configs.show()
self.combo_store.append([config])
@@ -259,6 +258,7 @@ class profileview:
f.close()
if self.setProfileFileList():
self.set_current_tree_selection(filename)
+ self.frame.hide()
except IOError as io:
self.show_mbox_warning(str(io))
return True
@@ -288,6 +288,10 @@ class profileview:
os.rename(self.config.config['root'] + old_filename, self.config.config['root'] + new_filename)
if self.setProfileFileList():
self.set_current_tree_selection(new_filename)
+ if self.config.checkConfigFile(self.config.config['root'] + new_filename) == '':
+ self.commonview.updateCommonView()
+ else:
+ self.frame.hide()
except OSError as io:
self.show_mbox_warning(str(io))
return True
@@ -305,6 +309,10 @@ class profileview:
self.show_mbox_warning(str(e))
if self.setProfileFileList():
self.set_current_tree_selection(new_filename)
+ if self.config.checkConfigFile(self.config.config['root'] + new_filename) == '':
+ self.commonview.updateCommonView()
+ else:
+ self.frame.hide()
return True
def on_menu_delete(self, widget):
@@ -318,11 +326,17 @@ class profileview:
if ret == gtk.RESPONSE_YES:
try:
os.unlink(self.config.config['root'] + filename)
- if self.setProfileFileList():
- self.configFileTree.set_cursor(0)
- return True
except OSError as oe:
self.show_mbox_warning(str(oe))
+ return False
+ if self.setProfileFileList():
+ self.configFileTree.set_cursor(0)
+ currentFile = self.get_current_tree_selection()
+ if self.config.checkConfigFile(self.config.config['root'] + currentFile) == '':
+ self.commonview.updateCommonView()
+ return True
+ else:
+ self.frame.hide()
return False
def get_text_dialog(self, message, default=''):