File Save As functionality implemented
authorHarishankar <v.harishankar@gmail.com>
Tue, 6 Dec 2011 05:12:17 +0000 (10:42 +0530)
committerHarishankar <v.harishankar@gmail.com>
Tue, 6 Dec 2011 05:12:17 +0000 (10:42 +0530)
Completed the File -> Save As... functionality in the GUI.

biacv_mainwindow.py
biacv_mainwindow.ui
biacv_mainwindow_ui.py

index 4a98c2d..681469d 100644 (file)
@@ -62,6 +62,19 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                # set the window title
                self.setWindowTitle ("BiaCV - " + self.currentfile)
 
+       # function to save a file as a new document
+       def on_file_save_as (self):
+               savefilename = PyQt4.QtGui.QFileDialog.getSaveFileName (self,
+                       lang.SAVE_TITLE)
+
+               # if save file name is not none
+               if savefilename <> "":
+                       mydata = self.get_document_data ()
+                       mydata.save_data (savefilename)
+                       self.ismodified = False
+                       self.currentfile = savefilename
+                       self.setWindowTitle ("BiaCV - " + self.currentfile)
+
        # function to save a file
        def on_file_save (self):
                # only save modified file
@@ -75,7 +88,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
 
                        if savefilename <> "":
                                mydata = self.get_document_data ()
-                               mydata.save_data (self.currentfile)
+                               mydata.save_data (savefilename)
                                self.ismodified = False
                                self.currentfile = savefilename
                                self.setWindowTitle ("BiaCV - " + self.currentfile)
index 9670324..9be86cd 100644 (file)
    <slot>on_add_education()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>426</x>
-     <y>189</y>
+     <x>70</x>
+     <y>98</y>
     </hint>
     <hint type="destinationlabel">
      <x>730</x>
    <slot>on_delete_education()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>658</x>
-     <y>189</y>
+     <x>100</x>
+     <y>98</y>
     </hint>
     <hint type="destinationlabel">
      <x>728</x>
    <hints>
     <hint type="sourcelabel">
      <x>100</x>
-     <y>217</y>
+     <y>102</y>
     </hint>
     <hint type="destinationlabel">
      <x>726</x>
    <slot>on_update_education()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>579</x>
-     <y>189</y>
+     <x>85</x>
+     <y>98</y>
     </hint>
     <hint type="destinationlabel">
      <x>728</x>
    <hints>
     <hint type="sourcelabel">
      <x>100</x>
-     <y>217</y>
+     <y>102</y>
     </hint>
     <hint type="destinationlabel">
      <x>729</x>
    <slot>on_change_currentemployment()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>328</x>
-     <y>136</y>
+     <x>80</x>
+     <y>88</y>
     </hint>
     <hint type="destinationlabel">
      <x>728</x>
    <slot>on_add_profession()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>309</x>
-     <y>216</y>
+     <x>61</x>
+     <y>99</y>
     </hint>
     <hint type="destinationlabel">
      <x>729</x>
    <hints>
     <hint type="sourcelabel">
      <x>99</x>
-     <y>244</y>
+     <y>103</y>
     </hint>
     <hint type="destinationlabel">
      <x>727</x>
    <hints>
     <hint type="sourcelabel">
      <x>99</x>
-     <y>244</y>
+     <y>103</y>
     </hint>
     <hint type="destinationlabel">
      <x>729</x>
    <slot>on_delete_profession()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>596</x>
-     <y>216</y>
+     <x>99</x>
+     <y>99</y>
     </hint>
     <hint type="destinationlabel">
      <x>729</x>
    <slot>on_update_profession()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>453</x>
-     <y>216</y>
+     <x>80</x>
+     <y>99</y>
     </hint>
     <hint type="destinationlabel">
      <x>726</x>
    <slot>on_add_skill()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>207</x>
-     <y>234</y>
+     <x>51</x>
+     <y>96</y>
     </hint>
     <hint type="destinationlabel">
      <x>730</x>
    <slot>on_delete_skill()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>566</x>
