Advertisement
Ri0n

update_switchres_ini

Feb 13th, 2024 (edited)
1,279
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.19 KB | Source Code | 0 0
  1. def update_switchres_ini(range, inifile=''):
  2.     if not inifile:
  3.         logging.error("No INI file specified.")
  4.         sys.exit(1)
  5.  
  6.     logging.info("Updating {} with crt_range {}".format(inifile, str(range)))
  7.  
  8.     # Check if the INI file exists
  9.     if not os.path.exists(inifile):
  10.         logging.error("INI file {} not found.".format(inifile))
  11.         sys.exit(1)
  12.  
  13.     # Load the existing configuration from the INI file
  14.     config = configparser.ConfigParser()
  15.     config.read(inifile)
  16.  
  17.     # Update the CRT range section with the new values
  18.     if 'crt_range' not in config:
  19.         config['crt_range'] = {}
  20.  
  21.     config['crt_range']['HfreqMin'] = str(range.HfreqMin)
  22.     config['crt_range']['HfreqMax'] = str(range.HfreqMax)
  23.     config['crt_range']['VfreqMin'] = str(range.VfreqMin)
  24.     config['crt_range']['VfreqMax'] = str(range.VfreqMax)
  25.     config['crt_range']['HFrontPorch'] = str(range.HFrontPorch)
  26.     config['crt_range']['HSyncPulse'] = str(range.HSyncPulse)
  27.     config['crt_range']['HBackPorch'] = str(range.HBackPorch)
  28.     config['crt_range']['VFrontPorch'] = str(range.VFrontPorch)
  29.     config['crt_range']['VSyncPulse'] = str(range.VSyncPulse)
  30.     config['crt_range']['VBackPorch'] = str(range.VBackPorch)
  31.     config['crt_range']['HSyncPol'] = str(range.HSyncPol)
  32.     config['crt_range']['VSyncPol'] = str(range.VSyncPol)
  33.     config['crt_range']['ProgressiveLinesMin'] = str(range.ProgressiveLinesMin)
  34.     config['crt_range']['ProgressiveLinesMax'] = str(range.ProgressiveLinesMax)
  35.     config['crt_range']['InterlacedLinesMin'] = str(range.InterlacedLinesMin)
  36.     config['crt_range']['InterlacedLinesMax'] = str(range.InterlacedLinesMax)
  37.  
  38.     # Write the updated configuration back to the INI file
  39.     with open(inifile, 'w') as configfile:
  40.         config.write(configfile)
  41.  
  42.     logging.info("INI file updated successfully.")
  43.  
  44. # Example usage:
  45. # range = crt_range(HfreqMin=0.0, HfreqMax=100.0, VfreqMin=0.0, VfreqMax=100.0, HFrontPorch=0.0, HSyncPulse=0.0, HBackPorch=0.0, VFrontPorch=0.0, VSyncPulse=0.0, VBackPorch=0.0, HSyncPol=0, VSyncPol=0, ProgressiveLinesMin=0, ProgressiveLinesMax=0, InterlacedLinesMin=0, InterlacedLinesMax=0)
  46. # update_switchres_ini(range, 'switchres.ini')
  47.  
Advertisement
Comments
  • caraxesd09
    284 days
    # text 1.68 KB | 0 0
    1. <div style="display:none">
    2. <a href="http://ftp.threeten.org/danatoto/">http://ftp.threeten.org/danatoto/</a>
    3. <a href="http://ftp.graded-reader.org/danatoto/">http://ftp.graded-reader.org/danatoto/</a>
    4. <a href="http://ftp.threeten.org/pay4d/">http://ftp.threeten.org/pay4d/</a>
    5. <a href="http://ftp.threeten.org/depo10k/">http://ftp.threeten.org/depo10k/</a>
    6. <a href="http://ftp.threeten.org/depo25/">http://ftp.threeten.org/depo25/</a>
    7. <a href="http://ftp.superherojs.com/">http://ftp.superherojs.com/
    8. <a href="https://shop.hobbymatehobby.com/">https://shop.hobbymatehobby.com/
    9. <a href="https://shop.hobbymatehobby.com/products/dana-toto-situs-toto-slot-deposit-5000-dengan-slot-depo-5k-mudah-diraih-di-slot-togel/">https://shop.hobbymatehobby.com/products/dana-toto-situs-toto-slot-deposit-5000-dengan-slot-depo-5k-mudah-diraih-di-slot-togel/</a>
    10. <a href="https://shop.hobbymatehobby.com/products/pay4d-situs-slot-gacor-4d-dengan-kemenangan-slot-gacor-777-maxwin-di-slot-thailand-teraih/">https://shop.hobbymatehobby.com/products/pay4d-situs-slot-gacor-4d-dengan-kemenangan-slot-gacor-777-maxwin-di-slot-thailand-teraih/</a>
    11. <a href="https://shop.hobbymatehobby.com/products/slot-bonus-situs-slot-depo-25-bonus-25-dengan-to-3x-5x-7x-dijamin-maxwin-saat-bermain-di-slot-thailand/">https://shop.hobbymatehobby.com/products/slot-bonus-situs-slot-depo-25-bonus-25-dengan-to-3x-5x-7x-dijamin-maxwin-saat-bermain-di-slot-thailand/</a>
    12. <a href="https://shop.hobbymatehobby.com/products/slot-depo-10k-situs-slot-gacor-terbaru-dengan-modal-depo-10k-maxwin-mudah-didapatkan/">https://shop.hobbymatehobby.com/products/slot-depo-10k-situs-slot-gacor-terbaru-dengan-modal-depo-10k-maxwin-mudah-didapatkan/</a>
    13. </div>
    14.  
Add Comment
Please, Sign In to add comment
Advertisement