def import_data_pack(self, data_pack_file):
        try:
            dal.dataimport.CM_VERSION = APP_VERSION
            pack = dal.dataimport.DataPack(data_pack_file)
            if not pack.good():
                self.advise_error(self.tr("Invalid data pack."))
            else:
                dest = osutil.get_user_data_path()
                if pack.id == 'core':
                    dest = os.path.join(dest, 'core.data')
                elif pack.language:
                    dest = os.path.join(dest, 'data.' + pack.language)
                else:
                    dest = os.path.join(dest, 'data')

                pack.export_to(dest)
            return True
        except Exception as e:
            return False
 def open_data_dir_act(self):
     path = os.path.normpath(osutil.get_user_data_path())
     if not os.path.exists(path):
         os.makedirs(path)
     osutil.portable_open(path)
Beispiel #3
0
 def open_data_dir_act(self):
     path = os.path.normpath(osutil.get_user_data_path())
     if not os.path.exists(path):
         os.makedirs(path)
     osutil.portable_open(path)