-     <y>234</y>
+     <x>99</x>
+     <y>96</y>
     </hint>
     <hint type="destinationlabel">
      <x>728</x>
    <hints>
     <hint type="sourcelabel">
      <x>99</x>
-     <y>261</y>
+     <y>102</y>
     </hint>
     <hint type="destinationlabel">
      <x>730</x>
    <hints>
     <hint type="sourcelabel">
      <x>99</x>
-     <y>261</y>
+     <y>102</y>
     </hint>
     <hint type="destinationlabel">
      <x>726</x>
    <slot>on_update_skill()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>386</x>
-     <y>234</y>
+     <x>75</x>
+     <y>96</y>
     </hint>
     <hint type="destinationlabel">
      <x>728</x>
    <slot>on_add_lang()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>468</x>
-     <y>132</y>
+     <x>107</x>
+     <y>110</y>
     </hint>
     <hint type="destinationlabel">
      <x>729</x>
    <slot>on_delete_lang()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>656</x>
-     <y>132</y>
+     <x>107</x>
+     <y>110</y>
     </hint>
     <hint type="destinationlabel">
      <x>733</x>
    <slot>on_select_lang()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>94</x>
-     <y>160</y>
+     <x>98</x>
+     <y>110</y>
     </hint>
     <hint type="destinationlabel">
      <x>730</x>
    <slot>on_select_lang()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>94</x>
-     <y>160</y>
+     <x>98</x>
+     <y>110</y>
     </hint>
     <hint type="destinationlabel">
      <x>730</x>
    <slot>on_update_lang()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>591</x>
-     <y>132</y>
+     <x>107</x>
+     <y>110</y>
     </hint>
     <hint type="destinationlabel">
      <x>729</x>
    <hints>
     <hint type="sourcelabel">
      <x>99</x>
-     <y>101</y>
+     <y>89</y>
     </hint>
     <hint type="destinationlabel">
      <x>0</x>
    <slot>on_document_modified()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>86</x>
-     <y>297</y>
+     <x>90</x>
+     <y>102</y>
     </hint>
     <hint type="destinationlabel">
      <x>2</x>
    <slot>on_document_modified()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>90</x>
-     <y>333</y>
+     <x>94</x>
+     <y>103</y>
     </hint>
     <hint type="destinationlabel">
      <x>1</x>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>actionSave_As</sender>
+   <signal>triggered()</signal>
+   <receiver>biacv_mainwindow</receiver>
+   <slot>on_file_save_as()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>364</x>
+     <y>248</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>on_add_education()</slot>
   <slot>on_file_new()</slot>
   <slot>on_file_save()</slot>
   <slot>on_file_open()</slot>
+  <slot>on_file_save_as()</slot>
  </slots>
 </ui>
index 5b34a9b..504b102 100644 (file)
@@ -2,7 +2,7 @@
 
 # Form implementation generated from reading ui file 'biacv_mainwindow.ui'
 #
-# Created: Mon Dec  5 20:12:17 2011
+# Created: Tue Dec  6 10:37:09 2011
 #      by: PyQt4 UI code generator 4.8.6
 #
 # WARNING! All changes made in this file will be lost!
@@ -609,6 +609,7 @@ class Ui_biacv_mainwindow(object):
         QtCore.QObject.connect(self.action_New, QtCore.SIGNAL(_fromUtf8("triggered()")), biacv_mainwindow.on_file_new)
         QtCore.QObject.connect(self.action_Save, QtCore.SIGNAL(_fromUtf8("triggered()")), biacv_mainwindow.on_file_save)
         QtCore.QObject.connect(self.action_Open, QtCore.SIGNAL(_fromUtf8("triggered()")), biacv_mainwindow.on_file_open)
+        QtCore.QObject.connect(self.actionSave_As, QtCore.SIGNAL(_fromUtf8("triggered()")), biacv_mainwindow.on_file_save_as)
         QtCore.QMetaObject.connectSlotsByName(biacv_mainwindow)
 
     def retranslateUi(self, biacv_mainwindow):