77
88import typing
99
10+ from .constants import Framework
11+
1012if typing .TYPE_CHECKING :
1113 import os
1214
@@ -36,7 +38,7 @@ class ConfigParseError(ConfigError):
3638 data : 'str | bytes | bytearray'
3739 '''The input data provided to the parser.'''
3840
39- path : 'os.PathLike | None'
41+ path : 'str | os.PathLike[str] | None'
4042 '''The path to the input file that caused the error, if parsing from file.'''
4143
4244 inner : 'Exception | None'
@@ -46,7 +48,7 @@ def __init__(
4648 self ,
4749 message : 'str' ,
4850 data : 'str | bytes | bytearray' ,
49- path : 'os.PathLike | None' = None ,
51+ path : 'str | os.PathLike[str] | None' = None ,
5052 inner : 'Exception | None' = None ,
5153 ) -> None :
5254 '''
@@ -62,3 +64,66 @@ def __init__(
6264 self .data = data
6365 self .path = path
6466 self .inner = inner
67+
68+
69+ class InvalidFrameworkError (BreezeStyleSheetError ):
70+ '''An exception that occurs when the provided framework is unknown.'''
71+
72+ # NOTE: This is unknown so it's not a valid `Framework` type.
73+ framework : 'str'
74+ '''The name of the provided Qt framework.'''
75+
76+ def __init__ (self , framework : 'str' ) -> None :
77+ super ().__init__ (f'Got an unsupported Qt framework of "{ framework } ".' )
78+ self .framework = framework
79+
80+
81+ class ResourceError (BreezeStyleSheetError ):
82+ '''The base exception for all Qt resource errors.'''
83+
84+
85+ class RccNotFoundError (ResourceError ):
86+ '''An exception that occurs when the Qt resource compiler cannot be found.'''
87+
88+ rcc : 'str | os.PathLike[str]'
89+ '''The name or path to the Qt resource compiler.'''
90+
91+ framework : 'Framework'
92+ '''The name of the provided Qt framework.'''
93+
94+ def __init__ (self , rcc : 'str | os.PathLike[str]' , framework : 'Framework' ) -> None :
95+ super ().__init__ (f'Unable to find a suitable "{ rcc } " executable for framework "{ framework } ".' )
96+ self .rcc = rcc
97+ self .framework = framework
98+
99+
100+ class ResourceCompileError (ResourceError ):
101+ '''An exception that occurs when there is an external error compiling the Qt resources.'''
102+
103+ rcc : 'str | os.PathLike[str]'
104+ '''The name or path to the Qt resource compiler.'''
105+
106+ qrc : 'str | os.PathLike[str]'
107+ '''The path to the input QRC file.'''
108+
109+ framework : 'Framework'
110+ '''The name of the provided Qt framework.'''
111+
112+ inner : 'Exception'
113+ '''The exception that caused the compilation error.'''
114+
115+ def __init__ (
116+ self ,
117+ rcc : 'str | os.PathLike[str]' ,
118+ qrc : 'str | os.PathLike[str]' ,
119+ framework : 'Framework' ,
120+ inner : 'Exception' ,
121+ ) -> None :
122+ super ().__init__ (
123+ f'Unable to find a compile the QRC file "{ qrc } " using resource'
124+ f' compiler "{ rcc } " for framework "{ framework } ".'
125+ )
126+ self .rcc = rcc
127+ self .qrc = qrc
128+ self .framework = framework
129+ self .inner = inner
0 commit comments