From: <jb...@us...> - 2010-02-15 08:26:39
|
Revision: 511 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=511&view=rev Author: jblance Date: 2010-02-15 08:26:32 +0000 (Mon, 15 Feb 2010) Log Message: ----------- Bug fixes in Unified Import - file import tab Modified Paths: -------------- pytrainer/trunk/glade/importdata.glade pytrainer/trunk/pytrainer/gui/windowimportdata.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/glade/importdata.glade =================================================================== --- pytrainer/trunk/glade/importdata.glade 2010-02-08 08:03:51 UTC (rev 510) +++ pytrainer/trunk/glade/importdata.glade 2010-02-15 08:26:32 UTC (rev 511) @@ -222,6 +222,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="tooltip" translatable="yes">Add files to import activities from</property> <property name="use_stock">True</property> <property name="focus_on_click">False</property> <signal name="clicked" handler="on_buttonSelectFiles_clicked"/> @@ -246,7 +247,7 @@ <child> <widget class="GtkLabel" id="labelSelectFileFrame"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Select file(s) to import activities from</b></property> + <property name="label" translatable="yes"><b>Add file(s) to import activities from</b></property> <property name="use_markup">True</property> <property name="single_line_mode">True</property> </widget> @@ -312,6 +313,7 @@ <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="tooltip" translatable="yes">Import selected activities</property> <signal name="clicked" handler="on_buttonFileImport_clicked"/> </widget> <packing> @@ -328,6 +330,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="tooltip" translatable="yes">Close Import dialog</property> <property name="use_stock">True</property> <signal name="clicked" handler="on_buttonFileClose_clicked"/> </widget> Modified: pytrainer/trunk/pytrainer/gui/windowimportdata.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowimportdata.py 2010-02-08 08:03:51 UTC (rev 510) +++ pytrainer/trunk/pytrainer/gui/windowimportdata.py 2010-02-15 08:26:32 UTC (rev 511) @@ -306,28 +306,31 @@ self.treeviewImportEvents.set_headers_clickable(True) self.treeviewImportEvents.set_model(store) return store + + def checkTreestoreForSelection(self, store): + """ + Function iterates over store checking if any items are selected + returns True if at least one item is selected, False otherwise + Checks item in position 1 only + """ + for item in store: + if item[1]: + return True + return False def treeviewImportFiles_toggled_checkbox(self, cell, path, store): """ Sets the state of the checkbox to true or false. """ store[path][1] = not store[path][1] - self.buttonRemoveSelectedFiles.set_sensitive(0) - for item in store: - if item[1]: - #Only enable remove button if at least one file is selected - self.buttonRemoveSelectedFiles.set_sensitive(1) - + self.buttonRemoveSelectedFiles.set_sensitive(self.checkTreestoreForSelection(store)) + def treeviewImportEvents_toggled_checkbox(self, cell, path, store): """ Sets the state of the checkbox to true or false. """ store[path][1] = not store[path][1] - self.buttonFileImport.set_sensitive(0) - for item in store: - if item[1]: - #Only enable import button if at least one activity is selected - self.buttonFileImport.set_sensitive(1) + self.buttonFileImport.set_sensitive(self.checkTreestoreForSelection(store)) def treeviewImportEvents_setCheckboxes(self, state): """ @@ -377,6 +380,7 @@ file_index += 1 for activity_iter in activity_iters: self.activities_store.remove(activity_iter) + self.buttonFileImport.set_sensitive(self.checkTreestoreForSelection(self.activities_store)) #Set correct state for import button for file_iter in file_iters: self.files_store.remove(file_iter) @@ -425,7 +429,7 @@ def updateActivity(self, activityID, file_id, status = None, notes = None): path = 0 for item in self.activities_store: - if item[0] == activityID and item[7] == file_id: + if item[0] == activityID and item[7] == str(file_id): if status is not None: self.activities_store[path][1] = status if notes is not None: @@ -525,7 +529,6 @@ def on_buttonRemoveSelectedFiles_clicked(self, widget): #Remove selected files and associated activities from list - #TODO self.removeSelectedFiles() def on_buttonFileImport_clicked(self, widget): Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-02-08 08:03:51 UTC (rev 510) +++ pytrainer/trunk/pytrainer/main.py 2010-02-15 08:26:32 UTC (rev 511) @@ -101,7 +101,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.7.1_svn#510" + self.version ="1.7.1_svn#511" self.DB_version = 3 self.date = Date() # Checking profile This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |