(self)
| 49 | self.refresh() |
| 50 | |
| 51 | def refresh(self): |
| 52 | self.clear() |
| 53 | ico_files = list_ico_files() |
| 54 | if not ico_files: |
| 55 | icon_path = os.path.join('icons', 'excel.ico') |
| 56 | self.addItem(QIcon(icon_path), 'excel.ico', icon_path) |
| 57 | else: |
| 58 | for f in ico_files: |
| 59 | icon_path = os.path.join('icons', f) |
| 60 | self.addItem(QIcon(icon_path), f, icon_path) |
| 61 | if self.count() > 0 and self.currentIndex() == -1: |
| 62 | self.setCurrentIndex(0) |
| 63 | |
| 64 | def choose_file(self, parent=None): |
| 65 | path, _ = QFileDialog.getOpenFileName(parent, 'Select Icon File', '.', 'Icon Files (*.ico);;All Files (*)') |
no test coverage detected