├── README.md ├── exe └── codeTransmit.exe └── src ├── mainwindow.py ├── mainwindow.ui └── uiWindow.py /README.md: -------------------------------------------------------------------------------- 1 | # CodeTransmit 2 | 基于python开发的编码转换工具,图形化界面基于pyside2(也就是qt5)开发。 3 | 4 | 支持批量转换任意格式的文件编码; 5 | 6 | 可将文件编码转为UTF-8 BOM 、UTF-8、GB2312中的任意一种格式; 7 | 8 | src文件夹下是源码,exe文件夹下是打包好可直接在windows下运行的exe程序。 9 | -------------------------------------------------------------------------------- /exe/codeTransmit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clorymmk/CodeTransmit/d40ba76defe60fb4c04fb1bc4af336b9ef791c64/exe/codeTransmit.exe -------------------------------------------------------------------------------- /src/mainwindow.py: -------------------------------------------------------------------------------- 1 | ''' 2 | @Author: your name 3 | @Date: 2020-03-13 09:44:52 4 | @LastEditTime: 2020-03-16 15:21:40 5 | @LastEditors: Please set LastEditors 6 | @Description: In User Settings Edit 7 | @FilePath: \codeTransmit\mainwindow.py 8 | ''' 9 | # This Python file uses the following encoding: utf-8 10 | import sys, os 11 | from PySide2.QtWidgets import QApplication, QMainWindow, QFileDialog, QCheckBox, QMessageBox, QTableWidgetItem 12 | from PySide2.QtCore import Qt 13 | from PySide2.QtCore import Signal, QObject,Slot #跨线程消息机制 14 | from uiWindow import Ui_MainWindow 15 | 16 | import codecs 17 | import chardet 18 | import threading 19 | 20 | from charamel import Detector 21 | #转换后的编码类型 22 | UTF8_BOM = 0 23 | UTF8 = 1 24 | GB2312 = 2 25 | 26 | FILE = 0 27 | FOLDER = 1 28 | 29 | class Communicate(QObject): 30 | speak_word = Signal(str) 31 | add_row = Signal(str,str,str,str) 32 | class MainWindow(QMainWindow): 33 | 34 | @Slot(str) 35 | def say_something(self,stuff): 36 | # print(stuff) 37 | self.ui.textBrowser.append(stuff) 38 | @Slot(str,str,str) 39 | def slotTableWidgetAddRow(self,filename,source_encoding,decoding,result): 40 | # print(stuff) 41 | rouCount = self.ui.tableWidget.rowCount() 42 | self.ui.tableWidget.insertRow(rouCount) 43 | self.ui.tableWidget.setItem(rouCount, 0, QTableWidgetItem(filename)) 44 | self.ui.tableWidget.setItem(rouCount, 1, QTableWidgetItem(source_encoding)) 45 | self.ui.tableWidget.setItem(rouCount, 2, QTableWidgetItem(decoding)) 46 | self.ui.tableWidget.setItem(rouCount, 3, QTableWidgetItem(result)) 47 | self.ui.tableWidget.item(rouCount, 0).setTextAlignment(Qt.AlignCenter) 48 | self.ui.tableWidget.item(rouCount, 1).setTextAlignment(Qt.AlignCenter) 49 | self.ui.tableWidget.item(rouCount, 2).setTextAlignment(Qt.AlignCenter) 50 | self.ui.tableWidget.item(rouCount, 3).setTextAlignment(Qt.AlignCenter) 51 | signal = Communicate() 52 | def __init__(self): 53 | super(MainWindow, self).__init__() 54 | self.ui = Ui_MainWindow() 55 | self.ui.setupUi(self) 56 | self.initForm() 57 | self.signal = Communicate() 58 | self.connectSlots() 59 | 60 | self.__path = None #处理的文件/文件夹路径 61 | self.__fileSuffix = ['.c', '.h', '.cpp', '.hpp'] #内置可勾选的文件类型 62 | self.__customFileSuffix = [] #自定义的文件类型 63 | 64 | self.usenewmethod = True 65 | if self.usenewmethod == False: 66 | self.__encodeType = 'UTF-8-SIG' #默认的编码类型 67 | self.__encodeTypeArr = ['UTF-8-SIG', 'utf-8', 'GB2312'] 68 | else: 69 | self.__encodeType = 'utf_8_sig' #默认的编码类型 70 | self.__encodeTypeArr = ['utf_8_sig', 'utf_8', 'gb2312'] 71 | 72 | self.__fileOrFolder = FOLDER #默认处理文件夹 73 | self.__mWorker = None #私有线程变量 74 | self.detector = Detector() 75 | 76 | 77 | def initForm(self): 78 | self.ui.tableWidget.setColumnCount(4) 79 | self.ui.tableWidget.setHorizontalHeaderLabels(["文件名","识别类型","解码方法","结果"]) 80 | # self.ui.tableWidget.horizontalHeader().setStretchLastSection(True) 81 | self.ui.tableWidget.setColumnWidth(0, 165) 82 | self.ui.tableWidget.setColumnWidth(1, 70) 83 | self.ui.tableWidget.setColumnWidth(2, 70) 84 | self.ui.tableWidget.setColumnWidth(3, 70) 85 | 86 | def setFilePath(self, path): 87 | self.__path = path 88 | 89 | def getFileSuffix(self): 90 | return self.__fileSuffix 91 | 92 | def addFileSuffix(self, item): 93 | self.__fileSuffix.append(item) 94 | 95 | def removeFileSuffix(self, item): 96 | self.__fileSuffix.remove(item) 97 | 98 | def clearFileSuffix(self): 99 | self.__fileSuffix.clear() 100 | 101 | def setEncodeType(self, type): 102 | self.__encodeType = type 103 | 104 | def connectSlots(self): 105 | self.ui.btnChooseFolder.clicked.connect(self.onOpenFolderClicked) 106 | self.ui.btnChooseFile.clicked.connect(self.onOpenFileClicked) 107 | self.ui.btnClear.clicked.connect(self.onBtnClearClicked) 108 | self.ui.comboBox.currentIndexChanged.connect(self.onCbEncodeIndexChanged) 109 | self.ui.btnCustomCheck.clicked.connect(self.onCustomEncodeCheck) 110 | fileTypeArr = self.ui.groupBox.findChildren(QCheckBox) 111 | for index, item in enumerate(fileTypeArr): 112 | item.stateChanged.connect(self.onFileTypeChanged) 113 | self.ui.btnTransmit.clicked.connect(self.onTransmitClicked) 114 | self.signal.speak_word.connect(self.say_something) 115 | self.signal.add_row.connect(self.slotTableWidgetAddRow) 116 | self.signal.speak_word.emit("started!") 117 | 118 | def onOpenFileClicked(self): 119 | fileName = QFileDialog.getOpenFileName(self, "", ".") 120 | if (fileName is None): 121 | self.signal.speak_word.emit("open file failed: fileName is None!") 122 | return 123 | 124 | self.setFilePath(fileName[0]) 125 | self.__fileOrFolder = FILE 126 | self.ui.labelPath.setText(fileName[0]) 127 | 128 | def onOpenFolderClicked(self): 129 | folderName = QFileDialog.getExistingDirectory(self, "", ".") 130 | if (folderName is None): 131 | self.signal.speak_word.emit("open folder failed:folderName is None!") 132 | return 133 | 134 | self.setFilePath(folderName) 135 | self.__fileOrFolder = FOLDER 136 | self.ui.labelPath.setText(folderName) 137 | 138 | def onBtnClearClicked(self): 139 | self.ui.textBrowser.clear() 140 | self.ui.tableWidget.clearContents() 141 | self.ui.tableWidget.setRowCount(0) 142 | 143 | def onCbEncodeIndexChanged(self, index): 144 | self.setEncodeType(self.__encodeTypeArr[index]) 145 | self.signal.speak_word.emit("Set encodeType: %s" % self.__encodeTypeArr[index]) 146 | 147 | def onCustomEncodeCheck(self): 148 | customStr = self.ui.leditCustomEncode.text() 149 | customArr = customStr.split(' ') 150 | 151 | for index, item in enumerate(customArr): 152 | if(len(item) < 2): 153 | QMessageBox.critical(self, "Error!", "自定义后缀无效:长度至少为2!") 154 | return 155 | if(item[0] != '.'): 156 | QMessageBox.critical(self, "Error!", "自定义后缀无效:必须以 '.' 打头!") 157 | return 158 | if(item.count('.',) > 1): 159 | QMessageBox.critical(self, "Error!", "自定义后缀无效:一种格式中不能出现多个 '.'!") 160 | return 161 | #移除后缀重复的元素 162 | if (item not in self.__fileSuffix) and (item not in self.__customFileSuffix): 163 | self.__customFileSuffix.append(item) 164 | 165 | def onFileTypeChanged(self, state): 166 | checkBox = QCheckBox.sender(self) 167 | itemText = checkBox.text() 168 | if(False == state): 169 | if itemText in self.__fileSuffix: 170 | self.removeFileSuffix(itemText) 171 | else: 172 | if itemText not in self.__fileSuffix: 173 | self.addFileSuffix(itemText) 174 | if itemText in self.__customFileSuffix: 175 | self.__customFileSuffix.remove(itemText) 176 | 177 | def enableWidgets(self, enabled): 178 | self.ui.groupBoxPath.setEnabled(enabled) 179 | self.ui.groupBoxEncode.setEnabled(enabled) 180 | self.ui.btnTransmit.setEnabled(enabled) 181 | self.ui.btnClear.setEnabled(enabled) 182 | 183 | def onTransmitClicked(self): 184 | if self.__path is None: 185 | QMessageBox.warning(self, "Warning!", "请先选择'文件'或'文件夹'路径!") 186 | return 187 | 188 | self.ui.tableWidget.clearContents() 189 | self.ui.tableWidget.setRowCount(0) 190 | 191 | if self.__fileOrFolder == FILE: 192 | self.convert(self.__path, self.__encodeType) 193 | elif self.__fileOrFolder == FOLDER: 194 | if 0 == len(self.__fileSuffix) and 0 == len(self.__customFileSuffix): 195 | QMessageBox.critical(self, "Error!", "请设置需要处理的文件后缀格式!") 196 | return 197 | self.enableWidgets(False) 198 | # self.explore(self.__path) 199 | self.__mWorker = threading.Thread(target=self.explore, args=(self.__path,)) 200 | self.__mWorker.start() 201 | else: 202 | QMessageBox.critical(self, "Error!", "文件类型错误,无法转换!") 203 | QApplication.processEvents() 204 | 205 | def explore(self, dir): 206 | for root, dirs, files in os.walk(dir): 207 | for file in files: 208 | suffix = os.path.splitext(file)[1] 209 | # if suffix == '.h' or suffix == '.c' or suffix == '.cpp' or suffix == '.hpp' or suffix == '.bat': 210 | # path = os.path.join(root,file) 211 | # self.convert(path) 212 | if self.__fileSuffix: 213 | for item in self.__fileSuffix: 214 | if(item == suffix): 215 | path = os.path.join(root,file) 216 | # print(path) 217 | self.convert(path, self.__encodeType) 218 | if self.__customFileSuffix: 219 | for item in self.__customFileSuffix: 220 | if(item == suffix): 221 | path = os.path.join(root,file) 222 | self.convert(path, self.__encodeType) 223 | 224 | self.signal.speak_word.emit("explore over!") 225 | self.enableWidgets(True) 226 | 227 | def convert_true(self, content,filePath, source_encoding,decoding,out_enc): 228 | try: 229 | self.signal.speak_word.emit("正在处理: %s" % filePath) 230 | content2 = content.decode(decoding).encode(out_enc) 231 | codecs.open(filePath,'wb').write(content2) 232 | self.signal.add_row.emit(filePath.split('\\')[-1],source_encoding,decoding,"成功") 233 | return True 234 | 235 | except Exception as err: 236 | self.signal.speak_word.emit("%s:%s"%(filePath, err)) 237 | self.signal.add_row.emit(filePath.split('\\')[-1],source_encoding,decoding,"转换失败") 238 | return False 239 | 240 | def convert(self, filePath, out_enc): 241 | try: 242 | content = codecs.open(filePath,'rb').read() 243 | self.usenewmethod = True 244 | if self.usenewmethod == False: 245 | source_encoding = chardet.detect(content)['encoding'] 246 | else: 247 | source_encoding = self.detector.detect(content) 248 | 249 | if source_encoding == out_enc: 250 | self.signal.speak_word.emit("此文件格式无需转换: %s" % filePath) 251 | return 252 | elif source_encoding == None: 253 | self.signal.speak_word.emit("此文件无法识别编码: %s" % filePath) 254 | self.signal.add_row.emit(filePath.split('\\')[-1],"无法识别","无法识别") 255 | 256 | if self.usenewmethod ==False: 257 | if source_encoding == "utf-8": 258 | self.convert_true(content,filePath,source_encoding,source_encoding,out_enc) 259 | else: 260 | if self.convert_true(content,filePath,source_encoding,"GB2312",out_enc)!=True : 261 | self.convert_true(content,filePath,source_encoding,source_encoding,out_enc) 262 | else: 263 | self.convert_true(content,filePath,source_encoding,source_encoding,out_enc) 264 | 265 | except Exception as err: 266 | self.signal.speak_word.emit("%s:%s"%(filePath, err)) 267 | self.signal.add_row.emit(filePath.split('\\')[-1],source_encoding,"转换失败") 268 | 269 | 270 | if __name__ == "__main__": 271 | app = QApplication(sys.argv) 272 | 273 | window = MainWindow() 274 | window.show() 275 | sys.exit(app.exec_()) 276 | -------------------------------------------------------------------------------- /src/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 693 10 | 487 11 | 12 | 13 | 14 | 编码转换工具V1.0.0(2020.03.16) 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 当前路径: 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 路径设置 44 | 45 | 46 | 47 | 2 48 | 49 | 50 | 5 51 | 52 | 53 | 2 54 | 55 | 56 | 57 | 58 | 1 59 | 60 | 61 | 62 | 选择文件 63 | 64 | 65 | 66 | 2 67 | 68 | 69 | 2 70 | 71 | 72 | 2 73 | 74 | 75 | 2 76 | 77 | 78 | 79 | 80 | QFrame::NoFrame 81 | 82 | 83 | QFrame::Raised 84 | 85 | 86 | 87 | 88 | 89 | 选择文件... 90 | 91 | 92 | 93 | 94 | 95 | 96 | Qt::Horizontal 97 | 98 | 99 | 100 | 40 101 | 20 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | Qt::Vertical 113 | 114 | 115 | 116 | 20 117 | 40 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 选择文件夹 127 | 128 | 129 | 130 | 2 131 | 132 | 133 | 2 134 | 135 | 136 | 2 137 | 138 | 139 | 2 140 | 141 | 142 | 143 | 144 | QFrame::NoFrame 145 | 146 | 147 | QFrame::Raised 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 选择文件夹... 156 | 157 | 158 | 159 | 160 | 161 | 162 | Qt::Horizontal 163 | 164 | 165 | 166 | 40 167 | 20 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 递归处理文件夹中以下类型 178 | 179 | 180 | 181 | 182 | 183 | .txt 184 | 185 | 186 | 187 | 188 | 189 | 190 | .java 191 | 192 | 193 | 194 | 195 | 196 | 197 | .cpp 198 | 199 | 200 | true 201 | 202 | 203 | 204 | 205 | 206 | 207 | 如果自定义多种文件类型,不同类型之间用空格分开,如:.html .xml 208 | 209 | 210 | true 211 | 212 | 213 | 214 | 215 | 216 | 217 | .c 218 | 219 | 220 | true 221 | 222 | 223 | 224 | 225 | 226 | 227 | .bat 228 | 229 | 230 | 231 | 232 | 233 | 234 | .py 235 | 236 | 237 | 238 | 239 | 240 | 241 | .m 242 | 243 | 244 | 245 | 246 | 247 | 248 | .h 249 | 250 | 251 | true 252 | 253 | 254 | 255 | 256 | 257 | 258 | .hpp 259 | 260 | 261 | true 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 应用 272 | 273 | 274 | 275 | 276 | 277 | 278 | 自定义类型 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 编码设置 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | QFrame::NoFrame 310 | 311 | 312 | 转换后的编码: 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | UTF-8 BOM 321 | 322 | 323 | 324 | 325 | UTF-8 326 | 327 | 328 | 329 | 330 | GB2312 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 转换 350 | 351 | 352 | 353 | 354 | 355 | 356 | 清屏 357 | 358 | 359 | 360 | 361 | 362 | 363 | Qt::Horizontal 364 | 365 | 366 | 367 | 40 368 | 20 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | -------------------------------------------------------------------------------- /src/uiWindow.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ################################################################################ 4 | ## Form generated from reading UI file 'mainwindow.ui' 5 | ## 6 | ## Created by: Qt User Interface Compiler version 5.14.1 7 | ## 8 | ## WARNING! All changes made in this file will be lost when recompiling UI file! 9 | ################################################################################ 10 | 11 | from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint, 12 | QRect, QSize, QUrl, Qt) 13 | from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, 14 | QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, 15 | QRadialGradient) 16 | from PySide2.QtWidgets import * 17 | 18 | 19 | class Ui_MainWindow(object): 20 | def setupUi(self, MainWindow): 21 | if MainWindow.objectName(): 22 | MainWindow.setObjectName(u"MainWindow") 23 | MainWindow.resize(723, 487) 24 | self.centralwidget = QWidget(MainWindow) 25 | self.centralwidget.setObjectName(u"centralwidget") 26 | self.verticalLayout = QVBoxLayout(self.centralwidget) 27 | self.verticalLayout.setObjectName(u"verticalLayout") 28 | self.horizontalLayout_4 = QHBoxLayout() 29 | self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") 30 | self.label_2 = QLabel(self.centralwidget) 31 | self.label_2.setObjectName(u"label_2") 32 | 33 | self.horizontalLayout_4.addWidget(self.label_2) 34 | 35 | self.labelPath = QLabel(self.centralwidget) 36 | self.labelPath.setObjectName(u"labelPath") 37 | 38 | self.horizontalLayout_4.addWidget(self.labelPath) 39 | 40 | self.horizontalLayout_4.setStretch(1, 1) 41 | 42 | self.verticalLayout.addLayout(self.horizontalLayout_4) 43 | 44 | self.horizontalLayout = QHBoxLayout() 45 | self.horizontalLayout.setObjectName(u"horizontalLayout") 46 | self.verticalLayout_9 = QVBoxLayout() 47 | self.verticalLayout_9.setObjectName(u"verticalLayout_9") 48 | self.groupBoxPath = QGroupBox(self.centralwidget) 49 | self.groupBoxPath.setObjectName(u"groupBoxPath") 50 | self.verticalLayout_5 = QVBoxLayout(self.groupBoxPath) 51 | self.verticalLayout_5.setSpacing(2) 52 | self.verticalLayout_5.setObjectName(u"verticalLayout_5") 53 | self.verticalLayout_5.setContentsMargins(-1, 5, 2, -1) 54 | self.tabWidget = QTabWidget(self.groupBoxPath) 55 | self.tabWidget.setObjectName(u"tabWidget") 56 | self.tab = QWidget() 57 | self.tab.setObjectName(u"tab") 58 | self.verticalLayout_7 = QVBoxLayout(self.tab) 59 | self.verticalLayout_7.setObjectName(u"verticalLayout_7") 60 | self.verticalLayout_7.setContentsMargins(2, 2, 2, 2) 61 | self.frame_2 = QFrame(self.tab) 62 | self.frame_2.setObjectName(u"frame_2") 63 | self.frame_2.setFrameShape(QFrame.NoFrame) 64 | self.frame_2.setFrameShadow(QFrame.Raised) 65 | self.horizontalLayout_2 = QHBoxLayout(self.frame_2) 66 | self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") 67 | self.btnChooseFile = QPushButton(self.frame_2) 68 | self.btnChooseFile.setObjectName(u"btnChooseFile") 69 | 70 | self.horizontalLayout_2.addWidget(self.btnChooseFile) 71 | 72 | self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) 73 | 74 | self.horizontalLayout_2.addItem(self.horizontalSpacer) 75 | 76 | 77 | self.verticalLayout_7.addWidget(self.frame_2) 78 | 79 | self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) 80 | 81 | self.verticalLayout_7.addItem(self.verticalSpacer) 82 | 83 | self.tabWidget.addTab(self.tab, "") 84 | self.tab_2 = QWidget() 85 | self.tab_2.setObjectName(u"tab_2") 86 | self.verticalLayout_8 = QVBoxLayout(self.tab_2) 87 | self.verticalLayout_8.setObjectName(u"verticalLayout_8") 88 | self.verticalLayout_8.setContentsMargins(2, 2, 2, 2) 89 | self.frame_3 = QFrame(self.tab_2) 90 | self.frame_3.setObjectName(u"frame_3") 91 | self.frame_3.setFrameShape(QFrame.NoFrame) 92 | self.frame_3.setFrameShadow(QFrame.Raised) 93 | self.verticalLayout_4 = QVBoxLayout(self.frame_3) 94 | self.verticalLayout_4.setObjectName(u"verticalLayout_4") 95 | self.horizontalLayout_3 = QHBoxLayout() 96 | self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") 97 | self.btnChooseFolder = QPushButton(self.frame_3) 98 | self.btnChooseFolder.setObjectName(u"btnChooseFolder") 99 | 100 | self.horizontalLayout_3.addWidget(self.btnChooseFolder) 101 | 102 | self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) 103 | 104 | self.horizontalLayout_3.addItem(self.horizontalSpacer_2) 105 | 106 | 107 | self.verticalLayout_4.addLayout(self.horizontalLayout_3) 108 | 109 | self.groupBox = QGroupBox(self.frame_3) 110 | self.groupBox.setObjectName(u"groupBox") 111 | self.gridLayout_3 = QGridLayout(self.groupBox) 112 | self.gridLayout_3.setObjectName(u"gridLayout_3") 113 | self.cbTxtFile = QCheckBox(self.groupBox) 114 | self.cbTxtFile.setObjectName(u"cbTxtFile") 115 | 116 | self.gridLayout_3.addWidget(self.cbTxtFile, 1, 1, 1, 1) 117 | 118 | self.cbJavaFile = QCheckBox(self.groupBox) 119 | self.cbJavaFile.setObjectName(u"cbJavaFile") 120 | 121 | self.gridLayout_3.addWidget(self.cbJavaFile, 1, 3, 1, 1) 122 | 123 | self.cbCppFile = QCheckBox(self.groupBox) 124 | self.cbCppFile.setObjectName(u"cbCppFile") 125 | self.cbCppFile.setChecked(True) 126 | 127 | self.gridLayout_3.addWidget(self.cbCppFile, 0, 2, 1, 1) 128 | 129 | self.label_3 = QLabel(self.groupBox) 130 | self.label_3.setObjectName(u"label_3") 131 | self.label_3.setWordWrap(True) 132 | 133 | self.gridLayout_3.addWidget(self.label_3, 8, 0, 1, 4) 134 | 135 | self.cbCFile = QCheckBox(self.groupBox) 136 | self.cbCFile.setObjectName(u"cbCFile") 137 | self.cbCFile.setChecked(True) 138 | 139 | self.gridLayout_3.addWidget(self.cbCFile, 0, 0, 1, 1) 140 | 141 | self.cbBatFile = QCheckBox(self.groupBox) 142 | self.cbBatFile.setObjectName(u"cbBatFile") 143 | 144 | self.gridLayout_3.addWidget(self.cbBatFile, 1, 0, 1, 1) 145 | 146 | self.cbPyFile = QCheckBox(self.groupBox) 147 | self.cbPyFile.setObjectName(u"cbPyFile") 148 | 149 | self.gridLayout_3.addWidget(self.cbPyFile, 1, 2, 1, 1) 150 | 151 | self.cbMFile = QCheckBox(self.groupBox) 152 | self.cbMFile.setObjectName(u"cbMFile") 153 | 154 | self.gridLayout_3.addWidget(self.cbMFile, 2, 0, 1, 1) 155 | 156 | self.cbHFile = QCheckBox(self.groupBox) 157 | self.cbHFile.setObjectName(u"cbHFile") 158 | self.cbHFile.setChecked(True) 159 | 160 | self.gridLayout_3.addWidget(self.cbHFile, 0, 1, 1, 1) 161 | 162 | self.cbHppFile = QCheckBox(self.groupBox) 163 | self.cbHppFile.setObjectName(u"cbHppFile") 164 | self.cbHppFile.setChecked(True) 165 | 166 | self.gridLayout_3.addWidget(self.cbHppFile, 0, 3, 1, 1) 167 | 168 | self.leditCustomEncode = QLineEdit(self.groupBox) 169 | self.leditCustomEncode.setObjectName(u"leditCustomEncode") 170 | 171 | self.gridLayout_3.addWidget(self.leditCustomEncode, 6, 0, 1, 2) 172 | 173 | self.btnCustomCheck = QPushButton(self.groupBox) 174 | self.btnCustomCheck.setObjectName(u"btnCustomCheck") 175 | 176 | self.gridLayout_3.addWidget(self.btnCustomCheck, 6, 2, 1, 2) 177 | 178 | self.label = QLabel(self.groupBox) 179 | self.label.setObjectName(u"label") 180 | 181 | self.gridLayout_3.addWidget(self.label, 5, 0, 1, 4) 182 | 183 | 184 | self.verticalLayout_4.addWidget(self.groupBox) 185 | 186 | 187 | self.verticalLayout_8.addWidget(self.frame_3) 188 | 189 | self.tabWidget.addTab(self.tab_2, "") 190 | 191 | self.verticalLayout_5.addWidget(self.tabWidget) 192 | 193 | 194 | self.verticalLayout_9.addWidget(self.groupBoxPath) 195 | 196 | self.groupBoxEncode = QGroupBox(self.centralwidget) 197 | self.groupBoxEncode.setObjectName(u"groupBoxEncode") 198 | self.verticalLayout_6 = QVBoxLayout(self.groupBoxEncode) 199 | self.verticalLayout_6.setObjectName(u"verticalLayout_6") 200 | self.horizontalLayout_5 = QHBoxLayout() 201 | self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") 202 | self.label_4 = QLabel(self.groupBoxEncode) 203 | self.label_4.setObjectName(u"label_4") 204 | self.label_4.setStyleSheet(u"") 205 | self.label_4.setFrameShape(QFrame.NoFrame) 206 | 207 | self.horizontalLayout_5.addWidget(self.label_4) 208 | 209 | self.comboBox = QComboBox(self.groupBoxEncode) 210 | self.comboBox.addItem("") 211 | self.comboBox.addItem("") 212 | self.comboBox.addItem("") 213 | self.comboBox.setObjectName(u"comboBox") 214 | 215 | self.horizontalLayout_5.addWidget(self.comboBox) 216 | 217 | self.horizontalLayout_5.setStretch(1, 1) 218 | 219 | self.verticalLayout_6.addLayout(self.horizontalLayout_5) 220 | 221 | 222 | self.verticalLayout_9.addWidget(self.groupBoxEncode) 223 | 224 | 225 | self.horizontalLayout.addLayout(self.verticalLayout_9) 226 | 227 | self.verticalLayout_2 = QVBoxLayout() 228 | self.verticalLayout_2.setObjectName(u"verticalLayout_2") 229 | self.horizontalLayout_6 = QHBoxLayout() 230 | self.horizontalLayout_6.setObjectName(u"horizontalLayout_6") 231 | self.btnTransmit = QPushButton(self.centralwidget) 232 | self.btnTransmit.setObjectName(u"btnTransmit") 233 | 234 | self.horizontalLayout_6.addWidget(self.btnTransmit) 235 | 236 | self.btnClear = QPushButton(self.centralwidget) 237 | self.btnClear.setObjectName(u"btnClear") 238 | 239 | self.horizontalLayout_6.addWidget(self.btnClear) 240 | 241 | self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) 242 | 243 | self.horizontalLayout_6.addItem(self.horizontalSpacer_3) 244 | 245 | 246 | self.verticalLayout_2.addLayout(self.horizontalLayout_6) 247 | 248 | self.tableWidget = QTableWidget(self.centralwidget) 249 | self.tableWidget.setObjectName(u"tableWidget") 250 | 251 | self.verticalLayout_2.addWidget(self.tableWidget) 252 | 253 | self.verticalLayout_2.setStretch(1, 1) 254 | 255 | self.horizontalLayout.addLayout(self.verticalLayout_2) 256 | 257 | self.horizontalLayout.setStretch(1, 1) 258 | 259 | self.verticalLayout.addLayout(self.horizontalLayout) 260 | 261 | self.textBrowser = QTextBrowser(self.centralwidget) 262 | self.textBrowser.setObjectName(u"textBrowser") 263 | 264 | self.verticalLayout.addWidget(self.textBrowser) 265 | 266 | self.verticalLayout.setStretch(1, 5) 267 | MainWindow.setCentralWidget(self.centralwidget) 268 | 269 | self.retranslateUi(MainWindow) 270 | 271 | self.tabWidget.setCurrentIndex(1) 272 | 273 | 274 | QMetaObject.connectSlotsByName(MainWindow) 275 | # setupUi 276 | 277 | def retranslateUi(self, MainWindow): 278 | MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"\u7f16\u7801\u8f6c\u6362\u5de5\u5177V1.0.0(2020.03.16)", None)) 279 | self.label_2.setText(QCoreApplication.translate("MainWindow", u"\u5f53\u524d\u8def\u5f84:", None)) 280 | self.labelPath.setText("") 281 | self.groupBoxPath.setTitle(QCoreApplication.translate("MainWindow", u"\u8def\u5f84\u8bbe\u7f6e", None)) 282 | self.btnChooseFile.setText(QCoreApplication.translate("MainWindow", u"\u9009\u62e9\u6587\u4ef6...", None)) 283 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("MainWindow", u"\u9009\u62e9\u6587\u4ef6", None)) 284 | self.btnChooseFolder.setText(QCoreApplication.translate("MainWindow", u"\u9009\u62e9\u6587\u4ef6\u5939...", None)) 285 | self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"\u9012\u5f52\u5904\u7406\u6587\u4ef6\u5939\u4e2d\u4ee5\u4e0b\u7c7b\u578b", None)) 286 | self.cbTxtFile.setText(QCoreApplication.translate("MainWindow", u".txt", None)) 287 | self.cbJavaFile.setText(QCoreApplication.translate("MainWindow", u".java", None)) 288 | self.cbCppFile.setText(QCoreApplication.translate("MainWindow", u".cpp", None)) 289 | self.label_3.setText(QCoreApplication.translate("MainWindow", u"\u5982\u679c\u81ea\u5b9a\u4e49\u591a\u79cd\u6587\u4ef6\u7c7b\u578b\uff0c\u4e0d\u540c\u7c7b\u578b\u4e4b\u95f4\u7528\u7a7a\u683c\u5206\u5f00\uff0c\u5982\uff1a.html .xml", None)) 290 | self.cbCFile.setText(QCoreApplication.translate("MainWindow", u".c", None)) 291 | self.cbBatFile.setText(QCoreApplication.translate("MainWindow", u".bat", None)) 292 | self.cbPyFile.setText(QCoreApplication.translate("MainWindow", u".py", None)) 293 | self.cbMFile.setText(QCoreApplication.translate("MainWindow", u".m", None)) 294 | self.cbHFile.setText(QCoreApplication.translate("MainWindow", u".h", None)) 295 | self.cbHppFile.setText(QCoreApplication.translate("MainWindow", u".hpp", None)) 296 | self.btnCustomCheck.setText(QCoreApplication.translate("MainWindow", u"\u5e94\u7528", None)) 297 | self.label.setText(QCoreApplication.translate("MainWindow", u"\u81ea\u5b9a\u4e49\u7c7b\u578b", None)) 298 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("MainWindow", u"\u9009\u62e9\u6587\u4ef6\u5939", None)) 299 | self.groupBoxEncode.setTitle(QCoreApplication.translate("MainWindow", u"\u7f16\u7801\u8bbe\u7f6e", None)) 300 | self.label_4.setText(QCoreApplication.translate("MainWindow", u"\u8f6c\u6362\u540e\u7684\u7f16\u7801:", None)) 301 | self.comboBox.setItemText(0, QCoreApplication.translate("MainWindow", u"UTF-8 BOM", None)) 302 | self.comboBox.setItemText(1, QCoreApplication.translate("MainWindow", u"UTF-8", None)) 303 | self.comboBox.setItemText(2, QCoreApplication.translate("MainWindow", u"GB2312", None)) 304 | 305 | self.btnTransmit.setText(QCoreApplication.translate("MainWindow", u"\u8f6c\u6362", None)) 306 | self.btnClear.setText(QCoreApplication.translate("MainWindow", u"\u6e05\u5c4f", None)) 307 | # retranslateUi 308 | 309 | --------------------------------------------------------------------------------