@@ -228,6 +228,213 @@ def exclude_rule_for_e3m1_e3m9(self, value: str | None):
228228
229229
230230class SettingsObject :
231+ class __SettingsObjectCopy :
232+ def __init__ (self , master : Any ) -> None :
233+ """
234+ # __SettingsObjectCopy
235+
236+ Serves as a copy of SettingsObject that doesn't allow for as much features.
237+
238+ :param master: SettingsObject class
239+ """
240+
241+ self ._SETTINGS : dict [str , int | bool | str | float | list [list [str , str , str ]] | None ] = master ._SETTINGS
242+ self .error_handler = master .error_handler
243+ self ._MASTER = master
244+
245+ def load (self ) -> None :
246+ """"""
247+
248+ self ._MASTER .load ()
249+
250+ self ._SETTINGS = self ._MASTER ._SETTINGS .copy ()
251+
252+ def save_settings (self , ** kw ) -> None :
253+ """
254+ ## save_settings
255+ Automatically save the settings using the default inner settings of the class.
256+
257+ :param indent: how many spaces as indentation *(int, defaults to 4)*
258+ """
259+
260+ self ._MASTER ._SETTINGS = self ._SETTINGS
261+ self ._MASTER .save_settings (** kw )
262+ del self
263+
264+ @property
265+ def databases (self ) -> list [list [str , str , str ]]:
266+ return self ._SETTINGS ['databases' ]
267+
268+ @databases .setter
269+ def databases (self , value : list [list [str , str , str ]]):
270+ value .pop (0 )
271+ self ._SETTINGS ['databases' ] = value
272+
273+ @databases .deleter
274+ def databases (self ):
275+ self ._SETTINGS ['databases' ].clear ()
276+
277+ @property
278+ def theme (self ) -> str :
279+ match self ._SETTINGS ['theme' ]:
280+ case 1 :
281+ return "light"
282+
283+ case 2 :
284+ return "dark"
285+
286+ case _:
287+ return "auto"
288+
289+ @theme .setter
290+ def theme (self , value : str | int ):
291+ if isinstance (value , int ):
292+ self ._SETTINGS ['theme' ] = value
293+ return
294+
295+ match value :
296+ case 'light' :
297+ value = 1
298+
299+ case 'dark' :
300+ value = 2
301+
302+ case _:
303+ value = 0
304+
305+ self ._SETTINGS ['theme' ] = value
306+
307+ @property
308+ def image_ratio (self ) -> bool :
309+ return self ._SETTINGS ['imageRatio' ]
310+
311+ @image_ratio .setter
312+ def image_ratio (self , value : str ):
313+ match value :
314+ case '16:9' | '1:1' :
315+ print ('Good image ratio.' )
316+
317+ case _:
318+ value = 'detect'
319+
320+ self ._SETTINGS ['imageRatio' ] = value
321+
322+ @property
323+ def image_width (self ) -> int :
324+ return self ._SETTINGS ['imageWidth' ]
325+
326+ @image_width .setter
327+ def image_width (self , value : int ):
328+ self ._SETTINGS ['imageWidth' ] = value
329+
330+ @property
331+ def use_width_as_height (self ) -> bool :
332+ return self ._SETTINGS ['widthIsHeight' ]
333+
334+ @use_width_as_height .setter
335+ def use_width_as_height (self , value : bool ):
336+ self ._SETTINGS ['widthIsHeight' ] = value
337+
338+ @property
339+ def zoom_boost (self ) -> float :
340+ return self ._SETTINGS ['zoomBoost' ]
341+
342+ @zoom_boost .setter
343+ def zoom_boost (self , value : float ):
344+ self ._SETTINGS ['zoomBoost' ] = value
345+
346+ @property
347+ def check_for_updates_on_startup (self ) -> bool :
348+ return self ._SETTINGS ['checkUpdates' ]
349+
350+ @check_for_updates_on_startup .setter
351+ def check_for_updates_on_startup (self , value : bool ):
352+ self ._SETTINGS ['checkUpdates' ] = value
353+
354+ '''
355+ @property
356+ def autoupdate(self) -> bool:
357+ """
358+ # Levels of Auto Updating
359+
360+ **Key name:** `autoUpdateLevel`
361+
362+ 0. **Always ask** (Default)
363+ 1. **Always update**
364+ 2. **Update if the latest is a major**
365+ 3. **Never update**
366+
367+ Auto Updating only works if **Check for Updates on Startup** (key name is `checkUpdates`) is enabled (set to `True`).
368+
369+ Both Auto Updates and Check for Updates require a stable Internet connection.
370+ """
371+
372+ return self._SETTINGS['autoUpdateLevel']
373+
374+ @autoupdate.setter
375+ def autoupdate(self, value: bool):
376+ if value < 0 or value > 3:
377+ value = 0 # [i] set to default
378+
379+ self._SETTINGS['autoUpdateLevel'] = value
380+ '''
381+
382+ @property
383+ def small_fonts (self ) -> bool :
384+ return self ._SETTINGS ['smallFonts' ]
385+
386+ @small_fonts .setter
387+ def small_fonts (self , value : bool ):
388+ """
389+ # small_fonts
390+
391+ **Key name:** `smallFonts`
392+
393+ 0. **Disabled**, which allows for the best UI experience
394+ 1. **Enabled**, which allows for DoomMapGuesser to be played in smaller monitors
395+ """
396+
397+ self ._SETTINGS ['smallFonts' ] = value
398+
399+ @property
400+ def exclude_rule_for_e3m1_e3m9 (self , ** kw ) -> str | None :
401+ """
402+ # exclude_rule_for_e3m1_e3m9
403+
404+ Whether to use **Hell Keep** or **Warrens** or both, even!
405+
406+ :param obj: the object to save - if not specified, will save itself
407+ :param object: same as above but this one does not take priority
408+
409+ Returns:
410+ str: either 'warrens', 'hellkeep' or 'both' depending on what the user chose *(None if set to show none)*
411+ """
412+
413+ __obj = kw .get ('obj' , None )
414+
415+ if __obj is None :
416+ __obj = kw .get ('object' , None )
417+
418+ a : str | None = self ._SETTINGS ['excludeRule' ]
419+
420+ if a not in ('warrens' , 'hell_keep' , 'both' ):
421+ self ._SETTINGS ['excludeRule' ] = None
422+
423+ if __obj is None :
424+ self .save_settings ()
425+
426+ else :
427+ self .dump_settings (__obj )
428+
429+ return self ._SETTINGS ['excludeRule' ]
430+
431+ @exclude_rule_for_e3m1_e3m9 .setter
432+ def exclude_rule_for_e3m1_e3m9 (self , value : str | None ):
433+ if value not in ('warrens' , 'hell_keep' , 'both' ):
434+ value = None
435+
436+ self ._SETTINGS ['excludeRule' ] = value
437+
231438 def __init__ (self , given_path : str , * _ , handler : Any , initial_settings : dict [str , int | bool | str | float | list [list [str , str , str ]]] | None = None , ** kw ) -> None :
232439 """
233440 # SettingsObject
@@ -482,7 +689,7 @@ def exclude_rule_for_e3m1_e3m9(self, **kw) -> str | None:
482689 :param object: same as above but this one does not take priority
483690
484691 Returns:
485- str: either 'warrens', 'hellkeep ' or 'both' depending on what the user chose *(None if set to show none)*
692+ str: either 'warrens', 'hell_keep ' or 'both' depending on what the user chose *(None if set to show none)*
486693 """
487694
488695 __obj = kw .get ('obj' , None )
@@ -512,7 +719,7 @@ def exclude_rule_for_e3m1_e3m9(self, value: str | None):
512719
513720 @property
514721 def copy (self ):
515- return __SettingsObjectCopy (self )
722+ return self . __SettingsObjectCopy (self )
516723
517724 def __getitem__ (self , key : str ) -> int | bool | str | float | list [str ] | None :
518725 if self ._BE_STRICT :
0 commit comments