OSDN Git Service

encoding corrections for open files
authorMahmoud Saghaei <mahmood.saghaei@gmail.com>
Thu, 3 Jun 2021 06:14:21 +0000 (10:44 +0430)
committerMahmoud Saghaei <mahmood.saghaei@gmail.com>
Thu, 3 Jun 2021 06:14:21 +0000 (10:44 +0430)
MinimPy2.spec
about_minimisation.py
config.py
db.py
main_window.py

index ec93f7f..b7cde84 100644 (file)
@@ -4,10 +4,10 @@
 block_cipher = None
 
 
-a = Analysis(['/home/msaghaei/PycharmProjects/minimpy2/main_window.py'],
+a = Analysis(['main_window.py'],
              pathex=['/home/msaghaei/PycharmProjects/minimpy2'],
              binaries=[],
-             datas=[('/home/msaghaei/PycharmProjects/minimpy2/db', 'db/'), ('/home/msaghaei/PycharmProjects/minimpy2/images', 'images/'), ('/home/msaghaei/PycharmProjects/minimpy2/locales', 'locales/'), ('/home/msaghaei/PycharmProjects/minimpy2/locale_sources.ts', '.'), ('/home/msaghaei/PycharmProjects/minimpy2/minimisation_en_US.txt', '.'), ('/home/msaghaei/PycharmProjects/minimpy2/minimisation_fa_IR.txt', '.')],
+             datas=[],
              hiddenimports=[],
              hookspath=[],
              runtime_hooks=[],
@@ -20,19 +20,15 @@ pyz = PYZ(a.pure, a.zipped_data,
              cipher=block_cipher)
 exe = EXE(pyz,
           a.scripts,
+          a.binaries,
+          a.zipfiles,
+          a.datas,
           [],
-          exclude_binaries=True,
           name='MinimPy2',
           debug=False,
           bootloader_ignore_signals=False,
           strip=False,
           upx=True,
-          console=False , icon='/home/msaghaei/PycharmProjects/minimpy2/images/logo.ico')
-coll = COLLECT(exe,
-               a.binaries,
-               a.zipfiles,
-               a.datas,
-               strip=False,
-               upx=True,
-               upx_exclude=[],
-               name='MinimPy2')
+          upx_exclude=[],
+          runtime_tmpdir=None,
+          console=False )
index b33774a..adb2cba 100755 (executable)
@@ -15,7 +15,7 @@ class AboutMinimisationDialog(qtw.QDialog):
             filename = 'minimisation_en_US.txt'
             if not path.exists(filename):
                 return
-        text = open(filename).read()
+        text = open(filename, encoding='utf8').read()
         self.ui.minimTextEdit.setPlainText(text)
         self.setWindowTitle(parent.tr('What is Minimisation'))
         self.ui.closePushButton.setText(parent.tr('Close'))
index c10ba61..a727794 100755 (executable)
--- a/config.py
+++ b/config.py
@@ -11,7 +11,7 @@ class Config(qtw.QDialog):
         self.parent = parent
         self.ui = Ui_ConfigDialog()
         self.ui.setupUi(self)
-        lines = open('locales/languages.lst').readlines()
+        lines = open('locales/languages.lst', encoding='utf8').readlines()
         self.lang_codes = []
         cur_lang = self.parent.settings.value('language', 'en_US', type=str)
         cur_index = 0
diff --git a/db.py b/db.py
index d0d0c86..ed42102 100755 (executable)
--- a/db.py
+++ b/db.py
@@ -26,7 +26,7 @@ class Database(qtc.QObject):
                 'open db: ' + self.db.lastError().text()
             )
             sys.exit(1)
-        all_sqls = open('db/database.sql').read().split(';')
+        all_sqls = open('db/database.sql', encoding='utf8').read().split(';')
         for sql in all_sqls:
             query = qts.QSqlQuery(self.db)
             query.prepare(sql)
index 2cbeb87..d663814 100644 (file)
@@ -58,7 +58,7 @@ class MainWindow(qtw.QMainWindow):
         self.ui.setupUi(self)
         lang = settings.value('language', 'en_US', type=str)
         filename = 'start_{}.html'.format(lang)
-        start_str = open(filename).read()
+        start_str = open(filename, encoding='utf8').read()
         self.ui.textEdit.setHtml(start_str)
         self.ui.actionNew.setIcon(qtg.QIcon('images/add.png'))
         self.ui.actionDelete.setIcon(qtg.QIcon('images/delete.png'))