From 71764e7ccb7d8a2085c0d984b37e4895a53407df Mon Sep 17 00:00:00 2001 From: Harishankar Date: Sat, 10 Dec 2011 10:28:32 +0530 Subject: [PATCH] Added file filter for BiaCV files Added a file filter for save and open dialog for BiaCV files. The default extension is .biacv --- biacv_lang.py | 4 +++- biacv_mainwindow.py | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/biacv_lang.py b/biacv_lang.py index cbac4ac..c9cf4e4 100644 --- a/biacv_lang.py +++ b/biacv_lang.py @@ -17,4 +17,6 @@ ABOUT_TITLE = "About BiaCV" ABOUT_TEXT = """BiaCV - A resume creator/editor Copyright 2011 V.Harishankar . -Licensed under the GNU GPL v3.""" \ No newline at end of file +Licensed under the GNU GPL v3.""" + +BIACV_FILE_FILTER = "BiaCV document(*.biacv);;All files(*.*)" \ No newline at end of file diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index f9e79b3..a68652c 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -78,7 +78,8 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): return # open file dialog - openfilename = PyQt4.QtGui.QFileDialog.getOpenFileName (self, lang.OPEN_TITLE) + openfilename = PyQt4.QtGui.QFileDialog.getOpenFileName (self, lang.OPEN_TITLE, + filter = lang.BIACV_FILE_FILTER) # if no open file name then return if openfilename == "": return @@ -121,7 +122,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): # function to save a file as a new document def on_file_save_as (self): savefilename = PyQt4.QtGui.QFileDialog.getSaveFileName (self, - lang.SAVE_TITLE) + lang.SAVE_TITLE, filter=lang.BIACV_FILE_FILTER) # if save file name is not none if savefilename <> "": @@ -140,7 +141,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): # if no current file get file name from file save dialog if self.currentfile is None: savefilename = PyQt4.QtGui.QFileDialog.getSaveFileName (self, - lang.SAVE_TITLE) + lang.SAVE_TITLE, filter=lang.BIACV_FILE_FILTER) if savefilename <> "": mydata = self.get_document_data () -- 2.20.1