def accept(self): # Copy values from form to settings and save self.settings.rar_exe_path = str(self.leRarExePath.text()) self.settings.unrar_exe_path = str(self.leUnrarExePath.text()) # make sure unrar/rar program is now in the path for the UnRAR class utils.addtopath(os.path.dirname(self.settings.unrar_exe_path)) utils.addtopath(os.path.dirname(self.settings.rar_exe_path)) if not str(self.leNameLengthDeltaThresh.text()).isdigit(): self.leNameLengthDeltaThresh.setText("0") if not str(self.leIssueNumPadding.text()).isdigit(): self.leIssueNumPadding.setText("0") self.settings.check_for_new_version = self.cbxCheckForNewVersion.isChecked() self.settings.id_length_delta_thresh = int( self.leNameLengthDeltaThresh.text()) self.settings.id_publisher_blacklist = str( self.tePublisherBlacklist.toPlainText()) self.settings.parse_scan_info = self.cbxParseScanInfo.isChecked() self.settings.use_series_start_as_volume = self.cbxUseSeriesStartAsVolume.isChecked() self.settings.clear_form_before_populating_from_cv = self.cbxClearFormBeforePopulating.isChecked() self.settings.remove_html_tables = self.cbxRemoveHtmlTables.isChecked() self.settings.cv_api_key = unicode(self.leKey.text()) ComicVineTalker.api_key = self.settings.cv_api_key self.settings.assume_lone_credit_is_primary = self.cbxAssumeLoneCreditIsPrimary.isChecked() self.settings.copy_characters_to_tags = self.cbxCopyCharactersToTags.isChecked() self.settings.copy_teams_to_tags = self.cbxCopyTeamsToTags.isChecked() self.settings.copy_locations_to_tags = self.cbxCopyLocationsToTags.isChecked() self.settings.copy_storyarcs_to_tags = self.cbxCopyStoryArcsToTags.isChecked() self.settings.copy_notes_to_comments = self.cbxCopyNotesToComments.isChecked() self.settings.copy_weblink_to_comments = self.cbxCopyWebLinkToComments.isChecked() self.settings.apply_cbl_transform_on_cv_import = self.cbxApplyCBLTransformOnCVIMport.isChecked() self.settings.apply_cbl_transform_on_bulk_operation = self.cbxApplyCBLTransformOnBatchOperation.isChecked() self.settings.rename_template = str(self.leRenameTemplate.text()) self.settings.rename_issue_number_padding = int( self.leIssueNumPadding.text()) self.settings.rename_use_smart_string_cleanup = self.cbxSmartCleanup.isChecked() self.settings.rename_extension_based_on_archive = self.cbxChangeExtension.isChecked() self.settings.save() QtGui.QDialog.accept(self)
def __init__(self): self.settings_file = "" self.folder = "" self.setDefaultValues() #self.config = configparser.RawConfigParser() self.folder = ComicTaggerSettings.getSettingsFolder() if not os.path.exists(self.folder): os.makedirs(self.folder) self.settings_file = os.path.join(self.folder, "settings.ini") self.CFG = ConfigObj(self.settings_file, encoding='utf-8') # if config file doesn't exist, write one out if not os.path.exists(self.settings_file): self.save() else: self.load() # take a crack at finding rar exes, if not set already if self.rar_exe_path == "": if platform.system() == "Windows": # look in some likely places for windows machine if os.path.exists("C:\Program Files\WinRAR\Rar.exe"): self.rar_exe_path = "C:\Program Files\WinRAR\Rar.exe" elif os.path.exists("C:\Program Files (x86)\WinRAR\Rar.exe"): self.rar_exe_path = "C:\Program Files (x86)\WinRAR\Rar.exe" else: # see if it's in the path of unix user if utils.which("rar") is not None: self.rar_exe_path = utils.which("rar") if self.rar_exe_path != "": self.save() if self.unrar_exe_path == "": if platform.system() != "Windows": # see if it's in the path of unix user if utils.which("unrar") is not None: self.unrar_exe_path = utils.which("unrar") if self.unrar_exe_path != "": self.save() # make sure unrar/rar program is now in the path for the UnRAR class to use utils.addtopath(os.path.dirname(self.unrar_exe_path)) utils.addtopath(os.path.dirname(self.rar_exe_path))
def __init__(self): self.settings_file = "" self.folder = "" self.setDefaultValues() #self.config = configparser.RawConfigParser() self.folder = ComicTaggerSettings.getSettingsFolder() if not os.path.exists( self.folder ): os.makedirs( self.folder ) self.settings_file = os.path.join( self.folder, "settings.ini") self.CFG = ConfigObj(self.settings_file, encoding='utf-8') # if config file doesn't exist, write one out if not os.path.exists( self.settings_file ): self.save() else: self.load() # take a crack at finding rar exes, if not set already if self.rar_exe_path == "": if platform.system() == "Windows": # look in some likely places for windows machine if os.path.exists( "C:\Program Files\WinRAR\Rar.exe" ): self.rar_exe_path = "C:\Program Files\WinRAR\Rar.exe" elif os.path.exists( "C:\Program Files (x86)\WinRAR\Rar.exe" ): self.rar_exe_path = "C:\Program Files (x86)\WinRAR\Rar.exe" else: # see if it's in the path of unix user if utils.which("rar") is not None: self.rar_exe_path = utils.which("rar") if self.rar_exe_path != "": self.save() if self.unrar_exe_path == "": if platform.system() != "Windows": # see if it's in the path of unix user if utils.which("unrar") is not None: self.unrar_exe_path = utils.which("unrar") if self.unrar_exe_path != "": self.save() # make sure unrar/rar program is now in the path for the UnRAR class to use utils.addtopath(os.path.dirname(self.unrar_exe_path)) utils.addtopath(os.path.dirname(self.rar_exe_path))
def accept(self): # Copy values from form to settings and save self.settings.rar_exe_path = str(self.leRarExePath.text()) self.settings.unrar_exe_path = str(self.leUnrarExePath.text()) # make sure unrar/rar program is now in the path for the UnRAR class utils.addtopath(os.path.dirname(self.settings.unrar_exe_path)) utils.addtopath(os.path.dirname(self.settings.rar_exe_path)) if not str(self.leNameLengthDeltaThresh.text()).isdigit(): self.leNameLengthDeltaThresh.setText("0") if not str(self.leIssueNumPadding.text()).isdigit(): self.leIssueNumPadding.setText("0") self.settings.check_for_new_version = self.cbxCheckForNewVersion.isChecked( ) self.settings.id_length_delta_thresh = int( self.leNameLengthDeltaThresh.text()) self.settings.id_publisher_blacklist = str( self.tePublisherBlacklist.toPlainText()) self.settings.parse_scan_info = self.cbxParseScanInfo.isChecked() self.settings.use_series_start_as_volume = self.cbxUseSeriesStartAsVolume.isChecked( ) self.settings.clear_form_before_populating_from_cv = self.cbxClearFormBeforePopulating.isChecked( ) self.settings.remove_html_tables = self.cbxRemoveHtmlTables.isChecked() self.settings.cv_api_key = unicode(self.leKey.text()) ComicVineTalker.api_key = self.settings.cv_api_key self.settings.assume_lone_credit_is_primary = self.cbxAssumeLoneCreditIsPrimary.isChecked( ) self.settings.copy_characters_to_tags = self.cbxCopyCharactersToTags.isChecked( ) self.settings.copy_teams_to_tags = self.cbxCopyTeamsToTags.isChecked() self.settings.copy_locations_to_tags = self.cbxCopyLocationsToTags.isChecked( ) self.settings.copy_storyarcs_to_tags = self.cbxCopyStoryArcsToTags.isChecked( ) self.settings.copy_notes_to_comments = self.cbxCopyNotesToComments.isChecked( ) self.settings.copy_weblink_to_comments = self.cbxCopyWebLinkToComments.isChecked( ) self.settings.apply_cbl_transform_on_cv_import = self.cbxApplyCBLTransformOnCVIMport.isChecked( ) self.settings.apply_cbl_transform_on_bulk_operation = self.cbxApplyCBLTransformOnBatchOperation.isChecked( ) self.settings.rename_template = str(self.leRenameTemplate.text()) self.settings.rename_issue_number_padding = int( self.leIssueNumPadding.text()) self.settings.rename_use_smart_string_cleanup = self.cbxSmartCleanup.isChecked( ) self.settings.rename_extension_based_on_archive = self.cbxChangeExtension.isChecked( ) self.settings.save() QtGui.QDialog.accept(self)