From: <jb...@us...> - 2010-03-04 09:07:57
|
Revision: 519 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=519&view=rev Author: jblance Date: 2010-03-04 09:07:17 +0000 (Thu, 04 Mar 2010) Log Message: ----------- Unified import - auto start file import option 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-03-03 22:25:30 UTC (rev 518) +++ pytrainer/trunk/glade/importdata.glade 2010-03-04 09:07:17 UTC (rev 519) @@ -475,6 +475,7 @@ <child> <widget class="GtkHBox" id="hboxDefaultTab"> <property name="visible">True</property> + <property name="orientation">vertical</property> <child> <widget class="GtkRadioButton" id="radiobuttonTabGPSDevice"> <property name="label" translatable="yes">Import from GPS Device</property> @@ -492,19 +493,41 @@ </packing> </child> <child> - <widget class="GtkRadioButton" id="radiobuttonFile"> - <property name="label" translatable="yes">Import from File</property> + <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - <property name="group">radiobuttonTabGPSDevice</property> + <child> + <widget class="GtkRadioButton" id="radiobuttonFile"> + <property name="label" translatable="yes">Import from File</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <property name="group">radiobuttonTabGPSDevice</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkCheckButton" id="checkbuttonAutoLaunch"> + <property name="label" translatable="yes">Launch 'File Select' on start</property> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip" translatable="yes">Automatically start the file selection dialog</property> + <property name="xalign">0.47999998927116394</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">10</property> + <property name="position">1</property> + </packing> + </child> </widget> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="padding">10</property> <property name="position">1</property> </packing> </child> Modified: pytrainer/trunk/pytrainer/gui/windowimportdata.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowimportdata.py 2010-03-03 22:25:30 UTC (rev 518) +++ pytrainer/trunk/pytrainer/gui/windowimportdata.py 2010-03-04 09:07:17 UTC (rev 519) @@ -51,16 +51,21 @@ self.defaulttab = 0 else: self.defaulttab = int(self.defaulttab) + self.auto_launch = self.configuration.getValue("pytraining","auto_launch_file_selection") + if self.auto_launch == "True": + self.auto_launch = True + else: + self.auto_launch = False self.notebookMainTabs.set_current_page(self.defaulttab) - self.init_tab(self.defaulttab) + self.init_tab(self.defaulttab, first=True) - def init_tab(self, page): + def init_tab(self, page, first=False): if page == 0: #'Import from GPS Device' tab self.init_gpsdevice_tab() elif page == 1: #'Import from File' tab - self.init_file_tab() + self.init_file_tab(first) elif page ==2: #'Plugins' tab self.init_plugins_tab() @@ -80,7 +85,7 @@ def init_gpsdevice_tab(self): return - def init_file_tab(self): + def init_file_tab(self, first=False): #self.filechooserbuttonSelectFile.unselect_all() self.updateStatusbar(self.statusbarImportFile, _("No file selected") ) self.processClasses = [] @@ -94,6 +99,11 @@ self.files_store.clear() self.buttonRemoveSelectedFiles.set_sensitive(0) self.buttonFileImport.set_sensitive(0) + if first and self.auto_launch: + while gtk.events_pending(): # This allows the GUI to update + gtk.main_iteration() # before completion of this entire action + print "autolaunch active" + self.buttonSelectFiles.clicked() return def init_plugins_tab(self): @@ -147,10 +157,13 @@ #Set correct radiobutton based on saved preference if self.defaulttab == 1: self.radiobuttonFile.set_active(1) + self.checkbuttonAutoLaunch.set_sensitive(1) elif self.defaulttab == 2: self.radiobuttonPlugins.set_active(1) else: self.radiobuttonTabGPSDevice.set_active(1) + if self.auto_launch: + self.checkbuttonAutoLaunch.set_active(1) return def detect_tools(self): @@ -346,14 +359,18 @@ """ Save options selected in options tab """ + self.autoLaunchFileSelection = "False" #Default tab option if self.radiobuttonTabGPSDevice.get_active(): self.defaulttab = "0" elif self.radiobuttonFile.get_active(): self.defaulttab = "1" + if self.checkbuttonAutoLaunch.get_active(): + self.autoLaunchFileSelection = "True" elif self.radiobuttonPlugins.get_active(): self.defaulttab = "2" self.configuration.setValue("pytraining","import_default_tab",self.defaulttab) + self.configuration.setValue("pytraining","auto_launch_file_selection",self.autoLaunchFileSelection) #option def removeSelectedFiles(self): @@ -450,6 +467,9 @@ ## Window signal handlers ## ############################ + def on_radiobuttonFile_toggled(self, *args): + print "radio button toggled" + def on_pluginsButton_Configure_clicked(self, button, pluginClass): ''' Handler for plugin Buttons Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-03-03 22:25:30 UTC (rev 518) +++ pytrainer/trunk/pytrainer/main.py 2010-03-04 09:07:17 UTC (rev 519) @@ -63,7 +63,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.1_svn#517" + self.version ="1.7.1_svn#519" self.DB_version = 3 #Setup usage and permitted options This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |