|
32 | 32 | from stegano.utils import get_file_extension |
33 | 33 |
|
34 | 34 |
|
35 | | -class SteganoGUI: |
| 35 | +class SteganoGUI: # pylint: disable=too-many-instance-attributes |
36 | 36 | """Main GUI class for stegano-sec""" |
37 | 37 |
|
38 | 38 | def __init__(self, root: tk.Tk): |
@@ -388,7 +388,7 @@ def detect_file_type(self, filepath: str) -> str: |
388 | 388 | return "text" |
389 | 389 | return "unknown" |
390 | 390 |
|
391 | | - def encode_message(self) -> None: |
| 391 | + def encode_message(self) -> None: # pylint: disable=too-many-return-statements,too-many-branches |
392 | 392 | """Encode message into file""" |
393 | 393 | # Validate inputs |
394 | 394 | input_path = self.encode_input_path.get() |
@@ -461,10 +461,10 @@ def encode_message(self) -> None: |
461 | 461 | "Error", "Encoding failed. Check console for details." |
462 | 462 | ) |
463 | 463 |
|
464 | | - except Exception as e: |
| 464 | + except (OSError, ValueError, UnicodeError, AttributeError, TypeError) as e: |
465 | 465 | messagebox.showerror("Error", f"Encoding failed: {str(e)}") |
466 | 466 |
|
467 | | - def decode_message(self) -> None: |
| 467 | + def decode_message(self) -> None: # pylint: disable=too-many-branches |
468 | 468 | """Decode message from file""" |
469 | 469 | # Validate inputs |
470 | 470 | input_path = self.decode_input_path.get() |
@@ -537,7 +537,7 @@ def decode_message(self) -> None: |
537 | 537 | "Error", "Decoding failed. Check console for details." |
538 | 538 | ) |
539 | 539 |
|
540 | | - except Exception as e: |
| 540 | + except (OSError, ValueError, UnicodeError, AttributeError, TypeError) as e: |
541 | 541 | messagebox.showerror("Error", f"Decoding failed: {str(e)}") |
542 | 542 |
|
543 | 543 | def check_capacity(self) -> None: |
@@ -604,7 +604,7 @@ def check_capacity(self) -> None: |
604 | 604 | self.capacity_result_text.delete("1.0", tk.END) |
605 | 605 | self.capacity_result_text.insert("1.0", result) |
606 | 606 |
|
607 | | - except Exception as e: |
| 607 | + except (OSError, ValueError, AttributeError, TypeError) as e: |
608 | 608 | messagebox.showerror("Error", f"Capacity check failed: {str(e)}") |
609 | 609 |
|
610 | 610 |
|
|
0 commit comments