| 9 | self.setSizeAdjustPolicy(QComboBox.AdjustToContents) |
| 10 | |
| 11 | def refresh(self): |
| 12 | self.clear() |
| 13 | app_dir = os.path.join('sign', 'app') |
| 14 | exe_icon = QIcon(os.path.join('gui', 'icons', 'exe.ico')) if os.path.exists(os.path.join('gui', 'icons', 'exe.ico')) else QIcon() |
| 15 | if os.path.isdir(app_dir): |
| 16 | for f in os.listdir(app_dir): |
| 17 | if f.lower().endswith('.exe'): |
| 18 | abs_path = os.path.abspath(os.path.join(app_dir, f)) |
| 19 | self.addItem(exe_icon, f, abs_path) |
| 20 | if self.count() > 0 and self.currentIndex() == -1: |
| 21 | self.setCurrentIndex(0) |
| 22 | |
| 23 | def choose_file(self, parent=None): |
| 24 | path, _ = QFileDialog.getOpenFileName(parent, '选择被伪造的应用', '.', 'EXE Files (*.exe);;All Files (*)') |