Skip to content
Snippets Groups Projects
Commit c3fb309d authored by Kien Le's avatar Kien Le
Browse files

flake8

parent 6897297d
No related branches found
No related tags found
No related merge requests found
...@@ -4,11 +4,9 @@ GUI to add/edit/remove channels ...@@ -4,11 +4,9 @@ GUI to add/edit/remove channels
""" """
from typing import List, Union from typing import List, Union
from PIL.ImageOps import contain
from PySide6.QtCore import Qt, Signal, Slot from PySide6.QtCore import Qt, Signal, Slot
from PySide6.QtWidgets import ( from PySide6.QtWidgets import (
QMessageBox, QCheckBox, QWidget, QBoxLayout, QMessageBox, QCheckBox, QWidget, QHBoxLayout,
QHBoxLayout,
) )
from sohstationviewer.view.db_config.db_config_dialog import ( from sohstationviewer.view.db_config.db_config_dialog import (
...@@ -27,12 +25,13 @@ class CenteredCheckBox(QWidget): ...@@ -27,12 +25,13 @@ class CenteredCheckBox(QWidget):
centered QCheckBox. This is simply the standard method to center a widget centered QCheckBox. This is simply the standard method to center a widget
without having to use stylesheets. The main bulk of the custom code is to without having to use stylesheets. The main bulk of the custom code is to
pass to the internal QCheckBox for processing. pass to the internal QCheckBox for processing.
This wrapper is intended to provide a more convenient way to work with a This wrapper is intended to provide a more convenient way to work with a
centered checkbox. Without it, the internal QCheckBox has to be retrieved centered checkbox. Without it, the internal QCheckBox has to be retrieved
every time we want to use it. This can become annoying to do, especially every time we want to use it. This can become annoying to do, especially
since there is no convenient method provided to retrieve the checkbox. since there is no convenient method provided to retrieve the checkbox.
""" """
def __init__(self, parent=None): def __init__(self, parent=None):
super(CenteredCheckBox, self).__init__(parent) super(CenteredCheckBox, self).__init__(parent)
layout = QHBoxLayout() layout = QHBoxLayout()
...@@ -90,15 +89,15 @@ class ChannelDialog(UiDBInfoDialog): ...@@ -90,15 +89,15 @@ class ChannelDialog(UiDBInfoDialog):
:return the created checkbox widget :return the created checkbox widget
""" """
row_channel = (self.database_rows[row_idx][0] row_channel = (self.database_rows[row_idx][0]
if row_idx < len(self.database_rows) else '') if row_idx < len(self.database_rows) else '')
checked = (self.database_rows[row_idx][col_idx - 1] checked = (self.database_rows[row_idx][col_idx - 1]
if row_idx < len(self.database_rows) else False) if row_idx < len(self.database_rows) else False)
checkbox = CenteredCheckBox(self.data_table_widget) checkbox = CenteredCheckBox(self.data_table_widget)
checkbox.setChecked(checked) checkbox.setChecked(checked)
set_widget_color(checkbox) set_widget_color(checkbox)
checkbox.checkStateChanged.connect( checkbox.checkStateChanged.connect(
lambda check_state: lambda check_state:
self.on_checkbox_toggle(bool(check_state.value), checkbox) self.on_checkbox_toggle(bool(check_state.value), checkbox)
) )
if self.data_type == 'RT130': if self.data_type == 'RT130':
checkbox.setDisabled(True) checkbox.setDisabled(True)
...@@ -168,7 +167,8 @@ class ChannelDialog(UiDBInfoDialog): ...@@ -168,7 +167,8 @@ class ChannelDialog(UiDBInfoDialog):
str(row_content[3])) str(row_content[3]))
self.data_table_widget.cellWidget(row_idx, 5).setText(row_content[4]) self.data_table_widget.cellWidget(row_idx, 5).setText(row_content[4])
self.data_table_widget.cellWidget(row_idx, 6).setValue(row_content[5]) self.data_table_widget.cellWidget(row_idx, 6).setValue(row_content[5])
self.data_table_widget.cellWidget(row_idx, 7).setChecked(row_content[6]) self.data_table_widget.cellWidget(row_idx, 7).setChecked(
row_content[6])
def set_row_widgets(self, row_idx, fk=False): def set_row_widgets(self, row_idx, fk=False):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment