Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
parmigggiana authored Oct 5, 2024
2 parents 1dab2f0 + d7e0248 commit acf5390
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/peracotta/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"source_code": "https://github.com/WEEE-Open/peracotta",
}

VERSION = "2.5.5"
VERSION = "2.5.6"

PATH = {
"UI": "assets/interface.ui",
Expand Down
10 changes: 5 additions & 5 deletions src/peracotta/gui/Toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,14 +593,14 @@ def minimumSizeHint(self) -> QtCore.QSize:
return old

def remove_item_from_toolbox(self, button):
logger.debug(f"Removing {button.text()}")
i = 0
for item in self.children():
if item is button:
self.removeItem(i)
break
if isinstance(item, QtWidgets.QAbstractButton):
if item == button:
self.removeItem(i)
break
else:
i += 1
i += 1

def removeItem(self, index: int) -> None:
i = 0
Expand Down
21 changes: 14 additions & 7 deletions src/peracotta/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(
self.intCpuRadioBtn = self.findChild(QtWidgets.QRadioButton, "intCpuRadioBtn")
self.intMoboRadioBtn = self.findChild(QtWidgets.QRadioButton, "intMoboRadioBtn")
self.bothGpuRadioBtn = self.findChild(QtWidgets.QRadioButton, "bothGpuRadioBtn")
self.GpuRadioBtns = [self.discreteRadioBtn, self.intCpuRadioBtn, self.intMoboRadioBtn, self.bothGpuRadioBtn]

# Selectors area
self.selectorsWidget = self.findChild(QtWidgets.QWidget, "selectorsWidget")
Expand Down Expand Up @@ -189,6 +190,10 @@ def setup(self):
niy = commons.ParserComponents.not_implemented_yet()
for item in commons.ParserComponents:
checkbox = QtWidgets.QCheckBox(item.value)
if item is commons.ParserComponents.GPU:
checkbox.toggled.connect(
lambda c=checkbox: [radio.setAutoExclusive(c) or radio.setChecked(False) or radio.setEnabled(c) for radio in self.GpuRadioBtns]
)
if item in niy:
checkbox.setEnabled(False)
layout.addWidget(checkbox)
Expand Down Expand Up @@ -380,7 +385,6 @@ def gpu_location_from_buttons(self):
)
return commons.GpuLocation.DISCRETE
else:
QtWidgets.QMessageBox.warning(self, "Warning", "Please, select one of the GPU locations to proceed.")
return None

def get_selected_filters(self):
Expand All @@ -395,7 +399,11 @@ def generate(self):
if self.perathread.isRunning():
return

if not self.set_thread_buttons_values():
self.set_thread_buttons_values()
logger.debug(f"Selected filters: {self.perathread.filters}")

if not self.perathread.gpu_location and commons.ParserComponents.GPU in self.perathread.filters:
QtWidgets.QMessageBox.warning(self, "Warning", "Please, select one of the GPU locations to proceed.")
self.perathread.set_default_values()
return

Expand All @@ -422,12 +430,10 @@ def generate(self):

def set_thread_buttons_values(self):
gpu_location = self.gpu_location_from_buttons()
if gpu_location is None:
return False
self.perathread.gpu_location = gpu_location

self.perathread.owner = self.ownerLineEdit.text()
self.perathread.filters = self.get_selected_filters()
return True
self.perathread.gpu_location = gpu_location

def _ask_sudo_pass(self):
sudo_passwd, ok = QtWidgets.QInputDialog.getText(
Expand Down Expand Up @@ -512,7 +518,8 @@ def load_raw_files(self, path: str = ""):
if self.perathread.isRunning():
return

if not self.set_thread_buttons_values():
self.set_thread_buttons_values()
if not self.perathread.gpu_location:
self.perathread.set_default_values()
return

Expand Down

0 comments on commit acf5390

Please sign in to comment.