Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
system_predicates = HC.options[ 'file_system_predicates' ]
( sign, ms ) = system_predicates[ 'duration' ]
s = ms // 1000
ms = ms % 1000
self._sign.SetStringSelection( sign )
self._duration_s.setValue( s )
self._duration_ms.setValue( ms )
hbox = QP.HBoxLayout()
QP.AddToLayout( hbox, ClientGUICommon.BetterStaticText(self,'system:duration'), CC.FLAGS_VCENTER )
QP.AddToLayout( hbox, self._sign, CC.FLAGS_VCENTER )
QP.AddToLayout( hbox, self._duration_s, CC.FLAGS_VCENTER )
QP.AddToLayout( hbox, ClientGUICommon.BetterStaticText(self,'s'), CC.FLAGS_VCENTER )
QP.AddToLayout( hbox, self._duration_ms, CC.FLAGS_VCENTER )
QP.AddToLayout( hbox, ClientGUICommon.BetterStaticText(self,'ms'), CC.FLAGS_VCENTER )
hbox.addStretch( 1 )
self.setLayout( hbox )
def _Delete( self ):
num_selected = self._listbox.GetNumSelected()
if num_selected == 0:
return
from hydrus.client.gui import ClientGUIDialogsQuick
result = ClientGUIDialogsQuick.GetYesNo( self, 'Remove {} selected?'.format( HydrusData.ToHumanInt( num_selected ) ) )
if result != QW.QDialog.Accepted:
return
self._listbox.DeleteSelected()
self.listBoxChanged.emit()
def _Delete( self ):
num_selected = self._listbox.GetNumSelected()
if num_selected == 0:
return
from hydrus.client.gui import ClientGUIDialogsQuick
result = ClientGUIDialogsQuick.GetYesNo( self, 'Remove {} selected?'.format( HydrusData.ToHumanInt( num_selected ) ) )
if result == QW.QDialog.Accepted:
self._listbox.DeleteSelected()
self.listBoxChanged.emit()
additional_data = self._RegenFileOtherHashes( media_result )
elif job_type == REGENERATE_FILE_DATA_JOB_FORCE_THUMBNAIL:
self._RegenFileThumbnailForce( media_result )
elif job_type == REGENERATE_FILE_DATA_JOB_REFIT_THUMBNAIL:
was_regenerated = self._RegenFileThumbnailRefit( media_result )
if was_regenerated:
num_thumb_refits += 1
job_key.SetVariable( 'popup_text_2', 'thumbs needing regen: {}'.format( HydrusData.ToHumanInt( num_thumb_refits ) ) )
elif job_type == REGENERATE_FILE_DATA_JOB_DELETE_NEIGHBOUR_DUPES:
self._DeleteNeighbourDupes( media_result )
elif job_type == REGENERATE_FILE_DATA_JOB_CHECK_SIMILAR_FILES_MEMBERSHIP:
additional_data = self._CheckSimilarFilesMembership( media_result )
elif job_type == REGENERATE_FILE_DATA_JOB_SIMILAR_FILES_METADATA:
additional_data = self._RegenSimilarFilesMetadata( media_result )
elif job_type == REGENERATE_FILE_DATA_JOB_FIX_PERMISSIONS:
self._FixFilePermissions( media_result )
ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
self._original_api_permissions = api_permissions
self._access_key = QW.QLineEdit()
self._access_key.setReadOnly( True )
width = ClientGUIFunctions.ConvertTextToPixelWidth( self._access_key, 66 )
self.setMinimumWidth( width )
self._name = QW.QLineEdit( self )
self._basic_permissions = QP.CheckListBox( self )
for permission in ClientAPI.ALLOWED_PERMISSIONS:
self._basic_permissions.Append( ClientAPI.basic_permission_to_str_lookup[ permission ], permission )
search_tag_filter = api_permissions.GetSearchTagFilter()
message = 'The API will only permit searching for tags that pass through this filter.'
message += os.linesep * 2
message += 'If you want to allow all tags, just leave it as is, permitting everything. If you want to limit it to just one tag, such as "do waifu2x on this", set up a whitelist with only that tag allowed.'
self._search_tag_filter = ClientGUITags.TagFilterButton( self, message, search_tag_filter, label_prefix = 'permitted tags: ' )
#
( service_string_gumpf, network_version ) = server_header.split( '/' )
network_version = int( network_version )
if network_version != HC.NETWORK_VERSION:
if network_version > HC.NETWORK_VERSION:
message = 'Your client is out of date; please download the latest release.'
else:
message = 'The server is out of date; please ask its admin to update to the latest release.'
raise HydrusExceptions.NetworkVersionException( 'Network version mismatch! The server\'s network version was ' + str( network_version ) + ', whereas your client\'s is ' + str( HC.NETWORK_VERSION ) + '! ' + message )
def do_test():
if HG.model_shutdown:
try:
process.kill()
except:
pass
raise HydrusExceptions.ShutdownException( 'Application is shutting down!' )
HydrusData.Print( 'Initialising daemons\u2026' )
self.InitView()
HydrusData.Print( 'Server is running. Press Ctrl+C to quit.' )
try:
while not HG.model_shutdown and not self._shutdown:
time.sleep( 1 )
except KeyboardInterrupt:
HydrusData.Print( 'Received a keyboard interrupt\u2026' )
HydrusData.Print( 'Shutting down controller\u2026' )
self.Exit()
def __init__( self, parent, test_result ):
ClientGUIScrolledPanels.ReviewPanel.__init__( self, parent )
( name, url, body, self._downloaded_data, new_temp_strings, new_cookie_strings, result ) = test_result
self._name = ClientGUICommon.BetterStaticText( self, label = name )
self._url = QW.QLineEdit( self )
self._url.setReadOnly( True )
self._body = QW.QPlainTextEdit( self )
self._body.setReadOnly( True )
min_size = ClientGUIFunctions.ConvertTextToPixels( self._body, ( 64, 3 ) )
QP.SetMinClientSize( self._body, min_size )
self._data_preview = QW.QPlainTextEdit( self )
self._data_preview.setReadOnly( True )
min_size = ClientGUIFunctions.ConvertTextToPixels( self._data_preview, ( 64, 8 ) )
if version == 3:
( serialisable_gallery_identifier, serialisable_gallery_stream_identifiers, serialisable_current_query_stuff, pending_queries, file_limit, gallery_paused, files_paused, serialisable_file_import_options, serialisable_tag_import_options, serialisable_gallery_seed_log, serialisable_file_seed_cache ) = old_serialisable_info
( current_query, current_query_num_new_urls, serialisable_current_gallery_stream_identifier, current_gallery_stream_identifier_page_index, serialisable_current_gallery_stream_identifier_found_urls, serialisable_pending_gallery_stream_identifiers ) = serialisable_current_query_stuff
highlighted_gallery_import_key = None
serialisable_highlighted_gallery_import_key = highlighted_gallery_import_key
gallery_imports = HydrusSerialisable.SerialisableList()
file_import_options = HydrusSerialisable.CreateFromSerialisableTuple( serialisable_file_import_options )
tag_import_options = HydrusSerialisable.CreateFromSerialisableTuple( serialisable_tag_import_options )
gallery_seed_log = HydrusSerialisable.CreateFromSerialisableTuple( serialisable_gallery_seed_log )
file_seed_cache = HydrusSerialisable.CreateFromSerialisableTuple( serialisable_file_seed_cache )
if len( file_seed_cache ) > 0:
current_query = 'queue brought from old page'
gallery_import = GalleryImport( query = current_query, source_name = 'updated from old system', initial_search_urls = [] )
gallery_import.PausePlayGallery()
gallery_import.PausePlayFiles()
gallery_import.SetFileLimit( file_limit )
gallery_import.SetFileImportOptions( file_import_options )
gallery_import.SetTagImportOptions( tag_import_options )