MCPcopy Create free account
hub / github.com/echQoQ/RustSL / refresh

Method refresh

gui/widgets.py:18–30  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

16 self.refresh()
17
18 def refresh(self):
19 self.clear()
20 input_dir = os.path.join(os.getcwd(), 'input')
21 default_idx = -1
22 bin_icon = QIcon(os.path.join('gui', 'icons', 'bin.ico')) if os.path.exists(os.path.join('gui', 'icons', 'bin.ico')) else QIcon()
23 if os.path.isdir(input_dir):
24 files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
25 for i, f in enumerate(files):
26 self.addItem(bin_icon, f, os.path.abspath(os.path.join(input_dir, f)))
27 if files:
28 default_idx = 0
29 if self.count() > 0 and self.currentIndex() == -1:
30 self.setCurrentIndex(default_idx)
31
32 def choose_file(self, parent=None):
33 path, _ = QFileDialog.getOpenFileName(parent, 'Select Bin File', '.', 'Bin Files (*.bin);;All Files (*)')

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected