Skip to content
Snippets Groups Projects
Commit cb7fc792 authored by Robier Al Kaadi's avatar Robier Al Kaadi :penguin:
Browse files

Solve Preference dialogue for scheduler GUI

parent d0d9edf3
No related branches found
No related tags found
No related merge requests found
Pipeline #134296 passed
...@@ -130,7 +130,7 @@ run-doc-test: ...@@ -130,7 +130,7 @@ run-doc-test:
- pip install black velin - pip install black velin
- velin . --check --black - velin . --check --black
- pip install ruff - pip install ruff
- ruff b_asic --output-format=gitlab > ruff.json - ruff check b_asic --output-format=gitlab > ruff.json
artifacts: artifacts:
name: "${CI_PROJECT_NAME}_code_quality" name: "${CI_PROJECT_NAME}_code_quality"
when: always when: always
......
...@@ -1146,7 +1146,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1146,7 +1146,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
dialog.exec_() dialog.exec_()
def creat_color_button(self, color: ColorDataType) -> ColorButton: def creat_color_button(self, color: ColorDataType) -> ColorButton:
"""Create a colored button to be used to modify a certain color""" """Create a colored button to be used to modify a certain color
color_type: ColorDataType
The color_type assigned to the butten to be created.
"""
button = ColorButton(color.DEFAULT) button = ColorButton(color.DEFAULT)
button.setText(color.name) button.setText(color.name)
if color.name == "Latency Color": if color.name == "Latency Color":
...@@ -1162,7 +1165,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1162,7 +1165,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
return button return button
def set_latency_color_by_type_name(self, all: bool): def set_latency_color_by_type_name(self, all: bool):
"""Set latency color based on operation type names""" """Set latency color based on operation type names
all: bool
Indicates if the color of all type names to be modified.
"""
if Latency_Color.changed: if Latency_Color.changed:
current_color = Latency_Color.current_color current_color = Latency_Color.current_color
else: else:
...@@ -1203,7 +1209,7 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1203,7 +1209,7 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
for type in self._schedule.get_used_type_names(): for type in self._schedule.get_used_type_names():
if Latency_Color.changed and not self._color_changed_perType: if Latency_Color.changed and not self._color_changed_perType:
self._color_per_type[type] = Latency_Color.current_color self._color_per_type[type] = Latency_Color.current_color
elif not (Latency_Color.changed and self._color_changed_perType): elif not Latency_Color.changed and not self._color_changed_perType:
self._color_per_type[type] = Latency_Color.DEFAULT self._color_per_type[type] = Latency_Color.DEFAULT
elif not Latency_Color.changed and self._color_changed_perType: elif not Latency_Color.changed and self._color_changed_perType:
if type in self.changed_operation_colors.keys(): if type in self.changed_operation_colors.keys():
...@@ -1240,7 +1246,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1240,7 +1246,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
) )
def Color_button_clicked(self, color_type: ColorDataType): def Color_button_clicked(self, color_type: ColorDataType):
"""Open a color dialog to select a color based on the specified color type""" """Open a color dialog to select a color based on the specified color type
color_type: ColorDataType
The color_type to be changed.
"""
settings = QSettings() settings = QSettings()
if color_type.changed: if color_type.changed:
current_color = color_type.current_color current_color = color_type.current_color
...@@ -1264,7 +1273,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1264,7 +1273,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
def font_clicked( def font_clicked(
self, Sizeline: QLineEdit, italicbutton: ColorButton, boldbutton: ColorButton self, Sizeline: QLineEdit, italicbutton: ColorButton, boldbutton: ColorButton
): ):
"""Open a font dialog to select a font and update the current font""" """Open a font dialog to select a font and update the current font
Sizeline: QLineEdit
The line displaying the text size to be matched with the chosen font.
italicbutton: ColorButton
The button displaying the italic state to be matched with the chosen font.
boldbutton: ColorButton
The button displaying the bold state to be matched with the chosen font.
"""
if Font.changed: if Font.changed:
current_font = Font.current_font current_font = Font.current_font
else: else:
...@@ -1358,13 +1374,19 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1358,13 +1374,19 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self._graph._font_color_change(Font.color) self._graph._font_color_change(Font.color)
def set_fontSize_clicked(self, size): def set_fontSize_clicked(self, size):
"""Set the font size to the specified size and update the font""" """Set the font size to the specified size and update the font
size
The font size to be set.
"""
Font.size = int(size) if (not size == "") else 6 Font.size = int(size) if (not size == "") else 6
Font.current_font.setPointSizeF(Font.size) Font.current_font.setPointSizeF(Font.size)
self.Update_font() self.Update_font()
def Italic_font_clicked(self, button: ColorButton): def Italic_font_clicked(self, button: ColorButton):
"""Toggle the font style to italic if not already italic, otherwise remove italic""" """Toggle the font style to italic if not already italic, otherwise remove italic
button: ColorButton
The clicked button. Used to indicate state on/off.
"""
Font.italic = not Font.italic Font.italic = not Font.italic
Font.current_font.setItalic(Font.italic) Font.current_font.setItalic(Font.italic)
( (
...@@ -1375,7 +1397,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1375,7 +1397,10 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self.Update_font() self.Update_font()
def Bold_font_clicked(self, button: ColorButton): def Bold_font_clicked(self, button: ColorButton):
"""Toggle the font style to bold if not already bold, otherwise unbold""" """Toggle the font style to bold if not already bold, otherwise unbold
button: ColorButton
The clicked button. Used to indicate state on/off.
"""
Font.bold = not Font.bold Font.bold = not Font.bold
Font.current_font.setBold(Font.bold) Font.current_font.setBold(Font.bold)
Font.current_font.setWeight(50) Font.current_font.setWeight(50)
...@@ -1387,15 +1412,22 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1387,15 +1412,22 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self.Update_font() self.Update_font()
def Incr_font_clicked(self, line: QLineEdit): def Incr_font_clicked(self, line: QLineEdit):
"""Increase the font size by 1""" """
( Increase the font size by 1.
line: QLineEdit
The line displaying the text size to be matched.
"""(
line.setText(str(Font.size + 1)) line.setText(str(Font.size + 1))
if Font.size <= 71 if Font.size <= 71
else line.setText(str(Font.size)) else line.setText(str(Font.size))
) )
def Decr_font_clicked(self, line: QLineEdit): def Decr_font_clicked(self, line: QLineEdit):
"""Decrease the font size by 1""" """
Decrease the font size by 1.
line: QLineEdit
The line displaying the text size to be matched.
"""
( (
line.setText(str(Font.size - 1)) line.setText(str(Font.size - 1))
if Font.size >= 7 if Font.size >= 7
...@@ -1432,7 +1464,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1432,7 +1464,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
def reset_font_clicked( def reset_font_clicked(
self, Sizeline: QLineEdit, italicbutton: ColorButton, boldbutton: ColorButton self, Sizeline: QLineEdit, italicbutton: ColorButton, boldbutton: ColorButton
): ):
"""Reset the font settings""" """Reset the font settings.
Sizeline: QLineEdit
The line displaying the text size to be matched with the chosen font.
italicbutton: ColorButton
The button displaying the italic state to be matched with the chosen font.
boldbutton: ColorButton
The button displaying the bold state to be matched with the chosen font.
"""
Font.current_font = QFont("Times", 12) Font.current_font = QFont("Times", 12)
Font.changed = False Font.changed = False
Font.color = Font.DEFAULT_COLOR Font.color = Font.DEFAULT_COLOR
...@@ -1453,7 +1492,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): ...@@ -1453,7 +1492,14 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
def Match_Dialog_Font( def Match_Dialog_Font(
self, Sizeline: QLineEdit, italicbutton: ColorButton, boldbutton: ColorButton self, Sizeline: QLineEdit, italicbutton: ColorButton, boldbutton: ColorButton
): ):
"""Update the widgets on the pref dialog to match the current font""" """Update the widgets on the pref dialog to match the current font
Sizeline: QLineEdit
The line displaying the text size to be matched with the current font.
italicbutton: ColorButton
The button displaying the italic state to be matched with the current font.
boldbutton: ColorButton
The button displaying the bold state to be matched with the current font.
"""
Sizeline.setText(str(Font.size)) Sizeline.setText(str(Font.size))
( (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment