Ejemplo n.º 1
0
 def _AddFolder( self ):
     
     new_options = HG.client_controller.new_options
     
     phrase = new_options.GetString( 'export_phrase' )
     
     name = 'export folder'
     path = ''
     export_type = HC.EXPORT_FOLDER_TYPE_REGULAR
     delete_from_client_after_export = False
     file_search_context = ClientSearch.FileSearchContext( file_service_key = CC.LOCAL_FILE_SERVICE_KEY )
     period = 15 * 60
     
     export_folder = ClientExporting.ExportFolder( name, path, export_type = export_type, delete_from_client_after_export = delete_from_client_after_export, file_search_context = file_search_context, period = period, phrase = phrase )
     
     with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit export folder' ) as dlg:
         
         panel = EditExportFolderPanel( dlg, export_folder )
         
         dlg.SetPanel( panel )
         
         if dlg.exec() == QW.QDialog.Accepted:
             
             export_folder = panel.GetValue()
             
             export_folder.SetNonDupeName( self._GetExistingNames() )
             
             self._export_folders.AddDatas( ( export_folder, ) )
Ejemplo n.º 2
0
    def GetValue(self):

        name = self._name.text()

        path = self._path.GetPath()

        export_type = self._type.GetValue()

        delete_from_client_after_export = self._delete_from_client_after_export.isChecked(
        )

        file_search_context = self._tag_autocomplete.GetFileSearchContext()

        run_regularly = self._run_regularly.isChecked()

        period = self._period.GetValue()

        if self._path.GetPath() in ('', None):

            raise HydrusExceptions.VetoException(
                'You must enter a folder path to export to!')

        phrase = self._pattern.text()

        try:

            ClientExporting.ParseExportPhrase(phrase)

        except Exception as e:

            raise HydrusExceptions.VetoException(
                'Could not parse that export phrase! ' + str(e))

        run_now = self._run_now.isChecked()

        paused = self._paused.isChecked()

        last_error = self._export_folder.GetLastError()

        export_folder = ClientExporting.ExportFolder(
            name,
            path=path,
            export_type=export_type,
            delete_from_client_after_export=delete_from_client_after_export,
            file_search_context=file_search_context,
            run_regularly=run_regularly,
            period=period,
            phrase=phrase,
            last_checked=self._last_checked,
            paused=paused,
            run_now=run_now,
            last_error=last_error)

        return export_folder