Mods
This commit is contained in:
		| @@ -48,7 +48,7 @@ class Config: | ||||
|     message_box_button_hover_text_color: str = "white" | ||||
|     scrollbar_handle_color: str = "rgb(69, 69, 69)" | ||||
|     input_background_color: str = "rgb(111, 111, 111)" | ||||
|     input_text_color: str = "rgb(18, 18, 18)" | ||||
|     input_text_color: str = "black" | ||||
|     input_border_color: str = "rgb(120, 120, 120)" | ||||
|     input_caret_color: str = "rgb(18, 18, 18)" | ||||
|     settings_json: Path | ||||
|   | ||||
| @@ -22,6 +22,16 @@ class Filter: | ||||
|     def get_value() -> str: | ||||
|         return str(Window.filter.text()).lower().strip() | ||||
|  | ||||
|     @staticmethod | ||||
|     def set_value(value: str) -> None: | ||||
|         Window.filter.setText(value) | ||||
|         Filter.do_filter() | ||||
|  | ||||
|     @staticmethod | ||||
|     def clear() -> None: | ||||
|         Window.filter.clear() | ||||
|         Filter.do_filter() | ||||
|  | ||||
|     @staticmethod | ||||
|     def filter(event: QKeyEvent | None = None) -> None: | ||||
|         Filter.debouncer.stop() | ||||
| @@ -29,11 +39,12 @@ class Filter: | ||||
|  | ||||
|     @staticmethod | ||||
|     def do_filter() -> None: | ||||
|         Filter.debouncer.stop() | ||||
|         value = Filter.get_value() | ||||
|  | ||||
|         for i in range(Window.view.count()): | ||||
|             item = Window.view.itemAt(i) | ||||
|             text = Filter.get_filter_text(item) | ||||
|             text = Filter.get_text(item) | ||||
|             hide = True | ||||
|  | ||||
|             for txt in text: | ||||
| @@ -47,7 +58,7 @@ class Filter: | ||||
|                 item.widget().show() | ||||
|  | ||||
|     @staticmethod | ||||
|     def get_filter_text(item: QWidget) -> list[str]: | ||||
|     def get_text(item: QWidget) -> list[str]: | ||||
|         text = [] | ||||
|         layout = item.widget().layout() | ||||
|  | ||||
|   | ||||
| @@ -569,3 +569,18 @@ class Game: | ||||
|     @staticmethod | ||||
|     def change_speed(speed: str) -> None: | ||||
|         Window.speed.setCurrentText(speed.capitalize()) | ||||
|  | ||||
|     @staticmethod | ||||
|     def filter_top() -> None: | ||||
|         from .filter import Filter | ||||
|  | ||||
|         value = Filter.get_value() | ||||
|         ant = Ants.top | ||||
|  | ||||
|         if not ant: | ||||
|             return | ||||
|  | ||||
|         if value == ant.name.lower(): | ||||
|             Filter.clear() | ||||
|         else: | ||||
|             Filter.set_value(ant.name) | ||||
|   | ||||
| @@ -258,7 +258,7 @@ class Window: | ||||
|         container = QHBoxLayout() | ||||
|  | ||||
|         btn_menu = SpecialButton("Menu") | ||||
|         btn_menu.setToolTip("The main menu\nMiddle Click to force an update") | ||||
|         btn_menu.setToolTip("The main menu\nMiddle Click: Force an update") | ||||
|         btn_menu.clicked.connect(Game.menu) | ||||
|         btn_menu.middleClicked.connect(Game.force_update) | ||||
|  | ||||
| @@ -359,12 +359,17 @@ class Window: | ||||
|  | ||||
|     @staticmethod | ||||
|     def add_footer() -> None: | ||||
|         from .game import Game | ||||
|  | ||||
|         root = QWidget() | ||||
|         root.setContentsMargins(0, 0, 0, 0) | ||||
|         container = QHBoxLayout() | ||||
|         Window.info = QPushButton("---") | ||||
|         Window.info.setToolTip("Click to scroll to the bottom or top") | ||||
|         Window.info = SpecialButton("---") | ||||
|         Window.info.setToolTip( | ||||
|             "Click to scroll to the bottom or top\nMiddle Click: Filter Top" | ||||
|         ) | ||||
|         Window.info.clicked.connect(Window.toggle_scroll) | ||||
|         Window.info.middleClicked.connect(Game.filter_top) | ||||
|         Window.info.setMinimumSize(35, 35) | ||||
|         container.addWidget(Window.info) | ||||
|         root.setLayout(container) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Auric Vente
					Auric Vente