コード例 #1
0
ファイル: container.py プロジェクト: intermezzo-fr/pireal
    def open_file(self):

        directory = os.path.expanduser("~")
        filename = QFileDialog.getOpenFileName(self, self.tr("Abrir Archivo"),
                                               directory, settings.DBFILE,
                                               QFileDialog.DontUseNativeDialog)
        if not filename:
            return
        ext = file_manager.get_extension(filename)
        if ext == '.pqf':
            # Query file
            self.new_query(filename)
        else:
            self.create_data_base(filename)
コード例 #2
0
ファイル: container.py プロジェクト: papablopo07/pireal
    def open_file(self):

        if self.__last_open_folder is None:
            directory = os.path.expanduser("~")
        else:
            directory = self.__last_open_folder
        filename = QFileDialog.getOpenFileName(self, self.tr("Abrir Archivo"),
                                               directory, settings.DBFILE,
                                               QFileDialog.DontUseNativeDialog)
        if not filename:
            return
        # Save folder
        self.__last_open_folder = file_manager.get_path(filename)

        ext = file_manager.get_extension(filename)
        if ext == '.pqf':
            # Query file
            self.new_query(filename)
        elif ext == '.rdb':
            self.load_rdb_database(file_manager.read_rdb_file(filename))
        else:
            self.create_data_base(filename)
コード例 #3
0
 def test_get_extension(self):
     filename = "/home/gabo/database.pdb"
     expected = ".pdb"
     extension = file_manager.get_extension(filename)
     self.assertEqual(expected, extension)
コード例 #4
0
def test_get_extension(filename, expected):
    assert file_manager.get_extension(filename) == expected
コード例 #5
0
 def test_get_extension(self):
     filename = "/home/gabo/database.pdb"
     expected = ".pdb"
     extension = file_manager.get_extension(filename)
     self.assertEqual(expected, extension)