diff --git a/db/help my media files are broke.txt b/db/help my media files are broke.txt
index a7fd2e917..313dcff07 100644
--- a/db/help my media files are broke.txt
+++ b/db/help my media files are broke.txt
@@ -15,7 +15,7 @@ FYI: In hydrus's file storage, there are two sets of 256 sub folders. One is 'fx
Once you are booted, your client may throw up lots of missing thumbnail/file errors. Do not worry so much about these for now, but it would be best to close your larger pages and pause the import pages for now. Don't pause network traffic, since we'll be using that in a minute.
-If you needed to remap your file locations during pre-boot repair, then hit _database->migrate database_. It may still have your old damaged location set as the 'ideal', and the remapped correct locations set as just a temporary location it currently wants to move away from. Correct this by giving the new locations some weight and removing the old locations. Once you are done, you should only see good locations listed, no desire to move anything, with 'current' and 'ideal' usage at the same percentage.
+If you needed to remap your file locations during pre-boot repair, then hit _database->move media files_. It may still have your old damaged location set as the 'ideal', and the remapped correct locations set as just a temporary location it currently wants to move away from. Correct this by giving the new locations some weight and removing the old locations. Once you are done, you should only see good locations listed, no desire to move anything, with 'current' and 'ideal' usage at the same percentage.
Next, we have two classes of problem: files in the database but not in storage, and files in storage but not in the database.
diff --git a/docs/changelog.md b/docs/changelog.md
index 39581851d..783eafc50 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -7,6 +7,41 @@ title: Changelog
!!! note
This is the new changelog, only the most recent builds. For all versions, see the [old changelog](old_changelog.html).
+## [Version 562](https://github.com/hydrusnetwork/hydrus/releases/tag/v562)
+
+### misc
+
+* page tab drag and drops will now not start unless the click has lasted more than 100ms
+* same for thumbnail drag and drop--it perviously did a 20 pixel deadzone, but time checks detect accidental/spastic clicks better and stops false negatives when you start dragging on certain edges
+* added a 'BUGFIX: disable page tab drag and drop' setting to _options->gui pages_. while adding this, I may have accidentally fixed the issue I wanted to investigate (rare hangs on page DnD)
+* the manage tags dialog now shows the current count of tags for each page tab, and, if there are outstanding changes, shows an asterisk
+* the `migrate database` dialog is renamed `move media files`
+
+### fixes
+
+* fixed the basic copy/paste in the single 'edit datetime' panel, wich was often raising a dumb error. this thing also now exports millisecond data (issue #1520)
+* I am pretty sure I fixed the column-resizing problem in the very new PySide6 (Qt) 6.6.1, which it seems AUR users were recently updated to in an automatic OS update. all columns were setting to 100px width on initialisation. I think it is now safe to try out 6.6.1. I am still not sure why it was doing this, but some extra safeguards seem to have fixed it and also not broken things for <=6.6.0, so let me know what you run into! if you were affected by this, recall that you can right-click on any multi-column list header and say 'reset widths' to get something sensible back here
+* when exporting files, the max size is now clipped another 84 characters (64 + 20 more, which usually ends up about 150 characters max for the output filename), in order to give padding for longer sidecar suffixes and also avoid going right to the filesystem limit, which broadly isn't sensible
+* I think I fixed an issue where the mouse could stay hidden, perhaps, just on Wayland, after closing the media viewer with your keyboard (issue #1518)
+* fixed inc/dec ratings in the media viewer not updating their tooltips on new media correctly
+* if you hit 'open this location' on the export files window and the location does not exist, you now get a nice messagebox rather than a semi-silent error
+
+### analyze
+
+* background: some databases that process the PTR superfast or otherwise import a lot of data to a new file domain sometimes encounter massively massively slow tag update actions (typically tag-delete when the tags involved have siblings/parents), so I want to make the critical 'ANALYZE' call more timely
+* the 'analyze' database maintenance call will be soft-called far more regularly during normal repository processing, not just on first sync
+* sped up how some pre-analyze calculation is done
+* the size limit for automatic database analyze maintenance is raised from 100k rows to 10M
+* I hope to do more work here in future, probably making a review panel like we did for vacuum
+* if your repository processing sometimes hangs your whole damn client for 10-15 minutes, hit _database->db maintenance->analyze->full_! this job may take 30-60 minutes to finish
+
+### boring code cleanup
+
+* finished the HG->CG.client_controller refactor I started last week. this was a thousand lines changed from one braindead format to another, but it will be a useful step towards untangling the hell-nest import hierarchy
+* did a scattering of the clientinterface typing, getting a feel for where I want to take this
+* deleted the old in-client server-test's 'boot' variant; this is no longer used and was always super hacky to maintain
+* I removed an old basic error raising routine that would sometimes kick in when a hash definition is missing. this routine now always fills in the missing data with garbage and does its best to recover the invalid situation automatically, with decent logging, while still informing the user that things are well busted m8. it isn't the user's job to fix this, and there is no good fix anyway, so no point halting work and giving it to the user to figure out!
+
## [Version 561](https://github.com/hydrusnetwork/hydrus/releases/tag/v561)
### rearranging thumbnails
@@ -447,54 +482,3 @@ title: Changelog
* the forced-wait throttle that happens on several exception catches is reduced from 1s to 200ms
* I made the new job status queue properly thread-safe with a lock. I forgot to do it last week, whoops!
* fixed the build script to construct a file named .tar.zst for the Ubuntu release, not .tar.gz
-
-## [Version 552](https://github.com/hydrusnetwork/hydrus/releases/tag/v552)
-
-### misc
-
-* 'system:has audio' and 'system:embedded metadata' are now combined under a new meta-system predicate 'system:file properties'. if you can't find your yes/no predicate, try looking there!
-* menu commands will no longer have their unadjusted label as their tooltip. all tooltips are either the full status bar description or the full label if it was long enough to be elided
-* the 'open externally' panel now shows the default filetype thumbnail for formats like zip and epub
-* 'system:number of character tags > 4' now parses correct when you type it (previously it wouldn't work with a namespace), including special handling for 'unnamespaced'
-* the various 'number of x' system predicates will now parse if you type 'num x', 'number x', or 'num of x'
-* to match the other entries, the '4k' resolution swap-in label is now '2160p'
-* added a little extra info on the manage tags dialog to 'getting started with tags'
-* if you have 'confirm sending files to trash' turned off, the delete dialog will now show on physical deletes (i.e. deletes from the trash)
-* updated the derpibooru parser to pull the new AI-based 'generator' and 'prompter' namespaces (converting both to the hydrus-appropriate 'creator')
-* thanks to a user, the Linux build is now archived with zstd instead of gzip. should be about the same size but faster to decompress
-
-### fixes
-
-* fixed a stupid typo in the folder copy/move tech last week that was not allowing some move/copies to start (as always, the thing that is so simple that you don't think to test it is the very thing that blows up). sorry for the trouble!
-* cleaned up the file/folder move/copy error statements a little more
-* fixed the 'default search page tag service' dropdown in _options->search_ not saving correctly
-* fixed the 'open externally' panel having out of position thumbnails when your thumbnail supersampling is set to other than 100%
-* fixed the import and display of images in signed 16-bit format (weird TIFFs, seems like).
-* any image with an unusual channel data type beyond uint16 and int16 is going to be, as the default thing to do, normalised to unsigned 8-bit. it may blow out the colour range, but it should show something!
-* the client handles files with (0x0) resolution better. they should now always import, and it'll _attempt_ to render them to a normal full size thumb. if it works (e.g. this is some misconfigured SVG), great, and if it doesn't, we'll get a nicely sized filetype.png or hydrus.png fallback
-* files with (0x0) resolution will now never show in the preview or media viewers. previously, the preview viewer would bail out half-way through setting the media, causing it to fall into an invalid state where it still showed the previous valid media but wouldn't 'click-off' it easily, and the media viewer would generally panic to its 'no media to show' state and lose navigation functionality. now, files that are 0x0 are included in the general 'can we show this?' pre-launch sanity checks
-
-### has_transparency
-
-* the database can now remember if a file has transparency. you can search this with the new 'system:has transparency' predicate, which is under the new 'system:file properties' and will also parse if you type 'system:has/no transparency/alpha'
-* note that my version of 'has transparency' discludes files that have an all-opaque alpha channel (i.e. one that lets no light through). RGBA is insufficient--I want an alpha channel with some actual translucency somewhere!
-* although many application image project types like PSD and XCF can have transparency, the various ways we render or thumbnail them are hacky and probably lock to RGB or RGBA always, so I'm going to start simple. this week, we test transparency for all the images that support it (basically anything but jpeg), and animated gif. the animated gif tech is new and actually looks through every frame of an RGBA gif until it hits interesting alpha to catch cases where it starts opaque and fades away
-* just like we had with 'has exif' and similar, 'has transparency' knowledge will be calculated instantly for all new files, but for the files you already have, we'll have to do some slow file maintenance in the background for a while to retroactively calculate it all. you don't have to do anything; the data will just populate over time
-* the duplicate filter now shows 'has transparency, the other is opaque' statements
-* while working on this, I encountered a number of files that seemed to be false positives--apparently normal, fully opaque images of anime girls that were somehow showing up as 'has interesting alpha'. upon inspecting them closely, I discovered the border pixels had a slight fade, or one pixel out of all of them was 98% opaque, or the single bottom right pixel was completely transparent. perhaps some of these are secret artist markers, but I imagine many are just an accidental drawing tablet smudge or dodgy crop tool calculations. I'm leaving them as 'has_transparency' for now, but maybe we'll want to tune this more in future, perhaps saying you have to be at least 0.3% transparent to count. anyway, as always, while I am interested in seeing files that seem to get a false positive/negative with this new 'has transparency' test, if you have the technical know-how, please check if they actually have no alpha yourself first. once you play around with this system, let me know what sort of pseudo-'false positive' rate you are getting, and we can talk about an appropriate threshold
-
-### client api
-
-* the 'file_metadata' call now includes a 'has_transparency' boolean! remember that it will be overly `false` for a while, until the file maintenance catches up
-* forgot to mention it last week, but thanks to a user there is a new `/manage_database/get_client_options` call that fetches a heap of different client options. this exposes a mess that may change with any update, but there may be something neat you can hook into. this week we fixed a thing that was breaking this call for probably all old clients
-* the client api version is now 56
-
-### boring cleanup
-
-* renamed JobKey to JobStatus across the program
-* in prep for Client API calls to interact with the popup system, the queue of JobStatuses waiting to be displayed in the popup toaster is now encapsulated in a separate class, outside of the Qt object dangerzone
-* sped up how the popup manager system inspects and cleans the JobStatus queue in general. should have better performance when you get hundreds or thousands of messages
-* cleaned up some awkward popup manager dismiss code
-* fixed a timing issue that meant popup messages were auto-dismissed from the popup toaster up to a second after they were being 'deleted' by their parent functiions. subscription flow felt more laggy because of this
-* fixed the file info manager's duplicate call to duplicate unusual metadata like has_exif and blurhash
-* removed some old code that isn't used any more
diff --git a/docs/database_migration.md b/docs/database_migration.md
index 2790678a5..e4d086b0a 100644
--- a/docs/database_migration.md
+++ b/docs/database_migration.md
@@ -46,7 +46,7 @@ If you would like to move your files and thumbnails to new locations, I generall
??? note "Missing Locations"
If your folders are in the wrong locations on a client boot, a repair dialog appears, and you can manually update the client's internal understanding. This is not impossible to figure out, _and in some tricky storage situations doing this on purpose can be faster than letting the client migrate things itself_, but generally it is best and safest to do everything through the dialog.
-Go _database->migrate database_, giving you this dialog:
+Go _database->move media files_, giving you this dialog:
![](images/db_migration.png)
@@ -56,7 +56,7 @@ The buttons let you add more locations and remove old ones. The operations on th
**Weight** means the relative amount of media you would like to store in that location. It only matters if you are spreading your files across multiple locations. If location A has a weight of 1 and B has a weight of 2, A will get approximately one third of your files and B will get approximately two thirds.
-**Max Size** means the max total size of files the client will want to store in that location. Again, it only matters if you are spreading your files across multiple locations, but it is a simple way to ensure you don't go over a particular smaller hard drive's size. One location must always be limitless. This is not precise, so give it some padding. When one location is maxed out, the remaining locations will distribute the remainder of the files according to their respective weights. _For the meantime, this will not update by itself. If you import many files, the location may go over its limit and you will have to revisit 'migrate database' to rebalance your files again. Bear with me--I will fix this soon with the background migrate._
+**Max Size** means the max total size of files the client will want to store in that location. Again, it only matters if you are spreading your files across multiple locations, but it is a simple way to ensure you don't go over a particular smaller hard drive's size. One location must always be limitless. This is not precise, so give it some padding. When one location is maxed out, the remaining locations will distribute the remainder of the files according to their respective weights. _For the meantime, this will not update by itself. If you import many files, the location may go over its limit and you will have to revisit 'move media files' to rebalance your files again. Bear with me--I will fix this soon with the background migrate._
Let's set up an example move:
diff --git a/docs/old_changelog.html b/docs/old_changelog.html
index 0f3c543a2..d66ca89b1 100644
--- a/docs/old_changelog.html
+++ b/docs/old_changelog.html
@@ -34,6 +34,36 @@
+ -
+
+
+ misc
+ - page tab drag and drops will now not start unless the click has lasted more than 100ms
+ - same for thumbnail drag and drop--it perviously did a 20 pixel deadzone, but time checks detect accidental/spastic clicks better and stops false negatives when you start dragging on certain edges
+ - added a 'BUGFIX: disable page tab drag and drop' setting to _options->gui pages_. while adding this, I may have accidentally fixed the issue I wanted to investigate (rare hangs on page DnD)
+ - the manage tags dialog now shows the current count of tags for each page tab, and, if there are outstanding changes, shows an asterisk
+ - the `migrate database` dialog is renamed `move media files`
+ fixes
+ - fixed the basic copy/paste in the single 'edit datetime' panel, wich was often raising a dumb error. this thing also now exports millisecond data (issue #1520)
+ - I am pretty sure I fixed the column-resizing problem in the very new PySide6 (Qt) 6.6.1, which it seems AUR users were recently updated to in an automatic OS update. all columns were setting to 100px width on initialisation. I think it is now safe to try out 6.6.1. I am still not sure why it was doing this, but some extra safeguards seem to have fixed it and also not broken things for <=6.6.0, so let me know what you run into! if you were affected by this, recall that you can right-click on any multi-column list header and say 'reset widths' to get something sensible back here
+ - when exporting files, the max size is now clipped another 84 characters (64 + 20 more, which usually ends up about 150 characters max for the output filename), in order to give padding for longer sidecar suffixes and also avoid going right to the filesystem limit, which broadly isn't sensible
+ - I think I fixed an issue where the mouse could stay hidden, perhaps, just on Wayland, after closing the media viewer with your keyboard (issue #1518)
+ - fixed inc/dec ratings in the media viewer not updating their tooltips on new media correctly
+ - if you hit 'open this location' on the export files window and the location does not exist, you now get a nice messagebox rather than a semi-silent error
+ analyze
+ - background: some databases that process the PTR superfast or otherwise import a lot of data to a new file domain sometimes encounter massively massively slow tag update actions (typically tag-delete when the tags involved have siblings/parents), so I want to make the critical 'ANALYZE' call more timely
+ - the 'analyze' database maintenance call will be soft-called far more regularly during normal repository processing, not just on first sync
+ - sped up how some pre-analyze calculation is done
+ - the size limit for automatic database analyze maintenance is raised from 100k rows to 10M
+ - I hope to do more work here in future, probably making a review panel like we did for vacuum
+ - if your repository processing sometimes hangs your whole damn client for 10-15 minutes, hit _database->db maintenance->analyze->full_! this job may take 30-60 minutes to finish
+ boring code cleanup
+ - finished the HG->CG.client_controller refactor I started last week. this was a thousand lines changed from one braindead format to another, but it will be a useful step towards untangling the hell-nest import hierarchy
+ - did a scattering of the clientinterface typing, getting a feel for where I want to take this
+ - deleted the old in-client server-test's 'boot' variant; this is no longer used and was always super hacky to maintain
+ - I removed an old basic error raising routine that would sometimes kick in when a hash definition is missing. this routine now always fills in the missing data with garbage and does its best to recover the invalid situation automatically, with decent logging, while still informing the user that things are well busted m8. it isn't the user's job to fix this, and there is no good fix anyway, so no point halting work and giving it to the user to figure out!
+
+
-
diff --git a/hydrus/client/ClientAPI.py b/hydrus/client/ClientAPI.py
index b96d7e556..a3477c8c6 100644
--- a/hydrus/client/ClientAPI.py
+++ b/hydrus/client/ClientAPI.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusTags
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.search import ClientSearch
CLIENT_API_PERMISSION_ADD_URLS = 0
@@ -78,7 +79,7 @@ def __init__( self ):
self._lock = threading.Lock()
- HG.client_controller.sub( self, 'MaintainMemory', 'memory_maintenance_pulse' )
+ CG.client_controller.sub( self, 'MaintainMemory', 'memory_maintenance_pulse' )
def _GetSerialisableInfo( self ):
diff --git a/hydrus/client/ClientApplicationCommand.py b/hydrus/client/ClientApplicationCommand.py
index ba1e5b362..57efad3c0 100644
--- a/hydrus/client/ClientApplicationCommand.py
+++ b/hydrus/client/ClientApplicationCommand.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
SIMPLE_ARCHIVE_DELETE_FILTER_BACK = 0
SIMPLE_ARCHIVE_DELETE_FILTER_DELETE = 1
@@ -798,11 +799,11 @@ def ToString( self ):
value_string = 'uncertain rating, "{}"'.format( value )
- if HG.client_controller is not None and HG.client_controller.IsBooted():
+ if CG.client_controller is not None and CG.client_controller.IsBooted():
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
value_string = service.ConvertNoneableRatingToString( value )
@@ -821,7 +822,7 @@ def ToString( self ):
try:
- from_name = HG.client_controller.services_manager.GetName( value )
+ from_name = CG.client_controller.services_manager.GetName( value )
value_string = '(from {})'.format( from_name )
@@ -849,7 +850,7 @@ def ToString( self ):
components.append( 'for' )
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
if services_manager.ServiceExists( service_key ):
diff --git a/hydrus/client/ClientController.py b/hydrus/client/ClientController.py
index 640915951..2e2414a5b 100644
--- a/hydrus/client/ClientController.py
+++ b/hydrus/client/ClientController.py
@@ -175,7 +175,6 @@ def __init__( self, db_dir ):
self._name = 'client'
- HG.client_controller = self
CG.client_controller = self
# just to set up some defaults, in case some db update expects something for an odd yaml-loading reason
diff --git a/hydrus/client/ClientDBMaintenanceManager.py b/hydrus/client/ClientDBMaintenanceManager.py
index 349100932..3d17e7554 100644
--- a/hydrus/client/ClientDBMaintenanceManager.py
+++ b/hydrus/client/ClientDBMaintenanceManager.py
@@ -8,9 +8,12 @@
from hydrus.core import HydrusThreading
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
+from hydrus.client.interfaces import ClientControllerInterface
+
class DatabaseMaintenanceManager( object ):
- def __init__( self, controller ):
+ def __init__( self, controller: ClientControllerInterface.ClientControllerInterface ):
self._controller = controller
@@ -34,7 +37,7 @@ def _AbleToDoBackgroundMaintenance( self ):
return True
- if HG.client_controller.CurrentlyIdle():
+ if CG.client_controller.CurrentlyIdle():
if not self._controller.new_options.GetBoolean( 'database_deferred_delete_maintenance_during_idle' ):
@@ -66,15 +69,15 @@ def _GetWaitPeriod( self, work_period: float, time_it_took: float, still_work_to
if self._is_working_hard:
- rest_ratio = HG.client_controller.new_options.GetInteger( 'deferred_table_delete_rest_percentage_work_hard' ) / 100
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'deferred_table_delete_rest_percentage_work_hard' ) / 100
- elif HG.client_controller.CurrentlyIdle():
+ elif CG.client_controller.CurrentlyIdle():
- rest_ratio = HG.client_controller.new_options.GetInteger( 'deferred_table_delete_rest_percentage_idle' ) / 100
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'deferred_table_delete_rest_percentage_idle' ) / 100
else:
- rest_ratio = HG.client_controller.new_options.GetInteger( 'deferred_table_delete_rest_percentage_normal' ) / 100
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'deferred_table_delete_rest_percentage_normal' ) / 100
reasonable_work_time = min( 5 * work_period, time_it_took )
@@ -86,15 +89,15 @@ def _GetWorkPeriod( self ):
if self._is_working_hard:
- return HG.client_controller.new_options.GetInteger( 'deferred_table_delete_work_time_ms_work_hard' ) / 1000
+ return CG.client_controller.new_options.GetInteger( 'deferred_table_delete_work_time_ms_work_hard' ) / 1000
- elif HG.client_controller.CurrentlyIdle():
+ elif CG.client_controller.CurrentlyIdle():
- return HG.client_controller.new_options.GetInteger( 'deferred_table_delete_work_time_ms_idle' ) / 1000
+ return CG.client_controller.new_options.GetInteger( 'deferred_table_delete_work_time_ms_idle' ) / 1000
else:
- return HG.client_controller.new_options.GetInteger( 'deferred_table_delete_work_time_ms_normal' ) / 1000
+ return CG.client_controller.new_options.GetInteger( 'deferred_table_delete_work_time_ms_normal' ) / 1000
@@ -143,7 +146,7 @@ def check_shutdown():
try:
- still_work_to_do = HG.client_controller.WriteSynchronous( 'do_deferred_table_delete_work', time_to_stop )
+ still_work_to_do = CG.client_controller.WriteSynchronous( 'do_deferred_table_delete_work', time_to_stop )
except Exception as e:
diff --git a/hydrus/client/ClientDaemons.py b/hydrus/client/ClientDaemons.py
index f386d281e..209366f98 100644
--- a/hydrus/client/ClientDaemons.py
+++ b/hydrus/client/ClientDaemons.py
@@ -9,10 +9,11 @@
from hydrus.client.metadata import ClientContentUpdates
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
def DAEMONCheckExportFolders():
- controller = HG.client_controller
+ controller = CG.client_controller
if not controller.new_options.GetBoolean( 'pause_export_folders_sync' ):
@@ -42,7 +43,7 @@ def DAEMONCheckExportFolders():
def DAEMONCheckImportFolders():
- controller = HG.client_controller
+ controller = CG.client_controller
if not controller.new_options.GetBoolean( 'pause_import_folders_sync' ):
@@ -75,7 +76,7 @@ def DAEMONMaintainTrash():
# TODO: Looking at it, this whole thing is whack
# rewrite it to be a database command that returns 'more work to do' and then just spam it until done
- controller = HG.client_controller
+ controller = CG.client_controller
if HC.options[ 'trash_max_size' ] is not None:
diff --git a/hydrus/client/ClientData.py b/hydrus/client/ClientData.py
index 0086f3076..e08d44452 100644
--- a/hydrus/client/ClientData.py
+++ b/hydrus/client/ClientData.py
@@ -10,6 +10,7 @@
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client.metadata import ClientContentUpdates
@@ -61,7 +62,7 @@ def CatchExceptionClient( etype, value, tb ):
HydrusData.DebugPrint( text )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
except:
@@ -194,7 +195,7 @@ def ShowExceptionTupleClient( etype, value, tb, do_wait = True ):
HydrusData.DebugPrint( text )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
if do_wait:
@@ -211,12 +212,12 @@ def ShowTextClient( text ):
HydrusData.Print( text )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
def ToHumanBytes( size ):
- sig_figs = HG.client_controller.new_options.GetInteger( 'human_bytes_sig_figs' )
+ sig_figs = CG.client_controller.new_options.GetInteger( 'human_bytes_sig_figs' )
return HydrusData.BaseToHumanBytes( size, sig_figs = sig_figs )
diff --git a/hydrus/client/ClientDuplicates.py b/hydrus/client/ClientDuplicates.py
index b11048453..d1d20b309 100644
--- a/hydrus/client/ClientDuplicates.py
+++ b/hydrus/client/ClientDuplicates.py
@@ -14,6 +14,7 @@
from hydrus.core.files.images import HydrusImageOpening
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client import ClientTime
from hydrus.client.importing.options import NoteImportOptions
@@ -41,7 +42,7 @@ def GetDuplicateComparisonScore( shown_media, comparison_media ):
def GetDuplicateComparisonStatements( shown_media, comparison_media ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
duplicate_comparison_score_higher_jpeg_quality = new_options.GetInteger( 'duplicate_comparison_score_higher_jpeg_quality' )
duplicate_comparison_score_much_higher_jpeg_quality = new_options.GetInteger( 'duplicate_comparison_score_much_higher_jpeg_quality' )
@@ -424,7 +425,7 @@ def GetDuplicateComparisonStatements( shown_media, comparison_media ):
if s_hash not in hashes_to_jpeg_quality:
- path = HG.client_controller.client_files_manager.GetFilePath( s_hash, s_mime )
+ path = CG.client_controller.client_files_manager.GetFilePath( s_hash, s_mime )
try:
@@ -442,7 +443,7 @@ def GetDuplicateComparisonStatements( shown_media, comparison_media ):
if c_hash not in hashes_to_jpeg_quality:
- path = HG.client_controller.client_files_manager.GetFilePath( c_hash, c_mime )
+ path = CG.client_controller.client_files_manager.GetFilePath( c_hash, c_mime )
try:
@@ -606,9 +607,9 @@ def GetMaintenanceNumbers( self ):
self._refresh_maintenance_numbers = False
self._currently_refreshing_maintenance_numbers = True
- HG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
+ CG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
- HG.client_controller.CallToThread( self.THREADRefreshMaintenanceNumbers )
+ CG.client_controller.CallToThread( self.THREADRefreshMaintenanceNumbers )
return ( self._similar_files_maintenance_status, self._currently_refreshing_maintenance_numbers, self._currently_doing_potentials_search )
@@ -621,13 +622,13 @@ def RefreshMaintenanceNumbers( self ):
self._refresh_maintenance_numbers = True
- HG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
+ CG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
def NotifyNewPotentialsSearchNumbers( self ):
- HG.client_controller.pub( 'new_similar_files_potentials_search_numbers' )
+ CG.client_controller.pub( 'new_similar_files_potentials_search_numbers' )
def StartPotentialsSearch( self ):
@@ -641,7 +642,7 @@ def StartPotentialsSearch( self ):
self._currently_doing_potentials_search = True
- HG.client_controller.CallToThreadLongRunning( self.THREADSearchPotentials )
+ CG.client_controller.CallToThreadLongRunning( self.THREADSearchPotentials )
@@ -649,7 +650,7 @@ def THREADRefreshMaintenanceNumbers( self ):
try:
- similar_files_maintenance_status = HG.client_controller.Read( 'similar_files_maintenance_status' )
+ similar_files_maintenance_status = CG.client_controller.Read( 'similar_files_maintenance_status' )
with self._lock:
@@ -659,7 +660,7 @@ def THREADRefreshMaintenanceNumbers( self ):
self._refresh_maintenance_numbers = False
- HG.client_controller.CallToThread( self.THREADRefreshMaintenanceNumbers )
+ CG.client_controller.CallToThread( self.THREADRefreshMaintenanceNumbers )
else:
@@ -667,13 +668,13 @@ def THREADRefreshMaintenanceNumbers( self ):
self._refresh_maintenance_numbers = False
- HG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
+ CG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
except:
self._currently_refreshing_maintenance_numbers = False
- HG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
+ CG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
raise
@@ -683,7 +684,7 @@ def THREADSearchPotentials( self ):
try:
- search_distance = HG.client_controller.new_options.GetInteger( 'similar_files_duplicate_pairs_search_distance' )
+ search_distance = CG.client_controller.new_options.GetInteger( 'similar_files_duplicate_pairs_search_distance' )
with self._lock:
@@ -708,27 +709,27 @@ def THREADSearchPotentials( self ):
num_searched_estimate = num_searched
- HG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
+ CG.client_controller.pub( 'new_similar_files_maintenance_numbers' )
job_status = ClientThreading.JobStatus( cancellable = True )
job_status.SetStatusTitle( 'searching for potential duplicates' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
still_work_to_do = True
while still_work_to_do:
- search_distance = HG.client_controller.new_options.GetInteger( 'similar_files_duplicate_pairs_search_distance' )
+ search_distance = CG.client_controller.new_options.GetInteger( 'similar_files_duplicate_pairs_search_distance' )
start_time = HydrusTime.GetNowPrecise()
- work_time_ms = HG.client_controller.new_options.GetInteger( 'potential_duplicates_search_work_time_ms' )
+ work_time_ms = CG.client_controller.new_options.GetInteger( 'potential_duplicates_search_work_time_ms' )
work_time = work_time_ms / 1000
- ( still_work_to_do, num_done ) = HG.client_controller.WriteSynchronous( 'maintain_similar_files_search_for_potential_duplicates', search_distance, maintenance_mode = HC.MAINTENANCE_FORCED, job_status = job_status, work_time_float = work_time )
+ ( still_work_to_do, num_done ) = CG.client_controller.WriteSynchronous( 'maintain_similar_files_search_for_potential_duplicates', search_distance, maintenance_mode = HC.MAINTENANCE_FORCED, job_status = job_status, work_time_float = work_time )
time_it_took = HydrusTime.GetNowPrecise() - start_time
@@ -736,7 +737,7 @@ def THREADSearchPotentials( self ):
if num_searched_estimate > total_num_files:
- similar_files_maintenance_status = HG.client_controller.Read( 'similar_files_maintenance_status' )
+ similar_files_maintenance_status = CG.client_controller.Read( 'similar_files_maintenance_status' )
if similar_files_maintenance_status is None:
@@ -762,7 +763,7 @@ def THREADSearchPotentials( self ):
break
- rest_ratio = HG.client_controller.new_options.GetInteger( 'potential_duplicates_search_rest_percentage' ) / 100
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'potential_duplicates_search_rest_percentage' ) / 100
reasonable_work_time = min( 5 * work_time, time_it_took )
@@ -848,9 +849,9 @@ def __init__( self ):
def _GetSerialisableInfo( self ):
- if HG.client_controller.IsBooted():
+ if CG.client_controller.IsBooted():
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
self._tag_service_actions = [ ( service_key, action, tag_filter ) for ( service_key, action, tag_filter ) in self._tag_service_actions if services_manager.ServiceExists( service_key ) and services_manager.GetServiceType( service_key ) in HC.REAL_TAG_SERVICES ]
self._rating_service_actions = [ ( service_key, action ) for ( service_key, action ) in self._rating_service_actions if services_manager.ServiceExists( service_key ) and services_manager.GetServiceType( service_key ) in HC.RATINGS_SERVICES ]
@@ -1095,7 +1096,7 @@ def ProcessPairIntoContentUpdatePackage( self, first_media: ClientMedia.MediaSin
#
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
for ( service_key, action, tag_filter ) in self._tag_service_actions:
@@ -1427,7 +1428,7 @@ def worth_updating_rating( source_rating, dest_rating ):
else:
- local_file_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_file_service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
deletee_service_keys = media.GetLocationsManager().GetCurrent().intersection( local_file_service_keys )
diff --git a/hydrus/client/ClientFiles.py b/hydrus/client/ClientFiles.py
index 6e7ac5f06..e5d4455bd 100644
--- a/hydrus/client/ClientFiles.py
+++ b/hydrus/client/ClientFiles.py
@@ -24,6 +24,7 @@
from hydrus.core.networking import HydrusNetworking
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientFilesPhysical
from hydrus.client import ClientImageHandling
from hydrus.client import ClientPaths
@@ -530,7 +531,7 @@ def _AttemptToHealMissingLocations( self ):
self._controller.BlockingSafeShowCriticalMessage( 'About to auto-heal client file folders.', summary_message )
- HG.client_controller.WriteSynchronous( 'repair_client_files', correct_rows )
+ CG.client_controller.WriteSynchronous( 'repair_client_files', correct_rows )
@@ -608,7 +609,7 @@ def _GenerateThumbnailBytes( self, file_path, media ):
bounding_dimensions = self._controller.options[ 'thumbnail_dimensions' ]
thumbnail_scale_type = self._controller.new_options.GetInteger( 'thumbnail_scale_type' )
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
target_resolution = HydrusImageHandling.GetThumbnailResolution( ( width, height ), bounding_dimensions, thumbnail_scale_type, thumbnail_dpr_percent )
@@ -725,7 +726,7 @@ def _GetRebalanceTuple( self ):
( ideal_media_base_locations, ideal_thumbnail_override_base_location ) = self._controller.Read( 'ideal_client_files_locations' )
- service_info = HG.client_controller.Read( 'service_info', CC.COMBINED_LOCAL_FILE_SERVICE_KEY )
+ service_info = CG.client_controller.Read( 'service_info', CC.COMBINED_LOCAL_FILE_SERVICE_KEY )
all_local_files_total_size = service_info[ HC.SERVICE_INFO_TOTAL_SIZE ]
@@ -1049,7 +1050,7 @@ def _Reinit( self ):
self._ReinitSubfolders()
- if HG.client_controller.IsFirstStart():
+ if CG.client_controller.IsFirstStart():
try:
@@ -1183,9 +1184,9 @@ def _ReinitMissingLocations( self ):
def _WaitOnWakeup( self ):
- if HG.client_controller.new_options.GetBoolean( 'file_system_waits_on_wakeup' ):
+ if CG.client_controller.new_options.GetBoolean( 'file_system_waits_on_wakeup' ):
- while HG.client_controller.JustWokeFromSleep():
+ while CG.client_controller.JustWokeFromSleep():
HydrusThreading.CheckIfThreadShuttingDown()
@@ -1297,7 +1298,7 @@ def ClearOrphans( self, move_location = None ):
hash = bytes.fromhex( should_be_a_hex_hash )
- is_an_orphan = HG.client_controller.Read( 'is_an_orphan', 'file', hash )
+ is_an_orphan = CG.client_controller.Read( 'is_an_orphan', 'file', hash )
except:
@@ -1364,7 +1365,7 @@ def ClearOrphans( self, move_location = None ):
hash = bytes.fromhex( should_be_a_hex_hash )
- is_an_orphan = HG.client_controller.Read( 'is_an_orphan', 'thumbnail', hash )
+ is_an_orphan = CG.client_controller.Read( 'is_an_orphan', 'thumbnail', hash )
except:
@@ -1785,7 +1786,7 @@ def RegenerateThumbnailIfWrongSize( self, media ):
bounding_dimensions = self._controller.options[ 'thumbnail_dimensions' ]
thumbnail_scale_type = self._controller.new_options.GetInteger( 'thumbnail_scale_type' )
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
( expected_width, expected_height ) = HydrusImageHandling.GetThumbnailResolution( (media_width, media_height), bounding_dimensions, thumbnail_scale_type, thumbnail_dpr_percent )
@@ -2000,9 +2001,9 @@ def __init__( self, controller ):
def _AbleToDoBackgroundMaintenance( self ):
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
- if HG.client_controller.CurrentlyIdle():
+ if CG.client_controller.CurrentlyIdle():
if not self._controller.new_options.GetBoolean( 'file_maintenance_during_idle' ):
@@ -2162,7 +2163,7 @@ def _CheckFileIntegrity( self, media_result, job_type ):
try:
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( url )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( url )
except HydrusExceptions.URLClassException:
@@ -2236,12 +2237,12 @@ def _CheckFileIntegrity( self, media_result, job_type ):
def qt_add_url( url ):
- HG.client_controller.gui.ImportURL( url, 'missing files redownloader' )
+ CG.client_controller.gui.ImportURL( url, 'missing files redownloader' )
for url in useful_urls:
- HG.client_controller.CallBlockingToQt( HG.client_controller.gui, qt_add_url, url )
+ CG.client_controller.CallBlockingToQt( CG.client_controller.gui, qt_add_url, url )
@@ -2887,7 +2888,7 @@ def _RunJob( self, media_results_to_job_types, job_status, job_done_hook = None
job_status.SetFiles( [ hash ], 'I/O error file' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
self._serious_error_encountered = True
self._shutdown = True
@@ -2908,7 +2909,7 @@ def _RunJob( self, media_results_to_job_types, job_status, job_done_hook = None
job_status.SetFiles( [ hash ], 'failed file' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
finally:
@@ -2969,7 +2970,7 @@ def ForceMaintenance( self, mandated_job_types = None ):
job_status = ClientThreading.JobStatus( cancellable = True )
- job_types_to_counts = HG.client_controller.Read( 'file_maintenance_get_job_counts' )
+ job_types_to_counts = CG.client_controller.Read( 'file_maintenance_get_job_counts' )
# in a dict so the hook has scope to alter it
vr_status = {}
diff --git a/hydrus/client/ClientFilesPhysical.py b/hydrus/client/ClientFilesPhysical.py
index c03abbbb4..07509c5aa 100644
--- a/hydrus/client/ClientFilesPhysical.py
+++ b/hydrus/client/ClientFilesPhysical.py
@@ -193,7 +193,7 @@ def WouldLikeToRemoveSubfolders( self, current_normalised_weight: float, total_i
def STATICGetIdealWeights( current_num_bytes: int, base_locations: typing.List[ "FilesStorageBaseLocation" ] ) -> typing.Dict[ "FilesStorageBaseLocation", float ]:
# This is kind of tacked on logic versus the eager/able/needs/would stuff, but I'm collecting it here so at least the logic, pseudo-doubled, is in one place
- # this is used by the migrate database listctrl atm, but maybe we can merge all this together sometime
+ # this is used by the 'move media files' listctrl atm, but maybe we can merge all this together sometime
result = {}
diff --git a/hydrus/client/ClientGlobals.py b/hydrus/client/ClientGlobals.py
index c5d87199a..fcddc9497 100644
--- a/hydrus/client/ClientGlobals.py
+++ b/hydrus/client/ClientGlobals.py
@@ -2,6 +2,4 @@
from hydrus.client.interfaces import ClientControllerInterface
-# TODO: move all HG.client_controller references here, and the various like 'mpv report mode' stuff
-# make a ServerGlobals too, I think!
client_controller: typing.Optional[ ClientControllerInterface.ClientControllerInterface ] = None
diff --git a/hydrus/client/ClientImageHandling.py b/hydrus/client/ClientImageHandling.py
index b51184313..cb222bcbe 100644
--- a/hydrus/client/ClientImageHandling.py
+++ b/hydrus/client/ClientImageHandling.py
@@ -6,11 +6,13 @@
import cv2
-from hydrus.client import ClientConstants as CC
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
from hydrus.core.files.images import HydrusImageHandling
+from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
+
cv_interpolation_enum_lookup = {}
cv_interpolation_enum_lookup[ CC.ZOOM_NEAREST ] = cv2.INTER_NEAREST
@@ -28,7 +30,7 @@ def DiscardBlankPerceptualHashes( perceptual_hashes ):
def GenerateNumPyImage( path, mime ):
- force_pil = HG.client_controller.new_options.GetBoolean( 'load_images_with_pil' )
+ force_pil = CG.client_controller.new_options.GetBoolean( 'load_images_with_pil' )
return HydrusImageHandling.GenerateNumPyImage( path, mime, force_pil = force_pil )
@@ -237,7 +239,7 @@ def collapse_bools_to_binary_uint( a, b ):
def ResizeNumPyImageForMediaViewer( mime, numpy_image, target_resolution ):
( target_width, target_height ) = target_resolution
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
( scale_up_quality, scale_down_quality ) = new_options.GetMediaZoomQuality( mime )
diff --git a/hydrus/client/ClientLocation.py b/hydrus/client/ClientLocation.py
index a430ba2fa..5e2d13cae 100644
--- a/hydrus/client/ClientLocation.py
+++ b/hydrus/client/ClientLocation.py
@@ -7,10 +7,11 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
def FilterOutRedundantMetaServices( list_of_service_keys: typing.List[ bytes ] ):
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
special_local_file_service_keys = { CC.TRASH_SERVICE_KEY, CC.COMBINED_LOCAL_MEDIA_SERVICE_KEY, CC.LOCAL_UPDATE_SERVICE_KEY }
@@ -37,13 +38,13 @@ def FilterOutRedundantMetaServices( list_of_service_keys: typing.List[ bytes ] )
def GetPossibleFileDomainServicesInOrder( all_known_files_allowed: bool, only_local_file_domains_allowed: bool ):
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
service_types_in_order = [ HC.LOCAL_FILE_DOMAIN ]
if not only_local_file_domains_allowed:
- advanced_mode = HG.client_controller.new_options.GetBoolean( 'advanced_mode' )
+ advanced_mode = CG.client_controller.new_options.GetBoolean( 'advanced_mode' )
if len( services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) ) ) > 1 or advanced_mode:
@@ -91,7 +92,7 @@ def SortFileServiceKeysNicely( list_of_service_keys ):
def ValidLocalDomainsFilter( service_keys ):
- return [ service_key for service_key in service_keys if HG.client_controller.services_manager.ServiceExists( service_key ) and HG.client_controller.services_manager.GetServiceType( service_key ) == HC.LOCAL_FILE_DOMAIN ]
+ return [ service_key for service_key in service_keys if CG.client_controller.services_manager.ServiceExists( service_key ) and CG.client_controller.services_manager.GetServiceType( service_key ) == HC.LOCAL_FILE_DOMAIN ]
class LocationContext( HydrusSerialisable.SerialisableBase ):
diff --git a/hydrus/client/ClientManagers.py b/hydrus/client/ClientManagers.py
index 8605397c4..7bc69f9ae 100644
--- a/hydrus/client/ClientManagers.py
+++ b/hydrus/client/ClientManagers.py
@@ -10,6 +10,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientData
from hydrus.client.media import ClientMedia
from hydrus.client.metadata import ClientContentUpdates
@@ -267,7 +268,7 @@ def __init__( self, controller ):
def _GenerateViewsRow( self, media: ClientMedia.Media, canvas_type: int, view_timestamp_ms: int, viewtime_delta: int ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
viewtime_min = None
viewtime_max = None
@@ -341,8 +342,8 @@ def _PubSubRow( self, hash, canvas_type, row ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_update )
- HG.client_controller.pub( 'content_updates_data', content_update_package )
- HG.client_controller.pub( 'content_updates_gui', content_update_package )
+ CG.client_controller.pub( 'content_updates_data', content_update_package )
+ CG.client_controller.pub( 'content_updates_gui', content_update_package )
def Flush( self ):
@@ -374,7 +375,7 @@ def Flush( self ):
def FinishViewing( self, media: ClientMedia.MediaSingleton, canvas_type, view_timestamp_ms, viewtime_delta ):
- if not HG.client_controller.new_options.GetBoolean( 'file_viewing_statistics_active' ):
+ if not CG.client_controller.new_options.GetBoolean( 'file_viewing_statistics_active' ):
return
diff --git a/hydrus/client/ClientOptions.py b/hydrus/client/ClientOptions.py
index a163076c6..168c7a049 100644
--- a/hydrus/client/ClientOptions.py
+++ b/hydrus/client/ClientOptions.py
@@ -12,6 +12,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDefaults
from hydrus.client import ClientDuplicates
+from hydrus.client import ClientGlobals as CG
from hydrus.client.importing.options import FileImportOptions
class ClientOptions( HydrusSerialisable.SerialisableBase ):
@@ -188,6 +189,7 @@ def _InitialiseDefaults( self ):
self._dictionary[ 'booleans' ][ 'tag_display_maintenance_during_active' ] = True
self._dictionary[ 'booleans' ][ 'save_page_sort_on_change' ] = False
+ self._dictionary[ 'booleans' ][ 'disable_page_tab_dnd' ] = False
self._dictionary[ 'booleans' ][ 'force_hide_page_signal_on_new_page' ] = False
self._dictionary[ 'booleans' ][ 'pause_export_folders_sync' ] = False
@@ -1213,7 +1215,7 @@ def GetDefaultLocalLocationContext( self ):
try:
- location_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ location_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
if location_context.IsEmpty():
diff --git a/hydrus/client/ClientParsing.py b/hydrus/client/ClientParsing.py
index 0a02c4fea..e82e1eab5 100644
--- a/hydrus/client/ClientParsing.py
+++ b/hydrus/client/ClientParsing.py
@@ -17,6 +17,7 @@
from hydrus.core import HydrusText
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientStrings
from hydrus.client.networking import ClientNetworkingFunctions
from hydrus.client.networking import ClientNetworkingJobs
@@ -1238,7 +1239,7 @@ def _ParseRawTexts( self, parsing_context, parsing_text, collapse_newlines: bool
try:
- root = HG.client_controller.parsing_cache.GetSoup( parsing_text )
+ root = CG.client_controller.parsing_cache.GetSoup( parsing_text )
except Exception as e:
@@ -1901,7 +1902,7 @@ def _ParseRawTexts( self, parsing_context, parsing_text, collapse_newlines: bool
try:
- j = HG.client_controller.parsing_cache.GetJSON( parsing_text )
+ j = CG.client_controller.parsing_cache.GetJSON( parsing_text )
except Exception as e:
@@ -2903,7 +2904,7 @@ def Parse( self, job_status, parsing_text, referral_url ):
network_job.OverrideBandwidth()
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
try:
@@ -3097,7 +3098,7 @@ def ConvertMediaToFileIdentifier( self, media ):
try:
- source_to_desired = HG.client_controller.Read( 'file_hashes', ( sha256_hash, ), 'sha256', hash_type )
+ source_to_desired = CG.client_controller.Read( 'file_hashes', ( sha256_hash, ), 'sha256', hash_type )
other_hash = list( source_to_desired.values() )[0]
@@ -3113,7 +3114,7 @@ def ConvertMediaToFileIdentifier( self, media ):
hash = media.GetHash()
mime = media.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
try:
@@ -3213,7 +3214,7 @@ def FetchParsingText( self, job_status, file_identifier ):
network_job.OverrideBandwidth()
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
try:
diff --git a/hydrus/client/ClientPaths.py b/hydrus/client/ClientPaths.py
index d52e8ede9..8545eadca 100644
--- a/hydrus/client/ClientPaths.py
+++ b/hydrus/client/ClientPaths.py
@@ -1,10 +1,10 @@
import webbrowser
-import os
from hydrus.core import HydrusConstants as HC
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusPaths
+from hydrus.client import ClientGlobals as CG
+
def DeletePath( path, always_delete_fully = False ):
delete_to_recycle_bin = HC.options[ 'delete_to_recycle_bin' ]
@@ -26,7 +26,7 @@ def LaunchPathInWebBrowser( path ):
def LaunchURLInWebBrowser( url ):
- web_browser_path = HG.client_controller.new_options.GetNoneableString( 'web_browser_path' )
+ web_browser_path = CG.client_controller.new_options.GetNoneableString( 'web_browser_path' )
if web_browser_path is None:
diff --git a/hydrus/client/ClientRendering.py b/hydrus/client/ClientRendering.py
index 2c780e16e..4b408b34c 100644
--- a/hydrus/client/ClientRendering.py
+++ b/hydrus/client/ClientRendering.py
@@ -18,6 +18,7 @@
from hydrus.core.files.images import HydrusImageHandling
from hydrus.client import ClientFiles
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientImageHandling
from hydrus.client import ClientVideoHandling
from hydrus.client.caches import ClientCachesBase
@@ -107,7 +108,7 @@ def __init__( self, media, this_is_for_metadata_alone = False ):
self._this_is_for_metadata_alone = this_is_for_metadata_alone
- HG.client_controller.CallToThread( self._Initialise )
+ CG.client_controller.CallToThread( self._Initialise )
def GetNumPyImage(self):
@@ -240,7 +241,7 @@ def _GetNumPyImage( self, clip_rect: QC.QRect, target_resolution: QC.QSize ):
def _Initialise( self ):
# do this here so we are off the main thread and can wait
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
self._path = client_files_manager.GetFilePath( self._hash, self._mime )
@@ -277,8 +278,8 @@ def _Initialise( self ):
HydrusData.ShowText( m )
- HG.client_controller.Write( 'file_maintenance_add_jobs_hashes', { self._hash }, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_DATA_TRY_URL_ELSE_REMOVE_RECORD )
- HG.client_controller.Write( 'file_maintenance_add_jobs_hashes', { self._hash }, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_METADATA )
+ CG.client_controller.Write( 'file_maintenance_add_jobs_hashes', { self._hash }, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_DATA_TRY_URL_ELSE_REMOVE_RECORD )
+ CG.client_controller.Write( 'file_maintenance_add_jobs_hashes', { self._hash }, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_METADATA )
'''
if not self._render_failed:
@@ -299,7 +300,7 @@ def _Initialise( self ):
HydrusData.ShowText( m )
- HG.client_controller.Write( 'file_maintenance_add_jobs_hashes', { self._hash }, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_METADATA )
+ CG.client_controller.Write( 'file_maintenance_add_jobs_hashes', { self._hash }, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_METADATA )
@@ -387,7 +388,7 @@ def GetQtImage( self, clip_rect: typing.Optional[ QC.QRect ] = None, target_reso
data = numpy_image.data
- qt_image = HG.client_controller.bitmap_manager.GetQtImageFromBuffer( width, height, depth * 8, data )
+ qt_image = CG.client_controller.bitmap_manager.GetQtImageFromBuffer( width, height, depth * 8, data )
# ok this stuff was originally for image ICC, as loaded using PIL's image.info dict
# ultimately I figured out how to do the conversion with PIL itself, which was more universal
@@ -453,7 +454,7 @@ def GetQtPixmap( self, clip_rect = None, target_resolution = None ):
data = numpy_image.data
- return HG.client_controller.bitmap_manager.GetQtPixmapFromBuffer( width, height, depth * 8, data )
+ return CG.client_controller.bitmap_manager.GetQtPixmapFromBuffer( width, height, depth * 8, data )
except Exception as e:
@@ -529,7 +530,7 @@ def __init__( self, media, target_resolution = None ):
hash = self._media.GetHash()
mime = self._media.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
self._path = client_files_manager.GetFilePath( hash, mime )
@@ -570,7 +571,7 @@ def __init__( self, media, target_resolution = None, init_position = 0 ):
( x, y ) = self._target_resolution
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
video_buffer_size = new_options.GetInteger( 'video_buffer_size' )
@@ -622,7 +623,7 @@ def __init__( self, media, target_resolution = None, init_position = 0 ):
self._rendered_first_frame = False
self._ideal_next_frame = 0
- HG.client_controller.CallToThread( self.THREADRender )
+ CG.client_controller.CallToThread( self.THREADRender )
def _HasFrame( self, index ):
@@ -1108,14 +1109,14 @@ def GetQtImage( self ) -> QG.QImage:
( width, height ) = self._size
- return HG.client_controller.bitmap_manager.GetQtImageFromBuffer( width, height, self._depth * 8, self._GetData() )
+ return CG.client_controller.bitmap_manager.GetQtImageFromBuffer( width, height, self._depth * 8, self._GetData() )
def GetQtPixmap( self ) -> QG.QPixmap:
( width, height ) = self._size
- return HG.client_controller.bitmap_manager.GetQtPixmapFromBuffer( width, height, self._depth * 8, self._GetData() )
+ return CG.client_controller.bitmap_manager.GetQtPixmapFromBuffer( width, height, self._depth * 8, self._GetData() )
def GetEstimatedMemoryFootprint( self ):
diff --git a/hydrus/client/ClientSerialisable.py b/hydrus/client/ClientSerialisable.py
index a4a6c4a85..31cc4b885 100644
--- a/hydrus/client/ClientSerialisable.py
+++ b/hydrus/client/ClientSerialisable.py
@@ -17,6 +17,7 @@
from hydrus.core.files.images import HydrusImageHandling
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIFunctions
# ok, the serialised png format is:
@@ -39,7 +40,7 @@
def CreateTopImage( width, title, payload_description, text ):
- text_extent_qt_image = HG.client_controller.bitmap_manager.GetQtImage( 20, 20, 24 )
+ text_extent_qt_image = CG.client_controller.bitmap_manager.GetQtImage( 20, 20, 24 )
painter = QG.QPainter( text_extent_qt_image )
@@ -92,7 +93,7 @@ def CreateTopImage( width, title, payload_description, text ):
#
- top_qt_image = HG.client_controller.bitmap_manager.GetQtImage( width, top_height, 24 )
+ top_qt_image = CG.client_controller.bitmap_manager.GetQtImage( width, top_height, 24 )
painter = QG.QPainter( top_qt_image )
diff --git a/hydrus/client/ClientServices.py b/hydrus/client/ClientServices.py
index 701dee7ad..183fda509 100644
--- a/hydrus/client/ClientServices.py
+++ b/hydrus/client/ClientServices.py
@@ -23,6 +23,7 @@
from hydrus.core.networking import HydrusNetworking
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientFiles
from hydrus.client import ClientThreading
from hydrus.client import ClientTime
@@ -240,7 +241,7 @@ def _SetDirty( self ):
self._dirty = True
- HG.client_controller.pub( 'service_updated', self )
+ CG.client_controller.pub( 'service_updated', self )
def CheckFunctional( self ) -> bool:
@@ -920,7 +921,7 @@ def _CheckCanCommunicateExternally( self, including_bandwidth = True ):
example_nj = ClientNetworkingJobs.NetworkJobHydrus( self._service_key, 'GET', self._GetBaseURL() )
- can_start = HG.client_controller.network_engine.bandwidth_manager.CanDoWork( example_nj.GetNetworkContexts(), threshold = 60 )
+ can_start = CG.client_controller.network_engine.bandwidth_manager.CanDoWork( example_nj.GetNetworkContexts(), threshold = 60 )
if not can_start:
@@ -966,7 +967,7 @@ def GetBandwidthCurrentMonthSummary( self ):
with self._lock:
- return HG.client_controller.network_engine.bandwidth_manager.GetCurrentMonthSummary( self.network_context )
+ return CG.client_controller.network_engine.bandwidth_manager.GetCurrentMonthSummary( self.network_context )
@@ -974,7 +975,7 @@ def GetBandwidthStringsAndGaugeTuples( self ):
with self._lock:
- return HG.client_controller.network_engine.bandwidth_manager.GetBandwidthStringsAndGaugeTuples( self.network_context )
+ return CG.client_controller.network_engine.bandwidth_manager.GetBandwidthStringsAndGaugeTuples( self.network_context )
@@ -1017,15 +1018,15 @@ def _DealWithAccountError( self ):
self._account = HydrusNetwork.Account.GenerateUnknownAccount( account_key )
- HG.client_controller.pub( 'notify_account_sync_due' )
+ CG.client_controller.pub( 'notify_account_sync_due' )
self._next_account_sync = HydrusTime.GetNow()
- HG.client_controller.network_engine.session_manager.ClearSession( self.network_context )
+ CG.client_controller.network_engine.session_manager.ClearSession( self.network_context )
self._SetDirty()
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
def _DealWithFundamentalNetworkError( self ):
@@ -1038,7 +1039,7 @@ def _DealWithFundamentalNetworkError( self ):
self._SetDirty()
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
def _GetErrorWaitPeriod( self ):
@@ -1102,7 +1103,7 @@ def _CredentialsAreChanging( self ):
self._SetDirty()
- HG.client_controller.pub( 'notify_account_sync_due' )
+ CG.client_controller.pub( 'notify_account_sync_due' )
def _GetSerialisableDictionary( self ):
@@ -1268,11 +1269,11 @@ def PausePlayNetworkSync( self ):
paused = self._network_sync_paused
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
if not paused:
- HG.client_controller.pub( 'notify_new_permissions' )
+ CG.client_controller.pub( 'notify_new_permissions' )
@@ -1356,7 +1357,7 @@ def Request( self, method, command, request_args = None, request_headers = None,
network_job.AddAdditionalHeader( 'Content-Type', HC.mime_mimetype_string_lookup[ content_type ] )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -1398,7 +1399,7 @@ def Request( self, method, command, request_args = None, request_headers = None,
elif isinstance( e, HydrusExceptions.SessionException ):
- HG.client_controller.network_engine.session_manager.ClearSession( self.network_context )
+ CG.client_controller.network_engine.session_manager.ClearSession( self.network_context )
elif isinstance( e, ( HydrusExceptions.MissingCredentialsException, HydrusExceptions.InsufficientCredentialsException, HydrusExceptions.ConflictException ) ):
@@ -1431,7 +1432,7 @@ def SetAccountRefreshDueNow( self ):
self._SetDirty()
- HG.client_controller.pub( 'notify_account_sync_due' )
+ CG.client_controller.pub( 'notify_account_sync_due' )
def SetClean( self ):
@@ -1527,7 +1528,7 @@ def SyncAccount( self, force = False ):
tag_filter = tag_filter_response[ 'tag_filter' ]
- if 'tag_filter' in self._service_options and HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if 'tag_filter' in self._service_options and CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
old_tag_filter = self._service_options[ 'tag_filter' ]
@@ -1592,8 +1593,8 @@ def SyncAccount( self, force = False ):
self._SetDirty()
- HG.client_controller.pub( 'notify_new_permissions' )
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'notify_new_permissions' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
@@ -1626,12 +1627,12 @@ def _CanSyncDownload( self ):
def _CanSyncProcess( self ):
- return not ( self._update_processing_paused or HG.client_controller.new_options.GetBoolean( 'pause_repo_sync' ) )
+ return not ( self._update_processing_paused or CG.client_controller.new_options.GetBoolean( 'pause_repo_sync' ) )
def _CheckFunctional( self, including_external_communication = True, including_bandwidth = True, including_account = True ):
- if HG.client_controller.new_options.GetBoolean( 'pause_repo_sync' ):
+ if CG.client_controller.new_options.GetBoolean( 'pause_repo_sync' ):
raise HydrusExceptions.ConflictException( 'All repositories are paused!' )
@@ -1738,12 +1739,12 @@ def _ReportOngoingRowSpeed( self, job_status, rows_done, total_rows, precise_tim
popup_message = '{} {}: processing at {} rows/s'.format( row_name, HydrusData.ConvertValueRangeToPrettyString( rows_done, total_rows ), rows_s )
- HG.client_controller.frame_splash_status.SetText( popup_message, print_to_log = False )
+ CG.client_controller.frame_splash_status.SetText( popup_message, print_to_log = False )
job_status.SetStatusText( popup_message, 2 )
if HG.profile_mode:
- HG.client_controller.PrintProfile( popup_message )
+ CG.client_controller.PrintProfile( popup_message )
@@ -1801,11 +1802,11 @@ def _SyncDownloadMetadata( self ):
if do_a_full_metadata_resync:
- HG.client_controller.WriteSynchronous( 'set_repository_update_hashes', service_key, metadata_slice )
+ CG.client_controller.WriteSynchronous( 'set_repository_update_hashes', service_key, metadata_slice )
else:
- HG.client_controller.WriteSynchronous( 'associate_repository_update_hashes', service_key, metadata_slice )
+ CG.client_controller.WriteSynchronous( 'associate_repository_update_hashes', service_key, metadata_slice )
with self._lock:
@@ -1839,7 +1840,7 @@ def _SyncDownloadUpdates( self, stop_time ):
service_key = self._service_key
- update_hashes = HG.client_controller.Read( 'missing_repository_update_hashes', service_key )
+ update_hashes = CG.client_controller.Read( 'missing_repository_update_hashes', service_key )
if len( update_hashes ) > 0:
@@ -1849,13 +1850,13 @@ def _SyncDownloadUpdates( self, stop_time ):
job_status.SetStatusTitle( name + ' sync: downloading updates' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
for ( i, update_hash ) in enumerate( update_hashes ):
status = 'update ' + HydrusData.ConvertValueRangeToPrettyString( i + 1, len( update_hashes ) )
- HG.client_controller.frame_splash_status.SetText( status, print_to_log = False )
+ CG.client_controller.frame_splash_status.SetText( status, print_to_log = False )
job_status.SetStatusText( status )
job_status.SetVariable( 'popup_gauge_1', ( i + 1, len( update_hashes ) ) )
@@ -1963,7 +1964,7 @@ def _SyncDownloadUpdates( self, stop_time ):
try:
- HG.client_controller.WriteSynchronous( 'import_update', update_network_string, update_hash, mime )
+ CG.client_controller.WriteSynchronous( 'import_update', update_network_string, update_hash, mime )
except Exception as e:
@@ -2002,7 +2003,7 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
- if HG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time ):
+ if CG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time ):
return
@@ -2019,7 +2020,7 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
content_types_to_process = self._GetContentTypesWeAreProcessing()
- ( this_is_first_definitions_work, definition_hashes_and_content_types, this_is_first_content_work, content_hashes_and_content_types ) = HG.client_controller.Read( 'repository_update_hashes_to_process', self._service_key, content_types_to_process )
+ ( this_is_first_definitions_work, definition_hashes_and_content_types, this_is_first_content_work, content_hashes_and_content_types ) = CG.client_controller.Read( 'repository_update_hashes_to_process', self._service_key, content_types_to_process )
if len( definition_hashes_and_content_types ) == 0 and len( content_hashes_and_content_types ) == 0:
@@ -2036,8 +2037,8 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
num_updates_done = 0
num_updates_to_do = len( definition_hashes_and_content_types ) + len( content_hashes_and_content_types )
- HG.client_controller.pub( 'message', job_status )
- HG.client_controller.frame_splash_status.SetTitleText( title, print_to_log = False )
+ CG.client_controller.pub( 'message', job_status )
+ CG.client_controller.frame_splash_status.SetTitleText( title, print_to_log = False )
total_definition_rows_completed = 0
total_content_rows_completed = 0
@@ -2055,7 +2056,7 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
splash_title = '{} sync: processing updates {}'.format( self._name, progress_string )
- HG.client_controller.frame_splash_status.SetTitleText( splash_title, clear_undertexts = False, print_to_log = False )
+ CG.client_controller.frame_splash_status.SetTitleText( splash_title, clear_undertexts = False, print_to_log = False )
status = 'processing {}'.format( progress_string )
@@ -2064,11 +2065,11 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
try:
- update_path = HG.client_controller.client_files_manager.GetFilePath( definition_hash, HC.APPLICATION_HYDRUS_UPDATE_DEFINITIONS )
+ update_path = CG.client_controller.client_files_manager.GetFilePath( definition_hash, HC.APPLICATION_HYDRUS_UPDATE_DEFINITIONS )
except HydrusExceptions.FileMissingException:
- HG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_PRESENCE_REMOVE_RECORD )
+ CG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_PRESENCE_REMOVE_RECORD )
raise Exception( 'An unusual error has occured during repository processing: a definition update file ({}) was missing. Your repository should be paused, and all update files have been scheduled for a presence check. I recommend you run _database->maintenance->clear/fix orphan file records_ too. Please then permit file maintenance under _database->file maintenance->manage scheduled jobs_ to finish its new work, which should fix this, before unpausing your repository.'.format( definition_hash.hex() ) )
@@ -2084,14 +2085,14 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
except:
- HG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_DATA_REMOVE_RECORD )
+ CG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_DATA_REMOVE_RECORD )
raise Exception( 'An unusual error has occured during repository processing: a definition update file ({}) was invalid. Your repository should be paused, and all update files have been scheduled for an integrity check. Please permit file maintenance under _database->file maintenance->manage scheduled jobs_ to finish its new work, which should fix this, before unpausing your repository.'.format( definition_hash.hex() ) )
if not isinstance( definition_update, HydrusNetwork.DefinitionsUpdate ):
- HG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_METADATA )
+ CG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_METADATA )
raise Exception( 'An unusual error has occured during repository processing: a definition update file ({}) has incorrect metadata. Your repository should be paused, and all update files have been scheduled for a metadata rescan. Please permit file maintenance under _database->file maintenance->manage scheduled jobs_ to finish its new work, which should fix this, before unpausing your repository.'.format( definition_hash.hex() ) )
@@ -2108,25 +2109,25 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
this_work_start_time = HydrusTime.GetNowPrecise()
- if HG.client_controller.CurrentlyVeryIdle():
+ if CG.client_controller.CurrentlyVeryIdle():
- work_time = HG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_very_idle' ) / 1000
- rest_ratio = HG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_very_idle' ) / 100
+ work_time = CG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_very_idle' ) / 1000
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_very_idle' ) / 100
- elif HG.client_controller.CurrentlyIdle():
+ elif CG.client_controller.CurrentlyIdle():
- work_time = HG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_idle' ) / 1000
- rest_ratio = HG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_idle' ) / 100
+ work_time = CG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_idle' ) / 1000
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_idle' ) / 100
else:
- work_time = HG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_normal' ) / 1000
- rest_ratio = HG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_normal' ) / 100
+ work_time = CG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_normal' ) / 1000
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_normal' ) / 100
start_time = HydrusTime.GetNowPrecise()
- num_rows_done = HG.client_controller.WriteSynchronous( 'process_repository_definitions', self._service_key, definition_hash, iterator_dict, content_types, job_status, work_time )
+ num_rows_done = CG.client_controller.WriteSynchronous( 'process_repository_definitions', self._service_key, definition_hash, iterator_dict, content_types, job_status, work_time )
time_it_took = HydrusTime.GetNowPrecise() - start_time
@@ -2135,14 +2136,14 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
work_done = True
- if this_is_first_definitions_work and total_definition_rows_completed > 1000 and not did_definition_analyze:
+ if ( this_is_first_definitions_work or total_definition_rows_completed > 10000 ) and not did_definition_analyze:
- HG.client_controller.WriteSynchronous( 'analyze', maintenance_mode = maintenance_mode, stop_time = stop_time )
+ CG.client_controller.WriteSynchronous( 'analyze', maintenance_mode = maintenance_mode )
did_definition_analyze = True
- if HG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time ) or job_status.IsCancelled():
+ if CG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time ) or job_status.IsCancelled():
return
@@ -2157,9 +2158,9 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
num_updates_done += 1
- if this_is_first_definitions_work and not did_definition_analyze:
+ if ( this_is_first_definitions_work or total_definition_rows_completed > 10000 ) and not did_definition_analyze:
- HG.client_controller.WriteSynchronous( 'analyze', maintenance_mode = maintenance_mode, stop_time = stop_time )
+ CG.client_controller.WriteSynchronous( 'analyze', maintenance_mode = maintenance_mode )
did_definition_analyze = True
@@ -2169,7 +2170,7 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
self._LogFinalRowSpeed( definition_start_time, total_definition_rows_completed, 'definitions' )
- if HG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time ) or job_status.IsCancelled():
+ if CG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time ) or job_status.IsCancelled():
return
@@ -2184,7 +2185,7 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
splash_title = '{} sync: processing updates {}'.format( self._name, progress_string )
- HG.client_controller.frame_splash_status.SetTitleText( splash_title, clear_undertexts = False, print_to_log = False )
+ CG.client_controller.frame_splash_status.SetTitleText( splash_title, clear_undertexts = False, print_to_log = False )
status = 'processing {}'.format( progress_string )
@@ -2193,11 +2194,11 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
try:
- update_path = HG.client_controller.client_files_manager.GetFilePath( content_hash, HC.APPLICATION_HYDRUS_UPDATE_CONTENT )
+ update_path = CG.client_controller.client_files_manager.GetFilePath( content_hash, HC.APPLICATION_HYDRUS_UPDATE_CONTENT )
except HydrusExceptions.FileMissingException:
- HG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_PRESENCE_REMOVE_RECORD )
+ CG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_PRESENCE_REMOVE_RECORD )
raise Exception( 'An unusual error has occured during repository processing: a content update file ({}) was missing. Your repository should be paused, and all update files have been scheduled for a presence check. I recommend you run _database->maintenance->clear/fix orphan file records_ too. Please then permit file maintenance under _database->file maintenance->manage scheduled jobs_ to finish its new work, which should fix this, before unpausing your repository.'.format( content_hash.hex() ) )
@@ -2213,14 +2214,14 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
except:
- HG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_DATA_REMOVE_RECORD )
+ CG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_INTEGRITY_DATA_REMOVE_RECORD )
raise Exception( 'An unusual error has occured during repository processing: a content update file ({}) was invalid. Your repository should be paused, and all update files have been scheduled for an integrity check. Please permit file maintenance under _database->file maintenance->manage scheduled jobs_ to finish its new work, which should fix this, before unpausing your repository.'.format( content_hash.hex() ) )
if not isinstance( content_update, HydrusNetwork.ContentUpdate ):
- HG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_METADATA )
+ CG.client_controller.WriteSynchronous( 'schedule_repository_update_file_maintenance', self._service_key, ClientFiles.REGENERATE_FILE_DATA_JOB_FILE_METADATA )
raise Exception( 'An unusual error has occured during repository processing: a content update file ({}) has incorrect metadata. Your repository should be paused, and all update files have been scheduled for a metadata rescan. Please permit file maintenance under _database->file maintenance->manage scheduled jobs_ to finish its new work, which should fix this, before unpausing your repository.'.format( content_hash.hex() ) )
@@ -2258,25 +2259,25 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
this_work_start_time = HydrusTime.GetNowPrecise()
- if HG.client_controller.CurrentlyVeryIdle():
+ if CG.client_controller.CurrentlyVeryIdle():
- work_time = HG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_very_idle' ) / 1000
- rest_ratio = HG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_very_idle' ) / 100
+ work_time = CG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_very_idle' ) / 1000
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_very_idle' ) / 100
- elif HG.client_controller.CurrentlyIdle():
+ elif CG.client_controller.CurrentlyIdle():
- work_time = HG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_idle' ) / 1000
- rest_ratio = HG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_idle' ) / 100
+ work_time = CG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_idle' ) / 1000
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_idle' ) / 100
else:
- work_time = HG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_normal' ) / 1000
- rest_ratio = HG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_normal' ) / 100
+ work_time = CG.client_controller.new_options.GetInteger( 'repository_processing_work_time_ms_normal' ) / 1000
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'repository_processing_rest_percentage_normal' ) / 100
start_time = HydrusTime.GetNowPrecise()
- num_rows_done = HG.client_controller.WriteSynchronous( 'process_repository_content', self._service_key, content_hash, iterator_dict, content_types, job_status, work_time )
+ num_rows_done = CG.client_controller.WriteSynchronous( 'process_repository_content', self._service_key, content_hash, iterator_dict, content_types, job_status, work_time )
time_it_took = HydrusTime.GetNowPrecise() - start_time
@@ -2285,14 +2286,14 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
work_done = True
- if this_is_first_content_work and total_content_rows_completed > 1000 and not did_content_analyze:
+ if ( this_is_first_content_work or total_content_rows_completed > 10000 ) and not did_content_analyze:
- HG.client_controller.WriteSynchronous( 'analyze', maintenance_mode = maintenance_mode, stop_time = stop_time )
+ CG.client_controller.WriteSynchronous( 'analyze', maintenance_mode = maintenance_mode )
did_content_analyze = True
- if HG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time ) or job_status.IsCancelled():
+ if CG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time ) or job_status.IsCancelled():
return
@@ -2307,9 +2308,9 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
num_updates_done += 1
- if this_is_first_content_work and not did_content_analyze:
+ if ( this_is_first_content_work or total_content_rows_completed > 10000 ) and not did_content_analyze:
- HG.client_controller.WriteSynchronous( 'analyze', maintenance_mode = maintenance_mode, stop_time = stop_time )
+ CG.client_controller.WriteSynchronous( 'analyze', maintenance_mode = maintenance_mode )
did_content_analyze = True
@@ -2340,7 +2341,7 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
self._SetDirty()
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
finally:
@@ -2354,8 +2355,8 @@ def _SyncProcessUpdates( self, maintenance_mode = HC.MAINTENANCE_IDLE, stop_time
self._SetDirty()
- HG.client_controller.pub( 'notify_new_force_refresh_tags_data' )
- HG.client_controller.pub( 'notify_new_tag_display_application' )
+ CG.client_controller.pub( 'notify_new_force_refresh_tags_data' )
+ CG.client_controller.pub( 'notify_new_tag_display_application' )
job_status.DeleteStatusText()
@@ -2392,7 +2393,7 @@ def CanDoIdleShutdownWork( self ):
content_types_we_are_processing = self._GetContentTypesWeAreProcessing()
- ( num_local_updates, num_updates, content_types_to_num_processed_updates, content_types_to_num_updates ) = HG.client_controller.Read( 'repository_progress', service_key )
+ ( num_local_updates, num_updates, content_types_to_num_processed_updates, content_types_to_num_updates ) = CG.client_controller.Read( 'repository_progress', service_key )
for ( content_type, num_processed_updates ) in content_types_to_num_processed_updates.items():
@@ -2438,8 +2439,8 @@ def DoAFullMetadataResync( self ):
self._SetDirty()
- HG.client_controller.pub( 'important_dirt_to_clean' )
- HG.client_controller.pub( 'notify_new_permissions' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'notify_new_permissions' )
def GetMetadata( self ):
@@ -2585,9 +2586,9 @@ def IsMostlyCaughtUp( self ):
content_types_to_process = self._GetContentTypesWeAreProcessing()
- ( this_is_first_definitions_work, definition_hashes_and_content_types, this_is_first_content_work, content_hashes_and_content_types ) = HG.client_controller.Read( 'repository_update_hashes_to_process', self._service_key, content_types_to_process )
+ ( this_is_first_definitions_work, definition_hashes_and_content_types, this_is_first_content_work, content_hashes_and_content_types ) = CG.client_controller.Read( 'repository_update_hashes_to_process', self._service_key, content_types_to_process )
- missing_update_hashes = HG.client_controller.Read( 'missing_repository_update_hashes', service_key )
+ missing_update_hashes = CG.client_controller.Read( 'missing_repository_update_hashes', service_key )
unprocessed_update_hashes = set( ( hash for ( hash, content_types ) in definition_hashes_and_content_types ) ).union( ( hash for ( hash, content_types ) in content_hashes_and_content_types ) ).union( missing_update_hashes )
@@ -2642,11 +2643,11 @@ def PausePlayUpdateDownloading( self ):
paused = self._update_downloading_paused
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
if not paused:
- HG.client_controller.pub( 'notify_new_permissions' )
+ CG.client_controller.pub( 'notify_new_permissions' )
@@ -2670,11 +2671,11 @@ def PausePlayUpdateProcessing( self, content_type = None ):
self._is_mostly_caught_up = None
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
if not paused:
- HG.client_controller.pub( 'notify_new_permissions' )
+ CG.client_controller.pub( 'notify_new_permissions' )
@@ -2696,10 +2697,10 @@ def Reset( self ):
self._SetDirty()
- HG.client_controller.pub( 'notify_account_sync_due' )
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'notify_account_sync_due' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
- HG.client_controller.Write( 'reset_repository', self )
+ CG.client_controller.Write( 'reset_repository', self )
def SetTagFilter( self, tag_filter: HydrusTags.TagFilter ):
@@ -2749,7 +2750,7 @@ def SyncRemote( self, stop_time = None ):
if self.IsDirty():
- HG.client_controller.pub( 'important_dirt_to_clean' )
+ CG.client_controller.pub( 'important_dirt_to_clean' )
@@ -2781,13 +2782,13 @@ def SyncThumbnails( self, stop_time ):
service_key = self._service_key
- thumbnail_hashes = HG.client_controller.Read( 'missing_thumbnail_hashes', service_key )
+ thumbnail_hashes = CG.client_controller.Read( 'missing_thumbnail_hashes', service_key )
num_to_do = len( thumbnail_hashes )
if num_to_do > 0:
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
job_status = ClientThreading.JobStatus( cancellable = True, stop_time = stop_time )
@@ -2795,13 +2796,13 @@ def SyncThumbnails( self, stop_time ):
job_status.SetStatusTitle( name + ' sync: downloading thumbnails' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
for ( i, thumbnail_hash ) in enumerate( thumbnail_hashes ):
status = 'thumbnail ' + HydrusData.ConvertValueRangeToPrettyString( i + 1, num_to_do )
- HG.client_controller.frame_splash_status.SetText( status, print_to_log = False )
+ CG.client_controller.frame_splash_status.SetText( status, print_to_log = False )
job_status.SetStatusText( status )
job_status.SetVariable( 'popup_gauge_1', ( i + 1, num_to_do ) )
@@ -2913,7 +2914,7 @@ def ConvertMultihashToURLTree( self, name, size, multihash, job_status: typing.O
try:
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -2988,7 +2989,7 @@ def EnableNoCopy( self, value ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -3010,7 +3011,7 @@ def GetDaemonVersion( self ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -3040,7 +3041,7 @@ def GetNoCopyAvailable( self ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
try:
@@ -3073,7 +3074,7 @@ def on_qt_select_tree( job_status, url_tree ):
from hydrus.client.gui import ClientGUIDialogs
- tlw = HG.client_controller.GetMainTLW()
+ tlw = CG.client_controller.GetMainTLW()
with ClientGUIDialogs.DialogSelectFromURLTree( tlw, url_tree ) as dlg:
@@ -3085,7 +3086,7 @@ def on_qt_select_tree( job_status, url_tree ):
if len( urls ) > 0:
- HG.client_controller.CallToThread( ClientImporting.THREADDownloadURLs, job_status, urls, multihash )
+ CG.client_controller.CallToThread( ClientImporting.THREADDownloadURLs, job_status, urls, multihash )
urls_good = True
@@ -3113,7 +3114,7 @@ def off_qt():
if not silent:
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
try:
@@ -3139,7 +3140,7 @@ def off_qt():
url = url_tree[3]
- HG.client_controller.CallToThread( ClientImporting.THREADDownloadURL, job_status, url, multihash )
+ CG.client_controller.CallToThread( ClientImporting.THREADDownloadURL, job_status, url, multihash )
else:
@@ -3156,7 +3157,7 @@ def off_qt():
- HG.client_controller.CallToThread( off_qt )
+ CG.client_controller.CallToThread( off_qt )
def IsPinned( self, multihash ):
@@ -3172,7 +3173,7 @@ def IsPinned( self, multihash ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
try:
@@ -3212,7 +3213,7 @@ def PinDirectory( self, hashes, note ):
job_status.SetStatusTitle( 'creating ipfs directory on ' + self._name )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
try:
@@ -3234,7 +3235,7 @@ def PinDirectory( self, hashes, note ):
job_status.SetStatusText( 'ensuring files are pinned: ' + HydrusData.ConvertValueRangeToPrettyString( i + 1, len( hashes ) ) )
job_status.SetVariable( 'popup_gauge_1', ( i + 1, len( hashes ) ) )
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
mime = media_result.GetMime()
@@ -3266,7 +3267,7 @@ def PinDirectory( self, hashes, note ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -3296,7 +3297,7 @@ def PinDirectory( self, hashes, note ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -3311,7 +3312,7 @@ def PinDirectory( self, hashes, note ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -3319,7 +3320,7 @@ def PinDirectory( self, hashes, note ):
content_updates = [ ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_DIRECTORIES, HC.CONTENT_UPDATE_ADD, content_update_row ) ]
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
job_status.SetStatusText( 'done!' )
@@ -3355,7 +3356,7 @@ def PinFile( self, hash, mime ):
api_base_url = self._GetAPIBaseURL()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
@@ -3406,7 +3407,7 @@ def PinFile( self, hash, mime ):
network_job.SetFiles( files )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -3440,7 +3441,7 @@ def PinFile( self, hash, mime ):
raise HydrusExceptions.DataMissing( message )
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
file_info_manager = media_result.GetFileInfoManager()
@@ -3448,7 +3449,7 @@ def PinFile( self, hash, mime ):
content_updates = [ ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ADD, content_update_row ) ]
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
return multihash
@@ -3466,14 +3467,14 @@ def UnpinDirectory( self, multihash ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
content_updates = [ ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_DIRECTORIES, HC.CONTENT_UPDATE_DELETE, multihash ) ]
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
def UnpinFile( self, hash, multihash ):
@@ -3489,14 +3490,14 @@ def UnpinFile( self, hash, multihash ):
network_job = ClientNetworkingJobs.NetworkJobIPFS( url )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
content_updates = [ ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_DELETE, { hash } ) ]
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
class ServicesManager( object ):
@@ -3506,7 +3507,7 @@ def __init__( self, controller ):
self._controller = controller
self._lock = threading.Lock()
- self._keys_to_services = {}
+ self._keys_to_services: typing.Dict[ bytes, Service ] = {}
self._services_sorted = []
self.RefreshServices()
@@ -3514,7 +3515,7 @@ def __init__( self, controller ):
self._controller.sub( self, 'RefreshServices', 'notify_new_services_data' )
- def _GetService( self, service_key: bytes ):
+ def _GetService( self, service_key: bytes ) -> Service:
try:
@@ -3606,7 +3607,15 @@ def GetServiceKeysToNames( self ):
- def GetServiceType( self, service_key: bytes ):
+ def GetServiceName( self, service_key: bytes ) -> str:
+
+ with self._lock:
+
+ return self._GetService( service_key ).GetName()
+
+
+
+ def GetServiceType( self, service_key: bytes ) -> int:
with self._lock:
diff --git a/hydrus/client/ClientThreading.py b/hydrus/client/ClientThreading.py
index 7f72437d5..930223efe 100644
--- a/hydrus/client/ClientThreading.py
+++ b/hydrus/client/ClientThreading.py
@@ -9,6 +9,7 @@
from hydrus.core import HydrusThreading
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import QtPorting as QP
class JobStatus( object ):
@@ -85,7 +86,7 @@ def _CheckCancelTests( self ):
return
- if HG.client_controller.ShouldStopThisWork( self._maintenance_mode, self._stop_time ):
+ if CG.client_controller.ShouldStopThisWork( self._maintenance_mode, self._stop_time ):
self.Cancel()
diff --git a/hydrus/client/ClientTime.py b/hydrus/client/ClientTime.py
index dc548b630..08adbb048 100644
--- a/hydrus/client/ClientTime.py
+++ b/hydrus/client/ClientTime.py
@@ -6,6 +6,7 @@
from hydrus.core import HydrusSerialisable
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
try:
@@ -115,7 +116,7 @@ def TimestampIsSensible( timestamp: typing.Optional[ int ] ) -> bool:
def TimestampToPrettyTimeDelta( timestamp, just_now_string = 'just now', just_now_threshold = 3, history_suffix = ' ago', show_seconds = True, no_prefix = False ):
- if HG.client_controller.new_options.GetBoolean( 'always_show_iso_time' ):
+ if CG.client_controller.new_options.GetBoolean( 'always_show_iso_time' ):
return HydrusTime.TimestampToPrettyTime( timestamp )
@@ -236,7 +237,7 @@ def ToString( self ) -> str:
try:
- service_string = HG.client_controller.services_manager.GetName( self.location )
+ service_string = CG.client_controller.services_manager.GetName( self.location )
except:
diff --git a/hydrus/client/caches/ClientCaches.py b/hydrus/client/caches/ClientCaches.py
index 62cdbd27c..dac92795a 100644
--- a/hydrus/client/caches/ClientCaches.py
+++ b/hydrus/client/caches/ClientCaches.py
@@ -16,6 +16,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientFiles
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientImageHandling
from hydrus.client import ClientParsing
from hydrus.client import ClientRendering
@@ -472,7 +473,7 @@ def _GetBestRecoveryThumbnailHydrusBitmap( self, display_media ):
bounding_dimensions = self._controller.options[ 'thumbnail_dimensions' ]
thumbnail_scale_type = self._controller.new_options.GetInteger( 'thumbnail_scale_type' )
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
( expected_width, expected_height ) = HydrusImageHandling.GetThumbnailResolution( ( media_width, media_height ), bounding_dimensions, thumbnail_scale_type, thumbnail_dpr_percent )
@@ -563,7 +564,7 @@ def _GetThumbnailHydrusBitmap( self, display_media ):
bounding_dimensions = self._controller.options[ 'thumbnail_dimensions' ]
thumbnail_scale_type = self._controller.new_options.GetInteger( 'thumbnail_scale_type' )
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
( expected_width, expected_height ) = HydrusImageHandling.GetThumbnailResolution( ( media_width, media_height ), bounding_dimensions, thumbnail_scale_type, thumbnail_dpr_percent )
@@ -635,7 +636,7 @@ def _HandleThumbnailException( self, hash, e, summary ):
job_status.SetStatusText( message )
job_status.SetFiles( [ hash ], 'broken thumbnail' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
@@ -751,7 +752,7 @@ def _ShouldBeAbleToProvideThumb( self, media ):
locations_manager = media.GetLocationsManager()
we_have_file = locations_manager.IsLocal()
- we_should_have_thumb = not locations_manager.GetCurrent().isdisjoint( HG.client_controller.services_manager.GetServiceKeys( ( HC.FILE_REPOSITORY, ) ) )
+ we_should_have_thumb = not locations_manager.GetCurrent().isdisjoint( CG.client_controller.services_manager.GetServiceKeys( ( HC.FILE_REPOSITORY, ) ) )
we_have_blurhash = media.GetFileInfoManager().blurhash is not None
return we_have_file or we_should_have_thumb or we_have_blurhash
@@ -792,7 +793,7 @@ def Clear( self ):
bounding_dimensions = self._controller.options[ 'thumbnail_dimensions' ]
thumbnail_scale_type = self._controller.new_options.GetInteger( 'thumbnail_scale_type' )
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
for ( mime, thumbnail_path ) in HydrusFileHandling.mimes_to_default_thumbnail_paths.items():
@@ -1037,7 +1038,7 @@ def MainLoop( self ):
with self._lock:
# got more important work or no work to do
- if len( self._waterfall_queue ) > 0 or len( self._delayed_regeneration_queue ) == 0 or HG.client_controller.CurrentlyPubSubbing():
+ if len( self._waterfall_queue ) > 0 or len( self._delayed_regeneration_queue ) == 0 or CG.client_controller.CurrentlyPubSubbing():
continue
diff --git a/hydrus/client/db/ClientDB.py b/hydrus/client/db/ClientDB.py
index 0b0b547b5..f39b7be1f 100644
--- a/hydrus/client/db/ClientDB.py
+++ b/hydrus/client/db/ClientDB.py
@@ -70,6 +70,7 @@
from hydrus.client.db import ClientDBTagSuggestions
from hydrus.client.db import ClientDBURLMap
from hydrus.client.importing import ClientImportFiles
+from hydrus.client.interfaces import ClientControllerInterface
from hydrus.client.media import ClientMediaManagers
from hydrus.client.media import ClientMediaResult
from hydrus.client.media import ClientMediaResultCache
@@ -226,7 +227,7 @@ class DB( HydrusDB.HydrusDB ):
READ_WRITE_ACTIONS = [ 'service_info', 'system_predicates', 'missing_thumbnail_hashes' ]
- def __init__( self, controller, db_dir, db_name ):
+ def __init__( self, controller: ClientControllerInterface.ClientControllerInterface, db_dir, db_name ):
self._initial_messages = []
diff --git a/hydrus/client/db/ClientDBDefinitionsCache.py b/hydrus/client/db/ClientDBDefinitionsCache.py
index 868d489cb..2293bd6f1 100644
--- a/hydrus/client/db/ClientDBDefinitionsCache.py
+++ b/hydrus/client/db/ClientDBDefinitionsCache.py
@@ -9,8 +9,8 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusLists
from hydrus.core import HydrusTags
-from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.db import ClientDBFilesStorage
from hydrus.client.db import ClientDBMappingsCounts
from hydrus.client.db import ClientDBMaster
@@ -219,7 +219,7 @@ def Repopulate( self ):
self.ClearCache()
- HG.client_controller.frame_splash_status.SetSubtext( 'reading local file data' )
+ CG.client_controller.frame_splash_status.SetSubtext( 'reading local file data' )
local_hash_ids = self.modules_files_storage.GetCurrentHashIdsList( self.modules_services.combined_local_file_service_id )
@@ -228,7 +228,7 @@ def Repopulate( self ):
for ( i, block_of_hash_ids ) in enumerate( HydrusLists.SplitListIntoChunks( local_hash_ids, BLOCK_SIZE ) ):
- HG.client_controller.frame_splash_status.SetSubtext( 'caching local file data {}'.format( HydrusData.ConvertValueRangeToPrettyString( i * BLOCK_SIZE, num_to_do ) ) )
+ CG.client_controller.frame_splash_status.SetSubtext( 'caching local file data {}'.format( HydrusData.ConvertValueRangeToPrettyString( i * BLOCK_SIZE, num_to_do ) ) )
self.AddHashIdsToCache( block_of_hash_ids )
diff --git a/hydrus/client/db/ClientDBFileDeleteLock.py b/hydrus/client/db/ClientDBFileDeleteLock.py
index 3b8748397..e7266aac5 100644
--- a/hydrus/client/db/ClientDBFileDeleteLock.py
+++ b/hydrus/client/db/ClientDBFileDeleteLock.py
@@ -2,8 +2,8 @@
import typing
from hydrus.core import HydrusConstants as HC
-from hydrus.core import HydrusGlobals as HG
+from hydrus.client import ClientGlobals as CG
from hydrus.client.db import ClientDBFilesInbox
from hydrus.client.db import ClientDBModule
from hydrus.client.db import ClientDBServices
@@ -22,7 +22,7 @@ def FilterForFileDeleteLock( self, service_id, hash_ids ):
# TODO: like in the MediaSingleton object, eventually extend this to the metadata conditional object
- if HG.client_controller.new_options.GetBoolean( 'delete_lock_for_archived_files' ):
+ if CG.client_controller.new_options.GetBoolean( 'delete_lock_for_archived_files' ):
service = self.modules_services.GetService( service_id )
diff --git a/hydrus/client/db/ClientDBFilesMaintenance.py b/hydrus/client/db/ClientDBFilesMaintenance.py
index 17641134e..96735afe3 100644
--- a/hydrus/client/db/ClientDBFilesMaintenance.py
+++ b/hydrus/client/db/ClientDBFilesMaintenance.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientFiles
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientTime
from hydrus.client.db import ClientDBDefinitionsCache
from hydrus.client.db import ClientDBFilesMaintenanceQueue
@@ -260,7 +261,7 @@ def ClearJobs( self, cleared_job_tuples ):
if len( hashes_that_need_refresh ) > 0:
- HG.client_controller.pub( 'new_file_info', hashes_that_need_refresh )
+ CG.client_controller.pub( 'new_file_info', hashes_that_need_refresh )
diff --git a/hydrus/client/db/ClientDBFilesMaintenanceQueue.py b/hydrus/client/db/ClientDBFilesMaintenanceQueue.py
index 5a7f3dfd7..b5f0ac1b9 100644
--- a/hydrus/client/db/ClientDBFilesMaintenanceQueue.py
+++ b/hydrus/client/db/ClientDBFilesMaintenanceQueue.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientFiles
+from hydrus.client import ClientGlobals as CG
from hydrus.client.db import ClientDBDefinitionsCache
from hydrus.client.db import ClientDBModule
@@ -55,12 +56,12 @@ def AddJobs( self, hash_ids, job_type, time_can_start = 0 ):
self._ExecuteMany( 'REPLACE INTO file_maintenance_jobs ( hash_id, job_type, time_can_start ) VALUES ( ?, ?, ? );', ( ( hash_id, job_type, time_can_start ) for hash_id in hash_ids ) )
- if HG.client_controller.IsBooted():
+ if CG.client_controller.IsBooted():
try:
# if this happens during boot db update, this doesn't exist lol
- HG.client_controller.files_maintenance_manager.Wake()
+ CG.client_controller.files_maintenance_manager.Wake()
except:
diff --git a/hydrus/client/db/ClientDBFilesPhysicalStorage.py b/hydrus/client/db/ClientDBFilesPhysicalStorage.py
index 2874aafa8..614291518 100644
--- a/hydrus/client/db/ClientDBFilesPhysicalStorage.py
+++ b/hydrus/client/db/ClientDBFilesPhysicalStorage.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusPaths
from hydrus.client import ClientFilesPhysical
+from hydrus.client import ClientGlobals as CG
from hydrus.client.db import ClientDBModule
class ClientDBFilesPhysicalStorage( ClientDBModule.ClientDBModule ):
@@ -270,6 +271,6 @@ def SetIdealClientFilesLocations( self, media_base_locations, thumbnail_override
self._Execute( 'INSERT INTO ideal_thumbnail_override_location ( location ) VALUES ( ? );', ( portable_path, ) )
- HG.client_controller.pub( 'new_ideal_client_files_locations' )
+ CG.client_controller.pub( 'new_ideal_client_files_locations' )
diff --git a/hydrus/client/db/ClientDBFilesSearch.py b/hydrus/client/db/ClientDBFilesSearch.py
index 8efda6c14..2d717a540 100644
--- a/hydrus/client/db/ClientDBFilesSearch.py
+++ b/hydrus/client/db/ClientDBFilesSearch.py
@@ -9,6 +9,7 @@
from hydrus.core import HydrusTags
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientThreading
from hydrus.client.db import ClientDBDefinitionsCache
@@ -1072,7 +1073,7 @@ def _DoSimpleRatingPreds( self, file_search_context: ClientSearch.FileSearchCont
else:
- service = HG.client_controller.services_manager.GetService( rating_service_key )
+ service = CG.client_controller.services_manager.GetService( rating_service_key )
service_type = service.GetServiceType()
@@ -1278,7 +1279,7 @@ def GetHashIdsFromQuery(
have_cross_referenced_file_locations = False
- HG.client_controller.ResetIdleTimer()
+ CG.client_controller.ResetIdleTimer()
system_predicates = file_search_context.GetSystemPredicates()
@@ -1549,7 +1550,7 @@ def GetHashIdsFromQuery(
service_id = self.modules_services.GetServiceId( rating_service_key )
- service = HG.client_controller.services_manager.GetService( rating_service_key )
+ service = CG.client_controller.services_manager.GetService( rating_service_key )
service_type = service.GetServiceType()
@@ -1784,7 +1785,7 @@ def sort_longest_tag_first_key( s ):
service_id = self.modules_services.GetServiceId( rating_service_key )
- service = HG.client_controller.services_manager.GetService( rating_service_key )
+ service = CG.client_controller.services_manager.GetService( rating_service_key )
service_type = service.GetServiceType()
diff --git a/hydrus/client/db/ClientDBFilesViewingStats.py b/hydrus/client/db/ClientDBFilesViewingStats.py
index dac07c4ce..9fbb162b9 100644
--- a/hydrus/client/db/ClientDBFilesViewingStats.py
+++ b/hydrus/client/db/ClientDBFilesViewingStats.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client import ClientTime
from hydrus.client.db import ClientDBModule
@@ -61,10 +62,10 @@ def ClearViews( self, hash_ids ):
def CullFileViewingStatistics( self ):
- media_min = HG.client_controller.new_options.GetNoneableInteger( 'file_viewing_statistics_media_min_time' )
- media_max = HG.client_controller.new_options.GetNoneableInteger( 'file_viewing_statistics_media_max_time' )
- preview_min = HG.client_controller.new_options.GetNoneableInteger( 'file_viewing_statistics_preview_min_time' )
- preview_max = HG.client_controller.new_options.GetNoneableInteger( 'file_viewing_statistics_preview_max_time' )
+ media_min = CG.client_controller.new_options.GetNoneableInteger( 'file_viewing_statistics_media_min_time' )
+ media_max = CG.client_controller.new_options.GetNoneableInteger( 'file_viewing_statistics_media_max_time' )
+ preview_min = CG.client_controller.new_options.GetNoneableInteger( 'file_viewing_statistics_preview_min_time' )
+ preview_max = CG.client_controller.new_options.GetNoneableInteger( 'file_viewing_statistics_preview_max_time' )
if media_min is not None and media_max is not None and media_min > media_max:
diff --git a/hydrus/client/db/ClientDBMaintenance.py b/hydrus/client/db/ClientDBMaintenance.py
index 5a019dc69..dbc0db0a6 100644
--- a/hydrus/client/db/ClientDBMaintenance.py
+++ b/hydrus/client/db/ClientDBMaintenance.py
@@ -11,6 +11,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client.db import ClientDBModule
@@ -219,19 +220,26 @@ def _GetTablePKColumnNames( self, table_name: str ):
return pk_column_names
- def _TableHasAtLeastRowCount( self, name, row_count ):
+ def _TableHasAtLeastRowCount( self, name, minimum_row_count ):
+
+ num_rows_found = 0
+ BLOCK_SIZE = max( 1, min( 10000, int( minimum_row_count / 10 ) ) )
cursor = self._Execute( 'SELECT 1 FROM {};'.format( name ) )
- for i in range( row_count ):
+ while num_rows_found < minimum_row_count:
+
+ result = cursor.fetchmany( BLOCK_SIZE )
- r = cursor.fetchone()
+ num_rows_this_loop = len( result )
- if r is None:
+ if num_rows_this_loop == 0:
return False
+ num_rows_found += num_rows_this_loop
+
return True
@@ -255,11 +263,11 @@ def AnalyzeDueTables( self, maintenance_mode = HC.MAINTENANCE_FORCED, stop_time
job_status.SetStatusTitle( 'database maintenance - analyzing' )
- HG.client_controller.pub( 'modal_message', job_status )
+ CG.client_controller.pub( 'modal_message', job_status )
for name in HydrusData.IterateListRandomlyAndFast( names_to_analyze ):
- HG.client_controller.frame_splash_status.SetText( 'analyzing ' + name )
+ CG.client_controller.frame_splash_status.SetText( 'analyzing ' + name )
job_status.SetStatusText( 'analyzing ' + name )
time.sleep( 0.02 )
@@ -275,7 +283,7 @@ def AnalyzeDueTables( self, maintenance_mode = HC.MAINTENANCE_FORCED, stop_time
HydrusData.Print( 'Analyzed ' + name + ' in ' + HydrusTime.TimeDeltaToPrettyTimeDelta( time_took ) )
- p1 = HG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time )
+ p1 = CG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time )
p2 = job_status.IsCancelled()
if p1 or p2:
@@ -340,7 +348,7 @@ def CheckDBIntegrity( self ):
job_status.SetStatusTitle( prefix_string + 'preparing' )
- HG.client_controller.pub( 'modal_message', job_status )
+ CG.client_controller.pub( 'modal_message', job_status )
job_status.SetStatusTitle( prefix_string + 'running' )
job_status.SetStatusText( 'errors found so far: ' + HydrusData.ToHumanInt( num_errors ) )
@@ -610,7 +618,8 @@ def GetTableNamesDueAnalysis( self, force_reanalyze = False ) -> typing.List:
boundaries.append( ( 100, True, 6 * 3600 ) )
boundaries.append( ( 10000, True, 3 * 86400 ) )
boundaries.append( ( 100000, False, 3 * 30 * 86400 ) )
- # anything bigger than 100k rows will now not be analyzed
+ boundaries.append( ( 10000000, False, 12 * 30 * 86400 ) )
+ # anything bigger than 10M rows will now not be analyzed
existing_names_to_info = { name : ( num_rows, HydrusTime.SecondiseMS( timestamp_ms ) ) for ( name, num_rows, timestamp_ms ) in self._Execute( 'SELECT name, num_rows, timestamp_ms FROM analyze_timestamps;' ) }
diff --git a/hydrus/client/db/ClientDBMaster.py b/hydrus/client/db/ClientDBMaster.py
index 1c70fc830..fcc97ca0b 100644
--- a/hydrus/client/db/ClientDBMaster.py
+++ b/hydrus/client/db/ClientDBMaster.py
@@ -49,7 +49,7 @@ def _GetInitialTableGenerationDict( self ) -> dict:
}
- def _PopulateHashIdsToHashesCache( self, hash_ids, exception_on_error = False ):
+ def _PopulateHashIdsToHashesCache( self, hash_ids ):
if len( self._hash_ids_to_hashes_cache ) > 100000:
@@ -90,11 +90,6 @@ def _PopulateHashIdsToHashesCache( self, hash_ids, exception_on_error = False ):
if hash_id not in uncached_hash_ids_to_hashes:
- if exception_on_error:
-
- raise HydrusExceptions.DataMissing( 'Did not find all entries for those hash ids!' )
-
-
# TODO: ultimately move this to the 'recover from missing definitions' stuff I am building in ClientDB, since the local hash cache may have it
# for now though, screw it
@@ -304,7 +299,7 @@ def GetHashIdsToHashes( self, hash_ids = None, hashes = None ):
if hash_ids is not None:
- self._PopulateHashIdsToHashesCache( hash_ids, exception_on_error = True )
+ self._PopulateHashIdsToHashesCache( hash_ids )
hash_ids_to_hashes = { hash_id : self._hash_ids_to_hashes_cache[ hash_id ] for hash_id in hash_ids }
diff --git a/hydrus/client/db/ClientDBModule.py b/hydrus/client/db/ClientDBModule.py
index efda1af6b..a767f4da9 100644
--- a/hydrus/client/db/ClientDBModule.py
+++ b/hydrus/client/db/ClientDBModule.py
@@ -5,6 +5,8 @@
from hydrus.core import HydrusDBModule
from hydrus.core import HydrusGlobals as HG
+from hydrus.client import ClientGlobals as CG
+
class ClientDBModule( HydrusDBModule.HydrusDBModule ):
def _DisplayCatastrophicError( self, text: str ):
@@ -15,7 +17,7 @@ def _DisplayCatastrophicError( self, text: str ):
HydrusData.DebugPrint( message )
- HG.client_controller.BlockingSafeShowCriticalMessage( 'hydrus db failed', message )
+ CG.client_controller.BlockingSafeShowCriticalMessage( 'hydrus db failed', message )
def _PresentMissingIndicesWarningToUser( self, index_names: typing.Collection[ str ] ):
@@ -27,9 +29,9 @@ def _PresentMissingIndicesWarningToUser( self, index_names: typing.Collection[ s
message = 'Your "{}" database module was missing {} indices. More information has been written to the log. This may or may not be a big deal, and on its own it is completely recoverable. If you do not have further problems, hydev does not need to know about it. The indices will be regenerated once you proceed--it may take some time.'.format( self.name, len( index_names ) )
- HG.client_controller.BlockingSafeShowMessage( message )
+ CG.client_controller.BlockingSafeShowMessage( message )
- HG.client_controller.frame_splash_status.SetText( 'recreating indices' )
+ CG.client_controller.frame_splash_status.SetText( 'recreating indices' )
def _PresentMissingTablesWarningToUser( self, table_names: typing.Collection[ str ] ):
@@ -57,9 +59,9 @@ def _PresentMissingTablesWarningToUser( self, table_names: typing.Collection[ st
message += 'If you proceed, the missing tables will be recreated. {}'.format( recovery_info )
- HG.client_controller.BlockingSafeShowMessage( message )
+ CG.client_controller.BlockingSafeShowMessage( message )
- HG.client_controller.frame_splash_status.SetText( 'recreating tables' )
+ CG.client_controller.frame_splash_status.SetText( 'recreating tables' )
def GetTablesAndColumnsThatUseDefinitions( self, content_type: int ) -> typing.List[ typing.Tuple[ str, str ] ]:
diff --git a/hydrus/client/db/ClientDBSerialisable.py b/hydrus/client/db/ClientDBSerialisable.py
index 1589e63e7..4ef32011d 100644
--- a/hydrus/client/db/ClientDBSerialisable.py
+++ b/hydrus/client/db/ClientDBSerialisable.py
@@ -13,6 +13,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.db import ClientDBModule
from hydrus.client.db import ClientDBServices
@@ -216,7 +217,7 @@ def DeleteYAMLDump( self, dump_type, dump_name = None ):
self._Execute( 'DELETE FROM service_info WHERE service_id = ? AND info_type = ?;', ( service_id, HC.SERVICE_INFO_NUM_SHARES ) )
- HG.client_controller.pub( 'refresh_local_booru_shares' )
+ CG.client_controller.pub( 'refresh_local_booru_shares' )
@@ -687,7 +688,7 @@ def SetJSONDump( self, obj, force_timestamp_ms = None ):
if force_timestamp_ms is None:
store_backups = True
- backup_depth = HG.client_controller.new_options.GetInteger( 'number_of_gui_session_backups' )
+ backup_depth = CG.client_controller.new_options.GetInteger( 'number_of_gui_session_backups' )
@@ -936,7 +937,7 @@ def SetYAMLDump( self, dump_type, dump_name, data ):
self._Execute( 'DELETE FROM service_info WHERE service_id = ? AND info_type = ?;', ( service_id, HC.SERVICE_INFO_NUM_SHARES ) )
- HG.client_controller.pub( 'refresh_local_booru_shares' )
+ CG.client_controller.pub( 'refresh_local_booru_shares' )
diff --git a/hydrus/client/db/ClientDBSimilarFiles.py b/hydrus/client/db/ClientDBSimilarFiles.py
index d7b43ac02..a75735e95 100644
--- a/hydrus/client/db/ClientDBSimilarFiles.py
+++ b/hydrus/client/db/ClientDBSimilarFiles.py
@@ -9,6 +9,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client.db import ClientDBFilesStorage
from hydrus.client.db import ClientDBModule
@@ -664,14 +665,14 @@ def MaintainTree( self, maintenance_mode = HC.MAINTENANCE_FORCED, job_status = N
if pub_job_status and not job_status_pubbed and HydrusTime.TimeHasPassed( time_started + 5 ):
- HG.client_controller.pub( 'modal_message', job_status )
+ CG.client_controller.pub( 'modal_message', job_status )
job_status_pubbed = True
( i_paused, should_quit ) = job_status.WaitIfNeeded()
- should_stop = HG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time )
+ should_stop = CG.client_controller.ShouldStopThisWork( maintenance_mode, stop_time = stop_time )
if should_quit or should_stop:
@@ -682,7 +683,7 @@ def MaintainTree( self, maintenance_mode = HC.MAINTENANCE_FORCED, job_status = N
text = 'rebalancing similar file metadata - ' + HydrusData.ConvertValueRangeToPrettyString( num_done, num_to_do )
- HG.client_controller.frame_splash_status.SetSubtext( text )
+ CG.client_controller.frame_splash_status.SetSubtext( text )
job_status.SetStatusText( text )
job_status.SetVariable( 'popup_gauge_1', ( num_done, num_to_do ) )
@@ -720,7 +721,7 @@ def MaintainTree( self, maintenance_mode = HC.MAINTENANCE_FORCED, job_status = N
def MaintenanceDue( self ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
if new_options.GetBoolean( 'maintain_similar_files_duplicate_pairs_during_idle' ):
@@ -745,7 +746,7 @@ def RegenerateTree( self ):
job_status.SetStatusTitle( 'regenerating similar file search data' )
- HG.client_controller.pub( 'modal_message', job_status )
+ CG.client_controller.pub( 'modal_message', job_status )
job_status.SetStatusText( 'purging search info of orphans' )
diff --git a/hydrus/client/db/ClientDBTagSearch.py b/hydrus/client/db/ClientDBTagSearch.py
index c02a31a0c..0eadbc556 100644
--- a/hydrus/client/db/ClientDBTagSearch.py
+++ b/hydrus/client/db/ClientDBTagSearch.py
@@ -13,6 +13,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.db import ClientDBMaintenance
from hydrus.client.db import ClientDBMappingsCounts
from hydrus.client.db import ClientDBMappingsStorage
@@ -1358,7 +1359,7 @@ def RegenerateSearchableSubtagMap( self, file_service_id, tag_service_id, status
message = HydrusData.ConvertValueRangeToPrettyString( num_done, num_to_do )
- HG.client_controller.frame_splash_status.SetSubtext( message )
+ CG.client_controller.frame_splash_status.SetSubtext( message )
if status_hook is not None:
diff --git a/hydrus/client/db/ClientDBTagSuggestions.py b/hydrus/client/db/ClientDBTagSuggestions.py
index 4f65e436f..4e2daa2ad 100644
--- a/hydrus/client/db/ClientDBTagSuggestions.py
+++ b/hydrus/client/db/ClientDBTagSuggestions.py
@@ -2,9 +2,9 @@
import typing
from hydrus.core import HydrusConstants as HC
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.db import ClientDBDefinitionsCache
from hydrus.client.db import ClientDBMaster
from hydrus.client.db import ClientDBModule
@@ -48,7 +48,7 @@ def sort_key( key ):
newest_first = sorted( tag_ids_to_timestamps_ms.keys(), key = sort_key, reverse = True )
- num_we_want = HG.client_controller.new_options.GetNoneableInteger( 'num_recent_tags' )
+ num_we_want = CG.client_controller.new_options.GetNoneableInteger( 'num_recent_tags' )
if num_we_want is None:
diff --git a/hydrus/client/exporting/ClientExportingFiles.py b/hydrus/client/exporting/ClientExportingFiles.py
index 581532986..5ea5950b1 100644
--- a/hydrus/client/exporting/ClientExportingFiles.py
+++ b/hydrus/client/exporting/ClientExportingFiles.py
@@ -15,6 +15,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientPaths
from hydrus.client import ClientThreading
from hydrus.client.metadata import ClientContentUpdates
@@ -38,7 +39,7 @@ def clean_tag_text( t ):
return t
- decent_expected_filename_length = 16
+ decent_expected_filename_length = 64
try:
@@ -152,7 +153,10 @@ def clean_tag_text( t ):
filename = filename[ : - len( ext ) ]
- filename = HydrusPaths.ElideFilenameOrDirectorySafely( filename, num_characters_used_in_other_components = destination_directory_num_characters_in_filesystem )
+ # sidecar suffixes, and in general we don't want to spam giganto strings to people's hard drives
+ extra_characters_and_padding = 64
+
+ filename = HydrusPaths.ElideFilenameOrDirectorySafely( filename, num_characters_used_in_other_components = destination_directory_num_characters_in_filesystem + extra_characters_and_padding )
if do_not_use_filenames is not None:
@@ -179,7 +183,7 @@ def clean_tag_text( t ):
def GetExportPath():
- portable_path = HG.client_controller.options[ 'export_path' ]
+ portable_path = CG.client_controller.options[ 'export_path' ]
if portable_path is None:
@@ -316,7 +320,7 @@ def __init__(
if file_search_context is None:
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
file_search_context = ClientSearch.FileSearchContext( location_context = default_location_context )
@@ -328,7 +332,7 @@ def __init__(
if phrase is None:
- phrase = HG.client_controller.new_options.GetString( 'export_phrase' )
+ phrase = CG.client_controller.new_options.GetString( 'export_phrase' )
self._path = path
@@ -500,7 +504,7 @@ def _UpdateSerialisableInfo( self, version, old_serialisable_info ):
def _DoExport( self, job_status: ClientThreading.JobStatus ):
- query_hash_ids = HG.client_controller.Read( 'file_query_ids', self._file_search_context, apply_implicit_limit = False )
+ query_hash_ids = CG.client_controller.Read( 'file_query_ids', self._file_search_context, apply_implicit_limit = False )
media_results = []
@@ -515,12 +519,12 @@ def _DoExport( self, job_status: ClientThreading.JobStatus ):
return
- if HG.client_controller.new_options.GetBoolean( 'pause_export_folders_sync' ) or HydrusThreading.IsThreadShuttingDown():
+ if CG.client_controller.new_options.GetBoolean( 'pause_export_folders_sync' ) or HydrusThreading.IsThreadShuttingDown():
return
- more_media_results = HG.client_controller.Read( 'media_results_from_ids', block_of_hash_ids )
+ more_media_results = CG.client_controller.Read( 'media_results_from_ids', block_of_hash_ids )
media_results.extend( more_media_results )
@@ -540,7 +544,7 @@ def _DoExport( self, job_status: ClientThreading.JobStatus ):
sync_paths = set()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
num_actually_copied = 0
@@ -553,7 +557,7 @@ def _DoExport( self, job_status: ClientThreading.JobStatus ):
return
- if HG.client_controller.new_options.GetBoolean( 'pause_export_folders_sync' ) or HydrusThreading.IsThreadShuttingDown():
+ if CG.client_controller.new_options.GetBoolean( 'pause_export_folders_sync' ) or HydrusThreading.IsThreadShuttingDown():
return
@@ -705,7 +709,7 @@ def _DoExport( self, job_status: ClientThreading.JobStatus ):
if self._delete_from_client_after_export:
- local_file_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_file_service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
service_keys_to_deletee_hashes = collections.defaultdict( list )
@@ -752,7 +756,7 @@ def _DoExport( self, job_status: ClientThreading.JobStatus ):
content_update = ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_DELETE, chunk_of_hashes, reason = reason )
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( service_key, content_update ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( service_key, content_update ) )
@@ -796,7 +800,7 @@ def DoWork( self ):
if popup_desired:
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
self._DoExport( job_status )
@@ -829,7 +833,7 @@ def DoWork( self ):
self._last_checked = HydrusTime.GetNow()
self._run_now = False
- HG.client_controller.WriteSynchronous( 'serialisable', self )
+ CG.client_controller.WriteSynchronous( 'serialisable', self )
job_status.FinishAndDismiss()
diff --git a/hydrus/client/gui/ClientGUI.py b/hydrus/client/gui/ClientGUI.py
index 864a2aaaf..24ce7b94b 100644
--- a/hydrus/client/gui/ClientGUI.py
+++ b/hydrus/client/gui/ClientGUI.py
@@ -94,6 +94,7 @@
from hydrus.client.gui.services import ClientGUIClientsideServices
from hydrus.client.gui.services import ClientGUIServersideServices
from hydrus.client.gui.widgets import ClientGUICommon
+from hydrus.client.interfaces import ClientControllerInterface
from hydrus.client.media import ClientMediaResult
from hydrus.client.metadata import ClientContentUpdates
from hydrus.client.metadata import ClientTags
@@ -467,7 +468,7 @@ def THREADUploadPending( service_key ):
class FrameGUI( CAC.ApplicationCommandProcessorMixin, ClientGUITopLevelWindows.MainFrameThatResizes ):
- def __init__( self, controller ):
+ def __init__( self, controller: ClientControllerInterface.ClientControllerInterface ):
self._controller = controller
@@ -3090,7 +3091,7 @@ def _InitialiseMenuInfoDatabase( self ):
ClientGUIMenus.AppendSeparator( menu )
- ClientGUIMenus.AppendMenuItem( menu, 'migrate database', 'Review and manage the locations your database is stored.', self._MigrateDatabase )
+ ClientGUIMenus.AppendMenuItem( menu, 'move media files', 'Review and manage the locations your database is stored.', self._MoveMediaFiles )
ClientGUIMenus.AppendSeparator( menu )
@@ -3462,8 +3463,7 @@ def flip_macos_antiflicker():
ClientGUIMenus.AppendMenuItem( tests, 'run the ui test', 'Run hydrus_dev\'s weekly UI Test. Guaranteed to work and not mess up your session, ha ha.', self._RunUITest )
ClientGUIMenus.AppendMenuItem( tests, 'run the client api test', 'Run hydrus_dev\'s weekly Client API Test. Guaranteed to work and not mess up your session, ha ha.', self._RunClientAPITest )
- ClientGUIMenus.AppendMenuItem( tests, 'run the server test', 'This will try to boot the server in your install folder and initialise it.', self._RunServerTest )
- ClientGUIMenus.AppendMenuItem( tests, 'run the server test on fresh server', 'This will try to initialise an already running server.', self._RunServerTest, do_boot = False )
+ ClientGUIMenus.AppendMenuItem( tests, 'run the server test on fresh server', 'This will try to initialise an already running server.', self._RunServerTest )
ClientGUIMenus.AppendMenu( debug, tests, 'tests, do not touch' )
@@ -4971,11 +4971,11 @@ def _ManageUPnP( self ):
with ClientGUIDialogsManage.DialogManageUPnP( self ) as dlg: dlg.exec()
- def _MigrateDatabase( self ):
+ def _MoveMediaFiles( self ):
- with ClientGUITopLevelWindowsPanels.DialogNullipotent( self, 'migrate database' ) as dlg:
+ with ClientGUITopLevelWindowsPanels.DialogNullipotent( self, 'move media files' ) as dlg:
- panel = ClientGUIScrolledPanelsReview.MigrateDatabasePanel( dlg, self._controller )
+ panel = ClientGUIScrolledPanelsReview.MoveMediaFilesPanel( dlg, self._controller )
dlg.SetPanel( panel )
@@ -6182,92 +6182,13 @@ def do_it():
CG.client_controller.CallToThread( do_it )
- def _RunServerTest( self, do_boot = True ):
+ def _RunServerTest( self ):
def do_it():
host = '127.0.0.1'
port = HC.DEFAULT_SERVER_ADMIN_PORT
- if do_boot:
-
- if HydrusNetworking.LocalPortInUse( port ):
-
- HydrusData.ShowText( 'The server appears to be already running. Either that, or something else is using port ' + str( HC.DEFAULT_SERVER_ADMIN_PORT ) + '.' )
-
- return
-
- else:
-
- try:
-
- HydrusData.ShowText( 'Starting server' + HC.UNICODE_ELLIPSIS )
-
- db_param = '-d=' + self._controller.GetDBDir()
-
- if HC.PLATFORM_WINDOWS:
-
- server_frozen_path = os.path.join( HC.BASE_DIR, 'hydrus_server.exe' )
-
- else:
-
- server_frozen_path = os.path.join( HC.BASE_DIR, 'hydrus_server' )
-
-
- if os.path.exists( server_frozen_path ):
-
- cmd = [ server_frozen_path, db_param ]
-
- else:
-
- python_executable = sys.executable
-
- if python_executable.endswith( 'hydrus_client.exe' ) or python_executable.endswith( 'hydrus_client' ):
-
- raise Exception( 'Could not automatically set up the server--could not find hydrus_client executable or python executable.' )
-
-
- if 'pythonw' in python_executable:
-
- python_executable = python_executable.replace( 'pythonw', 'python' )
-
-
- server_script_path = os.path.join( HC.BASE_DIR, 'hydrus_server.py' )
-
- cmd = [ python_executable, server_script_path, db_param ]
-
-
- sbp_kwargs = HydrusData.GetSubprocessKWArgs( hide_terminal = False )
-
- HydrusData.CheckProgramIsNotShuttingDown()
-
- subprocess.Popen( cmd, **sbp_kwargs )
-
- time_waited = 0
-
- while not HydrusNetworking.LocalPortInUse( port ):
-
- time.sleep( 3 )
-
- time_waited += 3
-
- if time_waited > 30:
-
- raise Exception( 'The server\'s port did not appear!' )
-
-
-
- except:
-
- HydrusData.ShowText( 'I tried to start the server, but something failed!' + os.linesep + traceback.format_exc() )
-
- return
-
-
-
-
- time.sleep( 5 )
-
HydrusData.ShowText( 'Creating admin service' + HC.UNICODE_ELLIPSIS )
admin_service_key = HydrusData.GenerateKey()
@@ -7178,7 +7099,7 @@ def DoFileStorageRebalance( self, job_status: ClientThreading.JobStatus ):
dlg.exec()
- self._MigrateDatabase()
+ self._MoveMediaFiles()
def eventFilter( self, watched, event ):
diff --git a/hydrus/client/gui/ClientGUIAPI.py b/hydrus/client/gui/ClientGUIAPI.py
index 54bafb7dc..218c92704 100644
--- a/hydrus/client/gui/ClientGUIAPI.py
+++ b/hydrus/client/gui/ClientGUIAPI.py
@@ -8,6 +8,7 @@
from hydrus.client import ClientAPI
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIScrolledPanels
@@ -33,7 +34,7 @@ def __init__( self, parent ):
self.widget().setLayout( vbox )
- self._repeating_job = HG.client_controller.CallRepeatingQtSafe( self, 0.0, 0.5, 'repeating client api permissions check', self.REPEATINGUpdate )
+ self._repeating_job = CG.client_controller.CallRepeatingQtSafe( self, 0.0, 0.5, 'repeating client api permissions check', self.REPEATINGUpdate )
def GetAPIAccessPermissions( self ):
diff --git a/hydrus/client/gui/ClientGUIAsync.py b/hydrus/client/gui/ClientGUIAsync.py
index d0458e787..cbf0446e9 100644
--- a/hydrus/client/gui/ClientGUIAsync.py
+++ b/hydrus/client/gui/ClientGUIAsync.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import QtPorting as QP
@@ -74,7 +75,7 @@ def qt_deliver_result( result ):
try:
- HG.client_controller.CallBlockingToQt( self._win, c, etype, value, tb )
+ CG.client_controller.CallBlockingToQt( self._win, c, etype, value, tb )
except ( HydrusExceptions.QtDeadWindowException, HydrusExceptions.ShutdownException ):
@@ -86,7 +87,7 @@ def qt_deliver_result( result ):
try:
- HG.client_controller.CallBlockingToQt( self._win, qt_deliver_result, result )
+ CG.client_controller.CallBlockingToQt( self._win, qt_deliver_result, result )
except ( HydrusExceptions.QtDeadWindowException, HydrusExceptions.ShutdownException ):
@@ -107,7 +108,7 @@ def qt_deliver_result( result ):
try:
- HG.client_controller.CallBlockingToQt( self._win, c, etype, value, tb )
+ CG.client_controller.CallBlockingToQt( self._win, c, etype, value, tb )
except ( HydrusExceptions.QtDeadWindowException, HydrusExceptions.ShutdownException ):
@@ -118,7 +119,7 @@ def qt_deliver_result( result ):
def start( self ):
- HG.client_controller.CallToThread( self._doWork )
+ CG.client_controller.CallToThread( self._doWork )
# this can refresh dirty stuff n times and won't spam work
@@ -173,7 +174,7 @@ def qt_deliver_result( result ):
try:
- pre_work_args = HG.client_controller.CallBlockingToQt( self._win, self._pre_work_callable )
+ pre_work_args = CG.client_controller.CallBlockingToQt( self._win, self._pre_work_callable )
except ( HydrusExceptions.QtDeadWindowException, HydrusExceptions.ShutdownException ):
@@ -187,7 +188,7 @@ def qt_deliver_result( result ):
try:
- HG.client_controller.CallBlockingToQt( self._win, qt_deliver_result, result )
+ CG.client_controller.CallBlockingToQt( self._win, qt_deliver_result, result )
except ( HydrusExceptions.QtDeadWindowException, HydrusExceptions.ShutdownException ):
@@ -212,7 +213,7 @@ def qt_deliver_result( result ):
def _startWork( self ):
- HG.client_controller.CallToThread( self._doWork )
+ CG.client_controller.CallToThread( self._doWork )
def update( self ):
diff --git a/hydrus/client/gui/ClientGUICore.py b/hydrus/client/gui/ClientGUICore.py
index 11dfa96ae..4e4e27408 100644
--- a/hydrus/client/gui/ClientGUICore.py
+++ b/hydrus/client/gui/ClientGUICore.py
@@ -3,6 +3,8 @@
from qtpy import QtWidgets as QW
from hydrus.core import HydrusConstants as HC
+
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIMenus
class GUICore( QC.QObject ):
@@ -15,6 +17,9 @@ def __init__( self ):
self._menu_open = False
+ # TODO: populate this shortly after boot and use it in place of many manual pixel counts
+ self.decent_pixel_text_height = 10
+
GUICore.my_instance = self
@@ -54,7 +59,7 @@ def PopupMenu( self, window: QW.QWidget, menu: QW.QMenu ):
from hydrus.core import HydrusGlobals as HG
- if HG.client_controller.new_options.GetBoolean( 'do_macos_debug_dialog_menus' ):
+ if CG.client_controller.new_options.GetBoolean( 'do_macos_debug_dialog_menus' ):
from hydrus.client.gui import ClientGUICoreMenuDebug
@@ -78,4 +83,5 @@ def PopupMenu( self, window: QW.QWidget, menu: QW.QMenu ):
ClientGUIMenus.DestroyMenu( menu )
+
core = GUICore.instance
diff --git a/hydrus/client/gui/ClientGUIDialogs.py b/hydrus/client/gui/ClientGUIDialogs.py
index 7f00de176..ab3eb38b7 100644
--- a/hydrus/client/gui/ClientGUIDialogs.py
+++ b/hydrus/client/gui/ClientGUIDialogs.py
@@ -11,6 +11,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIFrames
from hydrus.client.gui import ClientGUIFunctions
@@ -41,9 +42,9 @@ def __init__( self, parent, title, style = QC.Qt.Dialog, position = 'topleft' ):
self.setWindowFlag( QC.Qt.WindowContextHelpButtonHint, on = False )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
- self.setWindowIcon( QG.QIcon( HG.client_controller.frame_icon_pixmap ) )
+ self.setWindowIcon( QG.QIcon( CG.client_controller.frame_icon_pixmap ) )
self._widget_event_filter = QP.WidgetEventFilter( self )
@@ -52,7 +53,7 @@ def __init__( self, parent, title, style = QC.Qt.Dialog, position = 'topleft' ):
QP.CallAfter( QP.CenterOnWindow, parent, self )
- HG.client_controller.ResetIdleTimer()
+ CG.client_controller.ResetIdleTimer()
def keyPressEvent( self, event ):
@@ -160,7 +161,7 @@ def __init__( self, parent, service_key ):
self._num.setValue( 1 )
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
response = service.Request( HC.GET, 'account_types' )
@@ -227,7 +228,7 @@ def EventOK( self ):
expires = HydrusTime.GetNow() + lifetime
- service = HG.client_controller.services_manager.GetService( self._service_key )
+ service = CG.client_controller.services_manager.GetService( self._service_key )
try:
@@ -311,7 +312,7 @@ def __init__( self, parent, share_key, name, text, timeout, hashes, new_share =
self._hashes = hashes
- self._service = HG.client_controller.services_manager.GetService( CC.LOCAL_BOORU_SERVICE_KEY )
+ self._service = CG.client_controller.services_manager.GetService( CC.LOCAL_BOORU_SERVICE_KEY )
internal_port = self._service.GetPort()
@@ -388,16 +389,16 @@ def EventCopyExternalShareURL( self ):
return
- HG.client_controller.pub( 'clipboard', 'text', url )
+ CG.client_controller.pub( 'clipboard', 'text', url )
def EventCopyInternalShareURL( self ):
- self._service = HG.client_controller.services_manager.GetService( CC.LOCAL_BOORU_SERVICE_KEY )
+ self._service = CG.client_controller.services_manager.GetService( CC.LOCAL_BOORU_SERVICE_KEY )
url = self._service.GetInternalShareURL( self._share_key )
- HG.client_controller.pub( 'clipboard', 'text', url )
+ CG.client_controller.pub( 'clipboard', 'text', url )
def GetInfo( self ):
@@ -521,7 +522,7 @@ def __init__( self, parent, service_key, tag_display_type, tags, message = '' ):
self._tags = ClientGUIListBoxes.ListBoxTagsStringsAddRemove( self, service_key, tag_display_type = tag_display_type )
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._tag_autocomplete = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite( self, self.EnterTags, default_location_context, service_key, show_paste_button = True )
diff --git a/hydrus/client/gui/ClientGUIDialogsManage.py b/hydrus/client/gui/ClientGUIDialogsManage.py
index 558ddddb1..e00c274d2 100644
--- a/hydrus/client/gui/ClientGUIDialogsManage.py
+++ b/hydrus/client/gui/ClientGUIDialogsManage.py
@@ -13,6 +13,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIAsync
from hydrus.client.gui import ClientGUIDialogs
from hydrus.client.gui import ClientGUIDialogsMessage
@@ -45,9 +46,9 @@ def __init__( self, parent, media ):
#
- like_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
- numerical_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, ) )
- incdec_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_INCDEC, ) )
+ like_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
+ numerical_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, ) )
+ incdec_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_INCDEC, ) )
self._panels = []
@@ -125,14 +126,14 @@ def _Copy( self ):
text = json.dumps( [ ( service_key.hex(), rating ) for ( service_key, rating ) in rating_clipboard_pairs ] )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -173,7 +174,7 @@ def EventOK( self ):
if content_update_package.HasContent():
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
finally:
diff --git a/hydrus/client/gui/ClientGUIDialogsMessage.py b/hydrus/client/gui/ClientGUIDialogsMessage.py
index 483e361f0..a704fde36 100644
--- a/hydrus/client/gui/ClientGUIDialogsMessage.py
+++ b/hydrus/client/gui/ClientGUIDialogsMessage.py
@@ -4,7 +4,8 @@
from qtpy import QtWidgets as QW
from hydrus.core import HydrusData
-from hydrus.core import HydrusGlobals as HG
+
+from hydrus.client import ClientGlobals as CG
# This holds common calls for the various QMessageBox dialogs
# a thread can call these safely and they'll block
@@ -33,9 +34,9 @@ def ShowDialog( dialog_call: typing.Callable, win: typing.Optional[ QW.QWidget ]
else:
- qt_obj = HG.client_controller.app if win is None else win
+ qt_obj = CG.client_controller.app if win is None else win
- HG.client_controller.CallBlockingToQt( qt_obj, dialog_call, win, title, message )
+ CG.client_controller.CallBlockingToQt( qt_obj, dialog_call, win, title, message )
diff --git a/hydrus/client/gui/ClientGUIDialogsQuick.py b/hydrus/client/gui/ClientGUIDialogsQuick.py
index 4d173d300..834bac307 100644
--- a/hydrus/client/gui/ClientGUIDialogsQuick.py
+++ b/hydrus/client/gui/ClientGUIDialogsQuick.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientPaths
from hydrus.client.gui import ClientGUIScrolledPanelsButtonQuestions
from hydrus.client.gui import ClientGUIScrolledPanelsEdit
@@ -105,7 +106,7 @@ def qt_fire_button():
while not HydrusTime.TimeHasPassed( time_to_fire ):
- job = HG.client_controller.CallLaterQtSafe( dlg, 0.0, 'dialog auto yes/no title set', qt_set_title )
+ job = CG.client_controller.CallLaterQtSafe( dlg, 0.0, 'dialog auto yes/no title set', qt_set_title )
if job.IsDead(): # window closed
@@ -115,7 +116,7 @@ def qt_fire_button():
time.sleep( 1 )
- job = HG.client_controller.CallLaterQtSafe( dlg, 0.0, 'dialog auto yes/no fire', qt_fire_button )
+ job = CG.client_controller.CallLaterQtSafe( dlg, 0.0, 'dialog auto yes/no fire', qt_fire_button )
def GetYesNo( win, message, title = 'Are you sure?', yes_label = 'yes', no_label = 'no', auto_yes_time = None, auto_no_time = None, check_for_cancelled = False ):
@@ -130,11 +131,11 @@ def GetYesNo( win, message, title = 'Are you sure?', yes_label = 'yes', no_label
if auto_yes_time is not None:
- HG.client_controller.CallToThread( run_auto_yes_no_gubbins, dlg, HydrusTime.GetNow() + auto_yes_time, dlg.windowTitle(), 'auto-yes', QW.QDialog.Accepted )
+ CG.client_controller.CallToThread( run_auto_yes_no_gubbins, dlg, HydrusTime.GetNow() + auto_yes_time, dlg.windowTitle(), 'auto-yes', QW.QDialog.Accepted )
elif auto_no_time is not None:
- HG.client_controller.CallToThread( run_auto_yes_no_gubbins, dlg, HydrusTime.GetNow() + auto_no_time, dlg.windowTitle(), 'auto-no', QW.QDialog.Rejected )
+ CG.client_controller.CallToThread( run_auto_yes_no_gubbins, dlg, HydrusTime.GetNow() + auto_no_time, dlg.windowTitle(), 'auto-no', QW.QDialog.Rejected )
@@ -244,7 +245,7 @@ def SelectServiceKey( service_types = None, service_keys = None, unallowed = Non
if service_keys is None:
- services = HG.client_controller.services_manager.GetServices( service_types )
+ services = CG.client_controller.services_manager.GetServices( service_types )
service_keys = [ service.GetServiceKey() for service in services ]
@@ -268,13 +269,13 @@ def SelectServiceKey( service_types = None, service_keys = None, unallowed = Non
else:
- services = { HG.client_controller.services_manager.GetService( service_key ) for service_key in service_keys }
+ services = { CG.client_controller.services_manager.GetService( service_key ) for service_key in service_keys }
choice_tuples = [ ( service.GetName(), service.GetServiceKey() ) for service in services ]
try:
- tlw = HG.client_controller.GetMainTLW()
+ tlw = CG.client_controller.GetMainTLW()
service_key = SelectFromList( tlw, message, choice_tuples )
diff --git a/hydrus/client/gui/ClientGUIDownloaders.py b/hydrus/client/gui/ClientGUIDownloaders.py
index cce3c5011..fb2f3f75c 100644
--- a/hydrus/client/gui/ClientGUIDownloaders.py
+++ b/hydrus/client/gui/ClientGUIDownloaders.py
@@ -12,6 +12,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDefaults
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientStrings
from hydrus.client.gui import ClientGUIDialogs
from hydrus.client.gui import ClientGUIDialogsMessage
@@ -365,7 +366,7 @@ def _UpdateExampleURL( self ):
example_url = gug.GetExampleURL()
- example_url = HG.client_controller.network_engine.domain_manager.NormaliseURL( example_url )
+ example_url = CG.client_controller.network_engine.domain_manager.NormaliseURL( example_url )
self._example_url.setText( example_url )
@@ -386,7 +387,7 @@ def _UpdateExampleURL( self ):
try:
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( example_url )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( example_url )
if url_class is None:
@@ -706,9 +707,9 @@ def _ConvertGUGToListCtrlTuples( self, gug ):
try:
- example_url = HG.client_controller.network_engine.domain_manager.NormaliseURL( example_url )
+ example_url = CG.client_controller.network_engine.domain_manager.NormaliseURL( example_url )
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( example_url )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( example_url )
except:
diff --git a/hydrus/client/gui/ClientGUIDragDrop.py b/hydrus/client/gui/ClientGUIDragDrop.py
index 8ce7ee1b2..3a7fb4fb1 100644
--- a/hydrus/client/gui/ClientGUIDragDrop.py
+++ b/hydrus/client/gui/ClientGUIDragDrop.py
@@ -6,11 +6,11 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusPaths
from hydrus.core import HydrusTemp
from hydrus.core import HydrusText
+from hydrus.client import ClientGlobals as CG
from hydrus.client.exporting import ClientExportingFiles
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import QtPorting as QP
@@ -45,13 +45,13 @@ def DoFileExportDragDrop( window, page_key, media, alt_down ):
#
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
do_secret_discord_dnd_fix = new_options.GetBoolean( 'secret_discord_dnd_fix' ) and alt_down
#
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
original_paths = []
media_and_original_paths = []
diff --git a/hydrus/client/gui/ClientGUIDuplicates.py b/hydrus/client/gui/ClientGUIDuplicates.py
index 7d278bcbf..5fe49a476 100644
--- a/hydrus/client/gui/ClientGUIDuplicates.py
+++ b/hydrus/client/gui/ClientGUIDuplicates.py
@@ -3,9 +3,8 @@
from qtpy import QtWidgets as QW
from hydrus.core import HydrusData
-from hydrus.core import HydrusGlobals as HG
-from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsQuick
def ClearFalsePositives( win, hashes ):
@@ -31,7 +30,7 @@ def ClearFalsePositives( win, hashes ):
if result == QW.QDialog.Accepted:
- HG.client_controller.Write( 'clear_false_positive_relations', hashes )
+ CG.client_controller.Write( 'clear_false_positive_relations', hashes )
def DissolveAlternateGroup( win, hashes ):
@@ -57,7 +56,7 @@ def DissolveAlternateGroup( win, hashes ):
if result == QW.QDialog.Accepted:
- HG.client_controller.Write( 'dissolve_alternates_group', hashes )
+ CG.client_controller.Write( 'dissolve_alternates_group', hashes )
def DissolveDuplicateGroup( win, hashes ):
@@ -83,7 +82,7 @@ def DissolveDuplicateGroup( win, hashes ):
if result == QW.QDialog.Accepted:
- HG.client_controller.Write( 'dissolve_duplicates_group', hashes )
+ CG.client_controller.Write( 'dissolve_duplicates_group', hashes )
def RemoveFromAlternateGroup( win, hashes ):
@@ -109,7 +108,7 @@ def RemoveFromAlternateGroup( win, hashes ):
if result == QW.QDialog.Accepted:
- HG.client_controller.Write( 'remove_alternates_member', hashes )
+ CG.client_controller.Write( 'remove_alternates_member', hashes )
def RemoveFromDuplicateGroup( win, hashes ):
@@ -135,7 +134,7 @@ def RemoveFromDuplicateGroup( win, hashes ):
if result == QW.QDialog.Accepted:
- HG.client_controller.Write( 'remove_duplicates_member', hashes )
+ CG.client_controller.Write( 'remove_duplicates_member', hashes )
def RemovePotentials( win, hashes ):
@@ -157,7 +156,7 @@ def RemovePotentials( win, hashes ):
if result == QW.QDialog.Accepted:
- HG.client_controller.Write( 'remove_potential_pairs', hashes )
+ CG.client_controller.Write( 'remove_potential_pairs', hashes )
def ResetPotentialSearch( win, hashes ):
@@ -179,6 +178,6 @@ def ResetPotentialSearch( win, hashes ):
if result == QW.QDialog.Accepted:
- HG.client_controller.Write( 'reset_potential_search_status', hashes )
+ CG.client_controller.Write( 'reset_potential_search_status', hashes )
diff --git a/hydrus/client/gui/ClientGUIFileSeedCache.py b/hydrus/client/gui/ClientGUIFileSeedCache.py
index 90a8cb280..3db7787c2 100644
--- a/hydrus/client/gui/ClientGUIFileSeedCache.py
+++ b/hydrus/client/gui/ClientGUIFileSeedCache.py
@@ -12,6 +12,7 @@
from hydrus.core import HydrusText
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientPaths
from hydrus.client import ClientSerialisable
@@ -74,7 +75,7 @@ def ExportToClipboard( file_seed_cache: ClientImportFileSeeds.FileSeedCache ):
payload = GetExportableSourcesString( file_seed_cache )
- HG.client_controller.pub( 'clipboard', 'text', payload )
+ CG.client_controller.pub( 'clipboard', 'text', payload )
def ExportToPNG( win: QW.QWidget, file_seed_cache: ClientImportFileSeeds.FileSeedCache ):
@@ -93,7 +94,7 @@ def ImportFromClipboard( win: QW.QWidget, file_seed_cache: ClientImportFileSeeds
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -213,7 +214,7 @@ def ShowFilesInNewPage( file_seed_cache: ClientImportFileSeeds.FileSeedCache, sh
location_context = ClientLocation.LocationContext.STATICCreateSimple( CC.COMBINED_LOCAL_MEDIA_SERVICE_KEY )
- HG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes )
+ CG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes )
@@ -410,7 +411,7 @@ def _CopySelectedNotes( self ):
text = separator.join( notes )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -424,7 +425,7 @@ def _CopySelectedFileSeedData( self ):
text = separator.join( ( file_seed.file_seed_data for file_seed in file_seeds ) )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -694,7 +695,7 @@ def _SetSelected( self, status_to_set ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_update )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -723,7 +724,7 @@ def _ShowSelectionInNewPage( self ):
location_context = ClientLocation.LocationContext.STATICCreateSimple( CC.COMBINED_LOCAL_MEDIA_SERVICE_KEY )
- HG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes )
+ CG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes )
@@ -908,7 +909,7 @@ def __init__( self, parent, controller, page_key = None ):
#
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
def _GetFileSeedCache( self ):
@@ -985,7 +986,7 @@ def TIMERUIUpdate( self ):
do_it_anyway = True # to update the gauge
- HG.client_controller.pub( 'refresh_page_name', self._page_key )
+ CG.client_controller.pub( 'refresh_page_name', self._page_key )
diff --git a/hydrus/client/gui/ClientGUIFrames.py b/hydrus/client/gui/ClientGUIFrames.py
index 1e6ba80c2..a5a862d75 100644
--- a/hydrus/client/gui/ClientGUIFrames.py
+++ b/hydrus/client/gui/ClientGUIFrames.py
@@ -5,6 +5,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUITopLevelWindows
from hydrus.client.gui import QtPorting as QP
@@ -15,9 +16,9 @@ def __init__( self, key_type, keys ):
if key_type == 'registration': title = 'Registration Tokens'
elif key_type == 'access': title = 'Access Keys'
- tlw = HG.client_controller.GetMainTLW()
+ tlw = CG.client_controller.GetMainTLW()
- ClientGUITopLevelWindows.Frame.__init__( self, tlw, HG.client_controller.PrepStringForDisplay( title ) )
+ ClientGUITopLevelWindows.Frame.__init__( self, tlw, CG.client_controller.PrepStringForDisplay( title ) )
self._key_type = key_type
self._keys = keys
diff --git a/hydrus/client/gui/ClientGUIFunctions.py b/hydrus/client/gui/ClientGUIFunctions.py
index 678a4523a..16a4fe62b 100644
--- a/hydrus/client/gui/ClientGUIFunctions.py
+++ b/hydrus/client/gui/ClientGUIFunctions.py
@@ -10,6 +10,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusText
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import QtInit
from hydrus.client.gui import QtPorting as QP
@@ -427,7 +428,7 @@ def SetBitmapButtonBitmap( button, bitmap ):
def SetFocusLater( win: QW.QWidget ):
- HG.client_controller.CallAfterQtSafe( win, 'set focus to a window', win.setFocus, QC.Qt.OtherFocusReason )
+ CG.client_controller.CallAfterQtSafe( win, 'set focus to a window', win.setFocus, QC.Qt.OtherFocusReason )
def TLWIsActive( window ):
@@ -457,7 +458,7 @@ def TLWOrChildIsActive( win ):
def UpdateAppDisplayName():
- app_display_name = HG.client_controller.new_options.GetString( 'app_display_name' )
+ app_display_name = CG.client_controller.new_options.GetString( 'app_display_name' )
QW.QApplication.instance().setApplicationDisplayName( '{} {}'.format( app_display_name, HC.SOFTWARE_VERSION ) )
diff --git a/hydrus/client/gui/ClientGUIGallerySeedLog.py b/hydrus/client/gui/ClientGUIGallerySeedLog.py
index 61fff2813..fbfe8e00e 100644
--- a/hydrus/client/gui/ClientGUIGallerySeedLog.py
+++ b/hydrus/client/gui/ClientGUIGallerySeedLog.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusText
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientPaths
from hydrus.client import ClientSerialisable
from hydrus.client import ClientTime
@@ -56,7 +57,7 @@ def ImportFromClipboard( win: QW.QWidget, gallery_seed_log: ClientImportGalleryS
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -169,7 +170,7 @@ def ExportToClipboard( gallery_seed_log: ClientImportGallerySeeds.GallerySeedLog
payload = GetExportableURLsString( gallery_seed_log )
- HG.client_controller.pub( 'clipboard', 'text', payload )
+ CG.client_controller.pub( 'clipboard', 'text', payload )
def RetryErrors( win: QW.QWidget, gallery_seed_log: ClientImportGallerySeeds.GallerySeedLog ):
@@ -318,7 +319,7 @@ def _CopySelectedGalleryURLs( self ):
text = separator.join( ( gallery_seed.url for gallery_seed in gallery_seeds ) )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -342,7 +343,7 @@ def _CopySelectedNotes( self ):
text = separator.join( notes )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -634,7 +635,7 @@ def __init__( self, parent, controller, read_only: bool, can_generate_more_pages
#
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
def _GetGallerySeedLog( self ):
diff --git a/hydrus/client/gui/ClientGUILocatorSearchProviders.py b/hydrus/client/gui/ClientGUILocatorSearchProviders.py
index 8e7973fe1..fa4ae42ae 100644
--- a/hydrus/client/gui/ClientGUILocatorSearchProviders.py
+++ b/hydrus/client/gui/ClientGUILocatorSearchProviders.py
@@ -1,8 +1,10 @@
from hydrus.client.gui.QLocator import QAbstractLocatorSearchProvider, QCalculatorSearchProvider, QLocatorSearchResult
-from hydrus.core import HydrusGlobals as HG
-from qtpy import QtWidgets as QW
+
from html import escape
+from qtpy import QtWidgets as QW
+
+from hydrus.client import ClientGlobals as CG
def highlight_result_text( result_text: str, query_text: str ):
@@ -67,7 +69,7 @@ def resultSelected( self, resultID: int ):
if page:
- HG.client_controller.gui._notebook.ShowPage( page )
+ CG.client_controller.gui._notebook.ShowPage( page )
self.result_ids_to_pages = {}
@@ -77,12 +79,12 @@ def processQuery( self, query: str, context, jobID: int ):
self.result_ids_to_pages = {}
- if not HG.client_controller.gui or not HG.client_controller.gui._notebook:
+ if not CG.client_controller.gui or not CG.client_controller.gui._notebook:
return
- tab_widget = HG.client_controller.gui._notebook
+ tab_widget = CG.client_controller.gui._notebook
# helper function to traverse tab tree and generate entries
def get_child_tabs( tab_widget: QW.QTabWidget, parent_name: str ) -> list:
@@ -177,7 +179,7 @@ def resultSelected( self, resultID: int ):
def processQuery( self, query: str, context, jobID: int ):
- if not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
return
@@ -188,11 +190,11 @@ def processQuery( self, query: str, context, jobID: int ):
self.result_ids_to_pages = {}
- if not HG.client_controller.gui or not HG.client_controller.gui._menubar:
+ if not CG.client_controller.gui or not CG.client_controller.gui._menubar:
return
- menubar = HG.client_controller.gui._menubar
+ menubar = CG.client_controller.gui._menubar
# helper function to traverse menu and generate entries
# TODO: need to filter out menu items not suitable for display in locator
@@ -298,7 +300,7 @@ def resultSelected( self, resultID: int ):
def processQuery( self, query: str, context, jobID: int ):
- if not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
return
@@ -310,11 +312,11 @@ def processQuery( self, query: str, context, jobID: int ):
self.result_ids_to_pages = {}
self.menu = None
- if not HG.client_controller.gui or not HG.client_controller.gui._notebook:
+ if not CG.client_controller.gui or not CG.client_controller.gui._notebook:
return
- media_page = HG.client_controller.gui._notebook.GetCurrentMediaPage()
+ media_page = CG.client_controller.gui._notebook.GetCurrentMediaPage()
if not media_page or not media_page._media_panel:
diff --git a/hydrus/client/gui/ClientGUILogin.py b/hydrus/client/gui/ClientGUILogin.py
index b280b36d2..0b89a5080 100644
--- a/hydrus/client/gui/ClientGUILogin.py
+++ b/hydrus/client/gui/ClientGUILogin.py
@@ -13,6 +13,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDefaults
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client.gui import ClientGUIDialogs
from hydrus.client.gui import ClientGUIDialogsMessage
@@ -1285,7 +1286,7 @@ def __init__( self, parent, test_result ):
def _CopyData( self ):
- HG.client_controller.pub( 'clipboard', 'text', self._downloaded_data )
+ CG.client_controller.pub( 'clipboard', 'text', self._downloaded_data )
class EditLoginScriptPanel( ClientGUIScrolledPanels.EditPanel ):
@@ -1657,12 +1658,12 @@ def do_it( login_script, domain, credentials, network_job_presentation_context_f
bandwidth_manager = ClientNetworkingBandwidth.NetworkBandwidthManager()
session_manager = ClientNetworkingSessions.NetworkSessionManager()
- domain_manager = HG.client_controller.network_engine.domain_manager.Duplicate() # keep custom headers from current domain stuff
+ domain_manager = CG.client_controller.network_engine.domain_manager.Duplicate() # keep custom headers from current domain stuff
login_manager = ClientNetworkingLogin.NetworkLoginManager()
- network_engine = ClientNetworking.NetworkEngine( HG.client_controller, bandwidth_manager, session_manager, domain_manager, login_manager )
+ network_engine = ClientNetworking.NetworkEngine( CG.client_controller, bandwidth_manager, session_manager, domain_manager, login_manager )
- HG.client_controller.CallToThreadLongRunning( network_engine.MainLoop )
+ CG.client_controller.CallToThreadLongRunning( network_engine.MainLoop )
network_context = ClientNetworkingContexts.NetworkContext.STATICGenerateForDomain( domain )
@@ -1754,7 +1755,7 @@ def do_it( login_script, domain, credentials, network_job_presentation_context_f
self._currently_testing = True
- HG.client_controller.CallToThread( do_it, login_script, self._test_domain, self._test_credentials, network_job_presentation_context_factory )
+ CG.client_controller.CallToThread( do_it, login_script, self._test_domain, self._test_credentials, network_job_presentation_context_factory )
def _EditExampleDomainsInfo( self ):
diff --git a/hydrus/client/gui/ClientGUIMedia.py b/hydrus/client/gui/ClientGUIMedia.py
index e9a70c40c..3442bcf73 100644
--- a/hydrus/client/gui/ClientGUIMedia.py
+++ b/hydrus/client/gui/ClientGUIMedia.py
@@ -12,6 +12,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientPaths
from hydrus.client import ClientThreading
@@ -56,7 +57,7 @@ def CopyHashesToClipboard( win: QW.QWidget, hash_type: str, medias: typing.Seque
num_hashes = len( sha256_hashes )
num_remote_medias = len( [ not media.GetLocationsManager().IsLocal() for media in flat_media ] )
- source_to_desired = HG.client_controller.Read( 'file_hashes', sha256_hashes, 'sha256', hash_type )
+ source_to_desired = CG.client_controller.Read( 'file_hashes', sha256_hashes, 'sha256', hash_type )
desired_hashes = [ source_to_desired[ source_hash ] for source_hash in sha256_hashes if source_hash in source_to_desired ]
@@ -98,20 +99,20 @@ def CopyHashesToClipboard( win: QW.QWidget, hash_type: str, medias: typing.Seque
text_lines = desired_hashes
- if HG.client_controller.new_options.GetBoolean( 'prefix_hash_when_copying' ):
+ if CG.client_controller.new_options.GetBoolean( 'prefix_hash_when_copying' ):
text_lines = [ '{}:{}'.format( hash_type, hex_hash ) for hex_hash in text_lines ]
hex_hashes_text = os.linesep.join( text_lines )
- HG.client_controller.pub( 'clipboard', 'text', hex_hashes_text )
+ CG.client_controller.pub( 'clipboard', 'text', hex_hashes_text )
job_status = ClientThreading.JobStatus()
job_status.SetStatusText( '{} {} hashes copied'.format( HydrusData.ToHumanInt( len( desired_hashes ) ), hash_type ) )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
job_status.FinishAndDismiss( 2 )
@@ -131,7 +132,7 @@ def CopyMediaURLs( medias ):
urls_string = os.linesep.join( urls )
- HG.client_controller.pub( 'clipboard', 'text', urls_string )
+ CG.client_controller.pub( 'clipboard', 'text', urls_string )
def CopyMediaURLClassURLs( medias, url_class ):
@@ -144,7 +145,7 @@ def CopyMediaURLClassURLs( medias, url_class ):
for url in media_urls:
# can't do 'url_class.matches', as it will match too many
- if HG.client_controller.network_engine.domain_manager.GetURLClass( url ) == url_class:
+ if CG.client_controller.network_engine.domain_manager.GetURLClass( url ) == url_class:
urls.add( url )
@@ -155,7 +156,7 @@ def CopyMediaURLClassURLs( medias, url_class ):
urls_string = os.linesep.join( urls )
- HG.client_controller.pub( 'clipboard', 'text', urls_string )
+ CG.client_controller.pub( 'clipboard', 'text', urls_string )
def DoClearFileViewingStats( win: QW.QWidget, flat_medias: typing.Collection[ ClientMedia.MediaSingleton ] ):
@@ -183,7 +184,7 @@ def DoClearFileViewingStats( win: QW.QWidget, flat_medias: typing.Collection[ Cl
content_update = ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILE_VIEWING_STATS, HC.CONTENT_UPDATE_DELETE, hashes )
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_update ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_update ) )
def DoOpenKnownURLFromShortcut( win, media ):
@@ -199,7 +200,7 @@ def DoOpenKnownURLFromShortcut( win, media ):
try:
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( url )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( url )
except HydrusExceptions.URLClassException:
@@ -249,7 +250,7 @@ def DoOpenKnownURLFromShortcut( win, media ):
def EditDuplicateContentMergeOptions( win: QW.QWidget, duplicate_type: int ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
duplicate_content_merge_options = new_options.GetDuplicateContentMergeOptions( duplicate_type )
@@ -273,11 +274,11 @@ def OpenExternally( media ):
hash = media.GetHash()
mime = media.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
launch_path = new_options.GetMimeLaunch( mime )
@@ -289,7 +290,7 @@ def OpenFileLocation( media ):
hash = media.GetHash()
mime = media.GetMime()
- path = HG.client_controller.client_files_manager.GetFilePath( hash, mime )
+ path = CG.client_controller.client_files_manager.GetFilePath( hash, mime )
HydrusPaths.OpenFileLocation( path )
@@ -307,7 +308,7 @@ def OpenURLs( urls ):
message += ' This will take some time.'
- tlw = HG.client_controller.GetMainTLW()
+ tlw = CG.client_controller.GetMainTLW()
result = ClientGUIDialogsQuick.GetYesNo( tlw, message )
@@ -329,7 +330,7 @@ def do_it( urls ):
job_status.SetStatusTitle( 'Opening URLs' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
try:
@@ -363,7 +364,7 @@ def do_it( urls ):
- HG.client_controller.CallToThread( do_it, urls )
+ CG.client_controller.CallToThread( do_it, urls )
def OpenMediaURLs( medias ):
@@ -389,7 +390,7 @@ def OpenMediaURLClassURLs( medias, url_class ):
for url in media_urls:
# can't do 'url_class.matches', as it will match too many
- if HG.client_controller.network_engine.domain_manager.GetURLClass( url ) == url_class:
+ if CG.client_controller.network_engine.domain_manager.GetURLClass( url ) == url_class:
urls.add( url )
@@ -403,23 +404,23 @@ def ShowDuplicatesInNewPage( location_context: ClientLocation.LocationContext, h
# TODO: this can be replaced by a call to the MediaResult when it holds these hashes
# don't forget to return itself in position 0!
- hashes = HG.client_controller.Read( 'file_duplicate_hashes', location_context, hash, duplicate_type )
+ hashes = CG.client_controller.Read( 'file_duplicate_hashes', location_context, hash, duplicate_type )
if hashes is not None and len( hashes ) > 1:
- HG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes )
+ CG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes )
else:
location_context = ClientLocation.LocationContext.STATICCreateSimple( CC.COMBINED_FILE_SERVICE_KEY )
- hashes = HG.client_controller.Read( 'file_duplicate_hashes', location_context, hash, duplicate_type )
+ hashes = CG.client_controller.Read( 'file_duplicate_hashes', location_context, hash, duplicate_type )
if hashes is not None and len( hashes ) > 1:
HydrusData.ShowText( 'Could not find the members of this group in this location, so searched all known files and found more.' )
- HG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes )
+ CG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes )
else:
diff --git a/hydrus/client/gui/ClientGUIMediaActions.py b/hydrus/client/gui/ClientGUIMediaActions.py
index ce14db2f0..430cc7cba 100644
--- a/hydrus/client/gui/ClientGUIMediaActions.py
+++ b/hydrus/client/gui/ClientGUIMediaActions.py
@@ -16,6 +16,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientFiles
from hydrus.client import ClientPDFHandling
from hydrus.client import ClientThreading
@@ -42,7 +43,7 @@ def ApplyContentApplicationCommandToMedia( parent: QW.QWidget, command: CAC.Appl
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
except HydrusExceptions.DataMissing:
@@ -116,7 +117,7 @@ def ApplyContentApplicationCommandToMedia( parent: QW.QWidget, command: CAC.Appl
if len( content_updates ) > 0:
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( service_key, content_updates ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( service_key, content_updates ) )
@@ -144,7 +145,7 @@ def ClearDeleteRecord( win, media ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_update )
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
@@ -172,7 +173,7 @@ def EditFileNotes( win: QW.QWidget, media: ClientMedia.MediaSingleton, name_to_s
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( CC.LOCAL_NOTES_SERVICE_KEY, content_updates )
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
@@ -193,7 +194,7 @@ def EditFileTimestamps( win: QW.QWidget, ordered_medias: typing.List[ ClientMedi
if content_update_package.HasContent():
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
result = panel.GetFileModifiedUpdateData()
@@ -223,7 +224,7 @@ def do_it():
if not showed_popup and HydrusTime.TimeHasPassed( time_started + 3 ):
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
showed_popup = True
@@ -235,13 +236,13 @@ def do_it():
final_time_ms = file_modified_timestamp_ms + ( i * step_ms )
- HG.client_controller.client_files_manager.UpdateFileModifiedTimestampMS( m, final_time_ms )
+ CG.client_controller.client_files_manager.UpdateFileModifiedTimestampMS( m, final_time_ms )
job_status.FinishAndDismiss()
- HG.client_controller.CallToThread( do_it )
+ CG.client_controller.CallToThread( do_it )
@@ -494,7 +495,7 @@ def GetContentUpdatesForAppliedContentApplicationCommandTags( parent: QW.QWidget
def GetLocalFileActionServiceKeys( media: typing.Collection[ ClientMedia.MediaSingleton ] ):
- local_media_file_service_keys = set( HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) ) )
+ local_media_file_service_keys = set( CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) ) )
local_duplicable_to_file_service_keys = set()
local_moveable_from_and_to_file_service_keys = set()
@@ -529,7 +530,7 @@ def GetLocalFileActionServiceKeys( media: typing.Collection[ ClientMedia.MediaSi
def MoveOrDuplicateLocalFiles( win: QW.QWidget, dest_service_key: bytes, action: int, media: typing.Collection[ ClientMedia.MediaSingleton ], source_service_key: typing.Optional[ bytes ] = None ):
- dest_service_name = HG.client_controller.services_manager.GetName( dest_service_key )
+ dest_service_name = CG.client_controller.services_manager.GetName( dest_service_key )
applicable_media = [ m for m in media if m.GetLocationsManager().IsLocal() and dest_service_key not in m.GetLocationsManager().GetCurrent() and m.GetMime() not in HC.HYDRUS_UPDATE_FILES ]
@@ -540,12 +541,12 @@ def MoveOrDuplicateLocalFiles( win: QW.QWidget, dest_service_key: bytes, action:
( local_duplicable_to_file_service_keys, local_moveable_from_and_to_file_service_keys ) = GetLocalFileActionServiceKeys( media )
- do_yes_no = do_yes_no = HG.client_controller.new_options.GetBoolean( 'confirm_multiple_local_file_services_copy' )
+ do_yes_no = do_yes_no = CG.client_controller.new_options.GetBoolean( 'confirm_multiple_local_file_services_copy' )
yes_no_text = 'Add {} files to {}?'.format( HydrusData.ToHumanInt( len( applicable_media ) ), dest_service_name )
if action == HC.CONTENT_UPDATE_MOVE:
- do_yes_no = HG.client_controller.new_options.GetBoolean( 'confirm_multiple_local_file_services_move' )
+ do_yes_no = CG.client_controller.new_options.GetBoolean( 'confirm_multiple_local_file_services_move' )
local_moveable_from_and_to_file_service_keys = { pair for pair in local_moveable_from_and_to_file_service_keys if pair[1] == dest_service_key }
@@ -584,7 +585,7 @@ def MoveOrDuplicateLocalFiles( win: QW.QWidget, dest_service_key: bytes, action:
for potential_source_service_key in potential_source_service_keys:
- potential_source_service_name = HG.client_controller.services_manager.GetName( potential_source_service_key )
+ potential_source_service_name = CG.client_controller.services_manager.GetName( potential_source_service_key )
text = 'move {} in "{}" to "{}"'.format( len( potential_source_service_keys_to_applicable_media[ potential_source_service_key ] ), potential_source_service_name, dest_service_name )
@@ -606,7 +607,7 @@ def MoveOrDuplicateLocalFiles( win: QW.QWidget, dest_service_key: bytes, action:
- source_service_name = HG.client_controller.services_manager.GetName( source_service_key )
+ source_service_name = CG.client_controller.services_manager.GetName( source_service_key )
applicable_media = potential_source_service_keys_to_applicable_media[ source_service_key ]
@@ -644,7 +645,7 @@ def work_callable():
if num_to_do > BLOCK_SIZE:
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
now_ms = HydrusTime.GetNowMS()
@@ -679,7 +680,7 @@ def work_callable():
content_updates.append( ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_UNDELETE, undelete_hashes ) )
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( dest_service_key, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( dest_service_key, content_updates ) )
if action == HC.CONTENT_UPDATE_MOVE:
@@ -687,7 +688,7 @@ def work_callable():
content_updates = [ ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_DELETE_FROM_SOURCE_AFTER_MIGRATE, block_of_hashes, reason = 'Moved to {}'.format( dest_service_name ) ) ]
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( source_service_key, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( source_service_key, content_updates ) )
pauser.Pause()
@@ -742,7 +743,7 @@ def work_callable():
if num_to_do > BLOCK_SIZE:
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
for ( i, block_of_media ) in enumerate( HydrusLists.SplitListIntoChunks( medias, BLOCK_SIZE ) ):
@@ -757,7 +758,7 @@ def work_callable():
hashes = { media.GetHash() for media in block_of_media }
- HG.client_controller.WriteSynchronous( 'force_filetype', hashes, forced_mime )
+ CG.client_controller.WriteSynchronous( 'force_filetype', hashes, forced_mime )
hashes_we_needed_to_dupe = set()
@@ -773,7 +774,7 @@ def work_callable():
mime_to_move_to = media.GetFileInfoManager().GetOriginalMime()
- needed_to_dupe_the_file = HG.client_controller.client_files_manager.ChangeFileExt( hash, current_mime, mime_to_move_to )
+ needed_to_dupe_the_file = CG.client_controller.client_files_manager.ChangeFileExt( hash, current_mime, mime_to_move_to )
if needed_to_dupe_the_file:
@@ -783,7 +784,7 @@ def work_callable():
if len( hashes_we_needed_to_dupe ) > 0:
- HG.client_controller.WriteSynchronous( 'file_maintenance_add_jobs_hashes', hashes_we_needed_to_dupe, ClientFiles.REGENERATE_FILE_DATA_JOB_DELETE_NEIGHBOUR_DUPES, HydrusTime.GetNow() + 3600 )
+ CG.client_controller.WriteSynchronous( 'file_maintenance_add_jobs_hashes', hashes_we_needed_to_dupe, ClientFiles.REGENERATE_FILE_DATA_JOB_DELETE_NEIGHBOUR_DUPES, HydrusTime.GetNow() + 3600 )
pauser.Pause()
@@ -821,7 +822,7 @@ def ShowFileEmbeddedMetadata( win: QW.QWidget, media: ClientMedia.MediaSingleton
hash = media.GetHash()
mime = media.GetMime()
- path = HG.client_controller.client_files_manager.GetFilePath( hash, mime )
+ path = CG.client_controller.client_files_manager.GetFilePath( hash, mime )
if mime == HC.APPLICATION_PDF:
@@ -872,11 +873,11 @@ def ShowFileEmbeddedMetadata( win: QW.QWidget, media: ClientMedia.MediaSingleton
def UndeleteFiles( hashes ):
- local_file_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_file_service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
for chunk_of_hashes in HydrusData.SplitIteratorIntoChunks( hashes, 64 ):
- media_results = HG.client_controller.Read( 'media_results', chunk_of_hashes )
+ media_results = CG.client_controller.Read( 'media_results', chunk_of_hashes )
service_keys_to_hashes = collections.defaultdict( list )
@@ -903,7 +904,7 @@ def UndeleteFiles( hashes ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( service_key, content_update )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -919,7 +920,7 @@ def UndeleteMedia( win, media ):
media_deleted_service_keys = HydrusData.MassUnion( ( m.GetLocationsManager().GetDeleted() for m in undeletable_media ) )
- local_file_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_file_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) )
undeletable_services = [ local_file_service for local_file_service in local_file_services if local_file_service.GetServiceKey() in media_deleted_service_keys ]
@@ -938,7 +939,7 @@ def UndeleteMedia( win, media ):
if len( choice_tuples ) > 1:
- service = HG.client_controller.services_manager.GetService( CC.COMBINED_LOCAL_MEDIA_SERVICE_KEY )
+ service = CG.client_controller.services_manager.GetService( CC.COMBINED_LOCAL_MEDIA_SERVICE_KEY )
choice_tuples.append( ( 'all the above', service, 'Undelete back to all services the files have been deleted from.' ) )
@@ -985,7 +986,7 @@ def UndeleteMedia( win, media ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( service_key, content_update )
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
diff --git a/hydrus/client/gui/ClientGUIMediaControls.py b/hydrus/client/gui/ClientGUIMediaControls.py
index aa8df0c92..00271a017 100644
--- a/hydrus/client/gui/ClientGUIMediaControls.py
+++ b/hydrus/client/gui/ClientGUIMediaControls.py
@@ -1,10 +1,8 @@
from qtpy import QtCore as QC
from qtpy import QtWidgets as QW
-from qtpy import QtGui as QG
-
-from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import QtPorting as QP
from hydrus.client.gui.widgets import ClientGUICommon
@@ -29,25 +27,25 @@ def ChangeVolume( volume_type, volume ):
( mute_option_name, volume_option_name ) = volume_types_to_option_names[ volume_type ]
- HG.client_controller.new_options.SetInteger( volume_option_name, volume )
+ CG.client_controller.new_options.SetInteger( volume_option_name, volume )
- HG.client_controller.pub( 'new_audio_volume' )
+ CG.client_controller.pub( 'new_audio_volume' )
def FlipMute( volume_type ):
( mute_option_name, volume_option_name ) = volume_types_to_option_names[ volume_type ]
- HG.client_controller.new_options.FlipBoolean( mute_option_name )
+ CG.client_controller.new_options.FlipBoolean( mute_option_name )
- HG.client_controller.pub( 'new_audio_mute' )
+ CG.client_controller.pub( 'new_audio_mute' )
def SetMute( volume_type, mute ):
( mute_option_name, volume_option_name ) = volume_types_to_option_names[ volume_type ]
- HG.client_controller.new_options.SetBoolean( mute_option_name, mute )
+ CG.client_controller.new_options.SetBoolean( mute_option_name, mute )
- HG.client_controller.pub( 'new_audio_mute' )
+ CG.client_controller.pub( 'new_audio_mute' )
class AudioMuteButton( ClientGUICommon.BetterBitmapButton ):
@@ -59,14 +57,14 @@ def __init__( self, parent, volume_type ):
ClientGUICommon.BetterBitmapButton.__init__( self, parent, pixmap, FlipMute, self._volume_type )
- HG.client_controller.sub( self, 'UpdateMute', 'new_audio_mute' )
+ CG.client_controller.sub( self, 'UpdateMute', 'new_audio_mute' )
def _GetCorrectPixmap( self ):
( mute_option_name, volume_option_name ) = volume_types_to_option_names[ self._volume_type ]
- if HG.client_controller.new_options.GetBoolean( mute_option_name ):
+ if CG.client_controller.new_options.GetBoolean( mute_option_name ):
pixmap = CC.global_pixmaps().mute
@@ -165,7 +163,7 @@ def __init__( self, parent, canvas_type, direction = 'down' ):
self._specific_mute.setToolTip( 'Mute/unmute: {}'.format( CC.canvas_type_str_lookup[ self._canvas_type ] ) )
- if HG.client_controller.new_options.GetBoolean( option_to_use ):
+ if CG.client_controller.new_options.GetBoolean( option_to_use ):
slider_volume_type = volume_type
@@ -198,7 +196,7 @@ def __init__( self, parent, canvas_type, direction = 'down' ):
self.adjustSize()
- HG.client_controller.sub( self, 'NotifyNewOptions', 'notify_new_options' )
+ CG.client_controller.sub( self, 'NotifyNewOptions', 'notify_new_options' )
def DoShowHide( self ):
@@ -260,7 +258,7 @@ def NotifyNewOptions( self ):
volume_type = AUDIO_PREVIEW
- if HG.client_controller.new_options.GetBoolean( option_to_use ):
+ if CG.client_controller.new_options.GetBoolean( option_to_use ):
slider_volume_type = volume_type
@@ -300,7 +298,7 @@ def _GetCorrectValue( self ):
( mute_option_name, volume_option_name ) = volume_types_to_option_names[ self._volume_type ]
- return HG.client_controller.new_options.GetInteger( volume_option_name )
+ return CG.client_controller.new_options.GetInteger( volume_option_name )
def _VolumeSliderMoved( self ):
diff --git a/hydrus/client/gui/ClientGUIMediaMenus.py b/hydrus/client/gui/ClientGUIMediaMenus.py
index ac9319f06..528ac2073 100644
--- a/hydrus/client/gui/ClientGUIMediaMenus.py
+++ b/hydrus/client/gui/ClientGUIMediaMenus.py
@@ -11,6 +11,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientPaths
from hydrus.client.gui import ClientGUIMedia
@@ -31,22 +32,22 @@ def AddDuplicatesMenu( win: QW.QWidget, menu: QW.QMenu, location_context: Client
combined_local_location_context = ClientLocation.LocationContext.STATICCreateSimple( CC.COMBINED_LOCAL_FILE_SERVICE_KEY )
- if HG.client_controller.DBCurrentlyDoingJob():
+ if CG.client_controller.DBCurrentlyDoingJob():
file_duplicate_info = {}
all_local_files_file_duplicate_info = {}
else:
- file_duplicate_info = HG.client_controller.Read( 'file_duplicate_info', location_context, focused_hash )
+ file_duplicate_info = CG.client_controller.Read( 'file_duplicate_info', location_context, focused_hash )
- if location_context.current_service_keys.isdisjoint( HG.client_controller.services_manager.GetServiceKeys( HC.SPECIFIC_LOCAL_FILE_SERVICES ) ):
+ if location_context.current_service_keys.isdisjoint( CG.client_controller.services_manager.GetServiceKeys( HC.SPECIFIC_LOCAL_FILE_SERVICES ) ):
all_local_files_file_duplicate_info = {}
else:
- all_local_files_file_duplicate_info = HG.client_controller.Read( 'file_duplicate_info', combined_local_location_context, focused_hash )
+ all_local_files_file_duplicate_info = CG.client_controller.Read( 'file_duplicate_info', combined_local_location_context, focused_hash )
@@ -82,7 +83,7 @@ def AddDuplicatesMenu( win: QW.QWidget, menu: QW.QMenu, location_context: Client
if len( view_duplicate_relations_jobs ) > 1:
- label = '-for {}-'.format( job_location_context.ToString( HG.client_controller.services_manager.GetName ) )
+ label = '-for {}-'.format( job_location_context.ToString( CG.client_controller.services_manager.GetName ) )
ClientGUIMenus.AppendMenuLabel( duplicates_menu, label )
@@ -206,7 +207,7 @@ def AddDuplicatesMenu( win: QW.QWidget, menu: QW.QMenu, location_context: Client
ClientGUIMenus.AppendMenuItem( duplicates_edit_action_submenu, 'for ' + HC.duplicate_type_string_lookup[duplicate_type], 'Edit what happens when you set this status.', ClientGUIMedia.EditDuplicateContentMergeOptions, win, duplicate_type )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
ClientGUIMenus.AppendMenuItem( duplicates_edit_action_submenu, 'for ' + HC.duplicate_type_string_lookup[HC.DUPLICATE_ALTERNATE] + ' (advanced!)', 'Edit what happens when you set this status.', ClientGUIMedia.EditDuplicateContentMergeOptions, win, HC.DUPLICATE_ALTERNATE )
@@ -263,7 +264,7 @@ def AddDuplicatesMenu( win: QW.QWidget, menu: QW.QMenu, location_context: Client
if multiple_selected:
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
duplicates_multiple_dissolution_menu = ClientGUIMenus.GenerateMenu( duplicates_action_submenu )
@@ -295,7 +296,7 @@ def AddFileViewingStatsMenu( menu, medias: typing.Collection[ ClientMedia.Media
return
- view_style = HG.client_controller.new_options.GetInteger( 'file_viewing_stats_menu_display' )
+ view_style = CG.client_controller.new_options.GetInteger( 'file_viewing_stats_menu_display' )
if view_style == CC.FILE_VIEWING_STATS_MENU_DISPLAY_NONE:
@@ -365,7 +366,7 @@ def AddKnownURLsViewCopyMenu( win, menu, focus_media, selected_media = None ):
try:
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( url )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( url )
except HydrusExceptions.URLClassException:
@@ -422,7 +423,7 @@ def AddKnownURLsViewCopyMenu( win, menu, focus_media, selected_media = None ):
try:
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( url )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( url )
except HydrusExceptions.URLClassException:
@@ -489,7 +490,7 @@ def AddKnownURLsViewCopyMenu( win, menu, focus_media, selected_media = None ):
label = 'copy this file\'s ' + HydrusData.ToHumanInt( len( urls ) ) + ' recognised urls to your clipboard'
- ClientGUIMenus.AppendMenuItem( urls_copy_menu, label, 'Copy these urls to your clipboard.', HG.client_controller.pub, 'clipboard', 'text', urls_string )
+ ClientGUIMenus.AppendMenuItem( urls_copy_menu, label, 'Copy these urls to your clipboard.', CG.client_controller.pub, 'clipboard', 'text', urls_string )
if multiple_or_unmatching_focus_url_classes:
@@ -504,7 +505,7 @@ def AddKnownURLsViewCopyMenu( win, menu, focus_media, selected_media = None ):
label = 'copy this file\'s ' + HydrusData.ToHumanInt( len( urls ) ) + ' urls to your clipboard'
- ClientGUIMenus.AppendMenuItem( urls_copy_menu, label, 'Copy this url to your clipboard.', HG.client_controller.pub, 'clipboard', 'text', urls_string )
+ ClientGUIMenus.AppendMenuItem( urls_copy_menu, label, 'Copy this url to your clipboard.', CG.client_controller.pub, 'clipboard', 'text', urls_string )
# now by url match type
@@ -577,7 +578,7 @@ def AddLocalFilesMoveAddToMenu( win: QW.QWidget, menu: QW.QMenu, local_duplicabl
data = ( s_k, HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ADD, None )
)
- label = HG.client_controller.services_manager.GetName( s_k )
+ label = CG.client_controller.services_manager.GetName( s_k )
description = 'Duplicate the files to this local file service.'
call = HydrusData.Call( process_application_command_call, application_command )
@@ -607,7 +608,7 @@ def AddLocalFilesMoveAddToMenu( win: QW.QWidget, menu: QW.QMenu, local_duplicabl
data = ( dest_s_k, HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_MOVE, source_s_k )
)
- label = 'from {} to {}'.format( HG.client_controller.services_manager.GetName( source_s_k ), HG.client_controller.services_manager.GetName( dest_s_k ) )
+ label = 'from {} to {}'.format( CG.client_controller.services_manager.GetName( source_s_k ), CG.client_controller.services_manager.GetName( dest_s_k ) )
description = 'Add the files to the destination and delete from the source.'
call = HydrusData.Call( process_application_command_call, application_command )
@@ -682,7 +683,7 @@ def add_pretty_info_rows( m, rows ):
def AddServiceKeyLabelsToMenu( menu, service_keys, phrase ):
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
if len( service_keys ) == 1:
@@ -713,7 +714,7 @@ def AddServiceKeysToMenu( menu, service_keys, submenu_name, description, bare_ca
menu_tuples = []
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
for service_key in service_keys:
diff --git a/hydrus/client/gui/ClientGUIMenus.py b/hydrus/client/gui/ClientGUIMenus.py
index 6ceccfa11..05615b159 100644
--- a/hydrus/client/gui/ClientGUIMenus.py
+++ b/hydrus/client/gui/ClientGUIMenus.py
@@ -9,7 +9,8 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusProfiling
from hydrus.core import HydrusText
-from hydrus.core import HydrusTime
+
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import QtPorting as QP
@@ -114,7 +115,7 @@ def AppendMenuLabel( menu, label, description = '', copy_text = '' ):
menu.addAction( menu_item )
- BindMenuItem( menu_item, HG.client_controller.pub, 'clipboard', 'text', copy_text )
+ BindMenuItem( menu_item, CG.client_controller.pub, 'clipboard', 'text', copy_text )
return menu_item
@@ -202,7 +203,7 @@ def eventFilter( self, watched, event ):
if event.type() == QC.QEvent.StatusTip:
- QW.QApplication.instance().sendEvent( HG.client_controller.gui, event )
+ QW.QApplication.instance().sendEvent( CG.client_controller.gui, event )
return True
diff --git a/hydrus/client/gui/ClientGUIPanels.py b/hydrus/client/gui/ClientGUIPanels.py
index 640419c17..db7f4dd7e 100644
--- a/hydrus/client/gui/ClientGUIPanels.py
+++ b/hydrus/client/gui/ClientGUIPanels.py
@@ -2,6 +2,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import QtPorting as QP
from hydrus.client.gui.widgets import ClientGUICommon
@@ -107,7 +108,7 @@ def do_it( service ):
service = self._service_callable()
- HG.client_controller.CallToThread( do_it, service )
+ CG.client_controller.CallToThread( do_it, service )
def _CheckRunning( self ):
@@ -166,7 +167,7 @@ def do_it( service ):
service = self._service_callable()
- HG.client_controller.CallToThread( do_it, service )
+ CG.client_controller.CallToThread( do_it, service )
def _EnableNoCopy( self ):
@@ -216,6 +217,6 @@ def do_it( service ):
service = self._service_callable()
- HG.client_controller.CallToThread( do_it, service )
+ CG.client_controller.CallToThread( do_it, service )
diff --git a/hydrus/client/gui/ClientGUIPopupMessages.py b/hydrus/client/gui/ClientGUIPopupMessages.py
index dc5aa0997..72555a2a8 100644
--- a/hydrus/client/gui/ClientGUIPopupMessages.py
+++ b/hydrus/client/gui/ClientGUIPopupMessages.py
@@ -15,6 +15,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientData
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientThreading
from hydrus.client.gui import ClientGUIAsync
@@ -72,11 +73,11 @@ def __init__( self, parent, job_status: ClientThreading.JobStatus ):
font.setBold( True )
self._title.setFont( font )
- popup_message_character_width = HG.client_controller.new_options.GetInteger( 'popup_message_character_width' )
+ popup_message_character_width = CG.client_controller.new_options.GetInteger( 'popup_message_character_width' )
popup_char_width = ClientGUIFunctions.ConvertTextToPixelWidth( self._title, popup_message_character_width )
- if HG.client_controller.new_options.GetBoolean( 'popup_message_force_min_width' ):
+ if CG.client_controller.new_options.GetBoolean( 'popup_message_force_min_width' ):
self.setFixedWidth( popup_char_width )
@@ -272,7 +273,7 @@ def CopyTB( self ):
full_text = info + os.linesep + trace
- HG.client_controller.pub( 'clipboard', 'text', full_text )
+ CG.client_controller.pub( 'clipboard', 'text', full_text )
def CopyToClipboard( self ):
@@ -283,7 +284,7 @@ def CopyToClipboard( self ):
( title, text ) = result
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -315,7 +316,7 @@ def ShowFiles( self ):
def work_callable():
- presented_hashes = HG.client_controller.Read( 'filter_hashes', location_context, hashes )
+ presented_hashes = CG.client_controller.Read( 'filter_hashes', location_context, hashes )
return presented_hashes
@@ -334,7 +335,7 @@ def publish_callable( presented_hashes ):
if len( presented_hashes ) > 0:
- HG.client_controller.pub( 'new_page_query', location_context, initial_hashes = presented_hashes, page_name = attached_files_label )
+ CG.client_controller.pub( 'new_page_query', location_context, initial_hashes = presented_hashes, page_name = attached_files_label )
self._show_files_button.setEnabled( True )
@@ -838,7 +839,7 @@ def __init__( self, parent, job_status_queue: JobStatusPopupQueue ):
parent.installEventFilter( self )
- HG.client_controller.sub( self, 'AddMessage', 'message' )
+ CG.client_controller.sub( self, 'AddMessage', 'message' )
self._old_excepthook = sys.excepthook
self._old_show_exception = HydrusData.ShowException
@@ -854,14 +855,14 @@ def __init__( self, parent, job_status_queue: JobStatusPopupQueue ):
job_status.SetStatusText( 'initialising popup message manager' + HC.UNICODE_ELLIPSIS )
- self._update_job = HG.client_controller.CallRepeatingQtSafe( self, 0.25, 0.25, 'repeating popup message update', self.REPEATINGUpdate )
+ self._update_job = CG.client_controller.CallRepeatingQtSafe( self, 0.25, 0.25, 'repeating popup message update', self.REPEATINGUpdate )
self._summary_bar.dismissAll.connect( self.DismissAll )
self._summary_bar.expandCollapse.connect( self.ExpandCollapse )
- HG.client_controller.CallLaterQtSafe( self, 0.5, 'initialise message', self.AddMessage, job_status )
+ CG.client_controller.CallLaterQtSafe( self, 0.5, 'initialise message', self.AddMessage, job_status )
- HG.client_controller.CallLaterQtSafe( self, 1.0, 'delete initial message', job_status.FinishAndDismiss )
+ CG.client_controller.CallLaterQtSafe( self, 1.0, 'delete initial message', job_status.FinishAndDismiss )
def _CheckPending( self ):
@@ -1023,7 +1024,7 @@ def _OKToAlterUI( self ):
return False
- if HG.client_controller.new_options.GetBoolean( 'freeze_message_manager_when_mouse_on_other_monitor' ):
+ if CG.client_controller.new_options.GetBoolean( 'freeze_message_manager_when_mouse_on_other_monitor' ):
on_my_monitor = ClientGUIFunctions.MouseIsOnMyDisplay( main_gui )
@@ -1033,7 +1034,7 @@ def _OKToAlterUI( self ):
- if HG.client_controller.new_options.GetBoolean( 'freeze_message_manager_when_main_gui_minimised' ):
+ if CG.client_controller.new_options.GetBoolean( 'freeze_message_manager_when_main_gui_minimised' ):
main_gui_up = not main_gui.isMinimized()
@@ -1300,7 +1301,7 @@ def __init__( self, parent, job_status, hide_main_gui = False ):
self._message_pubbed = False
- self._update_job = HG.client_controller.CallRepeatingQtSafe( self, 0.25, 0.5, 'repeating popup dialog update', self.REPEATINGUpdate )
+ self._update_job = CG.client_controller.CallRepeatingQtSafe( self, 0.25, 0.5, 'repeating popup dialog update', self.REPEATINGUpdate )
def CleanBeforeDestroy( self ):
@@ -1354,7 +1355,7 @@ def _ReleaseMessage( self ):
if not self._message_pubbed:
- HG.client_controller.pub( 'message', self._job_status )
+ CG.client_controller.pub( 'message', self._job_status )
self._message_pubbed = True
diff --git a/hydrus/client/gui/ClientGUIRatings.py b/hydrus/client/gui/ClientGUIRatings.py
index 6203a7bef..96b3d4816 100644
--- a/hydrus/client/gui/ClientGUIRatings.py
+++ b/hydrus/client/gui/ClientGUIRatings.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import QtPorting as QP
from hydrus.client.gui.widgets import ClientGUICommon
from hydrus.client.metadata import ClientRatings
@@ -183,7 +184,7 @@ def GetNumericalWidth( service_key ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
num_stars = service.GetNumStars()
@@ -198,7 +199,7 @@ def GetPenAndBrushColours( service_key, rating_state ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
colour = service.GetColour( rating_state )
@@ -218,7 +219,7 @@ def GetStars( service_key, rating_state, rating ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
except HydrusExceptions.DataMissing:
@@ -265,7 +266,7 @@ def __init__( self, parent, service_key ):
self._service_key = service_key
- self._service = HG.client_controller.services_manager.GetService( self._service_key )
+ self._service = CG.client_controller.services_manager.GetService( self._service_key )
self._widget_event_filter = QP.WidgetEventFilter( self )
@@ -298,11 +299,11 @@ def _UpdateTooltip( self ):
if self.isEnabled():
- text = HG.client_controller.services_manager.GetName( self._service_key )
+ text = CG.client_controller.services_manager.GetName( self._service_key )
try:
- service = HG.client_controller.services_manager.GetService( self._service_key )
+ service = CG.client_controller.services_manager.GetService( self._service_key )
tt = '{} - {}'.format( service.GetName(), service.ConvertRatingStateAndRatingToString( self._rating_state, self._rating ) )
@@ -489,11 +490,11 @@ def _UpdateTooltip( self ):
if self.isEnabled():
- text = HG.client_controller.services_manager.GetName( self._service_key )
+ text = CG.client_controller.services_manager.GetName( self._service_key )
try:
- service = HG.client_controller.services_manager.GetService( self._service_key )
+ service = CG.client_controller.services_manager.GetService( self._service_key )
tt = '{} - {}'.format( service.GetName(), service.ConvertRatingStateToString( self._rating_state ) )
@@ -608,7 +609,7 @@ def __init__( self, parent, service_key ):
self._service_key = service_key
- self._service = HG.client_controller.services_manager.GetService( self._service_key )
+ self._service = CG.client_controller.services_manager.GetService( self._service_key )
self._num_stars = self._service.GetNumStars()
self._allow_zero = self._service.AllowZero()
@@ -708,11 +709,11 @@ def _UpdateTooltip( self ):
if self.isEnabled():
- text = HG.client_controller.services_manager.GetName( self._service_key )
+ text = CG.client_controller.services_manager.GetName( self._service_key )
try:
- service = HG.client_controller.services_manager.GetService( self._service_key )
+ service = CG.client_controller.services_manager.GetService( self._service_key )
tt = '{} - {}'.format( service.GetName(), service.ConvertRatingStateAndRatingToString( self._rating_state, self._rating ) )
diff --git a/hydrus/client/gui/ClientGUIScrolledPanelsEdit.py b/hydrus/client/gui/ClientGUIScrolledPanelsEdit.py
index 2b6af73fe..dcbb7d464 100644
--- a/hydrus/client/gui/ClientGUIScrolledPanelsEdit.py
+++ b/hydrus/client/gui/ClientGUIScrolledPanelsEdit.py
@@ -16,11 +16,11 @@
from hydrus.core import HydrusSerialisable
from hydrus.core import HydrusTags
from hydrus.core import HydrusText
-from hydrus.core import HydrusTime
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDuplicates
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientTime
from hydrus.client.gui import ClientGUIDialogs
from hydrus.client.gui import ClientGUIDialogsMessage
@@ -298,7 +298,7 @@ def _CopyNotes( self ):
json_string = note_import_options.DumpToString()
- HG.client_controller.pub( 'clipboard', 'text', json_string )
+ CG.client_controller.pub( 'clipboard', 'text', json_string )
@@ -319,7 +319,7 @@ def _CopyTags( self ):
json_string = tag_import_options.DumpToString()
- HG.client_controller.pub( 'clipboard', 'text', json_string )
+ CG.client_controller.pub( 'clipboard', 'text', json_string )
@@ -491,7 +491,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -561,7 +561,7 @@ def __init__( self, parent: QW.QWidget, media, default_reason, suggested_file_se
self._default_reason = default_reason
- local_file_service_domains = list( HG.client_controller.services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) ) )
+ local_file_service_domains = list( CG.client_controller.services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) ) )
if suggested_file_service_key is None:
@@ -588,9 +588,9 @@ def __init__( self, parent: QW.QWidget, media, default_reason, suggested_file_se
selection_success = False
- if HG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_special_action' ):
+ if CG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_special_action' ):
- last_advanced_file_deletion_special_action = HG.client_controller.new_options.GetNoneableString( 'last_advanced_file_deletion_special_action' )
+ last_advanced_file_deletion_special_action = CG.client_controller.new_options.GetNoneableString( 'last_advanced_file_deletion_special_action' )
selection_success = self._TryToSelectAction( last_advanced_file_deletion_special_action )
@@ -617,9 +617,9 @@ def __init__( self, parent: QW.QWidget, media, default_reason, suggested_file_se
permitted_reason_choices.append( ( default_reason, default_reason ) )
- if HG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_reason' ):
+ if CG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_reason' ):
- last_advanced_file_deletion_reason = HG.client_controller.new_options.GetNoneableString( 'last_advanced_file_deletion_reason' )
+ last_advanced_file_deletion_reason = CG.client_controller.new_options.GetNoneableString( 'last_advanced_file_deletion_reason' )
else:
@@ -635,7 +635,7 @@ def __init__( self, parent: QW.QWidget, media, default_reason, suggested_file_se
selection_index = None # text or custom
- for ( i, s ) in enumerate( HG.client_controller.new_options.GetStringList( 'advanced_file_deletion_reasons' ) ):
+ for ( i, s ) in enumerate( CG.client_controller.new_options.GetStringList( 'advanced_file_deletion_reasons' ) ):
if self._existing_shared_file_deletion_reason is not None and s == self._existing_shared_file_deletion_reason and not existing_reason_was_in_list:
@@ -701,7 +701,7 @@ def __init__( self, parent: QW.QWidget, media, default_reason, suggested_file_se
self._simple_description.hide()
- if not HG.client_controller.new_options.GetBoolean( 'use_advanced_file_deletion_dialog' ):
+ if not CG.client_controller.new_options.GetBoolean( 'use_advanced_file_deletion_dialog' ):
self._reason_panel.hide()
self._reason_panel.setEnabled( False )
@@ -739,7 +739,7 @@ def __init__( self, parent: QW.QWidget, media, default_reason, suggested_file_se
def _FilterForDeleteLock( self, media, suggested_file_service_key: bytes ):
- service = HG.client_controller.services_manager.GetService( suggested_file_service_key )
+ service = CG.client_controller.services_manager.GetService( suggested_file_service_key )
if service.GetServiceType() in HC.LOCAL_FILE_SERVICES:
@@ -813,11 +813,11 @@ def _GetReason( self ):
def _InitialisePermittedActionChoices( self ):
- we_are_advanced_delete_dialog = HG.client_controller.new_options.GetBoolean( 'use_advanced_file_deletion_dialog' )
+ we_are_advanced_delete_dialog = CG.client_controller.new_options.GetBoolean( 'use_advanced_file_deletion_dialog' )
possible_file_service_keys = []
- local_file_service_domains = list( HG.client_controller.services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) ) )
+ local_file_service_domains = list( CG.client_controller.services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) ) )
local_file_service_domain_keys = { service.GetServiceKey() for service in local_file_service_domains }
possible_file_service_keys.extend( ( ( lfs.GetServiceKey(), lfs.GetServiceKey() ) for lfs in local_file_service_domains ) )
@@ -834,7 +834,7 @@ def _InitialisePermittedActionChoices( self ):
possible_file_service_keys.append( ( CC.LOCAL_UPDATE_SERVICE_KEY, CC.COMBINED_LOCAL_FILE_SERVICE_KEY ) )
- possible_file_service_keys.extend( ( ( rfs.GetServiceKey(), rfs.GetServiceKey() ) for rfs in HG.client_controller.services_manager.GetServices( ( HC.FILE_REPOSITORY, ) ) ) )
+ possible_file_service_keys.extend( ( ( rfs.GetServiceKey(), rfs.GetServiceKey() ) for rfs in CG.client_controller.services_manager.GetServices( ( HC.FILE_REPOSITORY, ) ) ) )
keys_to_hashes = { ( selection_file_service_key, deletee_file_service_key ) : [ m.GetHash() for m in self._media if selection_file_service_key in m.GetLocationsManager().GetCurrent() ] for ( selection_file_service_key, deletee_file_service_key ) in possible_file_service_keys }
@@ -860,7 +860,7 @@ def _InitialisePermittedActionChoices( self ):
( selection_file_service_key, deletee_file_service_key ) = fsk
- deletee_service = HG.client_controller.services_manager.GetService( deletee_file_service_key )
+ deletee_service = CG.client_controller.services_manager.GetService( deletee_file_service_key )
deletee_service_type = deletee_service.GetServiceType()
@@ -1009,7 +1009,7 @@ def _InitialisePermittedActionChoices( self ):
self._question_is_already_resolved = True
- if HG.client_controller.new_options.GetBoolean( 'use_advanced_file_deletion_dialog' ):
+ if CG.client_controller.new_options.GetBoolean( 'use_advanced_file_deletion_dialog' ):
hashes = [ m.GetHash() for m in self._media if CC.COMBINED_LOCAL_FILE_SERVICE_KEY in m.GetLocationsManager().GetCurrent() ]
@@ -1162,7 +1162,7 @@ def GetValue( self ):
else:
- previous_last_advanced_file_deletion_special_action = HG.client_controller.new_options.GetNoneableString( 'last_advanced_file_deletion_special_action' )
+ previous_last_advanced_file_deletion_special_action = CG.client_controller.new_options.GetNoneableString( 'last_advanced_file_deletion_special_action' )
# if there is nothing to do but physically delete, then we don't want to overwrite an existing 'use service' setting
# HACKMODE ALERT. len() == 64 is a stupid test for 'looks like a service key mate'
@@ -1174,12 +1174,12 @@ def GetValue( self ):
last_advanced_file_deletion_special_action = file_service_key
- if save_action and HG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_special_action' ):
+ if save_action and CG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_special_action' ):
- HG.client_controller.new_options.SetNoneableString( 'last_advanced_file_deletion_special_action', last_advanced_file_deletion_special_action )
+ CG.client_controller.new_options.SetNoneableString( 'last_advanced_file_deletion_special_action', last_advanced_file_deletion_special_action )
- if save_reason and HG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_reason' ):
+ if save_reason and CG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_reason' ):
reasons_ok = self._reason_radio.isVisible() and self._reason_radio.isEnabled()
@@ -1196,7 +1196,7 @@ def GetValue( self ):
last_advanced_file_deletion_reason = reason
- HG.client_controller.new_options.SetNoneableString( 'last_advanced_file_deletion_reason', last_advanced_file_deletion_reason )
+ CG.client_controller.new_options.SetNoneableString( 'last_advanced_file_deletion_reason', last_advanced_file_deletion_reason )
@@ -1300,7 +1300,7 @@ def __init__( self, parent: QW.QWidget, duplicate_action, duplicate_content_merg
sync_notes_action = duplicate_content_merge_options.GetSyncNotesAction()
self._sync_note_import_options = duplicate_content_merge_options.GetSyncNoteImportOptions()
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
self._service_keys_to_tag_options = { service_key : ( action, tag_filter ) for ( service_key, action, tag_filter ) in tag_service_options if services_manager.ServiceExists( service_key ) }
@@ -1372,7 +1372,7 @@ def __init__( self, parent: QW.QWidget, duplicate_action, duplicate_content_merg
def _AddRating( self ):
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
choice_tuples = []
@@ -1450,7 +1450,7 @@ def _AddRating( self ):
def _AddTag( self ):
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
choice_tuples = []
@@ -1514,7 +1514,7 @@ def _AddTag( self ):
with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit which tags will be merged' ) as dlg_3:
- namespaces = HG.client_controller.network_engine.domain_manager.GetParserNamespaces()
+ namespaces = CG.client_controller.network_engine.domain_manager.GetParserNamespaces()
panel = ClientGUITags.EditTagFilterPanel( dlg_3, tag_filter, namespaces = namespaces )
@@ -1540,7 +1540,7 @@ def _ConvertRatingDataToListCtrlTuple( self, service_key ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
service_name = service.GetName()
@@ -1575,7 +1575,7 @@ def _ConvertTagDataToListCtrlTuple( self, service_key ):
try:
- service_name = HG.client_controller.services_manager.GetName( service_key )
+ service_name = CG.client_controller.services_manager.GetName( service_key )
except HydrusExceptions.DataMissing:
@@ -1648,7 +1648,7 @@ def _EditRating( self ):
if self._duplicate_action == HC.DUPLICATE_BETTER:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
service_type = service.GetServiceType()
@@ -1721,7 +1721,7 @@ def _EditTag( self ):
with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit which tags will be merged' ) as dlg_3:
- namespaces = HG.client_controller.network_engine.domain_manager.GetParserNamespaces()
+ namespaces = CG.client_controller.network_engine.domain_manager.GetParserNamespaces()
panel = ClientGUITags.EditTagFilterPanel( dlg_3, tag_filter, namespaces = namespaces )
@@ -1968,13 +1968,13 @@ def __init__( self, parent: QW.QWidget, names_to_notes: typing.Dict[ str, str ],
ClientGUIFunctions.SetFocusLater( first_panel )
- if HG.client_controller.new_options.GetBoolean( 'start_note_editing_at_end' ):
+ if CG.client_controller.new_options.GetBoolean( 'start_note_editing_at_end' ):
- HG.client_controller.CallAfterQtSafe( first_panel, 'moving cursor to end', first_panel.moveCursor, QG.QTextCursor.End )
+ CG.client_controller.CallAfterQtSafe( first_panel, 'moving cursor to end', first_panel.moveCursor, QG.QTextCursor.End )
else:
- HG.client_controller.CallAfterQtSafe( first_panel, 'moving cursor to start', first_panel.moveCursor, QG.QTextCursor.Start )
+ CG.client_controller.CallAfterQtSafe( first_panel, 'moving cursor to start', first_panel.moveCursor, QG.QTextCursor.Start )
#
@@ -2037,7 +2037,7 @@ def _AddNotePanel( self, name, note ):
ClientGUIFunctions.SetFocusLater( control )
- HG.client_controller.CallAfterQtSafe( control, 'moving cursor to end', control.moveCursor, QG.QTextCursor.End )
+ CG.client_controller.CallAfterQtSafe( control, 'moving cursor to end', control.moveCursor, QG.QTextCursor.End )
self._UpdateButtons()
@@ -2048,14 +2048,14 @@ def _Copy( self ):
text = json.dumps( names_to_notes )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -2561,7 +2561,7 @@ def _ConvertDataRowToFileServiceListCtrlTuples( self, row ):
try:
- pretty_name = HG.client_controller.services_manager.GetName( file_service_key )
+ pretty_name = CG.client_controller.services_manager.GetName( file_service_key )
except HydrusExceptions.DataMissing:
@@ -2599,7 +2599,7 @@ def _Copy( self, allowed_timestamp_types = None ):
text = json.dumps( list_of_timestamp_data.GetSerialisableTuple() )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _AddDomainModifiedTimestamp( self ):
@@ -2881,7 +2881,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -3308,7 +3308,7 @@ def __init__( self, parent: QW.QWidget, info ):
self._preview_start_paused = QW.QCheckBox( self )
self._preview_start_with_embed = QW.QCheckBox( self )
- advanced_mode = HG.client_controller.new_options.GetBoolean( 'advanced_mode' )
+ advanced_mode = CG.client_controller.new_options.GetBoolean( 'advanced_mode' )
for action in possible_show_actions:
diff --git a/hydrus/client/gui/ClientGUIScrolledPanelsManagement.py b/hydrus/client/gui/ClientGUIScrolledPanelsManagement.py
index 217f9e817..8422f5b2d 100644
--- a/hydrus/client/gui/ClientGUIScrolledPanelsManagement.py
+++ b/hydrus/client/gui/ClientGUIScrolledPanelsManagement.py
@@ -21,6 +21,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientFilesPhysical
+from hydrus.client import ClientGlobals as CG
from hydrus.client.importing.options import FileImportOptions
from hydrus.client.gui import ClientGUIDialogs
from hydrus.client.gui import ClientGUIDialogsMessage
@@ -59,7 +60,7 @@ def __init__( self, parent ):
self._original_options = dict( HC.options )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
self._original_new_options = self._new_options.Duplicate()
self._listbook = ClientGUICommon.ListBook( self )
@@ -160,7 +161,7 @@ def __init__( self, parent ):
QW.QWidget.__init__( self, parent )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
coloursets_panel = ClientGUICommon.StaticBox( self, 'coloursets' )
@@ -281,7 +282,7 @@ def __init__( self, parent ):
QW.QWidget.__init__( self, parent )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
general = ClientGUICommon.StaticBox( self, 'general' )
@@ -471,7 +472,7 @@ def __init__( self, parent, new_options ):
gallery_downloader = ClientGUICommon.StaticBox( self, 'gallery downloader' )
- gug_key_and_name = HG.client_controller.network_engine.domain_manager.GetDefaultGUGKeyAndName()
+ gug_key_and_name = CG.client_controller.network_engine.domain_manager.GetDefaultGUGKeyAndName()
self._default_gug = ClientGUIImport.GUGKeyAndNameSelector( gallery_downloader, gug_key_and_name )
@@ -641,7 +642,7 @@ def __init__( self, parent, new_options ):
def UpdateOptions( self ):
- HG.client_controller.network_engine.domain_manager.SetDefaultGUGKeyAndName( self._default_gug.GetValue() )
+ CG.client_controller.network_engine.domain_manager.SetDefaultGUGKeyAndName( self._default_gug.GetValue() )
self._new_options.SetInteger( 'gallery_page_wait_period_pages', self._gallery_page_wait_period_pages.value() )
HC.options[ 'gallery_file_limit' ] = self._gallery_file_limit.GetValue()
@@ -822,7 +823,7 @@ def __init__( self, parent ):
QW.QWidget.__init__( self, parent )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
browser_panel = ClientGUICommon.StaticBox( self, 'web browser launch path' )
@@ -1008,7 +1009,7 @@ def __init__( self, parent ):
QW.QWidget.__init__( self, parent )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
self._export_location = QP.DirPickerCtrl( self )
@@ -1090,8 +1091,8 @@ def __init__( self, parent ):
self._use_advanced_file_deletion_dialog.clicked.connect( self._UpdateAdvancedControls )
- self._remember_last_advanced_file_deletion_special_action.setChecked( HG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_special_action' ) )
- self._remember_last_advanced_file_deletion_reason.setChecked( HG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_reason' ) )
+ self._remember_last_advanced_file_deletion_special_action.setChecked( CG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_special_action' ) )
+ self._remember_last_advanced_file_deletion_reason.setChecked( CG.client_controller.new_options.GetBoolean( 'remember_last_advanced_file_deletion_reason' ) )
self._advanced_file_deletion_reasons.AddDatas( self._new_options.GetStringList( 'advanced_file_deletion_reasons' ) )
@@ -1216,8 +1217,8 @@ def UpdateOptions( self ):
self._new_options.SetStringList( 'advanced_file_deletion_reasons', self._advanced_file_deletion_reasons.GetData() )
- HG.client_controller.new_options.SetBoolean( 'remember_last_advanced_file_deletion_special_action', self._remember_last_advanced_file_deletion_special_action.isChecked() )
- HG.client_controller.new_options.SetBoolean( 'remember_last_advanced_file_deletion_reason', self._remember_last_advanced_file_deletion_reason.isChecked() )
+ CG.client_controller.new_options.SetBoolean( 'remember_last_advanced_file_deletion_special_action', self._remember_last_advanced_file_deletion_special_action.isChecked() )
+ CG.client_controller.new_options.SetBoolean( 'remember_last_advanced_file_deletion_reason', self._remember_last_advanced_file_deletion_reason.isChecked() )
@@ -1227,7 +1228,7 @@ def __init__( self, parent ):
QW.QWidget.__init__( self, parent )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
self._file_viewing_statistics_active = QW.QCheckBox( self )
self._file_viewing_statistics_active_on_archive_delete_filter = QW.QCheckBox( self )
@@ -1359,7 +1360,7 @@ def __init__( self, parent ):
#
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
self._app_display_name.setText( self._new_options.GetString( 'app_display_name' ) )
@@ -1583,6 +1584,10 @@ def __init__( self, parent, new_options ):
self._wheel_scrolls_tab_bar = QW.QCheckBox( self._pages_panel )
self._wheel_scrolls_tab_bar.setToolTip( 'When you scroll your mouse wheel over some tabs, the normal behaviour is to change the tab selection. If you often have overloaded tab bars, you might like to have the mouse wheel actually scroll the tab bar itself.' )
+ self._disable_page_tab_dnd = QW.QCheckBox( self._pages_panel )
+
+ self._disable_page_tab_dnd.setToolTip( 'Trying to debug some client hangs!' )
+
self._force_hide_page_signal_on_new_page = QW.QCheckBox( self._pages_panel )
self._force_hide_page_signal_on_new_page.setToolTip( 'If your video still plays with sound in the preview viewer when you create a new page, please try this.' )
@@ -1613,7 +1618,7 @@ def __init__( self, parent, new_options ):
#
- gui_session_names = HG.client_controller.Read( 'serialisable_names', HydrusSerialisable.SERIALISABLE_TYPE_GUI_SESSION_CONTAINER )
+ gui_session_names = CG.client_controller.Read( 'serialisable_names', HydrusSerialisable.SERIALISABLE_TYPE_GUI_SESSION_CONTAINER )
if CC.LAST_SESSION_SESSION_NAME not in gui_session_names:
@@ -1665,6 +1670,8 @@ def __init__( self, parent, new_options ):
self._total_pages_warning.setValue( self._new_options.GetInteger( 'total_pages_warning' ) )
+ self._disable_page_tab_dnd.setChecked( self._new_options.GetBoolean( 'disable_page_tab_dnd' ) )
+
self._force_hide_page_signal_on_new_page.setChecked( self._new_options.GetBoolean( 'force_hide_page_signal_on_new_page' ) )
self._set_search_focus_on_page_change.setChecked( self._new_options.GetBoolean( 'set_search_focus_on_page_change' ) )
@@ -1695,6 +1702,7 @@ def __init__( self, parent, new_options ):
rows.append( ( ' With shift held down?: ', self._page_drag_change_tab_with_shift ) )
rows.append( ( 'EXPERIMENTAL: Mouse wheel scrolls tab bar, not page selection: ', self._wheel_scrolls_tab_bar ) )
rows.append( ( 'Warn at this many total pages: ', self._total_pages_warning ) )
+ rows.append( ( 'BUGFIX: Disable all page tab drag and drop: ', self._disable_page_tab_dnd ) )
rows.append( ( 'BUGFIX: Force \'hide page\' signal when creating a new page: ', self._force_hide_page_signal_on_new_page ) )
gridbox = ClientGUICommon.WrapInGrid( self._pages_panel, rows )
@@ -1772,6 +1780,7 @@ def UpdateOptions( self ):
self._new_options.SetInteger( 'total_pages_warning', self._total_pages_warning.value() )
+ self._new_options.SetBoolean( 'disable_page_tab_dnd', self._disable_page_tab_dnd.isChecked() )
self._new_options.SetBoolean( 'force_hide_page_signal_on_new_page', self._force_hide_page_signal_on_new_page.isChecked() )
self._new_options.SetBoolean( 'page_drop_chase_normally', self._page_drop_chase_normally.isChecked() )
@@ -1850,7 +1859,7 @@ def __init__( self, parent ):
QW.QWidget.__init__( self, parent )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
self._jobs_panel = ClientGUICommon.StaticBox( self, 'when to run high cpu jobs' )
@@ -2351,7 +2360,7 @@ def __init__( self, parent ):
QW.QWidget.__init__( self, parent )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
#
@@ -2813,7 +2822,7 @@ def UpdateOptions( self ):
if mpv_conf_path is not None and mpv_conf_path != '' and os.path.exists( mpv_conf_path ) and os.path.isfile( mpv_conf_path ):
- dest_mpv_conf_path = HG.client_controller.GetMPVConfPath()
+ dest_mpv_conf_path = CG.client_controller.GetMPVConfPath()
try:
@@ -3076,7 +3085,7 @@ def __init__( self, parent, new_options ):
self._default_tag_service_search_page.addItem( 'all known tags', CC.COMBINED_TAG_SERVICE_KEY )
- services = HG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
+ services = CG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
for service in services:
@@ -3244,7 +3253,7 @@ def __init__( self, parent, new_options ):
#
- self._namespace_sort_by.AddDatas( [ media_sort.sort_type[1] for media_sort in HG.client_controller.new_options.GetDefaultNamespaceSorts() ] )
+ self._namespace_sort_by.AddDatas( [ media_sort.sort_type[1] for media_sort in CG.client_controller.new_options.GetDefaultNamespaceSorts() ] )
self._save_page_sort_on_change.setChecked( self._new_options.GetBoolean( 'save_page_sort_on_change' ) )
@@ -3966,7 +3975,7 @@ def __init__( self, parent, new_options ):
elif not HC.PLATFORM_WINDOWS:
- if not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
label = 'This is turned off for non-advanced non-Windows users for now.'
@@ -4033,7 +4042,7 @@ def __init__( self, parent, new_options ):
favourites_st = ClientGUICommon.BetterStaticText( favourites_panel, desc )
favourites_st.setWordWrap( True )
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._favourites = ClientGUIListBoxes.ListBoxTagsStringsAddRemove( favourites_panel, CC.COMBINED_TAG_SERVICE_KEY, tag_display_type = ClientTags.TAG_DISPLAY_STORAGE )
self._favourites_input = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite( favourites_panel, self._favourites.AddTags, default_location_context, CC.COMBINED_TAG_SERVICE_KEY, show_paste_button = True )
@@ -4403,7 +4412,7 @@ def __init__( self, parent, new_options ):
self._suggested_favourites_services = ClientGUICommon.BetterChoice( suggested_tags_favourites_panel )
- tag_services = HG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
+ tag_services = CG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
for tag_service in tag_services:
@@ -4416,7 +4425,7 @@ def __init__( self, parent, new_options ):
self._suggested_favourites_dict = {}
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._suggested_favourites_input = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite( suggested_tags_favourites_panel, self._suggested_favourites.AddTags, default_location_context, CC.COMBINED_TAG_SERVICE_KEY, show_paste_button = True )
@@ -4474,7 +4483,7 @@ def __init__( self, parent, new_options ):
self._favourite_file_lookup_script = ClientGUICommon.BetterChoice( suggested_tags_file_lookup_script_panel )
- script_names = sorted( HG.client_controller.Read( 'serialisable_names', HydrusSerialisable.SERIALISABLE_TYPE_PARSE_ROOT_FILE_LOOKUP ) )
+ script_names = sorted( CG.client_controller.Read( 'serialisable_names', HydrusSerialisable.SERIALISABLE_TYPE_PARSE_ROOT_FILE_LOOKUP ) )
for name in script_names:
@@ -5046,16 +5055,16 @@ def CommitChanges( self ):
try:
- HG.client_controller.WriteSynchronous( 'save_options', HC.options )
+ CG.client_controller.WriteSynchronous( 'save_options', HC.options )
- HG.client_controller.WriteSynchronous( 'serialisable', self._new_options )
+ CG.client_controller.WriteSynchronous( 'serialisable', self._new_options )
# we do this to convert tuples to lists and so on
test_new_options = self._new_options.Duplicate()
if test_new_options.GetMediaViewOptions() != self._original_new_options.GetMediaViewOptions():
- HG.client_controller.pub( 'clear_image_tile_cache' )
+ CG.client_controller.pub( 'clear_image_tile_cache' )
res_changed = HC.options[ 'thumbnail_dimensions' ] != self._original_options[ 'thumbnail_dimensions' ]
@@ -5064,7 +5073,7 @@ def CommitChanges( self ):
if res_changed or type_changed or dpr_changed:
- HG.client_controller.pub( 'reset_thumbnail_cache' )
+ CG.client_controller.pub( 'reset_thumbnail_cache' )
except Exception as e:
@@ -5148,7 +5157,7 @@ def _Copy( self ):
text = os.linesep.join( urls )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _EnterURLs( self, urls, only_add = False ):
@@ -5160,7 +5169,7 @@ def _EnterURLs( self, urls, only_add = False ):
try:
- normalised_url = HG.client_controller.network_engine.domain_manager.NormaliseURL( url )
+ normalised_url = CG.client_controller.network_engine.domain_manager.NormaliseURL( url )
normalised_urls.append( normalised_url )
@@ -5228,7 +5237,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -5385,7 +5394,7 @@ def CommitChanges( self ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, self._pending_content_updates )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -5437,7 +5446,7 @@ def __init__( self, parent, missing_subfolders: typing.Collection[ ClientFilesPh
text += os.linesep * 2
text += 'Although it is best if you can find everything, you only _have_ to fix the subdirectories starting with \'f\', which store your original files. Those starting \'t\' and \'r\' are for your thumbnails, which can be regenerated with a bit of work.'
text += os.linesep * 2
- text += 'Then hit \'apply\', and the client will launch. You should double-check all your locations under database->migrate database immediately.'
+ text += 'Then hit \'apply\', and the client will launch. You should double-check all your locations under \'database->move media files\' immediately.'
text += os.linesep * 2
text += '2) If the locations are not available, or you do not know what they should be, or you wish to fix this outside of the program, hit \'cancel\' to gracefully cancel client boot. Feel free to contact hydrus dev for help. Regardless of the situation, the document at "install_dir/db/help my media files are broke.txt" may be useful background reading.'
@@ -5625,7 +5634,7 @@ def CommitChanges( self ):
( correct_rows, thumb_problems ) = self._GetValue()
- HG.client_controller.WriteSynchronous( 'repair_client_files', correct_rows )
+ CG.client_controller.WriteSynchronous( 'repair_client_files', correct_rows )
def UserIsOKToOK( self ):
diff --git a/hydrus/client/gui/ClientGUIScrolledPanelsReview.py b/hydrus/client/gui/ClientGUIScrolledPanelsReview.py
index bf43243d3..87fa17cc2 100644
--- a/hydrus/client/gui/ClientGUIScrolledPanelsReview.py
+++ b/hydrus/client/gui/ClientGUIScrolledPanelsReview.py
@@ -28,6 +28,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientData
from hydrus.client import ClientFiles
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientMigration
from hydrus.client import ClientParsing
@@ -70,7 +71,7 @@ def __init__( self, parent, name, version, description, license_text, developers
ClientGUIScrolledPanels.ReviewPanel.__init__( self, parent )
icon_label = ClientGUICommon.BetterStaticText( self )
- icon_label.setPixmap( HG.client_controller.frame_icon_pixmap )
+ icon_label.setPixmap( CG.client_controller.frame_icon_pixmap )
name_label = ClientGUICommon.BetterStaticText( self, name )
name_label_font = name_label.font()
@@ -120,7 +121,7 @@ def __init__( self, parent, name, version, description, license_text, developers
-class MigrateDatabasePanel( ClientGUIScrolledPanels.ReviewPanel ):
+class MoveMediaFilesPanel( ClientGUIScrolledPanels.ReviewPanel ):
def __init__( self, parent, controller ):
@@ -130,11 +131,11 @@ def __init__( self, parent, controller ):
ClientGUIScrolledPanels.ReviewPanel.__init__( self, parent )
- self._client_files_subfolders = HG.client_controller.Read( 'client_files_subfolders' )
+ self._client_files_subfolders = CG.client_controller.Read( 'client_files_subfolders' )
( self._media_base_locations, self._ideal_thumbnails_base_location_override ) = self._controller.Read( 'ideal_client_files_locations' )
- service_info = HG.client_controller.Read( 'service_info', CC.COMBINED_LOCAL_FILE_SERVICE_KEY )
+ service_info = CG.client_controller.Read( 'service_info', CC.COMBINED_LOCAL_FILE_SERVICE_KEY )
self._all_local_files_total_size = service_info[ HC.SERVICE_INFO_TOTAL_SIZE ]
self._all_local_files_total_num = service_info[ HC.SERVICE_INFO_NUM_FILES ]
@@ -638,7 +639,7 @@ def _GetListCtrlLocations( self ):
def _GetThumbnailSizeEstimates( self ):
- ( t_width, t_height ) = HG.client_controller.options[ 'thumbnail_dimensions' ]
+ ( t_width, t_height ) = CG.client_controller.options[ 'thumbnail_dimensions' ]
typical_thumb_num_pixels = 320 * 240
typical_thumb_size = 36 * 1024
@@ -700,7 +701,7 @@ def _Rebalance( self ):
job_status = ClientThreading.JobStatus( cancellable = True, stop_time = stop_time )
- HG.client_controller.pub( 'do_file_storage_rebalance', job_status )
+ CG.client_controller.pub( 'do_file_storage_rebalance', job_status )
self._OKParent()
@@ -871,7 +872,7 @@ def _SetThumbnailLocation( self ):
def _Update( self ):
- self._client_files_subfolders = HG.client_controller.Read( 'client_files_subfolders' )
+ self._client_files_subfolders = CG.client_controller.Read( 'client_files_subfolders' )
( self._media_base_locations, self._ideal_thumbnails_base_location_override ) = self._controller.Read( 'ideal_client_files_locations' )
@@ -965,11 +966,11 @@ def __init__( self, parent, service_key, hashes = None ):
try:
- service = HG.client_controller.services_manager.GetService( self._service_key )
+ service = CG.client_controller.services_manager.GetService( self._service_key )
except HydrusExceptions.DataMissing:
- services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) )
+ services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) )
service = next( iter( services ) )
@@ -991,7 +992,7 @@ def __init__( self, parent, service_key, hashes = None ):
self._migration_source = ClientGUICommon.BetterChoice( self._migration_panel )
- location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._migration_source_hash_type_st = ClientGUICommon.BetterStaticText( self._migration_panel, 'hash type: unknown' )
@@ -1194,7 +1195,7 @@ def _MigrationGo( self ):
desired_hash_type = self._migration_destination_hash_type_choice.GetValue()
- destination = ClientMigration.MigrationDestinationHTA( HG.client_controller, self._dest_archive_path, desired_hash_type )
+ destination = ClientMigration.MigrationDestinationHTA( CG.client_controller, self._dest_archive_path, desired_hash_type )
else:
@@ -1202,7 +1203,7 @@ def _MigrationGo( self ):
desired_hash_type = 'sha256'
- destination = ClientMigration.MigrationDestinationTagServiceMappings( HG.client_controller, destination_service_key, content_action )
+ destination = ClientMigration.MigrationDestinationTagServiceMappings( CG.client_controller, destination_service_key, content_action )
file_filtering_type = self._migration_source_file_filtering_type.GetValue()
@@ -1225,7 +1226,7 @@ def _MigrationGo( self ):
else:
- extra_info = ' for files in "{}"'.format( location_context.ToString( HG.client_controller.services_manager.GetName ) )
+ extra_info = ' for files in "{}"'.format( location_context.ToString( CG.client_controller.services_manager.GetName ) )
@@ -1242,11 +1243,11 @@ def _MigrationGo( self ):
return
- source = ClientMigration.MigrationSourceHTA( HG.client_controller, self._source_archive_path, location_context, desired_hash_type, hashes, tag_filter )
+ source = ClientMigration.MigrationSourceHTA( CG.client_controller, self._source_archive_path, location_context, desired_hash_type, hashes, tag_filter )
else:
- source = ClientMigration.MigrationSourceTagServiceMappings( HG.client_controller, source_service_key, location_context, desired_hash_type, hashes, tag_filter, content_statuses )
+ source = ClientMigration.MigrationSourceTagServiceMappings( CG.client_controller, source_service_key, location_context, desired_hash_type, hashes, tag_filter, content_statuses )
else:
@@ -1262,13 +1263,13 @@ def _MigrationGo( self ):
content_action = HC.CONTENT_UPDATE_ADD
- destination = ClientMigration.MigrationDestinationHTPA( HG.client_controller, self._dest_archive_path, content_type )
+ destination = ClientMigration.MigrationDestinationHTPA( CG.client_controller, self._dest_archive_path, content_type )
else:
content_action = self._migration_action.GetValue()
- destination = ClientMigration.MigrationDestinationTagServicePairs( HG.client_controller, destination_service_key, content_action, content_type )
+ destination = ClientMigration.MigrationDestinationTagServicePairs( CG.client_controller, destination_service_key, content_action, content_type )
left_tag_pair_filter = self._migration_source_left_tag_pair_filter.GetValue()
@@ -1295,11 +1296,11 @@ def _MigrationGo( self ):
return
- source = ClientMigration.MigrationSourceHTPA( HG.client_controller, self._source_archive_path, left_tag_pair_filter, right_tag_pair_filter )
+ source = ClientMigration.MigrationSourceHTPA( CG.client_controller, self._source_archive_path, left_tag_pair_filter, right_tag_pair_filter )
else:
- source = ClientMigration.MigrationSourceTagServicePairs( HG.client_controller, source_service_key, content_type, left_tag_pair_filter, right_tag_pair_filter, content_statuses )
+ source = ClientMigration.MigrationSourceTagServicePairs( CG.client_controller, source_service_key, content_type, left_tag_pair_filter, right_tag_pair_filter, content_statuses )
@@ -1315,7 +1316,7 @@ def _MigrationGo( self ):
if result == QW.QDialog.Accepted:
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
do_it = True
@@ -1330,9 +1331,9 @@ def _MigrationGo( self ):
if do_it:
- migration_job = ClientMigration.MigrationJob( HG.client_controller, title, source, destination )
+ migration_job = ClientMigration.MigrationJob( CG.client_controller, title, source, destination )
- HG.client_controller.CallToThread( migration_job.Run )
+ CG.client_controller.CallToThread( migration_job.Run )
@@ -1525,7 +1526,7 @@ def _UpdateMigrationControlsActions( self ):
else:
- destination_service = HG.client_controller.services_manager.GetService( destination )
+ destination_service = CG.client_controller.services_manager.GetService( destination )
destination_service_type = destination_service.GetServiceType()
@@ -1637,7 +1638,7 @@ def _UpdateMigrationControlsNewSource( self ):
self._migration_source_archive_path_button.hide()
self._migration_source_hash_type_st.hide()
- source_service = HG.client_controller.services_manager.GetService( source )
+ source_service = CG.client_controller.services_manager.GetService( source )
source_service_type = source_service.GetServiceType()
@@ -1664,7 +1665,7 @@ def _UpdateMigrationControlsNewType( self ):
self._migration_source.clear()
self._migration_destination.clear()
- for service in HG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES ):
+ for service in CG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES ):
self._migration_source.addItem( service.GetName(), service.GetServiceKey() )
self._migration_destination.addItem( service.GetName(), service.GetServiceKey() )
@@ -1751,7 +1752,7 @@ def __init__( self, parent, network_engine ):
self._select_from_list = QW.QCheckBox( self )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
self._select_from_list.setChecked( True )
@@ -2186,11 +2187,11 @@ def _ImportPayloads( self, payloads ):
def _Paste( self ):
- if HG.client_controller.ClipboardHasImage():
+ if CG.client_controller.ClipboardHasImage():
try:
- qt_image = HG.client_controller.GetClipboardImage()
+ qt_image = CG.client_controller.GetClipboardImage()
payload_description = 'clipboard image data'
payload = ClientSerialisable.LoadFromQtImage( qt_image )
@@ -2206,7 +2207,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
payload_description = 'clipboard text data'
payload = HydrusCompression.CompressStringToBytes( raw_text )
@@ -2399,7 +2400,7 @@ def _CopyRow( self ):
copy_text = str( first_row_value )
- HG.client_controller.pub( 'clipboard', 'text', copy_text )
+ CG.client_controller.pub( 'clipboard', 'text', copy_text )
class ReviewFileHistory( ClientGUIScrolledPanels.ReviewPanel ):
@@ -2499,7 +2500,7 @@ def work_callable():
try:
- file_history = HG.client_controller.Read( 'file_history', num_steps, file_search_context = file_search_context, job_status = job_status )
+ file_history = CG.client_controller.Read( 'file_history', num_steps, file_search_context = file_search_context, job_status = job_status )
except HydrusExceptions.DBException as e:
@@ -2634,7 +2635,7 @@ def __init__( self, parent, stats ):
page_key = HydrusData.GenerateKey()
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
file_search_context = ClientSearch.FileSearchContext( location_context = default_location_context )
@@ -2727,7 +2728,7 @@ def __init__( self, parent, stats ):
self._RefreshWorkDue()
- HG.client_controller.sub( self, '_RefreshWorkDue', 'notify_files_maintenance_done' )
+ CG.client_controller.sub( self, '_RefreshWorkDue', 'notify_files_maintenance_done' )
def _AddJob( self ):
@@ -2751,7 +2752,7 @@ def _AddJob( self ):
def work_callable():
- HG.client_controller.files_maintenance_manager.ScheduleJobHashIds( hash_ids, job_type )
+ CG.client_controller.files_maintenance_manager.ScheduleJobHashIds( hash_ids, job_type )
return True
@@ -2816,7 +2817,7 @@ def work_callable():
for job_type in job_types:
- HG.client_controller.files_maintenance_manager.CancelJobs( job_type )
+ CG.client_controller.files_maintenance_manager.CancelJobs( job_type )
return True
@@ -2834,7 +2835,7 @@ def publish_callable( result ):
def _DoAllWork( self ):
- HG.client_controller.CallToThread( HG.client_controller.files_maintenance_manager.ForceMaintenance )
+ CG.client_controller.CallToThread( CG.client_controller.files_maintenance_manager.ForceMaintenance )
def _DoWork( self ):
@@ -2846,14 +2847,14 @@ def _DoWork( self ):
return
- HG.client_controller.CallToThread( HG.client_controller.files_maintenance_manager.ForceMaintenance, mandated_job_types = job_types )
+ CG.client_controller.CallToThread( CG.client_controller.files_maintenance_manager.ForceMaintenance, mandated_job_types = job_types )
def _RefreshWorkDue( self ):
def work_callable():
- job_types_to_counts = HG.client_controller.Read( 'file_maintenance_get_job_counts' )
+ job_types_to_counts = CG.client_controller.Read( 'file_maintenance_get_job_counts' )
return job_types_to_counts
@@ -2889,7 +2890,7 @@ def _RunSearch( self ):
def work_callable():
- query_hash_ids = HG.client_controller.Read( 'file_query_ids', file_search_context, apply_implicit_limit = False )
+ query_hash_ids = CG.client_controller.Read( 'file_query_ids', file_search_context, apply_implicit_limit = False )
return query_hash_ids
@@ -2929,7 +2930,7 @@ def _SelectAllMediaFiles( self ):
def work_callable():
- query_hash_ids = HG.client_controller.Read( 'file_query_ids', file_search_context, apply_implicit_limit = False )
+ query_hash_ids = CG.client_controller.Read( 'file_query_ids', file_search_context, apply_implicit_limit = False )
return query_hash_ids
@@ -2956,7 +2957,7 @@ def _SelectRepoUpdateFiles( self ):
def work_callable():
- query_hash_ids = HG.client_controller.Read( 'file_query_ids', file_search_context, apply_implicit_limit = False )
+ query_hash_ids = CG.client_controller.Read( 'file_query_ids', file_search_context, apply_implicit_limit = False )
return query_hash_ids
@@ -3157,7 +3158,7 @@ def _RefreshSearch( self ):
def work_callable():
- boned_stats = HG.client_controller.Read( 'boned_stats', file_search_context = file_search_context, job_status = job_status )
+ boned_stats = CG.client_controller.Read( 'boned_stats', file_search_context = file_search_context, job_status = job_status )
return boned_stats
@@ -3667,9 +3668,9 @@ def __init__( self, parent, paths = None ):
self._AddPathsToList( paths )
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
- HG.client_controller.CallToThreadLongRunning( self.THREADParseImportablePaths, self._unparsed_paths_queue, self._currently_parsing, self._work_to_do, self._parsed_path_queue, self._progress_updater, self._pause_event, self._cancel_event )
+ CG.client_controller.CallToThreadLongRunning( self.THREADParseImportablePaths, self._unparsed_paths_queue, self._currently_parsing, self._work_to_do, self._parsed_path_queue, self._progress_updater, self._pause_event, self._cancel_event )
def _AddPathsToList( self, paths ):
@@ -3710,7 +3711,7 @@ def _AddTags( self ):
delete_after_success = self._delete_after_success.isChecked()
- HG.client_controller.pub( 'new_hdd_import', paths, file_import_options, metadata_routers, paths_to_additional_service_keys_to_tags, delete_after_success )
+ CG.client_controller.pub( 'new_hdd_import', paths, file_import_options, metadata_routers, paths_to_additional_service_keys_to_tags, delete_after_success )
self._OKParent()
@@ -3745,7 +3746,7 @@ def _DoImport( self ):
delete_after_success = self._delete_after_success.isChecked()
- HG.client_controller.pub( 'new_hdd_import', paths, file_import_options, metadata_routers, paths_to_additional_service_keys_to_tags, delete_after_success )
+ CG.client_controller.pub( 'new_hdd_import', paths, file_import_options, metadata_routers, paths_to_additional_service_keys_to_tags, delete_after_success )
self._OKParent()
@@ -3982,7 +3983,7 @@ def THREADParseImportablePaths( self, unparsed_paths_queue, currently_parsing, w
# first we'll flesh out unparsed_paths with anything new to look at
- do_human_sort = HG.client_controller.new_options.GetBoolean( 'do_human_sort_on_hdd_file_import_paths' )
+ do_human_sort = CG.client_controller.new_options.GetBoolean( 'do_human_sort_on_hdd_file_import_paths' )
while not unparsed_paths_queue.empty():
diff --git a/hydrus/client/gui/ClientGUISerialisable.py b/hydrus/client/gui/ClientGUISerialisable.py
index 811d91788..c8a3df5ee 100644
--- a/hydrus/client/gui/ClientGUISerialisable.py
+++ b/hydrus/client/gui/ClientGUISerialisable.py
@@ -3,11 +3,10 @@
from qtpy import QtWidgets as QW
from hydrus.core import HydrusData
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusPaths
from hydrus.core import HydrusSerialisable
-from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientSerialisable
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import ClientGUIScrolledPanels
@@ -58,7 +57,7 @@ def __init__( self, parent, payload_obj, title = None, description = None, paylo
self._width.setValue( 512 )
- last_png_export_dir = HG.client_controller.new_options.GetNoneableString( 'last_png_export_dir' )
+ last_png_export_dir = CG.client_controller.new_options.GetNoneableString( 'last_png_export_dir' )
if title is not None:
@@ -162,7 +161,7 @@ def Export( self ):
base_dir = os.path.dirname( path )
- HG.client_controller.new_options.SetNoneableString( 'last_png_export_dir', base_dir )
+ CG.client_controller.new_options.SetNoneableString( 'last_png_export_dir', base_dir )
if not path.endswith( '.png' ):
@@ -174,7 +173,7 @@ def Export( self ):
self._export.setText( 'done!' )
- HG.client_controller.CallLaterQtSafe( self._export, 2.0, 'png export set text', self._export.setText, 'export' )
+ CG.client_controller.CallLaterQtSafe( self._export, 2.0, 'png export set text', self._export.setText, 'export' )
class PNGsExportPanel( ClientGUIScrolledPanels.ReviewPanel ):
@@ -197,7 +196,7 @@ def __init__( self, parent, payload_objs ):
#
- last_png_export_dir = HG.client_controller.new_options.GetNoneableString( 'last_png_export_dir' )
+ last_png_export_dir = CG.client_controller.new_options.GetNoneableString( 'last_png_export_dir' )
if last_png_export_dir is not None:
@@ -258,7 +257,7 @@ def Export( self ):
if last_png_export_dir is not None and last_png_export_dir != '':
- HG.client_controller.new_options.SetNoneableString( 'last_png_export_dir', last_png_export_dir )
+ CG.client_controller.new_options.SetNoneableString( 'last_png_export_dir', last_png_export_dir )
for obj in self._payload_objs:
@@ -279,6 +278,6 @@ def Export( self ):
self._export.setText( 'done!' )
- HG.client_controller.CallLaterQtSafe( self._export, 2.0, 'png export set text', self._export.setText, 'export' )
+ CG.client_controller.CallLaterQtSafe( self._export, 2.0, 'png export set text', self._export.setText, 'export' )
diff --git a/hydrus/client/gui/ClientGUIShortcutControls.py b/hydrus/client/gui/ClientGUIShortcutControls.py
index 61ee76931..2dc125c0e 100644
--- a/hydrus/client/gui/ClientGUIShortcutControls.py
+++ b/hydrus/client/gui/ClientGUIShortcutControls.py
@@ -11,6 +11,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIDialogsQuick
from hydrus.client.gui import ClientGUIScrolledPanels
@@ -26,7 +27,7 @@ def ManageShortcuts( win: QW.QWidget ):
shortcuts_manager = ClientGUIShortcuts.shortcuts_manager()
- call_mouse_buttons_primary_secondary = HG.client_controller.new_options.GetBoolean( 'call_mouse_buttons_primary_secondary' )
+ call_mouse_buttons_primary_secondary = CG.client_controller.new_options.GetBoolean( 'call_mouse_buttons_primary_secondary' )
all_shortcuts = shortcuts_manager.GetShortcutSets()
@@ -40,13 +41,13 @@ def ManageShortcuts( win: QW.QWidget ):
( call_mouse_buttons_primary_secondary, shortcut_sets ) = panel.GetValue()
- HG.client_controller.new_options.SetBoolean( 'call_mouse_buttons_primary_secondary', call_mouse_buttons_primary_secondary )
+ CG.client_controller.new_options.SetBoolean( 'call_mouse_buttons_primary_secondary', call_mouse_buttons_primary_secondary )
ClientGUIShortcuts.SetMouseLabels( call_mouse_buttons_primary_secondary )
dupe_shortcut_sets = [ shortcut_set.Duplicate() for shortcut_set in shortcut_sets ]
- HG.client_controller.Write( 'serialisables_overwrite', [ HydrusSerialisable.SERIALISABLE_TYPE_SHORTCUT_SET ], dupe_shortcut_sets )
+ CG.client_controller.Write( 'serialisables_overwrite', [ HydrusSerialisable.SERIALISABLE_TYPE_SHORTCUT_SET ], dupe_shortcut_sets )
shortcuts_manager.SetShortcutSets( shortcut_sets )
@@ -388,7 +389,7 @@ def __init__( self, parent, call_mouse_buttons_primary_secondary, all_shortcuts
self._edit_custom_button = ClientGUICommon.BetterButton( custom_panel, 'edit', self._EditCustom )
self._delete_button = ClientGUICommon.BetterButton( custom_panel, 'delete', self._Delete )
- if not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
custom_panel.hide()
diff --git a/hydrus/client/gui/ClientGUIShortcuts.py b/hydrus/client/gui/ClientGUIShortcuts.py
index 3fc08a272..b43388642 100644
--- a/hydrus/client/gui/ClientGUIShortcuts.py
+++ b/hydrus/client/gui/ClientGUIShortcuts.py
@@ -9,13 +9,12 @@
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusSerialisable
-from hydrus.core import HydrusTime
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientData
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIFunctions
-from hydrus.client.gui import QtPorting as QP
SHORTCUT_TYPE_KEYBOARD_CHARACTER = 0
SHORTCUT_TYPE_MOUSE = 1
@@ -1218,7 +1217,7 @@ def _UpdateSerialisableInfo( self, version, old_serialisable_info ):
# this never stored mouse actions, so skip
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
for ( modifier, key, ( serialisable_service_key, data ) ) in serialisable_keyboard_actions:
@@ -1601,7 +1600,7 @@ def do_it():
self._parent_currently_activated = True
- self._activating_wait_job = HG.client_controller.CallLater( 0.2, do_it )
+ self._activating_wait_job = CG.client_controller.CallLater( 0.2, do_it )
def FrameDeactivated( self ):
diff --git a/hydrus/client/gui/ClientGUIStringPanels.py b/hydrus/client/gui/ClientGUIStringPanels.py
index 0c6ae6523..8566a2e4b 100644
--- a/hydrus/client/gui/ClientGUIStringPanels.py
+++ b/hydrus/client/gui/ClientGUIStringPanels.py
@@ -12,6 +12,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientStrings
from hydrus.client.gui import ClientGUIDialogsQuick
@@ -368,7 +369,7 @@ def _AddConversion( self ):
try:
- default_string_converter = HG.client_controller.new_options.GetRawSerialisable( 'last_used_string_conversion_step' )
+ default_string_converter = CG.client_controller.new_options.GetRawSerialisable( 'last_used_string_conversion_step' )
default_conversions = default_string_converter.GetConversions()
@@ -408,7 +409,7 @@ def _AddConversion( self ):
new_default_string_converter = ClientStrings.StringConverter( conversions = [ ( conversion_type, data ) ] )
- HG.client_controller.new_options.SetRawSerialisable( 'last_used_string_conversion_step', new_default_string_converter )
+ CG.client_controller.new_options.SetRawSerialisable( 'last_used_string_conversion_step', new_default_string_converter )
enumerated_conversion = ( number, conversion_type, data )
@@ -566,7 +567,7 @@ def _EditConversion( self ):
new_default_string_converter = ClientStrings.StringConverter( conversions = [ ( conversion_type, data ) ] )
- HG.client_controller.new_options.SetRawSerialisable( 'last_used_string_conversion_step', new_default_string_converter )
+ CG.client_controller.new_options.SetRawSerialisable( 'last_used_string_conversion_step', new_default_string_converter )
enumerated_conversion = ( number, conversion_type, data )
diff --git a/hydrus/client/gui/ClientGUISubscriptions.py b/hydrus/client/gui/ClientGUISubscriptions.py
index 1c5596e59..2fd6ee73e 100644
--- a/hydrus/client/gui/ClientGUISubscriptions.py
+++ b/hydrus/client/gui/ClientGUISubscriptions.py
@@ -15,6 +15,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientTime
from hydrus.client.gui import ClientGUIAsync
from hydrus.client.gui import ClientGUIDialogs
@@ -46,7 +47,7 @@ def GetQueryHeadersQualityInfo( query_headers: typing.Iterable[ ClientImportSubs
try:
- query_log_container = HG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
+ query_log_container = CG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
except HydrusExceptions.DataMissing:
@@ -57,7 +58,7 @@ def GetQueryHeadersQualityInfo( query_headers: typing.Iterable[ ClientImportSubs
hashes = fsc.GetHashes()
- media_results = HG.client_controller.Read( 'media_results', hashes )
+ media_results = CG.client_controller.Read( 'media_results', hashes )
num_inbox = 0
num_archived = 0
@@ -97,7 +98,7 @@ def GetQueryLogContainers( query_headers: typing.Iterable[ ClientImportSubscript
try:
- query_log_container = HG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
+ query_log_container = CG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
except HydrusExceptions.DBException as e:
@@ -172,7 +173,7 @@ def __init__( self, parent: QW.QWidget, subscription: ClientImportSubscriptions.
queries_panel.AddButton( 'check now', self._CheckNow, enabled_check_func = self._ListCtrlCanCheckNow )
queries_panel.AddButton( 'reset', self._STARTReset, enabled_check_func = self._ListCtrlCanResetCache )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
queries_panel.AddSeparator()
@@ -188,7 +189,7 @@ def __init__( self, parent: QW.QWidget, subscription: ClientImportSubscriptions.
self._file_limits_panel = ClientGUICommon.StaticBox( self, 'synchronisation' )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
limits_max = 50000
@@ -343,7 +344,7 @@ def _AddQuery( self ):
gug_key_and_name = self._gug_key_and_name.GetValue()
- initial_search_text = HG.client_controller.network_engine.domain_manager.GetInitialSearchText( gug_key_and_name )
+ initial_search_text = CG.client_controller.network_engine.domain_manager.GetInitialSearchText( gug_key_and_name )
query_header = ClientImportSubscriptionQuery.SubscriptionQueryHeader()
@@ -476,7 +477,7 @@ def _ConvertQueryHeaderToListCtrlTuples( self, query_header: ClientImportSubscri
try:
- estimate = query_header.GetBandwidthWaitingEstimate( HG.client_controller.network_engine.bandwidth_manager, self._original_subscription.GetName() )
+ estimate = query_header.GetBandwidthWaitingEstimate( CG.client_controller.network_engine.bandwidth_manager, self._original_subscription.GetName() )
if estimate == 0:
@@ -524,7 +525,7 @@ def _CopyQueries( self ):
if len( clipboard_text ) > 0:
- HG.client_controller.pub( 'clipboard', 'text', clipboard_text )
+ CG.client_controller.pub( 'clipboard', 'text', clipboard_text )
@@ -581,7 +582,7 @@ def _EditQuery( self ):
try:
- old_query_log_container = HG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_log_container_name )
+ old_query_log_container = CG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_log_container_name )
except HydrusExceptions.DataMissing:
@@ -695,7 +696,7 @@ def _CopyQualityInfo( self, data ):
text = os.linesep.join( data_strings )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _STARTShowQualityInfo( self ):
@@ -809,7 +810,7 @@ def _PasteQueries( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -1188,9 +1189,9 @@ def __init__( self, parent: QW.QWidget, query_header: ClientImportSubscriptionQu
self._check_now = QW.QCheckBox( self )
self._paused = QW.QCheckBox( self )
- self._file_seed_cache_control = ClientGUIFileSeedCache.FileSeedCacheStatusControl( self, HG.client_controller )
+ self._file_seed_cache_control = ClientGUIFileSeedCache.FileSeedCacheStatusControl( self, CG.client_controller )
- self._gallery_seed_log_control = ClientGUIGallerySeedLog.GallerySeedLogStatusControl( self, HG.client_controller, True, True, 'search' )
+ self._gallery_seed_log_control = ClientGUIGallerySeedLog.GallerySeedLogStatusControl( self, CG.client_controller, True, True, 'search' )
tag_import_options = query_header.GetTagImportOptions()
show_downloader_options = False # just for additional tags, no parsing gubbins needed
@@ -1388,7 +1389,7 @@ def __init__( self, parent: QW.QWidget, subscriptions: typing.Collection[ Client
QP.AddToLayout( vbox, help_hbox, CC.FLAGS_ON_RIGHT )
- if HG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ):
+ if CG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ):
message = 'SUBSCRIPTIONS ARE CURRENTLY GLOBALLY PAUSED! CHECK THE NETWORK MENU TO UNPAUSE THEM.'
@@ -1634,7 +1635,7 @@ def _ConvertSubscriptionToListCtrlTuples( self, subscription ):
try:
- ( min_estimate, max_estimate ) = subscription.GetBandwidthWaitingEstimateMinMax( HG.client_controller.network_engine.bandwidth_manager )
+ ( min_estimate, max_estimate ) = subscription.GetBandwidthWaitingEstimateMinMax( CG.client_controller.network_engine.bandwidth_manager )
if max_estimate == 0: # don't seem to be any delays of any kind
@@ -2032,7 +2033,7 @@ def _RetryIgnored( self, query_headers: typing.Iterable[ ClientImportSubscriptio
def Add( self ):
- gug_key_and_name = HG.client_controller.network_engine.domain_manager.GetDefaultGUGKeyAndName()
+ gug_key_and_name = CG.client_controller.network_engine.domain_manager.GetDefaultGUGKeyAndName()
empty_subscription = ClientImportSubscriptions.Subscription( 'new subscription', gug_key_and_name = gug_key_and_name )
diff --git a/hydrus/client/gui/ClientGUISystemTray.py b/hydrus/client/gui/ClientGUISystemTray.py
index 41ac04ff7..4617edfb1 100644
--- a/hydrus/client/gui/ClientGUISystemTray.py
+++ b/hydrus/client/gui/ClientGUISystemTray.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusGlobals as HG
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIMenus
from hydrus.client.gui import QtPorting as QP
@@ -107,7 +108,7 @@ def _UpdateRestoreMinimiseMenuItemLabel( self ):
self._minimise_restore_menu_item.setText( label )
- show_it = self._ui_is_currently_shown and not HG.client_controller.new_options.GetBoolean( 'minimise_client_to_system_tray' )
+ show_it = self._ui_is_currently_shown and not CG.client_controller.new_options.GetBoolean( 'minimise_client_to_system_tray' )
self._minimise_restore_menu_item.setVisible( show_it )
@@ -156,7 +157,7 @@ def _UpdateSubscriptionsMenuItemLabel( self ):
def _UpdateTooltip( self ):
- app_display_name = HG.client_controller.new_options.GetString( 'app_display_name' )
+ app_display_name = CG.client_controller.new_options.GetString( 'app_display_name' )
tooltip = app_display_name
diff --git a/hydrus/client/gui/ClientGUITagSuggestions.py b/hydrus/client/gui/ClientGUITagSuggestions.py
index ef44e6948..ecd1a6279 100644
--- a/hydrus/client/gui/ClientGUITagSuggestions.py
+++ b/hydrus/client/gui/ClientGUITagSuggestions.py
@@ -12,6 +12,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientThreading
from hydrus.client.gui import ClientGUIDialogs
@@ -51,7 +52,7 @@ def FilterSuggestedTagsForMedia( tags: typing.Sequence[ str ], medias: typing.Co
# then we could also filter out worse/better siblings of the same count
# this is a sync way for now:
- # db_tags_to_ideals_and_parents = HG.client_controller.Read( 'tag_display_decorators', service_key, tags_to_lookup )
+ # db_tags_to_ideals_and_parents = CG.client_controller.Read( 'tag_display_decorators', service_key, tags_to_lookup )
for ( tag, count ) in current_tags_to_count.items():
@@ -73,7 +74,7 @@ def __init__( self, parent, service_key, activate_callable, sort_tags = True ):
self._activate_callable = activate_callable
- width = HG.client_controller.new_options.GetInteger( 'suggested_tags_width' )
+ width = CG.client_controller.new_options.GetInteger( 'suggested_tags_width' )
if width is not None:
@@ -124,7 +125,7 @@ def __init__( self, parent, service_key, activate_callable ):
self._activate_callable = activate_callable
- width = HG.client_controller.new_options.GetInteger( 'suggested_tags_width' )
+ width = CG.client_controller.new_options.GetInteger( 'suggested_tags_width' )
self.setMinimumWidth( width )
@@ -192,9 +193,9 @@ def __init__( self, parent, service_key, media, activate_callable ):
def _UpdateTagDisplay( self ):
- favourites = list( HG.client_controller.new_options.GetSuggestedTagsFavourites( self._service_key ) )
+ favourites = list( CG.client_controller.new_options.GetSuggestedTagsFavourites( self._service_key ) )
- ClientTagSorting.SortTags( HG.client_controller.new_options.GetDefaultTagSort(), favourites )
+ ClientTagSorting.SortTags( CG.client_controller.new_options.GetDefaultTagSort(), favourites )
tags = FilterSuggestedTagsForMedia( favourites, self._media, self._service_key )
@@ -231,7 +232,7 @@ def __init__( self, parent, service_key, media, activate_callable ):
self._last_fetched_tags = []
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
vbox = QP.VBoxLayout()
@@ -271,12 +272,12 @@ def qt_code( recent_tags ):
- recent_tags = HG.client_controller.Read( 'recent_tags', service_key )
+ recent_tags = CG.client_controller.Read( 'recent_tags', service_key )
QP.CallAfter( qt_code, recent_tags )
- HG.client_controller.CallToThread( do_it, self._service_key )
+ CG.client_controller.CallToThread( do_it, self._service_key )
def _UpdateTagDisplay( self ):
@@ -294,7 +295,7 @@ def EventClear( self ):
if result == QW.QDialog.Accepted:
- HG.client_controller.Write( 'push_recent_tags', self._service_key, None )
+ CG.client_controller.Write( 'push_recent_tags', self._service_key, None )
self._last_fetched_tags = []
@@ -343,7 +344,7 @@ def __init__( self, parent, service_key, media, activate_callable ):
self._selected_tags = set()
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
vbox = QP.VBoxLayout()
@@ -369,7 +370,7 @@ def __init__( self, parent, service_key, media, activate_callable ):
self._button_3.setMinimumWidth( 30 )
self._button_3.setToolTip( tt )
- if HG.client_controller.services_manager.GetServiceType( self._service_key ) == HC.LOCAL_TAG:
+ if CG.client_controller.services_manager.GetServiceType( self._service_key ) == HC.LOCAL_TAG:
self._just_do_local_files.setVisible( False )
@@ -434,11 +435,11 @@ def qt_code( predicates, num_done, num_to_do, num_skipped, total_time_took ):
start_time = HydrusTime.GetNowPrecise()
- concurrence_threshold = HG.client_controller.new_options.GetInteger( 'related_tags_concurrence_threshold_percent' ) / 100
+ concurrence_threshold = CG.client_controller.new_options.GetInteger( 'related_tags_concurrence_threshold_percent' ) / 100
search_tag_slices_weight_dict = { ':' : 1.0, '' : 1.0 }
result_tag_slices_weight_dict = { ':' : 1.0, '' : 1.0 }
- ( related_tags_search_tag_slices_weight_percent, related_tags_result_tag_slices_weight_percent ) = HG.client_controller.new_options.GetRelatedTagsTagSliceWeights()
+ ( related_tags_search_tag_slices_weight_percent, related_tags_result_tag_slices_weight_percent ) = CG.client_controller.new_options.GetRelatedTagsTagSliceWeights()
for ( tag_slice, weight_percent ) in related_tags_search_tag_slices_weight_percent:
@@ -466,7 +467,7 @@ def qt_code( predicates, num_done, num_to_do, num_skipped, total_time_took ):
result_tag_slices_weight_dict[ tag_slice ] = weight_percent / 100
- ( num_done, num_to_do, num_skipped, predicates ) = HG.client_controller.Read(
+ ( num_done, num_to_do, num_skipped, predicates ) = CG.client_controller.Read(
'related_tags',
file_service_key,
tag_service_key,
@@ -520,7 +521,7 @@ def qt_code( predicates, num_done, num_to_do, num_skipped, total_time_took ):
tag_service_key = self._service_key
- HG.client_controller.CallToThread( do_it, file_service_key, tag_service_key, search_tags, other_tags_to_exclude )
+ CG.client_controller.CallToThread( do_it, file_service_key, tag_service_key, search_tags, other_tags_to_exclude )
def _UpdateTagDisplay( self ):
@@ -648,7 +649,7 @@ def qt_code():
self._script_choice.addItem( script.GetName(), script )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
favourite_file_lookup_script = new_options.GetNoneableString( 'favourite_file_lookup_script' )
@@ -665,12 +666,12 @@ def qt_code():
self._fetch_button.setEnabled( True )
- scripts = HG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_PARSE_ROOT_FILE_LOOKUP )
+ scripts = CG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_PARSE_ROOT_FILE_LOOKUP )
QP.CallAfter( qt_code )
- HG.client_controller.CallToThread( do_it )
+ CG.client_controller.CallToThread( do_it )
def _SetTags( self, tags ):
@@ -729,7 +730,7 @@ def FetchTags( self ):
self._SetTags( [] )
- HG.client_controller.CallToThread( self.THREADFetchTags, script, job_status, file_identifier )
+ CG.client_controller.CallToThread( self.THREADFetchTags, script, job_status, file_identifier )
def MediaUpdated( self ):
@@ -792,7 +793,7 @@ def __init__( self, parent, service_key, media, activate_callable ):
self._service_key = service_key
self._media = media
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
layout_mode = self._new_options.GetNoneableString( 'suggested_tags_layout' )
@@ -813,7 +814,7 @@ def __init__( self, parent, service_key, media, activate_callable ):
self._favourite_tags = None
- favourites = HG.client_controller.new_options.GetSuggestedTagsFavourites( self._service_key )
+ favourites = CG.client_controller.new_options.GetSuggestedTagsFavourites( self._service_key )
if len( favourites ) > 0:
diff --git a/hydrus/client/gui/ClientGUITags.py b/hydrus/client/gui/ClientGUITags.py
index 617b1aff2..07ec5ee48 100644
--- a/hydrus/client/gui/ClientGUITags.py
+++ b/hydrus/client/gui/ClientGUITags.py
@@ -22,6 +22,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientManagers
from hydrus.client.gui import ClientGUIAsync
@@ -81,7 +82,7 @@ def EditNamespaceSort( win: QW.QWidget, sort_data ):
if len( edited_namespaces ) > 0:
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
available_types = [
ClientTags.TAG_DISPLAY_DISPLAY_ACTUAL,
@@ -121,7 +122,7 @@ def __init__( self, parent: QW.QWidget, tag_autocomplete_options: ClientTagsHand
ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
self._original_tag_autocomplete_options = tag_autocomplete_options
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
all_real_tag_service_keys = services_manager.GetServiceKeys( HC.REAL_TAG_SERVICES )
@@ -331,7 +332,7 @@ def __init__( self, parent, master_service_keys_to_sibling_applicable_service_ke
#
- services = list( HG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES ) )
+ services = list( CG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES ) )
select_service_key = services[0].GetServiceKey()
@@ -376,7 +377,7 @@ def __init__( self, parent, master_service_keys_to_sibling_applicable_service_ke
self._sync_status.setWordWrap( True )
- if HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
+ if CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
self._sync_status.setText( 'Siblings and parents are set to sync all the time. Changes will start applying as soon as you ok this dialog.' )
@@ -384,7 +385,7 @@ def __init__( self, parent, master_service_keys_to_sibling_applicable_service_ke
else:
- if HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_idle' ):
+ if CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_idle' ):
self._sync_status.setText( 'Siblings and parents are only set to sync during idle time. Changes here will only start to apply when you are not using the client.' )
@@ -436,7 +437,7 @@ def __init__( self, parent: QW.QWidget, master_service_key: bytes, sibling_appli
#
- self._sibling_service_keys_listbox = ClientGUIListBoxes.QueueListBox( self._sibling_box, 4, HG.client_controller.services_manager.GetName, add_callable = self._AddSibling )
+ self._sibling_service_keys_listbox = ClientGUIListBoxes.QueueListBox( self._sibling_box, 4, CG.client_controller.services_manager.GetName, add_callable = self._AddSibling )
#
@@ -448,7 +449,7 @@ def __init__( self, parent: QW.QWidget, master_service_key: bytes, sibling_appli
#
- self._parent_service_keys_listbox = ClientGUIListBoxes.QueueListBox( self._sibling_box, 4, HG.client_controller.services_manager.GetName, add_callable = self._AddParent )
+ self._parent_service_keys_listbox = ClientGUIListBoxes.QueueListBox( self._sibling_box, 4, CG.client_controller.services_manager.GetName, add_callable = self._AddParent )
#
@@ -479,7 +480,7 @@ def _AddParent( self ):
def _AddService( self, current_service_keys ):
- allowed_services = HG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
+ allowed_services = CG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
allowed_services = [ service for service in allowed_services if service.GetServiceKey() not in current_service_keys ]
@@ -533,7 +534,7 @@ def __init__( self, parent, tag_display_manager: ClientTagsHandling.TagDisplayMa
#
- services = list( HG.client_controller.services_manager.GetServices( ( HC.COMBINED_TAG, HC.LOCAL_TAG, HC.TAG_REPOSITORY ) ) )
+ services = list( CG.client_controller.services_manager.GetServices( ( HC.COMBINED_TAG, HC.LOCAL_TAG, HC.TAG_REPOSITORY ) ) )
for service in services:
@@ -700,7 +701,7 @@ def __init__( self, parent, tag_filter, only_show_blacklist = False, namespaces
self._show_all_panels_button = ClientGUICommon.BetterButton( self, 'show other panels', self._ShowAllPanels )
self._show_all_panels_button.setToolTip( 'This shows the whitelist and advanced panels, in case you want to craft a clever blacklist with \'except\' rules.' )
- show_the_button = self._only_show_blacklist and HG.client_controller.new_options.GetBoolean( 'advanced_mode' )
+ show_the_button = self._only_show_blacklist and CG.client_controller.new_options.GetBoolean( 'advanced_mode' )
self._show_all_panels_button.setVisible( show_the_button )
@@ -1014,7 +1015,7 @@ def _DeleteFavourite( self ):
def do_it( name ):
- names_to_tag_filters = HG.client_controller.new_options.GetFavouriteTagFilters()
+ names_to_tag_filters = CG.client_controller.new_options.GetFavouriteTagFilters()
if name in names_to_tag_filters:
@@ -1029,11 +1030,11 @@ def do_it( name ):
del names_to_tag_filters[ name ]
- HG.client_controller.new_options.SetFavouriteTagFilters( names_to_tag_filters )
+ CG.client_controller.new_options.SetFavouriteTagFilters( names_to_tag_filters )
- names_to_tag_filters = HG.client_controller.new_options.GetFavouriteTagFilters()
+ names_to_tag_filters = CG.client_controller.new_options.GetFavouriteTagFilters()
menu = ClientGUIMenus.GenerateMenu( self )
@@ -1054,11 +1055,11 @@ def do_it( name ):
def _ExportFavourite( self ):
- names_to_tag_filters = HG.client_controller.new_options.GetFavouriteTagFilters()
+ names_to_tag_filters = CG.client_controller.new_options.GetFavouriteTagFilters()
menu = ClientGUIMenus.GenerateMenu( self )
- ClientGUIMenus.AppendMenuItem( menu, 'this tag filter', 'export this tag filter', HG.client_controller.pub, 'clipboard', 'text', self.GetValue().DumpToString() )
+ ClientGUIMenus.AppendMenuItem( menu, 'this tag filter', 'export this tag filter', CG.client_controller.pub, 'clipboard', 'text', self.GetValue().DumpToString() )
if len( names_to_tag_filters ) > 0:
@@ -1066,7 +1067,7 @@ def _ExportFavourite( self ):
for ( name, tag_filter ) in names_to_tag_filters.items():
- ClientGUIMenus.AppendMenuItem( menu, name, 'export {}'.format( name ), HG.client_controller.pub, 'clipboard', 'text', tag_filter.DumpToString() )
+ ClientGUIMenus.AppendMenuItem( menu, name, 'export {}'.format( name ), CG.client_controller.pub, 'clipboard', 'text', tag_filter.DumpToString() )
@@ -1092,7 +1093,7 @@ def _ImportFavourite( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -1129,7 +1130,7 @@ def _ImportFavourite( self ):
if dlg.exec() == QW.QDialog.Accepted:
- names_to_tag_filters = HG.client_controller.new_options.GetFavouriteTagFilters()
+ names_to_tag_filters = CG.client_controller.new_options.GetFavouriteTagFilters()
name = dlg.GetValue()
@@ -1147,7 +1148,7 @@ def _ImportFavourite( self ):
names_to_tag_filters[ name ] = tag_filter
- HG.client_controller.new_options.SetFavouriteTagFilters( names_to_tag_filters )
+ CG.client_controller.new_options.SetFavouriteTagFilters( names_to_tag_filters )
self.SetValue( tag_filter )
@@ -1386,7 +1387,7 @@ def _InitWhitelistPanel( self ):
def _LoadFavourite( self ):
- names_to_tag_filters = HG.client_controller.new_options.GetFavouriteTagFilters()
+ names_to_tag_filters = CG.client_controller.new_options.GetFavouriteTagFilters()
menu = ClientGUIMenus.GenerateMenu( self )
@@ -1411,7 +1412,7 @@ def _SaveFavourite( self ):
if dlg.exec() == QW.QDialog.Accepted:
- names_to_tag_filters = HG.client_controller.new_options.GetFavouriteTagFilters()
+ names_to_tag_filters = CG.client_controller.new_options.GetFavouriteTagFilters()
name = dlg.GetValue()
tag_filter = self.GetValue()
@@ -1430,7 +1431,7 @@ def _SaveFavourite( self ):
names_to_tag_filters[ name ] = tag_filter
- HG.client_controller.new_options.SetFavouriteTagFilters( names_to_tag_filters )
+ CG.client_controller.new_options.SetFavouriteTagFilters( names_to_tag_filters )
@@ -1471,7 +1472,7 @@ def _ShowRedundantError( self, text ):
self._redundant_st.setText( text )
- HG.client_controller.CallLaterQtSafe( self._redundant_st, 2, 'clear redundant error', self._redundant_st.setVisible, False )
+ CG.client_controller.CallLaterQtSafe( self._redundant_st, 2, 'clear redundant error', self._redundant_st.setVisible, False )
def _SimpleAddBlacklistMultiple( self, tag_slices ):
@@ -1745,7 +1746,7 @@ def work_callable():
results = []
- tags_to_siblings = HG.client_controller.Read( 'tag_siblings_lookup', CC.COMBINED_TAG_SERVICE_KEY, test_tags )
+ tags_to_siblings = CG.client_controller.Read( 'tag_siblings_lookup', CC.COMBINED_TAG_SERVICE_KEY, test_tags )
for test_tag_and_siblings in tags_to_siblings.values():
@@ -1947,16 +1948,16 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext, me
#
- services = list( HG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) ) )
+ services = list( CG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) ) )
- services.extend( HG.client_controller.services_manager.GetServices( ( HC.TAG_REPOSITORY, ) ) )
+ services.extend( CG.client_controller.services_manager.GetServices( ( HC.TAG_REPOSITORY, ) ) )
if HG.gui_report_mode:
HydrusData.ShowText( f'Opening manage tags on these services: {services}' )
- default_tag_service_key = HG.client_controller.new_options.GetKey( 'default_tag_service_tab' )
+ default_tag_service_key = CG.client_controller.new_options.GetKey( 'default_tag_service_tab' )
for service in services:
@@ -1979,6 +1980,8 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext, me
page.okSignal.connect( self.okSignal )
+ page.valueChanged.connect( self._UpdatePageTabNames )
+
if service_key == default_tag_service_key:
# Py 3.11/PyQt6 6.5.0/two tabs/total tab characters > ~12/select second tab during init = first tab disappears bug
@@ -2003,11 +2006,13 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext, me
if self._canvas_key is not None:
- HG.client_controller.sub( self, 'CanvasHasNewMedia', 'canvas_new_display_media' )
+ CG.client_controller.sub( self, 'CanvasHasNewMedia', 'canvas_new_display_media' )
self._my_shortcut_handler = ClientGUIShortcuts.ShortcutsHandler( self, [ 'global', 'media', 'main_gui' ] )
+ self._UpdatePageTabNames()
+
QP.CallAfter( self._SetSearchFocus )
@@ -2033,6 +2038,39 @@ def _SetSearchFocus( self ):
+ def _UpdatePageTabNames( self ):
+
+ for index in range( self._tag_services.count() ):
+
+ page = self._tag_services.widget( index )
+
+ service_key = page.GetServiceKey()
+
+ service_name = CG.client_controller.services_manager.GetServiceName( service_key )
+
+ num_tags = page.GetTagCount()
+
+ if num_tags > 0:
+
+ tab_name = f'{service_name} ({num_tags})'
+
+ else:
+
+ tab_name = service_name
+
+
+ if page.HasChanges():
+
+ tab_name += ' *'
+
+
+ if self._tag_services.tabText( index ) != tab_name:
+
+ self._tag_services.setTabText( index, tab_name )
+
+
+
+
def CanvasHasNewMedia( self, canvas_key, new_media_singleton ):
if canvas_key == self._canvas_key:
@@ -2046,6 +2084,8 @@ def CanvasHasNewMedia( self, canvas_key, new_media_singleton ):
page.SetMedia( self._current_media )
+ self._UpdatePageTabNames()
+
@@ -2065,7 +2105,7 @@ def CommitChanges( self ):
for content_update_package in content_update_packages:
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -2085,14 +2125,14 @@ def EventServiceChanged( self, index ):
if page is not None:
- HG.client_controller.CallAfterQtSafe( page, 'setting page focus', page.SetTagBoxFocus )
+ CG.client_controller.CallAfterQtSafe( page, 'setting page focus', page.SetTagBoxFocus )
- if HG.client_controller.new_options.GetBoolean( 'save_default_tag_service_tab_on_change' ):
+ if CG.client_controller.new_options.GetBoolean( 'save_default_tag_service_tab_on_change' ):
current_page = self._tag_services.currentWidget()
- HG.client_controller.new_options.SetKey( 'default_tag_service_tab', current_page.GetServiceKey() )
+ CG.client_controller.new_options.SetKey( 'default_tag_service_tab', current_page.GetServiceKey() )
@@ -2163,7 +2203,7 @@ def ShowNext( self ):
if self._canvas_key is not None:
- HG.client_controller.pub( 'canvas_show_next', self._canvas_key )
+ CG.client_controller.pub( 'canvas_show_next', self._canvas_key )
@@ -2171,7 +2211,7 @@ def ShowPrevious( self ):
if self._canvas_key is not None:
- HG.client_controller.pub( 'canvas_show_previous', self._canvas_key )
+ CG.client_controller.pub( 'canvas_show_previous', self._canvas_key )
@@ -2201,6 +2241,7 @@ class _Panel( CAC.ApplicationCommandProcessorMixin, QW.QWidget ):
movePageRight = QC.Signal()
showPrevious = QC.Signal()
showNext = QC.Signal()
+ valueChanged = QC.Signal()
def __init__( self, parent, location_context: ClientLocation.LocationContext, tag_service_key, media, immediate_commit, canvas_key = None ):
@@ -2214,7 +2255,7 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext, ta
self._groups_of_content_updates = []
- self._service = HG.client_controller.services_manager.GetService( self._tag_service_key )
+ self._service = CG.client_controller.services_manager.GetService( self._tag_service_key )
self._i_am_local_tag_service = self._service.GetServiceType() == HC.LOCAL_TAG
@@ -2226,7 +2267,7 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext, ta
#
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
if self._i_am_local_tag_service:
@@ -2324,7 +2365,7 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext, ta
if self._immediate_commit:
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
self._suggested_tags.mouseActivationOccurred.connect( self.SetTagBoxFocus )
@@ -2550,7 +2591,7 @@ def _EnterTags( self, tags, only_add = False, only_remove = False, forced_reason
'splitting filename/title/etc... into individual tags'
]
- suggestions = HG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_MAPPINGS, HC.CONTENT_UPDATE_DELETE )
+ suggestions = CG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_MAPPINGS, HC.CONTENT_UPDATE_DELETE )
suggestions.extend( fixed_suggestions )
@@ -2562,7 +2603,7 @@ def _EnterTags( self, tags, only_add = False, only_remove = False, forced_reason
if reason not in fixed_suggestions:
- HG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_MAPPINGS, HC.CONTENT_UPDATE_DELETE, reason )
+ CG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_MAPPINGS, HC.CONTENT_UPDATE_DELETE, reason )
else:
@@ -2632,7 +2673,7 @@ def _EnterTags( self, tags, only_add = False, only_remove = False, forced_reason
- num_recent_tags = HG.client_controller.new_options.GetNoneableInteger( 'num_recent_tags' )
+ num_recent_tags = CG.client_controller.new_options.GetNoneableInteger( 'num_recent_tags' )
if len( recent_tags ) > 0 and num_recent_tags is not None:
@@ -2643,7 +2684,7 @@ def _EnterTags( self, tags, only_add = False, only_remove = False, forced_reason
recent_tags = random.sample( recent_tags, num_recent_tags )
- HG.client_controller.Write( 'push_recent_tags', self._tag_service_key, recent_tags )
+ CG.client_controller.Write( 'push_recent_tags', self._tag_service_key, recent_tags )
if len( content_updates_group ) > 0:
@@ -2652,7 +2693,7 @@ def _EnterTags( self, tags, only_add = False, only_remove = False, forced_reason
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._tag_service_key, content_updates_group )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
else:
@@ -2664,6 +2705,8 @@ def _EnterTags( self, tags, only_add = False, only_remove = False, forced_reason
self._tags_box.SetTagsByMedia( self._media )
+ self.valueChanged.emit()
+
def _MigrateTags( self ):
@@ -2676,7 +2719,7 @@ def _MigrateTags( self ):
def do_it( tag_service_key, hashes ):
- tlw = HG.client_controller.GetMainTLW()
+ tlw = CG.client_controller.GetMainTLW()
frame = ClientGUITopLevelWindowsPanels.FrameThatTakesScrollablePanel( tlw, 'migrate tags' )
@@ -2707,7 +2750,7 @@ def _Copy( self ):
text = os.linesep.join( tags )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -2756,7 +2799,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -2855,6 +2898,11 @@ def GetContentUpdatePackages( self ):
return content_update_packages
+ def GetTagCount( self ):
+
+ return self._tags_box.GetNumTerms()
+
+
def GetServiceKey( self ):
return self._tag_service_key
@@ -2921,6 +2969,8 @@ def ProcessContentUpdatePackage( self, content_update_package: ClientContentUpda
self._tags_box.SetTagsByMedia( self._media )
+ self.valueChanged.emit()
+
self._suggested_tags.MediaUpdated()
@@ -2964,6 +3014,8 @@ def SetMedia( self, media ):
self._tags_box.SetTagsByMedia( self._media )
+ self.valueChanged.emit()
+
self._suggested_tags.SetMedia( media )
@@ -2983,11 +3035,11 @@ def __init__( self, parent, tags = None ):
#
- default_tag_service_key = HG.client_controller.new_options.GetKey( 'default_tag_service_tab' )
+ default_tag_service_key = CG.client_controller.new_options.GetKey( 'default_tag_service_tab' )
- services = list( HG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) ) )
+ services = list( CG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) ) )
- services.extend( HG.client_controller.services_manager.GetServices( ( HC.TAG_REPOSITORY, ) ) )
+ services.extend( CG.client_controller.services_manager.GetServices( ( HC.TAG_REPOSITORY, ) ) )
for service in services:
@@ -3018,11 +3070,11 @@ def __init__( self, parent, tags = None ):
def _SaveDefaultTagServiceKey( self ):
- if HG.client_controller.new_options.GetBoolean( 'save_default_tag_service_tab_on_change' ):
+ if CG.client_controller.new_options.GetBoolean( 'save_default_tag_service_tab_on_change' ):
current_page = self._tag_services.currentWidget()
- HG.client_controller.new_options.SetKey( 'default_tag_service_tab', current_page.GetServiceKey() )
+ CG.client_controller.new_options.SetKey( 'default_tag_service_tab', current_page.GetServiceKey() )
@@ -3049,7 +3101,7 @@ def CommitChanges( self ):
if content_update_package.HasContent():
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
@@ -3078,7 +3130,7 @@ def __init__( self, parent, service_key, tags = None ):
self._service_key = service_key
- self._service = HG.client_controller.services_manager.GetService( self._service_key )
+ self._service = CG.client_controller.services_manager.GetService( self._service_key )
self._i_am_local_tag_service = self._service.GetServiceType() == HC.LOCAL_TAG
@@ -3134,7 +3186,7 @@ def __init__( self, parent, service_key, tags = None ):
self._children.setMinimumHeight( preview_height )
self._parents.setMinimumHeight( preview_height )
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._child_input = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite( self, self.EnterChildren, default_location_context, service_key, show_paste_button = True )
self._child_input.setEnabled( False )
@@ -3194,7 +3246,7 @@ def __init__( self, parent, service_key, tags = None ):
self._child_input.tagsPasted.connect( self.EnterChildrenOnlyAdd )
self._parent_input.tagsPasted.connect( self.EnterParentsOnlyAdd )
- HG.client_controller.CallToThread( self.THREADInitialise, tags, self._service_key )
+ CG.client_controller.CallToThread( self.THREADInitialise, tags, self._service_key )
def _AddButton( self ):
@@ -3285,7 +3337,7 @@ def _AddPairs( self, pairs, add_only = False ):
'character/series/studio/etc... belonging (character x belongs to series y)'
]
- suggestions = HG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_TAG_PARENTS, HC.CONTENT_UPDATE_ADD )
+ suggestions = CG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_TAG_PARENTS, HC.CONTENT_UPDATE_ADD )
suggestions.extend( fixed_suggestions )
@@ -3297,7 +3349,7 @@ def _AddPairs( self, pairs, add_only = False ):
if reason not in fixed_suggestions:
- HG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_TAG_PARENTS, HC.CONTENT_UPDATE_ADD, reason )
+ CG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_TAG_PARENTS, HC.CONTENT_UPDATE_ADD, reason )
else:
@@ -3370,7 +3422,7 @@ def _AddPairs( self, pairs, add_only = False ):
'obvious typo/mistake'
]
- suggestions = HG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_TAG_PARENTS, HC.CONTENT_UPDATE_DELETE )
+ suggestions = CG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_TAG_PARENTS, HC.CONTENT_UPDATE_DELETE )
suggestions.extend( fixed_suggestions )
@@ -3383,7 +3435,7 @@ def _AddPairs( self, pairs, add_only = False ):
if reason not in fixed_suggestions:
- HG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_TAG_PARENTS, HC.CONTENT_UPDATE_DELETE, reason )
+ CG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_TAG_PARENTS, HC.CONTENT_UPDATE_DELETE, reason )
else:
@@ -3617,7 +3669,7 @@ def _ExportToClipboard( self ):
export_string = self._GetExportString()
- HG.client_controller.pub( 'clipboard', 'text', export_string )
+ CG.client_controller.pub( 'clipboard', 'text', export_string )
def _ExportToTXT( self ):
@@ -3657,7 +3709,7 @@ def _ImportFromClipboard( self, add_only = False ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -3984,8 +4036,8 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
else:
- synced_names = sorted( ( HG.client_controller.services_manager.GetName( s_k ) for ( s_k, work_to_do ) in service_keys_to_work_to_do.items() if not work_to_do ) )
- unsynced_names = sorted( ( HG.client_controller.services_manager.GetName( s_k ) for ( s_k, work_to_do ) in service_keys_to_work_to_do.items() if work_to_do ) )
+ synced_names = sorted( ( CG.client_controller.services_manager.GetName( s_k ) for ( s_k, work_to_do ) in service_keys_to_work_to_do.items() if not work_to_do ) )
+ unsynced_names = sorted( ( CG.client_controller.services_manager.GetName( s_k ) for ( s_k, work_to_do ) in service_keys_to_work_to_do.items() if work_to_do ) )
synced_string = ', '.join( ( '"{}"'.format( name ) for name in synced_names ) )
unsynced_string = ', '.join( ( '"{}"'.format( name ) for name in unsynced_names ) )
@@ -4008,7 +4060,7 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
- if HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
+ if CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
maintenance_part = 'Parents are set to sync all the time in the background.'
@@ -4025,7 +4077,7 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
looking_good = False
- if HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_idle' ):
+ if CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_idle' ):
maintenance_part = 'Parents are set to sync only when you are not using the client.'
changes_part = 'It may take some time for changes here to apply.'
@@ -4097,9 +4149,9 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
- original_statuses_to_pairs = HG.client_controller.Read( 'tag_parents', service_key )
+ original_statuses_to_pairs = CG.client_controller.Read( 'tag_parents', service_key )
- ( master_service_keys_to_sibling_applicable_service_keys, master_service_keys_to_parent_applicable_service_keys ) = HG.client_controller.Read( 'tag_display_application' )
+ ( master_service_keys_to_sibling_applicable_service_keys, master_service_keys_to_parent_applicable_service_keys ) = CG.client_controller.Read( 'tag_display_application' )
service_keys_we_care_about = { s_k for ( s_k, s_ks ) in master_service_keys_to_parent_applicable_service_keys.items() if service_key in s_ks }
@@ -4107,7 +4159,7 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
for s_k in service_keys_we_care_about:
- status = HG.client_controller.Read( 'tag_display_maintenance_status', s_k )
+ status = CG.client_controller.Read( 'tag_display_maintenance_status', s_k )
work_to_do = status[ 'num_parents_to_sync' ] > 0
@@ -4132,11 +4184,11 @@ def __init__( self, parent, tags = None ):
#
- default_tag_service_key = HG.client_controller.new_options.GetKey( 'default_tag_service_tab' )
+ default_tag_service_key = CG.client_controller.new_options.GetKey( 'default_tag_service_tab' )
- services = list( HG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) ) )
+ services = list( CG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) ) )
- services.extend( HG.client_controller.services_manager.GetServices( ( HC.TAG_REPOSITORY, ) ) )
+ services.extend( CG.client_controller.services_manager.GetServices( ( HC.TAG_REPOSITORY, ) ) )
for service in services:
@@ -4167,11 +4219,11 @@ def __init__( self, parent, tags = None ):
def _SaveDefaultTagServiceKey( self ):
- if HG.client_controller.new_options.GetBoolean( 'save_default_tag_service_tab_on_change' ):
+ if CG.client_controller.new_options.GetBoolean( 'save_default_tag_service_tab_on_change' ):
current_page = self._tag_services.currentWidget()
- HG.client_controller.new_options.SetKey( 'default_tag_service_tab', current_page.GetServiceKey() )
+ CG.client_controller.new_options.SetKey( 'default_tag_service_tab', current_page.GetServiceKey() )
@@ -4198,7 +4250,7 @@ def CommitChanges( self ):
if content_update_package.HasContent():
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
@@ -4225,7 +4277,7 @@ def EventServiceChanged( self, event ):
if page is not None:
- HG.client_controller.CallAfterQtSafe( page, 'setting page focus', page.SetTagBoxFocus )
+ CG.client_controller.CallAfterQtSafe( page, 'setting page focus', page.SetTagBoxFocus )
@@ -4239,7 +4291,7 @@ def __init__( self, parent, service_key, tags = None ):
self._service_key = service_key
- self._service = HG.client_controller.services_manager.GetService( self._service_key )
+ self._service = CG.client_controller.services_manager.GetService( self._service_key )
self._i_am_local_tag_service = self._service.GetServiceType() == HC.LOCAL_TAG
@@ -4291,7 +4343,7 @@ def __init__( self, parent, service_key, tags = None ):
self._old_siblings.setMinimumHeight( preview_height )
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._old_input = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite( self, self.EnterOlds, default_location_context, service_key, show_paste_button = True )
self._old_input.setEnabled( False )
@@ -4345,7 +4397,7 @@ def __init__( self, parent, service_key, tags = None ):
self._show_all.clicked.connect( self._UpdateListCtrlData )
self._old_siblings.listBoxChanged.connect( self._UpdateListCtrlData )
- HG.client_controller.CallToThread( self.THREADInitialise, tags, self._service_key )
+ CG.client_controller.CallToThread( self.THREADInitialise, tags, self._service_key )
self._listctrl_async_updater = self._InitialiseListCtrlAsyncUpdater()
@@ -4455,7 +4507,7 @@ def _AddPairs( self, pairs, add_only = False, remove_only = False, default_reaso
'rewording/namespacing based on preference'
]
- suggestions = HG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_TAG_SIBLINGS, HC.CONTENT_UPDATE_ADD )
+ suggestions = CG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_TAG_SIBLINGS, HC.CONTENT_UPDATE_ADD )
suggestions.extend( fixed_suggestions )
@@ -4469,7 +4521,7 @@ def _AddPairs( self, pairs, add_only = False, remove_only = False, default_reaso
if reason not in fixed_suggestions:
- HG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_TAG_SIBLINGS, HC.CONTENT_UPDATE_ADD, reason )
+ CG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_TAG_SIBLINGS, HC.CONTENT_UPDATE_ADD, reason )
else:
@@ -4561,7 +4613,7 @@ def _AddPairs( self, pairs, add_only = False, remove_only = False, default_reaso
'correcting to repository standard'
]
- suggestions = HG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_TAG_SIBLINGS, HC.CONTENT_UPDATE_DELETE )
+ suggestions = CG.client_controller.new_options.GetRecentPetitionReasons( HC.CONTENT_TYPE_TAG_SIBLINGS, HC.CONTENT_UPDATE_DELETE )
suggestions.extend( fixed_suggestions )
@@ -4573,7 +4625,7 @@ def _AddPairs( self, pairs, add_only = False, remove_only = False, default_reaso
if reason not in fixed_suggestions:
- HG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_TAG_SIBLINGS, HC.CONTENT_UPDATE_DELETE, reason )
+ CG.client_controller.new_options.PushRecentPetitionReason( HC.CONTENT_TYPE_TAG_SIBLINGS, HC.CONTENT_UPDATE_DELETE, reason )
else:
@@ -4956,7 +5008,7 @@ def _ExportToClipboard( self ):
export_string = self._GetExportString()
- HG.client_controller.pub( 'clipboard', 'text', export_string )
+ CG.client_controller.pub( 'clipboard', 'text', export_string )
def _ExportToTXT( self ):
@@ -4996,7 +5048,7 @@ def _ImportFromClipboard( self, add_only = False ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -5369,8 +5421,8 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
else:
- synced_names = sorted( ( HG.client_controller.services_manager.GetName( s_k ) for ( s_k, work_to_do ) in service_keys_to_work_to_do.items() if not work_to_do ) )
- unsynced_names = sorted( ( HG.client_controller.services_manager.GetName( s_k ) for ( s_k, work_to_do ) in service_keys_to_work_to_do.items() if work_to_do ) )
+ synced_names = sorted( ( CG.client_controller.services_manager.GetName( s_k ) for ( s_k, work_to_do ) in service_keys_to_work_to_do.items() if not work_to_do ) )
+ unsynced_names = sorted( ( CG.client_controller.services_manager.GetName( s_k ) for ( s_k, work_to_do ) in service_keys_to_work_to_do.items() if work_to_do ) )
synced_string = ', '.join( ( '"{}"'.format( name ) for name in synced_names ) )
unsynced_string = ', '.join( ( '"{}"'.format( name ) for name in unsynced_names ) )
@@ -5393,7 +5445,7 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
- if HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
+ if CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
maintenance_part = 'Siblings are set to sync all the time in the background.'
@@ -5410,7 +5462,7 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
looking_good = False
- if HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_idle' ):
+ if CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_idle' ):
maintenance_part = 'Siblings are set to sync only when you are not using the client.'
changes_part = 'It may take some time for changes here to apply.'
@@ -5483,9 +5535,9 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
- original_statuses_to_pairs = HG.client_controller.Read( 'tag_siblings', service_key )
+ original_statuses_to_pairs = CG.client_controller.Read( 'tag_siblings', service_key )
- ( master_service_keys_to_sibling_applicable_service_keys, master_service_keys_to_parent_applicable_service_keys ) = HG.client_controller.Read( 'tag_display_application' )
+ ( master_service_keys_to_sibling_applicable_service_keys, master_service_keys_to_parent_applicable_service_keys ) = CG.client_controller.Read( 'tag_display_application' )
service_keys_we_care_about = { s_k for ( s_k, s_ks ) in master_service_keys_to_sibling_applicable_service_keys.items() if service_key in s_ks }
@@ -5493,7 +5545,7 @@ def qt_code( original_statuses_to_pairs, current_statuses_to_pairs, service_keys
for s_k in service_keys_we_care_about:
- status = HG.client_controller.Read( 'tag_display_maintenance_status', s_k )
+ status = CG.client_controller.Read( 'tag_display_maintenance_status', s_k )
work_to_do = status[ 'num_siblings_to_sync' ] > 0
@@ -5522,7 +5574,7 @@ def __init__( self, parent ):
#
- services = list( HG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES ) )
+ services = list( CG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES ) )
select_service_key = services[0].GetServiceKey()
@@ -5563,12 +5615,12 @@ def __init__( self, parent ):
self.widget().setLayout( vbox )
- HG.client_controller.sub( self, '_UpdateStatusText', 'notify_new_menu_option' )
+ CG.client_controller.sub( self, '_UpdateStatusText', 'notify_new_menu_option' )
def _UpdateStatusText( self ):
- if HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
+ if CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
self._sync_status.setText( 'Siblings and parents are set to sync all the time. If there is work to do here, it should be cleared out in real time as you watch.' )
@@ -5576,7 +5628,7 @@ def _UpdateStatusText( self ):
else:
- if HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_idle' ):
+ if CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_idle' ):
self._sync_status.setText( 'Siblings and parents are only set to sync during idle time. If there is work to do here, it should be cleared out when you are not using the client.' )
@@ -5623,8 +5675,8 @@ def __init__( self, parent, service_key ):
self._refresh_values_updater = self._InitialiseRefreshValuesUpdater()
- HG.client_controller.sub( self, 'NotifyRefresh', 'notify_new_tag_display_sync_status' )
- HG.client_controller.sub( self, '_StartRefresh', 'notify_new_tag_display_application' )
+ CG.client_controller.sub( self, 'NotifyRefresh', 'notify_new_tag_display_sync_status' )
+ CG.client_controller.sub( self, '_StartRefresh', 'notify_new_tag_display_application' )
self._StartRefresh()
@@ -5640,7 +5692,7 @@ def loading_callable():
self._refresh_button.setEnabled( False )
# keep button available to slow down
- running_fast_and_button_is_slow = HG.client_controller.tag_display_maintenance_manager.CurrentlyGoingFaster( self._service_key ) and 'slow' in self._go_faster_button.text()
+ running_fast_and_button_is_slow = CG.client_controller.tag_display_maintenance_manager.CurrentlyGoingFaster( self._service_key ) and 'slow' in self._go_faster_button.text()
if not running_fast_and_button_is_slow:
@@ -5650,7 +5702,7 @@ def loading_callable():
def work_callable( args ):
- status = HG.client_controller.Read( 'tag_display_maintenance_status', service_key )
+ status = CG.client_controller.Read( 'tag_display_maintenance_status', service_key )
time.sleep( 0.1 ) # for user feedback more than anything
@@ -5746,13 +5798,13 @@ def publish_callable( result ):
self._go_faster_button.setVisible( sync_work_to_do and not sync_halted )
self._go_faster_button.setEnabled( sync_work_to_do and not sync_halted )
- if HG.client_controller.tag_display_maintenance_manager.CurrentlyGoingFaster( self._service_key ):
+ if CG.client_controller.tag_display_maintenance_manager.CurrentlyGoingFaster( self._service_key ):
self._go_faster_button.setText( 'slow down!' )
else:
- if not HG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
+ if not CG.client_controller.new_options.GetBoolean( 'tag_display_maintenance_during_active' ):
self._go_faster_button.setText( 'work now!' )
@@ -5773,7 +5825,7 @@ def _StartRefresh( self ):
def _SyncFaster( self ):
- HG.client_controller.tag_display_maintenance_manager.FlipSyncFaster( self._service_key )
+ CG.client_controller.tag_display_maintenance_manager.FlipSyncFaster( self._service_key )
self._StartRefresh()
@@ -5816,7 +5868,7 @@ def _EditTagFilter( self ):
with ClientGUITopLevelWindowsPanels.DialogEdit( self, title ) as dlg:
- namespaces = HG.client_controller.network_engine.domain_manager.GetParserNamespaces()
+ namespaces = CG.client_controller.network_engine.domain_manager.GetParserNamespaces()
panel = EditTagFilterPanel( dlg, self._tag_filter, only_show_blacklist = self._only_show_blacklist, namespaces = namespaces, message = self._message )
diff --git a/hydrus/client/gui/ClientGUITime.py b/hydrus/client/gui/ClientGUITime.py
index 9c4e94f5a..e55e57f54 100644
--- a/hydrus/client/gui/ClientGUITime.py
+++ b/hydrus/client/gui/ClientGUITime.py
@@ -12,6 +12,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientTime
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIFunctions
@@ -83,7 +84,7 @@ def __init__( self, parent, checker_options ):
#
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
never_faster_than_min = 1
never_slower_than_min = 1
@@ -183,7 +184,7 @@ def __init__( self, parent, checker_options ):
QP.AddToLayout( vbox, defaults_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
QP.AddToLayout( vbox, gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
label = 'As you are in advanced mode, these options have extremely low limits. This is intended only for testing and small scale private network tasks. Do not use very fast check times for real world use on public websites, as it is wasteful and rude, hydrus will be overloaded with high-CPU parsing work, and you may get your IP banned.'
@@ -792,12 +793,12 @@ def _Copy( self ):
else:
- timestamp = best_qt_datetime.toSecsSinceEpoch()
+ timestamp = best_qt_datetime.toMSecsSinceEpoch() / 1000
text = json.dumps( timestamp )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _NoneClicked( self ):
@@ -812,7 +813,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -839,7 +840,7 @@ def _Paste( self ):
- looks_good = timestamp is None or isinstance( timestamp, float )
+ looks_good = timestamp is None or isinstance( timestamp, ( int, float ) )
if not looks_good:
@@ -1306,7 +1307,7 @@ def __init__( self, parent, timestamp_data_stub = None ):
self._current_file_service = ClientGUICommon.BetterChoice( self )
- for service in HG.client_controller.services_manager.GetServices( HC.REAL_FILE_SERVICES ):
+ for service in CG.client_controller.services_manager.GetServices( HC.REAL_FILE_SERVICES ):
self._current_file_service.addItem( service.GetName(), service.GetServiceKey() )
@@ -1315,7 +1316,7 @@ def __init__( self, parent, timestamp_data_stub = None ):
self._deleted_file_service = ClientGUICommon.BetterChoice( self )
- for service in HG.client_controller.services_manager.GetServices( HC.FILE_SERVICES_WITH_DELETE_RECORD ):
+ for service in CG.client_controller.services_manager.GetServices( HC.FILE_SERVICES_WITH_DELETE_RECORD ):
self._deleted_file_service.addItem( service.GetName(), service.GetServiceKey() )
diff --git a/hydrus/client/gui/ClientGUITopLevelWindows.py b/hydrus/client/gui/ClientGUITopLevelWindows.py
index 9dd7c1778..df8b85980 100644
--- a/hydrus/client/gui/ClientGUITopLevelWindows.py
+++ b/hydrus/client/gui/ClientGUITopLevelWindows.py
@@ -4,10 +4,8 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
-from hydrus.core import HydrusExceptions
-from hydrus.core import HydrusGlobals as HG
-from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import ClientGUIShortcuts
from hydrus.client.gui import QtPorting as QP
@@ -81,7 +79,7 @@ def GetSafeSize( tlw: QW.QWidget, min_size: QC.QSize, gravity ) -> QC.QSize:
# so borrow main gui's
if frame_padding.isEmpty():
- main_gui = HG.client_controller.gui
+ main_gui = CG.client_controller.gui
if main_gui is not None and QP.isValid( main_gui ) and not main_gui.isFullScreen():
@@ -139,7 +137,7 @@ def GetSafeSize( tlw: QW.QWidget, min_size: QC.QSize, gravity ) -> QC.QSize:
def ExpandTLWIfPossible( tlw: QW.QWidget, frame_key, desired_size_delta: QC.QSize ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
( remember_size, remember_position, last_size, last_position, default_gravity, default_position, maximised, fullscreen ) = new_options.GetFrameLocation( frame_key )
@@ -188,7 +186,7 @@ def SaveTLWSizeAndPosition( tlw: QW.QWidget, frame_key ):
return
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
( remember_size, remember_position, last_size, last_position, default_gravity, default_position, maximised, fullscreen ) = new_options.GetFrameLocation( frame_key )
@@ -220,7 +218,7 @@ def SaveTLWSizeAndPosition( tlw: QW.QWidget, frame_key ):
def SetInitialTLWSizeAndPosition( tlw: QW.QWidget, frame_key ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
( remember_size, remember_position, last_size, last_position, default_gravity, default_position, maximised, fullscreen ) = new_options.GetFrameLocation( frame_key )
@@ -382,11 +380,11 @@ def __init__( self, parent, title, do_not_activate = False ):
self.setWindowTitle( title )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
- self.setWindowIcon( QG.QIcon( HG.client_controller.frame_icon_pixmap ) )
+ self.setWindowIcon( QG.QIcon( CG.client_controller.frame_icon_pixmap ) )
- HG.client_controller.ResetIdleTimer()
+ CG.client_controller.ResetIdleTimer()
self._widget_event_filter = QP.WidgetEventFilter( self )
@@ -595,11 +593,11 @@ def __init__( self, parent, title ):
self.setAttribute( QC.Qt.WA_DeleteOnClose )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
- self.setWindowIcon( QG.QIcon( HG.client_controller.frame_icon_pixmap ) )
+ self.setWindowIcon( QG.QIcon( CG.client_controller.frame_icon_pixmap ) )
- HG.client_controller.ResetIdleTimer()
+ CG.client_controller.ResetIdleTimer()
self._widget_event_filter = QP.WidgetEventFilter( self )
@@ -622,13 +620,13 @@ def __init__( self, parent, title ):
self.setWindowTitle( title )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
- self.setWindowIcon( QG.QIcon( HG.client_controller.frame_icon_pixmap ) )
+ self.setWindowIcon( QG.QIcon( CG.client_controller.frame_icon_pixmap ) )
self._widget_event_filter = QP.WidgetEventFilter( self )
- HG.client_controller.ResetIdleTimer()
+ CG.client_controller.ResetIdleTimer()
def CleanBeforeDestroy( self ):
@@ -659,13 +657,13 @@ def CleanBeforeDestroy( self ):
MainFrame.CleanBeforeDestroy( self )
# maximise sends a pre-maximise size event that poisons last_size if this is immediate
- HG.client_controller.CallLaterQtSafe( self, 0.1, 'save frame size and position: {}'.format( self._frame_key ), SaveTLWSizeAndPosition, self, self._frame_key )
+ CG.client_controller.CallLaterQtSafe( self, 0.1, 'save frame size and position: {}'.format( self._frame_key ), SaveTLWSizeAndPosition, self, self._frame_key )
def EventSizeAndPositionChanged( self, event ):
# maximise sends a pre-maximise size event that poisons last_size if this is immediate
- HG.client_controller.CallLaterQtSafe( self, 0.1, 'save frame size and position: {}'.format( self._frame_key ), SaveTLWSizeAndPosition, self, self._frame_key )
+ CG.client_controller.CallLaterQtSafe( self, 0.1, 'save frame size and position: {}'.format( self._frame_key ), SaveTLWSizeAndPosition, self, self._frame_key )
return True # was: event.ignore()
@@ -690,13 +688,13 @@ def CleanBeforeDestroy( self ):
MainFrame.CleanBeforeDestroy( self )
# maximise sends a pre-maximise size event that poisons last_size if this is immediate
- HG.client_controller.CallLaterQtSafe( self, 0.1, 'save frame size and position: {}'.format( self._frame_key ), SaveTLWSizeAndPosition, self, self._frame_key )
+ CG.client_controller.CallLaterQtSafe( self, 0.1, 'save frame size and position: {}'.format( self._frame_key ), SaveTLWSizeAndPosition, self, self._frame_key )
def EventSizeAndPositionChanged( self, event ):
# maximise sends a pre-maximise size event that poisons last_size if this is immediate
- HG.client_controller.CallLaterQtSafe( self, 0.1, 'save frame size and position: {}'.format( self._frame_key ), SaveTLWSizeAndPosition, self, self._frame_key )
+ CG.client_controller.CallLaterQtSafe( self, 0.1, 'save frame size and position: {}'.format( self._frame_key ), SaveTLWSizeAndPosition, self, self._frame_key )
return True # was: event.ignore()
diff --git a/hydrus/client/gui/QtPorting.py b/hydrus/client/gui/QtPorting.py
index 5a8886c24..912487e7d 100644
--- a/hydrus/client/gui/QtPorting.py
+++ b/hydrus/client/gui/QtPorting.py
@@ -17,8 +17,10 @@
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusProfiling
+from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import QtInit
isValid = QtInit.isValid
@@ -171,7 +173,7 @@ def _Browse( self ):
kwargs = {}
- if HG.client_controller.new_options.GetBoolean( 'use_qt_file_dialogs' ):
+ if CG.client_controller.new_options.GetBoolean( 'use_qt_file_dialogs' ):
# careful here, QW.QFileDialog.Options doesn't exist on PyQt6
kwargs[ 'options' ] = QW.QFileDialog.Option.DontUseNativeDialog
@@ -258,7 +260,7 @@ def _Browse( self ):
kwargs = {}
- if HG.client_controller.new_options.GetBoolean( 'use_qt_file_dialogs' ):
+ if CG.client_controller.new_options.GetBoolean( 'use_qt_file_dialogs' ):
# careful here, QW.QFileDialog.Options doesn't exist on PyQt6
kwargs[ 'options' ] = QW.QFileDialog.Option.DontUseNativeDialog
@@ -333,6 +335,7 @@ def __init__( self, parent = None ):
self._last_clicked_tab_index = -1
self._last_clicked_global_pos = None
+ self._last_clicked_timestamp_ms = 0
def AddSupplementaryTabBarDropTarget( self, drop_target ):
@@ -346,6 +349,8 @@ def clearLastClickedTabInfo( self ):
self._last_clicked_global_pos = None
+ self._last_clicked_timestamp_ms = 0
+
def event( self, event ):
@@ -367,6 +372,8 @@ def mousePressEvent( self, event ):
self._last_clicked_global_pos = event.globalPosition().toPoint()
+ self._last_clicked_timestamp_ms = HydrusTime.GetNowMS()
+
QW.QTabBar.mousePressEvent( self, event )
@@ -446,11 +453,11 @@ def dragMoveEvent( self, event ):
if shift_down:
- do_navigate = HG.client_controller.new_options.GetBoolean( 'page_drag_change_tab_with_shift' )
+ do_navigate = CG.client_controller.new_options.GetBoolean( 'page_drag_change_tab_with_shift' )
else:
- do_navigate = HG.client_controller.new_options.GetBoolean( 'page_drag_change_tab_normally' )
+ do_navigate = CG.client_controller.new_options.GetBoolean( 'page_drag_change_tab_normally' )
if do_navigate:
@@ -467,7 +474,7 @@ def dragMoveEvent( self, event ):
def lastClickedTabInfo( self ):
- return ( self._last_clicked_tab_index, self._last_clicked_global_pos )
+ return ( self._last_clicked_tab_index, self._last_clicked_global_pos, self._last_clicked_timestamp_ms )
def dropEvent( self, event ):
@@ -486,7 +493,7 @@ def wheelEvent( self, event ):
try:
- if HG.client_controller.new_options.GetBoolean( 'wheel_scrolls_tab_bar' ):
+ if CG.client_controller.new_options.GetBoolean( 'wheel_scrolls_tab_bar' ):
children = self.children()
@@ -599,10 +606,14 @@ def AddSupplementaryTabBarDropTarget( self, drop_target ):
def mouseMoveEvent( self, e ):
- if self.currentWidget() and self.currentWidget().rect().contains( self.currentWidget().mapFromGlobal( self.mapToGlobal( e.position().toPoint() ) ) ):
+ mouse_is_over_actual_page = self.currentWidget() and self.currentWidget().rect().contains( self.currentWidget().mapFromGlobal( self.mapToGlobal( e.position().toPoint() ) ) )
+
+ if mouse_is_over_actual_page or CG.client_controller.new_options.GetBoolean( 'disable_page_tab_dnd' ):
QW.QTabWidget.mouseMoveEvent( self, e )
+ return
+
if e.buttons() != QC.Qt.LeftButton:
@@ -623,16 +634,19 @@ def mouseMoveEvent( self, e ):
return
- ( clicked_tab_index, clicked_global_pos ) = self._tab_bar.lastClickedTabInfo()
+ ( clicked_tab_index, clicked_global_pos, clicked_timestamp_ms ) = self._tab_bar.lastClickedTabInfo()
if clicked_tab_index == -1:
return
- if e.globalPosition().toPoint() == clicked_global_pos:
+ # I used to do manhattanlength stuff, but tbh this works better
+ # delta_pos = e.globalPosition().toPoint() - clicked_global_pos
+
+ if not HydrusTime.TimeHasPassedMS( clicked_timestamp_ms + 100 ):
- # don't start a drag until movement
+ # don't start a drag until decent movement
return
@@ -697,11 +711,11 @@ def dragMoveEvent( self, event: QG.QDragMoveEvent ):
if shift_down:
- do_navigate = HG.client_controller.new_options.GetBoolean( 'page_drag_change_tab_with_shift' )
+ do_navigate = CG.client_controller.new_options.GetBoolean( 'page_drag_change_tab_with_shift' )
else:
- do_navigate = HG.client_controller.new_options.GetBoolean( 'page_drag_change_tab_normally' )
+ do_navigate = CG.client_controller.new_options.GetBoolean( 'page_drag_change_tab_normally' )
if do_navigate:
@@ -768,7 +782,7 @@ def dropEvent( self, e: QG.QDropEvent ):
return
- ( source_page_index, source_page_click_global_pos ) = source_tab_bar.lastClickedTabInfo()
+ ( source_page_index, source_page_click_global_pos, source_page_clicked_timestamp_ms ) = source_tab_bar.lastClickedTabInfo()
source_tab_bar.clearLastClickedTabInfo()
@@ -870,7 +884,7 @@ def dropEvent( self, e: QG.QDropEvent ):
follow_dropped_page = not shift_down
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
if shift_down:
@@ -898,7 +912,7 @@ def dropEvent( self, e: QG.QDropEvent ):
page_key = source_notebook.GetPageKey()
- CallAfter( HG.client_controller.gui.ShowPage, page_key )
+ CallAfter( CG.client_controller.gui.ShowPage, page_key )
@@ -1240,7 +1254,7 @@ def ToKeySequence( modifiers, key ):
-def AddShortcut( widget, modifier, key, callable, *args ):
+def AddShortcut( widget, modifier, key, func: typing.Callable, *args ):
shortcut = QW.QShortcut( widget )
@@ -1248,8 +1262,9 @@ def AddShortcut( widget, modifier, key, callable, *args ):
shortcut.setContext( QC.Qt.WidgetWithChildrenShortcut )
- shortcut.activated.connect( lambda: callable( *args ) )
+ shortcut.activated.connect( lambda: func( *args ) )
+
def GetBackgroundColour( widget ):
return widget.palette().color( QG.QPalette.Window )
@@ -2054,7 +2069,7 @@ def __init__( self, parent = None, message = None ):
self.setOption( QW.QFileDialog.ShowDirsOnly, True )
- if HG.client_controller.new_options.GetBoolean( 'use_qt_file_dialogs' ):
+ if CG.client_controller.new_options.GetBoolean( 'use_qt_file_dialogs' ):
self.setOption( QW.QFileDialog.DontUseNativeDialog, True )
@@ -2122,7 +2137,7 @@ def __init__( self, parent = None, message = None, acceptMode = QW.QFileDialog.A
self.setNameFilter( wildcard )
- if HG.client_controller.new_options.GetBoolean( 'use_qt_file_dialogs' ):
+ if CG.client_controller.new_options.GetBoolean( 'use_qt_file_dialogs' ):
self.setOption( QW.QFileDialog.DontUseNativeDialog, True )
diff --git a/hydrus/client/gui/canvas/ClientGUICanvas.py b/hydrus/client/gui/canvas/ClientGUICanvas.py
index cf026f5a9..7df5b24bf 100644
--- a/hydrus/client/gui/canvas/ClientGUICanvas.py
+++ b/hydrus/client/gui/canvas/ClientGUICanvas.py
@@ -18,6 +18,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientData
from hydrus.client import ClientDuplicates
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientPaths
from hydrus.client.gui import ClientGUICore as CGC
@@ -58,7 +59,7 @@ def AddAudioVolumeMenu( menu, canvas_type ):
mute_volume_type = ClientGUIMediaControls.AUDIO_MEDIA_VIEWER
- if HG.client_controller.new_options.GetBoolean( 'media_viewer_uses_its_own_audio_volume' ):
+ if CG.client_controller.new_options.GetBoolean( 'media_viewer_uses_its_own_audio_volume' ):
volume_volume_type = ClientGUIMediaControls.AUDIO_MEDIA_VIEWER
@@ -67,7 +68,7 @@ def AddAudioVolumeMenu( menu, canvas_type ):
mute_volume_type = ClientGUIMediaControls.AUDIO_PREVIEW
- if HG.client_controller.new_options.GetBoolean( 'preview_uses_its_own_audio_volume' ):
+ if CG.client_controller.new_options.GetBoolean( 'preview_uses_its_own_audio_volume' ):
volume_volume_type = ClientGUIMediaControls.AUDIO_PREVIEW
@@ -77,7 +78,7 @@ def AddAudioVolumeMenu( menu, canvas_type ):
( global_mute_option_name, global_volume_option_name ) = ClientGUIMediaControls.volume_types_to_option_names[ ClientGUIMediaControls.AUDIO_GLOBAL ]
- if HG.client_controller.new_options.GetBoolean( global_mute_option_name ):
+ if CG.client_controller.new_options.GetBoolean( global_mute_option_name ):
label = 'unmute global'
@@ -96,7 +97,7 @@ def AddAudioVolumeMenu( menu, canvas_type ):
( mute_option_name, volume_option_name ) = ClientGUIMediaControls.volume_types_to_option_names[ mute_volume_type ]
- if HG.client_controller.new_options.GetBoolean( mute_option_name ):
+ if CG.client_controller.new_options.GetBoolean( mute_option_name ):
label = 'unmute {}'.format( ClientGUIMediaControls.volume_types_str_lookup[ mute_volume_type ] )
@@ -117,7 +118,7 @@ def AddAudioVolumeMenu( menu, canvas_type ):
# 0-100 inclusive
volumes = list( range( 0, 110, 10 ) )
- current_volume = HG.client_controller.new_options.GetInteger( volume_option_name )
+ current_volume = CG.client_controller.new_options.GetInteger( volume_option_name )
if current_volume not in volumes:
@@ -147,12 +148,12 @@ class CanvasBackgroundColourGenerator( object ):
def GetColour( self ) -> QG.QColor:
- return HG.client_controller.new_options.GetColour( CC.COLOUR_MEDIA_BACKGROUND )
+ return CG.client_controller.new_options.GetColour( CC.COLOUR_MEDIA_BACKGROUND )
def CanDoTransparencyCheckerboard( self ) -> bool:
- return HG.client_controller.new_options.GetBoolean( 'draw_transparency_checkerboard_media_canvas' )
+ return CG.client_controller.new_options.GetBoolean( 'draw_transparency_checkerboard_media_canvas' )
@@ -167,12 +168,12 @@ def __init__( self, duplicate_canvas ):
def CanDoTransparencyCheckerboard( self ) -> bool:
- return HG.client_controller.new_options.GetBoolean( 'draw_transparency_checkerboard_media_canvas' ) or HG.client_controller.new_options.GetBoolean( 'draw_transparency_checkerboard_media_canvas_duplicates' )
+ return CG.client_controller.new_options.GetBoolean( 'draw_transparency_checkerboard_media_canvas' ) or CG.client_controller.new_options.GetBoolean( 'draw_transparency_checkerboard_media_canvas_duplicates' )
def GetColour( self ) -> QG.QColor:
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
normal_colour = new_options.GetColour( CC.COLOUR_MEDIA_BACKGROUND )
@@ -328,7 +329,7 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext ):
self._current_media_start_time_ms = HydrusTime.GetNowMS()
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
self._canvas_key = HydrusData.GenerateKey()
@@ -364,19 +365,19 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext ):
self._media_container.zoomChanged.connect( self.ZoomChanged )
- HG.client_controller.sub( self, 'ZoomIn', 'canvas_zoom_in' )
- HG.client_controller.sub( self, 'ZoomOut', 'canvas_zoom_out' )
- HG.client_controller.sub( self, 'ZoomSwitch', 'canvas_zoom_switch' )
- HG.client_controller.sub( self, 'OpenExternally', 'canvas_open_externally' )
- HG.client_controller.sub( self, 'ManageTags', 'canvas_manage_tags' )
- HG.client_controller.sub( self, 'update', 'notify_new_colourset' )
+ CG.client_controller.sub( self, 'ZoomIn', 'canvas_zoom_in' )
+ CG.client_controller.sub( self, 'ZoomOut', 'canvas_zoom_out' )
+ CG.client_controller.sub( self, 'ZoomSwitch', 'canvas_zoom_switch' )
+ CG.client_controller.sub( self, 'OpenExternally', 'canvas_open_externally' )
+ CG.client_controller.sub( self, 'ManageTags', 'canvas_manage_tags' )
+ CG.client_controller.sub( self, 'update', 'notify_new_colourset' )
def _Archive( self ):
if self._current_media is not None:
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ARCHIVE, ( self._current_media.GetHash(), ) ) ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ARCHIVE, ( self._current_media.GetHash(), ) ) ) )
@@ -388,7 +389,7 @@ def _CopyBMPToClipboard( self, resolution = None ):
if self._current_media.IsStaticImage():
- HG.client_controller.pub( 'clipboard', 'bmp', ( self._current_media, resolution ) )
+ CG.client_controller.pub( 'clipboard', 'bmp', ( self._current_media, resolution ) )
copied = True
@@ -411,11 +412,11 @@ def _CopyFileToClipboard( self ):
if self._current_media is not None:
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
paths = [ client_files_manager.GetFilePath( self._current_media.GetHash(), self._current_media.GetMime() ) ]
- HG.client_controller.pub( 'clipboard', 'paths', paths )
+ CG.client_controller.pub( 'clipboard', 'paths', paths )
@@ -423,11 +424,11 @@ def _CopyPathToClipboard( self ):
if self._current_media is not None:
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( self._current_media.GetHash(), self._current_media.GetMime() )
- HG.client_controller.pub( 'clipboard', 'text', path )
+ CG.client_controller.pub( 'clipboard', 'text', path )
@@ -454,7 +455,7 @@ def _Delete( self, media = None, default_reason = None, file_service_key = None,
( possible_suggested_file_service_key, ) = self._location_context.current_service_keys
- if HG.client_controller.services_manager.GetServiceType( possible_suggested_file_service_key ) in HC.SPECIFIC_LOCAL_FILE_SERVICES + ( HC.FILE_REPOSITORY, ):
+ if CG.client_controller.services_manager.GetServiceType( possible_suggested_file_service_key ) in HC.SPECIFIC_LOCAL_FILE_SERVICES + ( HC.FILE_REPOSITORY, ):
file_service_key = possible_suggested_file_service_key
@@ -474,7 +475,7 @@ def do_it( content_update_packages ):
for content_update_package in content_update_packages:
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -484,7 +485,7 @@ def do_it( content_update_packages ):
else:
- HG.client_controller.CallToThread( do_it, content_update_packages )
+ CG.client_controller.CallToThread( do_it, content_update_packages )
return True
@@ -518,7 +519,7 @@ def _Inbox( self ):
return
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_INBOX, ( self._current_media.GetHash(), ) ) ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_INBOX, ( self._current_media.GetHash(), ) ) ) )
def _ManageNotes( self, name_to_start_on = None ):
@@ -538,7 +539,7 @@ def _ManageRatings( self ):
return
- if len( HG.client_controller.services_manager.GetServices( HC.RATINGS_SERVICES ) ) > 0:
+ if len( CG.client_controller.services_manager.GetServices( HC.RATINGS_SERVICES ) ) > 0:
with ClientGUIDialogsManage.DialogManageRatings( self, ( self._current_media, ) ) as dlg:
@@ -640,7 +641,7 @@ def _OpenExternally( self ):
hash = self._current_media.GetHash()
mime = self._current_media.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
@@ -658,7 +659,7 @@ def _OpenFileInWebBrowser( self ):
hash = self._current_media.GetHash()
mime = self._current_media.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
@@ -708,7 +709,7 @@ def _SaveCurrentMediaViewTime( self ):
hash = self._current_media.GetHash()
- HG.client_controller.file_viewing_stats_manager.FinishViewing( self._current_media, self.CANVAS_TYPE, view_timestamp_ms, viewtime_delta )
+ CG.client_controller.file_viewing_stats_manager.FinishViewing( self._current_media, self.CANVAS_TYPE, view_timestamp_ms, viewtime_delta )
def _SeekDeltaCurrentMedia( self, direction, duration_ms ):
@@ -732,7 +733,7 @@ def _ShowMediaInNewPage( self ):
hashes = { hash }
- HG.client_controller.pub( 'new_page_query', self._location_context, initial_hashes = hashes )
+ CG.client_controller.pub( 'new_page_query', self._location_context, initial_hashes = hashes )
def _Undelete( self ):
@@ -1253,7 +1254,7 @@ def SetMedia( self, media: typing.Optional[ ClientMedia.MediaSingleton ] ):
self.EndDrag()
- HG.client_controller.ResetIdleTimer()
+ CG.client_controller.ResetIdleTimer()
self._SaveCurrentMediaViewTime()
@@ -1282,9 +1283,9 @@ def SetMedia( self, media: typing.Optional[ ClientMedia.MediaSingleton ] ):
- HG.client_controller.pub( 'canvas_new_display_media', self._canvas_key, self._current_media )
+ CG.client_controller.pub( 'canvas_new_display_media', self._canvas_key, self._current_media )
- HG.client_controller.pub( 'canvas_new_index_string', self._canvas_key, self._GetIndexString() )
+ CG.client_controller.pub( 'canvas_new_index_string', self._canvas_key, self._GetIndexString() )
self.update()
@@ -1372,7 +1373,7 @@ def __init__( self, parent, page_key, location_context: ClientLocation.LocationC
self._media_container.launchMediaViewer.connect( self.LaunchMediaViewer )
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
def mouseReleaseEvent( self, event ):
@@ -1431,13 +1432,13 @@ def ShowMenu( self ):
menu = ClientGUIMenus.GenerateMenu( self )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
advanced_mode = new_options.GetBoolean( 'advanced_mode' )
if self._current_media is not None:
- services = HG.client_controller.services_manager.GetServices()
+ services = CG.client_controller.services_manager.GetServices()
locations_manager = self._current_media.GetLocationsManager()
@@ -1482,16 +1483,16 @@ def ShowMenu( self ):
ClientGUIMenus.AppendSeparator( menu )
- local_file_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_file_service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
# brush this up to handle different service keys
# undelete do an optional service key too
- local_file_service_keys_we_are_in = sorted( locations_manager.GetCurrent().intersection( local_file_service_keys ), key = HG.client_controller.services_manager.GetName )
+ local_file_service_keys_we_are_in = sorted( locations_manager.GetCurrent().intersection( local_file_service_keys ), key = CG.client_controller.services_manager.GetName )
for file_service_key in local_file_service_keys_we_are_in:
- ClientGUIMenus.AppendMenuItem( menu, 'delete from {}'.format( HG.client_controller.services_manager.GetName( file_service_key ) ), 'Delete this file.', self._Delete, file_service_key = file_service_key )
+ ClientGUIMenus.AppendMenuItem( menu, 'delete from {}'.format( CG.client_controller.services_manager.GetName( file_service_key ) ), 'Delete this file.', self._Delete, file_service_key = file_service_key )
if locations_manager.IsTrashed():
@@ -1579,7 +1580,7 @@ def ShowMenu( self ):
hash_id_str = str( self._current_media.GetHashId() )
- ClientGUIMenus.AppendMenuItem( copy_menu, 'file_id ({})'.format( hash_id_str ), 'Copy this file\'s internal file/hash_id.', HG.client_controller.pub, 'clipboard', 'text', hash_id_str )
+ ClientGUIMenus.AppendMenuItem( copy_menu, 'file_id ({})'.format( hash_id_str ), 'Copy this file\'s internal file/hash_id.', CG.client_controller.pub, 'clipboard', 'text', hash_id_str )
if self._current_media.IsStaticImage():
@@ -1608,7 +1609,7 @@ def ShowMenu( self ):
def LaunchMediaViewer( self ):
- HG.client_controller.pub( 'launch_media_viewer', self._page_key )
+ CG.client_controller.pub( 'launch_media_viewer', self._page_key )
def MediaFocusWentToExternalProgram( self, page_key ):
@@ -1660,7 +1661,7 @@ def __init__( self, parent, location_context ):
Canvas.__init__( self, parent, location_context )
- HG.client_controller.sub( self, 'RedrawDetails', 'refresh_all_tag_presentation_gui' )
+ CG.client_controller.sub( self, 'RedrawDetails', 'refresh_all_tag_presentation_gui' )
def _DrawAdditionalTopMiddleInfo( self, painter: QG.QPainter, current_y ):
@@ -1845,7 +1846,7 @@ def _DrawTags( self, painter: QG.QPainter ):
tags_i_want_to_display = list( tags_i_want_to_display )
- tag_sort = HG.client_controller.new_options.GetDefaultTagSort()
+ tag_sort = CG.client_controller.new_options.GetDefaultTagSort()
ClientTagSorting.SortTags( tag_sort, tags_i_want_to_display )
@@ -1936,7 +1937,7 @@ def _DrawTopRight( self, painter: QG.QPainter ) -> int:
# ratings
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
like_services = services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
@@ -2046,7 +2047,7 @@ def _DrawTopRight( self, painter: QG.QPainter ) -> int:
urls = self._current_media.GetLocationsManager().GetURLs()
- url_tuples = HG.client_controller.network_engine.domain_manager.ConvertURLsToMediaViewerTuples( urls )
+ url_tuples = CG.client_controller.network_engine.domain_manager.ConvertURLsToMediaViewerTuples( urls )
for ( display_string, url ) in url_tuples:
@@ -2145,10 +2146,10 @@ def __init__( self, parent, location_context ):
self._RestartCursorHideWait()
- HG.client_controller.sub( self, 'CloseFromHover', 'canvas_close' )
- HG.client_controller.sub( self, 'FullscreenSwitch', 'canvas_fullscreen_switch' )
+ CG.client_controller.sub( self, 'CloseFromHover', 'canvas_close' )
+ CG.client_controller.sub( self, 'FullscreenSwitch', 'canvas_fullscreen_switch' )
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
def _GenerateHoverTopFrame( self ):
@@ -2158,7 +2159,7 @@ def _GenerateHoverTopFrame( self ):
def _HideCursorCheck( self ):
- hide_time_ms = HG.client_controller.new_options.GetNoneableInteger( 'media_viewer_cursor_autohide_time_ms' )
+ hide_time_ms = CG.client_controller.new_options.GetNoneableInteger( 'media_viewer_cursor_autohide_time_ms' )
if hide_time_ms is None:
@@ -2217,7 +2218,7 @@ def _RestartCursorHideCheckJob( self ):
- self._timer_cursor_hide_job = HG.client_controller.CallLaterQtSafe( self, 0.1, 'hide cursor check', self._HideCursorCheck )
+ self._timer_cursor_hide_job = CG.client_controller.CallLaterQtSafe( self, 0.1, 'hide cursor check', self._HideCursorCheck )
def _TryToCloseWindow( self ):
@@ -2225,6 +2226,13 @@ def _TryToCloseWindow( self ):
self.window().close()
+ def CleanBeforeDestroy( self ):
+
+ self.setCursor( QG.QCursor( QC.Qt.ArrowCursor ) )
+
+ CanvasWithDetails.CleanBeforeDestroy( self )
+
+
def CloseFromHover( self, canvas_key ):
if canvas_key == self._canvas_key:
@@ -2273,7 +2281,7 @@ def mouseMoveEvent( self, event ):
if approx_distance > 0:
- touchscreen_canvas_drags_unanchor = HG.client_controller.new_options.GetBoolean( 'touchscreen_canvas_drags_unanchor' )
+ touchscreen_canvas_drags_unanchor = CG.client_controller.new_options.GetBoolean( 'touchscreen_canvas_drags_unanchor' )
if not self._current_drag_is_touch and approx_distance > 50:
@@ -2285,7 +2293,7 @@ def mouseMoveEvent( self, event ):
# touch events obviously don't mix with warping well. the touch just warps it back and again and we get a massive delta!
touch_anchor_override = touchscreen_canvas_drags_unanchor and self._current_drag_is_touch
- anchor_and_hide_canvas_drags = HG.client_controller.new_options.GetBoolean( 'anchor_and_hide_canvas_drags' )
+ anchor_and_hide_canvas_drags = CG.client_controller.new_options.GetBoolean( 'anchor_and_hide_canvas_drags' )
if anchor_and_hide_canvas_drags and not touch_anchor_override:
@@ -2428,11 +2436,11 @@ def __init__( self, parent, file_search_context_1: ClientSearch.FileSearchContex
self._my_shortcuts_handler.AddShortcuts( 'media_viewer_browser' )
self._my_shortcuts_handler.AddShortcuts( 'duplicate_filter' )
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
- HG.client_controller.sub( self, 'Delete', 'canvas_delete' )
- HG.client_controller.sub( self, 'Undelete', 'canvas_undelete' )
- HG.client_controller.sub( self, 'SwitchMedia', 'canvas_show_next' )
- HG.client_controller.sub( self, 'SwitchMedia', 'canvas_show_previous' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'Delete', 'canvas_delete' )
+ CG.client_controller.sub( self, 'Undelete', 'canvas_undelete' )
+ CG.client_controller.sub( self, 'SwitchMedia', 'canvas_show_next' )
+ CG.client_controller.sub( self, 'SwitchMedia', 'canvas_show_previous' )
QP.CallAfter( self._LoadNextBatchOfPairs )
@@ -2451,11 +2459,11 @@ def _CommitProcessed( self, blocking = True ):
if blocking:
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
else:
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
@@ -2478,11 +2486,11 @@ def _CommitProcessed( self, blocking = True ):
if blocking:
- HG.client_controller.WriteSynchronous( 'duplicate_pair_status', pair_info )
+ CG.client_controller.WriteSynchronous( 'duplicate_pair_status', pair_info )
else:
- HG.client_controller.Write( 'duplicate_pair_status', pair_info )
+ CG.client_controller.Write( 'duplicate_pair_status', pair_info )
@@ -2581,7 +2589,7 @@ def _DoCustomAction( self ):
return
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
if duplicate_type in [ HC.DUPLICATE_BETTER, HC.DUPLICATE_SAME_QUALITY ] or ( new_options.GetBoolean( 'advanced_mode' ) and duplicate_type == HC.DUPLICATE_ALTERNATE ):
@@ -2766,7 +2774,7 @@ def _LoadNextBatchOfPairs( self ):
self._currently_fetching_pairs = True
- HG.client_controller.CallToThread( self.THREADFetchPairs, self._file_search_context_1, self._file_search_context_2, self._dupe_search_type, self._pixel_dupes_preference, self._max_hamming_distance )
+ CG.client_controller.CallToThread( self.THREADFetchPairs, self._file_search_context_1, self._file_search_context_2, self._dupe_search_type, self._pixel_dupes_preference, self._max_hamming_distance )
self.update()
@@ -2803,7 +2811,7 @@ def _PrefetchNeighbours( self ):
media_to_prefetch.extend( self._batch_of_pairs_to_process[ self._current_pair_index + 1 ] )
- image_cache = HG.client_controller.GetCache( 'images' )
+ image_cache = CG.client_controller.GetCache( 'images' )
for media in media_to_prefetch:
@@ -2816,7 +2824,7 @@ def _PrefetchNeighbours( self ):
# we do qt safe to make sure the job is cancelled if we are destroyed
- HG.client_controller.CallAfterQtSafe( self, 'image pre-fetch', image_cache.PrefetchImageRenderer, media )
+ CG.client_controller.CallAfterQtSafe( self, 'image pre-fetch', image_cache.PrefetchImageRenderer, media )
@@ -2831,9 +2839,9 @@ def _ProcessPair( self, duplicate_type, delete_first = False, delete_second = Fa
if duplicate_content_merge_options is None:
- if duplicate_type in [ HC.DUPLICATE_BETTER, HC.DUPLICATE_SAME_QUALITY ] or ( HG.client_controller.new_options.GetBoolean( 'advanced_mode' ) and duplicate_type == HC.DUPLICATE_ALTERNATE ):
+ if duplicate_type in [ HC.DUPLICATE_BETTER, HC.DUPLICATE_SAME_QUALITY ] or ( CG.client_controller.new_options.GetBoolean( 'advanced_mode' ) and duplicate_type == HC.DUPLICATE_ALTERNATE ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
duplicate_content_merge_options = new_options.GetDuplicateContentMergeOptions( duplicate_type )
@@ -2909,7 +2917,7 @@ def test_we_can_pop():
# the first one shouldn't be auto-skipped, so if it was and now we can't pop, something weird happened
- HG.client_controller.pub( 'new_similar_files_potentials_search_numbers' )
+ CG.client_controller.pub( 'new_similar_files_potentials_search_numbers' )
ClientGUIDialogsMessage.ShowCritical( self, 'Hell!', 'Due to an unexpected series of events, the duplicate filter has no valid pair to back up to. It could be some files were deleted during processing. The filter will now close.' )
@@ -3113,7 +3121,7 @@ def pair_is_good( pair ):
if not we_saw_a_non_auto_skip:
- HG.client_controller.pub( 'new_similar_files_potentials_search_numbers' )
+ CG.client_controller.pub( 'new_similar_files_potentials_search_numbers' )
ClientGUIDialogsMessage.ShowCritical( self, 'Hell!', 'It seems an entire batch of pairs were unable to be displayed. The duplicate filter will now close.' )
@@ -3203,7 +3211,7 @@ def Archive( self, canvas_key ):
def CleanBeforeDestroy( self ):
- HG.client_controller.pub( 'new_similar_files_potentials_search_numbers' )
+ CG.client_controller.pub( 'new_similar_files_potentials_search_numbers' )
ClientDuplicates.hashes_to_jpeg_quality = {} # clear the cache
@@ -3328,7 +3336,7 @@ def catch_up():
- HG.client_controller.CallLaterQtSafe( self, 0.01, 'duplicates filter post-processing wait', catch_up )
+ CG.client_controller.CallLaterQtSafe( self, 0.01, 'duplicates filter post-processing wait', catch_up )
def SetMedia( self, media ):
@@ -3342,7 +3350,7 @@ def SetMedia( self, media ):
if shown_media != comparison_media:
- HG.client_controller.pub( 'canvas_new_duplicate_pair', self._canvas_key, shown_media, comparison_media )
+ CG.client_controller.pub( 'canvas_new_duplicate_pair', self._canvas_key, shown_media, comparison_media )
@@ -3435,7 +3443,7 @@ def qt_continue( unprocessed_pairs ):
self._ShowCurrentPair()
- result = HG.client_controller.Read( 'duplicate_pairs_for_filtering', file_search_context_1, file_search_context_2, dupe_search_type, pixel_dupes_preference, max_hamming_distance )
+ result = CG.client_controller.Read( 'duplicate_pairs_for_filtering', file_search_context_1, file_search_context_2, dupe_search_type, pixel_dupes_preference, max_hamming_distance )
if len( result ) == 0:
@@ -3499,10 +3507,10 @@ def _PrefetchNeighbours( self ):
previous = self._current_media
next = self._current_media
- delay_base = HG.client_controller.new_options.GetInteger( 'media_viewer_prefetch_delay_base_ms' ) / 1000
+ delay_base = CG.client_controller.new_options.GetInteger( 'media_viewer_prefetch_delay_base_ms' ) / 1000
- num_to_go_back = HG.client_controller.new_options.GetInteger( 'media_viewer_prefetch_num_previous' )
- num_to_go_forward = HG.client_controller.new_options.GetInteger( 'media_viewer_prefetch_num_next' )
+ num_to_go_back = CG.client_controller.new_options.GetInteger( 'media_viewer_prefetch_num_previous' )
+ num_to_go_forward = CG.client_controller.new_options.GetInteger( 'media_viewer_prefetch_num_next' )
# if media_looked_at nukes the list, we want shorter delays, so do next first
@@ -3542,7 +3550,7 @@ def _PrefetchNeighbours( self ):
to_render.append( ( previous, delay ) )
- image_cache = HG.client_controller.GetCache( 'images' )
+ image_cache = CG.client_controller.GetCache( 'images' )
for ( media, delay ) in to_render:
@@ -3555,7 +3563,7 @@ def _PrefetchNeighbours( self ):
# we do qt safe to make sure the job is cancelled if we are destroyed
- HG.client_controller.CallLaterQtSafe( self, delay, 'image pre-fetch', image_cache.PrefetchImageRenderer, media )
+ CG.client_controller.CallLaterQtSafe( self, delay, 'image pre-fetch', image_cache.PrefetchImageRenderer, media )
@@ -3572,7 +3580,7 @@ def _Remove( self ):
hashes = { self._current_media.GetHash() }
- HG.client_controller.pub( 'remove_media', self._page_key, hashes )
+ CG.client_controller.pub( 'remove_media', self._page_key, hashes )
singleton_media = { self._current_media }
@@ -3584,7 +3592,7 @@ def _Remove( self ):
elif self.HasMedia( self._current_media ):
- HG.client_controller.pub( 'canvas_new_index_string', self._canvas_key, self._GetIndexString() )
+ CG.client_controller.pub( 'canvas_new_index_string', self._canvas_key, self._GetIndexString() )
self.update()
@@ -3625,7 +3633,7 @@ def AddMediaResults( self, page_key, media_results ):
ClientMedia.ListeningMediaList.AddMediaResults( self, media_results )
- HG.client_controller.pub( 'canvas_new_index_string', self._canvas_key, self._GetIndexString() )
+ CG.client_controller.pub( 'canvas_new_index_string', self._canvas_key, self._GetIndexString() )
self.update()
@@ -3667,7 +3675,7 @@ def ProcessContentUpdatePackage( self, content_update_package: ClientContentUpda
elif self.HasMedia( self._current_media ):
- HG.client_controller.pub( 'canvas_new_index_string', self._canvas_key, self._GetIndexString() )
+ CG.client_controller.pub( 'canvas_new_index_string', self._canvas_key, self._GetIndexString() )
self.update()
@@ -3696,7 +3704,7 @@ def CommitArchiveDelete( page_key: bytes, location_context: ClientLocation.Locat
all_hashes.update( kept_hashes )
all_hashes.update( deleted_hashes )
- HG.client_controller.pub( 'remove_media', page_key, all_hashes )
+ CG.client_controller.pub( 'remove_media', page_key, all_hashes )
location_context = location_context.Duplicate()
@@ -3726,7 +3734,7 @@ def CommitArchiveDelete( page_key: bytes, location_context: ClientLocation.Locat
content_update_package.AddContentUpdate( deletee_file_service_key, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_DELETE, block_of_deleted_hashes, reason = reason ) )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
# we do a second set of removes to deal with late processing and a quick F5ing user
@@ -3734,24 +3742,24 @@ def CommitArchiveDelete( page_key: bytes, location_context: ClientLocation.Locat
block_of_deleted_hashes = [ m.GetHash() for m in block_of_deleted ]
- HG.client_controller.pub( 'remove_media', page_key, block_of_deleted_hashes )
+ CG.client_controller.pub( 'remove_media', page_key, block_of_deleted_hashes )
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
for block_of_kept_hashes in HydrusLists.SplitListIntoChunks( kept_hashes, 64 ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ARCHIVE, block_of_kept_hashes ) )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
if HC.options[ 'remove_filtered_files' ]:
- HG.client_controller.pub( 'remove_media', page_key, block_of_kept_hashes )
+ CG.client_controller.pub( 'remove_media', page_key, block_of_kept_hashes )
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
@@ -3768,8 +3776,8 @@ def __init__( self, parent, page_key, location_context: ClientLocation.LocationC
self._kept = set()
self._deleted = set()
- HG.client_controller.sub( self, 'Delete', 'canvas_delete' )
- HG.client_controller.sub( self, 'Undelete', 'canvas_undelete' )
+ CG.client_controller.sub( self, 'Delete', 'canvas_delete' )
+ CG.client_controller.sub( self, 'Undelete', 'canvas_undelete' )
first_media = self._GetFirst()
@@ -3824,7 +3832,7 @@ def TryToDoPreClose( self ):
current_local_service_keys = HydrusData.MassUnion( [ m.GetLocationsManager().GetCurrent() for m in deleted ] )
- local_file_domain_service_keys = [ service_key for service_key in current_local_service_keys if HG.client_controller.services_manager.GetServiceType( service_key ) == HC.LOCAL_FILE_DOMAIN ]
+ local_file_domain_service_keys = [ service_key for service_key in current_local_service_keys if CG.client_controller.services_manager.GetServiceType( service_key ) == HC.LOCAL_FILE_DOMAIN ]
location_contexts_to_present_options_for.extend( [ ClientLocation.LocationContext.STATICCreateSimple( service_key ) for service_key in local_file_domain_service_keys ] )
@@ -3867,7 +3875,7 @@ def TryToDoPreClose( self ):
else:
- location_label = location_context.ToString( HG.client_controller.services_manager.GetName )
+ location_label = location_context.ToString( CG.client_controller.services_manager.GetName )
delete_label = 'delete {} from {}'.format( HydrusData.ToHumanInt( num_deletable ), location_label )
@@ -3900,7 +3908,7 @@ def TryToDoPreClose( self ):
self._current_media = self._GetFirst() # so the pubsub on close is better
- HG.client_controller.CallToThread( CommitArchiveDelete, self._page_key, deletee_location_context, kept, deleted )
+ CG.client_controller.CallToThread( CommitArchiveDelete, self._page_key, deletee_location_context, kept, deleted )
@@ -4064,10 +4072,10 @@ def __init__( self, parent, page_key, location_context: ClientLocation.LocationC
self._my_shortcuts_handler.AddShortcuts( 'media_viewer_browser' )
- HG.client_controller.sub( self, 'Delete', 'canvas_delete' )
- HG.client_controller.sub( self, 'ShowNext', 'canvas_show_next' )
- HG.client_controller.sub( self, 'ShowPrevious', 'canvas_show_previous' )
- HG.client_controller.sub( self, 'Undelete', 'canvas_undelete' )
+ CG.client_controller.sub( self, 'Delete', 'canvas_delete' )
+ CG.client_controller.sub( self, 'ShowNext', 'canvas_show_next' )
+ CG.client_controller.sub( self, 'ShowPrevious', 'canvas_show_previous' )
+ CG.client_controller.sub( self, 'Undelete', 'canvas_undelete' )
def _GenerateHoverTopFrame( self ):
@@ -4233,7 +4241,7 @@ def __init__( self, parent, page_key, location_context: ClientLocation.LocationC
QP.CallAfter( self.SetMedia, first_media ) # don't set this until we have a size > (20, 20)!
- HG.client_controller.sub( self, 'AddMediaResults', 'add_media_results' )
+ CG.client_controller.sub( self, 'AddMediaResults', 'add_media_results' )
self.userChangedMedia.connect( self.NotifyUserChangedMedia )
@@ -4253,7 +4261,7 @@ def _CalculateAnySpecialSlideshowPeriodForCurrentMedia( self ):
return
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
if duration_s < self._normal_slideshow_period:
@@ -4349,7 +4357,7 @@ def _DoSlideshowWork( self ):
if self._media_container.CurrentlyPresentingMediaWithDuration():
- if HG.client_controller.new_options.GetBoolean( 'slideshow_always_play_duration_media_once_through' ):
+ if CG.client_controller.new_options.GetBoolean( 'slideshow_always_play_duration_media_once_through' ):
if not self._media_container.HasPlayedOnceThrough():
@@ -4498,11 +4506,11 @@ def ShowMenu( self ):
if self._current_media is not None:
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
advanced_mode = new_options.GetBoolean( 'advanced_mode' )
- services = HG.client_controller.services_manager.GetServices()
+ services = CG.client_controller.services_manager.GetServices()
local_ratings_services = [ service for service in services if service.GetServiceType() in HC.RATINGS_SERVICES ]
@@ -4574,7 +4582,7 @@ def ShowMenu( self ):
slideshow = ClientGUIMenus.GenerateMenu( menu )
- slideshow_durations = HG.client_controller.new_options.GetSlideshowDurations()
+ slideshow_durations = CG.client_controller.new_options.GetSlideshowDurations()
for slideshow_duration in slideshow_durations:
@@ -4616,12 +4624,12 @@ def ShowMenu( self ):
#
- local_file_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_file_service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
# brush this up to handle different service keys
# undelete do an optional service key too
- local_file_service_keys_we_are_in = sorted( locations_manager.GetCurrent().intersection( local_file_service_keys ), key = HG.client_controller.services_manager.GetName )
+ local_file_service_keys_we_are_in = sorted( locations_manager.GetCurrent().intersection( local_file_service_keys ), key = CG.client_controller.services_manager.GetName )
if len( local_file_service_keys_we_are_in ) > 0:
@@ -4629,7 +4637,7 @@ def ShowMenu( self ):
for file_service_key in local_file_service_keys_we_are_in:
- ClientGUIMenus.AppendMenuItem( delete_menu, 'from {}'.format( HG.client_controller.services_manager.GetName( file_service_key ) ), 'Delete this file.', self._Delete, file_service_key = file_service_key )
+ ClientGUIMenus.AppendMenuItem( delete_menu, 'from {}'.format( CG.client_controller.services_manager.GetName( file_service_key ) ), 'Delete this file.', self._Delete, file_service_key = file_service_key )
ClientGUIMenus.AppendMenu( menu, delete_menu, 'delete' )
@@ -4728,7 +4736,7 @@ def ShowMenu( self ):
hash_id_str = str( self._current_media.GetHashId() )
- ClientGUIMenus.AppendMenuItem( copy_menu, 'file_id ({})'.format( hash_id_str ), 'Copy this file\'s internal file/hash_id.', HG.client_controller.pub, 'clipboard', 'text', hash_id_str )
+ ClientGUIMenus.AppendMenuItem( copy_menu, 'file_id ({})'.format( hash_id_str ), 'Copy this file\'s internal file/hash_id.', CG.client_controller.pub, 'clipboard', 'text', hash_id_str )
if self._current_media.IsStaticImage():
diff --git a/hydrus/client/gui/canvas/ClientGUICanvasFrame.py b/hydrus/client/gui/canvas/ClientGUICanvasFrame.py
index 9015c0328..58f9b8c42 100644
--- a/hydrus/client/gui/canvas/ClientGUICanvasFrame.py
+++ b/hydrus/client/gui/canvas/ClientGUICanvasFrame.py
@@ -6,6 +6,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientApplicationCommand as CAC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIMediaControls
from hydrus.client.gui import ClientGUIShortcuts
from hydrus.client.gui import ClientGUITopLevelWindows
@@ -24,9 +25,9 @@ def __init__( self, parent ):
self._my_shortcut_handler = ClientGUIShortcuts.ShortcutsHandler( self, [ 'global', 'media_viewer' ] )
- HG.client_controller.gui.RegisterCanvasFrameReference( self )
+ CG.client_controller.gui.RegisterCanvasFrameReference( self )
- self.destroyed.connect( HG.client_controller.gui.MaintainCanvasFrameReferences )
+ self.destroyed.connect( CG.client_controller.gui.MaintainCanvasFrameReferences )
self._was_maximised_before_fullscreen = True
@@ -97,19 +98,19 @@ def ProcessApplicationCommand( self, command: CAC.ApplicationCommand ):
if action == CAC.SIMPLE_EXIT_APPLICATION:
- HG.client_controller.gui.TryToExit()
+ CG.client_controller.gui.TryToExit()
elif action == CAC.SIMPLE_EXIT_APPLICATION_FORCE_MAINTENANCE:
- HG.client_controller.gui.TryToExit( force_shutdown_maintenance = True )
+ CG.client_controller.gui.TryToExit( force_shutdown_maintenance = True )
elif action == CAC.SIMPLE_RESTART_APPLICATION:
- HG.client_controller.gui.TryToExit( restart = True )
+ CG.client_controller.gui.TryToExit( restart = True )
elif action == CAC.SIMPLE_HIDE_TO_SYSTEM_TRAY:
- HG.client_controller.gui.HideToSystemTray()
+ CG.client_controller.gui.HideToSystemTray()
elif action == CAC.SIMPLE_CLOSE_MEDIA_VIEWER:
@@ -121,7 +122,7 @@ def ProcessApplicationCommand( self, command: CAC.ApplicationCommand ):
elif action == CAC.SIMPLE_FLIP_DARKMODE:
- HG.client_controller.gui.FlipDarkmode()
+ CG.client_controller.gui.FlipDarkmode()
elif action == CAC.SIMPLE_GLOBAL_AUDIO_MUTE:
@@ -137,11 +138,11 @@ def ProcessApplicationCommand( self, command: CAC.ApplicationCommand ):
elif action == CAC.SIMPLE_GLOBAL_PROFILE_MODE_FLIP:
- HG.client_controller.FlipProfileMode()
+ CG.client_controller.FlipProfileMode()
elif action == CAC.SIMPLE_GLOBAL_FORCE_ANIMATION_SCANBAR_SHOW:
- HG.client_controller.new_options.FlipBoolean( 'force_animation_scanbar_show' )
+ CG.client_controller.new_options.FlipBoolean( 'force_animation_scanbar_show' )
else:
diff --git a/hydrus/client/gui/canvas/ClientGUICanvasHoverFrames.py b/hydrus/client/gui/canvas/ClientGUICanvasHoverFrames.py
index 2efd77b45..a2a4cd5bf 100644
--- a/hydrus/client/gui/canvas/ClientGUICanvasHoverFrames.py
+++ b/hydrus/client/gui/canvas/ClientGUICanvasHoverFrames.py
@@ -8,12 +8,12 @@
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusSerialisable
-from hydrus.core import HydrusTime
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientData
from hydrus.client import ClientDuplicates
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDragDrop
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIFunctions
@@ -46,8 +46,8 @@ def __init__( self, parent, service_key, canvas_key ):
self._hashes = set()
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
- HG.client_controller.sub( self, 'SetDisplayMedia', 'canvas_new_display_media' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'SetDisplayMedia', 'canvas_new_display_media' )
def _Draw( self, painter ):
@@ -58,8 +58,6 @@ def _Draw( self, painter ):
if self._current_media is not None:
- ( self._rating_state, self._rating ) = ClientRatings.GetIncDecStateFromMedia( ( self._current_media, ), self._service_key )
-
ClientGUIRatings.DrawIncDec( painter, 0, 0, self._service_key, self._rating_state, self._rating )
@@ -72,7 +70,7 @@ def _SetRating( self, rating ):
content_update = ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( rating, self._hashes ) )
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
@@ -116,10 +114,15 @@ def SetDisplayMedia( self, canvas_key, media ):
self._hashes = set()
+ self._rating_state = None
+ self._rating = None
+
else:
self._hashes = self._current_media.GetHashes()
+ ( self._rating_state, self._rating ) = ClientRatings.GetIncDecStateFromMedia( ( self._current_media, ), self._service_key )
+
self.update()
@@ -136,9 +139,10 @@ def __init__( self, parent, service_key, canvas_key ):
self._canvas_key = canvas_key
self._current_media = None
+ self._hashes = set()
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
- HG.client_controller.sub( self, 'SetDisplayMedia', 'canvas_new_display_media' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'SetDisplayMedia', 'canvas_new_display_media' )
def _Draw( self, painter ):
@@ -162,7 +166,7 @@ def EventLeftDown( self, event ):
content_update = ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( rating, self._hashes ) )
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
@@ -175,7 +179,7 @@ def EventRightDown( self, event ):
content_update = ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( rating, self._hashes ) )
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
@@ -255,8 +259,8 @@ def __init__( self, parent, service_key, canvas_key ):
self._hashes = set()
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
- HG.client_controller.sub( self, 'SetDisplayMedia', 'canvas_new_display_media' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'SetDisplayMedia', 'canvas_new_display_media' )
def _ClearRating( self ):
@@ -269,7 +273,7 @@ def _ClearRating( self ):
content_update = ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( rating, self._hashes ) )
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
@@ -295,7 +299,7 @@ def _SetRating( self, rating ):
content_update = ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( rating, self._hashes ) )
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service_key, content_update ) )
@@ -397,7 +401,7 @@ def __init__( self, parent: QW.QWidget, my_canvas, canvas_key ):
parent.installEventFilter( self )
- HG.client_controller.sub( self, 'SetDisplayMedia', 'canvas_new_display_media' )
+ CG.client_controller.sub( self, 'SetDisplayMedia', 'canvas_new_display_media' )
def _GetIdealSizeAndPosition( self ):
@@ -687,8 +691,8 @@ def __init__( self, parent, my_canvas, canvas_key ):
self.setLayout( vbox )
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
- HG.client_controller.sub( self, 'SetIndexString', 'canvas_new_index_string' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'SetIndexString', 'canvas_new_index_string' )
def _Archive( self ):
@@ -737,15 +741,15 @@ def _PopulateCenterButtons( self ):
self._archive_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().archive, self._Archive )
self._archive_button.setFocusPolicy( QC.Qt.TabFocus )
- self._trash_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().delete, HG.client_controller.pub, 'canvas_delete', self._canvas_key )
+ self._trash_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().delete, CG.client_controller.pub, 'canvas_delete', self._canvas_key )
self._trash_button.setToolTip( 'send to trash' )
self._trash_button.setFocusPolicy( QC.Qt.TabFocus )
- self._delete_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().trash_delete, HG.client_controller.pub, 'canvas_delete', self._canvas_key )
+ self._delete_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().trash_delete, CG.client_controller.pub, 'canvas_delete', self._canvas_key )
self._delete_button.setToolTip( 'delete completely' )
self._delete_button.setFocusPolicy( QC.Qt.TabFocus )
- self._undelete_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().undelete, HG.client_controller.pub, 'canvas_undelete', self._canvas_key )
+ self._undelete_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().undelete, CG.client_controller.pub, 'canvas_undelete', self._canvas_key )
self._undelete_button.setToolTip( 'undelete' )
self._undelete_button.setFocusPolicy( QC.Qt.TabFocus )
@@ -792,7 +796,7 @@ def _PopulateRightButtons( self ):
self._show_embedded_metadata_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().listctrl, self._ShowFileEmbeddedMetadata )
self._show_embedded_metadata_button.setFocusPolicy( QC.Qt.TabFocus )
- fullscreen_switch = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().fullscreen_switch, HG.client_controller.pub, 'canvas_fullscreen_switch', self._canvas_key )
+ fullscreen_switch = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().fullscreen_switch, CG.client_controller.pub, 'canvas_fullscreen_switch', self._canvas_key )
fullscreen_switch.setToolTip( 'fullscreen switch' )
fullscreen_switch.setFocusPolicy( QC.Qt.TabFocus )
@@ -812,7 +816,7 @@ def _PopulateRightButtons( self ):
drag_button.pressed.connect( self.DragButtonHit )
drag_button.setFocusPolicy( QC.Qt.TabFocus )
- close = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().stop, HG.client_controller.pub, 'canvas_close', self._canvas_key )
+ close = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().stop, CG.client_controller.pub, 'canvas_close', self._canvas_key )
close.setToolTip( 'close' )
close.setFocusPolicy( QC.Qt.TabFocus )
@@ -863,7 +867,7 @@ def _ResetButtons( self ):
self._delete_button.hide()
- if set( locations_manager.GetDeleted() ).isdisjoint( HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) ) ):
+ if set( locations_manager.GetDeleted() ).isdisjoint( CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) ) ):
self._undelete_button.hide()
@@ -941,7 +945,7 @@ def _ResetText( self ):
def _FlipActiveDefaultCustomShortcut( self, name ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
default_media_viewer_custom_shortcuts = list( new_options.GetStringList( 'default_media_viewer_custom_shortcuts' ) )
@@ -971,7 +975,7 @@ def _ShowFileEmbeddedMetadata( self ):
def _ShowShortcutMenu( self ):
- all_shortcut_names = HG.client_controller.Read( 'serialisable_names', HydrusSerialisable.SERIALISABLE_TYPE_SHORTCUT_SET )
+ all_shortcut_names = CG.client_controller.Read( 'serialisable_names', HydrusSerialisable.SERIALISABLE_TYPE_SHORTCUT_SET )
custom_shortcuts_names = [ name for name in all_shortcut_names if name not in ClientGUIShortcuts.SHORTCUTS_RESERVED_NAMES ]
@@ -982,7 +986,7 @@ def _ShowShortcutMenu( self ):
if len( custom_shortcuts_names ) > 0:
my_canvas_active_custom_shortcuts = self._my_canvas.GetActiveCustomShortcutNames()
- default_media_viewer_custom_shortcuts = HG.client_controller.new_options.GetStringList( 'default_media_viewer_custom_shortcuts' )
+ default_media_viewer_custom_shortcuts = CG.client_controller.new_options.GetStringList( 'default_media_viewer_custom_shortcuts' )
current_menu = ClientGUIMenus.GenerateMenu( menu )
@@ -1222,7 +1226,7 @@ def __init__( self, parent, my_canvas, top_hover: CanvasHoverFrameTop, canvas_ke
like_hbox = QP.HBoxLayout( spacing = 0 )
- like_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
+ like_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
if len( like_services ) > 0:
@@ -1242,7 +1246,7 @@ def __init__( self, parent, my_canvas, top_hover: CanvasHoverFrameTop, canvas_ke
# each numerical one in turn
- numerical_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, ) )
+ numerical_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, ) )
for service in numerical_services:
@@ -1259,7 +1263,7 @@ def __init__( self, parent, my_canvas, top_hover: CanvasHoverFrameTop, canvas_ke
incdec_hbox = QP.HBoxLayout( spacing = 0 )
- incdec_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_INCDEC, ) )
+ incdec_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_INCDEC, ) )
if len( incdec_services ) > 0:
@@ -1287,7 +1291,7 @@ def __init__( self, parent, my_canvas, top_hover: CanvasHoverFrameTop, canvas_ke
self._ResetData()
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
def _Archive( self ):
@@ -1412,7 +1416,7 @@ def _ResetData( self ):
QP.ClearLayout( self._urls_vbox, delete_widgets = True )
- url_tuples = HG.client_controller.network_engine.domain_manager.ConvertURLsToMediaViewerTuples( urls )
+ url_tuples = CG.client_controller.network_engine.domain_manager.ConvertURLsToMediaViewerTuples( urls )
for ( display_string, url ) in url_tuples:
@@ -1609,7 +1613,7 @@ def __init__( self, parent, my_canvas, top_right_hover: CanvasHoverFrameTopRight
self._ResetNotes()
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
def _EditNotes( self, name ):
@@ -1807,7 +1811,7 @@ def __init__( self, parent: QW.QWidget, my_canvas: QW.QWidget, canvas_key: bytes
self._show_in_a_page_button.setToolTip( 'send pair to the duplicates media page, for later processing' )
self._show_in_a_page_button.setFocusPolicy( QC.Qt.TabFocus )
- self._trash_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().delete, HG.client_controller.pub, 'canvas_delete', self._canvas_key )
+ self._trash_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().delete, CG.client_controller.pub, 'canvas_delete', self._canvas_key )
self._trash_button.setToolTip( 'send to trash' )
self._trash_button.setFocusPolicy( QC.Qt.TabFocus )
@@ -1816,7 +1820,7 @@ def __init__( self, parent: QW.QWidget, my_canvas: QW.QWidget, canvas_key: bytes
menu_items.append( ( 'normal', 'edit duplicate metadata merge options for \'this is better\'', 'edit what content is merged when you filter files', HydrusData.Call( self._EditMergeOptions, HC.DUPLICATE_BETTER ) ) )
menu_items.append( ( 'normal', 'edit duplicate metadata merge options for \'same quality\'', 'edit what content is merged when you filter files', HydrusData.Call( self._EditMergeOptions, HC.DUPLICATE_SAME_QUALITY ) ) )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
menu_items.append( ( 'normal', 'edit duplicate metadata merge options for \'alternates\' (advanced!)', 'edit what content is merged when you filter files', HydrusData.Call( self._EditMergeOptions, HC.DUPLICATE_ALTERNATE ) ) )
@@ -1827,7 +1831,7 @@ def __init__( self, parent: QW.QWidget, my_canvas: QW.QWidget, canvas_key: bytes
self._cog_button = ClientGUIMenuButton.MenuBitmapButton( self, CC.global_pixmaps().cog, menu_items )
self._cog_button.setFocusPolicy( QC.Qt.TabFocus )
- close_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().stop, HG.client_controller.pub, 'canvas_close', self._canvas_key )
+ close_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().stop, CG.client_controller.pub, 'canvas_close', self._canvas_key )
close_button.setToolTip( 'close filter' )
close_button.setFocusPolicy( QC.Qt.TabFocus )
@@ -1942,13 +1946,13 @@ def __init__( self, parent: QW.QWidget, my_canvas: QW.QWidget, canvas_key: bytes
self.setLayout( vbox )
- HG.client_controller.sub( self, 'SetDuplicatePair', 'canvas_new_duplicate_pair' )
- HG.client_controller.sub( self, 'SetIndexString', 'canvas_new_index_string' )
+ CG.client_controller.sub( self, 'SetDuplicatePair', 'canvas_new_duplicate_pair' )
+ CG.client_controller.sub( self, 'SetIndexString', 'canvas_new_index_string' )
def _EditBackgroundSwitchIntensity( self ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
for ( message, tooltip, variable_name ) in [
( 'intensity for A', 'This changes the background colour when you are looking at A. If you have a pure white/black background, it helps to highlight transparency vs opaque white/black image background.', 'duplicate_background_switch_intensity_a' ),
@@ -1983,7 +1987,7 @@ def _EditBackgroundSwitchIntensity( self ):
def _EditMergeOptions( self, duplicate_type ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
duplicate_content_merge_options = new_options.GetDuplicateContentMergeOptions( duplicate_type )
@@ -2121,7 +2125,7 @@ def __init__( self, parent, my_canvas, top_hover: CanvasHoverFrameTop, canvas_ke
self.setLayout( vbox )
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
def _GetIdealSizeAndPosition( self ):
diff --git a/hydrus/client/gui/canvas/ClientGUICanvasMedia.py b/hydrus/client/gui/canvas/ClientGUICanvasMedia.py
index e5caf9f88..6042c6502 100644
--- a/hydrus/client/gui/canvas/ClientGUICanvasMedia.py
+++ b/hydrus/client/gui/canvas/ClientGUICanvasMedia.py
@@ -27,6 +27,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientRendering
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import ClientGUIMedia
@@ -63,7 +64,7 @@ def CalculateCanvasMediaSize( media, canvas_size: QC.QSize, show_action ):
'''if ClientGUICanvasMedia.ShouldHaveAnimationBar( media, show_action ):
- animated_scanbar_height = HG.client_controller.new_options.GetInteger( 'animated_scanbar_height' )
+ animated_scanbar_height = CG.client_controller.new_options.GetInteger( 'animated_scanbar_height' )
canvas_height -= animated_scanbar_height
'''
@@ -93,7 +94,7 @@ def CalculateCanvasZooms( canvas_size: QC.QSize, canvas_type: int, device_pixel_
return ( 1.0, 1.0 )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
( canvas_width, canvas_height ) = CalculateCanvasMediaSize( media, canvas_size, show_action )
@@ -210,11 +211,11 @@ def CalculateMediaContainerSize( media, device_pixel_ratio: float, zoom, show_ac
# Note that this handles a zipfile default thumb too. by sending None resolution to GetThumbnailResolution, it falls back to default dimensions
# imperfect, but overall fine for most situations
- bounding_dimensions = HG.client_controller.options[ 'thumbnail_dimensions' ]
- thumbnail_scale_type = HG.client_controller.new_options.GetInteger( 'thumbnail_scale_type' )
+ bounding_dimensions = CG.client_controller.options[ 'thumbnail_dimensions' ]
+ thumbnail_scale_type = CG.client_controller.new_options.GetInteger( 'thumbnail_scale_type' )
# we want the device independant size here, not actual pixels, so want to keep this 100
- #thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ #thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
thumbnail_dpr_percent = 100
( thumb_width, thumb_height ) = HydrusImageHandling.GetThumbnailResolution( media.GetResolution(), bounding_dimensions, thumbnail_scale_type, thumbnail_dpr_percent )
@@ -229,7 +230,7 @@ def CalculateMediaContainerSize( media, device_pixel_ratio: float, zoom, show_ac
'''if ClientGUICanvasMedia.ShouldHaveAnimationBar( media, show_action ):
- animated_scanbar_height = HG.client_controller.new_options.GetInteger( 'animated_scanbar_height' )
+ animated_scanbar_height = CG.client_controller.new_options.GetInteger( 'animated_scanbar_height' )
media_height += animated_scanbar_height
'''
@@ -445,7 +446,7 @@ def _TryToDrawCanvasBitmap( self ):
if self._canvas_qt_pixmap is None:
- self._canvas_qt_pixmap = HG.client_controller.bitmap_manager.GetQtPixmap( my_raw_width, my_raw_height )
+ self._canvas_qt_pixmap = CG.client_controller.bitmap_manager.GetQtPixmap( my_raw_width, my_raw_height )
self._canvas_qt_pixmap.setDevicePixelRatio( self.devicePixelRatio() )
@@ -797,13 +798,13 @@ def SetMedia( self, media: typing.Optional[ ClientMedia.MediaSingleton ], start_
self._num_frames = 1
- HG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
else:
self._num_frames = self._media.GetNumFrames()
- HG.client_controller.gui.RegisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.RegisterAnimationUpdateWindow( self )
self.update()
@@ -834,7 +835,7 @@ def TIMERAnimationUpdate( self ):
do_times_to_play_animation_pause = False
- if self._media.GetMime() in HC.VIEWABLE_ANIMATIONS and not HG.client_controller.new_options.GetBoolean( 'always_loop_gifs' ):
+ if self._media.GetMime() in HC.VIEWABLE_ANIMATIONS and not CG.client_controller.new_options.GetBoolean( 'always_loop_gifs' ):
times_to_play_animation = self._video_container.GetTimesToPlayAnimation()
@@ -885,7 +886,7 @@ def TIMERAnimationUpdate( self ):
except:
- HG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
raise
@@ -1040,7 +1041,7 @@ def _Redraw( self, painter ):
- animated_scanbar_nub_width = HG.client_controller.new_options.GetInteger( 'animated_scanbar_nub_width' )
+ animated_scanbar_nub_width = CG.client_controller.new_options.GetInteger( 'animated_scanbar_nub_width' )
num_frames_are_useful = self._num_frames is not None and self._num_frames > 1
@@ -1106,7 +1107,7 @@ def _ScanToCurrentMousePos( self ):
mouse_pos = self.mapFromGlobal( QG.QCursor.pos() )
- animated_scanbar_nub_width = HG.client_controller.new_options.GetInteger( 'animated_scanbar_nub_width' )
+ animated_scanbar_nub_width = CG.client_controller.new_options.GetInteger( 'animated_scanbar_nub_width' )
compensated_x_position = mouse_pos.x() - ( animated_scanbar_nub_width / 2 )
@@ -1135,7 +1136,7 @@ def ClearMedia( self ):
self._media_window = None
- HG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
self.update()
@@ -1239,7 +1240,7 @@ def SetMediaAndWindow( self, media, media_window ):
self._currently_in_a_drag = False
self._it_was_playing_before_drag = False
- HG.client_controller.gui.RegisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.RegisterAnimationUpdateWindow( self )
self._next_draw_info = None
@@ -1407,7 +1408,7 @@ def __init__( self, parent, canvas_type, background_colour_generator, additional
self.hide()
- HG.client_controller.sub( self, 'Pause', 'pause_all_media' )
+ CG.client_controller.sub( self, 'Pause', 'pause_all_media' )
def _DestroyOrHideThisMediaWindow( self, media_window ):
@@ -1440,12 +1441,12 @@ def _DestroyOrHideThisMediaWindow( self, media_window ):
if isinstance( media_window, ClientGUIMPV.MPVWidget ):
- HG.client_controller.gui.ReleaseMPVWidget( media_window )
+ CG.client_controller.gui.ReleaseMPVWidget( media_window )
if isinstance( media_window, QtMediaPlayer ):
- HG.client_controller.gui.ReleaseQtMediaPlayer( media_window )
+ CG.client_controller.gui.ReleaseQtMediaPlayer( media_window )
else:
@@ -1539,7 +1540,7 @@ def _MakeMediaWindow( self ):
elif self._show_action == CC.MEDIA_VIEWER_ACTION_SHOW_WITH_MPV:
- self._media_window = HG.client_controller.gui.GetMPVWidget( self )
+ self._media_window = CG.client_controller.gui.GetMPVWidget( self )
self._media_window.SetCanvasType( self._canvas_type )
@@ -1693,7 +1694,7 @@ def _TryToChangeZoom( self, new_zoom, zoom_center_type_override = None ):
if zoom_center_type_override is None:
- zoom_center_type = HG.client_controller.new_options.GetInteger( 'media_viewer_zoom_center' )
+ zoom_center_type = CG.client_controller.new_options.GetInteger( 'media_viewer_zoom_center' )
else:
@@ -1765,7 +1766,7 @@ def ClearMedia( self ):
self._media_window = None
- HG.client_controller.gui.UnregisterUIUpdateWindow( self )
+ CG.client_controller.gui.UnregisterUIUpdateWindow( self )
self.hide()
@@ -1873,11 +1874,11 @@ def GetIdealControlsBarRect( self, full_size = True ):
if full_size:
- animated_scanbar_height = HG.client_controller.new_options.GetInteger( 'animated_scanbar_height' )
+ animated_scanbar_height = CG.client_controller.new_options.GetInteger( 'animated_scanbar_height' )
else:
- animated_scanbar_height = HG.client_controller.new_options.GetNoneableInteger( 'animated_scanbar_hide_height' )
+ animated_scanbar_height = CG.client_controller.new_options.GetNoneableInteger( 'animated_scanbar_hide_height' )
if animated_scanbar_height is None:
@@ -1948,7 +1949,7 @@ def HasPlayedOnceThrough( self ):
def IsAtMaxZoom( self ):
- possible_zooms = HG.client_controller.new_options.GetMediaZooms()
+ possible_zooms = CG.client_controller.new_options.GetMediaZooms()
max_zoom = max( possible_zooms )
@@ -2190,7 +2191,7 @@ def SetMedia( self, media: ClientMedia.MediaSingleton, maintain_zoom, maintain_p
self._media_window.show()
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
self.show()
@@ -2232,9 +2233,9 @@ def ZoomIn( self, zoom_center_type_override = None ):
return
- ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) = HG.client_controller.new_options.GetMediaZoomOptions( self._media.GetMime() )
+ ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) = CG.client_controller.new_options.GetMediaZoomOptions( self._media.GetMime() )
- possible_zooms = HG.client_controller.new_options.GetMediaZooms()
+ possible_zooms = CG.client_controller.new_options.GetMediaZooms()
if exact_zooms_only:
@@ -2417,11 +2418,11 @@ def ZoomMax( self ):
return
- possible_zooms = HG.client_controller.new_options.GetMediaZooms()
+ possible_zooms = CG.client_controller.new_options.GetMediaZooms()
max_zoom = max( possible_zooms )
- ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) = HG.client_controller.new_options.GetMediaZoomOptions( self._media.GetMime() )
+ ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) = CG.client_controller.new_options.GetMediaZoomOptions( self._media.GetMime() )
if exact_zooms_only:
@@ -2450,7 +2451,7 @@ def ZoomOut( self, zoom_center_type_override = None ):
return
- ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) = HG.client_controller.new_options.GetMediaZoomOptions( self._media.GetMime() )
+ ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) = CG.client_controller.new_options.GetMediaZoomOptions( self._media.GetMime() )
if exact_zooms_only:
@@ -2475,7 +2476,7 @@ def ZoomOut( self, zoom_center_type_override = None ):
else:
- possible_zooms = HG.client_controller.new_options.GetMediaZooms()
+ possible_zooms = CG.client_controller.new_options.GetMediaZooms()
possible_zooms.append( self._canvas_zoom )
@@ -2553,11 +2554,11 @@ def ZoomSwitchMax( self, switch_base: float ):
if self._current_zoom == switch_base:
- possible_zooms = HG.client_controller.new_options.GetMediaZooms()
+ possible_zooms = CG.client_controller.new_options.GetMediaZooms()
max_zoom = max( possible_zooms )
- ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) = HG.client_controller.new_options.GetMediaZoomOptions( self._media.GetMime() )
+ ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) = CG.client_controller.new_options.GetMediaZoomOptions( self._media.GetMime() )
if exact_zooms_only:
@@ -2599,8 +2600,8 @@ def TIMERUIUpdate( self ):
else:
is_near = self.MouseIsNearAnimationBar()
- show_small_instead_of_hiding = HG.client_controller.new_options.GetNoneableInteger( 'animated_scanbar_hide_height' ) is not None
- force_show = self._volume_control.PopupIsVisible() or self._animation_bar.DoingADrag() or HG.client_controller.new_options.GetBoolean( 'force_animation_scanbar_show' )
+ show_small_instead_of_hiding = CG.client_controller.new_options.GetNoneableInteger( 'animated_scanbar_hide_height' ) is not None
+ force_show = self._volume_control.PopupIsVisible() or self._animation_bar.DoingADrag() or CG.client_controller.new_options.GetBoolean( 'force_animation_scanbar_show' )
should_show_controls = is_near or show_small_instead_of_hiding or force_show
@@ -2670,7 +2671,7 @@ def __init__( self, parent, background_colour_generator ):
self.setCursor( QG.QCursor( QC.Qt.PointingHandCursor ) )
- HG.client_controller.sub( self, 'update', 'notify_new_colourset' )
+ CG.client_controller.sub( self, 'update', 'notify_new_colourset' )
def _Redraw( self, painter ):
@@ -2684,7 +2685,7 @@ def _Redraw( self, painter ):
center_y = my_height // 2
radius = min( 50, center_x, center_y ) - 5
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
colour = self._background_colour_generator.GetColour()
@@ -2770,7 +2771,7 @@ def SetMedia( self, media ):
if needs_thumb:
- thumbnail_path = HG.client_controller.client_files_manager.GetThumbnailPath( self._media )
+ thumbnail_path = CG.client_controller.client_files_manager.GetThumbnailPath( self._media )
thumbnail_mime = HydrusFileHandling.GetThumbnailMime( thumbnail_path )
@@ -2790,7 +2791,7 @@ def __init__( self, parent, media ):
QW.QWidget.__init__( self, parent )
- self._new_options = HG.client_controller.new_options
+ self._new_options = CG.client_controller.new_options
self._media = media
@@ -2798,9 +2799,9 @@ def __init__( self, parent, media ):
if self._media.GetLocationsManager().IsLocal():
- qt_pixmap = HG.client_controller.GetCache( 'thumbnail' ).GetThumbnail( media ).GetQtPixmap()
+ qt_pixmap = CG.client_controller.GetCache( 'thumbnail' ).GetThumbnail( media ).GetQtPixmap()
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
if thumbnail_dpr_percent != 100:
@@ -2849,7 +2850,7 @@ def LaunchFile( self ):
hash = self._media.GetHash()
mime = self._media.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
@@ -2909,8 +2910,8 @@ def __init__( self, parent: QW.QWidget, canvas_type, background_colour_generator
self._my_shortcut_handler = ClientGUIShortcuts.ShortcutsHandler( self, [ shortcut_set ], catch_mouse = True )
- HG.client_controller.sub( self, 'UpdateAudioMute', 'new_audio_mute' )
- HG.client_controller.sub( self, 'UpdateAudioVolume', 'new_audio_volume' )
+ CG.client_controller.sub( self, 'UpdateAudioMute', 'new_audio_mute' )
+ CG.client_controller.sub( self, 'UpdateAudioVolume', 'new_audio_volume' )
def _MediaStatusChanged( self, status ):
@@ -3144,7 +3145,7 @@ def SetMedia( self, media: ClientMedia.MediaSingleton, start_paused = False ):
self._my_video_output.setVisible( not is_audio )
self._my_audio_placeholder.setVisible( is_audio )
- path = HG.client_controller.client_files_manager.GetFilePath( self._media.GetHash(), self._media.GetMime() )
+ path = CG.client_controller.client_files_manager.GetFilePath( self._media.GetHash(), self._media.GetMime() )
self._media_player.setSource( QC.QUrl.fromLocalFile( path ) )
@@ -3209,7 +3210,7 @@ def __init__( self, parent, canvas_type, background_colour_generator ):
self._last_device_pixel_ratio = self.devicePixelRatio()
- self._tile_cache = HG.client_controller.GetCache( 'image_tiles' )
+ self._tile_cache = CG.client_controller.GetCache( 'image_tiles' )
self._canvas_tiles = {}
@@ -3255,7 +3256,7 @@ def _ClearCanvasTileCache( self ):
# the trick of going ( 123456 // 16 ) * 16 to give you a nice multiple of 16 does not work with floats like 1.4 lmao.
# what we can do instead is phrase 1.4 as 7/5 and use 7 as our int. any number cleanly divisible by 7 is cleanly divisible by 1.4
- ideal_tile_dimension = HG.client_controller.new_options.GetInteger( 'ideal_tile_dimension' )
+ ideal_tile_dimension = CG.client_controller.new_options.GetInteger( 'ideal_tile_dimension' )
nice_number = HydrusData.GetNicelyDivisibleNumberForZoom( self._zoom / self.devicePixelRatio(), ideal_tile_dimension )
@@ -3376,7 +3377,7 @@ def _DrawTile( self, tile_coordinate ):
raw_width = raw_canvas_clip_rect.width()
raw_height = raw_canvas_clip_rect.height()
- tile_pixmap = HG.client_controller.bitmap_manager.GetQtPixmap( raw_width, raw_height )
+ tile_pixmap = CG.client_controller.bitmap_manager.GetQtPixmap( raw_width, raw_height )
painter = QG.QPainter( tile_pixmap )
@@ -3690,13 +3691,13 @@ def SetMedia( self, media ):
self._media = media
- image_cache = HG.client_controller.GetCache( 'images' )
+ image_cache = CG.client_controller.GetCache( 'images' )
self._image_renderer = image_cache.GetImageRenderer( self._media )
if not self._image_renderer.IsReady():
- HG.client_controller.gui.RegisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.RegisterAnimationUpdateWindow( self )
self.update()
@@ -3710,12 +3711,12 @@ def TIMERAnimationUpdate( self ):
self.update()
- HG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
except:
- HG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
raise
diff --git a/hydrus/client/gui/canvas/ClientGUIMPV.py b/hydrus/client/gui/canvas/ClientGUIMPV.py
index d15b427b3..2701c6da0 100644
--- a/hydrus/client/gui/canvas/ClientGUIMPV.py
+++ b/hydrus/client/gui/canvas/ClientGUIMPV.py
@@ -15,6 +15,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIMedia
@@ -104,7 +105,7 @@ def log_handler( loglevel, component, message ):
'Error splitting the input' in message
]
- HG.client_controller.CallBlockingToQt( HG.client_controller.gui, EmergencyDumpOutGlobal, True in probably_crashy_tests, f'{component}: {message}' )
+ CG.client_controller.CallBlockingToQt( CG.client_controller.gui, EmergencyDumpOutGlobal, True in probably_crashy_tests, f'{component}: {message}' )
HydrusData.DebugPrint( '[MPV {}] {}: {}'.format( loglevel, component, message ) )
@@ -269,10 +270,10 @@ def __init__( self, parent ):
self.destroyed.connect( self._player.terminate )
- HG.client_controller.sub( self, 'UpdateAudioMute', 'new_audio_mute' )
- HG.client_controller.sub( self, 'UpdateAudioVolume', 'new_audio_volume' )
- HG.client_controller.sub( self, 'UpdateConf', 'notify_new_options' )
- HG.client_controller.sub( self, 'SetLogLevel', 'set_mpv_log_level' )
+ CG.client_controller.sub( self, 'UpdateAudioMute', 'new_audio_mute' )
+ CG.client_controller.sub( self, 'UpdateAudioVolume', 'new_audio_volume' )
+ CG.client_controller.sub( self, 'UpdateConf', 'notify_new_options' )
+ CG.client_controller.sub( self, 'SetLogLevel', 'set_mpv_log_level' )
self.installEventFilter( self )
@@ -304,14 +305,14 @@ def _GetAudioOptionNames( self ):
if self._canvas_type in CC.CANVAS_MEDIA_VIEWER_TYPES:
- if HG.client_controller.new_options.GetBoolean( 'media_viewer_uses_its_own_audio_volume' ):
+ if CG.client_controller.new_options.GetBoolean( 'media_viewer_uses_its_own_audio_volume' ):
return ClientGUIMediaControls.volume_types_to_option_names[ ClientGUIMediaControls.AUDIO_MEDIA_VIEWER ]
elif self._canvas_type == CC.CANVAS_PREVIEW:
- if HG.client_controller.new_options.GetBoolean( 'preview_uses_its_own_audio_volume' ):
+ if CG.client_controller.new_options.GetBoolean( 'preview_uses_its_own_audio_volume' ):
return ClientGUIMediaControls.volume_types_to_option_names[ ClientGUIMediaControls.AUDIO_PREVIEW ]
@@ -536,7 +537,7 @@ def EmergencyDumpOut( self, probably_crashy, reason ):
job_status.SetFiles( [ original_media.GetHash() ], 'MPV-crasher' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
else:
@@ -945,7 +946,7 @@ def SetMedia( self, media: typing.Optional[ ClientMedia.MediaSingleton ], start_
# so let's see what happens here
mute_override = not self._media.HasAudio()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
@@ -955,7 +956,7 @@ def SetMedia( self, media: typing.Optional[ ClientMedia.MediaSingleton ], start_
self._player.pause = True
- if mime in HC.VIEWABLE_ANIMATIONS and not HG.client_controller.new_options.GetBoolean( 'always_loop_gifs' ):
+ if mime in HC.VIEWABLE_ANIMATIONS and not CG.client_controller.new_options.GetBoolean( 'always_loop_gifs' ):
if mime == HC.ANIMATION_GIF:
@@ -1033,11 +1034,11 @@ def UpdateAudioVolume( self ):
def UpdateConf( self ):
- mpv_config_path = HG.client_controller.GetMPVConfPath()
+ mpv_config_path = CG.client_controller.GetMPVConfPath()
if not os.path.exists( mpv_config_path ):
- default_mpv_config_path = HG.client_controller.GetDefaultMPVConfPath()
+ default_mpv_config_path = CG.client_controller.GetDefaultMPVConfPath()
if not os.path.exists( default_mpv_config_path ):
diff --git a/hydrus/client/gui/canvas/ClientGUIMediaVolume.py b/hydrus/client/gui/canvas/ClientGUIMediaVolume.py
index 9c74b1b34..251cc5b39 100644
--- a/hydrus/client/gui/canvas/ClientGUIMediaVolume.py
+++ b/hydrus/client/gui/canvas/ClientGUIMediaVolume.py
@@ -1,6 +1,5 @@
-from hydrus.core import HydrusGlobals as HG
-
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIMediaControls
def GetCorrectCurrentMute( canvas_type: int ):
@@ -18,7 +17,7 @@ def GetCorrectCurrentMute( canvas_type: int ):
( mute_option_name, volume_option_name ) = ClientGUIMediaControls.volume_types_to_option_names[ ClientGUIMediaControls.AUDIO_PREVIEW ]
- return HG.client_controller.new_options.GetBoolean( mute_option_name ) or HG.client_controller.new_options.GetBoolean( global_mute_option_name )
+ return CG.client_controller.new_options.GetBoolean( mute_option_name ) or CG.client_controller.new_options.GetBoolean( global_mute_option_name )
def GetCorrectCurrentVolume( canvas_type: int ):
@@ -27,18 +26,18 @@ def GetCorrectCurrentVolume( canvas_type: int ):
if canvas_type in CC.CANVAS_MEDIA_VIEWER_TYPES:
- if HG.client_controller.new_options.GetBoolean( 'media_viewer_uses_its_own_audio_volume' ):
+ if CG.client_controller.new_options.GetBoolean( 'media_viewer_uses_its_own_audio_volume' ):
( mute_option_name, volume_option_name ) = ClientGUIMediaControls.volume_types_to_option_names[ ClientGUIMediaControls.AUDIO_MEDIA_VIEWER ]
elif canvas_type == CC.CANVAS_PREVIEW:
- if HG.client_controller.new_options.GetBoolean( 'preview_uses_its_own_audio_volume' ):
+ if CG.client_controller.new_options.GetBoolean( 'preview_uses_its_own_audio_volume' ):
( mute_option_name, volume_option_name ) = ClientGUIMediaControls.volume_types_to_option_names[ ClientGUIMediaControls.AUDIO_PREVIEW ]
- return HG.client_controller.new_options.GetInteger( volume_option_name )
+ return CG.client_controller.new_options.GetInteger( volume_option_name )
diff --git a/hydrus/client/gui/exporting/ClientGUIExport.py b/hydrus/client/gui/exporting/ClientGUIExport.py
index 61218384b..fbf580bfb 100644
--- a/hydrus/client/gui/exporting/ClientGUIExport.py
+++ b/hydrus/client/gui/exporting/ClientGUIExport.py
@@ -9,13 +9,13 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusLists
from hydrus.core import HydrusPaths
from hydrus.core import HydrusThreading
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientThreading
from hydrus.client.exporting import ClientExportingFiles
@@ -73,7 +73,7 @@ def __init__( self, parent, export_folders ):
def _AddFolder( self ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
phrase = new_options.GetString( 'export_phrase' )
@@ -82,7 +82,7 @@ def _AddFolder( self ):
export_type = HC.EXPORT_FOLDER_TYPE_REGULAR
delete_from_client_after_export = False
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
file_search_context = ClientSearch.FileSearchContext( location_context = default_location_context )
@@ -520,7 +520,7 @@ def __init__( self, parent, flat_media, do_export_and_then_quit = False ):
ClientGUIScrolledPanels.ReviewPanel.__init__( self, parent )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
self._media_to_paths = {}
self._media_to_number_indices = { media : i + 1 for ( i, media ) in enumerate( flat_media ) }
@@ -530,7 +530,7 @@ def __init__( self, parent, flat_media, do_export_and_then_quit = False ):
self._tags_box = ClientGUIListBoxes.StaticBoxSorterForListBoxTags( self, 'files\' tags' )
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
t = ClientGUIListBoxes.ListBoxTagsMedia( self._tags_box, ClientTags.TAG_DISPLAY_DISPLAY_ACTUAL, include_counts = True )
@@ -594,7 +594,7 @@ def __init__( self, parent, flat_media, do_export_and_then_quit = False ):
self._paths.SetData( flat_media )
- self._delete_files_after_export.setChecked( HG.client_controller.new_options.GetBoolean( 'delete_files_after_export' ) )
+ self._delete_files_after_export.setChecked( CG.client_controller.new_options.GetBoolean( 'delete_files_after_export' ) )
self._delete_files_after_export.clicked.connect( self.EventDeleteFilesChanged )
#
@@ -640,7 +640,7 @@ def __init__( self, parent, flat_media, do_export_and_then_quit = False ):
if do_export_and_then_quit:
- HG.client_controller.CallAfterQtSafe( self, 'doing export before dialog quit', self._DoExport, True )
+ CG.client_controller.CallAfterQtSafe( self, 'doing export before dialog quit', self._DoExport, True )
@@ -754,7 +754,7 @@ def _DoExport( self, quit_afterwards = False ):
pattern = self._pattern.text()
- HG.client_controller.new_options.SetString( 'export_phrase', pattern )
+ CG.client_controller.new_options.SetString( 'export_phrase', pattern )
try:
@@ -769,7 +769,7 @@ def _DoExport( self, quit_afterwards = False ):
metadata_routers = self._metadata_routers_button.GetValue()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
self._export.setEnabled( False )
@@ -810,7 +810,7 @@ def do_it( directory, metadata_routers, delete_afterwards, export_symlinks, quit
job_status.SetStatusTitle( 'file export' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
pauser = HydrusThreading.BigJobPauser()
@@ -895,7 +895,7 @@ def do_it( directory, metadata_routers, delete_afterwards, export_symlinks, quit
deletee_medias = ClientMediaFileFilter.FilterAndReportDeleteLockFailures( possible_deletee_medias )
- local_file_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_file_service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
chunks_of_deletee_medias = HydrusLists.SplitListIntoChunks( list( deletee_medias ), 64 )
@@ -917,7 +917,7 @@ def do_it( directory, metadata_routers, delete_afterwards, export_symlinks, quit
content_update = ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_DELETE, service_keys_to_hashes[ service_key ], reason = reason )
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( service_key, content_update ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( service_key, content_update ) )
@@ -936,7 +936,7 @@ def do_it( directory, metadata_routers, delete_afterwards, export_symlinks, quit
QP.CallAfter( qt_done, quit_afterwards )
- HG.client_controller.CallToThread( do_it, directory, metadata_routers, delete_afterwards, export_symlinks, quit_afterwards )
+ CG.client_controller.CallToThread( do_it, directory, metadata_routers, delete_afterwards, export_symlinks, quit_afterwards )
def _GetPath( self, media ):
@@ -970,7 +970,7 @@ def _MetadataRoutersUpdated( self ):
metadata_routers = self._metadata_routers_button.GetValue()
- HG.client_controller.new_options.SetDefaultExportFilesMetadataRouters( metadata_routers )
+ CG.client_controller.new_options.SetDefaultExportFilesMetadataRouters( metadata_routers )
def _RefreshPaths( self ):
@@ -986,7 +986,7 @@ def _RefreshPaths( self ):
self._last_phrase_used = pattern
self._last_dir_used = dir_path
- HG.client_controller.new_options.SetString( 'export_phrase', pattern )
+ CG.client_controller.new_options.SetString( 'export_phrase', pattern )
self._existing_filenames = set()
self._media_to_paths = {}
@@ -1015,7 +1015,7 @@ def EventDeleteFilesChanged( self ):
value = self._delete_files_after_export.isChecked()
- HG.client_controller.new_options.SetBoolean( 'delete_files_after_export', value )
+ CG.client_controller.new_options.SetBoolean( 'delete_files_after_export', value )
if value:
@@ -1029,7 +1029,14 @@ def EventOpenLocation( self ):
if directory is not None and directory != '':
+ if not os.path.exists( directory ):
+
+ ClientGUIDialogsMessage.ShowCritical( self, 'Does not exist!', 'That location does not seem to exist!' )
+
+ return
+
+
HydrusPaths.LaunchDirectory( directory )
-
+
diff --git a/hydrus/client/gui/importing/ClientGUIImport.py b/hydrus/client/gui/importing/ClientGUIImport.py
index 7c9c52321..fb48e5011 100644
--- a/hydrus/client/gui/importing/ClientGUIImport.py
+++ b/hydrus/client/gui/importing/ClientGUIImport.py
@@ -14,6 +14,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientTime
from hydrus.client.gui import ClientGUIDialogs
from hydrus.client.gui import ClientGUIDialogsMessage
@@ -158,7 +159,7 @@ def GetTags( self, index, path ):
tags = HydrusTags.CleanTags( tags )
- tags = HG.client_controller.tag_display_manager.FilterTags( ClientTags.TAG_DISPLAY_STORAGE, self._service_key, tags )
+ tags = CG.client_controller.tag_display_manager.FilterTags( ClientTags.TAG_DISPLAY_STORAGE, self._service_key, tags )
return tags
@@ -447,7 +448,7 @@ def __init__( self, parent, service_key, filename_tagging_options, present_for_a
self._tags = ClientGUIListBoxes.ListBoxTagsStringsAddRemove( self._tags_panel, self._service_key, tag_display_type = ClientTags.TAG_DISPLAY_STORAGE )
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._tag_autocomplete_all = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite( self._tags_panel, self.EnterTags, default_location_context, service_key, show_paste_button = True )
@@ -589,7 +590,7 @@ def _GetTagsFromClipboard( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -654,7 +655,7 @@ def _PasteSingleTags( self ):
def EnterTags( self, tags ):
- HG.client_controller.Write( 'push_recent_tags', self._service_key, tags )
+ CG.client_controller.Write( 'push_recent_tags', self._service_key, tags )
if len( tags ) > 0:
@@ -678,7 +679,7 @@ def EnterTagsOnlyAdd( self, tags ):
def EnterTagsSingle( self, tags ):
- HG.client_controller.Write( 'push_recent_tags', self._service_key, tags )
+ CG.client_controller.Write( 'push_recent_tags', self._service_key, tags )
if len( tags ) > 0:
@@ -812,9 +813,9 @@ def __init__( self, parent, paths ):
self._notebook.addTab( self._metadata_router_page, 'sidecars' )
- services = HG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
+ services = CG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
- default_tag_service_key = HG.client_controller.new_options.GetKey( 'default_tag_service_tab' )
+ default_tag_service_key = CG.client_controller.new_options.GetKey( 'default_tag_service_tab' )
for service in services:
@@ -857,13 +858,13 @@ def _SaveDefaultTagServiceKey( self ):
return
- if HG.client_controller.new_options.GetBoolean( 'save_default_tag_service_tab_on_change' ):
+ if CG.client_controller.new_options.GetBoolean( 'save_default_tag_service_tab_on_change' ):
current_page = self._notebook.currentWidget()
if current_page in self._filename_tagging_option_pages:
- HG.client_controller.new_options.SetKey( 'default_tag_service_tab', current_page.GetServiceKey() )
+ CG.client_controller.new_options.SetKey( 'default_tag_service_tab', current_page.GetServiceKey() )
@@ -1016,7 +1017,7 @@ def ScheduleRefreshFileList( self ):
self._schedule_refresh_file_list_job = None
- self._schedule_refresh_file_list_job = HG.client_controller.CallLaterQtSafe( self, 0.5, 'refresh path list', self.RefreshFileList )
+ self._schedule_refresh_file_list_job = CG.client_controller.CallLaterQtSafe( self, 0.5, 'refresh path list', self.RefreshFileList )
def SetSearchFocus( self ):
@@ -1139,7 +1140,7 @@ def ScheduleRefreshFileList( self ):
self._schedule_refresh_file_list_job = None
- self._schedule_refresh_file_list_job = HG.client_controller.CallLaterQtSafe( self, 0.5, 'refresh path list', self.RefreshFileList )
+ self._schedule_refresh_file_list_job = CG.client_controller.CallLaterQtSafe( self, 0.5, 'refresh path list', self.RefreshFileList )
def SetSearchFocus( self ):
@@ -1235,7 +1236,7 @@ def ScheduleRefreshTags( self ):
self._schedule_refresh_tags_job = None
- self._schedule_refresh_tags_job = HG.client_controller.CallLaterQtSafe( self, 0.5, 'refresh tags', self.RefreshTags )
+ self._schedule_refresh_tags_job = CG.client_controller.CallLaterQtSafe( self, 0.5, 'refresh tags', self.RefreshTags )
class GalleryImportPanel( ClientGUICommon.StaticBox ):
@@ -1256,7 +1257,7 @@ def __init__( self, parent, page_key, name = 'gallery query' ):
self._import_queue_panel = ClientGUICommon.StaticBox( self, 'imports' )
self._file_status = ClientGUICommon.BetterStaticText( self._import_queue_panel, ellipsize_end = True )
- self._file_seed_cache_control = ClientGUIFileSeedCache.FileSeedCacheStatusControl( self._import_queue_panel, HG.client_controller, self._page_key )
+ self._file_seed_cache_control = ClientGUIFileSeedCache.FileSeedCacheStatusControl( self._import_queue_panel, CG.client_controller, self._page_key )
self._file_download_control = ClientGUINetworkJobControl.NetworkJobControl( self._import_queue_panel )
self._files_pause_button = ClientGUICommon.BetterBitmapButton( self._import_queue_panel, CC.global_pixmaps().file_pause, self.PauseFiles )
@@ -1269,7 +1270,7 @@ def __init__( self, parent, page_key, name = 'gallery query' ):
self._gallery_pause_button = ClientGUICommon.BetterBitmapButton( self._gallery_panel, CC.global_pixmaps().gallery_pause, self.PauseGallery )
self._gallery_pause_button.setToolTip( 'pause/play search' )
- self._gallery_seed_log_control = ClientGUIGallerySeedLog.GallerySeedLogStatusControl( self._gallery_panel, HG.client_controller, False, True, 'search', page_key = self._page_key )
+ self._gallery_seed_log_control = ClientGUIGallerySeedLog.GallerySeedLogStatusControl( self._gallery_panel, CG.client_controller, False, True, 'search', page_key = self._page_key )
self._gallery_download_control = ClientGUINetworkJobControl.NetworkJobControl( self._gallery_panel )
@@ -1330,7 +1331,7 @@ def __init__( self, parent, page_key, name = 'gallery query' ):
self._UpdateControlsForNewGalleryImport()
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
def _SetFileImportOptions( self, file_import_options: FileImportOptions.FileImportOptions ):
@@ -1501,7 +1502,7 @@ def SetGalleryImport( self, gallery_import ):
def TIMERUIUpdate( self ):
- if HG.client_controller.gui.IShouldRegularlyUpdate( self ):
+ if CG.client_controller.gui.IShouldRegularlyUpdate( self ):
self._UpdateStatus()
@@ -1513,7 +1514,7 @@ def __init__( self, parent, gug_key_and_name, update_callable = None ):
ClientGUICommon.BetterButton.__init__( self, parent, 'gallery selector', self._Edit )
- gug = HG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
+ gug = CG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
if gug is not None:
@@ -1528,7 +1529,7 @@ def __init__( self, parent, gug_key_and_name, update_callable = None ):
def _Edit( self ):
- domain_manager = HG.client_controller.network_engine.domain_manager
+ domain_manager = CG.client_controller.network_engine.domain_manager
# maybe relegate to hidden page and something like "(does not work)" if no gallery url class match
@@ -1627,7 +1628,7 @@ def _SetLabel( self ):
label = self._gug_key_and_name[1]
- gug = HG.client_controller.network_engine.domain_manager.GetGUG( self._gug_key_and_name )
+ gug = CG.client_controller.network_engine.domain_manager.GetGUG( self._gug_key_and_name )
if gug is None:
@@ -1683,7 +1684,7 @@ def __init__( self, parent, page_key, name = 'watcher' ):
self._files_pause_button.setToolTip( 'pause/play files' )
self._file_status = ClientGUICommon.BetterStaticText( imports_panel, ellipsize_end = True )
- self._file_seed_cache_control = ClientGUIFileSeedCache.FileSeedCacheStatusControl( imports_panel, HG.client_controller, self._page_key )
+ self._file_seed_cache_control = ClientGUIFileSeedCache.FileSeedCacheStatusControl( imports_panel, CG.client_controller, self._page_key )
self._file_download_control = ClientGUINetworkJobControl.NetworkJobControl( imports_panel )
#
@@ -1700,7 +1701,7 @@ def __init__( self, parent, page_key, name = 'watcher' ):
self._check_now_button = QW.QPushButton( 'check now', checker_panel )
self._check_now_button.clicked.connect( self.EventCheckNow )
- self._gallery_seed_log_control = ClientGUIGallerySeedLog.GallerySeedLogStatusControl( checker_panel, HG.client_controller, True, False, 'check', page_key = self._page_key )
+ self._gallery_seed_log_control = ClientGUIGallerySeedLog.GallerySeedLogStatusControl( checker_panel, CG.client_controller, True, False, 'check', page_key = self._page_key )
checker_options = ClientImportOptions.CheckerOptions()
@@ -1776,7 +1777,7 @@ def __init__( self, parent, page_key, name = 'watcher' ):
self._UpdateControlsForNewWatcher()
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
def _SetCheckerOptions( self, checker_options ):
@@ -2007,7 +2008,7 @@ def SetWatcher( self, watcher ):
def TIMERUIUpdate( self ):
- if HG.client_controller.gui.IShouldRegularlyUpdate( self ):
+ if CG.client_controller.gui.IShouldRegularlyUpdate( self ):
self._UpdateStatus()
diff --git a/hydrus/client/gui/importing/ClientGUIImportFolders.py b/hydrus/client/gui/importing/ClientGUIImportFolders.py
index ffdbbee11..526efc91f 100644
--- a/hydrus/client/gui/importing/ClientGUIImportFolders.py
+++ b/hydrus/client/gui/importing/ClientGUIImportFolders.py
@@ -3,12 +3,11 @@
from qtpy import QtWidgets as QW
from hydrus.core import HydrusConstants as HC
-from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIDialogsQuick
from hydrus.client.gui import ClientGUIFileSeedCache
@@ -206,7 +205,7 @@ def __init__( self, parent, import_folder: ClientImportLocal.ImportFolder ):
self._publish_files_to_popup_button = QW.QCheckBox( self._folder_box )
self._publish_files_to_page = QW.QCheckBox( self._folder_box )
- self._file_seed_cache_button = ClientGUIFileSeedCache.FileSeedCacheButton( self._folder_box, HG.client_controller, self._import_folder.GetFileSeedCache, file_seed_cache_set_callable = self._import_folder.SetFileSeedCache )
+ self._file_seed_cache_button = ClientGUIFileSeedCache.FileSeedCacheButton( self._folder_box, CG.client_controller, self._import_folder.GetFileSeedCache, file_seed_cache_set_callable = self._import_folder.SetFileSeedCache )
#
@@ -268,7 +267,7 @@ def create_choice():
self._metadata_routers_button = ClientGUIMetadataMigration.SingleFileMetadataRoutersButton( self, metadata_routers, allowed_importer_classes, allowed_exporter_classes )
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
#
@@ -311,7 +310,7 @@ def create_choice():
self._location_failed.SetPath( action_locations[ CC.STATUS_ERROR ] )
- good_tag_service_keys_to_filename_tagging_options = { service_key : filename_tagging_options for ( service_key, filename_tagging_options ) in list(tag_service_keys_to_filename_tagging_options.items()) if HG.client_controller.services_manager.ServiceExists( service_key ) }
+ good_tag_service_keys_to_filename_tagging_options = { service_key : filename_tagging_options for ( service_key, filename_tagging_options ) in list(tag_service_keys_to_filename_tagging_options.items()) if CG.client_controller.services_manager.ServiceExists( service_key ) }
self._filename_tagging_options.AddDatas( list(good_tag_service_keys_to_filename_tagging_options.items()) )
@@ -476,7 +475,7 @@ def _CheckValid( self ):
ClientGUIDialogsMessage.ShowWarning( self, f'The path you have entered--"{path}"--does not exist! The dialog will not force you to correct it, but this import folder will do no work as long as the location is missing!' )
- if HC.BASE_DIR.startswith( path ) or HG.client_controller.GetDBDir().startswith( path ):
+ if HC.BASE_DIR.startswith( path ) or CG.client_controller.GetDBDir().startswith( path ):
raise HydrusExceptions.VetoException( 'You cannot set an import path that includes your install or database directory!' )
@@ -546,7 +545,7 @@ def _ConvertFilenameTaggingOptionsToListCtrlTuples( self, data ):
( service_key, filename_tagging_options ) = data
- name = HG.client_controller.services_manager.GetName( service_key )
+ name = CG.client_controller.services_manager.GetName( service_key )
display_tuple = ( name, )
sort_tuple = ( name, )
diff --git a/hydrus/client/gui/importing/ClientGUIImportOptions.py b/hydrus/client/gui/importing/ClientGUIImportOptions.py
index 747ecb720..a21c51e9f 100644
--- a/hydrus/client/gui/importing/ClientGUIImportOptions.py
+++ b/hydrus/client/gui/importing/ClientGUIImportOptions.py
@@ -10,6 +10,7 @@
from hydrus.core import HydrusSerialisable
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogs
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIDialogsQuick
@@ -48,7 +49,7 @@ def __init__( self, parent: QW.QWidget, file_import_options: FileImportOptions.F
if file_import_options.IsDefault():
- file_import_options = HG.client_controller.new_options.GetDefaultFileImportOptions( FileImportOptions.IMPORT_TYPE_LOUD ).Duplicate()
+ file_import_options = CG.client_controller.new_options.GetDefaultFileImportOptions( FileImportOptions.IMPORT_TYPE_LOUD ).Duplicate()
file_import_options.SetIsDefault( True )
@@ -174,7 +175,7 @@ def __init__( self, parent: QW.QWidget, file_import_options: FileImportOptions.F
destination_location_context = file_import_options.GetDestinationLocationContext()
- destination_location_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ destination_location_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
self._destination_location_context = ClientGUILocation.LocationSearchContextButton( destination_panel, destination_location_context )
@@ -227,7 +228,7 @@ def __init__( self, parent: QW.QWidget, file_import_options: FileImportOptions.F
rows.append( ( 'exclude previously deleted files: ', self._exclude_deleted ) )
- if show_downloader_options and HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if show_downloader_options and CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
rows.append( ( 'check hashes to determine "already in db/previously deleted"?: ', self._preimport_hash_check_type ) )
rows.append( ( 'check URLs to determine "already in db/previously deleted"?: ', self._preimport_url_check_type ) )
@@ -263,7 +264,7 @@ def __init__( self, parent: QW.QWidget, file_import_options: FileImportOptions.F
rows.append( ( 'archive all imports: ', self._auto_archive ) )
- if show_downloader_options and HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if show_downloader_options and CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
rows.append( ( 'associate primary urls: ', self._associate_primary_urls ) )
rows.append( ( 'associate (and trust) additional source urls: ', self._associate_source_urls ) )
@@ -321,8 +322,8 @@ def __init__( self, parent: QW.QWidget, file_import_options: FileImportOptions.F
def _LoadDefaultOptions( self ):
- loud_file_import_options = HG.client_controller.new_options.GetDefaultFileImportOptions( FileImportOptions.IMPORT_TYPE_LOUD )
- quiet_file_import_options = HG.client_controller.new_options.GetDefaultFileImportOptions( FileImportOptions.IMPORT_TYPE_QUIET )
+ loud_file_import_options = CG.client_controller.new_options.GetDefaultFileImportOptions( FileImportOptions.IMPORT_TYPE_LOUD )
+ quiet_file_import_options = CG.client_controller.new_options.GetDefaultFileImportOptions( FileImportOptions.IMPORT_TYPE_QUIET )
choice_tuples = []
@@ -383,7 +384,7 @@ def _SetValue( self, file_import_options: FileImportOptions.FileImportOptions ):
destination_location_context = file_import_options.GetDestinationLocationContext()
- destination_location_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ destination_location_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
self._destination_location_context.SetValue( destination_location_context )
@@ -741,7 +742,7 @@ def _EditWhitelistItem( self, whitelist_name ):
def _LoadDefaultOptions( self ):
- domain_manager = HG.client_controller.network_engine.domain_manager
+ domain_manager = CG.client_controller.network_engine.domain_manager
( file_post_default_note_import_options, watchable_default_note_import_options, url_class_keys_to_default_note_import_options ) = domain_manager.GetDefaultNoteImportOptions()
@@ -1030,7 +1031,7 @@ def __init__( self, parent: QW.QWidget, service_key: bytes, service_tag_import_o
self._service_key = service_key
self._show_downloader_options = show_downloader_options
- name = HG.client_controller.services_manager.GetName( self._service_key )
+ name = CG.client_controller.services_manager.GetName( self._service_key )
main_box = ClientGUICommon.StaticBox( self, name )
@@ -1050,7 +1051,7 @@ def __init__( self, parent: QW.QWidget, service_key: bytes, service_tag_import_o
self._get_tags_checkbox = QW.QCheckBox( 'get tags', downloader_options_panel )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
message = None
@@ -1127,7 +1128,7 @@ def _EditOnlyAddExistingTagsFilter( self ):
with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit already-exist filter' ) as dlg:
- namespaces = HG.client_controller.network_engine.domain_manager.GetParserNamespaces()
+ namespaces = CG.client_controller.network_engine.domain_manager.GetParserNamespaces()
message = 'If you do not want the \'only add tags that already exist\' option to apply to all tags coming in, set a filter here for the tags you _want_ to be exposed to this test.'
message += os.linesep * 2
@@ -1335,7 +1336,7 @@ def __init__( self, parent: QW.QWidget, tag_import_options: TagImportOptions.Tag
#
- if not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
st = ClientGUICommon.BetterStaticText( default_panel, label = 'Most of the time, you want to rely on the default tag import options!' )
@@ -1419,7 +1420,7 @@ def _EditWhitelist( self ):
def _InitialiseServices( self, tag_import_options ):
- services = HG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
+ services = CG.client_controller.services_manager.GetServices( HC.REAL_TAG_SERVICES )
for service in services:
@@ -1439,7 +1440,7 @@ def _InitialiseServices( self, tag_import_options ):
def _LoadDefaultOptions( self ):
- domain_manager = HG.client_controller.network_engine.domain_manager
+ domain_manager = CG.client_controller.network_engine.domain_manager
( file_post_default_tag_import_options, watchable_default_tag_import_options, url_class_keys_to_default_tag_import_options ) = domain_manager.GetDefaultTagImportOptions()
@@ -1798,21 +1799,21 @@ def _CopyFileImportOptions( self ):
json_string = self._file_import_options.DumpToString()
- HG.client_controller.pub( 'clipboard', 'text', json_string )
+ CG.client_controller.pub( 'clipboard', 'text', json_string )
def _CopyNoteImportOptions( self ):
json_string = self._note_import_options.DumpToString()
- HG.client_controller.pub( 'clipboard', 'text', json_string )
+ CG.client_controller.pub( 'clipboard', 'text', json_string )
def _CopyTagImportOptions( self ):
json_string = self._tag_import_options.DumpToString()
- HG.client_controller.pub( 'clipboard', 'text', json_string )
+ CG.client_controller.pub( 'clipboard', 'text', json_string )
def _EditOptions( self ):
@@ -1862,7 +1863,7 @@ def _PasteFileImportOptions( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -1903,7 +1904,7 @@ def _PasteNoteImportOptions( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -1944,7 +1945,7 @@ def _PasteTagImportOptions( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
diff --git a/hydrus/client/gui/lists/ClientGUIListBoxes.py b/hydrus/client/gui/lists/ClientGUIListBoxes.py
index 0672510e5..37852219b 100644
--- a/hydrus/client/gui/lists/ClientGUIListBoxes.py
+++ b/hydrus/client/gui/lists/ClientGUIListBoxes.py
@@ -17,6 +17,7 @@
from hydrus.core import HydrusTags
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientSerialisable
from hydrus.client.gui import ClientGUIAsync
@@ -419,7 +420,7 @@ def _ExportToClipboard( self ):
json = export_object.DumpToString()
- HG.client_controller.pub( 'clipboard', 'text', json )
+ CG.client_controller.pub( 'clipboard', 'text', json )
@@ -500,7 +501,7 @@ def _ImportFromClipboard( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -1193,7 +1194,7 @@ def _CopySelectedTexts( self ):
text = '\n'.join( texts )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -1752,7 +1753,7 @@ def _Redraw( self, painter ):
return
- fades_can_ever_happen = QtInit.WE_ARE_QT6 and HG.client_controller.new_options.GetBoolean( 'fade_sibling_connector' )
+ fades_can_ever_happen = QtInit.WE_ARE_QT6 and CG.client_controller.new_options.GetBoolean( 'fade_sibling_connector' )
current_visible_index = first_visible_positional_index
@@ -2226,6 +2227,11 @@ def GetIdealHeight( self ):
return text_height * self._total_positional_rows + 20
+ def GetNumTerms( self ):
+
+ return len( self._ordered_terms )
+
+
def HasValues( self ):
return len( self._ordered_terms ) > 0
@@ -2370,29 +2376,29 @@ def __init__( self, parent, *args, tag_display_type: int = ClientTags.TAG_DISPLA
if terms_may_have_sibling_or_parent_info:
- self._show_parent_decorators = HG.client_controller.new_options.GetBoolean( 'show_parent_decorators_on_storage_taglists' )
- self._show_sibling_decorators = HG.client_controller.new_options.GetBoolean( 'show_sibling_decorators_on_storage_taglists' )
+ self._show_parent_decorators = CG.client_controller.new_options.GetBoolean( 'show_parent_decorators_on_storage_taglists' )
+ self._show_sibling_decorators = CG.client_controller.new_options.GetBoolean( 'show_sibling_decorators_on_storage_taglists' )
- self._extra_parent_rows_allowed = HG.client_controller.new_options.GetBoolean( 'expand_parents_on_storage_taglists' )
+ self._extra_parent_rows_allowed = CG.client_controller.new_options.GetBoolean( 'expand_parents_on_storage_taglists' )
self._render_for_user = not self._tag_display_type == ClientTags.TAG_DISPLAY_STORAGE
self._page_key = None # placeholder. if a subclass sets this, it changes menu behaviour to allow 'select this tag' menu pubsubs
- self._sibling_connector_string = HG.client_controller.new_options.GetString( 'sibling_connector' )
+ self._sibling_connector_string = CG.client_controller.new_options.GetString( 'sibling_connector' )
self._sibling_connector_namespace = None
- if not HG.client_controller.new_options.GetBoolean( 'fade_sibling_connector' ):
+ if not CG.client_controller.new_options.GetBoolean( 'fade_sibling_connector' ):
- self._sibling_connector_namespace = HG.client_controller.new_options.GetNoneableString( 'sibling_connector_custom_namespace_colour' )
+ self._sibling_connector_namespace = CG.client_controller.new_options.GetNoneableString( 'sibling_connector_custom_namespace_colour' )
self._UpdateBackgroundColour()
- HG.client_controller.sub( self, 'ForceTagRecalc', 'refresh_all_tag_presentation_gui' )
- HG.client_controller.sub( self, '_UpdateBackgroundColour', 'notify_new_colourset' )
- HG.client_controller.sub( self, 'NotifyNewOptions', 'notify_new_options' )
+ CG.client_controller.sub( self, 'ForceTagRecalc', 'refresh_all_tag_presentation_gui' )
+ CG.client_controller.sub( self, '_UpdateBackgroundColour', 'notify_new_colourset' )
+ CG.client_controller.sub( self, 'NotifyNewOptions', 'notify_new_options' )
def _GetCopyableTagStrings( self, command ):
@@ -2495,7 +2501,7 @@ def _HasCounts( self ):
def _NewDuplicateFilterPage( self, predicates ):
- activate_window = HG.client_controller.new_options.GetBoolean( 'activate_window_on_tag_search_page_activation' )
+ activate_window = CG.client_controller.new_options.GetBoolean( 'activate_window_on_tag_search_page_activation' )
predicates = ClientGUISearch.FleshOutPredicates( self, predicates )
@@ -2510,12 +2516,12 @@ def _NewDuplicateFilterPage( self, predicates ):
location_context = self._GetCurrentLocationContext()
- HG.client_controller.pub( 'new_page_duplicates', location_context, initial_predicates = predicates, page_name = page_name, activate_window = activate_window )
+ CG.client_controller.pub( 'new_page_duplicates', location_context, initial_predicates = predicates, page_name = page_name, activate_window = activate_window )
def _NewSearchPages( self, pages_of_predicates ):
- activate_window = HG.client_controller.new_options.GetBoolean( 'activate_window_on_tag_search_page_activation' )
+ activate_window = CG.client_controller.new_options.GetBoolean( 'activate_window_on_tag_search_page_activation' )
for predicates in pages_of_predicates:
@@ -2532,7 +2538,7 @@ def _NewSearchPages( self, pages_of_predicates ):
location_context = self._GetCurrentLocationContext()
- HG.client_controller.pub( 'new_page_query', location_context, initial_predicates = predicates, page_name = page_name, activate_window = activate_window )
+ CG.client_controller.pub( 'new_page_query', location_context, initial_predicates = predicates, page_name = page_name, activate_window = activate_window )
activate_window = False
@@ -2546,7 +2552,7 @@ def _ProcessMenuCopyEvent( self, command ):
text = os.linesep.join( texts )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -2576,7 +2582,7 @@ def _ProcessMenuTagEvent( self, command ):
return
- HG.client_controller.tag_display_manager.HideTags( self._tag_display_type, CC.COMBINED_TAG_SERVICE_KEY, tags )
+ CG.client_controller.tag_display_manager.HideTags( self._tag_display_type, CC.COMBINED_TAG_SERVICE_KEY, tags )
elif command == 'hide_namespace':
@@ -2596,10 +2602,10 @@ def _ProcessMenuTagEvent( self, command ):
tag_slices = [ namespace if namespace == '' else namespace + ':' for namespace in namespaces ]
- HG.client_controller.tag_display_manager.HideTags( self._tag_display_type, CC.COMBINED_TAG_SERVICE_KEY, tag_slices )
+ CG.client_controller.tag_display_manager.HideTags( self._tag_display_type, CC.COMBINED_TAG_SERVICE_KEY, tag_slices )
- HG.client_controller.pub( 'notify_new_tag_display_rules' )
+ CG.client_controller.pub( 'notify_new_tag_display_rules' )
else:
@@ -2648,7 +2654,7 @@ def _SelectionChanged( self ):
def _UpdateBackgroundColour( self ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
self._background_colour = new_options.GetColour( CC.COLOUR_TAGS_BOX )
@@ -2728,12 +2734,12 @@ def eventFilter( self, watched, event ):
def NotifyNewOptions( self ):
- new_sibling_connector_string = HG.client_controller.new_options.GetString( 'sibling_connector' )
+ new_sibling_connector_string = CG.client_controller.new_options.GetString( 'sibling_connector' )
new_sibling_connector_namespace = None
- if not HG.client_controller.new_options.GetBoolean( 'fade_sibling_connector' ):
+ if not CG.client_controller.new_options.GetBoolean( 'fade_sibling_connector' ):
- new_sibling_connector_namespace = HG.client_controller.new_options.GetNoneableString( 'sibling_connector_custom_namespace_colour' )
+ new_sibling_connector_namespace = CG.client_controller.new_options.GetNoneableString( 'sibling_connector_custom_namespace_colour' )
if new_sibling_connector_string != self._sibling_connector_string or new_sibling_connector_namespace != self._sibling_connector_namespace:
@@ -2895,7 +2901,7 @@ def ShowMenu( self ):
def sp_work_callable():
- selected_tag_to_service_keys_to_siblings_and_parents = HG.client_controller.Read( 'tag_siblings_and_parents_lookup', ( selected_tag, ) )
+ selected_tag_to_service_keys_to_siblings_and_parents = CG.client_controller.Read( 'tag_siblings_and_parents_lookup', ( selected_tag, ) )
service_keys_to_siblings_and_parents = selected_tag_to_service_keys_to_siblings_and_parents[ selected_tag ]
@@ -2904,7 +2910,7 @@ def sp_work_callable():
def sp_publish_callable( service_keys_to_siblings_and_parents ):
- service_keys_in_order = HG.client_controller.services_manager.GetServiceKeys( HC.REAL_TAG_SERVICES )
+ service_keys_in_order = CG.client_controller.services_manager.GetServiceKeys( HC.REAL_TAG_SERVICES )
all_siblings = set()
@@ -2952,7 +2958,7 @@ def sp_publish_callable( service_keys_to_siblings_and_parents ):
num_parents = len( parents_to_service_keys )
num_children = len( children_to_service_keys )
- service_keys_to_service_names = { service_key : HG.client_controller.services_manager.GetName( service_key ) for service_key in service_keys_in_order }
+ service_keys_to_service_names = { service_key : CG.client_controller.services_manager.GetName( service_key ) for service_key in service_keys_in_order }
ALL_SERVICES_LABEL = 'all services'
@@ -3047,7 +3053,7 @@ def group_and_sort_parents_to_service_keys( p_to_s_ks, c_to_s_ks ):
ideal_label = 'ideal is "{}" on: {}'.format( ideal, convert_service_keys_to_name_string( ideals_to_service_keys[ ideal ] ) )
- ClientGUIMenus.AppendMenuItem( siblings_menu, ideal_label, ideal_label, HG.client_controller.pub, 'clipboard', 'text', ideal )
+ ClientGUIMenus.AppendMenuItem( siblings_menu, ideal_label, ideal_label, CG.client_controller.pub, 'clipboard', 'text', ideal )
#
@@ -3330,13 +3336,13 @@ def add_favourite_tags( tags ):
- favourite_tags = set( HG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
+ favourite_tags = set( CG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
favourite_tags.update( tags )
- HG.client_controller.new_options.SetStringList( 'favourite_tags', list( favourite_tags ) )
+ CG.client_controller.new_options.SetStringList( 'favourite_tags', list( favourite_tags ) )
- HG.client_controller.pub( 'notify_new_favourite_tags' )
+ CG.client_controller.pub( 'notify_new_favourite_tags' )
def remove_favourite_tags( tags ):
@@ -3352,16 +3358,16 @@ def remove_favourite_tags( tags ):
return
- favourite_tags = set( HG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
+ favourite_tags = set( CG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
favourite_tags.difference_update( tags )
- HG.client_controller.new_options.SetStringList( 'favourite_tags', list( favourite_tags ) )
+ CG.client_controller.new_options.SetStringList( 'favourite_tags', list( favourite_tags ) )
- HG.client_controller.pub( 'notify_new_favourite_tags' )
+ CG.client_controller.pub( 'notify_new_favourite_tags' )
- favourite_tags = list( HG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
+ favourite_tags = list( CG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
to_add = set( selected_actual_tags ).difference( favourite_tags )
to_remove = set( selected_actual_tags ).intersection( favourite_tags )
@@ -3754,7 +3760,7 @@ def work_callable( args ):
tags_to_lookup = set( tags_to_terms.keys() )
- db_tags_to_ideals_and_parents = HG.client_controller.Read( 'tag_display_decorators', service_key, tags_to_lookup )
+ db_tags_to_ideals_and_parents = CG.client_controller.Read( 'tag_display_decorators', service_key, tags_to_lookup )
terms_to_info.update( { tags_to_terms[ tag ] : info for ( tag, info ) in db_tags_to_ideals_and_parents.items() } )
@@ -3771,7 +3777,7 @@ def _SelectFilesWithTags( self, and_or_or ):
selected_actual_tags = self._GetTagsFromTerms( self._selected_terms )
- HG.client_controller.pub( 'select_files_with_tags', self._page_key, self._service_key, and_or_or, set( selected_actual_tags ) )
+ CG.client_controller.pub( 'select_files_with_tags', self._page_key, self._service_key, and_or_or, set( selected_actual_tags ) )
@@ -3972,7 +3978,7 @@ def __init__( self, parent, tag_display_type, service_key = None, include_counts
ListBoxTagsDisplayCapable.__init__( self, parent, service_key = service_key, tag_display_type = tag_display_type, height_num_chars = 24 )
- self._tag_sort = HG.client_controller.new_options.GetDefaultTagSort()
+ self._tag_sort = CG.client_controller.new_options.GetDefaultTagSort()
self._last_media_results = set()
@@ -4175,7 +4181,7 @@ def AddAdditionalMenuItems( self, menu: QW.QMenu ):
ListBoxTagsDisplayCapable.AddAdditionalMenuItems( self, menu )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
submenu = ClientGUIMenus.GenerateMenu( menu )
@@ -4397,7 +4403,7 @@ def __init__( self, parent, title, show_siblings_sort = False ):
self._tags_box = None
# make this its own panel
- self._tag_sort = ClientGUITagSorting.TagSortControl( self, HG.client_controller.new_options.GetDefaultTagSort(), show_siblings = show_siblings_sort )
+ self._tag_sort = ClientGUITagSorting.TagSortControl( self, CG.client_controller.new_options.GetDefaultTagSort(), show_siblings = show_siblings_sort )
self._tag_sort.valueChanged.connect( self.EventSort )
@@ -4417,7 +4423,7 @@ def SetTagServiceKey( self, service_key ):
if service_key != CC.COMBINED_TAG_SERVICE_KEY:
- title = '{} for {}'.format( title, HG.client_controller.services_manager.GetName( service_key ) )
+ title = '{} for {}'.format( title, CG.client_controller.services_manager.GetName( service_key ) )
self.SetTitle( title )
@@ -4463,7 +4469,7 @@ def __init__( self, parent, canvas_key ):
def _Activate( self, ctrl_down, shift_down ) -> bool:
- HG.client_controller.pub( 'canvas_manage_tags', self._canvas_key )
+ CG.client_controller.pub( 'canvas_manage_tags', self._canvas_key )
return True
diff --git a/hydrus/client/gui/lists/ClientGUIListCtrl.py b/hydrus/client/gui/lists/ClientGUIListCtrl.py
index f760b25e6..f27a5577f 100644
--- a/hydrus/client/gui/lists/ClientGUIListCtrl.py
+++ b/hydrus/client/gui/lists/ClientGUIListCtrl.py
@@ -60,6 +60,8 @@ def __init__( self, parent, column_list_type, height_num_chars, data_to_tuples_f
self._initial_height_num_chars = height_num_chars
self._forced_height_num_chars = None
+ self._has_initialised_size = False
+
self._data_to_tuples_func = data_to_tuples_func
self._use_simple_delete = use_simple_delete
@@ -107,6 +109,7 @@ def __init__( self, parent, column_list_type, height_num_chars, data_to_tuples_f
self.setMinimumWidth( total_width )
'''
+
main_tlw = CG.client_controller.GetMainTLW()
# if last section is set too low, for instance 3, the column seems unable to ever shrink from initial (expanded to fill space) size
@@ -118,7 +121,6 @@ def __init__( self, parent, column_list_type, height_num_chars, data_to_tuples_f
# I think this is because of mismatch between set size and min size! So ensuring we never set smaller than that initially should fix this???!?
MIN_SECTION_SIZE_CHARS = 3
- MIN_LAST_SECTION_SIZE_CHARS = 10
self._min_section_width = ClientGUIFunctions.ConvertTextToPixelWidth( main_tlw, MIN_SECTION_SIZE_CHARS )
@@ -126,6 +128,8 @@ def __init__( self, parent, column_list_type, height_num_chars, data_to_tuples_f
last_column_index = self._column_list_status.GetColumnCount() - 1
+ self.header().setStretchLastSection( True )
+
for ( i, column_type ) in enumerate( self._column_list_status.GetColumnTypes() ):
self.headerItem().setData( i, QC.Qt.UserRole, column_type )
@@ -161,8 +165,6 @@ def __init__( self, parent, column_list_type, height_num_chars, data_to_tuples_f
self.setColumnWidth( i, width_pixels )
- self.header().setStretchLastSection( True )
-
self._delete_key_callback = delete_key_callback
self._activation_callback = activation_callback
@@ -181,10 +183,44 @@ def __init__( self, parent, column_list_type, height_num_chars, data_to_tuples_f
self.header().setContextMenuPolicy( QC.Qt.CustomContextMenu )
self.header().customContextMenuRequested.connect( self._ShowHeaderMenu )
+ CG.client_controller.CallAfterQtSafe( self, 'initialising multi-column list widths', self._InitialiseColumnWidths )
+
CG.client_controller.sub( self, 'NotifySettingsUpdated', 'reset_all_listctrl_status' )
CG.client_controller.sub( self, 'NotifySettingsUpdated', 'reset_listctrl_status' )
+ def _InitialiseColumnWidths( self ):
+
+ MIN_SECTION_SIZE_CHARS = 3
+
+ main_tlw = CG.client_controller.GetMainTLW()
+
+ last_column_index = self._column_list_status.GetColumnCount() - 1
+
+ for ( i, column_type ) in enumerate( self._column_list_status.GetColumnTypes() ):
+
+ if i == last_column_index:
+
+ width_chars = MIN_SECTION_SIZE_CHARS
+
+ else:
+
+ width_chars = self._column_list_status.GetColumnWidth( column_type )
+
+
+ width_chars = max( width_chars, MIN_SECTION_SIZE_CHARS )
+
+ # ok this is a pain in the neck issue, but fontmetrics changes afte widget init. I guess font gets styled on top afterwards
+ # this means that if I use this window's fontmetrics here, in init, then it is different later on, and we get creeping growing columns lmao
+ # several other places in the client are likely affected in different ways by this also!
+ width_pixels = ClientGUIFunctions.ConvertTextToPixelWidth( main_tlw, width_chars )
+
+ self.setColumnWidth( i, width_pixels )
+
+
+ self._has_initialised_size = True
+
+
def _AddDataInfo( self, data_info ):
( data, display_tuple, sort_tuple ) = data_info
@@ -219,9 +255,12 @@ def _AddDataInfo( self, data_info ):
def _SectionsResized( self, logical_index, old_size, new_size ):
- self._DoStatusChanged()
-
- self.updateGeometry()
+ if self._has_initialised_size:
+
+ self._DoStatusChanged()
+
+ self.updateGeometry()
+
def _DoStatusChanged( self ):
@@ -895,9 +934,15 @@ def minimumSizeHint( self ):
def resizeEvent( self, event ):
- self._DoStatusChanged()
+ result = QW.QTreeWidget.resizeEvent( self, event )
+
+ # do not touch this! weird hack that fixed a new bug in 6.6.1 where all columns would reset on load to 100px wide!
+ if self._has_initialised_size:
+
+ self._DoStatusChanged()
+
- return QW.QTreeWidget.resizeEvent( self, event )
+ return result
def sizeHint( self ):
diff --git a/hydrus/client/gui/lists/ClientGUIListManager.py b/hydrus/client/gui/lists/ClientGUIListManager.py
index 513cba86b..25405e764 100644
--- a/hydrus/client/gui/lists/ClientGUIListManager.py
+++ b/hydrus/client/gui/lists/ClientGUIListManager.py
@@ -1,7 +1,6 @@
from hydrus.core import HydrusSerialisable
-from hydrus.core import HydrusGlobals as HG
-
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui.lists import ClientGUIListStatus
class ColumnListManager( HydrusSerialisable.SerialisableBase ):
@@ -58,7 +57,7 @@ def ResetToDefaults( self, column_list_type = None ):
self._column_list_types_to_statuses = HydrusSerialisable.SerialisableDictionary()
- HG.client_controller.pub( 'reset_all_listctrl_status' )
+ CG.client_controller.pub( 'reset_all_listctrl_status' )
else:
@@ -66,7 +65,7 @@ def ResetToDefaults( self, column_list_type = None ):
del self._column_list_types_to_statuses[ column_list_type ]
- HG.client_controller.pub( 'reset_listctrl_status', column_list_type )
+ CG.client_controller.pub( 'reset_listctrl_status', column_list_type )
@@ -85,4 +84,5 @@ def SetClean( self ):
self._dirty = False
+
HydrusSerialisable.SERIALISABLE_TYPES_TO_OBJECT_TYPES[ HydrusSerialisable.SERIALISABLE_TYPE_COLUMN_LIST_MANAGER ] = ColumnListManager
diff --git a/hydrus/client/gui/metadata/ClientGUIMetadataMigration.py b/hydrus/client/gui/metadata/ClientGUIMetadataMigration.py
index 62c9cdeea..2031fbf24 100644
--- a/hydrus/client/gui/metadata/ClientGUIMetadataMigration.py
+++ b/hydrus/client/gui/metadata/ClientGUIMetadataMigration.py
@@ -3,14 +3,12 @@
from qtpy import QtCore as QC
from qtpy import QtWidgets as QW
-from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusText
-from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import ClientGUIScrolledPanels
@@ -148,9 +146,9 @@ def _AddRouter( self ):
if isinstance( exporter, ClientMetadataMigrationExporters.SingleFileMetadataExporterMediaTags ):
- if not HG.client_controller.services_manager.ServiceExists( exporter.GetServiceKey() ):
+ if not CG.client_controller.services_manager.ServiceExists( exporter.GetServiceKey() ):
- exporter.SetServiceKey( HG.client_controller.services_manager.GetDefaultLocalTagService().GetServiceKey() )
+ exporter.SetServiceKey( CG.client_controller.services_manager.GetDefaultLocalTagService().GetServiceKey() )
diff --git a/hydrus/client/gui/metadata/ClientGUIMetadataMigrationExporters.py b/hydrus/client/gui/metadata/ClientGUIMetadataMigrationExporters.py
index c17c24fdc..2d2d90f64 100644
--- a/hydrus/client/gui/metadata/ClientGUIMetadataMigrationExporters.py
+++ b/hydrus/client/gui/metadata/ClientGUIMetadataMigrationExporters.py
@@ -9,6 +9,7 @@
from hydrus.core import HydrusText
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client.gui import ClientGUIDialogs
from hydrus.client.gui import ClientGUIDialogsMessage
@@ -239,7 +240,7 @@ def _GetValue( self ) -> ClientMetadataMigrationExporters.SingleFileMetadataExpo
try:
- HG.client_controller.services_manager.GetName( self._service_key )
+ CG.client_controller.services_manager.GetName( self._service_key )
except HydrusExceptions.DataMissing:
@@ -339,7 +340,7 @@ def _SetValue( self, exporter: ClientMetadataMigrationExporters.SingleFileMetada
self._service_selection_panel.setVisible( True )
- if not HG.client_controller.services_manager.ServiceExists( self._service_key ):
+ if not CG.client_controller.services_manager.ServiceExists( self._service_key ):
message = 'Hey, the tag service for your exporter does not seem to exist! Maybe it was deleted. Please select a new one that does.'
@@ -399,7 +400,7 @@ def _UpdateServiceKeyButtonLabel( self ):
try:
- name = HG.client_controller.services_manager.GetName( self._service_key )
+ name = CG.client_controller.services_manager.GetName( self._service_key )
except HydrusExceptions.DataMissing:
diff --git a/hydrus/client/gui/metadata/ClientGUIMetadataMigrationImporters.py b/hydrus/client/gui/metadata/ClientGUIMetadataMigrationImporters.py
index f35d28fb1..f83a9ba31 100644
--- a/hydrus/client/gui/metadata/ClientGUIMetadataMigrationImporters.py
+++ b/hydrus/client/gui/metadata/ClientGUIMetadataMigrationImporters.py
@@ -8,9 +8,9 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientStrings
-
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIDialogsQuick
from hydrus.client.gui import ClientGUIScrolledPanels
@@ -403,7 +403,7 @@ def _UpdateServiceKeyButtonLabel( self ):
try:
- name = HG.client_controller.services_manager.GetName( self._service_key )
+ name = CG.client_controller.services_manager.GetName( self._service_key )
except HydrusExceptions.DataMissing:
diff --git a/hydrus/client/gui/networking/ClientGUIHydrusNetwork.py b/hydrus/client/gui/networking/ClientGUIHydrusNetwork.py
index 97fe4f158..c95d31fe7 100644
--- a/hydrus/client/gui/networking/ClientGUIHydrusNetwork.py
+++ b/hydrus/client/gui/networking/ClientGUIHydrusNetwork.py
@@ -13,6 +13,7 @@
from hydrus.core.networking import HydrusNetworking
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIAsync
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIDialogsQuick
@@ -412,7 +413,7 @@ def __init__( self, parent: QW.QWidget, service_key: bytes, accounts: typing.Col
ClientGUIScrolledPanels.ReviewPanel.__init__( self, parent )
self._service_key = service_key
- self._service = HG.client_controller.services_manager.GetService( self._service_key )
+ self._service = CG.client_controller.services_manager.GetService( self._service_key )
self._accounts = accounts
self._accounts_box = ClientGUICommon.StaticBox( self, 'accounts' )
@@ -494,7 +495,7 @@ def __init__( self, parent: QW.QWidget, service_key: bytes, account_identifiers:
QW.QWidget.__init__( self, parent )
self._service_key = service_key
- self._service = HG.client_controller.services_manager.GetService( self._service_key )
+ self._service = CG.client_controller.services_manager.GetService( self._service_key )
self._account_identifiers = account_identifiers
self._done_first_fetch = False
@@ -623,7 +624,7 @@ def _CopyCheckedAccountKeys( self ):
account_keys_text = os.linesep.join( ( account_key.hex() for account_key in checked_account_keys ) )
- HG.client_controller.pub( 'clipboard', 'text', account_keys_text )
+ CG.client_controller.pub( 'clipboard', 'text', account_keys_text )
@@ -874,7 +875,7 @@ def __init__( self, parent: QW.QWidget, service_key: bytes, subject_identifiers:
ClientGUIScrolledPanels.ReviewPanel.__init__( self, parent )
self._service_key = service_key
- self._service = HG.client_controller.services_manager.GetService( service_key )
+ self._service = CG.client_controller.services_manager.GetService( service_key )
self._subject_identifiers = subject_identifiers
self._account_types = []
diff --git a/hydrus/client/gui/networking/ClientGUINetwork.py b/hydrus/client/gui/networking/ClientGUINetwork.py
index 41971ae98..53a520777 100644
--- a/hydrus/client/gui/networking/ClientGUINetwork.py
+++ b/hydrus/client/gui/networking/ClientGUINetwork.py
@@ -15,6 +15,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDefaults
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDragDrop
from hydrus.client.gui import ClientGUICharts
from hydrus.client.gui import ClientGUIDialogsMessage
@@ -178,7 +179,7 @@ def __init__( self, parent: QW.QWidget, network_context: ClientNetworkingContext
self._context_data_services = ClientGUICommon.BetterChoice( self )
- for service in HG.client_controller.services_manager.GetServices( HC.REPOSITORIES ):
+ for service in CG.client_controller.services_manager.GetServices( HC.REPOSITORIES ):
self._context_data_services.addItem( service.GetName(), service.GetServiceKey() )
@@ -192,7 +193,7 @@ def __init__( self, parent: QW.QWidget, network_context: ClientNetworkingContext
self._context_data_none.setVisible( False )
- names = HG.client_controller.Read( 'serialisable_names', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_LEGACY )
+ names = CG.client_controller.Read( 'serialisable_names', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_LEGACY )
for name in names:
@@ -599,7 +600,7 @@ def __init__( self, parent, controller ):
self._bandwidths.Sort()
- self._update_job = HG.client_controller.CallRepeatingQtSafe( self, 0.5, 5.0, 'repeating all bandwidth status update', self._Update )
+ self._update_job = CG.client_controller.CallRepeatingQtSafe( self, 0.5, 5.0, 'repeating all bandwidth status update', self._Update )
#
@@ -958,9 +959,9 @@ def __init__( self, parent, controller, network_context ):
#
- self._rules_job = HG.client_controller.CallRepeatingQtSafe( self, 0.5, 5.0, 'repeating bandwidth rules update', self._UpdateRules )
+ self._rules_job = CG.client_controller.CallRepeatingQtSafe( self, 0.5, 5.0, 'repeating bandwidth rules update', self._UpdateRules )
- self._update_job = HG.client_controller.CallRepeatingQtSafe( self, 0.5, 1.0, 'repeating bandwidth status update', self._Update )
+ self._update_job = CG.client_controller.CallRepeatingQtSafe( self, 0.5, 1.0, 'repeating bandwidth status update', self._Update )
def _EditRules( self ):
diff --git a/hydrus/client/gui/networking/ClientGUINetworkJobControl.py b/hydrus/client/gui/networking/ClientGUINetworkJobControl.py
index 869a12e78..b0dbde3f8 100644
--- a/hydrus/client/gui/networking/ClientGUINetworkJobControl.py
+++ b/hydrus/client/gui/networking/ClientGUINetworkJobControl.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIFunctions
@@ -81,7 +82,7 @@ def _EditBandwidthRules( self, network_context: ClientNetworkingContexts.Network
with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit bandwidth rules for {}'.format( network_context.ToString() ) ) as dlg:
- bandwidth_rules = HG.client_controller.network_engine.bandwidth_manager.GetRules( network_context )
+ bandwidth_rules = CG.client_controller.network_engine.bandwidth_manager.GetRules( network_context )
summary = network_context.GetSummary()
@@ -93,7 +94,7 @@ def _EditBandwidthRules( self, network_context: ClientNetworkingContexts.Network
bandwidth_rules = panel.GetValue()
- HG.client_controller.network_engine.bandwidth_manager.SetRules( network_context, bandwidth_rules )
+ CG.client_controller.network_engine.bandwidth_manager.SetRules( network_context, bandwidth_rules )
@@ -332,7 +333,7 @@ def CopyError( self ):
return
- HG.client_controller.pub( 'clipboard', 'text', self._error_text )
+ CG.client_controller.pub( 'clipboard', 'text', self._error_text )
def ClearNetworkJob( self ):
@@ -345,7 +346,7 @@ def ClearNetworkJob( self ):
self._Update()
- HG.client_controller.gui.UnregisterUIUpdateWindow( self )
+ CG.client_controller.gui.UnregisterUIUpdateWindow( self )
@@ -369,7 +370,7 @@ def SetNetworkJob( self, network_job: ClientNetworkingJobs.NetworkJob ):
self._Update()
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
@@ -399,7 +400,7 @@ def TIMERUIUpdate( self ):
self._OverrideBandwidthIfAppropriate()
- if self._should_update_freely or HG.client_controller.gui.IShouldRegularlyUpdate( self ):
+ if self._should_update_freely or CG.client_controller.gui.IShouldRegularlyUpdate( self ):
self._Update()
diff --git a/hydrus/client/gui/pages/ClientGUIManagementController.py b/hydrus/client/gui/pages/ClientGUIManagementController.py
index 417d03fd7..66d4837d7 100644
--- a/hydrus/client/gui/pages/ClientGUIManagementController.py
+++ b/hydrus/client/gui/pages/ClientGUIManagementController.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client.importing import ClientImportGallery
from hydrus.client.importing import ClientImportLocal
@@ -31,7 +32,7 @@
def CreateManagementController( page_name, management_type ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
management_controller = ManagementController( page_name )
@@ -50,7 +51,7 @@ def CreateManagementControllerDuplicateFilter(
if location_context is None:
- location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
if initial_predicates is None:
@@ -67,7 +68,7 @@ def CreateManagementControllerDuplicateFilter(
file_search_context = ClientSearch.FileSearchContext( location_context = location_context, predicates = initial_predicates )
- synchronised = HG.client_controller.new_options.GetBoolean( 'default_search_synchronised' )
+ synchronised = CG.client_controller.new_options.GetBoolean( 'default_search_synchronised' )
management_controller.SetVariable( 'synchronised', synchronised )
@@ -87,7 +88,7 @@ def CreateManagementControllerImportGallery( page_name = None ):
page_name = 'gallery'
- gug_key_and_name = HG.client_controller.network_engine.domain_manager.GetDefaultGUGKeyAndName()
+ gug_key_and_name = CG.client_controller.network_engine.domain_manager.GetDefaultGUGKeyAndName()
multiple_gallery_import = ClientImportGallery.MultipleGalleryImport( gug_key_and_name = gug_key_and_name )
@@ -102,7 +103,7 @@ def CreateManagementControllerImportSimpleDownloader():
simple_downloader_import = ClientImportSimpleURLs.SimpleDownloaderImport()
- formula_name = HG.client_controller.new_options.GetString( 'favourite_simple_downloader_formula' )
+ formula_name = CG.client_controller.new_options.GetString( 'favourite_simple_downloader_formula' )
simple_downloader_import.SetFormulaName( formula_name )
@@ -158,7 +159,7 @@ def CreateManagementControllerImportURLs( page_name = None ):
def CreateManagementControllerPetitions( petition_service_key ):
- petition_service = HG.client_controller.services_manager.GetService( petition_service_key )
+ petition_service = CG.client_controller.services_manager.GetService( petition_service_key )
page_name = petition_service.GetName() + ' petitions'
@@ -180,7 +181,7 @@ def CreateManagementControllerQuery( page_name, file_search_context: ClientSearc
management_controller = CreateManagementController( page_name, MANAGEMENT_TYPE_QUERY )
- synchronised = HG.client_controller.new_options.GetBoolean( 'default_search_synchronised' )
+ synchronised = CG.client_controller.new_options.GetBoolean( 'default_search_synchronised' )
management_controller.SetVariable( 'file_search_context', file_search_context )
management_controller.SetVariable( 'search_enabled', search_enabled )
@@ -519,7 +520,7 @@ def _UpdateSerialisableInfo( self, version, old_serialisable_info ):
variables[ 'dupe_search_type' ] = value
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
file_search_context = ClientSearch.FileSearchContext( location_context = default_location_context, predicates = [ ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_SYSTEM_EVERYTHING ) ] )
@@ -644,7 +645,7 @@ def GetLocationContext( self ) -> ClientLocation.LocationContext:
try:
- petition_service = HG.client_controller.services_manager.GetService( petition_service_key )
+ petition_service = CG.client_controller.services_manager.GetService( petition_service_key )
petition_service_type = petition_service.GetServiceType()
diff --git a/hydrus/client/gui/pages/ClientGUIManagementPanels.py b/hydrus/client/gui/pages/ClientGUIManagementPanels.py
index b25997817..6cceb35c6 100644
--- a/hydrus/client/gui/pages/ClientGUIManagementPanels.py
+++ b/hydrus/client/gui/pages/ClientGUIManagementPanels.py
@@ -2,7 +2,6 @@
import os
import random
import threading
-import time
import typing
from qtpy import QtCore as QC
@@ -11,7 +10,6 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusLists
from hydrus.core import HydrusTags
from hydrus.core import HydrusTime
@@ -20,6 +18,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDefaults
from hydrus.client import ClientDuplicates
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientParsing
from hydrus.client import ClientPaths
@@ -153,7 +152,7 @@ def _Activate( self, ctrl_down, shift_down ) -> bool:
predicates = ( ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_OR_CONTAINER, value = predicates ), )
- HG.client_controller.pub( 'enter_predicates', self._page_key, predicates )
+ CG.client_controller.pub( 'enter_predicates', self._page_key, predicates )
return True
@@ -224,7 +223,7 @@ def _ProcessMenuPredicateEvent( self, command ):
if p is not None:
- HG.client_controller.pub( 'enter_predicates', self._page_key, p, permit_remove = permit_remove, permit_add = permit_add )
+ CG.client_controller.pub( 'enter_predicates', self._page_key, p, permit_remove = permit_remove, permit_add = permit_add )
@@ -532,8 +531,8 @@ def __init__( self, parent, page, controller, management_controller: ClientGUIMa
file_search_context_1 = management_controller.GetVariable( 'file_search_context_1' )
file_search_context_2 = management_controller.GetVariable( 'file_search_context_2' )
- file_search_context_1.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
- file_search_context_2.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ file_search_context_1.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
+ file_search_context_2.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
if self._management_controller.HasVariable( 'synchronised' ):
@@ -706,7 +705,7 @@ def __init__( self, parent, page, controller, management_controller: ClientGUIMa
def _EditMergeOptions( self, duplicate_type ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
duplicate_content_merge_options = new_options.GetDuplicateContentMergeOptions( duplicate_type )
@@ -820,7 +819,7 @@ def qt_code( potential_duplicates_count ):
def thread_do_it( file_search_context_1, file_search_context_2, dupe_search_type, pixel_dupes_preference, max_hamming_distance ):
- potential_duplicates_count = HG.client_controller.Read( 'potential_duplicates_count', file_search_context_1, file_search_context_2, dupe_search_type, pixel_dupes_preference, max_hamming_distance )
+ potential_duplicates_count = CG.client_controller.Read( 'potential_duplicates_count', file_search_context_1, file_search_context_2, dupe_search_type, pixel_dupes_preference, max_hamming_distance )
QP.CallAfter( qt_code, potential_duplicates_count )
@@ -835,7 +834,7 @@ def thread_do_it( file_search_context_1, file_search_context_2, dupe_search_type
( file_search_context_1, file_search_context_2, dupe_search_type, pixel_dupes_preference, max_hamming_distance ) = self._GetDuplicateFileSearchData()
- HG.client_controller.CallToThread( thread_do_it, file_search_context_1, file_search_context_2, dupe_search_type, pixel_dupes_preference, max_hamming_distance )
+ CG.client_controller.CallToThread( thread_do_it, file_search_context_1, file_search_context_2, dupe_search_type, pixel_dupes_preference, max_hamming_distance )
@@ -1535,13 +1534,13 @@ def _ConvertDataToListCtrlTuples( self, gallery_import ):
if files_finished:
- pretty_files_paused = HG.client_controller.new_options.GetString( 'stop_character' )
+ pretty_files_paused = CG.client_controller.new_options.GetString( 'stop_character' )
sort_files_paused = -1
elif files_paused:
- pretty_files_paused = HG.client_controller.new_options.GetString( 'pause_character' )
+ pretty_files_paused = CG.client_controller.new_options.GetString( 'pause_character' )
sort_files_paused = 0
@@ -1557,13 +1556,13 @@ def _ConvertDataToListCtrlTuples( self, gallery_import ):
if gallery_finished:
- pretty_gallery_paused = HG.client_controller.new_options.GetString( 'stop_character' )
+ pretty_gallery_paused = CG.client_controller.new_options.GetString( 'stop_character' )
sort_gallery_paused = -1
elif gallery_paused:
- pretty_gallery_paused = HG.client_controller.new_options.GetString( 'pause_character' )
+ pretty_gallery_paused = CG.client_controller.new_options.GetString( 'pause_character' )
sort_gallery_paused = 0
@@ -1604,7 +1603,7 @@ def _CopySelectedQueries( self ):
text = os.linesep.join( ( gallery_importer.GetQueryText() for gallery_importer in gallery_importers ) )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -1741,7 +1740,7 @@ def work_callable():
if not have_published_job_status and HydrusTime.TimeHasPassedFloat( start_time + 3 ):
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
have_published_job_status = True
@@ -1751,7 +1750,7 @@ def work_callable():
return all_media_results
- block_of_media_results = HG.client_controller.Read( 'media_results', block_of_hashes, sorted = True )
+ block_of_media_results = CG.client_controller.Read( 'media_results', block_of_hashes, sorted = True )
all_media_results.extend( block_of_media_results )
@@ -1841,7 +1840,7 @@ def _PendQueries( self, queries ):
results = self._multiple_gallery_import.PendQueries( queries )
- if len( results ) > 0 and self._highlighted_gallery_import is None and HG.client_controller.new_options.GetBoolean( 'highlight_new_query' ):
+ if len( results ) > 0 and self._highlighted_gallery_import is None and CG.client_controller.new_options.GetBoolean( 'highlight_new_query' ):
first_result = results[ 0 ]
@@ -2020,7 +2019,7 @@ def _ShowSelectedImportersFileSeedCaches( self ):
frame = ClientGUITopLevelWindowsPanels.FrameThatTakesScrollablePanel( self, title, frame_key )
- panel = ClientGUIFileSeedCache.EditFileSeedCachePanel( frame, HG.client_controller, file_seed_cache )
+ panel = ClientGUIFileSeedCache.EditFileSeedCachePanel( frame, CG.client_controller, file_seed_cache )
frame.SetPanel( panel )
@@ -2088,7 +2087,7 @@ def _ShowSelectedImportersGallerySeedLogs( self ):
frame = ClientGUITopLevelWindowsPanels.FrameThatTakesScrollablePanel( self, title, frame_key )
- panel = ClientGUIGallerySeedLog.EditGallerySeedLogPanel( frame, HG.client_controller, read_only, can_generate_more_pages, 'search', gallery_seed_log )
+ panel = ClientGUIGallerySeedLog.EditGallerySeedLogPanel( frame, CG.client_controller, read_only, can_generate_more_pages, 'search', gallery_seed_log )
frame.SetPanel( panel )
@@ -2213,7 +2212,7 @@ def PendSubscriptionGapDownloader( self, gug_key_and_name, query_text, file_impo
new_query = self._multiple_gallery_import.PendSubscriptionGapDownloader( gug_key_and_name, query_text, file_import_options, tag_import_options, note_import_options, file_limit )
- if new_query is not None and self._highlighted_gallery_import is None and HG.client_controller.new_options.GetBoolean( 'highlight_new_query' ):
+ if new_query is not None and self._highlighted_gallery_import is None and CG.client_controller.new_options.GetBoolean( 'highlight_new_query' ):
self._HighlightGalleryImport( new_query )
@@ -2336,7 +2335,7 @@ def __init__( self, parent, page, controller, management_controller: ClientGUIMa
self._UpdateImportStatus()
- HG.client_controller.sub( self, '_ClearExistingHighlightAndPanel', 'clear_multiwatcher_highlights' )
+ CG.client_controller.sub( self, '_ClearExistingHighlightAndPanel', 'clear_multiwatcher_highlights' )
self._import_options_button.fileImportOptionsChanged.connect( self._OptionsUpdated )
self._import_options_button.noteImportOptionsChanged.connect( self._OptionsUpdated )
@@ -2369,7 +2368,7 @@ def _AddURLs( self, urls, filterable_tags = None, additional_service_keys_to_tag
- if first_result is not None and self._highlighted_watcher is None and HG.client_controller.new_options.GetBoolean( 'highlight_new_watcher' ):
+ if first_result is not None and self._highlighted_watcher is None and CG.client_controller.new_options.GetBoolean( 'highlight_new_watcher' ):
self._HighlightWatcher( first_result )
@@ -2494,7 +2493,7 @@ def _ConvertDataToListCtrlTuples( self, watcher: ClientImportWatchers.WatcherImp
if files_paused:
- pretty_files_paused = HG.client_controller.new_options.GetString( 'pause_character' )
+ pretty_files_paused = CG.client_controller.new_options.GetString( 'pause_character' )
else:
@@ -2506,13 +2505,13 @@ def _ConvertDataToListCtrlTuples( self, watcher: ClientImportWatchers.WatcherImp
if checking_dead:
- pretty_checking_paused = HG.client_controller.new_options.GetString( 'stop_character' )
+ pretty_checking_paused = CG.client_controller.new_options.GetString( 'stop_character' )
sort_checking_paused = -1
elif checking_paused:
- pretty_checking_paused = HG.client_controller.new_options.GetString( 'pause_character' )
+ pretty_checking_paused = CG.client_controller.new_options.GetString( 'pause_character' )
sort_checking_paused = 0
@@ -2571,7 +2570,7 @@ def _CopySelectedSubjects( self ):
text = os.linesep.join( ( watcher.GetSubject() for watcher in watchers ) )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -2583,7 +2582,7 @@ def _CopySelectedURLs( self ):
text = os.linesep.join( ( watcher.GetURL() for watcher in watchers ) )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -2740,7 +2739,7 @@ def work_callable():
if not have_published_job_status and HydrusTime.TimeHasPassedFloat( start_time + 3 ):
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
have_published_job_status = True
@@ -2750,7 +2749,7 @@ def work_callable():
return all_media_results
- block_of_media_results = HG.client_controller.Read( 'media_results', block_of_hashes, sorted = True )
+ block_of_media_results = CG.client_controller.Read( 'media_results', block_of_hashes, sorted = True )
all_media_results.extend( block_of_media_results )
@@ -3010,7 +3009,7 @@ def _ShowSelectedImportersFileSeedCaches( self ):
frame = ClientGUITopLevelWindowsPanels.FrameThatTakesScrollablePanel( self, title, frame_key )
- panel = ClientGUIFileSeedCache.EditFileSeedCachePanel( frame, HG.client_controller, file_seed_cache )
+ panel = ClientGUIFileSeedCache.EditFileSeedCachePanel( frame, CG.client_controller, file_seed_cache )
frame.SetPanel( panel )
@@ -3078,7 +3077,7 @@ def _ShowSelectedImportersGallerySeedLogs( self ):
frame = ClientGUITopLevelWindowsPanels.FrameThatTakesScrollablePanel( self, title, frame_key )
- panel = ClientGUIGallerySeedLog.EditGallerySeedLogPanel( frame, HG.client_controller, read_only, can_generate_more_pages, 'check', gallery_seed_log )
+ panel = ClientGUIGallerySeedLog.EditGallerySeedLogPanel( frame, CG.client_controller, read_only, can_generate_more_pages, 'check', gallery_seed_log )
frame.SetPanel( panel )
@@ -4373,7 +4372,7 @@ def _CopyAccountKey( self ):
account_key = self._current_petition.GetPetitionerAccount().GetAccountKey()
- HG.client_controller.pub( 'clipboard', 'text', account_key.hex() )
+ CG.client_controller.pub( 'clipboard', 'text', account_key.hex() )
def _DenySelected( self ):
@@ -4575,7 +4574,7 @@ def do_it( service ):
response = service.Request( HC.GET, 'petitions_summary', { 'content_type' : content_type, 'status' : status, 'num' : num_to_fetch, 'subject_account_key' : subject_account_key } )
- HG.client_controller.CallBlockingToQt( self, qt_set_petitions_summary, response[ 'petitions_summary' ] )
+ CG.client_controller.CallBlockingToQt( self, qt_set_petitions_summary, response[ 'petitions_summary' ] )
except HydrusExceptions.NotFoundException:
@@ -4585,11 +4584,11 @@ def do_it( service ):
job_status.FinishAndDismiss( 5 )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
finally:
- HG.client_controller.CallBlockingToQt( self, qt_done )
+ CG.client_controller.CallBlockingToQt( self, qt_done )
@@ -4847,7 +4846,7 @@ def _SetPetitionsSummary( self, petitions_summary: typing.List[ HydrusNetwork.Pe
if len( self._petition_headers_we_are_fetching ) > 0:
- HG.client_controller.CallToThread( self.THREADPetitionFetcherAndUploader, self._petition_fetcher_and_uploader_work_lock, self._service )
+ CG.client_controller.CallToThread( self.THREADPetitionFetcherAndUploader, self._petition_fetcher_and_uploader_work_lock, self._service )
self._HighlightAPetitionIfNeeded()
@@ -4980,7 +4979,7 @@ def _StartUploadingCompletedPetitions( self, petitions: typing.Collection[ Hydru
self._HighlightAPetitionIfNeeded()
- HG.client_controller.CallToThread( self.THREADPetitionFetcherAndUploader, self._petition_fetcher_and_uploader_work_lock, self._service )
+ CG.client_controller.CallToThread( self.THREADPetitionFetcherAndUploader, self._petition_fetcher_and_uploader_work_lock, self._service )
def _UpdateAccountKey( self ):
@@ -5175,13 +5174,13 @@ def EventContentsRightClick( self, contents ):
tag = copyable_items[0]
- ClientGUIMenus.AppendMenuItem( menu, 'copy {}'.format( tag ), 'Copy this tag.', HG.client_controller.pub, 'clipboard', 'text', tag )
+ ClientGUIMenus.AppendMenuItem( menu, 'copy {}'.format( tag ), 'Copy this tag.', CG.client_controller.pub, 'clipboard', 'text', tag )
else:
text = os.linesep.join( copyable_items )
- ClientGUIMenus.AppendMenuItem( menu, 'copy {} tags'.format( HydrusData.ToHumanInt( len( copyable_items ) ) ), 'Copy this tag.', HG.client_controller.pub, 'clipboard', 'text', text )
+ ClientGUIMenus.AppendMenuItem( menu, 'copy {} tags'.format( HydrusData.ToHumanInt( len( copyable_items ) ) ), 'Copy this tag.', CG.client_controller.pub, 'clipboard', 'text', text )
@@ -5194,7 +5193,7 @@ def PageShown( self ):
ManagementPanel.PageShown( self )
- HG.client_controller.CallToThread( self.THREADPetitionFetcherAndUploader, self._petition_fetcher_and_uploader_work_lock, self._service )
+ CG.client_controller.CallToThread( self.THREADPetitionFetcherAndUploader, self._petition_fetcher_and_uploader_work_lock, self._service )
def ProcessCurrentPetition( self ):
@@ -5248,11 +5247,11 @@ def qt_get_work():
if len( self._petition_headers_we_are_fetching ) > 0:
- if HG.client_controller.PageAliveAndNotClosed( self._page_key ):
+ if CG.client_controller.PageAliveAndNotClosed( self._page_key ):
fetch_petition_header = self._petition_headers_we_are_fetching[0]
- elif HG.client_controller.PageDestroyed( self._page_key ):
+ elif CG.client_controller.PageDestroyed( self._page_key ):
self._petition_headers_we_are_fetching = []
@@ -5371,7 +5370,7 @@ def qt_petition_fetched( petition: HydrusNetwork.Petition ):
fetch_petition_header: typing.Optional[ HydrusNetwork.PetitionHeader ] = None
outgoing_petition: typing.Optional[ HydrusNetwork.Petition ] = None
- ( fetch_petition_header, outgoing_petition ) = HG.client_controller.CallBlockingToQt( self, qt_get_work )
+ ( fetch_petition_header, outgoing_petition ) = CG.client_controller.CallBlockingToQt( self, qt_get_work )
if fetch_petition_header is None and outgoing_petition is None:
@@ -5393,18 +5392,18 @@ def qt_petition_fetched( petition: HydrusNetwork.Petition ):
petition = response[ 'petition' ]
- HG.client_controller.CallBlockingToQt( self, qt_petition_fetched, petition )
+ CG.client_controller.CallBlockingToQt( self, qt_petition_fetched, petition )
except HydrusExceptions.NotFoundException:
- HG.client_controller.CallBlockingToQt( self, qt_petition_fetch_404, fetch_petition_header )
+ CG.client_controller.CallBlockingToQt( self, qt_petition_fetch_404, fetch_petition_header )
except Exception as e:
HydrusData.ShowText( 'Failed to fetch a petition!' )
HydrusData.ShowException( e )
- HG.client_controller.CallBlockingToQt( self, qt_petition_fetch_failed, fetch_petition_header )
+ CG.client_controller.CallBlockingToQt( self, qt_petition_fetch_failed, fetch_petition_header )
@@ -5428,7 +5427,7 @@ def qt_petition_fetched( petition: HydrusNetwork.Petition ):
if HydrusTime.TimeHasPassed( time_started + 3 ):
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
( i_paused, should_quit ) = job_status.WaitIfNeeded()
@@ -5444,7 +5443,7 @@ def qt_petition_fetched( petition: HydrusNetwork.Petition ):
if len( content_updates ) > 0:
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( service.GetServiceKey(), content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( service.GetServiceKey(), content_updates ) )
job_status.SetStatusText( HydrusData.ConvertValueRangeToPrettyString( num_done, num_to_do ) )
@@ -5456,14 +5455,14 @@ def qt_petition_fetched( petition: HydrusNetwork.Petition ):
job_status.FinishAndDismiss()
- HG.client_controller.CallBlockingToQt( self, qt_petition_cleared, outgoing_petition )
+ CG.client_controller.CallBlockingToQt( self, qt_petition_cleared, outgoing_petition )
except Exception as e:
HydrusData.ShowText( 'Failed to upload a petition!' )
HydrusData.ShowException( e )
- HG.client_controller.CallBlockingToQt( self, qt_petition_clear_failed, outgoing_petition )
+ CG.client_controller.CallBlockingToQt( self, qt_petition_clear_failed, outgoing_petition )
@@ -5481,7 +5480,7 @@ def __init__( self, parent, page, controller, management_controller: ClientGUIMa
file_search_context = self._management_controller.GetVariable( 'file_search_context' )
- file_search_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ file_search_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
self._search_enabled = self._management_controller.GetVariable( 'search_enabled' )
@@ -5572,7 +5571,7 @@ def _MakeCurrentSelectionTagsBox( self, sizer ):
file_search_context = self._management_controller.GetVariable( 'file_search_context' )
- file_search_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ file_search_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
tag_service_key = file_search_context.GetTagContext().service_key
@@ -5802,7 +5801,7 @@ def Start( self ):
file_search_context = self._management_controller.GetVariable( 'file_search_context' )
- file_search_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ file_search_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
initial_predicates = file_search_context.GetPredicates()
@@ -5828,7 +5827,7 @@ def qt_code():
QUERY_CHUNK_SIZE = 256
- HG.client_controller.file_viewing_stats_manager.Flush()
+ CG.client_controller.file_viewing_stats_manager.Flush()
query_hash_ids = controller.Read( 'file_query_ids', file_search_context, job_status = query_job_status, limit_sort_by = sort_by )
diff --git a/hydrus/client/gui/pages/ClientGUIPages.py b/hydrus/client/gui/pages/ClientGUIPages.py
index a9f08f45f..9a5b416e5 100644
--- a/hydrus/client/gui/pages/ClientGUIPages.py
+++ b/hydrus/client/gui/pages/ClientGUIPages.py
@@ -17,6 +17,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientThreading
from hydrus.client.gui import ClientGUIAsync
@@ -126,7 +127,7 @@ def __init__( self, parent, controller ):
self.setMinimumWidth( width )
self.setMinimumHeight( height )
- self._petition_service_keys = [ service.GetServiceKey() for service in HG.client_controller.services_manager.GetServices( HC.REPOSITORIES ) if True in ( service.HasPermission( content_type, HC.PERMISSION_ACTION_MODERATE ) for content_type in HC.SERVICE_TYPES_TO_CONTENT_TYPES[ service.GetServiceType() ] ) ]
+ self._petition_service_keys = [ service.GetServiceKey() for service in CG.client_controller.services_manager.GetServices( HC.REPOSITORIES ) if True in ( service.HasPermission( content_type, HC.PERMISSION_ACTION_MODERATE ) for content_type in HC.SERVICE_TYPES_TO_CONTENT_TYPES[ service.GetServiceType() ] ) ]
self._InitButtons( 'home' )
@@ -163,7 +164,7 @@ def _AddEntry( self, button, entry ):
elif entry_type in ( 'page_query', 'page_petitions' ):
- name = HG.client_controller.services_manager.GetService( obj ).GetName()
+ name = CG.client_controller.services_manager.GetService( obj ).GetName()
button.setText( name )
@@ -1108,7 +1109,7 @@ def publish_callable( media_results ):
# do this 'after' so on a long session setup, it all boots once session loaded
- HG.client_controller.CallAfterQtSafe( self, 'starting page controller', self._management_panel.Start )
+ CG.client_controller.CallAfterQtSafe( self, 'starting page controller', self._management_panel.Start )
self._initialised = True
self._initial_hashes = []
@@ -1133,7 +1134,7 @@ def Start( self ):
else:
# do this 'after' so on a long session setup, it all boots once session loaded
- HG.client_controller.CallAfterQtSafe( self, 'starting page controller', self._management_panel.Start )
+ CG.client_controller.CallAfterQtSafe( self, 'starting page controller', self._management_panel.Start )
self._initialised = True
@@ -1243,7 +1244,7 @@ def _RefreshPageNamesAfterDnD( self, page_widget, source_widget ):
def _UpdateOptions( self ):
- if HG.client_controller.new_options.GetBoolean( 'elide_page_tab_names' ):
+ if CG.client_controller.new_options.GetBoolean( 'elide_page_tab_names' ):
self.tabBar().setElideMode( QC.Qt.ElideMiddle )
@@ -1252,7 +1253,7 @@ def _UpdateOptions( self ):
self.tabBar().setElideMode( QC.Qt.ElideNone )
- direction = HG.client_controller.new_options.GetInteger( 'notebook_tab_alignment' )
+ direction = CG.client_controller.new_options.GetInteger( 'notebook_tab_alignment' )
self.setTabPosition( directions_for_notebook_tabs[ direction ] )
@@ -1625,7 +1626,7 @@ def _RefreshPageName( self, index ):
page_name = HydrusText.ElideText( full_page_name, max_page_name_chars )
- do_tooltip = len( page_name ) != len( full_page_name ) or HG.client_controller.new_options.GetBoolean( 'elide_page_tab_names' )
+ do_tooltip = len( page_name ) != len( full_page_name ) or CG.client_controller.new_options.GetBoolean( 'elide_page_tab_names' )
num_string = ''
@@ -1794,7 +1795,7 @@ def _ShowMenu( self, screen_position ):
click_over_page_of_pages = isinstance( page, PagesNotebook )
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
label = 'page weight: {}'.format( HydrusData.ToHumanInt( page.GetTotalWeight() ) )
@@ -2140,10 +2141,10 @@ def AppendGUISessionFreshest( self, name, load_in_a_page_of_pages = True ):
job_status.SetStatusText( 'loading session "{}"'.format( name ) + HC.UNICODE_ELLIPSIS )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
# get that message showing before we do the work of loading session
- HG.client_controller.app.processEvents()
+ CG.client_controller.app.processEvents()
try:
@@ -2157,7 +2158,7 @@ def AppendGUISessionFreshest( self, name, load_in_a_page_of_pages = True ):
return
- HG.client_controller.app.processEvents()
+ CG.client_controller.app.processEvents()
if load_in_a_page_of_pages:
@@ -2168,7 +2169,7 @@ def AppendGUISessionFreshest( self, name, load_in_a_page_of_pages = True ):
destination = self
- HG.client_controller.app.processEvents()
+ CG.client_controller.app.processEvents()
destination.AppendGUISession( session )
@@ -3419,7 +3420,7 @@ def NewPagesNotebook( self, name = 'pages', forced_insertion_index = None, on_de
if give_it_a_blank_page:
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
page.NewPageQuery( default_location_context )
diff --git a/hydrus/client/gui/pages/ClientGUIResults.py b/hydrus/client/gui/pages/ClientGUIResults.py
index e028391a8..5f893d8f9 100644
--- a/hydrus/client/gui/pages/ClientGUIResults.py
+++ b/hydrus/client/gui/pages/ClientGUIResults.py
@@ -22,6 +22,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientData
from hydrus.client import ClientFiles
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientPaths
from hydrus.client.gui import ClientGUIDragDrop
@@ -182,11 +183,11 @@ def __init__( self, parent, page_key, management_controller: ClientGUIManagement
self._empty_page_status_override = None
- HG.client_controller.sub( self, 'AddMediaResults', 'add_media_results' )
- HG.client_controller.sub( self, 'RemoveMedia', 'remove_media' )
- HG.client_controller.sub( self, '_UpdateBackgroundColour', 'notify_new_colourset' )
- HG.client_controller.sub( self, 'SelectByTags', 'select_files_with_tags' )
- HG.client_controller.sub( self, 'LaunchMediaViewerOnFocus', 'launch_media_viewer' )
+ CG.client_controller.sub( self, 'AddMediaResults', 'add_media_results' )
+ CG.client_controller.sub( self, 'RemoveMedia', 'remove_media' )
+ CG.client_controller.sub( self, '_UpdateBackgroundColour', 'notify_new_colourset' )
+ CG.client_controller.sub( self, 'SelectByTags', 'select_files_with_tags' )
+ CG.client_controller.sub( self, 'LaunchMediaViewerOnFocus', 'launch_media_viewer' )
self._had_changes_to_tag_presentation_while_hidden = False
@@ -222,7 +223,7 @@ def _Archive( self ):
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ARCHIVE, hashes ) ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ARCHIVE, hashes ) ) )
@@ -270,7 +271,7 @@ def _CopyBMPToClipboard( self, resolution = None ):
if media.IsStaticImage():
- HG.client_controller.pub( 'clipboard', 'bmp', ( media, resolution ) )
+ CG.client_controller.pub( 'clipboard', 'bmp', ( media, resolution ) )
copied = True
@@ -282,7 +283,7 @@ def _CopyBMPToClipboard( self, resolution = None ):
def _CopyFilesToClipboard( self ):
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
media = self._GetSelectedFlatMedia( discriminant = CC.DISCRIMINANT_LOCAL )
@@ -300,7 +301,7 @@ def _CopyFilesToClipboard( self ):
if len( paths ) > 0:
- HG.client_controller.pub( 'clipboard', 'paths', paths )
+ CG.client_controller.pub( 'clipboard', 'paths', paths )
@@ -327,11 +328,11 @@ def _CopyPathToClipboard( self ):
media = self._GetFocusSingleton()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( media.GetHash(), media.GetMime() )
- HG.client_controller.pub( 'clipboard', 'text', path )
+ CG.client_controller.pub( 'clipboard', 'text', path )
@@ -339,7 +340,7 @@ def _CopyPathsToClipboard( self ):
media_results = self.GenerateMediaResults( discriminant = CC.DISCRIMINANT_LOCAL, selected_media = set( self._selected_media ) )
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
paths = []
@@ -352,7 +353,7 @@ def _CopyPathsToClipboard( self ):
text = os.linesep.join( paths )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -371,7 +372,7 @@ def _CopyServiceFilenameToClipboard( self, service_key ):
return
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
if service.GetServiceType() == HC.IPFS:
@@ -380,7 +381,7 @@ def _CopyServiceFilenameToClipboard( self, service_key ):
filename = multihash_prefix + filename
- HG.client_controller.pub( 'clipboard', 'text', filename )
+ CG.client_controller.pub( 'clipboard', 'text', filename )
@@ -388,7 +389,7 @@ def _CopyServiceFilenamesToClipboard( self, service_key ):
prefix = ''
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
if service.GetServiceType() == HC.IPFS:
@@ -407,7 +408,7 @@ def _CopyServiceFilenamesToClipboard( self, service_key ):
copy_string = os.linesep.join( filenames )
- HG.client_controller.pub( 'clipboard', 'text', copy_string )
+ CG.client_controller.pub( 'clipboard', 'text', copy_string )
else:
@@ -428,7 +429,7 @@ def _Delete( self, file_service_key = None, only_those_in_file_service_key = Non
( possible_suggested_file_service_key, ) = self._location_context.current_service_keys
- if HG.client_controller.services_manager.GetServiceType( possible_suggested_file_service_key ) in HC.SPECIFIC_LOCAL_FILE_SERVICES + ( HC.FILE_REPOSITORY, ):
+ if CG.client_controller.services_manager.GetServiceType( possible_suggested_file_service_key ) in HC.SPECIFIC_LOCAL_FILE_SERVICES + ( HC.FILE_REPOSITORY, ):
file_service_key = possible_suggested_file_service_key
@@ -444,7 +445,7 @@ def _Delete( self, file_service_key = None, only_those_in_file_service_key = Non
media_to_delete = [ m for m in media_to_delete if only_those_in_file_service_key in m.GetLocationsManager().GetCurrent() ]
- if file_service_key is None or HG.client_controller.services_manager.GetServiceType( file_service_key ) in HC.LOCAL_FILE_SERVICES:
+ if file_service_key is None or CG.client_controller.services_manager.GetServiceType( file_service_key ) in HC.LOCAL_FILE_SERVICES:
default_reason = 'Deleted from Media Page.'
@@ -471,11 +472,11 @@ def do_it( content_update_packages ):
for content_update_package in content_update_packages:
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
- HG.client_controller.CallToThread( do_it, content_update_packages )
+ CG.client_controller.CallToThread( do_it, content_update_packages )
def _DeselectSelect( self, media_to_deselect, media_to_select ):
@@ -510,7 +511,7 @@ def _DownloadSelected( self ):
def _DownloadHashes( self, hashes ):
- HG.client_controller.quick_download_manager.DownloadFiles( hashes )
+ CG.client_controller.quick_download_manager.DownloadFiles( hashes )
def _EndShiftSelect( self ):
@@ -788,7 +789,7 @@ def _GetSimilarTo( self, max_hamming ):
initial_predicates = [ ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_SYSTEM_SIMILAR_TO_FILES, ( tuple( hashes ), max_hamming ) ) ]
- HG.client_controller.pub( 'new_page_query', self._location_context, initial_predicates = initial_predicates )
+ CG.client_controller.pub( 'new_page_query', self._location_context, initial_predicates = initial_predicates )
@@ -934,9 +935,9 @@ def _HitMedia( self, media, ctrl, shift ):
focus_it = False
- if HG.client_controller.new_options.GetBoolean( 'focus_preview_on_ctrl_click' ):
+ if CG.client_controller.new_options.GetBoolean( 'focus_preview_on_ctrl_click' ):
- if HG.client_controller.new_options.GetBoolean( 'focus_preview_on_ctrl_click_only_static' ):
+ if CG.client_controller.new_options.GetBoolean( 'focus_preview_on_ctrl_click_only_static' ):
focus_it = media.GetDurationMS() is None
@@ -983,9 +984,9 @@ def _HitMedia( self, media, ctrl, shift ):
focus_it = False
- if HG.client_controller.new_options.GetBoolean( 'focus_preview_on_shift_click' ):
+ if CG.client_controller.new_options.GetBoolean( 'focus_preview_on_shift_click' ):
- if HG.client_controller.new_options.GetBoolean( 'focus_preview_on_shift_click_only_static' ):
+ if CG.client_controller.new_options.GetBoolean( 'focus_preview_on_shift_click_only_static' ):
focus_it = media.GetDurationMS() is None
@@ -1042,7 +1043,7 @@ def _Inbox( self ):
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_INBOX, hashes ) ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_INBOX, hashes ) ) )
@@ -1057,7 +1058,7 @@ def _LaunchMediaViewer( self, first_media = None ):
return
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
( media_show_action, media_start_paused, media_start_with_embed ) = new_options.GetMediaShowAction( media.GetMime() )
@@ -1066,11 +1067,11 @@ def _LaunchMediaViewer( self, first_media = None ):
hash = media.GetHash()
mime = media.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
launch_path = new_options.GetMimeLaunch( mime )
@@ -1137,7 +1138,7 @@ def _ManageRatings( self ):
if len( flat_media ) > 0:
- if len( HG.client_controller.services_manager.GetServices( HC.RATINGS_SERVICES ) ) > 0:
+ if len( CG.client_controller.services_manager.GetServices( HC.RATINGS_SERVICES ) ) > 0:
with ClientGUIDialogsManage.DialogManageRatings( self, flat_media ) as dlg:
@@ -1246,11 +1247,11 @@ def _OpenExternally( self ):
hash = media.GetHash()
mime = media.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
launch_path = new_options.GetMimeLaunch( mime )
@@ -1270,7 +1271,7 @@ def _OpenFileInWebBrowser( self ):
hash = focused_singleton.GetHash()
mime = focused_singleton.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
@@ -1292,7 +1293,7 @@ def _OpenFileLocation( self ):
hash = focused_singleton.GetHash()
mime = focused_singleton.GetMime()
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
path = client_files_manager.GetFilePath( hash, mime )
@@ -1319,7 +1320,7 @@ def _PetitionFiles( self, remote_service_key ):
if hashes is not None and len( hashes ) > 0:
- remote_service = HG.client_controller.services_manager.GetService( remote_service_key )
+ remote_service = CG.client_controller.services_manager.GetService( remote_service_key )
service_type = remote_service.GetServiceType()
@@ -1344,7 +1345,7 @@ def _PetitionFiles( self, remote_service_key ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( remote_service_key, content_update )
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
@@ -1356,14 +1357,14 @@ def _PetitionFiles( self, remote_service_key ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( remote_service_key, content_update )
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
def _PublishSelectionChange( self, tags_changed = False ):
- if HG.client_controller.gui.IsCurrentPage( self._page_key ):
+ if CG.client_controller.gui.IsCurrentPage( self._page_key ):
if len( self._selected_media ) == 0:
@@ -1395,7 +1396,7 @@ def _PublishSelectionChange( self, tags_changed = False ):
def _PublishSelectionIncrement( self, medias ):
- if HG.client_controller.gui.IsCurrentPage( self._page_key ):
+ if CG.client_controller.gui.IsCurrentPage( self._page_key ):
medias = list( medias )
@@ -1495,13 +1496,13 @@ def _RegenerateFileData( self, job_type ):
time.sleep( 0.1 )
- HG.client_controller.CallToThread( HG.client_controller.files_maintenance_manager.RunJobImmediately, flat_media, job_type )
+ CG.client_controller.CallToThread( CG.client_controller.files_maintenance_manager.RunJobImmediately, flat_media, job_type )
else:
hashes = { media.GetHash() for media in flat_media }
- HG.client_controller.CallToThread( HG.client_controller.files_maintenance_manager.ScheduleJob, hashes, job_type )
+ CG.client_controller.CallToThread( CG.client_controller.files_maintenance_manager.ScheduleJob, hashes, job_type )
@@ -1510,7 +1511,7 @@ def _RescindDownloadSelected( self ):
hashes = self._GetSelectedHashes( discriminant = CC.DISCRIMINANT_NOT_LOCAL )
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_RESCIND_PEND, hashes ) ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_RESCIND_PEND, hashes ) ) )
def _RescindPetitionFiles( self, file_service_key ):
@@ -1519,7 +1520,7 @@ def _RescindPetitionFiles( self, file_service_key ):
if hashes is not None and len( hashes ) > 0:
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( file_service_key, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_RESCIND_PETITION, hashes ) ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( file_service_key, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_RESCIND_PETITION, hashes ) ) )
@@ -1529,7 +1530,7 @@ def _RescindUploadFiles( self, file_service_key ):
if hashes is not None and len( hashes ) > 0:
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( file_service_key, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_RESCIND_PEND, hashes ) ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( file_service_key, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_RESCIND_PEND, hashes ) ) )
@@ -1616,11 +1617,11 @@ def _SetDuplicates( self, duplicate_type, media_pairs = None, media_group = None
yes_no_text = 'apply "{}"'.format( HC.duplicate_type_string_lookup[ duplicate_type ] )
- if duplicate_type in [ HC.DUPLICATE_BETTER, HC.DUPLICATE_SAME_QUALITY ] or ( HG.client_controller.new_options.GetBoolean( 'advanced_mode' ) and duplicate_type == HC.DUPLICATE_ALTERNATE ):
+ if duplicate_type in [ HC.DUPLICATE_BETTER, HC.DUPLICATE_SAME_QUALITY ] or ( CG.client_controller.new_options.GetBoolean( 'advanced_mode' ) and duplicate_type == HC.DUPLICATE_ALTERNATE ):
yes_no_text += ' (with default duplicate metadata merge options)'
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
duplicate_content_merge_options = new_options.GetDuplicateContentMergeOptions( duplicate_type )
@@ -1793,7 +1794,7 @@ def _SetDuplicates( self, duplicate_type, media_pairs = None, media_group = None
if len( pair_info ) > 0:
- HG.client_controller.WriteSynchronous( 'duplicate_pair_status', pair_info )
+ CG.client_controller.WriteSynchronous( 'duplicate_pair_status', pair_info )
return True
@@ -1805,7 +1806,7 @@ def _SetDuplicatesCustom( self ):
duplicate_types = [ HC.DUPLICATE_BETTER, HC.DUPLICATE_SAME_QUALITY ]
- if HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
duplicate_types.append( HC.DUPLICATE_ALTERNATE )
@@ -1821,7 +1822,7 @@ def _SetDuplicatesCustom( self ):
return
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
duplicate_content_merge_options = new_options.GetDuplicateContentMergeOptions( duplicate_type )
@@ -1924,7 +1925,7 @@ def _SetDuplicatesFocusedKing( self, silent = False ):
if do_it:
- HG.client_controller.WriteSynchronous( 'duplicate_set_king', focused_hash )
+ CG.client_controller.WriteSynchronous( 'duplicate_set_king', focused_hash )
else:
@@ -2020,7 +2021,7 @@ def _ShareOnLocalBooru( self ):
info[ 'timeout' ] = timeout
info[ 'hashes' ] = hashes
- HG.client_controller.Write( 'local_booru_share', share_key, info )
+ CG.client_controller.Write( 'local_booru_share', share_key, info )
@@ -2032,13 +2033,13 @@ def _ShowSelectionInNewDuplicateFilterPage( self ):
hashes = self._GetSelectedHashes( ordered = True )
- activate_window = HG.client_controller.new_options.GetBoolean( 'activate_window_on_tag_search_page_activation' )
+ activate_window = CG.client_controller.new_options.GetBoolean( 'activate_window_on_tag_search_page_activation' )
predicates = [ ClientSearch.Predicate( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_HASH, value = ( tuple( hashes ), 'sha256' ) ) ]
page_name = 'duplicates'
- HG.client_controller.pub( 'new_page_duplicates', self._location_context, initial_predicates = predicates, page_name = page_name, activate_window = activate_window )
+ CG.client_controller.pub( 'new_page_duplicates', self._location_context, initial_predicates = predicates, page_name = page_name, activate_window = activate_window )
def _ShowSelectionInNewPage( self ):
@@ -2058,7 +2059,7 @@ def _ShowSelectionInNewPage( self ):
media_collect = ClientMedia.MediaCollect()
- HG.client_controller.pub( 'new_page_query', self._location_context, initial_hashes = hashes, initial_sort = media_sort, initial_collect = media_collect )
+ CG.client_controller.pub( 'new_page_query', self._location_context, initial_hashes = hashes, initial_sort = media_sort, initial_collect = media_collect )
@@ -2086,7 +2087,7 @@ def _UploadDirectory( self, file_service_key ):
if hashes is not None and len( hashes ) > 0:
- ipfs_service = HG.client_controller.services_manager.GetService( file_service_key )
+ ipfs_service = CG.client_controller.services_manager.GetService( file_service_key )
with ClientGUIDialogs.DialogTextEntry( self, 'Enter a note to describe this directory.' ) as dlg:
@@ -2095,7 +2096,7 @@ def _UploadDirectory( self, file_service_key ):
note = dlg.GetValue()
- HG.client_controller.CallToThread( ipfs_service.PinDirectory, hashes, note )
+ CG.client_controller.CallToThread( ipfs_service.PinDirectory, hashes, note )
@@ -2106,7 +2107,7 @@ def _UploadFiles( self, file_service_key ):
if hashes is not None and len( hashes ) > 0:
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( file_service_key, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_PEND, hashes ) ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( file_service_key, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_PEND, hashes ) ) )
@@ -2114,13 +2115,13 @@ def AddMediaResults( self, page_key, media_results ):
if page_key == self._page_key:
- HG.client_controller.pub( 'refresh_page_name', self._page_key )
+ CG.client_controller.pub( 'refresh_page_name', self._page_key )
result = ClientMedia.ListeningMediaList.AddMediaResults( self, media_results )
self.newMediaAdded.emit()
- HG.client_controller.pub( 'notify_new_pages_count' )
+ CG.client_controller.pub( 'notify_new_pages_count' )
return result
@@ -2674,13 +2675,13 @@ def paintEvent( self, event ):
painter = QG.QPainter( self )
- bg_colour = HG.client_controller.new_options.GetColour( CC.COLOUR_THUMBGRID_BACKGROUND )
+ bg_colour = CG.client_controller.new_options.GetColour( CC.COLOUR_THUMBGRID_BACKGROUND )
painter.setBackground( QG.QBrush( bg_colour ) )
painter.eraseRect( painter.viewport() )
- background_pixmap = HG.client_controller.bitmap_manager.GetMediaBackgroundPixmap()
+ background_pixmap = CG.client_controller.bitmap_manager.GetMediaBackgroundPixmap()
if background_pixmap is not None:
@@ -2702,7 +2703,7 @@ def __init__( self, parent, page_key, management_controller: ClientGUIManagement
MediaPanel.__init__( self, parent, page_key, management_controller, [] )
- HG.client_controller.sub( self, 'SetNumQueryResults', 'set_num_query_results' )
+ CG.client_controller.sub( self, 'SetNumQueryResults', 'set_num_query_results' )
def _GetPrettyStatusForStatusBar( self ):
@@ -2752,6 +2753,7 @@ def __init__( self, parent, page_key, management_controller: ClientGUIManagement
self._num_columns = 1
self._drag_init_coordinates = None
+ self._drag_click_timestamp_ms = 0
self._drag_prefire_event_count = 0
self._hashes_to_thumbnails_waiting_to_be_drawn: typing.Dict[ bytes, ThumbnailWaitingToBeDrawn ] = {}
self._hashes_faded = set()
@@ -2762,7 +2764,7 @@ def __init__( self, parent, page_key, management_controller: ClientGUIManagement
( thumbnail_span_width, thumbnail_span_height ) = self._GetThumbnailSpanDimensions()
- thumbnail_scroll_rate = float( HG.client_controller.new_options.GetString( 'thumbnail_scroll_rate' ) )
+ thumbnail_scroll_rate = float( CG.client_controller.new_options.GetString( 'thumbnail_scroll_rate' ) )
self.verticalScrollBar().setSingleStep( int( round( thumbnail_span_height * thumbnail_scroll_rate ) ) )
@@ -2778,12 +2780,12 @@ def __init__( self, parent, page_key, management_controller: ClientGUIManagement
self._UpdateScrollBars()
- HG.client_controller.sub( self, 'MaintainPageCache', 'memory_maintenance_pulse' )
- HG.client_controller.sub( self, 'NotifyNewFileInfo', 'new_file_info' )
- HG.client_controller.sub( self, 'NewThumbnails', 'new_thumbnails' )
- HG.client_controller.sub( self, 'ThumbnailsReset', 'notify_complete_thumbnail_reset' )
- HG.client_controller.sub( self, 'RedrawAllThumbnails', 'refresh_all_tag_presentation_gui' )
- HG.client_controller.sub( self, 'WaterfallThumbnails', 'waterfall_thumbnails' )
+ CG.client_controller.sub( self, 'MaintainPageCache', 'memory_maintenance_pulse' )
+ CG.client_controller.sub( self, 'NotifyNewFileInfo', 'new_file_info' )
+ CG.client_controller.sub( self, 'NewThumbnails', 'new_thumbnails' )
+ CG.client_controller.sub( self, 'ThumbnailsReset', 'notify_complete_thumbnail_reset' )
+ CG.client_controller.sub( self, 'RedrawAllThumbnails', 'refresh_all_tag_presentation_gui' )
+ CG.client_controller.sub( self, 'WaterfallThumbnails', 'waterfall_thumbnails' )
def _CalculateVisiblePageIndices( self ):
@@ -2818,7 +2820,7 @@ def _CreateNewDirtyPage( self ):
canvas_width = int( my_width * dpr )
canvas_height = int( self._num_rows_per_canvas_page * thumbnail_span_height * dpr )
- canvas_page = HG.client_controller.bitmap_manager.GetQtImage( canvas_width, canvas_height, 32 )
+ canvas_page = CG.client_controller.bitmap_manager.GetQtImage( canvas_width, canvas_height, 32 )
canvas_page.setDevicePixelRatio( dpr )
@@ -2850,7 +2852,7 @@ def _DirtyPage( self, clean_index ):
if len( thumbnails ) > 0:
- HG.client_controller.GetCache( 'thumbnail' ).CancelWaterfall( self._page_key, thumbnails )
+ CG.client_controller.GetCache( 'thumbnail' ).CancelWaterfall( self._page_key, thumbnails )
self._dirty_canvas_pages.append( canvas_page )
@@ -2860,9 +2862,9 @@ def _DrawCanvasPage( self, page_index, canvas_page ):
painter = QG.QPainter( canvas_page )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
- bg_colour = HG.client_controller.new_options.GetColour( CC.COLOUR_THUMBGRID_BACKGROUND )
+ bg_colour = CG.client_controller.new_options.GetColour( CC.COLOUR_THUMBGRID_BACKGROUND )
if HG.thumbnail_debug_mode and page_index % 2 == 0:
@@ -2896,9 +2898,9 @@ def _DrawCanvasPage( self, page_index, canvas_page ):
thumbnails_to_render_later = []
- thumbnail_cache = HG.client_controller.GetCache( 'thumbnail' )
+ thumbnail_cache = CG.client_controller.GetCache( 'thumbnail' )
- thumbnail_margin = HG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
+ thumbnail_margin = CG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
for ( thumbnail_index, thumbnail ) in page_thumbnails:
@@ -2933,7 +2935,7 @@ def _DrawCanvasPage( self, page_index, canvas_page ):
if len( thumbnails_to_render_later ) > 0:
- HG.client_controller.GetCache( 'thumbnail' ).Waterfall( self._page_key, thumbnails_to_render_later )
+ CG.client_controller.GetCache( 'thumbnail' ).Waterfall( self._page_key, thumbnails_to_render_later )
@@ -2944,7 +2946,7 @@ def _FadeThumbnails( self, thumbnails ):
return
- if not HG.client_controller.gui.IsCurrentPage( self._page_key ):
+ if not CG.client_controller.gui.IsCurrentPage( self._page_key ):
self._DirtyAllPages()
@@ -2986,7 +2988,7 @@ def _FadeThumbnails( self, thumbnails ):
bitmap = thumbnail.GetQtImage( self.devicePixelRatio() )
- fade_thumbnails = HG.client_controller.new_options.GetBoolean( 'fade_thumbnails' )
+ fade_thumbnails = CG.client_controller.new_options.GetBoolean( 'fade_thumbnails' )
if fade_thumbnails:
@@ -3000,7 +3002,7 @@ def _FadeThumbnails( self, thumbnails ):
self._hashes_to_thumbnails_waiting_to_be_drawn[ hash ] = thumbnail_draw_object
- HG.client_controller.gui.RegisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.RegisterAnimationUpdateWindow( self )
def _GenerateMediaCollection( self, media_results ):
@@ -3023,7 +3025,7 @@ def _GetMediaCoordinates( self, media ):
( thumbnail_span_width, thumbnail_span_height ) = self._GetThumbnailSpanDimensions()
- thumbnail_margin = HG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
+ thumbnail_margin = CG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
( x, y ) = ( column * thumbnail_span_width + thumbnail_margin, row * thumbnail_span_height + thumbnail_margin )
@@ -3041,8 +3043,8 @@ def _GetPageIndexFromThumbnailIndex( self, thumbnail_index ):
def _GetThumbnailSpanDimensions( self ):
- thumbnail_border = HG.client_controller.new_options.GetInteger( 'thumbnail_border' )
- thumbnail_margin = HG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
+ thumbnail_border = CG.client_controller.new_options.GetInteger( 'thumbnail_border' )
+ thumbnail_margin = CG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
return ClientData.AddPaddingToDimensions( HC.options[ 'thumbnail_dimensions' ], ( thumbnail_border + thumbnail_margin ) * 2 )
@@ -3059,7 +3061,7 @@ def _GetThumbnailUnderMouse( self, mouse_event ):
x_mod = x % t_span_x
y_mod = y % t_span_y
- thumbnail_margin = HG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
+ thumbnail_margin = CG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
if x_mod <= thumbnail_margin or y_mod <= thumbnail_margin or x_mod > t_span_x - thumbnail_margin or y_mod > t_span_y - thumbnail_margin:
@@ -3294,7 +3296,7 @@ def _RedrawMedia( self, thumbnails ):
visible_thumbnails = [ thumbnail for thumbnail in thumbnails if self._MediaIsInCleanPage( thumbnail ) ]
- thumbnail_cache = HG.client_controller.GetCache( 'thumbnail' )
+ thumbnail_cache = CG.client_controller.GetCache( 'thumbnail' )
thumbnails_to_render_now = []
thumbnails_to_render_later = []
@@ -3318,7 +3320,7 @@ def _RedrawMedia( self, thumbnails ):
if len( thumbnails_to_render_later ) > 0:
- HG.client_controller.GetCache( 'thumbnail' ).Waterfall( self._page_key, thumbnails_to_render_later )
+ CG.client_controller.GetCache( 'thumbnail' ).Waterfall( self._page_key, thumbnails_to_render_later )
@@ -3382,9 +3384,9 @@ def _RemoveMediaDirectly( self, singleton_media, collected_media ):
self._PublishSelectionChange()
- HG.client_controller.pub( 'refresh_page_name', self._page_key )
+ CG.client_controller.pub( 'refresh_page_name', self._page_key )
- HG.client_controller.pub( 'notify_new_pages_count' )
+ CG.client_controller.pub( 'notify_new_pages_count' )
self.widget().update()
@@ -3427,7 +3429,7 @@ def _ScrollToMedia( self, media ):
( thumbnail_span_width, thumbnail_span_height ) = self._GetThumbnailSpanDimensions()
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
percent_visible = new_options.GetInteger( 'thumbnail_visibility_scroll_percent' ) / 100
@@ -3483,7 +3485,7 @@ def AddMediaResults( self, page_key, media_results ):
self._RecalculateVirtualSize()
- HG.client_controller.GetCache( 'thumbnail' ).Waterfall( self._page_key, thumbnails )
+ CG.client_controller.GetCache( 'thumbnail' ).Waterfall( self._page_key, thumbnails )
if len( self._selected_media ) == 0:
@@ -3519,7 +3521,7 @@ def EventMouseFullScreen( self, event ):
else:
- can_download = not locations_manager.GetCurrent().isdisjoint( HG.client_controller.services_manager.GetRemoteFileServiceKeys() )
+ can_download = not locations_manager.GetCurrent().isdisjoint( CG.client_controller.services_manager.GetRemoteFileServiceKeys() )
if can_download:
@@ -3545,7 +3547,7 @@ def GetTotalFileSize( self ):
def MaintainPageCache( self ):
- if not HG.client_controller.gui.IsCurrentPage( self._page_key ):
+ if not CG.client_controller.gui.IsCurrentPage( self._page_key ):
self._DirtyAllPages()
@@ -3579,9 +3581,9 @@ def mouseMoveEvent( self, event ):
# prefire deal here is mpv lags on initial click, which can cause a drag (and hence an immediate pause) event by accident when mouserelease isn't processed quick
# so now we'll say we can't start a drag unless we get a smooth ramp to our pixel delta threshold
clean_drag_started = self._drag_prefire_event_count >= 10
- moved_a_decent_bit_from_start = total_absolute_pixels_moved > 20
+ prob_not_an_accidental_click = HydrusTime.TimeHasPassedMS( self._drag_click_timestamp_ms + 100 )
- if clean_drag_started and moved_a_decent_bit_from_start:
+ if clean_drag_started and prob_not_an_accidental_click:
media = self._GetSelectedFlatMedia( discriminant = CC.DISCRIMINANT_LOCAL )
@@ -3603,6 +3605,7 @@ def mouseMoveEvent( self, event ):
self._drag_init_coordinates = None
self._drag_prefire_event_count = 0
+ self._drag_click_timestamp_ms = 0
event.ignore()
@@ -3655,16 +3658,16 @@ def qt_do_update( hashes_to_media_results ):
def do_it( win, callable, affected_hashes ):
- media_results = HG.client_controller.Read( 'media_results', affected_hashes )
+ media_results = CG.client_controller.Read( 'media_results', affected_hashes )
hashes_to_media_results = { media_result.GetHash() : media_result for media_result in media_results }
- HG.client_controller.CallAfterQtSafe( win, 'new file info notification', qt_do_update, hashes_to_media_results )
+ CG.client_controller.CallAfterQtSafe( win, 'new file info notification', qt_do_update, hashes_to_media_results )
affected_hashes = self._hashes.intersection( hashes )
- HG.client_controller.CallToThread( do_it, self, do_it, affected_hashes )
+ CG.client_controller.CallToThread( do_it, self, do_it, affected_hashes )
def ProcessApplicationCommand( self, command: CAC.ApplicationCommand ):
@@ -3810,11 +3813,11 @@ def showEvent( self, event ):
def ShowMenu( self, do_not_show_just_return = False ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
advanced_mode = new_options.GetBoolean( 'advanced_mode' )
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
flat_selected_medias = ClientMedia.FlattenMedia( self._selected_media )
@@ -3832,7 +3835,7 @@ def ShowMenu( self, do_not_show_just_return = False ):
all_specific_file_domains = all_file_domains.difference( { CC.COMBINED_FILE_SERVICE_KEY, CC.COMBINED_LOCAL_FILE_SERVICE_KEY } )
all_local_file_domains = services_manager.Filter( all_specific_file_domains, ( HC.LOCAL_FILE_DOMAIN, ) )
- all_local_file_domains_sorted = sorted( all_local_file_domains, key = HG.client_controller.services_manager.GetName )
+ all_local_file_domains_sorted = sorted( all_local_file_domains, key = CG.client_controller.services_manager.GetName )
all_file_repos = services_manager.Filter( all_specific_file_domains, ( HC.FILE_REPOSITORY, ) )
@@ -3859,7 +3862,7 @@ def ShowMenu( self, do_not_show_just_return = False ):
collections_selected = True in ( media.IsCollection() for media in self._selected_media )
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
services = services_manager.GetServices()
@@ -3943,7 +3946,7 @@ def ShowMenu( self, do_not_show_just_return = False ):
# info about the files
- remote_service_keys = HG.client_controller.services_manager.GetRemoteFileServiceKeys()
+ remote_service_keys = CG.client_controller.services_manager.GetRemoteFileServiceKeys()
groups_of_current_remote_service_keys = [ locations_manager.GetCurrent().intersection( remote_service_keys ) for locations_manager in selected_locations_managers ]
groups_of_pending_remote_service_keys = [ locations_manager.GetPending().intersection( remote_service_keys ) for locations_manager in selected_locations_managers ]
@@ -4246,7 +4249,7 @@ def ShowMenu( self, do_not_show_just_return = False ):
user_command_deletable_file_service_keys = local_media_file_service_keys.union( [ CC.LOCAL_UPDATE_SERVICE_KEY ] )
- local_file_service_keys_we_are_in = sorted( current_file_service_keys.intersection( user_command_deletable_file_service_keys ), key = HG.client_controller.services_manager.GetName )
+ local_file_service_keys_we_are_in = sorted( current_file_service_keys.intersection( user_command_deletable_file_service_keys ), key = CG.client_controller.services_manager.GetName )
if len( local_file_service_keys_we_are_in ) > 0:
@@ -4254,7 +4257,7 @@ def ShowMenu( self, do_not_show_just_return = False ):
for file_service_key in local_file_service_keys_we_are_in:
- service_name = HG.client_controller.services_manager.GetName( file_service_key )
+ service_name = CG.client_controller.services_manager.GetName( file_service_key )
ClientGUIMenus.AppendMenuItem( delete_menu, f'from {service_name}', f'Delete the selected files from {service_name}.', self._Delete, file_service_key )
@@ -4548,7 +4551,7 @@ def ShowMenu( self, do_not_show_just_return = False ):
hash_id_str = str( focus_singleton.GetHashId() )
- ClientGUIMenus.AppendMenuItem( copy_menu, 'file_id ({})'.format( hash_id_str ), 'Copy this file\'s internal file/hash_id.', HG.client_controller.pub, 'clipboard', 'text', hash_id_str )
+ ClientGUIMenus.AppendMenuItem( copy_menu, 'file_id ({})'.format( hash_id_str ), 'Copy this file\'s internal file/hash_id.', CG.client_controller.pub, 'clipboard', 'text', hash_id_str )
for ipfs_service_key in self._focused_media.GetLocationsManager().GetCurrent().intersection( ipfs_service_keys ):
@@ -4633,7 +4636,7 @@ def ThumbnailsReset( self ):
( thumbnail_span_width, thumbnail_span_height ) = self._GetThumbnailSpanDimensions()
- thumbnail_scroll_rate = float( HG.client_controller.new_options.GetString( 'thumbnail_scroll_rate' ) )
+ thumbnail_scroll_rate = float( CG.client_controller.new_options.GetString( 'thumbnail_scroll_rate' ) )
self.verticalScrollBar().setSingleStep( int( round( thumbnail_span_height * thumbnail_scroll_rate ) ) )
@@ -4653,7 +4656,7 @@ def TIMERAnimationUpdate( self ):
( thumbnail_span_width, thumbnail_span_height ) = self._GetThumbnailSpanDimensions()
- thumbnail_margin = HG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
+ thumbnail_margin = CG.client_controller.new_options.GetInteger( 'thumbnail_margin' )
hashes = list( self._hashes_to_thumbnails_waiting_to_be_drawn.keys() )
@@ -4734,7 +4737,7 @@ def TIMERAnimationUpdate( self ):
if len( self._hashes_to_thumbnails_waiting_to_be_drawn ) == 0:
- HG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
+ CG.client_controller.gui.UnregisterAnimationUpdateWindow( self )
@@ -4759,6 +4762,7 @@ def __init__( self, parent ):
def mousePressEvent( self, event ):
self._parent._drag_init_coordinates = QG.QCursor.pos()
+ self._parent._drag_click_timestamp_ms = HydrusTime.GetNowMS()
thumb = self._parent._GetThumbnailUnderMouse( event )
@@ -4810,13 +4814,13 @@ def paintEvent( self, event ):
y_start = self._parent._GetYStart()
- bg_colour = HG.client_controller.new_options.GetColour( CC.COLOUR_THUMBGRID_BACKGROUND )
+ bg_colour = CG.client_controller.new_options.GetColour( CC.COLOUR_THUMBGRID_BACKGROUND )
painter.setBackground( QG.QBrush( bg_colour ) )
painter.eraseRect( painter.viewport() )
- background_pixmap = HG.client_controller.bitmap_manager.GetMediaBackgroundPixmap()
+ background_pixmap = CG.client_controller.bitmap_manager.GetMediaBackgroundPixmap()
if background_pixmap is not None:
@@ -5144,9 +5148,9 @@ def GetQtImage( self, device_pixel_ratio ) -> QG.QImage:
# we don't really want to mess around with DPR here, we just want to draw thumbs
# that said, this works after a medium-high headache getting it there, so let's not get ahead of ourselves
- thumbnail_hydrus_bmp = HG.client_controller.GetCache( 'thumbnail' ).GetThumbnail( self )
+ thumbnail_hydrus_bmp = CG.client_controller.GetCache( 'thumbnail' ).GetThumbnail( self )
- thumbnail_border = HG.client_controller.new_options.GetInteger( 'thumbnail_border' )
+ thumbnail_border = CG.client_controller.new_options.GetInteger( 'thumbnail_border' )
( width, height ) = ClientData.AddPaddingToDimensions( HC.options[ 'thumbnail_dimensions' ], thumbnail_border * 2 )
@@ -5154,7 +5158,7 @@ def GetQtImage( self, device_pixel_ratio ) -> QG.QImage:
qt_image_height = int( height * device_pixel_ratio )
- qt_image = HG.client_controller.bitmap_manager.GetQtImage( qt_image_width, qt_image_height, 24 )
+ qt_image = CG.client_controller.bitmap_manager.GetQtImage( qt_image_width, qt_image_height, 24 )
qt_image.setDevicePixelRatio( device_pixel_ratio )
@@ -5202,7 +5206,7 @@ def GetQtImage( self, device_pixel_ratio ) -> QG.QImage:
painter.setRenderHint( QG.QPainter.Antialiasing, True ) # seems to do nothing, it only affects primitives?
painter.setRenderHint( QG.QPainter.SmoothPixmapTransform, True ) # makes the thumb QImage scale up and down prettily when we need it, either because it is too small or DPR gubbins
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
if not local:
@@ -5229,7 +5233,7 @@ def GetQtImage( self, device_pixel_ratio ) -> QG.QImage:
# the painter isn't getting QSS style from the qt_image, we need to set the font explitly to get font size changes from QSS etc..
- f = QG.QFont( HG.client_controller.gui.font() )
+ f = QG.QFont( CG.client_controller.gui.font() )
# this line magically fixes the bad text, as above
f.setStyleStrategy( QG.QFont.PreferAntialias )
@@ -5240,7 +5244,7 @@ def GetQtImage( self, device_pixel_ratio ) -> QG.QImage:
raw_thumbnail_qt_image = thumbnail_hydrus_bmp.GetQtImage()
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
if thumbnail_dpr_percent != 100:
@@ -5264,7 +5268,7 @@ def GetQtImage( self, device_pixel_ratio ) -> QG.QImage:
TEXT_BORDER = 1
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
tags = self.GetTagsManager().GetCurrentAndPending( CC.COMBINED_TAG_SERVICE_KEY, ClientTags.TAG_DISPLAY_SINGLE_MEDIA )
@@ -5476,9 +5480,9 @@ def GetQtImage( self, device_pixel_ratio ) -> QG.QImage:
icons_to_draw.append( CC.global_pixmaps().play )
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
- remote_file_service_keys = HG.client_controller.services_manager.GetRemoteFileServiceKeys()
+ remote_file_service_keys = CG.client_controller.services_manager.GetRemoteFileServiceKeys()
current = locations_manager.GetCurrent().intersection( remote_file_service_keys )
pending = locations_manager.GetPending().intersection( remote_file_service_keys )
diff --git a/hydrus/client/gui/pages/ClientGUIResultsSortCollect.py b/hydrus/client/gui/pages/ClientGUIResultsSortCollect.py
index 649c01f38..1b06d8538 100644
--- a/hydrus/client/gui/pages/ClientGUIResultsSortCollect.py
+++ b/hydrus/client/gui/pages/ClientGUIResultsSortCollect.py
@@ -10,6 +10,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import ClientGUIMenus
@@ -86,7 +87,7 @@ def _ReinitialiseChoices( self ):
text_and_data_tuples = set()
- for media_sort in HG.client_controller.new_options.GetDefaultNamespaceSorts():
+ for media_sort in CG.client_controller.new_options.GetDefaultNamespaceSorts():
namespaces = media_sort.GetNamespaces()
@@ -104,7 +105,7 @@ def _ReinitialiseChoices( self ):
text_and_data_tuples = sorted( ( ( namespace, ( 'namespace', namespace ) ) for namespace in text_and_data_tuples ) )
- star_ratings_services = HG.client_controller.services_manager.GetServices( HC.STAR_RATINGS_SERVICES )
+ star_ratings_services = CG.client_controller.services_manager.GetServices( HC.STAR_RATINGS_SERVICES )
for star_ratings_service in star_ratings_services:
@@ -314,7 +315,7 @@ def __init__( self, parent, media_collect = None ):
if media_collect is None:
- media_collect = HG.client_controller.new_options.GetDefaultCollect()
+ media_collect = CG.client_controller.new_options.GetDefaultCollect()
self._media_collect = media_collect
@@ -359,7 +360,7 @@ def __init__( self, parent, media_collect = None ):
self._collect_comboctrl.installEventFilter( self )
- HG.client_controller.sub( self, 'NotifyAdvancedMode', 'notify_advanced_mode' )
+ CG.client_controller.sub( self, 'NotifyAdvancedMode', 'notify_advanced_mode' )
def _BroadcastCollect( self ):
@@ -369,7 +370,7 @@ def _BroadcastCollect( self ):
def _UpdateButtonsVisible( self ):
- self._tag_context_button.setVisible( HG.client_controller.new_options.GetBoolean( 'advanced_mode' ) )
+ self._tag_context_button.setVisible( CG.client_controller.new_options.GetBoolean( 'advanced_mode' ) )
def _UpdateLabel( self ):
@@ -425,7 +426,7 @@ def GetValue( self ):
def ListenForNewOptions( self ):
- HG.client_controller.sub( self, 'NotifyNewOptions', 'notify_new_options' )
+ CG.client_controller.sub( self, 'NotifyNewOptions', 'notify_new_options' )
def NotifyAdvancedMode( self ):
@@ -599,7 +600,7 @@ def _PopulateSortMenuOrList( self, menu = None ):
- default_namespace_sorts = HG.client_controller.new_options.GetDefaultNamespaceSorts()
+ default_namespace_sorts = CG.client_controller.new_options.GetDefaultNamespaceSorts()
if menu is not None:
@@ -631,7 +632,7 @@ def _PopulateSortMenuOrList( self, menu = None ):
ClientGUIMenus.AppendMenuItem( submenu, 'custom', 'Set a custom namespace sort', self._SetCustomNamespaceSortFromUser )
- rating_service_keys = HG.client_controller.services_manager.GetServiceKeys( HC.RATINGS_SERVICES )
+ rating_service_keys = CG.client_controller.services_manager.GetServiceKeys( HC.RATINGS_SERVICES )
if len( rating_service_keys ) > 0:
@@ -767,7 +768,7 @@ def _UpdateButtonsVisible( self ):
( sort_metatype, sort_data ) = self._sort_type
- show_tag_button = sort_metatype == 'namespaces' and HG.client_controller.new_options.GetBoolean( 'advanced_mode' )
+ show_tag_button = sort_metatype == 'namespaces' and CG.client_controller.new_options.GetBoolean( 'advanced_mode' )
self._tag_context_button.setVisible( show_tag_button )
@@ -782,7 +783,7 @@ def _UpdateSortTypeLabel( self ):
( sort_metatype, sort_data ) = self._sort_type
- show_tdt = sort_metatype == 'namespaces' and HG.client_controller.new_options.GetBoolean( 'advanced_mode' )
+ show_tdt = sort_metatype == 'namespaces' and CG.client_controller.new_options.GetBoolean( 'advanced_mode' )
if show_tdt:
@@ -811,11 +812,11 @@ def _UpdateSortTypeLabel( self ):
def _UserChoseASort( self ):
- if HG.client_controller.new_options.GetBoolean( 'save_page_sort_on_change' ):
+ if CG.client_controller.new_options.GetBoolean( 'save_page_sort_on_change' ):
media_sort = self._GetCurrentSort()
- HG.client_controller.new_options.SetDefaultSort( media_sort )
+ CG.client_controller.new_options.SetDefaultSort( media_sort )
@@ -885,7 +886,7 @@ def SetSort( self, media_sort: ClientMedia.MediaSort, do_sort = False ):
def wheelEvent( self, event ):
- if HG.client_controller.new_options.GetBoolean( 'menu_choice_buttons_can_mouse_scroll' ):
+ if CG.client_controller.new_options.GetBoolean( 'menu_choice_buttons_can_mouse_scroll' ):
if self._sort_type_button.rect().contains( self._sort_type_button.mapFromGlobal( QG.QCursor.pos() ) ):
diff --git a/hydrus/client/gui/parsing/ClientGUIParsing.py b/hydrus/client/gui/parsing/ClientGUIParsing.py
index 7236c85b1..3799fe64b 100644
--- a/hydrus/client/gui/parsing/ClientGUIParsing.py
+++ b/hydrus/client/gui/parsing/ClientGUIParsing.py
@@ -14,6 +14,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDefaults
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientStrings
from hydrus.client.gui import ClientGUIDialogs
@@ -1591,9 +1592,9 @@ def qt_tidy_up( example_data, example_bytes, error ):
network_job.OverrideBandwidth()
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
- HG.client_controller.CallToThread( wait_and_do_it, network_job )
+ CG.client_controller.CallToThread( wait_and_do_it, network_job )
def GetFormula( self ):
diff --git a/hydrus/client/gui/parsing/ClientGUIParsingLegacy.py b/hydrus/client/gui/parsing/ClientGUIParsingLegacy.py
index 3d2f793e8..77c8ead1f 100644
--- a/hydrus/client/gui/parsing/ClientGUIParsingLegacy.py
+++ b/hydrus/client/gui/parsing/ClientGUIParsingLegacy.py
@@ -1,7 +1,6 @@
import os
import threading
-from qtpy import QtCore as QC
from qtpy import QtWidgets as QW
from hydrus.core import HydrusConstants as HC
@@ -12,6 +11,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientPaths
from hydrus.client import ClientSerialisable
@@ -197,7 +197,7 @@ def Copy( self ):
json = export_object.DumpToString()
- HG.client_controller.pub( 'clipboard', 'text', json )
+ CG.client_controller.pub( 'clipboard', 'text', json )
@@ -265,7 +265,7 @@ def Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -426,7 +426,7 @@ def EventTestFetchResult( self ):
network_job.OverrideBandwidth()
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
try:
@@ -502,7 +502,7 @@ def do_it( node, data, referral_url ):
data = self._example_data.toPlainText()
referral_url = self._referral_url
- HG.client_controller.CallToThread( do_it, node, data, referral_url )
+ CG.client_controller.CallToThread( do_it, node, data, referral_url )
def GetExampleData( self ):
@@ -827,7 +827,7 @@ def do_it( script, job_status, data ):
data = self._example_data.toPlainText()
- HG.client_controller.CallToThread( do_it, script, job_status, data )
+ CG.client_controller.CallToThread( do_it, script, job_status, data )
def GetExampleData( self ):
@@ -900,7 +900,7 @@ def __init__( self, parent ):
for script_type in self.SCRIPT_TYPES:
- scripts.extend( HG.client_controller.Read( 'serialisable_named', script_type ) )
+ scripts.extend( CG.client_controller.Read( 'serialisable_named', script_type ) )
for script in scripts:
@@ -1026,7 +1026,7 @@ def CommitChanges( self ):
scripts = self._scripts.GetData()
- HG.client_controller.Write( 'serialisables_overwrite', self.SCRIPT_TYPES, scripts )
+ CG.client_controller.Write( 'serialisables_overwrite', self.SCRIPT_TYPES, scripts )
def Delete( self ):
@@ -1098,7 +1098,7 @@ def ExportToClipboard( self ):
json = export_object.DumpToString()
- HG.client_controller.pub( 'clipboard', 'text', json )
+ CG.client_controller.pub( 'clipboard', 'text', json )
@@ -1123,7 +1123,7 @@ def ImportFromClipboard( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -1314,7 +1314,7 @@ def TIMERUIUpdate( self ):
if self._job_status is None:
- HG.client_controller.gui.UnregisterUIUpdateWindow( self )
+ CG.client_controller.gui.UnregisterUIUpdateWindow( self )
@@ -1360,5 +1360,5 @@ def SetJobStatus( self, job_status ):
self._job_status = job_status
- HG.client_controller.gui.RegisterUIUpdateWindow( self )
+ CG.client_controller.gui.RegisterUIUpdateWindow( self )
diff --git a/hydrus/client/gui/parsing/ClientGUIParsingTest.py b/hydrus/client/gui/parsing/ClientGUIParsingTest.py
index 30f53b37c..b20cb6589 100644
--- a/hydrus/client/gui/parsing/ClientGUIParsingTest.py
+++ b/hydrus/client/gui/parsing/ClientGUIParsingTest.py
@@ -15,6 +15,7 @@
from hydrus.core.files import HydrusFileHandling
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientStrings
from hydrus.client.gui import ClientGUIDialogs
@@ -120,7 +121,7 @@ def __init__( self, parent, object_callable, test_data: typing.Optional[ ClientP
def _Copy( self ):
- HG.client_controller.pub( 'clipboard', 'text', self._example_data_raw )
+ CG.client_controller.pub( 'clipboard', 'text', self._example_data_raw )
def _FetchFromURL( self ):
@@ -148,7 +149,7 @@ def do_it( url ):
network_job.OverrideBandwidth()
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
example_bytes = None
@@ -182,7 +183,7 @@ def do_it( url ):
url = dlg.GetValue()
- HG.client_controller.CallToThread( do_it, url )
+ CG.client_controller.CallToThread( do_it, url )
@@ -191,7 +192,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
try:
@@ -290,7 +291,7 @@ def _SetExampleData( self, example_data, example_bytes = None ):
try:
- j = HG.client_controller.parsing_cache.GetJSON( example_data )
+ j = CG.client_controller.parsing_cache.GetJSON( example_data )
example_data_to_show = json.dumps( j, indent = 4 )
@@ -495,7 +496,7 @@ def __init__( self, parent, object_callable, pre_parsing_converter_callable, tes
def _CopyPostConversion( self ):
- HG.client_controller.pub( 'clipboard', 'text', self._example_data_post_conversion )
+ CG.client_controller.pub( 'clipboard', 'text', self._example_data_post_conversion )
def _RefreshDataPreviews( self ):
@@ -627,7 +628,7 @@ def _CopyPostSeparation( self ):
joiner = os.linesep * 2
- HG.client_controller.pub( 'clipboard', 'text', joiner.join( self._example_data_post_separation ) )
+ CG.client_controller.pub( 'clipboard', 'text', joiner.join( self._example_data_post_separation ) )
def _SetExampleData( self, example_data, example_bytes = None ):
diff --git a/hydrus/client/gui/search/ClientGUIACDropdown.py b/hydrus/client/gui/search/ClientGUIACDropdown.py
index aa5ae2c4c..b6f4e3b1e 100644
--- a/hydrus/client/gui/search/ClientGUIACDropdown.py
+++ b/hydrus/client/gui/search/ClientGUIACDropdown.py
@@ -17,6 +17,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientThreading
from hydrus.client.gui import ClientGUICore as CGC
@@ -154,17 +155,17 @@ def ReadFetch(
AppendLoadingPredicate( matches, 'loading system predicates' )
- HG.client_controller.CallAfterQtSafe( win, 'read a/c exact match results', prefetch_callable, job_status, matches, parsed_autocomplete_text )
+ CG.client_controller.CallAfterQtSafe( win, 'read a/c exact match results', prefetch_callable, job_status, matches, parsed_autocomplete_text )
cache_valid = isinstance( results_cache, ClientSearchAutocomplete.PredicateResultsCacheSystem )
we_need_results = not cache_valid
- db_not_going_to_hang_if_we_hit_it = not HG.client_controller.DBCurrentlyDoingJob()
+ db_not_going_to_hang_if_we_hit_it = not CG.client_controller.DBCurrentlyDoingJob()
if we_need_results or db_not_going_to_hang_if_we_hit_it:
- predicates = HG.client_controller.Read( 'file_system_predicates', file_search_context, force_system_everything = force_system_everything )
+ predicates = CG.client_controller.Read( 'file_system_predicates', file_search_context, force_system_everything = force_system_everything )
results_cache = ClientSearchAutocomplete.PredicateResultsCacheSystem( predicates )
@@ -193,7 +194,7 @@ def ReadFetch(
try:
- media = HG.client_controller.CallBlockingToQt( win, qt_media_callable )
+ media = CG.client_controller.CallBlockingToQt( win, qt_media_callable )
except HydrusExceptions.QtDeadWindowException:
@@ -237,7 +238,7 @@ def ReadFetch(
else:
- exact_match_predicates = HG.client_controller.Read( 'autocomplete_predicates', ClientTags.TAG_DISPLAY_DISPLAY_ACTUAL, file_search_context, search_text = strict_search_text, exact_match = True, inclusive = parsed_autocomplete_text.inclusive, job_status = job_status )
+ exact_match_predicates = CG.client_controller.Read( 'autocomplete_predicates', ClientTags.TAG_DISPLAY_DISPLAY_ACTUAL, file_search_context, search_text = strict_search_text, exact_match = True, inclusive = parsed_autocomplete_text.inclusive, job_status = job_status )
small_exact_match_search = ShouldDoExactSearch( parsed_autocomplete_text )
@@ -261,13 +262,13 @@ def ReadFetch(
AppendLoadingPredicate( exact_match_matches, 'loading full results' )
- HG.client_controller.CallAfterQtSafe( win, 'read a/c exact match results', prefetch_callable, job_status, exact_match_matches, parsed_autocomplete_text )
+ CG.client_controller.CallAfterQtSafe( win, 'read a/c exact match results', prefetch_callable, job_status, exact_match_matches, parsed_autocomplete_text )
#
search_namespaces_into_full_tags = parsed_autocomplete_text.GetTagAutocompleteOptions().SearchNamespacesIntoFullTags()
- predicates = HG.client_controller.Read( 'autocomplete_predicates', ClientTags.TAG_DISPLAY_DISPLAY_ACTUAL, file_search_context, search_text = autocomplete_search_text, inclusive = parsed_autocomplete_text.inclusive, job_status = job_status, search_namespaces_into_full_tags = search_namespaces_into_full_tags )
+ predicates = CG.client_controller.Read( 'autocomplete_predicates', ClientTags.TAG_DISPLAY_DISPLAY_ACTUAL, file_search_context, search_text = autocomplete_search_text, inclusive = parsed_autocomplete_text.inclusive, job_status = job_status, search_namespaces_into_full_tags = search_namespaces_into_full_tags )
if job_status.IsCancelled():
@@ -300,7 +301,7 @@ def ReadFetch(
AppendLoadingPredicate( matches, 'calculating results' )
- HG.client_controller.CallAfterQtSafe( win, 'read a/c exact match results', prefetch_callable, job_status, matches, parsed_autocomplete_text )
+ CG.client_controller.CallAfterQtSafe( win, 'read a/c exact match results', prefetch_callable, job_status, matches, parsed_autocomplete_text )
# it is possible that media will change between calls to this, so don't cache it
@@ -375,13 +376,13 @@ def ReadFetch(
AppendLoadingPredicate( prefetch_matches, 'loading sibling data' )
- HG.client_controller.CallAfterQtSafe( win, 'read a/c exact match results', prefetch_callable, job_status, prefetch_matches, parsed_autocomplete_text )
+ CG.client_controller.CallAfterQtSafe( win, 'read a/c exact match results', prefetch_callable, job_status, prefetch_matches, parsed_autocomplete_text )
#
# now spend time fetching siblings if needed
- predicates = HG.client_controller.Read( 'media_predicates', tag_context, tags_to_count, parsed_autocomplete_text.inclusive, job_status = job_status )
+ predicates = CG.client_controller.Read( 'media_predicates', tag_context, tags_to_count, parsed_autocomplete_text.inclusive, job_status = job_status )
results_cache = ClientSearchAutocomplete.PredicateResultsCacheMedia( predicates )
@@ -425,7 +426,7 @@ def ReadFetch(
return
- HG.client_controller.CallAfterQtSafe( win, 'read a/c full results', results_callable, job_status, parsed_autocomplete_text, results_cache, matches )
+ CG.client_controller.CallAfterQtSafe( win, 'read a/c full results', results_callable, job_status, parsed_autocomplete_text, results_cache, matches )
def PutAtTopOfMatches( matches: list, predicate: ClientSearch.Predicate, insert_if_does_not_exist: bool = True ):
@@ -528,7 +529,7 @@ def WriteFetch(
else:
- original_exact_match_predicates = HG.client_controller.Read( 'autocomplete_predicates', ClientTags.TAG_DISPLAY_STORAGE, file_search_context, search_text = strict_search_text, exact_match = True, zero_count_ok = True, job_status = job_status )
+ original_exact_match_predicates = CG.client_controller.Read( 'autocomplete_predicates', ClientTags.TAG_DISPLAY_STORAGE, file_search_context, search_text = strict_search_text, exact_match = True, zero_count_ok = True, job_status = job_status )
exact_match_predicates = list( original_exact_match_predicates )
@@ -552,7 +553,7 @@ def WriteFetch(
AppendLoadingPredicate( exact_match_matches, 'loading full results' )
- HG.client_controller.CallAfterQtSafe( win, 'write a/c exact match results', prefetch_callable, job_status, exact_match_matches, parsed_autocomplete_text )
+ CG.client_controller.CallAfterQtSafe( win, 'write a/c exact match results', prefetch_callable, job_status, exact_match_matches, parsed_autocomplete_text )
if job_status.IsCancelled():
@@ -563,7 +564,7 @@ def WriteFetch(
search_namespaces_into_full_tags = parsed_autocomplete_text.GetTagAutocompleteOptions().SearchNamespacesIntoFullTags()
- predicates = HG.client_controller.Read( 'autocomplete_predicates', ClientTags.TAG_DISPLAY_STORAGE, file_search_context, search_text = autocomplete_search_text, job_status = job_status, zero_count_ok = True, search_namespaces_into_full_tags = search_namespaces_into_full_tags )
+ predicates = CG.client_controller.Read( 'autocomplete_predicates', ClientTags.TAG_DISPLAY_STORAGE, file_search_context, search_text = autocomplete_search_text, job_status = job_status, zero_count_ok = True, search_namespaces_into_full_tags = search_namespaces_into_full_tags )
if is_explicit_wildcard:
@@ -590,7 +591,7 @@ def WriteFetch(
InsertTagPredicates( matches, display_tag_service_key, parsed_autocomplete_text, allow_auto_wildcard_conversion )
- HG.client_controller.CallAfterQtSafe( win, 'write a/c full results', results_callable, job_status, parsed_autocomplete_text, results_cache, matches )
+ CG.client_controller.CallAfterQtSafe( win, 'write a/c full results', results_callable, job_status, parsed_autocomplete_text, results_cache, matches )
class ListBoxTagsPredicatesAC( ClientGUIListBoxes.ListBoxTagsPredicates ):
@@ -697,7 +698,7 @@ def SetPredicates( self, predicates, preserve_single_selection = False ):
if len( self._predicates ) > 0:
- ac_select_first_with_count = HG.client_controller.new_options.GetBoolean( 'ac_select_first_with_count' )
+ ac_select_first_with_count = CG.client_controller.new_options.GetBoolean( 'ac_select_first_with_count' )
if ac_select_first_with_count: # no matter what, selection preservation won't work well if we move selection down
@@ -800,9 +801,9 @@ def __init__( self, parent ):
self._can_intercept_unusual_key_events = True
- if self.window() == HG.client_controller.gui:
+ if self.window() == CG.client_controller.gui:
- use_float_mode = HG.client_controller.new_options.GetBoolean( 'autocomplete_float_main_gui' )
+ use_float_mode = CG.client_controller.new_options.GetBoolean( 'autocomplete_float_main_gui' )
else:
@@ -935,15 +936,15 @@ def __init__( self, parent ):
- HG.client_controller.sub( self, '_UpdateBackgroundColour', 'notify_new_colourset' )
- HG.client_controller.sub( self, 'DoDropdownHideShow', 'notify_page_change' )
+ CG.client_controller.sub( self, '_UpdateBackgroundColour', 'notify_new_colourset' )
+ CG.client_controller.sub( self, 'DoDropdownHideShow', 'notify_page_change' )
self._ScheduleResultsRefresh( 0.0 )
- HG.client_controller.CallLaterQtSafe( self, 0.05, 'hide/show dropdown', self._DropdownHideShow )
+ CG.client_controller.CallLaterQtSafe( self, 0.05, 'hide/show dropdown', self._DropdownHideShow )
# trying a second go to see if that improves some positioning
- HG.client_controller.CallLaterQtSafe( self, 0.25, 'hide/show dropdown', self._DropdownHideShow )
+ CG.client_controller.CallLaterQtSafe( self, 0.25, 'hide/show dropdown', self._DropdownHideShow )
def _BroadcastChoices( self, predicates, shift_down ):
@@ -1071,7 +1072,7 @@ def _ScheduleResultsRefresh( self, delay ):
self._schedule_results_refresh_job.Cancel()
- self._schedule_results_refresh_job = HG.client_controller.CallLaterQtSafe( self, delay, 'a/c results refresh', self._UpdateSearchResults )
+ self._schedule_results_refresh_job = CG.client_controller.CallLaterQtSafe( self, delay, 'a/c results refresh', self._UpdateSearchResults )
def _SetupTopListBox( self ):
@@ -1161,7 +1162,7 @@ def _TakeResponsibilityForEnter( self, shift_down ):
def _UpdateBackgroundColour( self ):
- colour = HG.client_controller.new_options.GetColour( CC.COLOUR_AUTOCOMPLETE_BACKGROUND )
+ colour = CG.client_controller.new_options.GetColour( CC.COLOUR_AUTOCOMPLETE_BACKGROUND )
if not self._can_intercept_unusual_key_events:
@@ -1203,7 +1204,7 @@ def DoDropdownHideShow( self ):
def keyPressFilter( self, event ):
- HG.client_controller.ResetIdleTimer()
+ CG.client_controller.ResetIdleTimer()
( modifier, key ) = ClientGUIShortcuts.ConvertKeyEventToSimpleTuple( event )
@@ -1252,7 +1253,7 @@ def keyPressFilter( self, event ):
def EventCloseDropdown( self, event ):
- HG.client_controller.gui.close()
+ CG.client_controller.gui.close()
return True
@@ -1537,9 +1538,9 @@ class AutoCompleteDropdownTags( AutoCompleteDropdown ):
def __init__( self, parent, location_context: ClientLocation.LocationContext, tag_service_key ):
- location_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ location_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
- if not HG.client_controller.services_manager.ServiceExists( tag_service_key ):
+ if not CG.client_controller.services_manager.ServiceExists( tag_service_key ):
tag_service_key = CC.COMBINED_TAG_SERVICE_KEY
@@ -1550,7 +1551,7 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext, ta
AutoCompleteDropdown.__init__( self, parent )
- tag_service = HG.client_controller.services_manager.GetService( self._tag_service_key )
+ tag_service = CG.client_controller.services_manager.GetService( self._tag_service_key )
self._location_context_button = ClientGUILocation.LocationSearchContextButton( self._dropdown_window, location_context, is_paired_with_tag_domain = True )
self._location_context_button.setMinimumWidth( 20 )
@@ -1571,8 +1572,8 @@ def __init__( self, parent, location_context: ClientLocation.LocationContext, ta
self._location_context_button.locationChanged.connect( self._LocationContextJustChanged )
self._tag_context_button.valueChanged.connect( self._TagContextJustChanged )
- HG.client_controller.sub( self, 'RefreshFavouriteTags', 'notify_new_favourite_tags' )
- HG.client_controller.sub( self, 'NotifyNewServices', 'notify_new_services' )
+ CG.client_controller.sub( self, 'RefreshFavouriteTags', 'notify_new_favourite_tags' )
+ CG.client_controller.sub( self, 'NotifyNewServices', 'notify_new_services' )
def _BroadcastChoices( self, predicates, shift_down ):
@@ -1589,7 +1590,7 @@ def _GetParsedAutocompleteText( self ) -> ClientSearchAutocomplete.ParsedAutocom
collapse_search_characters = True
- tag_autocomplete_options = HG.client_controller.tag_display_manager.GetTagAutocompleteOptions( self._tag_service_key )
+ tag_autocomplete_options = CG.client_controller.tag_display_manager.GetTagAutocompleteOptions( self._tag_service_key )
parsed_autocomplete_text = ClientSearchAutocomplete.ParsedAutocompleteText( self._text_ctrl.text(), tag_autocomplete_options, collapse_search_characters )
@@ -1612,7 +1613,7 @@ def _LocationContextJustChanged( self, location_context: ClientLocation.Location
if location_context.IsAllKnownFiles() and self._tag_service_key == CC.COMBINED_TAG_SERVICE_KEY:
- top_local_tag_service_key = HG.client_controller.services_manager.GetDefaultLocalTagService().GetServiceKey()
+ top_local_tag_service_key = CG.client_controller.services_manager.GetDefaultLocalTagService().GetServiceKey()
self._SetTagService( top_local_tag_service_key )
@@ -1626,7 +1627,7 @@ def _SetLocationContext( self, location_context: ClientLocation.LocationContext
location_context = location_context.Duplicate()
- location_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ location_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
if location_context == self._location_context_button.GetValue():
@@ -1635,7 +1636,7 @@ def _SetLocationContext( self, location_context: ClientLocation.LocationContext
if location_context.IsAllKnownFiles() and self._tag_service_key == CC.COMBINED_TAG_SERVICE_KEY:
- local_tag_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) )
+ local_tag_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) )
self._SetTagService( local_tag_services[0].GetServiceKey() )
@@ -1654,14 +1655,14 @@ def _SetResultsToList( self, results, parsed_autocomplete_text: ClientSearchAuto
def _SetTagService( self, tag_service_key ):
- if not HG.client_controller.services_manager.ServiceExists( tag_service_key ):
+ if not CG.client_controller.services_manager.ServiceExists( tag_service_key ):
tag_service_key = CC.COMBINED_TAG_SERVICE_KEY
if tag_service_key == CC.COMBINED_TAG_SERVICE_KEY and self._location_context_button.GetValue().IsAllKnownFiles():
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._SetLocationContext( default_location_context )
@@ -1696,14 +1697,14 @@ def _TagContextJustChanged( self, tag_context: ClientSearch.TagContext ):
tag_service_key = tag_context.service_key
- if not HG.client_controller.services_manager.ServiceExists( tag_service_key ):
+ if not CG.client_controller.services_manager.ServiceExists( tag_service_key ):
tag_service_key = CC.COMBINED_TAG_SERVICE_KEY
if tag_service_key == CC.COMBINED_TAG_SERVICE_KEY and self._location_context_button.GetValue().IsAllKnownFiles():
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._SetLocationContext( default_location_context )
@@ -1743,7 +1744,7 @@ def NotifyNewServices( self ):
def RefreshFavouriteTags( self ):
- favourite_tags = sorted( HG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
+ favourite_tags = sorted( CG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
predicates = [ ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_TAG, value = tag ) for tag in favourite_tags ]
@@ -1864,7 +1865,7 @@ def __init__( self, parent: QW.QWidget, page_key, file_search_context: ClientSea
self._or_basic = ClientGUICommon.BetterButton( self._dropdown_window, 'OR', self._CreateNewOR )
self._or_basic.setToolTip( 'Create a new empty OR predicate in the dialog.' )
- if not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
self._or_basic.hide()
@@ -1872,7 +1873,7 @@ def __init__( self, parent: QW.QWidget, page_key, file_search_context: ClientSea
self._or_advanced = ClientGUICommon.BetterButton( self._dropdown_window, 'advanced', self._AdvancedORInput )
self._or_advanced.setToolTip( 'You can paste complicated predicate strings in here and it will parse into proper logic.' )
- if not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
self._or_advanced.hide()
@@ -2044,7 +2045,7 @@ def _FavouriteSearchesMenu( self ):
ClientGUIMenus.AppendMenuItem( menu, 'save this search', 'Save this search for later.', self._SaveFavouriteSearch )
- folders_to_names = HG.client_controller.favourite_search_manager.GetFoldersToNames()
+ folders_to_names = CG.client_controller.favourite_search_manager.GetFoldersToNames()
if len( folders_to_names ) > 0:
@@ -2146,7 +2147,7 @@ def _InitFavouritesList( self ):
if self._fixed_results_list_height is None:
- height_num_chars = HG.client_controller.new_options.GetInteger( 'ac_read_list_height_num_chars' )
+ height_num_chars = CG.client_controller.new_options.GetInteger( 'ac_read_list_height_num_chars' )
else:
@@ -2162,7 +2163,7 @@ def _InitSearchResultsList( self ):
if self._fixed_results_list_height is None:
- height_num_chars = HG.client_controller.new_options.GetInteger( 'ac_read_list_height_num_chars' )
+ height_num_chars = CG.client_controller.new_options.GetInteger( 'ac_read_list_height_num_chars' )
else:
@@ -2183,7 +2184,7 @@ def _LocationContextJustChanged( self, location_context: ClientLocation.Location
def _LoadFavouriteSearch( self, folder_name, name ):
- ( file_search_context, synchronised, media_sort, media_collect ) = HG.client_controller.favourite_search_manager.GetFavouriteSearch( folder_name, name )
+ ( file_search_context, synchronised, media_sort, media_collect ) = CG.client_controller.favourite_search_manager.GetFavouriteSearch( folder_name, name )
self.blockSignals( True )
@@ -2213,7 +2214,7 @@ def _ManageFavouriteSearches( self, favourite_search_row_to_save = None ):
from hydrus.client.gui.search import ClientGUISearchPanels
- favourite_searches_rows = HG.client_controller.favourite_search_manager.GetFavouriteSearchRows()
+ favourite_searches_rows = CG.client_controller.favourite_search_manager.GetFavouriteSearchRows()
title = 'edit favourite searches'
@@ -2227,7 +2228,7 @@ def _ManageFavouriteSearches( self, favourite_search_row_to_save = None ):
edited_favourite_searches_rows = panel.GetValue()
- HG.client_controller.favourite_search_manager.SetFavouriteSearchRows( edited_favourite_searches_rows )
+ CG.client_controller.favourite_search_manager.SetFavouriteSearchRows( edited_favourite_searches_rows )
@@ -2236,7 +2237,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -2257,7 +2258,7 @@ def _Paste( self ):
collapse_search_characters = True
- tag_autocomplete_options = HG.client_controller.tag_display_manager.GetTagAutocompleteOptions( self._tag_service_key )
+ tag_autocomplete_options = CG.client_controller.tag_display_manager.GetTagAutocompleteOptions( self._tag_service_key )
pat = ClientSearchAutocomplete.ParsedAutocompleteText( text, tag_autocomplete_options, collapse_search_characters = collapse_search_characters )
@@ -2393,7 +2394,7 @@ def _StartSearchResultsFetchJob( self, job_status ):
under_construction_or_predicate = self._under_construction_or_predicate.Duplicate()
- HG.client_controller.CallToThread( ReadFetch, self, job_status, self.SetPrefetchResults, self.SetFetchedResults, parsed_autocomplete_text, self._media_callable, fsc, self._search_pause_play.IsOn(), self._include_unusual_predicate_types, self._results_cache, under_construction_or_predicate, self._force_system_everything )
+ CG.client_controller.CallToThread( ReadFetch, self, job_status, self.SetPrefetchResults, self.SetFetchedResults, parsed_autocomplete_text, self._media_callable, fsc, self._search_pause_play.IsOn(), self._include_unusual_predicate_types, self._results_cache, under_construction_or_predicate, self._force_system_everything )
def _ShouldTakeResponsibilityForEnter( self ):
@@ -2606,7 +2607,7 @@ def __init__( self, parent: AutoCompleteDropdownTagsRead, page_key, initial_pred
self._DataHasChanged()
- HG.client_controller.sub( self, 'EnterPredicates', 'enter_predicates' )
+ CG.client_controller.sub( self, 'EnterPredicates', 'enter_predicates' )
def _Activate( self, ctrl_down, shift_down ) -> bool:
@@ -2839,9 +2840,9 @@ def __init__( self, parent, chosen_tag_callable, location_context, tag_service_k
self._chosen_tag_callable = chosen_tag_callable
self._tag_service_key_changed_callable = tag_service_key_changed_callable
- service = HG.client_controller.services_manager.GetService( tag_service_key )
+ service = CG.client_controller.services_manager.GetService( tag_service_key )
- tag_autocomplete_options = HG.client_controller.tag_display_manager.GetTagAutocompleteOptions( tag_service_key )
+ tag_autocomplete_options = CG.client_controller.tag_display_manager.GetTagAutocompleteOptions( tag_service_key )
( location_context, tag_service_key ) = tag_autocomplete_options.GetWriteAutocompleteSearchDomain( location_context )
@@ -2921,26 +2922,26 @@ def _GetParsedAutocompleteText( self ) -> ClientSearchAutocomplete.ParsedAutocom
def _InitFavouritesList( self ):
- height_num_chars = HG.client_controller.new_options.GetInteger( 'ac_write_list_height_num_chars' )
+ height_num_chars = CG.client_controller.new_options.GetInteger( 'ac_write_list_height_num_chars' )
favs_list = ListBoxTagsStringsAC( self._dropdown_notebook, self.BroadcastChoices, self._display_tag_service_key, self._float_mode, tag_display_type = ClientTags.TAG_DISPLAY_STORAGE, height_num_chars = height_num_chars )
- favs_list.SetExtraParentRowsAllowed( HG.client_controller.new_options.GetBoolean( 'expand_parents_on_storage_autocomplete_taglists' ) )
- favs_list.SetParentDecoratorsAllowed( HG.client_controller.new_options.GetBoolean( 'show_parent_decorators_on_storage_autocomplete_taglists' ) )
- favs_list.SetSiblingDecoratorsAllowed( HG.client_controller.new_options.GetBoolean( 'show_sibling_decorators_on_storage_autocomplete_taglists' ) )
+ favs_list.SetExtraParentRowsAllowed( CG.client_controller.new_options.GetBoolean( 'expand_parents_on_storage_autocomplete_taglists' ) )
+ favs_list.SetParentDecoratorsAllowed( CG.client_controller.new_options.GetBoolean( 'show_parent_decorators_on_storage_autocomplete_taglists' ) )
+ favs_list.SetSiblingDecoratorsAllowed( CG.client_controller.new_options.GetBoolean( 'show_sibling_decorators_on_storage_autocomplete_taglists' ) )
return favs_list
def _InitSearchResultsList( self ):
- height_num_chars = HG.client_controller.new_options.GetInteger( 'ac_write_list_height_num_chars' )
+ height_num_chars = CG.client_controller.new_options.GetInteger( 'ac_write_list_height_num_chars' )
preds_list = ListBoxTagsPredicatesAC( self._dropdown_notebook, self.BroadcastChoices, self._display_tag_service_key, self._float_mode, tag_display_type = ClientTags.TAG_DISPLAY_STORAGE, height_num_chars = height_num_chars )
- preds_list.SetExtraParentRowsAllowed( HG.client_controller.new_options.GetBoolean( 'expand_parents_on_storage_autocomplete_taglists' ) )
- preds_list.SetParentDecoratorsAllowed( HG.client_controller.new_options.GetBoolean( 'show_parent_decorators_on_storage_autocomplete_taglists' ) )
- preds_list.SetSiblingDecoratorsAllowed( HG.client_controller.new_options.GetBoolean( 'show_sibling_decorators_on_storage_autocomplete_taglists' ) )
+ preds_list.SetExtraParentRowsAllowed( CG.client_controller.new_options.GetBoolean( 'expand_parents_on_storage_autocomplete_taglists' ) )
+ preds_list.SetParentDecoratorsAllowed( CG.client_controller.new_options.GetBoolean( 'show_parent_decorators_on_storage_autocomplete_taglists' ) )
+ preds_list.SetSiblingDecoratorsAllowed( CG.client_controller.new_options.GetBoolean( 'show_sibling_decorators_on_storage_autocomplete_taglists' ) )
return preds_list
@@ -2949,7 +2950,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
@@ -3006,7 +3007,7 @@ def _StartSearchResultsFetchJob( self, job_status ):
file_search_context = ClientSearch.FileSearchContext( location_context = self._location_context_button.GetValue(), tag_context = tag_context )
- HG.client_controller.CallToThread( WriteFetch, self, job_status, self.SetPrefetchResults, self.SetFetchedResults, parsed_autocomplete_text, file_search_context, self._results_cache )
+ CG.client_controller.CallToThread( WriteFetch, self, job_status, self.SetPrefetchResults, self.SetFetchedResults, parsed_autocomplete_text, file_search_context, self._results_cache )
def _TakeResponsibilityForEnter( self, shift_down ):
@@ -3030,7 +3031,7 @@ def _TakeResponsibilityForEnter( self, shift_down ):
def RefreshFavouriteTags( self ):
- favourite_tags = sorted( HG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
+ favourite_tags = sorted( CG.client_controller.new_options.GetStringList( 'favourite_tags' ) )
self._favourites_list.SetTags( favourite_tags )
diff --git a/hydrus/client/gui/search/ClientGUILocation.py b/hydrus/client/gui/search/ClientGUILocation.py
index 12f54054b..00996f732 100644
--- a/hydrus/client/gui/search/ClientGUILocation.py
+++ b/hydrus/client/gui/search/ClientGUILocation.py
@@ -5,6 +5,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIFunctions
@@ -38,7 +39,7 @@ def __init__( self, parent: QW.QWidget, location_context: ClientLocation.Locatio
self._location_list.Append( name, ( HC.CONTENT_STATUS_CURRENT, service_key ), starts_checked = starts_checked )
- advanced_mode = HG.client_controller.new_options.GetBoolean( 'advanced_mode' )
+ advanced_mode = CG.client_controller.new_options.GetBoolean( 'advanced_mode' )
if advanced_mode and not only_local_file_domains_allowed:
@@ -81,7 +82,7 @@ def _ClearSurplusServices( self ):
location_context = self._GetValue()
- location_context.ClearSurplusLocalFilesServices( HG.client_controller.services_manager.GetServiceType )
+ location_context.ClearSurplusLocalFilesServices( CG.client_controller.services_manager.GetServiceType )
if set( location_context.GetStatusesAndServiceKeysList() ) != set( self._location_list.GetValue() ):
@@ -220,7 +221,7 @@ def _IsAllKnownFilesServiceTypeAllowed( self ) -> bool:
if self._all_known_files_allowed:
- if self._all_known_files_allowed_only_in_advanced_mode and not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if self._all_known_files_allowed_only_in_advanced_mode and not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
return False
@@ -255,7 +256,7 @@ def SetValue( self, location_context: ClientLocation.LocationContext, force_labe
location_context = location_context.Duplicate()
- location_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ location_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
if not force_label:
@@ -273,7 +274,7 @@ def SetValue( self, location_context: ClientLocation.LocationContext, force_labe
else:
- text = self._location_context.ToString( HG.client_controller.services_manager.GetName )
+ text = self._location_context.ToString( CG.client_controller.services_manager.GetName )
self.setText( text )
diff --git a/hydrus/client/gui/search/ClientGUIPredicatesMultiple.py b/hydrus/client/gui/search/ClientGUIPredicatesMultiple.py
index e2e32ee9f..b9b5a6c84 100644
--- a/hydrus/client/gui/search/ClientGUIPredicatesMultiple.py
+++ b/hydrus/client/gui/search/ClientGUIPredicatesMultiple.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIRatings
from hydrus.client.gui import QtPorting as QP
from hydrus.client.gui.search import ClientGUIPredicatesSingle
@@ -22,7 +23,7 @@ def __init__( self, parent: QW.QWidget, service_key: bytes, predicate: typing.Op
self._service_key = service_key
- service = HG.client_controller.services_manager.GetService( self._service_key )
+ service = CG.client_controller.services_manager.GetService( self._service_key )
name = service.GetName()
@@ -112,7 +113,7 @@ def __init__( self, parent: QW.QWidget, service_key: bytes, predicate: typing.Op
self._service_key = service_key
- service = HG.client_controller.services_manager.GetService( self._service_key )
+ service = CG.client_controller.services_manager.GetService( self._service_key )
name = service.GetName()
@@ -248,7 +249,7 @@ def __init__( self, parent: QW.QWidget, service_key: bytes, predicate: typing.Op
self._service_key = service_key
- service = HG.client_controller.services_manager.GetService( self._service_key )
+ service = CG.client_controller.services_manager.GetService( self._service_key )
name = service.GetName()
@@ -422,7 +423,7 @@ def __init__( self, parent, predicates ):
#
- local_like_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
+ local_like_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
gridbox = QP.GridLayout( cols = 5 )
@@ -454,7 +455,7 @@ def __init__( self, parent, predicates ):
#
- local_numerical_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, ) )
+ local_numerical_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, ) )
for service in local_numerical_services:
@@ -476,7 +477,7 @@ def __init__( self, parent, predicates ):
#
- local_incdec_services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_INCDEC, ) )
+ local_incdec_services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_INCDEC, ) )
for service in local_incdec_services:
@@ -510,7 +511,7 @@ def __init__( self, parent, predicates ):
def _FilterWhatICanEdit( self, predicates: typing.Collection[ ClientSearch.Predicate ] ) -> typing.Collection[ ClientSearch.Predicate ]:
- local_rating_service_keys = HG.client_controller.services_manager.GetServiceKeys( HC.RATINGS_SERVICES )
+ local_rating_service_keys = CG.client_controller.services_manager.GetServiceKeys( HC.RATINGS_SERVICES )
good_predicates = []
@@ -541,7 +542,7 @@ def _GetPredicatesToInitialisePanelWith( self, predicates: typing.Collection[ Cl
return predicates
- custom_default_predicates = HG.client_controller.new_options.GetCustomDefaultSystemPredicates( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_RATING )
+ custom_default_predicates = CG.client_controller.new_options.GetCustomDefaultSystemPredicates( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_RATING )
custom_default_predicates = self._FilterWhatICanEdit( custom_default_predicates )
@@ -557,7 +558,7 @@ def _GetPredicatesToInitialisePanelWith( self, predicates: typing.Collection[ Cl
def ClearCustomDefault( self ):
- HG.client_controller.new_options.ClearCustomDefaultSystemPredicates( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_RATING )
+ CG.client_controller.new_options.ClearCustomDefaultSystemPredicates( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_RATING )
def GetDefaultPredicates( self ):
@@ -581,12 +582,12 @@ def SaveCustomDefault( self ):
predicates = self.GetPredicates()
- HG.client_controller.new_options.SetCustomDefaultSystemPredicates( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_RATING, predicates = predicates )
+ CG.client_controller.new_options.SetCustomDefaultSystemPredicates( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_RATING, predicates = predicates )
def UsesCustomDefault( self ) -> bool:
- custom_default_predicates = HG.client_controller.new_options.GetCustomDefaultSystemPredicates( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_RATING )
+ custom_default_predicates = CG.client_controller.new_options.GetCustomDefaultSystemPredicates( predicate_type = ClientSearch.PREDICATE_TYPE_SYSTEM_RATING )
custom_default_predicates = self._FilterWhatICanEdit( custom_default_predicates )
diff --git a/hydrus/client/gui/search/ClientGUIPredicatesOR.py b/hydrus/client/gui/search/ClientGUIPredicatesOR.py
index 381ebb08e..7e1461207 100644
--- a/hydrus/client/gui/search/ClientGUIPredicatesOR.py
+++ b/hydrus/client/gui/search/ClientGUIPredicatesOR.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import QtPorting as QP
from hydrus.client.search import ClientSearch
@@ -34,7 +35,7 @@ def __init__( self, parent: QW.QWidget, predicate: ClientSearch.Predicate ):
page_key = HydrusData.GenerateKey()
- location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
file_search_context = ClientSearch.FileSearchContext( location_context = location_context, predicates = predicates )
diff --git a/hydrus/client/gui/search/ClientGUIPredicatesSingle.py b/hydrus/client/gui/search/ClientGUIPredicatesSingle.py
index 1b9458a2c..28f71bc82 100644
--- a/hydrus/client/gui/search/ClientGUIPredicatesSingle.py
+++ b/hydrus/client/gui/search/ClientGUIPredicatesSingle.py
@@ -13,6 +13,7 @@
from hydrus.core.files.images import HydrusImageHandling
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientImageHandling
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIFunctions
@@ -308,7 +309,7 @@ def _GetPredicateToInitialisePanelWith( self, predicate: ClientSearch.Predicate
return predicate
- custom_defaults = HG.client_controller.new_options.GetCustomDefaultSystemPredicates( comparable_predicate = default_predicate )
+ custom_defaults = CG.client_controller.new_options.GetCustomDefaultSystemPredicates( comparable_predicate = default_predicate )
if len( custom_defaults ) > 0:
@@ -322,7 +323,7 @@ def ClearCustomDefault( self ):
default_predicate = self.GetDefaultPredicate()
- HG.client_controller.new_options.ClearCustomDefaultSystemPredicates( comparable_predicate = default_predicate )
+ CG.client_controller.new_options.ClearCustomDefaultSystemPredicates( comparable_predicate = default_predicate )
def GetDefaultPredicate( self ) -> ClientSearch.Predicate:
@@ -339,14 +340,14 @@ def SaveCustomDefault( self ):
predicates = self.GetPredicates()
- HG.client_controller.new_options.SetCustomDefaultSystemPredicates( comparable_predicates = predicates )
+ CG.client_controller.new_options.SetCustomDefaultSystemPredicates( comparable_predicates = predicates )
def UsesCustomDefault( self ) -> bool:
default_predicate = self.GetDefaultPredicate()
- custom_defaults = HG.client_controller.new_options.GetCustomDefaultSystemPredicates( comparable_predicate = default_predicate )
+ custom_defaults = CG.client_controller.new_options.GetCustomDefaultSystemPredicates( comparable_predicate = default_predicate )
return len( custom_defaults ) > 0
@@ -882,7 +883,7 @@ def __init__( self, parent, predicate ):
self._status = ClientGUICommon.BetterRadioBox( self, choices = choices, vertical = True )
- services = HG.client_controller.services_manager.GetServices( HC.REAL_FILE_SERVICES )
+ services = CG.client_controller.services_manager.GetServices( HC.REAL_FILE_SERVICES )
choices = [ ( service.GetName(), service.GetServiceKey() ) for service in services ]
@@ -1542,7 +1543,7 @@ def __init__( self, parent, predicate ):
self._url_classes = ClientGUICommon.BetterChoice( self )
- for url_class in HG.client_controller.network_engine.domain_manager.GetURLClasses():
+ for url_class in CG.client_controller.network_engine.domain_manager.GetURLClasses():
if url_class.ShouldAssociateWithFiles():
@@ -2181,11 +2182,11 @@ def _Clear( self ):
def _Paste( self ):
- if HG.client_controller.ClipboardHasImage():
+ if CG.client_controller.ClipboardHasImage():
try:
- qt_image = HG.client_controller.GetClipboardImage()
+ qt_image = CG.client_controller.GetClipboardImage()
numpy_image = ClientGUIFunctions.ConvertQtImageToNumPy( qt_image )
@@ -2206,7 +2207,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
diff --git a/hydrus/client/gui/search/ClientGUISearch.py b/hydrus/client/gui/search/ClientGUISearch.py
index 62f7c59d3..1602f1ed3 100644
--- a/hydrus/client/gui/search/ClientGUISearch.py
+++ b/hydrus/client/gui/search/ClientGUISearch.py
@@ -9,6 +9,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIFunctions
@@ -93,7 +94,7 @@ def EditPredicates( widget: QW.QWidget, predicates: typing.Collection[ ClientSea
edited_predicates = panel.GetValue()
- HG.client_controller.new_options.PushRecentPredicates( edited_predicates )
+ CG.client_controller.new_options.PushRecentPredicates( edited_predicates )
result = list( non_editable_predicates )
result.extend( edited_predicates )
@@ -164,7 +165,7 @@ def FleshOutPredicates( widget: QW.QWidget, predicates: typing.Collection[ Clien
preds = panel.GetValue()
- HG.client_controller.new_options.PushRecentPredicates( preds )
+ CG.client_controller.new_options.PushRecentPredicates( preds )
good_predicates.extend( preds )
@@ -698,7 +699,7 @@ def __init__( self, parent, predicate: ClientSearch.Predicate ):
elif predicate_type == ClientSearch.PREDICATE_TYPE_SYSTEM_RATING:
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
ratings_services = services_manager.GetServices( HC.RATINGS_SERVICES )
@@ -785,7 +786,7 @@ def __init__( self, parent, predicate: ClientSearch.Predicate ):
if len( recent_predicate_types ) > 0:
- recent_predicates = HG.client_controller.new_options.GetRecentPredicates( recent_predicate_types )
+ recent_predicates = CG.client_controller.new_options.GetRecentPredicates( recent_predicate_types )
recent_predicates = [ pred for pred in recent_predicates if pred not in all_static_preds ]
@@ -862,7 +863,7 @@ def StaticRemoveButtonClicked( self, button: ClientGUIPredicatesSingle.StaticSys
for predicate in predicates:
- HG.client_controller.new_options.RemoveRecentPredicate( predicate )
+ CG.client_controller.new_options.RemoveRecentPredicate( predicate )
button.hide()
@@ -978,7 +979,7 @@ def __init__( self, parent: QW.QWidget, tag_context: ClientSearch.TagContext, us
def _Edit( self ):
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
service_types_in_order = [ HC.LOCAL_TAG, HC.TAG_REPOSITORY, HC.COMBINED_TAG ]
@@ -1016,11 +1017,11 @@ def SetValue( self, tag_context: ClientSearch.TagContext ):
tag_context = tag_context.Duplicate()
- tag_context.FixMissingServices( HG.client_controller.services_manager.FilterValidServiceKeys )
+ tag_context.FixMissingServices( CG.client_controller.services_manager.FilterValidServiceKeys )
self._tag_context = tag_context
- label = self._tag_context.ToString( HG.client_controller.services_manager.GetName )
+ label = self._tag_context.ToString( CG.client_controller.services_manager.GetName )
if self._use_short_label:
diff --git a/hydrus/client/gui/search/ClientGUISearchPanels.py b/hydrus/client/gui/search/ClientGUISearchPanels.py
index 7468c4c3f..1ec018afc 100644
--- a/hydrus/client/gui/search/ClientGUISearchPanels.py
+++ b/hydrus/client/gui/search/ClientGUISearchPanels.py
@@ -9,7 +9,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
-from hydrus.client import ClientLocation
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import ClientGUIDialogsQuick
from hydrus.client.gui import ClientGUIScrolledPanels
@@ -201,7 +201,7 @@ def __init__( self, parent, favourite_searches_rows, initial_search_row_to_edit
if initial_search_row_to_edit is not None:
- HG.client_controller.CallLaterQtSafe( self, 0.5, 'add new favourite search', self._AddNewFavouriteSearch, initial_search_row_to_edit )
+ CG.client_controller.CallLaterQtSafe( self, 0.5, 'add new favourite search', self._AddNewFavouriteSearch, initial_search_row_to_edit )
@@ -216,7 +216,7 @@ def _AddNewFavouriteSearch( self, search_row = None ):
foldername = None
name = 'new favourite search'
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
file_search_context = ClientSearch.FileSearchContext( location_context = default_location_context )
diff --git a/hydrus/client/gui/services/ClientGUIClientsideServices.py b/hydrus/client/gui/services/ClientGUIClientsideServices.py
index b7e7fc050..8bb8ae06a 100644
--- a/hydrus/client/gui/services/ClientGUIClientsideServices.py
+++ b/hydrus/client/gui/services/ClientGUIClientsideServices.py
@@ -12,13 +12,13 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusPaths
from hydrus.core import HydrusSerialisable
-from hydrus.core import HydrusTagArchive
from hydrus.core import HydrusTime
from hydrus.core.networking import HydrusNetwork
from hydrus.core.networking import HydrusNetworkVariableHandling
from hydrus.client import ClientAPI
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientPaths
from hydrus.client import ClientServices
@@ -70,7 +70,7 @@ def __init__( self, parent, auto_account_creation_service_key = None ):
#
- self._original_services = HG.client_controller.services_manager.GetServices()
+ self._original_services = CG.client_controller.services_manager.GetServices()
self._listctrl.AddDatas( self._original_services )
@@ -93,7 +93,7 @@ def __init__( self, parent, auto_account_creation_service_key = None ):
if auto_account_creation_service_key is not None:
- HG.client_controller.CallLaterQtSafe( self, 1.2, 'auto-account creation spawn', self._Edit, auto_account_creation_service_key = auto_account_creation_service_key )
+ CG.client_controller.CallLaterQtSafe( self, 1.2, 'auto-account creation spawn', self._Edit, auto_account_creation_service_key = auto_account_creation_service_key )
@@ -200,7 +200,7 @@ def _Delete( self ):
if service.GetServiceType() == service_type and service in self._original_services:
- service_info = HG.client_controller.Read( 'service_info', service.GetServiceKey() )
+ service_info = CG.client_controller.Read( 'service_info', service.GetServiceKey() )
num_files = service_info[ HC.SERVICE_INFO_NUM_FILES ]
@@ -280,7 +280,7 @@ def CommitChanges( self ):
services = self._listctrl.GetData()
- HG.client_controller.SetServices( services )
+ CG.client_controller.SetServices( services )
def UserIsOKToOK( self ):
@@ -544,7 +544,7 @@ def do_it():
network_job.SetForLogin( True )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
try:
@@ -588,7 +588,7 @@ def do_it():
self._test_address_button.setEnabled( False )
self._test_address_button.setText( 'testing' + HC.UNICODE_ELLIPSIS )
- HG.client_controller.CallToThread( do_it )
+ CG.client_controller.CallToThread( do_it )
def GetCredentials( self ):
@@ -684,7 +684,7 @@ def __init__( self, parent, service_key, remote_panel: EditServiceRemoteSubPanel
if auto_account_creation_service_key is not None:
- HG.client_controller.CallLaterQtSafe( self, 1.2, 'auto-account service spawn', self._STARTFetchAutoAccountCreationAccountTypes )
+ CG.client_controller.CallLaterQtSafe( self, 1.2, 'auto-account service spawn', self._STARTFetchAutoAccountCreationAccountTypes )
@@ -726,7 +726,7 @@ def work_callable():
network_job.SetForLogin( True )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -819,7 +819,7 @@ def work_callable():
network_job.SetForLogin( True )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -869,7 +869,7 @@ def work_callable():
network_job.SetForLogin( True )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
network_job.WaitUntilDone()
@@ -1088,7 +1088,7 @@ def GetValue( self ):
network_context = ClientNetworkingContexts.NetworkContext( CC.NETWORK_CONTEXT_HYDRUS, self._service_key )
- HG.client_controller.network_engine.session_manager.ClearSession( network_context )
+ CG.client_controller.network_engine.session_manager.ClearSession( network_context )
dictionary_part[ 'credentials' ] = credentials
@@ -1499,7 +1499,7 @@ def __init__( self, parent, dictionary ):
abs_initial_dict = {}
- media_base_locations = HG.client_controller.client_files_manager.GetCurrentFileBaseLocations()
+ media_base_locations = CG.client_controller.client_files_manager.GetCurrentFileBaseLocations()
all_base_location_paths = { base_location.path for base_location in media_base_locations }
@@ -1629,7 +1629,7 @@ def __init__( self, parent, service ):
self._id_button.setFixedWidth( width )
- self._service_key_button = ClientGUICommon.BetterButton( self, 'copy service key', HG.client_controller.pub, 'clipboard', 'text', service.GetServiceKey().hex() )
+ self._service_key_button = ClientGUICommon.BetterButton( self, 'copy service key', CG.client_controller.pub, 'clipboard', 'text', service.GetServiceKey().hex() )
self._refresh_button = ClientGUICommon.BetterBitmapButton( self, CC.global_pixmaps().refresh, self._RefreshButton )
@@ -1696,7 +1696,7 @@ def __init__( self, parent, service ):
#
- if not HG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
+ if not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ):
self._id_button.hide()
@@ -1737,7 +1737,7 @@ def _GetAndShowID( self ):
def work_callable():
- service_id = HG.client_controller.Read( 'service_id', service_key )
+ service_id = CG.client_controller.Read( 'service_id', service_key )
return service_id
@@ -1756,7 +1756,7 @@ def publish_callable( service_id ):
def _RefreshButton( self ):
- HG.client_controller.pub( 'service_updated', self._service )
+ CG.client_controller.pub( 'service_updated', self._service )
def EventImmediateSync( self, event ):
@@ -1850,7 +1850,7 @@ def __init__( self, parent, service ):
self.Add( self._name_and_type, CC.FLAGS_EXPAND_PERPENDICULAR )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _Refresh( self ):
@@ -1920,7 +1920,7 @@ def __init__( self, parent, service ):
self.Add( self._service_status, CC.FLAGS_EXPAND_PERPENDICULAR )
self.Add( permissions_list_panel, CC.FLAGS_EXPAND_BOTH_WAYS )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _ConvertDataToListCtrlTuples( self, api_permissions ):
@@ -1956,7 +1956,7 @@ def _CopyAPIAccessKey( self ):
text = access_key.hex()
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _AddFromAPI( self ):
@@ -2013,7 +2013,7 @@ def _AddManually( self, api_permissions = None ):
api_permissions = panel.GetValue()
- HG.client_controller.client_api_manager.AddAccess( api_permissions )
+ CG.client_controller.client_api_manager.AddAccess( api_permissions )
self._Refresh()
@@ -2028,7 +2028,7 @@ def _Delete( self ):
access_keys = [ api_permissions.GetAccessKey() for api_permissions in self._permissions_list.GetData( only_selected = True ) ]
- HG.client_controller.client_api_manager.DeleteAccess( access_keys )
+ CG.client_controller.client_api_manager.DeleteAccess( access_keys )
self._Refresh()
@@ -2057,7 +2057,7 @@ def _Duplicate( self ):
existing_objects.extend( dupes )
- HG.client_controller.client_api_manager.SetPermissions( existing_objects )
+ CG.client_controller.client_api_manager.SetPermissions( existing_objects )
self._Refresh()
@@ -2080,7 +2080,7 @@ def _Edit( self ):
api_permissions = panel.GetValue()
- HG.client_controller.client_api_manager.OverwriteAccess( api_permissions )
+ CG.client_controller.client_api_manager.OverwriteAccess( api_permissions )
else:
@@ -2144,7 +2144,7 @@ def _Refresh( self ):
self._service_status.setText( status )
- api_permissions_objects = HG.client_controller.client_api_manager.GetAllPermissions()
+ api_permissions_objects = CG.client_controller.client_api_manager.GetAllPermissions()
self._permissions_list.SetData( api_permissions_objects )
@@ -2185,8 +2185,8 @@ def __init__( self, parent, service ):
self.Add( self._deferred_delete_status, CC.FLAGS_EXPAND_PERPENDICULAR )
self.Add( self._clear_deleted_files_record, CC.FLAGS_ON_RIGHT )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
- HG.client_controller.sub( self, '_Refresh', 'notify_new_physical_file_delete_numbers' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, '_Refresh', 'notify_new_physical_file_delete_numbers' )
def _ClearDeletedFilesRecord( self ):
@@ -2209,9 +2209,9 @@ def _ClearDeletedFilesRecord( self ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_update )
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
- HG.client_controller.pub( 'service_updated', self._service )
+ CG.client_controller.pub( 'service_updated', self._service )
@@ -2223,7 +2223,7 @@ def _Refresh( self ):
return
- HG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
+ CG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
def ServiceUpdated( self, service ):
@@ -2248,7 +2248,7 @@ def qt_code( text ):
self._deferred_delete_status.setText( text )
- ( num_files, num_thumbnails ) = HG.client_controller.Read( 'num_deferred_file_deletes' )
+ ( num_files, num_thumbnails ) = CG.client_controller.Read( 'num_deferred_file_deletes' )
if num_files == 0 and num_thumbnails == 0:
@@ -2282,7 +2282,7 @@ def __init__( self, parent, service ):
self.Add( self._file_info_st, CC.FLAGS_EXPAND_PERPENDICULAR )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _Refresh( self ):
@@ -2292,7 +2292,7 @@ def _Refresh( self ):
return
- HG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
+ CG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
def ServiceUpdated( self, service ):
@@ -2317,7 +2317,7 @@ def qt_code( text ):
self._file_info_st.setText( text )
- service_info = HG.client_controller.Read( 'service_info', service.GetServiceKey() )
+ service_info = CG.client_controller.Read( 'service_info', service.GetServiceKey() )
num_files = service_info[ HC.SERVICE_INFO_NUM_FILES ]
total_size = service_info[ HC.SERVICE_INFO_TOTAL_SIZE ]
@@ -2369,7 +2369,7 @@ def __init__( self, parent, service ):
self.Add( self._bandwidth_summary, CC.FLAGS_EXPAND_PERPENDICULAR )
self.Add( self._bandwidth_panel, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _Refresh( self ):
@@ -2495,7 +2495,7 @@ def __init__( self, parent, service ):
self.Add( self._bandwidth_panel, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
self.Add( hbox, CC.FLAGS_ON_RIGHT )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _CopyAccountKey( self ):
@@ -2506,7 +2506,7 @@ def _CopyAccountKey( self ):
account_key_hex = account_key.hex()
- HG.client_controller.pub( 'clipboard', 'text', account_key_hex )
+ CG.client_controller.pub( 'clipboard', 'text', account_key_hex )
def _PausePlayNetworkSync( self ):
@@ -2671,7 +2671,7 @@ def errback_callable( etype, value, tb ):
self._my_updater.Update()
- if HG.client_controller.new_options.GetBoolean( 'pause_repo_sync' ):
+ if CG.client_controller.new_options.GetBoolean( 'pause_repo_sync' ):
ClientGUIDialogsMessage.ShowWarning( self, 'All repositories are currently paused under the services->pause menu! Please unpause them and then try again!' )
@@ -2793,7 +2793,7 @@ def __init__( self, parent, service ):
#
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
if not new_options.GetBoolean( 'advanced_mode' ):
@@ -2858,7 +2858,7 @@ def __init__( self, parent, service ):
self.setLayout( vbox )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _DoAFullMetadataResync( self ):
@@ -2920,9 +2920,9 @@ def do_it( dest_dir, service ):
try:
job_status.SetStatusTitle( 'exporting updates for ' + service.GetName() )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
- client_files_manager = HG.client_controller.client_files_manager
+ client_files_manager = CG.client_controller.client_files_manager
for ( i, update_hash ) in enumerate( update_hashes ):
@@ -2979,7 +2979,7 @@ def do_it( dest_dir, service ):
self._export_updates_button.setText( 'exporting' + HC.UNICODE_ELLIPSIS )
self._export_updates_button.setEnabled( False )
- HG.client_controller.CallToThread( do_it, path, self._service )
+ CG.client_controller.CallToThread( do_it, path, self._service )
@@ -3075,7 +3075,7 @@ def _Refresh( self ):
self._service_info_button.setText( 'service info' )
self._service_info_button.setEnabled( True )
- self._service_info_button.setVisible( HG.client_controller.new_options.GetBoolean( 'advanced_mode' ) )
+ self._service_info_button.setVisible( CG.client_controller.new_options.GetBoolean( 'advanced_mode' ) )
#
@@ -3158,7 +3158,7 @@ def _Refresh( self ):
self._metadata_st.setText( self._service.GetNextUpdateDueString() )
- HG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
+ CG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
def _ReprocessDefinitions( self ):
@@ -3167,7 +3167,7 @@ def do_it( service, my_updater ):
service_key = service.GetServiceKey()
- HG.client_controller.WriteSynchronous( 'reprocess_repository', service_key, ( HC.CONTENT_TYPE_DEFINITIONS, ) )
+ CG.client_controller.WriteSynchronous( 'reprocess_repository', service_key, ( HC.CONTENT_TYPE_DEFINITIONS, ) )
my_updater.Update()
@@ -3182,7 +3182,7 @@ def do_it( service, my_updater ):
if result == QW.QDialog.Accepted:
- HG.client_controller.CallToThread( do_it, self._service, self._my_updater )
+ CG.client_controller.CallToThread( do_it, self._service, self._my_updater )
@@ -3192,7 +3192,7 @@ def do_it( service, my_updater, content_types_to_reset ):
service_key = service.GetServiceKey()
- HG.client_controller.WriteSynchronous( 'reprocess_repository', service_key, content_types_to_reset )
+ CG.client_controller.WriteSynchronous( 'reprocess_repository', service_key, content_types_to_reset )
my_updater.Update()
@@ -3214,7 +3214,7 @@ def do_it( service, my_updater, content_types_to_reset ):
if result == QW.QDialog.Accepted:
- HG.client_controller.CallToThread( do_it, self._service, self._my_updater, content_types )
+ CG.client_controller.CallToThread( do_it, self._service, self._my_updater, content_types )
@@ -3245,7 +3245,7 @@ def do_it( service, my_updater, content_types_to_reset ):
service_key = service.GetServiceKey()
- HG.client_controller.WriteSynchronous( 'reset_repository_processing', service_key, content_types_to_reset )
+ CG.client_controller.WriteSynchronous( 'reset_repository_processing', service_key, content_types_to_reset )
my_updater.Update()
@@ -3267,7 +3267,7 @@ def do_it( service, my_updater, content_types_to_reset ):
if result == QW.QDialog.Accepted:
- HG.client_controller.CallToThread( do_it, self._service, self._my_updater, content_types )
+ CG.client_controller.CallToThread( do_it, self._service, self._my_updater, content_types )
@@ -3286,7 +3286,7 @@ def _ReviewTagFilter( self ):
message = 'The Tag Repository applies this to all new pending tag mapping uploads. If you upload a mapping that this filter denies, it will be silently discarded serverside. Siblings and parents are not affected.'
- namespaces = HG.client_controller.network_engine.domain_manager.GetParserNamespaces()
+ namespaces = CG.client_controller.network_engine.domain_manager.GetParserNamespaces()
panel = ClientGUITags.EditTagFilterPanel( frame, tag_filter, namespaces = namespaces, message = message, read_only = True )
@@ -3322,7 +3322,7 @@ def do_it( service, my_updater ):
self._sync_remote_now_button.setEnabled( False )
- HG.client_controller.CallToThread( do_it, self._service, self._my_updater )
+ CG.client_controller.CallToThread( do_it, self._service, self._my_updater )
def _SyncProcessingNow( self ):
@@ -3344,7 +3344,7 @@ def do_it( service, my_updater ):
self._sync_processing_now_button.setEnabled( False )
- HG.client_controller.CallToThread( do_it, self._service, self._my_updater )
+ CG.client_controller.CallToThread( do_it, self._service, self._my_updater )
@@ -3442,7 +3442,7 @@ def qt_code( num_local_updates, num_updates, content_types_to_num_processed_upda
- ( num_local_updates, num_updates, content_types_to_num_processed_updates, content_types_to_num_updates ) = HG.client_controller.Read( 'repository_progress', service.GetServiceKey() )
+ ( num_local_updates, num_updates, content_types_to_num_processed_updates, content_types_to_num_updates ) = CG.client_controller.Read( 'repository_progress', service.GetServiceKey() )
is_mostly_caught_up = service.IsMostlyCaughtUp()
@@ -3482,7 +3482,7 @@ def __init__( self, parent, service ):
self.Add( interaction_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
self.Add( self._ipfs_shares_panel, CC.FLAGS_EXPAND_BOTH_WAYS )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _ConvertDataToListCtrlTuple( self, data ):
@@ -3515,7 +3515,7 @@ def _CopyMultihashes( self ):
text = os.linesep.join( ( multihash_prefix + multihash for multihash in multihashes ) )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
@@ -3526,7 +3526,7 @@ def _Refresh( self ):
return
- HG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
+ CG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
def _SetNotes( self ):
@@ -3545,14 +3545,14 @@ def _SetNotes( self ):
for ( multihash, num_files, total_size, old_note ) in datas:
- hashes = HG.client_controller.Read( 'service_directory', self._service.GetServiceKey(), multihash )
+ hashes = CG.client_controller.Read( 'service_directory', self._service.GetServiceKey(), multihash )
content_update_row = ( hashes, multihash, note )
content_updates.append( ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_DIRECTORIES, HC.CONTENT_UPDATE_ADD, content_update_row ) )
- HG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service.GetServiceKey(), content_updates ) )
+ CG.client_controller.Write( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service.GetServiceKey(), content_updates ) )
self._my_updater.Update()
@@ -3580,9 +3580,9 @@ def do_it( service_key, pages_of_hashes_to_show ):
for ( multihash, num_files, total_size, note ) in shares:
- hashes = HG.client_controller.Read( 'service_directory', service_key, multihash )
+ hashes = CG.client_controller.Read( 'service_directory', service_key, multihash )
- HG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes, page_name = 'ipfs directory' )
+ CG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes, page_name = 'ipfs directory' )
time.sleep( 0.5 )
@@ -3597,7 +3597,7 @@ def do_it( service_key, pages_of_hashes_to_show ):
self._ipfs_shares_panel.setEnabled( False )
- HG.client_controller.CallToThread( do_it, self._service.GetServiceKey(), shares )
+ CG.client_controller.CallToThread( do_it, self._service.GetServiceKey(), shares )
def _Unpin( self ):
@@ -3637,7 +3637,7 @@ def do_it( service, multihashes ):
self._ipfs_shares_panel.setEnabled( False )
- HG.client_controller.CallToThread( do_it, self._service, multihashes )
+ CG.client_controller.CallToThread( do_it, self._service, multihashes )
@@ -3670,7 +3670,7 @@ def qt_code( ipfs_shares ):
self._ipfs_shares.SetData( ipfs_shares )
- ipfs_shares = HG.client_controller.Read( 'service_directories', service.GetServiceKey() )
+ ipfs_shares = CG.client_controller.Read( 'service_directories', service.GetServiceKey() )
QP.CallAfter( qt_code, ipfs_shares )
@@ -3714,7 +3714,7 @@ def __init__( self, parent, service ):
self.Add( self._service_status, CC.FLAGS_EXPAND_PERPENDICULAR )
self.Add( booru_share_panel, CC.FLAGS_EXPAND_BOTH_WAYS )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _CanCopyURL( self ):
@@ -3780,7 +3780,7 @@ def _CopyExternalShareURL( self ):
text = os.linesep.join( urls )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _CopyInternalShareURL( self ):
@@ -3803,7 +3803,7 @@ def _CopyInternalShareURL( self ):
text = os.linesep.join( urls )
- HG.client_controller.pub( 'clipboard', 'text', text )
+ CG.client_controller.pub( 'clipboard', 'text', text )
def _Delete( self ):
@@ -3814,7 +3814,7 @@ def _Delete( self ):
for share_key in self._booru_shares.GetData( only_selected = True ):
- HG.client_controller.Write( 'delete_local_booru_share', share_key )
+ CG.client_controller.Write( 'delete_local_booru_share', share_key )
self._booru_shares.DeleteSelected()
@@ -3845,7 +3845,7 @@ def _Edit( self ):
info[ 'timeout' ] = timeout
info[ 'hashes' ] = hashes
- HG.client_controller.Write( 'local_booru_share', share_key, info )
+ CG.client_controller.Write( 'local_booru_share', share_key, info )
else:
@@ -3868,7 +3868,7 @@ def _OpenSearch( self ):
name = info[ 'name' ]
hashes = info[ 'hashes' ]
- HG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes, page_name = 'booru share: ' + name )
+ CG.client_controller.pub( 'new_page_query', location_context, initial_hashes = hashes, page_name = 'booru share: ' + name )
@@ -3899,7 +3899,7 @@ def _Refresh( self ):
self._service_status.setText( status )
- HG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
+ CG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
def ServiceUpdated( self, service ):
@@ -3928,7 +3928,7 @@ def qt_code( booru_shares ):
self._booru_shares.Sort()
- booru_shares = HG.client_controller.Read( 'local_booru_shares' )
+ booru_shares = CG.client_controller.Read( 'local_booru_shares' )
QP.CallAfter( qt_code, booru_shares )
@@ -3964,7 +3964,7 @@ def __init__( self, parent, service ):
self.Add( self._rating_info_st, CC.FLAGS_EXPAND_PERPENDICULAR )
self.Add( self._clear_deleted, CC.FLAGS_ON_RIGHT )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _ClearRatings( self, advanced_action, action_description ):
@@ -3981,15 +3981,15 @@ def _ClearRatings( self, advanced_action, action_description ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( self._service.GetServiceKey(), content_update )
- HG.client_controller.Write( 'content_updates', content_update_package, publish_content_updates = False )
+ CG.client_controller.Write( 'content_updates', content_update_package, publish_content_updates = False )
- HG.client_controller.pub( 'service_updated', self._service )
+ CG.client_controller.pub( 'service_updated', self._service )
def _Refresh( self ):
- HG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
+ CG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
def ServiceUpdated( self, service ):
@@ -4014,7 +4014,7 @@ def qt_code( text ):
self._rating_info_st.setText( text )
- service_info = HG.client_controller.Read( 'service_info', service.GetServiceKey() )
+ service_info = CG.client_controller.Read( 'service_info', service.GetServiceKey() )
num_files = service_info[ HC.SERVICE_INFO_NUM_FILE_HASHES ]
@@ -4047,12 +4047,12 @@ def __init__( self, parent, service ):
self.Add( self._tag_info_st, CC.FLAGS_EXPAND_PERPENDICULAR )
self.Add( self._tag_migration, CC.FLAGS_ON_RIGHT )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _MigrateTags( self ):
- tlw = HG.client_controller.GetMainTLW()
+ tlw = CG.client_controller.GetMainTLW()
frame = ClientGUITopLevelWindowsPanels.FrameThatTakesScrollablePanel( tlw, 'migrate tags' )
@@ -4063,7 +4063,7 @@ def _MigrateTags( self ):
def _Refresh( self ):
- HG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
+ CG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
def ServiceUpdated( self, service ):
@@ -4088,7 +4088,7 @@ def qt_code( text ):
self._tag_info_st.setText( text )
- service_info = HG.client_controller.Read( 'service_info', service.GetServiceKey() )
+ service_info = CG.client_controller.Read( 'service_info', service.GetServiceKey() )
num_files = service_info[ HC.SERVICE_INFO_NUM_FILE_HASHES ]
num_tags = service_info[ HC.SERVICE_INFO_NUM_TAGS ]
@@ -4136,7 +4136,7 @@ def __init__( self, parent, service ):
self.Add( hbox, CC.FLAGS_ON_RIGHT )
- HG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
+ CG.client_controller.sub( self, 'ServiceUpdated', 'service_updated' )
def _ClearTrash( self ):
@@ -4151,7 +4151,7 @@ def _ClearTrash( self ):
def do_it( service ):
- hashes = HG.client_controller.Read( 'trash_hashes' )
+ hashes = CG.client_controller.Read( 'trash_hashes' )
for group_of_hashes in HydrusData.SplitIteratorIntoChunks( hashes, 16 ):
@@ -4159,23 +4159,23 @@ def do_it( service ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_update )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
time.sleep( 0.01 )
- HG.client_controller.pub( 'service_updated', service )
+ CG.client_controller.pub( 'service_updated', service )
self._clear_trash.setEnabled( False )
- HG.client_controller.CallToThread( do_it, self._service )
+ CG.client_controller.CallToThread( do_it, self._service )
def _Refresh( self ):
- HG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
+ CG.client_controller.CallToThread( self.THREADFetchInfo, self._service )
def _UndeleteAll( self ):
@@ -4188,18 +4188,18 @@ def _UndeleteAll( self ):
def do_it( service ):
- hashes = HG.client_controller.Read( 'trash_hashes' )
+ hashes = CG.client_controller.Read( 'trash_hashes' )
from hydrus.client.gui import ClientGUIMediaActions
ClientGUIMediaActions.UndeleteFiles( hashes )
- HG.client_controller.pub( 'service_updated', service )
+ CG.client_controller.pub( 'service_updated', service )
self._undelete_all.setEnabled( False )
- HG.client_controller.CallToThread( do_it, self._service )
+ CG.client_controller.CallToThread( do_it, self._service )
@@ -4226,7 +4226,7 @@ def qt_code( num_files ):
self._undelete_all.setEnabled( num_files > 0 )
- service_info = HG.client_controller.Read( 'service_info', service.GetServiceKey() )
+ service_info = CG.client_controller.Read( 'service_info', service.GetServiceKey() )
num_files = service_info[ HC.SERVICE_INFO_NUM_FILES ]
diff --git a/hydrus/client/gui/services/ClientGUIServersideServices.py b/hydrus/client/gui/services/ClientGUIServersideServices.py
index 324faedd6..49f6d8b81 100644
--- a/hydrus/client/gui/services/ClientGUIServersideServices.py
+++ b/hydrus/client/gui/services/ClientGUIServersideServices.py
@@ -9,6 +9,7 @@
from hydrus.core.networking import HydrusNetwork
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsQuick
from hydrus.client.gui import ClientGUIScrolledPanels
from hydrus.client.gui import ClientGUITopLevelWindowsPanels
@@ -250,7 +251,7 @@ class ManageServerServicesPanel( ClientGUIScrolledPanels.ManagePanel ):
def __init__( self, parent, service_key ):
- self._clientside_admin_service = HG.client_controller.services_manager.GetService( service_key )
+ self._clientside_admin_service = CG.client_controller.services_manager.GetService( service_key )
ClientGUIScrolledPanels.ManagePanel.__init__( self, parent )
@@ -462,9 +463,9 @@ def CommitChanges( self ):
with HG.dirty_object_lock:
- HG.client_controller.WriteSynchronous( 'update_server_services', admin_service_key, services, service_keys_to_access_keys, self._deletee_service_keys )
+ CG.client_controller.WriteSynchronous( 'update_server_services', admin_service_key, services, service_keys_to_access_keys, self._deletee_service_keys )
- HG.client_controller.RefreshServices()
+ CG.client_controller.RefreshServices()
diff --git a/hydrus/client/gui/widgets/ClientGUIApplicationCommand.py b/hydrus/client/gui/widgets/ClientGUIApplicationCommand.py
index 3df2b1317..afd90cd46 100644
--- a/hydrus/client/gui/widgets/ClientGUIApplicationCommand.py
+++ b/hydrus/client/gui/widgets/ClientGUIApplicationCommand.py
@@ -8,6 +8,7 @@
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIScrolledPanels
from hydrus.client.gui import ClientGUIShortcuts
@@ -33,7 +34,7 @@ def __init__( self, parent: QW.QWidget ):
#
- services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) )
+ services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_FILE_DOMAIN, ) )
for service in services:
@@ -98,7 +99,7 @@ def __init__( self, parent: QW.QWidget ):
#
- services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
+ services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_LIKE, ) )
if len( services ) == 0:
@@ -209,7 +210,7 @@ def __init__( self, parent: QW.QWidget ):
#
- services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, ) )
+ services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, ) )
if len( services ) == 0:
@@ -265,7 +266,7 @@ def _UpdateSliderRange( self ):
if service_key is not None:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
self._current_ratings_numerical_service = service
@@ -347,7 +348,7 @@ def __init__( self, parent: QW.QWidget ):
#
- services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, HC.LOCAL_RATING_INCDEC ) )
+ services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_RATING_NUMERICAL, HC.LOCAL_RATING_INCDEC ) )
if len( services ) == 0:
@@ -696,13 +697,13 @@ def __init__( self, parent: QW.QWidget ):
self._tag_value = QW.QLineEdit( self )
self._tag_value.setReadOnly( True )
- default_location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext()
+ default_location_context = CG.client_controller.new_options.GetDefaultLocalLocationContext()
self._tag_input = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite( self, self.SetTags, default_location_context, CC.COMBINED_TAG_SERVICE_KEY )
#
- services = HG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, HC.TAG_REPOSITORY ) )
+ services = CG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, HC.TAG_REPOSITORY ) )
for service in services:
@@ -842,9 +843,9 @@ def __init__( self, parent: QW.QWidget, command: CAC.ApplicationCommand, shortcu
service_key = command.GetContentServiceKey()
- if HG.client_controller.services_manager.ServiceExists( service_key ):
+ if CG.client_controller.services_manager.ServiceExists( service_key ):
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
action = command.GetContentAction()
value = command.GetContentValue()
@@ -853,7 +854,7 @@ def __init__( self, parent: QW.QWidget, command: CAC.ApplicationCommand, shortcu
ClientGUIDialogsMessage.ShowWarning( self, 'The service that this command relies upon no longer exists! This command will reset to a default form.' )
- local_tag_services = list( HG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) ) )
+ local_tag_services = list( CG.client_controller.services_manager.GetServices( ( HC.LOCAL_TAG, ) ) )
service = local_tag_services[0]
diff --git a/hydrus/client/gui/widgets/ClientGUIColourPicker.py b/hydrus/client/gui/widgets/ClientGUIColourPicker.py
index 163fa3cf3..26c0d7f5a 100644
--- a/hydrus/client/gui/widgets/ClientGUIColourPicker.py
+++ b/hydrus/client/gui/widgets/ClientGUIColourPicker.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIFunctions
@@ -125,7 +126,7 @@ def _ImportHexFromClipboard( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except Exception as e:
@@ -190,7 +191,7 @@ def ShowMenu( self ):
hex_string = self.GetColour().name( QG.QColor.HexRgb )
- ClientGUIMenus.AppendMenuItem( menu, 'copy ' + hex_string + ' to the clipboard', 'Copy the current colour to the clipboard.', HG.client_controller.pub, 'clipboard', 'text', hex_string )
+ ClientGUIMenus.AppendMenuItem( menu, 'copy ' + hex_string + ' to the clipboard', 'Copy the current colour to the clipboard.', CG.client_controller.pub, 'clipboard', 'text', hex_string )
ClientGUIMenus.AppendMenuItem( menu, 'import a hex colour from the clipboard', 'Look at the clipboard for a colour in the format #FF0000, and set the colour.', self._ImportHexFromClipboard )
CGC.core().PopupMenu( self, menu )
diff --git a/hydrus/client/gui/widgets/ClientGUICommon.py b/hydrus/client/gui/widgets/ClientGUICommon.py
index c46a7a552..d8e7248a6 100644
--- a/hydrus/client/gui/widgets/ClientGUICommon.py
+++ b/hydrus/client/gui/widgets/ClientGUICommon.py
@@ -11,10 +11,10 @@
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
-from hydrus.core import HydrusTime
from hydrus.client import ClientApplicationCommand as CAC
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientPaths
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIFunctions
@@ -899,24 +899,24 @@ def __init__( self, boolean_name ):
def GetCurrentValue( self ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
return new_options.GetBoolean( self._boolean_name )
def Invert( self ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
new_options.InvertBoolean( self._boolean_name )
if self._boolean_name == 'advanced_mode':
- HG.client_controller.pub( 'notify_advanced_mode' )
+ CG.client_controller.pub( 'notify_advanced_mode' )
- HG.client_controller.pub( 'checkbox_manager_inverted' )
- HG.client_controller.pub( 'notify_new_menu_option' )
+ CG.client_controller.pub( 'checkbox_manager_inverted' )
+ CG.client_controller.pub( 'notify_new_menu_option' )
@@ -976,19 +976,19 @@ def _Hit( self ):
ClientGUIMenus.AppendSeparator( menu )
- ClientGUIMenus.AppendMenuItem( menu, 'unique numerical file id - {file_id}', 'copy "{file_id}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{file_id}' )
- ClientGUIMenus.AppendMenuItem( menu, 'the file\'s hash - {hash}', 'copy "{hash}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{hash}' )
- ClientGUIMenus.AppendMenuItem( menu, 'all the file\'s tags - {tags}', 'copy "{tags}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{tags}' )
- ClientGUIMenus.AppendMenuItem( menu, 'all the file\'s non-namespaced tags - {nn tags}', 'copy "{nn tags}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{nn tags}' )
- ClientGUIMenus.AppendMenuItem( menu, 'file order - {#}', 'copy "{#}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{#}' )
+ ClientGUIMenus.AppendMenuItem( menu, 'unique numerical file id - {file_id}', 'copy "{file_id}" to the clipboard', CG.client_controller.pub, 'clipboard', 'text', '{file_id}' )
+ ClientGUIMenus.AppendMenuItem( menu, 'the file\'s hash - {hash}', 'copy "{hash}" to the clipboard', CG.client_controller.pub, 'clipboard', 'text', '{hash}' )
+ ClientGUIMenus.AppendMenuItem( menu, 'all the file\'s tags - {tags}', 'copy "{tags}" to the clipboard', CG.client_controller.pub, 'clipboard', 'text', '{tags}' )
+ ClientGUIMenus.AppendMenuItem( menu, 'all the file\'s non-namespaced tags - {nn tags}', 'copy "{nn tags}" to the clipboard', CG.client_controller.pub, 'clipboard', 'text', '{nn tags}' )
+ ClientGUIMenus.AppendMenuItem( menu, 'file order - {#}', 'copy "{#}" to the clipboard', CG.client_controller.pub, 'clipboard', 'text', '{#}' )
ClientGUIMenus.AppendSeparator( menu )
- ClientGUIMenus.AppendMenuItem( menu, f'all instances of a particular namespace - [{HC.UNICODE_ELLIPSIS}]', f'copy "[{HC.UNICODE_ELLIPSIS}]" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', f'[{HC.UNICODE_ELLIPSIS}]' )
+ ClientGUIMenus.AppendMenuItem( menu, f'all instances of a particular namespace - [{HC.UNICODE_ELLIPSIS}]', f'copy "[{HC.UNICODE_ELLIPSIS}]" to the clipboard', CG.client_controller.pub, 'clipboard', 'text', f'[{HC.UNICODE_ELLIPSIS}]' )
ClientGUIMenus.AppendSeparator( menu )
- ClientGUIMenus.AppendMenuItem( menu, f'a particular tag, if the file has it - ({HC.UNICODE_ELLIPSIS})', f'copy "({HC.UNICODE_ELLIPSIS})" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', f'({HC.UNICODE_ELLIPSIS})' )
+ ClientGUIMenus.AppendMenuItem( menu, f'a particular tag, if the file has it - ({HC.UNICODE_ELLIPSIS})', f'copy "({HC.UNICODE_ELLIPSIS})" to the clipboard', CG.client_controller.pub, 'clipboard', 'text', f'({HC.UNICODE_ELLIPSIS})' )
CGC.core().PopupMenu( self, menu )
@@ -1779,39 +1779,39 @@ def _ShowMenu( self ):
submenu = ClientGUIMenus.GenerateMenu( menu )
- ClientGUIMenus.AppendMenuItem( submenu, r'whitespace character - \s', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'\s' )
- ClientGUIMenus.AppendMenuItem( submenu, r'number character - \d', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'\d' )
- ClientGUIMenus.AppendMenuItem( submenu, r'alphanumeric or underscore character - \w', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'\w' )
- ClientGUIMenus.AppendMenuItem( submenu, r'any character - .', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'.' )
- ClientGUIMenus.AppendMenuItem( submenu, r'backslash character - \\', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'\\' )
- ClientGUIMenus.AppendMenuItem( submenu, r'beginning of line - ^', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'^' )
- ClientGUIMenus.AppendMenuItem( submenu, r'end of line - $', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'$' )
- ClientGUIMenus.AppendMenuItem( submenu, f'any of these - [{HC.UNICODE_ELLIPSIS}]', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', f'text', '[{HC.UNICODE_ELLIPSIS}]' )
- ClientGUIMenus.AppendMenuItem( submenu, f'anything other than these - [^{HC.UNICODE_ELLIPSIS}]', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', f'[^{HC.UNICODE_ELLIPSIS}]' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'whitespace character - \s', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'\s' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'number character - \d', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'\d' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'alphanumeric or underscore character - \w', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'\w' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'any character - .', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'.' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'backslash character - \\', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'\\' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'beginning of line - ^', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'^' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'end of line - $', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'$' )
+ ClientGUIMenus.AppendMenuItem( submenu, f'any of these - [{HC.UNICODE_ELLIPSIS}]', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', f'text', '[{HC.UNICODE_ELLIPSIS}]' )
+ ClientGUIMenus.AppendMenuItem( submenu, f'anything other than these - [^{HC.UNICODE_ELLIPSIS}]', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', f'[^{HC.UNICODE_ELLIPSIS}]' )
ClientGUIMenus.AppendSeparator( submenu )
- ClientGUIMenus.AppendMenuItem( submenu, r'0 or more matches, consuming as many as possible - *', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'*' )
- ClientGUIMenus.AppendMenuItem( submenu, r'1 or more matches, consuming as many as possible - +', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'+' )
- ClientGUIMenus.AppendMenuItem( submenu, r'0 or 1 matches, preferring 1 - ?', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'?' )
- ClientGUIMenus.AppendMenuItem( submenu, r'0 or more matches, consuming as few as possible - *?', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'*?' )
- ClientGUIMenus.AppendMenuItem( submenu, r'1 or more matches, consuming as few as possible - +?', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'+?' )
- ClientGUIMenus.AppendMenuItem( submenu, r'0 or 1 matches, preferring 0 - ??', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'??' )
- ClientGUIMenus.AppendMenuItem( submenu, r'exactly m matches - {m}', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'{m}' )
- ClientGUIMenus.AppendMenuItem( submenu, r'm to n matches, consuming as many as possible - {m,n}', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'{m,n}' )
- ClientGUIMenus.AppendMenuItem( submenu, r'm to n matches, consuming as few as possible - {m,n}?', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'{m,n}?' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'0 or more matches, consuming as many as possible - *', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'*' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'1 or more matches, consuming as many as possible - +', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'+' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'0 or 1 matches, preferring 1 - ?', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'?' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'0 or more matches, consuming as few as possible - *?', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'*?' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'1 or more matches, consuming as few as possible - +?', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'+?' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'0 or 1 matches, preferring 0 - ??', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'??' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'exactly m matches - {m}', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'{m}' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'm to n matches, consuming as many as possible - {m,n}', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'{m,n}' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'm to n matches, consuming as few as possible - {m,n}?', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'{m,n}?' )
ClientGUIMenus.AppendSeparator( submenu )
- ClientGUIMenus.AppendMenuItem( submenu, f'the next characters are: (non-consuming) - (?={HC.UNICODE_ELLIPSIS})', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', f'(?={HC.UNICODE_ELLIPSIS})' )
- ClientGUIMenus.AppendMenuItem( submenu, f'the next characters are not: (non-consuming) - (?!{HC.UNICODE_ELLIPSIS})', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', f'(?!{HC.UNICODE_ELLIPSIS})' )
- ClientGUIMenus.AppendMenuItem( submenu, f'the previous characters are: (non-consuming) - (?<={HC.UNICODE_ELLIPSIS})', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', f'(?<={HC.UNICODE_ELLIPSIS})' )
- ClientGUIMenus.AppendMenuItem( submenu, f'the previous characters are not: (non-consuming) - (? 74 - [1-9]+\d*', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', r'[1-9]+\d*' )
- ClientGUIMenus.AppendMenuItem( submenu, r'filename - (?<=' + re.escape( os.path.sep ) + r')[^' + re.escape( os.path.sep ) + r']*?(?=\..*$)', 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '(?<=' + re.escape( os.path.sep ) + r')[^' + re.escape( os.path.sep ) + r']*?(?=\..*$)' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'0074 -> 74 - [1-9]+\d*', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', r'[1-9]+\d*' )
+ ClientGUIMenus.AppendMenuItem( submenu, r'filename - (?<=' + re.escape( os.path.sep ) + r')[^' + re.escape( os.path.sep ) + r']*?(?=\..*$)', 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', '(?<=' + re.escape( os.path.sep ) + r')[^' + re.escape( os.path.sep ) + r']*?(?=\..*$)' )
ClientGUIMenus.AppendMenu( menu, submenu, 'regex components' )
@@ -1823,7 +1823,7 @@ def _ShowMenu( self ):
for ( regex_phrase, description ) in HC.options[ 'regex_favourites' ]:
- ClientGUIMenus.AppendMenuItem( submenu, description, 'copy this phrase to the clipboard', HG.client_controller.pub, 'clipboard', 'text', regex_phrase )
+ ClientGUIMenus.AppendMenuItem( submenu, description, 'copy this phrase to the clipboard', CG.client_controller.pub, 'clipboard', 'text', regex_phrase )
ClientGUIMenus.AppendMenu( menu, submenu, 'favourites' )
@@ -1850,7 +1850,7 @@ def _ManageFavourites( self ):
HC.options[ 'regex_favourites' ] = regex_favourites
- HG.client_controller.Write( 'save_options', HC.options )
+ CG.client_controller.Write( 'save_options', HC.options )
diff --git a/hydrus/client/gui/widgets/ClientGUIControls.py b/hydrus/client/gui/widgets/ClientGUIControls.py
index 0ea62cf93..691fd830e 100644
--- a/hydrus/client/gui/widgets/ClientGUIControls.py
+++ b/hydrus/client/gui/widgets/ClientGUIControls.py
@@ -12,6 +12,7 @@
from hydrus.core.networking import HydrusNetworking
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUIDialogsMessage
from hydrus.client.gui import ClientGUIFunctions
from hydrus.client.gui import ClientGUIScrolledPanels
@@ -465,7 +466,7 @@ def _Paste( self ):
try:
- raw_text = HG.client_controller.GetClipboardText()
+ raw_text = CG.client_controller.GetClipboardText()
except HydrusExceptions.DataMissing as e:
diff --git a/hydrus/client/gui/widgets/ClientGUIMenuButton.py b/hydrus/client/gui/widgets/ClientGUIMenuButton.py
index 03cc1f20b..5dfe5a8b7 100644
--- a/hydrus/client/gui/widgets/ClientGUIMenuButton.py
+++ b/hydrus/client/gui/widgets/ClientGUIMenuButton.py
@@ -1,13 +1,8 @@
-import os
import typing
from qtpy import QtCore as QC
-from qtpy import QtWidgets as QW
-from hydrus.core import HydrusGlobals as HG
-from hydrus.core import HydrusExceptions
-
-from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.gui import ClientGUICore as CGC
from hydrus.client.gui import ClientGUIMenus
from hydrus.client.gui.widgets import ClientGUICommon
@@ -229,7 +224,7 @@ def SetValue( self, data ):
def wheelEvent( self, event ):
- can_do_it = HG.client_controller.new_options.GetBoolean( 'menu_choice_buttons_can_mouse_scroll' )
+ can_do_it = CG.client_controller.new_options.GetBoolean( 'menu_choice_buttons_can_mouse_scroll' )
if can_do_it:
diff --git a/hydrus/client/importing/ClientImportControl.py b/hydrus/client/importing/ClientImportControl.py
index fbca88229..3fc0c67b4 100644
--- a/hydrus/client/importing/ClientImportControl.py
+++ b/hydrus/client/importing/ClientImportControl.py
@@ -1,10 +1,10 @@
import typing
-from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.importing import ClientImportFileSeeds
from hydrus.client.importing import ClientImportGallerySeeds
from hydrus.client.importing.options import FileImportOptions
@@ -16,7 +16,7 @@ def CheckImporterCanDoFileWorkBecausePaused( paused: bool, file_seed_cache: Clie
raise HydrusExceptions.VetoException( 'paused' )
- if HG.client_controller.new_options.GetBoolean( 'pause_all_file_queues' ):
+ if CG.client_controller.new_options.GetBoolean( 'pause_all_file_queues' ):
raise HydrusExceptions.VetoException( 'all file import queues are paused! network->pause to resume!' )
@@ -28,7 +28,7 @@ def CheckImporterCanDoFileWorkBecausePaused( paused: bool, file_seed_cache: Clie
raise HydrusExceptions.VetoException()
- if HG.client_controller.PageClosedButNotDestroyed( page_key ):
+ if CG.client_controller.PageClosedButNotDestroyed( page_key ):
raise HydrusExceptions.VetoException( 'page is closed' )
@@ -53,7 +53,7 @@ def CheckImporterCanDoGalleryWorkBecausePaused( paused: bool, gallery_seed_log:
raise HydrusExceptions.VetoException( 'paused' )
- if HG.client_controller.new_options.GetBoolean( 'pause_all_gallery_searches' ):
+ if CG.client_controller.new_options.GetBoolean( 'pause_all_gallery_searches' ):
raise HydrusExceptions.VetoException( 'all gallery searches are paused! network->pause to resume!' )
@@ -78,7 +78,7 @@ def CheckCanDoNetworkWork( no_work_until: int, no_work_until_reason: str ):
raise HydrusExceptions.VetoException( no_work_text )
- if HG.client_controller.network_engine.IsBusy():
+ if CG.client_controller.network_engine.IsBusy():
raise HydrusExceptions.VetoException( 'network engine is too busy!' )
@@ -128,5 +128,5 @@ def NeatenStatusText( text: str ) -> str:
def PageImporterShouldStopWorking( page_key: bytes ):
- return HG.started_shutdown or not HG.client_controller.PageAlive( page_key )
+ return HG.started_shutdown or not CG.client_controller.PageAlive( page_key )
diff --git a/hydrus/client/importing/ClientImportFileSeeds.py b/hydrus/client/importing/ClientImportFileSeeds.py
index e9549f3f3..d85c7eab8 100644
--- a/hydrus/client/importing/ClientImportFileSeeds.py
+++ b/hydrus/client/importing/ClientImportFileSeeds.py
@@ -21,7 +21,7 @@
from hydrus.core.files import HydrusFileHandling
from hydrus.client import ClientConstants as CC
-from hydrus.client import ClientData
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientTime
from hydrus.client.importing import ClientImportFiles
@@ -44,7 +44,7 @@ def FileURLMappingHasUntrustworthyNeighbours( hash: bytes, url: str ):
try:
- url = HG.client_controller.network_engine.domain_manager.NormaliseURL( url )
+ url = CG.client_controller.network_engine.domain_manager.NormaliseURL( url )
except HydrusExceptions.URLClassException:
@@ -52,19 +52,19 @@ def FileURLMappingHasUntrustworthyNeighbours( hash: bytes, url: str ):
return False
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( url )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( url )
# direct file URLs do not care about neighbours, since that can mean tokenised or different CDN URLs
url_is_worried_about_neighbours = url_class is not None and url_class.GetURLType() not in ( HC.URL_TYPE_FILE, HC.URL_TYPE_UNKNOWN )
if url_is_worried_about_neighbours:
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
file_urls = media_result.GetLocationsManager().GetURLs()
# normalise to collapse http/https dupes
- file_urls = HG.client_controller.network_engine.domain_manager.NormaliseURLs( file_urls )
+ file_urls = CG.client_controller.network_engine.domain_manager.NormaliseURLs( file_urls )
for file_url in file_urls:
@@ -82,7 +82,7 @@ def FileURLMappingHasUntrustworthyNeighbours( hash: bytes, url: str ):
try:
- file_url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( file_url )
+ file_url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( file_url )
except HydrusExceptions.URLClassException:
@@ -221,12 +221,12 @@ def _AddSourceURLs( self, urls ):
urls.difference_update( all_primary_urls )
- primary_url_classes = { HG.client_controller.network_engine.domain_manager.GetURLClass( url ) for url in all_primary_urls }
+ primary_url_classes = { CG.client_controller.network_engine.domain_manager.GetURLClass( url ) for url in all_primary_urls }
primary_url_classes.discard( None )
# ok when a booru has a """"""source"""""" url that points to a file alternate on the same booru, that isn't what we call a source url
# so anything that has a source url with the same url class as our primaries, just some same-site loopback, we'll dump
- urls = { url for url in urls if HG.client_controller.network_engine.domain_manager.GetURLClass( url ) not in primary_url_classes }
+ urls = { url for url in urls if CG.client_controller.network_engine.domain_manager.GetURLClass( url ) not in primary_url_classes }
self._source_urls.update( urls )
@@ -235,7 +235,7 @@ def _CheckTagsVeto( self, tags, tag_import_options: TagImportOptions.TagImportOp
if len( tags ) > 0:
- tags_to_siblings = HG.client_controller.Read( 'tag_siblings_lookup', CC.COMBINED_TAG_SERVICE_KEY, tags )
+ tags_to_siblings = CG.client_controller.Read( 'tag_siblings_lookup', CC.COMBINED_TAG_SERVICE_KEY, tags )
all_chain_tags = set( itertools.chain.from_iterable( tags_to_siblings.values() ) )
@@ -332,7 +332,7 @@ def _SetupNoteImportOptions( self, given_note_import_options: NoteImportOptions.
lookup_url = self._GetImportOptionsLookupURL()
- note_import_options = HG.client_controller.network_engine.domain_manager.GetDefaultNoteImportOptionsForURL( lookup_url )
+ note_import_options = CG.client_controller.network_engine.domain_manager.GetDefaultNoteImportOptionsForURL( lookup_url )
else:
@@ -348,7 +348,7 @@ def _SetupTagImportOptions( self, given_tag_import_options: TagImportOptions.Tag
lookup_url = self._GetImportOptionsLookupURL()
- tag_import_options = HG.client_controller.network_engine.domain_manager.GetDefaultTagImportOptionsForURL( lookup_url )
+ tag_import_options = CG.client_controller.network_engine.domain_manager.GetDefaultTagImportOptionsForURL( lookup_url )
else:
@@ -639,7 +639,7 @@ def DownloadAndImportRawFile( self, file_url: str, file_import_options, loud_or_
status_hook( 'downloading file' )
- url_to_fetch = HG.client_controller.network_engine.domain_manager.GetURLToFetch( file_url )
+ url_to_fetch = CG.client_controller.network_engine.domain_manager.GetURLToFetch( file_url )
network_job = network_job_factory( 'GET', url_to_fetch, temp_path = temp_path, referral_url = referral_url )
@@ -655,7 +655,7 @@ def DownloadAndImportRawFile( self, file_url: str, file_import_options, loud_or_
network_job.SetFileImportOptions( file_import_options )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
with network_job_presentation_context_factory( network_job ) as njpc:
@@ -673,7 +673,7 @@ def DownloadAndImportRawFile( self, file_url: str, file_import_options, loud_or_
self._AddPrimaryURLs( ( actual_fetched_url, ) )
- ( actual_url_type, actual_match_name, actual_can_parse, actual_cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( actual_fetched_url )
+ ( actual_url_type, actual_match_name, actual_can_parse, actual_cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( actual_fetched_url )
if actual_url_type == HC.URL_TYPE_POST and actual_can_parse:
@@ -685,7 +685,7 @@ def DownloadAndImportRawFile( self, file_url: str, file_import_options, loud_or_
else:
- ( original_url_type, original_match_name, original_can_parse, original_cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.file_seed_data )
+ ( original_url_type, original_match_name, original_can_parse, original_cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.file_seed_data )
if original_url_type == actual_url_type and original_match_name == actual_match_name:
@@ -770,7 +770,7 @@ def GetExampleNetworkJob( self, network_job_factory ):
try:
- ( url_to_check, parser ) = HG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( post_url )
+ ( url_to_check, parser ) = CG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( post_url )
except HydrusExceptions.URLClassException:
@@ -838,7 +838,7 @@ def GetPreImportStatusPredictionHash( self, file_import_options: FileImportOptio
for ( hash_type, found_hash ) in jobs:
- file_import_status = HG.client_controller.Read( 'hash_status', hash_type, found_hash, prefix = '{} hash recognised'.format( hash_type ) )
+ file_import_status = CG.client_controller.Read( 'hash_status', hash_type, found_hash, prefix = '{} hash recognised'.format( hash_type ) )
# there's some subtle gubbins going on here
# an sha256 'haven't seen this before' result will not set the hash here and so will not count as a match
@@ -893,12 +893,12 @@ def GetPreImportStatusPredictionURL( self, file_import_options: FileImportOption
# now that we store primary and source urls separately, we'll trust any primary but be careful about source
# trusting classless source urls was too much of a hassle with too many boorus providing bad source urls like user account pages
- urls.extend( ( url for url in self._source_urls if HG.client_controller.network_engine.domain_manager.URLDefinitelyRefersToOneFile( url ) ) )
+ urls.extend( ( url for url in self._source_urls if CG.client_controller.network_engine.domain_manager.URLDefinitelyRefersToOneFile( url ) ) )
# now discard gallery pages or post urls that can hold multiple files
- urls = [ url for url in urls if not HG.client_controller.network_engine.domain_manager.URLCanReferToMultipleFiles( url ) ]
+ urls = [ url for url in urls if not CG.client_controller.network_engine.domain_manager.URLCanReferToMultipleFiles( url ) ]
- lookup_urls = HG.client_controller.network_engine.domain_manager.NormaliseURLs( urls )
+ lookup_urls = CG.client_controller.network_engine.domain_manager.NormaliseURLs( urls )
untrustworthy_domains = set()
@@ -909,7 +909,7 @@ def GetPreImportStatusPredictionURL( self, file_import_options: FileImportOption
continue
- results = HG.client_controller.Read( 'url_statuses', lookup_url )
+ results = CG.client_controller.Read( 'url_statuses', lookup_url )
if len( results ) == 0: # if no match found, this is a new URL, no useful data discovered
@@ -1068,7 +1068,7 @@ def IsAPostURL( self ):
try:
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.file_seed_data )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.file_seed_data )
except HydrusExceptions.URLClassException:
@@ -1104,7 +1104,7 @@ def IsProbablyMasterPostURL( self ):
# if our given referral is a post url, we are most probably a multi-file url
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( self._referral_url )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( self._referral_url )
if url_type == HC.URL_TYPE_POST:
@@ -1133,7 +1133,7 @@ def Normalise( self ):
try:
- self.file_seed_data = HG.client_controller.network_engine.domain_manager.NormaliseURL( self.file_seed_data )
+ self.file_seed_data = CG.client_controller.network_engine.domain_manager.NormaliseURL( self.file_seed_data )
except HydrusExceptions.URLClassException:
@@ -1220,9 +1220,9 @@ def PresentToPage( self, page_key: bytes ):
if hash is not None:
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
- HG.client_controller.pub( 'add_media_results', page_key, ( media_result, ) )
+ CG.client_controller.pub( 'add_media_results', page_key, ( media_result, ) )
@@ -1285,7 +1285,7 @@ def WorksInNewSystem( self ):
if self.file_seed_type == FILE_SEED_TYPE_URL:
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.file_seed_data )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.file_seed_data )
if url_type == HC.URL_TYPE_FILE:
@@ -1299,7 +1299,7 @@ def WorksInNewSystem( self ):
if url_type == HC.URL_TYPE_UNKNOWN and self._referral_url is not None: # this is likely be a multi-file child of a post url file_seed
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( self._referral_url )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( self._referral_url )
if url_type == HC.URL_TYPE_POST: # we must have got here through parsing that m8, so let's assume this is an unrecognised file url
@@ -1317,7 +1317,7 @@ def WorkOnURL( self, file_seed_cache: "FileSeedCache", status_hook, network_job_
try:
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.file_seed_data )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.file_seed_data )
if url_type not in ( HC.URL_TYPE_POST, HC.URL_TYPE_FILE, HC.URL_TYPE_UNKNOWN ):
@@ -1347,7 +1347,7 @@ def WorkOnURL( self, file_seed_cache: "FileSeedCache", status_hook, network_job_
url_for_child_referral = post_url
- ( url_to_check, parser ) = HG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( post_url )
+ ( url_to_check, parser ) = CG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( post_url )
status_hook( 'downloading file page' )
@@ -1371,7 +1371,7 @@ def WorkOnURL( self, file_seed_cache: "FileSeedCache", status_hook, network_job_
network_job.AddAdditionalHeader( key, value )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
with network_job_presentation_context_factory( network_job ) as njpc:
@@ -1386,7 +1386,7 @@ def WorkOnURL( self, file_seed_cache: "FileSeedCache", status_hook, network_job_
# we have redirected, a 3XX response
- ( actual_url_type, actual_match_name, actual_can_parse, actual_cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( actual_fetched_url )
+ ( actual_url_type, actual_match_name, actual_can_parse, actual_cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( actual_fetched_url )
if actual_url_type == HC.URL_TYPE_POST and actual_can_parse:
@@ -1396,7 +1396,7 @@ def WorkOnURL( self, file_seed_cache: "FileSeedCache", status_hook, network_job_
url_for_child_referral = post_url
- ( url_to_check, parser ) = HG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( post_url )
+ ( url_to_check, parser ) = CG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( post_url )
@@ -1510,7 +1510,7 @@ def WorkOnURL( self, file_seed_cache: "FileSeedCache", status_hook, network_job_
desired_url = desired_urls[0]
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( desired_url )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( desired_url )
if url_type in ( HC.URL_TYPE_FILE, HC.URL_TYPE_UNKNOWN ):
@@ -1771,7 +1771,7 @@ def WriteContentUpdates( self, file_import_options: typing.Optional[ FileImportO
if media_result is None:
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
for ( service_key, content_updates ) in tag_import_options.GetContentUpdatePackage( self.status, media_result, set( self._tags ), external_filterable_tags = self._external_filterable_tags, external_additional_service_keys_to_tags = self._external_additional_service_keys_to_tags ).IterateContentUpdates():
@@ -1786,7 +1786,7 @@ def WriteContentUpdates( self, file_import_options: typing.Optional[ FileImportO
if media_result is None:
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
names_and_notes = sorted( self._names_and_notes_dict.items() )
@@ -1801,7 +1801,7 @@ def WriteContentUpdates( self, file_import_options: typing.Optional[ FileImportO
if content_update_package.HasContent():
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
return did_work
@@ -1892,7 +1892,7 @@ def GetStatusText( self, simple = False ) -> str:
status_text += HydrusData.ToHumanInt( total_processed )
- show_new_on_file_seed_short_summary = HG.client_controller.new_options.GetBoolean( 'show_new_on_file_seed_short_summary' )
+ show_new_on_file_seed_short_summary = CG.client_controller.new_options.GetBoolean( 'show_new_on_file_seed_short_summary' )
if show_new_on_file_seed_short_summary and num_successful_and_new:
@@ -1906,7 +1906,7 @@ def GetStatusText( self, simple = False ) -> str:
simple_status_strings.append( '{}Ig'.format( HydrusData.ToHumanInt( num_ignored ) ) )
- show_deleted_on_file_seed_short_summary = HG.client_controller.new_options.GetBoolean( 'show_deleted_on_file_seed_short_summary' )
+ show_deleted_on_file_seed_short_summary = CG.client_controller.new_options.GetBoolean( 'show_deleted_on_file_seed_short_summary' )
if show_deleted_on_file_seed_short_summary and num_deleted > 0:
@@ -2411,7 +2411,7 @@ def _NotifyFileSeedsUpdated( self, file_seeds: typing.Collection[ FileSeed ] ):
return
- HG.client_controller.pub( 'file_seed_cache_file_seeds_updated', self._file_seed_cache_key, file_seeds )
+ CG.client_controller.pub( 'file_seed_cache_file_seeds_updated', self._file_seed_cache_key, file_seeds )
def _SetFileSeedsToIndicesDirty( self ):
diff --git a/hydrus/client/importing/ClientImportFiles.py b/hydrus/client/importing/ClientImportFiles.py
index e861fc188..7d7c7c3b5 100644
--- a/hydrus/client/importing/ClientImportFiles.py
+++ b/hydrus/client/importing/ClientImportFiles.py
@@ -12,6 +12,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientFiles
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientImageHandling
from hydrus.client.importing.options import FileImportOptions
from hydrus.client.metadata import ClientContentUpdates
@@ -91,7 +92,7 @@ def CheckFileImportStatus( file_import_status: FileImportStatus ) -> FileImportS
return file_import_status
- HG.client_controller.client_files_manager.GetFilePath( hash, mime = mime )
+ CG.client_controller.client_files_manager.GetFilePath( hash, mime = mime )
except HydrusExceptions.FileMissingException:
@@ -187,7 +188,7 @@ def DoWork( self, status_hook = None ) -> FileImportStatus:
status_hook( 'copying file into file storage' )
- HG.client_controller.client_files_manager.AddFile( hash, mime, self._temp_path, thumbnail_bytes = self._thumbnail_bytes )
+ CG.client_controller.client_files_manager.AddFile( hash, mime, self._temp_path, thumbnail_bytes = self._thumbnail_bytes )
if status_hook is not None:
@@ -196,7 +197,7 @@ def DoWork( self, status_hook = None ) -> FileImportStatus:
self._file_import_options.CheckReadyToImport()
- self._post_import_file_status = HG.client_controller.WriteSynchronous( 'import_file', self )
+ self._post_import_file_status = CG.client_controller.WriteSynchronous( 'import_file', self )
else:
@@ -208,7 +209,7 @@ def DoWork( self, status_hook = None ) -> FileImportStatus:
# if the file is already in the database but not in all the desired file services, let's push content updates to make it happen
if self._pre_import_file_status.status == CC.STATUS_SUCCESSFUL_BUT_REDUNDANT:
- media_result = HG.client_controller.Read( 'media_result', self._pre_import_file_status.hash )
+ media_result = CG.client_controller.Read( 'media_result', self._pre_import_file_status.hash )
destination_location_context = self._file_import_options.GetDestinationLocationContext()
@@ -229,7 +230,7 @@ def DoWork( self, status_hook = None ) -> FileImportStatus:
content_update_package.AddContentUpdate( service_key, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ADD, ( file_info_manager, now_ms ) ) )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -265,7 +266,7 @@ def GeneratePreImportHashAndStatus( self, status_hook = None ):
status_hook( 'checking for file status' )
- self._pre_import_file_status = HG.client_controller.Read( 'hash_status', 'sha256', hash, prefix = 'file recognised' )
+ self._pre_import_file_status = CG.client_controller.Read( 'hash_status', 'sha256', hash, prefix = 'file recognised' )
if self._pre_import_file_status.hash is None:
@@ -303,7 +304,7 @@ def GenerateInfo( self, status_hook = None ):
HydrusData.ShowText( 'File import job mime: {}'.format( HC.mime_string_lookup[ mime ] ) )
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
if mime in HC.DECOMPRESSION_BOMB_IMAGES and not self._file_import_options.AllowsDecompressionBombs():
@@ -349,13 +350,13 @@ def GenerateInfo( self, status_hook = None ):
HydrusData.ShowText( 'File import job generating thumbnail' )
- bounding_dimensions = HG.client_controller.options[ 'thumbnail_dimensions' ]
- thumbnail_scale_type = HG.client_controller.new_options.GetInteger( 'thumbnail_scale_type' )
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ bounding_dimensions = CG.client_controller.options[ 'thumbnail_dimensions' ]
+ thumbnail_scale_type = CG.client_controller.new_options.GetInteger( 'thumbnail_scale_type' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
target_resolution = HydrusImageHandling.GetThumbnailResolution( ( width, height ), bounding_dimensions, thumbnail_scale_type, thumbnail_dpr_percent )
- percentage_in = HG.client_controller.new_options.GetInteger( 'video_thumbnail_percentage_in' )
+ percentage_in = CG.client_controller.new_options.GetInteger( 'video_thumbnail_percentage_in' )
extra_description = f'File with hash "{self.GetHash().hex()}".'
@@ -554,7 +555,7 @@ def PubsubContentUpdates( self ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ARCHIVE, hashes ) )
- HG.client_controller.Write( 'content_updates', content_update_package )
+ CG.client_controller.Write( 'content_updates', content_update_package )
diff --git a/hydrus/client/importing/ClientImportGallery.py b/hydrus/client/importing/ClientImportGallery.py
index fa91dd5d4..852c020de 100644
--- a/hydrus/client/importing/ClientImportGallery.py
+++ b/hydrus/client/importing/ClientImportGallery.py
@@ -11,6 +11,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDownloading
+from hydrus.client import ClientGlobals as CG
from hydrus.client.importing import ClientImportFileSeeds
from hydrus.client.importing import ClientImportGallerySeeds
from hydrus.client.importing import ClientImporting
@@ -107,8 +108,8 @@ def __init__( self, query = None, source_name = None, initial_search_urls = None
self._last_serialisable_change_timestamp = 0
- HG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
- HG.client_controller.sub( self, 'NotifyGallerySeedsUpdated', 'gallery_seed_log_gallery_seeds_updated' )
+ CG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
+ CG.client_controller.sub( self, 'NotifyGallerySeedsUpdated', 'gallery_seed_log_gallery_seeds_updated' )
def _AmOverFileLimit( self ):
@@ -395,7 +396,7 @@ def title_hook( text ):
with self._lock:
- delay = HG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
+ delay = CG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
self._DelayWork( delay, str( e ) )
@@ -880,8 +881,8 @@ def Start( self, page_key, publish_to_page ):
self._page_key = page_key
self._publish_to_page = publish_to_page
- self._files_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
- self._gallery_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnGallery )
+ self._files_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
+ self._gallery_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnGallery )
self._files_repeating_job.SetThreadSlotType( 'gallery_files' )
self._gallery_repeating_job.SetThreadSlotType( 'gallery_search' )
@@ -956,7 +957,7 @@ def REPEATINGWorkOnFiles( self ):
self._WorkOnFiles()
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
self._SerialisableChangeMade()
@@ -1027,7 +1028,7 @@ def REPEATINGWorkOnGallery( self ):
time.sleep( 1 )
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
self._SerialisableChangeMade()
@@ -1465,7 +1466,7 @@ def GetHighlightedGalleryImport( self ):
def GetInitialSearchText( self ):
- return HG.client_controller.network_engine.domain_manager.GetInitialSearchText( self._gug_key_and_name )
+ return CG.client_controller.network_engine.domain_manager.GetInitialSearchText( self._gug_key_and_name )
def GetLastTimeImportsChanged( self ):
@@ -1592,7 +1593,7 @@ def PendSubscriptionGapDownloader( self, gug_key_and_name, query_text, file_impo
with self._lock:
- gug = HG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
+ gug = CG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
if gug is None:
@@ -1643,7 +1644,7 @@ def PendQueries( self, query_texts ):
with self._lock:
- gug = HG.client_controller.network_engine.domain_manager.GetGUG( self._gug_key_and_name )
+ gug = CG.client_controller.network_engine.domain_manager.GetGUG( self._gug_key_and_name )
if gug is None:
@@ -1881,7 +1882,7 @@ def Start( self, page_key ):
self._page_key = page_key
# set a 2s period so the page value/range is breddy snappy
- self._importers_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), 2.0, self.REPEATINGWorkOnImporters )
+ self._importers_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), 2.0, self.REPEATINGWorkOnImporters )
for gallery_import in self._gallery_imports:
@@ -1931,7 +1932,7 @@ def REPEATINGWorkOnImporters( self ):
self._last_pubbed_value_range = current_value_range
- HG.client_controller.pub( 'refresh_page_name', self._page_key )
+ CG.client_controller.pub( 'refresh_page_name', self._page_key )
diff --git a/hydrus/client/importing/ClientImportGallerySeeds.py b/hydrus/client/importing/ClientImportGallerySeeds.py
index d216569fe..284769aea 100644
--- a/hydrus/client/importing/ClientImportGallerySeeds.py
+++ b/hydrus/client/importing/ClientImportGallerySeeds.py
@@ -15,6 +15,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client.importing import ClientImporting
from hydrus.client.metadata import ClientTags
@@ -117,7 +118,7 @@ def __init__( self, url = None, can_generate_more_pages = True ):
try:
- url = HG.client_controller.network_engine.domain_manager.NormaliseURL( url )
+ url = CG.client_controller.network_engine.domain_manager.NormaliseURL( url )
except HydrusExceptions.URLClassException:
@@ -318,7 +319,7 @@ def GetExampleNetworkJob( self, network_job_factory ):
try:
- ( url_to_check, parser ) = HG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( self.url )
+ ( url_to_check, parser ) = CG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( self.url )
except HydrusExceptions.URLClassException:
@@ -362,7 +363,7 @@ def SetStatus( self, status, note = '', exception = None ):
def WorksInNewSystem( self ):
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.url )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( self.url )
if url_type == HC.URL_TYPE_GALLERY and can_parse:
@@ -398,7 +399,7 @@ def WorkOnURL( self, gallery_token_name, gallery_seed_log: "GallerySeedLog", fil
url_for_child_referral = gallery_url
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( gallery_url )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( gallery_url )
if url_type not in ( HC.URL_TYPE_GALLERY, HC.URL_TYPE_WATCHABLE ):
@@ -410,7 +411,7 @@ def WorkOnURL( self, gallery_token_name, gallery_seed_log: "GallerySeedLog", fil
raise HydrusExceptions.VetoException( 'Cannot parse {}: {}'.format( match_name, cannot_parse_reason) )
- ( url_to_check, parser ) = HG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( gallery_url )
+ ( url_to_check, parser ) = CG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( gallery_url )
status_hook( 'downloading gallery page' )
@@ -438,7 +439,7 @@ def WorkOnURL( self, gallery_token_name, gallery_seed_log: "GallerySeedLog", fil
network_job.OverrideBandwidth( 30 )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
with network_job_presentation_context_factory( network_job ) as njpc:
@@ -453,7 +454,7 @@ def WorkOnURL( self, gallery_token_name, gallery_seed_log: "GallerySeedLog", fil
if actual_fetched_url != url_to_check:
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( actual_fetched_url )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( actual_fetched_url )
if url_type == HC.URL_TYPE_GALLERY:
@@ -463,7 +464,7 @@ def WorkOnURL( self, gallery_token_name, gallery_seed_log: "GallerySeedLog", fil
url_for_child_referral = gallery_url
- ( url_to_check, parser ) = HG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( gallery_url )
+ ( url_to_check, parser ) = CG.client_controller.network_engine.domain_manager.GetURLToFetchAndParser( gallery_url )
else:
@@ -603,7 +604,7 @@ def WorkOnURL( self, gallery_token_name, gallery_seed_log: "GallerySeedLog", fil
# we have failed to parse a next page url, but we would still like one, so let's see if the url match can provide one
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( url_to_check )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( url_to_check )
if url_class is not None and url_class.CanGenerateNextGalleryPage():
@@ -1186,7 +1187,7 @@ def NotifyGallerySeedsUpdated( self, gallery_seeds ):
self._SetStatusDirty()
- HG.client_controller.pub( 'gallery_seed_log_gallery_seeds_updated', self._gallery_seed_log_key, gallery_seeds )
+ CG.client_controller.pub( 'gallery_seed_log_gallery_seeds_updated', self._gallery_seed_log_key, gallery_seeds )
def RemoveGallerySeeds( self, gallery_seeds_to_delete ):
diff --git a/hydrus/client/importing/ClientImportLocal.py b/hydrus/client/importing/ClientImportLocal.py
index 52e546fd7..0989750a9 100644
--- a/hydrus/client/importing/ClientImportLocal.py
+++ b/hydrus/client/importing/ClientImportLocal.py
@@ -4,7 +4,6 @@
import time
import typing
-from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
@@ -15,8 +14,8 @@
from hydrus.core.files import HydrusFileHandling
from hydrus.client import ClientConstants as CC
-from hydrus.client import ClientData
from hydrus.client import ClientFiles
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientPaths
from hydrus.client import ClientThreading
from hydrus.client.importing import ClientImportControl
@@ -108,7 +107,7 @@ def __init__( self, paths = None, file_import_options = None, metadata_routers =
self._last_serialisable_change_timestamp = 0
- HG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
+ CG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
def _GetSerialisableInfo( self ):
@@ -207,7 +206,7 @@ def status_hook( text ):
hash = file_seed.GetHash()
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
for router in self._metadata_routers:
@@ -412,7 +411,7 @@ def Start( self, page_key ):
self._page_key = page_key
- self._files_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
+ self._files_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
self._files_repeating_job.SetThreadSlotType( 'misc' )
@@ -460,7 +459,7 @@ def REPEATINGWorkOnFiles( self ):
self._WorkOnFiles()
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
self._SerialisableChangeMade()
@@ -777,7 +776,7 @@ def _ImportFiles( self, job_status ):
file_seed = self._file_seed_cache.GetNextFileSeed( CC.STATUS_UNKNOWN )
- p1 = HG.client_controller.new_options.GetBoolean( 'pause_import_folders_sync' ) or self._paused
+ p1 = CG.client_controller.new_options.GetBoolean( 'pause_import_folders_sync' ) or self._paused
p2 = HydrusThreading.IsThreadShuttingDown()
p3 = job_status.IsCancelled()
@@ -790,7 +789,7 @@ def _ImportFiles( self, job_status ):
if HydrusTime.TimeHasPassed( time_to_save ):
- HG.client_controller.WriteSynchronous( 'serialisable', self )
+ CG.client_controller.WriteSynchronous( 'serialisable', self )
time_to_save = HydrusTime.GetNow() + 600
@@ -814,7 +813,7 @@ def _ImportFiles( self, job_status ):
if self._tag_import_options.HasAdditionalTags() or len( self._metadata_routers ) > 0:
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
if self._tag_import_options.HasAdditionalTags():
@@ -824,7 +823,7 @@ def _ImportFiles( self, job_status ):
if content_update_package.HasContent():
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -847,7 +846,7 @@ def _ImportFiles( self, job_status ):
for ( tag_service_key, filename_tagging_options ) in self._tag_service_keys_to_filename_tagging_options.items():
- if not HG.client_controller.services_manager.ServiceExists( tag_service_key ):
+ if not CG.client_controller.services_manager.ServiceExists( tag_service_key ):
continue
@@ -873,7 +872,7 @@ def _ImportFiles( self, job_status ):
content_update_package = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromServiceKeysToTags( { hash }, service_keys_to_tags )
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -1141,7 +1140,7 @@ def DoWork( self ):
return
- if HG.client_controller.new_options.GetBoolean( 'pause_import_folders_sync' ) or self._paused:
+ if CG.client_controller.new_options.GetBoolean( 'pause_import_folders_sync' ) or self._paused:
return
@@ -1180,7 +1179,7 @@ def DoWork( self ):
if not pubbed_job_status and popup_desired:
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
pubbed_job_status = True
@@ -1196,7 +1195,7 @@ def DoWork( self ):
if not pubbed_job_status and popup_desired:
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
pubbed_job_status = True
@@ -1215,7 +1214,7 @@ def DoWork( self ):
if checked_folder or did_import_file_work or error_occured:
- HG.client_controller.WriteSynchronous( 'serialisable', self )
+ CG.client_controller.WriteSynchronous( 'serialisable', self )
job_status.FinishAndDismiss()
diff --git a/hydrus/client/importing/ClientImportSimpleURLs.py b/hydrus/client/importing/ClientImportSimpleURLs.py
index f1d59665b..eeed90ed9 100644
--- a/hydrus/client/importing/ClientImportSimpleURLs.py
+++ b/hydrus/client/importing/ClientImportSimpleURLs.py
@@ -11,6 +11,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.importing import ClientImportControl
from hydrus.client.importing import ClientImporting
from hydrus.client.importing import ClientImportFileSeeds
@@ -63,7 +64,7 @@ def __init__( self ):
self._last_serialisable_change_timestamp = 0
- HG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
+ CG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
def _DelayWork( self, time_delta, reason ):
@@ -235,7 +236,7 @@ def status_hook( text ):
except HydrusExceptions.NetworkException as e:
- delay = HG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
+ delay = CG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
self._DelayWork( delay, str( e ) )
@@ -298,7 +299,7 @@ def _WorkOnGallery( self ):
network_job.OverrideBandwidth( 30 )
- HG.client_controller.network_engine.AddJob( network_job )
+ CG.client_controller.network_engine.AddJob( network_job )
with self._PageNetworkJobPresentationContextFactory( network_job ):
@@ -370,7 +371,7 @@ def _WorkOnGallery( self ):
except HydrusExceptions.NetworkException as e:
- delay = HG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
+ delay = CG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
self._DelayWork( delay, str( e ) )
@@ -668,8 +669,8 @@ def Start( self, page_key ):
self._page_key = page_key
- self._files_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
- self._gallery_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnGallery )
+ self._files_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
+ self._gallery_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnGallery )
self._files_repeating_job.SetThreadSlotType( 'misc' )
self._gallery_repeating_job.SetThreadSlotType( 'misc' )
@@ -742,7 +743,7 @@ def REPEATINGWorkOnFiles( self ):
self._WorkOnFiles()
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
self._SerialisableChangeMade()
@@ -810,7 +811,7 @@ def REPEATINGWorkOnGallery( self ):
time.sleep( 1 )
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
self._SerialisableChangeMade()
@@ -875,8 +876,8 @@ def __init__( self ):
self._last_serialisable_change_timestamp = 0
- HG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
- HG.client_controller.sub( self, 'NotifyGallerySeedsUpdated', 'gallery_seed_log_gallery_seeds_updated' )
+ CG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
+ CG.client_controller.sub( self, 'NotifyGallerySeedsUpdated', 'gallery_seed_log_gallery_seeds_updated' )
def _DelayWork( self, time_delta, reason ):
@@ -1039,7 +1040,7 @@ def _WorkOnFiles( self ):
except HydrusExceptions.NetworkException as e:
- delay = HG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
+ delay = CG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
self._DelayWork( delay, str( e ) )
@@ -1085,7 +1086,7 @@ def file_seeds_callable( file_seeds ):
except HydrusExceptions.NetworkException as e:
- delay = HG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
+ delay = CG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
self._DelayWork( delay, str( e ) )
@@ -1293,7 +1294,7 @@ def PendURLs( self, urls, filterable_tags = None, additional_service_keys_to_tag
try:
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClass( url )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClass( url )
except HydrusExceptions.URLClassException:
@@ -1392,8 +1393,8 @@ def Start( self, page_key ):
self._page_key = page_key
- self._files_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
- self._gallery_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnGallery )
+ self._files_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
+ self._gallery_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnGallery )
self._files_repeating_job.SetThreadSlotType( 'misc' )
self._gallery_repeating_job.SetThreadSlotType( 'misc' )
@@ -1466,7 +1467,7 @@ def REPEATINGWorkOnFiles( self ):
self._WorkOnFiles()
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
self._SerialisableChangeMade()
@@ -1529,7 +1530,7 @@ def REPEATINGWorkOnGallery( self ):
time.sleep( 1 )
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
self._SerialisableChangeMade()
diff --git a/hydrus/client/importing/ClientImportSubscriptionLegacy.py b/hydrus/client/importing/ClientImportSubscriptionLegacy.py
index 7ef4de781..1ae7d12ef 100644
--- a/hydrus/client/importing/ClientImportSubscriptionLegacy.py
+++ b/hydrus/client/importing/ClientImportSubscriptionLegacy.py
@@ -11,6 +11,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientDownloading
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientTime
from hydrus.client.importing import ClientImporting
from hydrus.client.importing import ClientImportFileSeeds
@@ -126,7 +127,7 @@ def BandwidthOK( self, subscription_name ):
threshold = 90
- bandwidth_ok = HG.client_controller.network_engine.bandwidth_manager.CanDoWork( example_network_contexts, threshold = threshold )
+ bandwidth_ok = CG.client_controller.network_engine.bandwidth_manager.CanDoWork( example_network_contexts, threshold = threshold )
if HG.subscription_report_mode:
@@ -171,7 +172,7 @@ def DomainOK( self ):
url = file_seed.file_seed_data
- domain_ok = HG.client_controller.network_engine.domain_manager.DomainOK( url )
+ domain_ok = CG.client_controller.network_engine.domain_manager.DomainOK( url )
if HG.subscription_report_mode:
@@ -185,7 +186,7 @@ def GetBandwidthWaitingEstimate( self, subscription_name ):
example_network_contexts = self._GetExampleNetworkContexts( subscription_name )
- ( estimate, bandwidth_network_context ) = HG.client_controller.network_engine.bandwidth_manager.GetWaitingEstimateAndContext( example_network_contexts )
+ ( estimate, bandwidth_network_context ) = CG.client_controller.network_engine.bandwidth_manager.GetWaitingEstimateAndContext( example_network_contexts )
return estimate
@@ -484,7 +485,7 @@ def __init__( self, name, gug_key_and_name = None ):
self._queries = []
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
self._checker_options = new_options.GetDefaultSubscriptionCheckerOptions()
@@ -517,7 +518,7 @@ def __init__( self, name, gug_key_and_name = None ):
def _CanDoWorkNow( self ):
- p1 = not ( self._paused or HG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ) or HG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ) )
+ p1 = not ( self._paused or CG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ) or CG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ) )
p2 = not ( HG.started_shutdown or HydrusThreading.IsThreadShuttingDown() )
p3 = self._NoDelays()
@@ -525,7 +526,7 @@ def _CanDoWorkNow( self ):
message = 'Subscription "{}" CanDoWork check.'.format( self._name )
message += os.linesep
- message += 'Paused/Global/Network Pause: {}/{}/{}'.format( self._paused, HG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ), HG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ) )
+ message += 'Paused/Global/Network Pause: {}/{}/{}'.format( self._paused, CG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ), CG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ) )
message += os.linesep
message += 'Started/Thread shutdown: {}/{}'.format( HG.started_shutdown, HydrusThreading.IsThreadShuttingDown() )
message += os.linesep
@@ -571,7 +572,7 @@ def _GetQueriesForProcessing( self ) -> typing.List[ SubscriptionQueryLegacy ]:
queries = list( self._queries )
- if HG.client_controller.new_options.GetBoolean( 'process_subs_in_random_order' ):
+ if CG.client_controller.new_options.GetBoolean( 'process_subs_in_random_order' ):
random.shuffle( queries )
@@ -649,7 +650,7 @@ def _QueryFileLoginOK( self, query ):
nj = file_seed.GetExampleNetworkJob( self._GenerateNetworkJobFactory( query ) )
- nj.engine = HG.client_controller.network_engine
+ nj.engine = CG.client_controller.network_engine
if nj.CurrentlyNeedsLogin():
@@ -709,7 +710,7 @@ def _QuerySyncLoginOK( self, query ):
nj = gallery_seed.GetExampleNetworkJob( self._GenerateNetworkJobFactory( query ) )
- nj.engine = HG.client_controller.network_engine
+ nj.engine = CG.client_controller.network_engine
if nj.CurrentlyNeedsLogin():
diff --git a/hydrus/client/importing/ClientImportSubscriptions.py b/hydrus/client/importing/ClientImportSubscriptions.py
index 6af73f0ba..8b9ac2ab5 100644
--- a/hydrus/client/importing/ClientImportSubscriptions.py
+++ b/hydrus/client/importing/ClientImportSubscriptions.py
@@ -13,7 +13,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
-from hydrus.client import ClientData
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client import ClientTime
from hydrus.client.importing import ClientImporting
@@ -45,7 +45,7 @@ def __init__( self, name, gug_key_and_name = None ):
self._query_headers: typing.List[ ClientImportSubscriptionQuery.SubscriptionQueryHeader ] = []
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
self._checker_options = new_options.GetDefaultSubscriptionCheckerOptions()
@@ -89,7 +89,7 @@ def __init__( self, name, gug_key_and_name = None ):
def _CanDoWorkNow( self ):
- p1 = not ( self._paused or HG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ) or HG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ) or HG.client_controller.subscriptions_manager.SubscriptionsArePausedForEditing() )
+ p1 = not ( self._paused or CG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ) or CG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ) or CG.client_controller.subscriptions_manager.SubscriptionsArePausedForEditing() )
p2 = not ( HG.started_shutdown or self._stop_work_for_shutdown )
p3 = self._NoDelays()
@@ -97,7 +97,7 @@ def _CanDoWorkNow( self ):
message = 'Subscription "{}" CanDoWork check.'.format( self._name )
message += os.linesep
- message += 'Paused/Global/Network/Dialog Pause: {}/{}/{}/{}'.format( self._paused, HG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ), HG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ), HG.client_controller.subscriptions_manager.SubscriptionsArePausedForEditing() )
+ message += 'Paused/Global/Network/Dialog Pause: {}/{}/{}/{}'.format( self._paused, CG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ), CG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ), CG.client_controller.subscriptions_manager.SubscriptionsArePausedForEditing() )
message += os.linesep
message += 'Started/Sub shutdown: {}/{}'.format( HG.started_shutdown, self._stop_work_for_shutdown )
message += os.linesep
@@ -152,7 +152,7 @@ def _GetQueryHeadersForProcessing( self ) -> typing.List[ ClientImportSubscripti
query_headers = list( self._query_headers )
- if HG.client_controller.new_options.GetBoolean( 'process_subs_in_random_order' ):
+ if CG.client_controller.new_options.GetBoolean( 'process_subs_in_random_order' ):
random.shuffle( query_headers )
@@ -244,7 +244,7 @@ def _ShowHitPeriodicFileLimitMessage( self, query_name: int, query_text: int, fi
message += os.linesep
message += 'Either a user uploaded a lot of files to that query in a short period, in which case there is a gap in your subscription you may wish to fill, or the site has just changed its URL format, in which case you may see several of these messages for this site over the coming weeks, and you should ignore them.'
- call = HydrusData.Call( HG.client_controller.pub, 'make_new_subscription_gap_downloader', self._gug_key_and_name, query_text, self._file_import_options.Duplicate(), self._tag_import_options.Duplicate(), self._note_import_options, file_limit * 5 )
+ call = HydrusData.Call( CG.client_controller.pub, 'make_new_subscription_gap_downloader', self._gug_key_and_name, query_text, self._file_import_options.Duplicate(), self._tag_import_options.Duplicate(), self._note_import_options, file_limit * 5 )
call.SetLabel( 'start a new downloader for this to fill in the gap!' )
@@ -253,14 +253,14 @@ def _ShowHitPeriodicFileLimitMessage( self, query_name: int, query_text: int, fi
job_status.SetStatusText( message )
job_status.SetUserCallable( call )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
def _SyncQueries( self, job_status ):
self._have_made_an_initial_sync_bandwidth_notification = False
- gug = HG.client_controller.network_engine.domain_manager.GetGUG( self._gug_key_and_name )
+ gug = CG.client_controller.network_engine.domain_manager.GetGUG( self._gug_key_and_name )
if gug is None:
@@ -311,7 +311,7 @@ def _SyncQueries( self, job_status ):
try:
- query_log_container = HG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
+ query_log_container = CG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
except HydrusExceptions.DBException as e:
@@ -337,7 +337,7 @@ def _SyncQueries( self, job_status ):
finally:
- HG.client_controller.WriteSynchronous( 'serialisable', query_log_container )
+ CG.client_controller.WriteSynchronous( 'serialisable', query_log_container )
@@ -412,7 +412,7 @@ def _SyncQuery(
while gallery_seed_log.WorkToDo():
p1 = not self._CanDoWorkNow()
- ( login_ok, login_reason ) = query_header.GalleryLoginOK( HG.client_controller.network_engine, self._name )
+ ( login_ok, login_reason ) = query_header.GalleryLoginOK( CG.client_controller.network_engine, self._name )
if p1 or not login_ok:
@@ -710,7 +710,7 @@ def file_seeds_callable( gallery_page_of_file_seeds ):
if this_is_initial_sync:
- if not query_header.FileBandwidthOK( HG.client_controller.network_engine.bandwidth_manager, self._name ) and not self._have_made_an_initial_sync_bandwidth_notification:
+ if not query_header.FileBandwidthOK( CG.client_controller.network_engine.bandwidth_manager, self._name ) and not self._have_made_an_initial_sync_bandwidth_notification:
HydrusData.ShowText( 'FYI: The query "{}" for subscription "{}" performed its initial sync ok, but it is short on bandwidth right now, so no files will be downloaded yet. The subscription will catch up in future as bandwidth becomes available. You can review the estimated time until bandwidth is available under the manage subscriptions dialog. If more queries are performing initial syncs in this run, they may be the same.'.format( query_name, self._name ) )
@@ -740,7 +740,7 @@ def _SyncQueryLogContainers( self ):
try:
- query_log_container = HG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
+ query_log_container = CG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
except HydrusExceptions.DBException as e:
@@ -887,7 +887,7 @@ def _WorkOnQueriesFiles( self, job_status ):
try:
- query_log_container = HG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
+ query_log_container = CG.client_controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_SUBSCRIPTION_QUERY_LOG_CONTAINER, query_header.GetQueryLogContainerName() )
except HydrusExceptions.DBException as e:
@@ -913,7 +913,7 @@ def _WorkOnQueriesFiles( self, job_status ):
finally:
- HG.client_controller.WriteSynchronous( 'serialisable', query_log_container )
+ CG.client_controller.WriteSynchronous( 'serialisable', query_log_container )
@@ -934,8 +934,8 @@ def _WorkOnQueriesFilesCanDoWork( self ):
if query_header.HasFileWorkToDo():
- bandwidth_ok = query_header.FileBandwidthOK( HG.client_controller.network_engine.bandwidth_manager, self._name )
- domain_ok = query_header.FileDomainOK( HG.client_controller.network_engine.domain_manager )
+ bandwidth_ok = query_header.FileBandwidthOK( CG.client_controller.network_engine.bandwidth_manager, self._name )
+ domain_ok = query_header.FileDomainOK( CG.client_controller.network_engine.domain_manager )
if HG.subscription_report_mode:
@@ -1006,9 +1006,9 @@ def _WorkOnQueryFiles(
p1 = not self._CanDoWorkNow()
- p3 = not query_header.FileDomainOK( HG.client_controller.network_engine.domain_manager )
- p4 = not query_header.FileBandwidthOK( HG.client_controller.network_engine.bandwidth_manager, self._name )
- ( login_ok, login_reason ) = query_header.FileLoginOK( HG.client_controller.network_engine, self._name )
+ p3 = not query_header.FileDomainOK( CG.client_controller.network_engine.domain_manager )
+ p4 = not query_header.FileBandwidthOK( CG.client_controller.network_engine.bandwidth_manager, self._name )
+ ( login_ok, login_reason ) = query_header.FileLoginOK( CG.client_controller.network_engine, self._name )
if p1 or p4 or not login_ok:
@@ -1084,7 +1084,7 @@ def status_hook( text ):
hash = file_seed.GetHash()
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
downloaded_tags = []
@@ -1092,7 +1092,7 @@ def status_hook( text ):
if content_update_package.HasContent():
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -1155,7 +1155,7 @@ def status_hook( text ):
time.sleep( 5 )
- error_count_threshold = HG.client_controller.new_options.GetNoneableInteger( 'subscription_file_error_cancel_threshold' )
+ error_count_threshold = CG.client_controller.new_options.GetNoneableInteger( 'subscription_file_error_cancel_threshold' )
if error_count_threshold is not None and self._file_error_count >= error_count_threshold:
@@ -1177,7 +1177,7 @@ def status_hook( text ):
time.sleep( ClientImporting.DID_SUBSTANTIAL_FILE_WORK_MINIMUM_SLEEP_TIME )
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
finally:
@@ -1309,7 +1309,7 @@ def GetBestEarliestNextWorkTime( self ):
for query_header in self._query_headers:
- next_work_time = query_header.GetNextWorkTime( HG.client_controller.network_engine.bandwidth_manager, self._name )
+ next_work_time = query_header.GetNextWorkTime( CG.client_controller.network_engine.bandwidth_manager, self._name )
if next_work_time is not None:
@@ -1663,7 +1663,7 @@ def Sync( self ):
if self._show_a_popup_while_working:
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
# it is possible a query becomes due for a check while others are syncing, so we repeat this while watching for a stop signal
@@ -1680,7 +1680,7 @@ def Sync( self ):
except HydrusExceptions.NetworkException as e:
- delay = HG.client_controller.new_options.GetInteger( 'subscription_network_error_delay' )
+ delay = CG.client_controller.new_options.GetInteger( 'subscription_network_error_delay' )
HydrusData.Print( 'The subscription ' + self._name + ' encountered an exception when trying to sync:' )
@@ -1697,7 +1697,7 @@ def Sync( self ):
HydrusData.ShowText( 'The subscription ' + self._name + ' encountered an exception when trying to sync:' )
HydrusData.ShowException( e )
- delay = HG.client_controller.new_options.GetInteger( 'subscription_other_error_delay' )
+ delay = CG.client_controller.new_options.GetInteger( 'subscription_other_error_delay' )
self._DelayWork( delay, 'error: ' + str( e ) )
@@ -1874,8 +1874,8 @@ def _GetMainLoopWaitTime( self ):
def _GetSubscriptionReadyToGo( self ):
- p1 = HG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ) or self._pause_subscriptions_for_editing
- p2 = HG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' )
+ p1 = CG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ) or self._pause_subscriptions_for_editing
+ p2 = CG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' )
p3 = HG.started_shutdown
if p1 or p2 or p3:
@@ -1883,7 +1883,7 @@ def _GetSubscriptionReadyToGo( self ):
return None
- max_simultaneous_subscriptions = HG.client_controller.new_options.GetInteger( 'max_simultaneous_subscriptions' )
+ max_simultaneous_subscriptions = CG.client_controller.new_options.GetInteger( 'max_simultaneous_subscriptions' )
if len( self._names_to_running_subscription_info ) >= max_simultaneous_subscriptions:
@@ -1908,7 +1908,7 @@ def _GetSubscriptionReadyToGo( self ):
possible_names = list( possible_names )
- if HG.client_controller.new_options.GetBoolean( 'process_subs_in_random_order' ):
+ if CG.client_controller.new_options.GetBoolean( 'process_subs_in_random_order' ):
subscription_name = random.choice( possible_names )
@@ -1955,8 +1955,8 @@ def _UpdateSubscriptionInfo( self, subscription: Subscription, just_finished_wor
else:
- p1 = HG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ) or self._pause_subscriptions_for_editing
- p2 = HG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' )
+ p1 = CG.client_controller.new_options.GetBoolean( 'pause_subs_sync' ) or self._pause_subscriptions_for_editing
+ p2 = CG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' )
stopped_because_pause = p1 or p2
@@ -2008,7 +2008,7 @@ def MainLoop( self ):
job = SubscriptionJob( self._controller, subscription )
- HG.client_controller.CallToThread( job.Work )
+ CG.client_controller.CallToThread( job.Work )
self._names_to_running_subscription_info[ subscription.GetName() ] = ( job, subscription )
diff --git a/hydrus/client/importing/ClientImportWatchers.py b/hydrus/client/importing/ClientImportWatchers.py
index 549d9c0a8..042ffc4a5 100644
--- a/hydrus/client/importing/ClientImportWatchers.py
+++ b/hydrus/client/importing/ClientImportWatchers.py
@@ -10,6 +10,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientData
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientTime
from hydrus.client.importing import ClientImportControl
from hydrus.client.importing import ClientImporting
@@ -42,7 +43,7 @@ def __init__( self, url = None ):
self._highlighted_watcher_url = None
- self._checker_options = HG.client_controller.new_options.GetDefaultWatcherCheckerOptions()
+ self._checker_options = CG.client_controller.new_options.GetDefaultWatcherCheckerOptions()
self._file_import_options = FileImportOptions.FileImportOptions()
self._file_import_options.SetIsDefault( True )
@@ -193,7 +194,7 @@ def _UpdateSerialisableInfo( self, version, old_serialisable_info ):
try:
- checker_options = HG.client_controller.new_options.GetDefaultWatcherCheckerOptions()
+ checker_options = CG.client_controller.new_options.GetDefaultWatcherCheckerOptions()
file_import_options = FileImportOptions.FileImportOptions()
file_import_options.SetIsDefault( True )
@@ -242,7 +243,7 @@ def AddURL( self, url, filterable_tags = None, additional_service_keys_to_tags =
return None
- url = HG.client_controller.network_engine.domain_manager.NormaliseURL( url )
+ url = CG.client_controller.network_engine.domain_manager.NormaliseURL( url )
with self._lock:
@@ -614,7 +615,7 @@ def Start( self, page_key ):
self._page_key = page_key
# set a 2s period so the page value/range is breddy snappy
- self._watchers_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), 2.0, self.REPEATINGWorkOnWatchers )
+ self._watchers_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), 2.0, self.REPEATINGWorkOnWatchers )
for watcher in self._watchers:
@@ -669,7 +670,7 @@ def REPEATINGWorkOnWatchers( self ):
self._last_pubbed_value_range = current_value_range
- HG.client_controller.pub( 'refresh_page_name', self._page_key )
+ CG.client_controller.pub( 'refresh_page_name', self._page_key )
@@ -699,7 +700,7 @@ def __init__( self ):
self._external_filterable_tags = set()
self._external_additional_service_keys_to_tags = ClientTags.ServiceKeysToTags()
- self._checker_options = HG.client_controller.new_options.GetDefaultWatcherCheckerOptions()
+ self._checker_options = CG.client_controller.new_options.GetDefaultWatcherCheckerOptions()
self._file_import_options = FileImportOptions.FileImportOptions()
self._file_import_options.SetIsDefault( True )
@@ -746,7 +747,7 @@ def __init__( self ):
self._last_serialisable_change_timestamp = 0
- HG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
+ CG.client_controller.sub( self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated' )
def _CheckerNetworkJobPresentationContextFactory( self, network_job ):
@@ -845,7 +846,7 @@ def title_hook( text ):
except HydrusExceptions.NetworkException as e:
- delay = HG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
+ delay = CG.client_controller.new_options.GetInteger( 'downloader_network_error_delay' )
self._DelayWork( delay, str( e ) )
@@ -1761,7 +1762,7 @@ def SetURL( self, url ):
try:
- url = HG.client_controller.network_engine.domain_manager.NormaliseURL( url )
+ url = CG.client_controller.network_engine.domain_manager.NormaliseURL( url )
except HydrusExceptions.URLClassException:
@@ -1795,8 +1796,8 @@ def Start( self, page_key, publish_to_page ):
self._UpdateFileVelocityStatus()
- self._files_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
- self._checker_repeating_job = HG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnChecker )
+ self._files_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnFiles )
+ self._checker_repeating_job = CG.client_controller.CallRepeating( ClientImporting.GetRepeatingJobInitialDelay(), ClientImporting.REPEATING_JOB_TYPICAL_PERIOD, self.REPEATINGWorkOnChecker )
self._files_repeating_job.SetThreadSlotType( 'watcher_files' )
self._checker_repeating_job.SetThreadSlotType( 'watcher_check' )
@@ -1871,7 +1872,7 @@ def REPEATINGWorkOnFiles( self ):
self._WorkOnFiles()
- HG.client_controller.WaitUntilViewFree()
+ CG.client_controller.WaitUntilViewFree()
self._SerialisableChangeMade()
@@ -1920,7 +1921,7 @@ def CheckCanDoCheckerWork( self ):
raise HydrusExceptions.VetoException( 'paused' )
- if HG.client_controller.new_options.GetBoolean( 'pause_all_watcher_checkers' ):
+ if CG.client_controller.new_options.GetBoolean( 'pause_all_watcher_checkers' ):
raise HydrusExceptions.VetoException( 'all checkers are paused! network->pause to resume!' )
diff --git a/hydrus/client/importing/ClientImporting.py b/hydrus/client/importing/ClientImporting.py
index 59adf4e40..f9d8ad8c8 100644
--- a/hydrus/client/importing/ClientImporting.py
+++ b/hydrus/client/importing/ClientImporting.py
@@ -4,9 +4,9 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
-from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientThreading
from hydrus.client.importing import ClientImportFileSeeds
@@ -127,12 +127,12 @@ def PublishPresentationHashes( publishing_label: str, hashes: typing.List[ bytes
job_status.Finish() # important to later make it auto-dismiss on all files disappearing
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
if publish_files_to_page:
- HG.client_controller.pub( 'imported_files_to_page', list( hashes ), publishing_label )
+ CG.client_controller.pub( 'imported_files_to_page', list( hashes ), publishing_label )
diff --git a/hydrus/client/importing/options/FileImportOptions.py b/hydrus/client/importing/options/FileImportOptions.py
index 8295a2366..1978b7245 100644
--- a/hydrus/client/importing/options/FileImportOptions.py
+++ b/hydrus/client/importing/options/FileImportOptions.py
@@ -4,11 +4,10 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusSerialisable
-from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client.importing.options import PresentationImportOptions
from hydrus.client.search import ClientSearch
@@ -20,7 +19,7 @@ def GetRealFileImportOptions( file_import_options: "FileImportOptions", loud_or_
if file_import_options.IsDefault():
- file_import_options = HG.client_controller.new_options.GetDefaultFileImportOptions( loud_or_quiet )
+ file_import_options = CG.client_controller.new_options.GetDefaultFileImportOptions( loud_or_quiet )
return file_import_options
@@ -65,7 +64,7 @@ def __init__( self ):
try:
- fallback = HG.client_controller.services_manager.GetLocalMediaFileServices()[0].GetServiceKey()
+ fallback = CG.client_controller.services_manager.GetLocalMediaFileServices()[0].GetServiceKey()
except:
diff --git a/hydrus/client/importing/options/PresentationImportOptions.py b/hydrus/client/importing/options/PresentationImportOptions.py
index 1b262a84a..df3c0a0f0 100644
--- a/hydrus/client/importing/options/PresentationImportOptions.py
+++ b/hydrus/client/importing/options/PresentationImportOptions.py
@@ -2,6 +2,7 @@
from hydrus.core import HydrusSerialisable
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
PRESENTATION_STATUS_ANY_GOOD = 0
@@ -239,7 +240,7 @@ def GetSummary( self ):
else:
- s = 'in {}'.format( self._location_context.ToString( HG.client_controller.services_manager.GetName ) )
+ s = 'in {}'.format( self._location_context.ToString( CG.client_controller.services_manager.GetName ) )
summary = '{}, {}'.format( summary, s )
@@ -310,7 +311,7 @@ def GetPresentedHashes( self, hashes_and_statuses, location_context_override = N
if len( needs_inbox_lookup ) > 0:
- inbox_hashes = HG.client_controller.Read( 'inbox_hashes', needs_inbox_lookup )
+ inbox_hashes = CG.client_controller.Read( 'inbox_hashes', needs_inbox_lookup )
for ( hash, status ) in hashes_and_statuses:
@@ -345,7 +346,7 @@ def GetPresentedHashes( self, hashes_and_statuses, location_context_override = N
if not location_context.IsAllKnownFiles():
- presented_hashes = HG.client_controller.Read( 'filter_hashes', location_context, presented_hashes )
+ presented_hashes = CG.client_controller.Read( 'filter_hashes', location_context, presented_hashes )
diff --git a/hydrus/client/importing/options/TagImportOptions.py b/hydrus/client/importing/options/TagImportOptions.py
index 908648d17..c3874631f 100644
--- a/hydrus/client/importing/options/TagImportOptions.py
+++ b/hydrus/client/importing/options/TagImportOptions.py
@@ -3,15 +3,13 @@
import typing
from hydrus.core import HydrusConstants as HC
-from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusSerialisable
from hydrus.core import HydrusTags
-from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
-from hydrus.client import ClientData
+from hydrus.client import ClientGlobals as CG
from hydrus.client.importing.options import ClientImportOptions
from hydrus.client.media import ClientMediaResult
from hydrus.client.metadata import ClientContentUpdates
@@ -226,7 +224,7 @@ def GetTags( self, service_key, path ):
tags = HydrusTags.CleanTags( tags )
- tags = HG.client_controller.tag_display_manager.FilterTags( ClientTags.TAG_DISPLAY_STORAGE, service_key, tags )
+ tags = CG.client_controller.tag_display_manager.FilterTags( ClientTags.TAG_DISPLAY_STORAGE, service_key, tags )
return tags
@@ -280,9 +278,9 @@ def __init__( self, fetch_tags_even_if_url_recognised_and_file_already_in_db = F
def _GetSerialisableInfo( self ):
- if HG.client_controller.IsBooted():
+ if CG.client_controller.IsBooted():
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
test_func = services_manager.ServiceExists
@@ -495,7 +493,7 @@ def GetContentUpdatePackage( self, status: int, media_result: ClientMediaResult.
service_keys_to_tags = ClientTags.ServiceKeysToTags()
- for service_key in HG.client_controller.services_manager.GetServiceKeys( HC.REAL_TAG_SERVICES ):
+ for service_key in CG.client_controller.services_manager.GetServiceKeys( HC.REAL_TAG_SERVICES ):
service_additional_tags = set()
@@ -559,7 +557,7 @@ def GetSummary( self, show_downloader_options ):
try:
- name = HG.client_controller.services_manager.GetName( service_key )
+ name = CG.client_controller.services_manager.GetName( service_key )
except HydrusExceptions.DataMissing:
@@ -859,7 +857,7 @@ def GetTags( self, service_key: bytes, status: int, media_result: ClientMediaRes
tags.difference_update( applicable_tags )
- existing_applicable_tags = HG.client_controller.Read( 'filter_existing_tags', service_key, applicable_tags )
+ existing_applicable_tags = CG.client_controller.Read( 'filter_existing_tags', service_key, applicable_tags )
tags.update( existing_applicable_tags )
diff --git a/hydrus/client/interfaces/ClientControllerInterface.py b/hydrus/client/interfaces/ClientControllerInterface.py
index bcf85c4db..3cada38a9 100644
--- a/hydrus/client/interfaces/ClientControllerInterface.py
+++ b/hydrus/client/interfaces/ClientControllerInterface.py
@@ -1,3 +1,5 @@
+import typing
+
from qtpy import QtWidgets as QW
from hydrus.core.interfaces import HydrusControllerInterface
@@ -6,23 +8,28 @@
class ClientControllerInterface( HydrusControllerInterface.HydrusControllerInterface ):
- def CallBlockingToQt( self, win: QW.QWidget, func: callable, *args, **kwargs ) -> object:
+ def CallBlockingToQt( self, win: QW.QWidget, func: typing.Callable, *args, **kwargs ) -> object:
raise NotImplementedError()
- def CallAfterQtSafe( self, window: QW.QWidget, label: str, func: callable, *args, **kwargs ) -> ClientThreading.QtAwareJob:
+ def CallAfterQtSafe( self, window: QW.QWidget, label: str, func: typing.Callable, *args, **kwargs ) -> ClientThreading.QtAwareJob:
raise NotImplementedError()
- def CallLaterQtSafe( self, window: QW.QWidget, initial_delay: float, label: str, func: callable, *args, **kwargs ) -> ClientThreading.QtAwareJob:
+ def CallLaterQtSafe( self, window: QW.QWidget, initial_delay: float, label: str, func: typing.Callable, *args, **kwargs ) -> ClientThreading.QtAwareJob:
raise NotImplementedError()
- def CallRepeatingQtSafe( self, window: QW.QWidget, initial_delay: float, period: float, label: str, func: callable, *args, **kwargs ) -> ClientThreading.QtAwareRepeatingJob:
+ def CallRepeatingQtSafe( self, window: QW.QWidget, initial_delay: float, period: float, label: str, func: typing.Callable, *args, **kwargs ) -> ClientThreading.QtAwareRepeatingJob:
raise NotImplementedError()
+ def GetClipboardText( self ) -> str:
+
+ raise NotImplementedError()
+
+
diff --git a/hydrus/client/media/ClientMedia.py b/hydrus/client/media/ClientMedia.py
index d9be552e7..f5c95c18b 100644
--- a/hydrus/client/media/ClientMedia.py
+++ b/hydrus/client/media/ClientMedia.py
@@ -11,6 +11,7 @@
from hydrus.core.files import HydrusPSDHandling
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientTime
from hydrus.client.media import ClientMediaManagers
@@ -230,11 +231,11 @@ def GetShowAction( media: "MediaSingleton", canvas_type: int ):
if canvas_type == CC.CANVAS_PREVIEW:
- action = HG.client_controller.new_options.GetPreviewShowAction( mime )
+ action = CG.client_controller.new_options.GetPreviewShowAction( mime )
else:
- action = HG.client_controller.new_options.GetMediaShowAction( mime )
+ action = CG.client_controller.new_options.GetMediaShowAction( mime )
if mime == HC.APPLICATION_PSD and action[0] == CC.MEDIA_VIEWER_ACTION_SHOW_WITH_NATIVE and not HydrusPSDHandling.PSD_TOOLS_OK:
@@ -522,7 +523,7 @@ def DoesACollect( self ):
def ToString( self ):
s_list = list( self.namespaces )
- s_list.extend( [ HG.client_controller.services_manager.GetName( service_key ) for service_key in self.rating_service_keys if HG.client_controller.services_manager.ServiceExists( service_key ) ] )
+ s_list.extend( [ CG.client_controller.services_manager.GetName( service_key ) for service_key in self.rating_service_keys if CG.client_controller.services_manager.ServiceExists( service_key ) ] )
if len( s_list ) == 0:
@@ -1207,7 +1208,7 @@ def ProcessContentUpdatePackage( self, full_content_update_package: ClientConten
if action in ( HC.CONTENT_UPDATE_DELETE, HC.CONTENT_UPDATE_DELETE_FROM_SOURCE_AFTER_MIGRATE ):
- local_file_domains = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_file_domains = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
all_local_file_services = set( list( local_file_domains ) + [ CC.COMBINED_LOCAL_FILE_SERVICE_KEY, CC.COMBINED_LOCAL_MEDIA_SERVICE_KEY, CC.TRASH_SERVICE_KEY, CC.LOCAL_UPDATE_SERVICE_KEY ] )
#
@@ -1229,7 +1230,7 @@ def ProcessContentUpdatePackage( self, full_content_update_package: ClientConten
user_says_remove_and_possibly_trashed_from_non_trash_local_view = HC.options[ 'remove_trashed_files' ] and possibly_trashed and not we_are_looking_at_trash
- user_says_remove_and_moved_from_this_local_file_domain = HG.client_controller.new_options.GetBoolean( 'remove_local_domain_moved_files' ) and moved_from_this_domain_to_another
+ user_says_remove_and_moved_from_this_local_file_domain = CG.client_controller.new_options.GetBoolean( 'remove_local_domain_moved_files' ) and moved_from_this_domain_to_another
if physically_deleted_and_local_view or user_says_remove_and_possibly_trashed_from_non_trash_local_view or deleted_from_repo_and_repo_view or user_says_remove_and_moved_from_this_local_file_domain:
@@ -1314,7 +1315,7 @@ def Sort( self, media_sort = None ):
self._media_sort = media_sort
- media_sort_fallback = HG.client_controller.new_options.GetFallbackSort()
+ media_sort_fallback = CG.client_controller.new_options.GetFallbackSort()
media_sort_fallback.Sort( self._location_context, self._sorted_media )
@@ -1332,8 +1333,8 @@ def __init__( self, location_context: ClientLocation.LocationContext, media_resu
MediaList.__init__( self, location_context, media_results )
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
- HG.client_controller.sub( self, 'ProcessServiceUpdates', 'service_updates_gui' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_gui' )
+ CG.client_controller.sub( self, 'ProcessServiceUpdates', 'service_updates_gui' )
def AddMediaResults( self, media_results ):
@@ -1501,7 +1502,7 @@ def _RecalcHashes( self ):
deleted_to_timestamps_ms = {}
deleted_to_previously_imported_timestamps_ms = {}
- for service_key in HG.client_controller.services_manager.GetServiceKeys( HC.REAL_FILE_SERVICES ):
+ for service_key in CG.client_controller.services_manager.GetServiceKeys( HC.REAL_FILE_SERVICES ):
current_timestamps_ms = [ timestamp_ms for timestamp_ms in ( times_manager.GetImportedTimestampMS( service_key ) for times_manager in all_timestamp_managers ) if timestamp_ms is not None ]
@@ -1958,7 +1959,7 @@ def timestamp_ms_is_interesting( timestamp_ms_1, timestamp_ms_2 ):
if has_audio:
- audio_label = HG.client_controller.new_options.GetString( 'has_audio_label' )
+ audio_label = CG.client_controller.new_options.GetString( 'has_audio_label' )
info_string += f', {audio_label}'
@@ -1978,7 +1979,7 @@ def timestamp_ms_is_interesting( timestamp_ms_1, timestamp_ms_2 ):
current_service_keys = locations_manager.GetCurrent()
deleted_service_keys = locations_manager.GetDeleted()
- local_file_services = HG.client_controller.services_manager.GetLocalMediaFileServices()
+ local_file_services = CG.client_controller.services_manager.GetLocalMediaFileServices()
seen_local_file_service_timestamps_ms = set()
@@ -2000,7 +2001,7 @@ def timestamp_ms_is_interesting( timestamp_ms_1, timestamp_ms_2 ):
import_timestamp_ms = times_manager.GetImportedTimestampMS( CC.COMBINED_LOCAL_FILE_SERVICE_KEY )
- if HG.client_controller.new_options.GetBoolean( 'hide_uninteresting_local_import_time' ):
+ if CG.client_controller.new_options.GetBoolean( 'hide_uninteresting_local_import_time' ):
# if we haven't already printed this timestamp somewhere
line_is_interesting = False not in ( timestamp_ms_is_interesting( timestamp_ms, import_timestamp_ms ) for timestamp_ms in seen_local_file_service_timestamps_ms )
@@ -2063,7 +2064,7 @@ def timestamp_ms_is_interesting( timestamp_ms_1, timestamp_ms_2 ):
if file_modified_timestamp_ms is not None:
- if HG.client_controller.new_options.GetBoolean( 'hide_uninteresting_modified_time' ):
+ if CG.client_controller.new_options.GetBoolean( 'hide_uninteresting_modified_time' ):
# if we haven't already printed this timestamp somewhere
line_is_interesting = False not in ( timestamp_ms_is_interesting( timestamp_ms, file_modified_timestamp_ms ) for timestamp_ms in seen_local_file_service_timestamps_ms )
@@ -2105,13 +2106,13 @@ def timestamp_ms_is_interesting( timestamp_ms_1, timestamp_ms_2 ):
- for service_key in current_service_keys.intersection( HG.client_controller.services_manager.GetServiceKeys( HC.REMOTE_FILE_SERVICES ) ):
+ for service_key in current_service_keys.intersection( CG.client_controller.services_manager.GetServiceKeys( HC.REMOTE_FILE_SERVICES ) ):
timestamp_ms = times_manager.GetImportedTimestampMS( service_key )
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
except HydrusExceptions.DataMissing:
@@ -2189,7 +2190,7 @@ def GetTimesManager( self ):
def GetTitleString( self ):
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
tag_summary_generator = new_options.GetTagSummaryGenerator( 'media_viewer_top' )
@@ -2885,7 +2886,7 @@ def GetSortTypeString( self ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
name = service.GetName()
diff --git a/hydrus/client/media/ClientMediaFileFilter.py b/hydrus/client/media/ClientMediaFileFilter.py
index 9d52f46e5..e79051a1c 100644
--- a/hydrus/client/media/ClientMediaFileFilter.py
+++ b/hydrus/client/media/ClientMediaFileFilter.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusSerialisable
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client.media import ClientMedia
from hydrus.client.metadata import ClientTags
@@ -385,7 +386,7 @@ def ToString( self ):
file_service_key = self.filter_data
- s = HG.client_controller.services_manager.GetName( file_service_key )
+ s = CG.client_controller.services_manager.GetName( file_service_key )
elif self.filter_type == FILE_FILTER_TAGS:
@@ -395,7 +396,7 @@ def ToString( self ):
if tag_service_key != CC.COMBINED_TAG_SERVICE_KEY:
- s = '{} on {}'.format( s, HG.client_controller.services_manager.GetName( tag_service_key ) )
+ s = '{} on {}'.format( s, CG.client_controller.services_manager.GetName( tag_service_key ) )
s = HydrusText.ElideText( s, 64 )
@@ -492,5 +493,5 @@ def ReportDeleteLockFailures( medias: typing.Collection[ ClientMedia.Media ] ):
job_status.SetFiles( hashes, 'see them' )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
diff --git a/hydrus/client/media/ClientMediaManagers.py b/hydrus/client/media/ClientMediaManagers.py
index 39dba0594..8b36eeb92 100644
--- a/hydrus/client/media/ClientMediaManagers.py
+++ b/hydrus/client/media/ClientMediaManagers.py
@@ -11,6 +11,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientTime
from hydrus.client.metadata import ClientContentUpdates
@@ -750,7 +751,7 @@ def __init__(
def _AddToService( self, service_key, do_undelete = False, forced_import_time_ms = None ):
- service_type = HG.client_controller.services_manager.GetServiceType( service_key )
+ service_type = CG.client_controller.services_manager.GetServiceType( service_key )
if forced_import_time_ms is None:
@@ -787,7 +788,7 @@ def _AddToService( self, service_key, do_undelete = False, forced_import_time_ms
- local_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
if service_key in local_service_keys:
@@ -820,7 +821,7 @@ def _AddToService( self, service_key, do_undelete = False, forced_import_time_ms
if service_type in HC.FILE_SERVICES_COVERED_BY_COMBINED_DELETED_FILE:
- all_service_keys_covered_by_combined_deleted_files = HG.client_controller.services_manager.GetServiceKeys( HC.FILE_SERVICES_COVERED_BY_COMBINED_DELETED_FILE )
+ all_service_keys_covered_by_combined_deleted_files = CG.client_controller.services_manager.GetServiceKeys( HC.FILE_SERVICES_COVERED_BY_COMBINED_DELETED_FILE )
if len( self._deleted.intersection( all_service_keys_covered_by_combined_deleted_files ) ) == 0:
@@ -831,7 +832,7 @@ def _AddToService( self, service_key, do_undelete = False, forced_import_time_ms
def _DeleteFromService( self, service_key: bytes, reason: typing.Optional[ str ] ):
- service_type = HG.client_controller.services_manager.GetServiceType( service_key )
+ service_type = CG.client_controller.services_manager.GetServiceType( service_key )
if service_key in self._current:
@@ -863,7 +864,7 @@ def _DeleteFromService( self, service_key: bytes, reason: typing.Optional[ str ]
self._petitioned.discard( service_key )
- local_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
+ local_service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) )
if service_key in local_service_keys:
@@ -956,7 +957,7 @@ def GetPetitioned( self ):
def GetRemoteLocationStrings( self ):
- remote_file_services = list( HG.client_controller.services_manager.GetServices( ( HC.FILE_REPOSITORY, HC.IPFS ) ) )
+ remote_file_services = list( CG.client_controller.services_manager.GetServices( ( HC.FILE_REPOSITORY, HC.IPFS ) ) )
remote_file_services.sort( key = lambda s: s.GetName() )
@@ -1105,7 +1106,7 @@ def ProcessContentUpdate( self, service_key, content_update ):
if service_key == CC.COMBINED_LOCAL_FILE_SERVICE_KEY:
- service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, HC.COMBINED_LOCAL_FILE ) )
+ service_keys = CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, HC.COMBINED_LOCAL_FILE ) )
else:
@@ -1138,7 +1139,7 @@ def ProcessContentUpdate( self, service_key, content_update ):
elif action == HC.CONTENT_UPDATE_ADD:
- service_type = HG.client_controller.services_manager.GetServiceType( service_key )
+ service_type = CG.client_controller.services_manager.GetServiceType( service_key )
if service_type == HC.IPFS:
@@ -1171,7 +1172,7 @@ def ProcessContentUpdate( self, service_key, content_update ):
if service_key == CC.COMBINED_LOCAL_MEDIA_SERVICE_KEY:
- for s_k in HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) ):
+ for s_k in CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) ):
if s_k in self._current:
@@ -1181,7 +1182,7 @@ def ProcessContentUpdate( self, service_key, content_update ):
elif service_key == CC.COMBINED_LOCAL_FILE_SERVICE_KEY:
- for s_k in HG.client_controller.services_manager.GetServiceKeys( ( HC.COMBINED_LOCAL_MEDIA, HC.LOCAL_FILE_DOMAIN, HC.LOCAL_FILE_TRASH_DOMAIN, HC.LOCAL_FILE_UPDATE_DOMAIN ) ):
+ for s_k in CG.client_controller.services_manager.GetServiceKeys( ( HC.COMBINED_LOCAL_MEDIA, HC.LOCAL_FILE_DOMAIN, HC.LOCAL_FILE_TRASH_DOMAIN, HC.LOCAL_FILE_UPDATE_DOMAIN ) ):
if s_k in self._current:
@@ -1198,7 +1199,7 @@ def ProcessContentUpdate( self, service_key, content_update ):
if service_key == CC.COMBINED_LOCAL_MEDIA_SERVICE_KEY:
- for s_k in HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) ):
+ for s_k in CG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_FILE_DOMAIN, ) ):
if s_k in self._deleted:
@@ -1383,7 +1384,7 @@ def GetRating( self, service_key ):
else:
- service_type = HG.client_controller.services_manager.GetServiceType( service_key )
+ service_type = CG.client_controller.services_manager.GetServiceType( service_key )
if service_type == HC.LOCAL_RATING_INCDEC:
@@ -1398,7 +1399,7 @@ def GetRating( self, service_key ):
def GetRatingForAPI( self, service_key ) -> typing.Union[ int, bool, None ]:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
service_type = service.GetServiceType()
@@ -1602,7 +1603,7 @@ def _RecalcDisplayFilteredCache( self, tag_display_type ):
# display filtering
- tag_display_manager = HG.client_controller.tag_display_manager
+ tag_display_manager = CG.client_controller.tag_display_manager
source_service_keys_to_statuses_to_tags = self._tag_display_types_to_service_keys_to_statuses_to_tags[ ClientTags.TAG_DISPLAY_DISPLAY_ACTUAL ]
diff --git a/hydrus/client/media/ClientMediaResult.py b/hydrus/client/media/ClientMediaResult.py
index d40395b39..e0012dd00 100644
--- a/hydrus/client/media/ClientMediaResult.py
+++ b/hydrus/client/media/ClientMediaResult.py
@@ -4,6 +4,7 @@
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
+from hydrus.client import ClientGlobals as CG
from hydrus.client.media import ClientMediaManagers
class MediaResult( object ):
@@ -32,7 +33,7 @@ def DeletePending( self, service_key: bytes ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
except HydrusExceptions.DataMissing:
@@ -163,7 +164,7 @@ def IsDeleteLocked( self ):
# TODO: ultimately replace this with metadata conditionals for whatever the user likes, 'don't delete anything rated 5 stars', whatever
- delete_lock_for_archived_files = HG.client_controller.new_options.GetBoolean( 'delete_lock_for_archived_files' )
+ delete_lock_for_archived_files = CG.client_controller.new_options.GetBoolean( 'delete_lock_for_archived_files' )
if delete_lock_for_archived_files:
@@ -194,7 +195,7 @@ def ProcessContentUpdate( self, service_key, content_update ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
except HydrusExceptions.DataMissing:
diff --git a/hydrus/client/media/ClientMediaResultCache.py b/hydrus/client/media/ClientMediaResultCache.py
index d811fed90..724901804 100644
--- a/hydrus/client/media/ClientMediaResultCache.py
+++ b/hydrus/client/media/ClientMediaResultCache.py
@@ -3,12 +3,11 @@
import weakref
from hydrus.core import HydrusConstants as HC
-from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusLists
from hydrus.core import HydrusThreading
-from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.media import ClientMediaResult
from hydrus.client.metadata import ClientContentUpdates
from hydrus.client.metadata import ClientTags
@@ -40,12 +39,12 @@ def __init__( self ):
# this means that if a user refreshes a search and the existing media result handles briefly go to zero...
# or if the client api makes repeated requests on the same media results...
# then that won't be a chance for the weakvaluedict to step in. we'll keep this scratchpad of stuff
- self._fifo_timeout_cache = ClientCachesBase.DataCache( HG.client_controller, 'media result cache', 2048, 120 )
+ self._fifo_timeout_cache = ClientCachesBase.DataCache( CG.client_controller, 'media result cache', 2048, 120 )
- HG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_data' )
- HG.client_controller.sub( self, 'ProcessServiceUpdates', 'service_updates_data' )
- HG.client_controller.sub( self, 'NewForceRefreshTags', 'notify_new_force_refresh_tags_data' )
- HG.client_controller.sub( self, 'NewTagDisplayRules', 'notify_new_tag_display_rules' )
+ CG.client_controller.sub( self, 'ProcessContentUpdatePackage', 'content_updates_data' )
+ CG.client_controller.sub( self, 'ProcessServiceUpdates', 'service_updates_data' )
+ CG.client_controller.sub( self, 'NewForceRefreshTags', 'notify_new_force_refresh_tags_data' )
+ CG.client_controller.sub( self, 'NewTagDisplayRules', 'notify_new_tag_display_rules' )
def AddMediaResults( self, media_results: typing.Iterable[ ClientMediaResult.MediaResult ] ):
@@ -151,7 +150,7 @@ def do_it( hash_ids ):
return
- hash_ids_to_tags_managers = HG.client_controller.Read( 'force_refresh_tags_managers', group_of_hash_ids )
+ hash_ids_to_tags_managers = CG.client_controller.Read( 'force_refresh_tags_managers', group_of_hash_ids )
with self._lock:
@@ -167,7 +166,7 @@ def do_it( hash_ids ):
- HG.client_controller.pub( 'refresh_all_tag_presentation_gui' )
+ CG.client_controller.pub( 'refresh_all_tag_presentation_gui' )
with self._lock:
@@ -175,7 +174,7 @@ def do_it( hash_ids ):
hash_ids = list( self._hash_ids_to_media_results.keys() )
- HG.client_controller.CallToThread( do_it, hash_ids )
+ CG.client_controller.CallToThread( do_it, hash_ids )
def NewTagDisplayRules( self ):
@@ -188,7 +187,7 @@ def NewTagDisplayRules( self ):
- HG.client_controller.pub( 'refresh_all_tag_presentation_gui' )
+ CG.client_controller.pub( 'refresh_all_tag_presentation_gui' )
def ProcessContentUpdatePackage( self, content_update_package: ClientContentUpdates.ContentUpdatePackage ):
diff --git a/hydrus/client/metadata/ClientContentUpdates.py b/hydrus/client/metadata/ClientContentUpdates.py
index 21f629e00..7ad0f9db3 100644
--- a/hydrus/client/metadata/ClientContentUpdates.py
+++ b/hydrus/client/metadata/ClientContentUpdates.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusSerialisable
from hydrus.core.networking import HydrusNetwork
+from hydrus.client import ClientGlobals as CG
def ConvertClientToServerUpdateToContentUpdates( client_to_server_update: HydrusNetwork.ClientToServerUpdate ):
content_updates = []
@@ -270,7 +271,7 @@ def AddServiceKeysToTags( self, hashes, service_keys_to_tags ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
except HydrusExceptions.DataMissing:
@@ -354,7 +355,7 @@ def ToString( self ) -> str:
if len( content_updates ) > 0:
- name = HG.client_controller.services_manager.GetName( service_key )
+ name = CG.client_controller.services_manager.GetName( service_key )
locations.add( name )
diff --git a/hydrus/client/metadata/ClientMetadataMigrationExporters.py b/hydrus/client/metadata/ClientMetadataMigrationExporters.py
index f4ac3aa2a..d284bd540 100644
--- a/hydrus/client/metadata/ClientMetadataMigrationExporters.py
+++ b/hydrus/client/metadata/ClientMetadataMigrationExporters.py
@@ -11,6 +11,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientStrings
from hydrus.client import ClientTime
from hydrus.client.importing.options import NoteImportOptions
@@ -112,7 +113,7 @@ def Export( self, hash: bytes, rows: typing.Collection[ str ] ):
names_and_notes.append( ( name, text ) )
- media_result = HG.client_controller.Read( 'media_result', hash )
+ media_result = CG.client_controller.Read( 'media_result', hash )
note_import_options = NoteImportOptions.NoteImportOptions()
@@ -124,7 +125,7 @@ def Export( self, hash: bytes, rows: typing.Collection[ str ] ):
if content_update_package.HasContent():
- HG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
+ CG.client_controller.WriteSynchronous( 'content_updates', content_update_package )
@@ -203,7 +204,7 @@ def Export( self, hash: bytes, rows: typing.Collection[ str ] ):
return
- if HG.client_controller.services_manager.GetServiceType( self._service_key ) == HC.LOCAL_TAG:
+ if CG.client_controller.services_manager.GetServiceType( self._service_key ) == HC.LOCAL_TAG:
add_content_action = HC.CONTENT_UPDATE_ADD
@@ -220,7 +221,7 @@ def Export( self, hash: bytes, rows: typing.Collection[ str ] ):
content_updates = [ ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_MAPPINGS, add_content_action, ( tag, hashes ) ) for tag in tags ]
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( self._service_key, content_updates ) )
@@ -233,7 +234,7 @@ def ToString( self ) -> str:
try:
- name = HG.client_controller.services_manager.GetName( self._service_key )
+ name = CG.client_controller.services_manager.GetName( self._service_key )
except:
@@ -306,7 +307,7 @@ def Export( self, hash: bytes, rows: typing.Collection[ str ] ):
content_updates = [ ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_TIMESTAMP, HC.CONTENT_UPDATE_SET, ( ( hash, ), new_timestamp_data ) ) ]
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_updates ) )
def GetExampleStrings( self ):
@@ -371,7 +372,7 @@ def Export( self, hash: bytes, rows: typing.Collection[ str ] ):
try:
- url = HG.client_controller.network_engine.domain_manager.NormaliseURL( row )
+ url = CG.client_controller.network_engine.domain_manager.NormaliseURL( row )
urls.append( url )
@@ -389,7 +390,7 @@ def Export( self, hash: bytes, rows: typing.Collection[ str ] ):
content_updates = [ ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_URLS, HC.CONTENT_UPDATE_ADD, ( urls, hashes ) ) ]
- HG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_updates ) )
+ CG.client_controller.WriteSynchronous( 'content_updates', ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdates( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, content_updates ) )
def GetExampleStrings( self ):
diff --git a/hydrus/client/metadata/ClientMetadataMigrationImporters.py b/hydrus/client/metadata/ClientMetadataMigrationImporters.py
index 92d36adb6..4ceefdc12 100644
--- a/hydrus/client/metadata/ClientMetadataMigrationImporters.py
+++ b/hydrus/client/metadata/ClientMetadataMigrationImporters.py
@@ -8,6 +8,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientStrings
from hydrus.client import ClientTime
@@ -274,7 +275,7 @@ def ToString( self ) -> str:
try:
- name = HG.client_controller.services_manager.GetName( self._service_key )
+ name = CG.client_controller.services_manager.GetName( self._service_key )
except:
diff --git a/hydrus/client/metadata/ClientRatings.py b/hydrus/client/metadata/ClientRatings.py
index 60dcdbcac..ccd34a9fe 100644
--- a/hydrus/client/metadata/ClientRatings.py
+++ b/hydrus/client/metadata/ClientRatings.py
@@ -1,5 +1,6 @@
from hydrus.core import HydrusExceptions
-from hydrus.core import HydrusGlobals as HG
+
+from hydrus.client import ClientGlobals as CG
LIKE = 0
DISLIKE = 1
@@ -142,7 +143,7 @@ def GetShape( service_key ):
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
shape = service.GetShape()
diff --git a/hydrus/client/metadata/ClientTags.py b/hydrus/client/metadata/ClientTags.py
index c7c2aee18..19a7382d5 100644
--- a/hydrus/client/metadata/ClientTags.py
+++ b/hydrus/client/metadata/ClientTags.py
@@ -1,12 +1,10 @@
import collections
-import threading
import typing
-from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusSerialisable
from hydrus.core import HydrusTags
-from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
TAG_DISPLAY_STORAGE = 0
TAG_DISPLAY_DISPLAY_ACTUAL = 1
@@ -39,7 +37,7 @@ def RenderTag( tag, render_for_user: bool ):
if render_for_user:
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
if new_options.GetBoolean( 'replace_tag_underscores_with_spaces' ):
diff --git a/hydrus/client/metadata/ClientTagsHandling.py b/hydrus/client/metadata/ClientTagsHandling.py
index 5947fb449..086c844d4 100644
--- a/hydrus/client/metadata/ClientTagsHandling.py
+++ b/hydrus/client/metadata/ClientTagsHandling.py
@@ -5,7 +5,6 @@
import typing
from hydrus.core import HydrusConstants as HC
-from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusSerialisable
@@ -13,6 +12,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
class TagAutocompleteOptions( HydrusSerialisable.SerialisableBase ):
@@ -386,7 +386,7 @@ def _GetRestTime( self, service_key, expected_work_time, actual_work_time ):
self._go_faster.discard( service_key )
- rest_ratio = HG.client_controller.new_options.GetInteger( 'tag_display_processing_rest_percentage_work_hard' ) / 100
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'tag_display_processing_rest_percentage_work_hard' ) / 100
@@ -394,11 +394,11 @@ def _GetRestTime( self, service_key, expected_work_time, actual_work_time ):
if self._controller.CurrentlyIdle():
- rest_ratio = HG.client_controller.new_options.GetInteger( 'tag_display_processing_rest_percentage_idle' ) / 100
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'tag_display_processing_rest_percentage_idle' ) / 100
else:
- rest_ratio = HG.client_controller.new_options.GetInteger( 'tag_display_processing_rest_percentage_normal' ) / 100
+ rest_ratio = CG.client_controller.new_options.GetInteger( 'tag_display_processing_rest_percentage_normal' ) / 100
if actual_work_time > expected_work_time * 10:
@@ -451,17 +451,17 @@ def _GetWorkTime( self, service_key ):
if service_key in self._go_faster:
- return HG.client_controller.new_options.GetInteger( 'tag_display_processing_work_time_ms_work_hard' ) / 1000
+ return CG.client_controller.new_options.GetInteger( 'tag_display_processing_work_time_ms_work_hard' ) / 1000
if self._controller.CurrentlyIdle():
- return HG.client_controller.new_options.GetInteger( 'tag_display_processing_work_time_ms_idle' ) / 1000
+ return CG.client_controller.new_options.GetInteger( 'tag_display_processing_work_time_ms_idle' ) / 1000
else:
- return HG.client_controller.new_options.GetInteger( 'tag_display_processing_work_time_ms_normal' ) / 1000
+ return CG.client_controller.new_options.GetInteger( 'tag_display_processing_work_time_ms_normal' ) / 1000
diff --git a/hydrus/client/networking/ClientNetworkingBandwidth.py b/hydrus/client/networking/ClientNetworkingBandwidth.py
index 20fafd7e9..50680687e 100644
--- a/hydrus/client/networking/ClientNetworkingBandwidth.py
+++ b/hydrus/client/networking/ClientNetworkingBandwidth.py
@@ -10,6 +10,7 @@
from hydrus.core.networking import HydrusNetworking
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.networking import ClientNetworkingContexts
class NetworkBandwidthManagerTrackerContainer( HydrusSerialisable.SerialisableBaseNamed ):
@@ -613,19 +614,19 @@ def TryToConsumeAGalleryToken( self, second_level_domain, query_type ):
timestamps_dict = self._last_pages_gallery_query_timestamps
- delay = HG.client_controller.new_options.GetInteger( 'gallery_page_wait_period_pages' )
+ delay = CG.client_controller.new_options.GetInteger( 'gallery_page_wait_period_pages' )
elif query_type == 'subscription':
timestamps_dict = self._last_subscriptions_gallery_query_timestamps
- delay = HG.client_controller.new_options.GetInteger( 'gallery_page_wait_period_subscriptions' )
+ delay = CG.client_controller.new_options.GetInteger( 'gallery_page_wait_period_subscriptions' )
elif query_type == 'watcher':
timestamps_dict = self._last_watchers_query_timestamps
- delay = HG.client_controller.new_options.GetInteger( 'watcher_page_wait_period' )
+ delay = CG.client_controller.new_options.GetInteger( 'watcher_page_wait_period' )
else:
diff --git a/hydrus/client/networking/ClientNetworkingContexts.py b/hydrus/client/networking/ClientNetworkingContexts.py
index c2e53f603..4bdfe0d6e 100644
--- a/hydrus/client/networking/ClientNetworkingContexts.py
+++ b/hydrus/client/networking/ClientNetworkingContexts.py
@@ -4,7 +4,7 @@
from hydrus.core import HydrusSerialisable
from hydrus.client import ClientConstants as CC
-
+from hydrus.client import ClientGlobals as CG
class NetworkContext( HydrusSerialisable.SerialisableBase ):
SERIALISABLE_TYPE = HydrusSerialisable.SERIALISABLE_TYPE_NETWORK_CONTEXT
@@ -180,7 +180,7 @@ def ToString( self ):
service_key = self.context_data
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
if services_manager.ServiceExists( service_key ):
diff --git a/hydrus/client/networking/ClientNetworkingDomain.py b/hydrus/client/networking/ClientNetworkingDomain.py
index 8155a9be8..7a9fe004a 100644
--- a/hydrus/client/networking/ClientNetworkingDomain.py
+++ b/hydrus/client/networking/ClientNetworkingDomain.py
@@ -14,6 +14,7 @@
from hydrus.core.networking import HydrusNetworking
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientThreading
from hydrus.client.networking import ClientNetworkingContexts
from hydrus.client.networking import ClientNetworkingFunctions
@@ -898,7 +899,7 @@ def CanValidateInPopup( self, network_contexts ):
def ConvertURLsToMediaViewerTuples( self, urls ):
- show_unmatched_urls_in_media_viewer = HG.client_controller.new_options.GetBoolean( 'show_unmatched_urls_in_media_viewer' )
+ show_unmatched_urls_in_media_viewer = CG.client_controller.new_options.GetBoolean( 'show_unmatched_urls_in_media_viewer' )
url_tuples = []
unmatched_url_tuples = []
@@ -1067,14 +1068,14 @@ def DomainOK( self, url ):
if domain in self._second_level_domains_to_network_infrastructure_errors:
- number_of_errors = HG.client_controller.new_options.GetInteger( 'domain_network_infrastructure_error_number' )
+ number_of_errors = CG.client_controller.new_options.GetInteger( 'domain_network_infrastructure_error_number' )
if number_of_errors == 0:
return True
- error_time_delta = HG.client_controller.new_options.GetInteger( 'domain_network_infrastructure_error_time_delta' )
+ error_time_delta = CG.client_controller.new_options.GetInteger( 'domain_network_infrastructure_error_time_delta' )
network_infrastructure_errors = self._second_level_domains_to_network_infrastructure_errors[ domain ]
@@ -1128,8 +1129,8 @@ def GetDefaultGUGKeyAndName( self ):
with self._lock:
- gug_key = HG.client_controller.new_options.GetKey( 'default_gug_key' )
- gug_name = HG.client_controller.new_options.GetString( 'default_gug_name' )
+ gug_key = CG.client_controller.new_options.GetKey( 'default_gug_key' )
+ gug_name = CG.client_controller.new_options.GetString( 'default_gug_name' )
return ( gug_key, gug_name )
@@ -1857,8 +1858,8 @@ def SetDefaultGUGKeyAndName( self, gug_key_and_name ):
( gug_key, gug_name ) = gug_key_and_name
- HG.client_controller.new_options.SetKey( 'default_gug_key', gug_key )
- HG.client_controller.new_options.SetString( 'default_gug_name', gug_name )
+ CG.client_controller.new_options.SetKey( 'default_gug_key', gug_key )
+ CG.client_controller.new_options.SetString( 'default_gug_name', gug_name )
@@ -2386,7 +2387,7 @@ def Start( self ):
job_status.SetVariable( 'popup_yes_no_question', question )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
result = job_status.GetIfHasVariable( 'popup_yes_no_answer' )
diff --git a/hydrus/client/networking/ClientNetworkingFunctions.py b/hydrus/client/networking/ClientNetworkingFunctions.py
index 7c8f90ac8..5440b75d3 100644
--- a/hydrus/client/networking/ClientNetworkingFunctions.py
+++ b/hydrus/client/networking/ClientNetworkingFunctions.py
@@ -6,6 +6,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusExceptions
+from hydrus.client import ClientGlobals as CG
def AddCookieToSession( session, name, value, domain, path, expires, secure = False, rest = None ):
version = 0
@@ -323,7 +324,7 @@ def GetSearchURLs( url ):
try:
- normalised_url = HG.client_controller.network_engine.domain_manager.NormaliseURL( url )
+ normalised_url = CG.client_controller.network_engine.domain_manager.NormaliseURL( url )
search_urls.add( normalised_url )
@@ -423,7 +424,7 @@ def NormaliseAndFilterAssociableURLs( urls ):
try:
- url = HG.client_controller.network_engine.domain_manager.NormaliseURL( url )
+ url = CG.client_controller.network_engine.domain_manager.NormaliseURL( url )
except HydrusExceptions.URLClassException:
@@ -433,7 +434,7 @@ def NormaliseAndFilterAssociableURLs( urls ):
normalised_urls.add( url )
- associable_urls = { url for url in normalised_urls if HG.client_controller.network_engine.domain_manager.ShouldAssociateURLWithFiles( url ) }
+ associable_urls = { url for url in normalised_urls if CG.client_controller.network_engine.domain_manager.ShouldAssociateURLWithFiles( url ) }
return associable_urls
diff --git a/hydrus/client/networking/ClientNetworkingGUG.py b/hydrus/client/networking/ClientNetworkingGUG.py
index 6c856e874..d0b72cd1c 100644
--- a/hydrus/client/networking/ClientNetworkingGUG.py
+++ b/hydrus/client/networking/ClientNetworkingGUG.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusSerialisable
from hydrus.core import HydrusTime
+from hydrus.client import ClientGlobals as CG
from hydrus.client.networking import ClientNetworkingFunctions
class GalleryURLGenerator( HydrusSerialisable.SerialisableBaseNamed ):
@@ -77,7 +78,7 @@ def CheckFunctional( self ):
example_url = self.GetExampleURL()
- ( url_type, match_name, can_parse, cannot_parse_reason ) = HG.client_controller.network_engine.domain_manager.GetURLParseCapability( example_url )
+ ( url_type, match_name, can_parse, cannot_parse_reason ) = CG.client_controller.network_engine.domain_manager.GetURLParseCapability( example_url )
except Exception as e:
@@ -281,7 +282,7 @@ def CheckFunctional( self ):
for gug_key_and_name in self._gug_keys_and_names:
- gug = HG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
+ gug = CG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
if gug is not None:
@@ -296,7 +297,7 @@ def GenerateGalleryURLs( self, query_text ):
for gug_key_and_name in self._gug_keys_and_names:
- gug = HG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
+ gug = CG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
if gug is not None:
@@ -313,7 +314,7 @@ def GetExampleURLs( self ):
for gug_key_and_name in self._gug_keys_and_names:
- gug = HG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
+ gug = CG.client_controller.network_engine.domain_manager.GetGUG( gug_key_and_name )
if gug is not None:
diff --git a/hydrus/client/networking/ClientNetworkingJobs.py b/hydrus/client/networking/ClientNetworkingJobs.py
index 960351477..565de2093 100644
--- a/hydrus/client/networking/ClientNetworkingJobs.py
+++ b/hydrus/client/networking/ClientNetworkingJobs.py
@@ -1,4 +1,3 @@
-import calendar
import datetime
import io
import os
@@ -20,6 +19,7 @@
from hydrus.core.networking import HydrusNetworking
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientTime
from hydrus.client.networking import ClientNetworkingContexts
from hydrus.client.networking import ClientNetworkingFunctions
@@ -256,7 +256,7 @@ def _CanReattemptConnection( self ):
return False
- max_connection_attempts_allowed = HG.client_controller.new_options.GetInteger( 'max_connection_attempts_allowed' )
+ max_connection_attempts_allowed = CG.client_controller.new_options.GetInteger( 'max_connection_attempts_allowed' )
return self._current_connection_attempt_number <= max_connection_attempts_allowed
@@ -270,7 +270,7 @@ def _CanReattemptRequest( self ):
if self._method == 'GET':
- max_attempts_allowed = HG.client_controller.new_options.GetInteger( 'max_request_attempts_allowed_get' )
+ max_attempts_allowed = CG.client_controller.new_options.GetInteger( 'max_request_attempts_allowed_get' )
else:
@@ -335,7 +335,7 @@ def _GenerateSpecificNetworkContexts( self ):
def _GetTimeouts( self ):
- connect_timeout = HG.client_controller.new_options.GetInteger( 'network_timeout' )
+ connect_timeout = CG.client_controller.new_options.GetInteger( 'network_timeout' )
read_timeout = connect_timeout * 6
@@ -1014,7 +1014,7 @@ def _SolveCloudFlare( self, response ):
def _WaitOnConnectionError( self, status_text: str ):
- connection_error_wait_time = HG.client_controller.new_options.GetInteger( 'connection_error_wait_time' )
+ connection_error_wait_time = CG.client_controller.new_options.GetInteger( 'connection_error_wait_time' )
self._connection_error_wake_time = HydrusTime.GetNow() + ( ( self._current_connection_attempt_number - 1 ) * connection_error_wait_time )
@@ -1033,7 +1033,7 @@ def _WaitOnConnectionError( self, status_text: str ):
def _WaitOnNetworkTrafficPaused( self, status_text: str ):
- while HG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ) and not self._IsCancelled():
+ while CG.client_controller.new_options.GetBoolean( 'pause_all_new_network_traffic' ) and not self._IsCancelled():
with self._lock:
@@ -1057,7 +1057,7 @@ def _WaitOnServersideBandwidth( self, status_text: str ):
# 429/509/529 response from server. basically means 'I'm under big load mate'
# a future version of this could def talk to domain manager and add a temp delay so other network jobs can be informed
- serverside_bandwidth_wait_time = HG.client_controller.new_options.GetInteger( 'serverside_bandwidth_wait_time' )
+ serverside_bandwidth_wait_time = CG.client_controller.new_options.GetInteger( 'serverside_bandwidth_wait_time' )
problem_rating = ( self._current_connection_attempt_number + self._current_request_attempt_number ) - 1
diff --git a/hydrus/client/networking/ClientNetworkingLogin.py b/hydrus/client/networking/ClientNetworkingLogin.py
index 709abee0a..d965e0e4b 100644
--- a/hydrus/client/networking/ClientNetworkingLogin.py
+++ b/hydrus/client/networking/ClientNetworkingLogin.py
@@ -13,6 +13,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientParsing
from hydrus.client import ClientStrings
from hydrus.client import ClientThreading
@@ -959,7 +960,7 @@ def _Start( self ):
job_status.SetStatusTitle( 'Logging in ' + login_domain )
- HG.client_controller.pub( 'message', job_status )
+ CG.client_controller.pub( 'message', job_status )
HydrusData.Print( 'Starting login for ' + login_domain )
diff --git a/hydrus/client/networking/ClientNetworkingSessions.py b/hydrus/client/networking/ClientNetworkingSessions.py
index 37b111633..4acd73fbb 100644
--- a/hydrus/client/networking/ClientNetworkingSessions.py
+++ b/hydrus/client/networking/ClientNetworkingSessions.py
@@ -9,6 +9,7 @@
from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.networking import ClientNetworkingContexts
from hydrus.client.networking import ClientNetworkingFunctions
@@ -191,8 +192,8 @@ def __init__( self ):
self._ReinitialiseProxies()
- HG.client_controller.sub( self, 'ReinitialiseProxies', 'notify_new_options' )
- HG.client_controller.sub( self, 'MaintainConnectionPools', 'memory_maintenance_pulse' )
+ CG.client_controller.sub( self, 'ReinitialiseProxies', 'notify_new_options' )
+ CG.client_controller.sub( self, 'MaintainConnectionPools', 'memory_maintenance_pulse' )
def _GetSerialisableInfo( self ):
@@ -244,9 +245,9 @@ def _ReinitialiseProxies( self ):
self._proxies_dict = {}
- http_proxy = HG.client_controller.new_options.GetNoneableString( 'http_proxy' )
- https_proxy = HG.client_controller.new_options.GetNoneableString( 'https_proxy' )
- no_proxy = HG.client_controller.new_options.GetNoneableString( 'no_proxy' )
+ http_proxy = CG.client_controller.new_options.GetNoneableString( 'http_proxy' )
+ https_proxy = CG.client_controller.new_options.GetNoneableString( 'https_proxy' )
+ no_proxy = CG.client_controller.new_options.GetNoneableString( 'no_proxy' )
if http_proxy is not None:
@@ -353,7 +354,7 @@ def GetSession( self, network_context ):
session.verify = False
- if not HG.client_controller.new_options.GetBoolean( 'verify_regular_https' ):
+ if not CG.client_controller.new_options.GetBoolean( 'verify_regular_https' ):
session.verify = False
diff --git a/hydrus/client/search/ClientSearch.py b/hydrus/client/search/ClientSearch.py
index c8404bca0..6f4503f69 100644
--- a/hydrus/client/search/ClientSearch.py
+++ b/hydrus/client/search/ClientSearch.py
@@ -15,6 +15,7 @@
from hydrus.client import ClientConstants as CC
from hydrus.client import ClientData
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientTime
from hydrus.client.metadata import ClientTags
@@ -440,7 +441,7 @@ def __init__( self, system_predicates: typing.Collection[ "Predicate" ] ):
self._file_viewing_stats_predicates = []
- new_options = HG.client_controller.new_options
+ new_options = CG.client_controller.new_options
for predicate in system_predicates:
@@ -928,7 +929,7 @@ def GetLimit( self, apply_implicit_limit = True ):
if self._limit is None and apply_implicit_limit:
- forced_search_limit = HG.client_controller.new_options.GetNoneableInteger( 'forced_search_limit' )
+ forced_search_limit = CG.client_controller.new_options.GetNoneableInteger( 'forced_search_limit' )
return forced_search_limit
@@ -2237,8 +2238,8 @@ def GetTextsAndNamespaces( self, render_for_user: bool, or_under_construction: b
if self._predicate_type == PREDICATE_TYPE_OR_CONTAINER:
- or_connector = HG.client_controller.new_options.GetString( 'or_connector' )
- or_connector_namespace = HG.client_controller.new_options.GetNoneableString( 'or_connector_custom_namespace_colour' )
+ or_connector = CG.client_controller.new_options.GetString( 'or_connector' )
+ or_connector_namespace = CG.client_controller.new_options.GetNoneableString( 'or_connector_custom_namespace_colour' )
texts_and_namespaces = []
@@ -2930,7 +2931,7 @@ def ToString( self, with_count: bool = True, render_for_user: bool = False, or_u
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
name = service.GetName()
@@ -3049,7 +3050,7 @@ def ToString( self, with_count: bool = True, render_for_user: bool = False, or_u
try:
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
base += service.GetName()
diff --git a/hydrus/client/search/ClientSearchParseSystemPredicates.py b/hydrus/client/search/ClientSearchParseSystemPredicates.py
index 6feba75da..ec55647fe 100644
--- a/hydrus/client/search/ClientSearchParseSystemPredicates.py
+++ b/hydrus/client/search/ClientSearchParseSystemPredicates.py
@@ -7,6 +7,7 @@
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client.search import ClientSearch
from hydrus.external import SystemPredicateParser
@@ -109,7 +110,7 @@ def file_service_pred_generator( o, v, u ):
service_name = v
- service_key = HG.client_controller.services_manager.GetServiceKeyFromName( HC.REAL_FILE_SERVICES, service_name )
+ service_key = CG.client_controller.services_manager.GetServiceKeyFromName( HC.REAL_FILE_SERVICES, service_name )
except:
@@ -148,9 +149,9 @@ def rating_service_pred_generator( operator, value_and_service_name ):
( value, service_name ) = value_and_service_name
- service_key = HG.client_controller.services_manager.GetServiceKeyFromName( HC.RATINGS_SERVICES, service_name )
+ service_key = CG.client_controller.services_manager.GetServiceKeyFromName( HC.RATINGS_SERVICES, service_name )
- service = HG.client_controller.services_manager.GetService( service_key )
+ service = CG.client_controller.services_manager.GetService( service_key )
except:
@@ -189,7 +190,7 @@ def url_class_pred_generator( include, url_class_name ):
try:
- url_class = HG.client_controller.network_engine.domain_manager.GetURLClassFromName( url_class_name )
+ url_class = CG.client_controller.network_engine.domain_manager.GetURLClassFromName( url_class_name )
except HydrusExceptions.DataMissing as e:
diff --git a/hydrus/core/HydrusConstants.py b/hydrus/core/HydrusConstants.py
index 539e0e03b..61d036109 100644
--- a/hydrus/core/HydrusConstants.py
+++ b/hydrus/core/HydrusConstants.py
@@ -105,7 +105,7 @@
# Misc
NETWORK_VERSION = 20
-SOFTWARE_VERSION = 561
+SOFTWARE_VERSION = 562
CLIENT_API_VERSION = 60
SERVER_THUMBNAIL_DIMENSIONS = ( 200, 200 )
diff --git a/hydrus/core/HydrusController.py b/hydrus/core/HydrusController.py
index 9cc04fb7d..528f47369 100644
--- a/hydrus/core/HydrusController.py
+++ b/hydrus/core/HydrusController.py
@@ -36,7 +36,7 @@ def __init__( self, db_dir ):
pubsub_valid_callable = self._GetPubsubValidCallable()
- self._pubsub = HydrusPubSub.HydrusPubSub( self, pubsub_valid_callable )
+ self._pubsub = HydrusPubSub.HydrusPubSub( pubsub_valid_callable )
self._daemon_jobs = {}
self._caches = {}
self._managers = {}
diff --git a/hydrus/core/HydrusDB.py b/hydrus/core/HydrusDB.py
index 5cd02bf18..0c77906b4 100644
--- a/hydrus/core/HydrusDB.py
+++ b/hydrus/core/HydrusDB.py
@@ -14,6 +14,7 @@
from hydrus.core import HydrusPaths
from hydrus.core import HydrusProfiling
from hydrus.core import HydrusTime
+from hydrus.core.interfaces import HydrusControllerInterface
def CheckCanVacuum( db_path, stop_time = None ):
@@ -133,7 +134,7 @@ class HydrusDB( HydrusDBBase.DBBase ):
READ_WRITE_ACTIONS = []
UPDATE_WAIT = 2
- def __init__( self, controller, db_dir, db_name ):
+ def __init__( self, controller: HydrusControllerInterface.HydrusControllerInterface, db_dir, db_name ):
HydrusDBBase.DBBase.__init__( self )
diff --git a/hydrus/core/HydrusPaths.py b/hydrus/core/HydrusPaths.py
index bfc3174fb..624302a39 100644
--- a/hydrus/core/HydrusPaths.py
+++ b/hydrus/core/HydrusPaths.py
@@ -203,10 +203,10 @@ def ElideFilenameOrDirectorySafely( name: str, num_characters_used_in_other_comp
# most OSes cannot handle a filename or dirname with more than 255 characters
# Windows cannot handle a _total_ pathname more than 260
- # to be safe and deal with surprise extensions like (11) or .txt sidecars, we use 240
+ # to be safe and deal with surprise extensions like (11) or .txt sidecars, we use 220
# moreover, unicode paths are encoded to bytes, so we have to count differently
- MAX_PATH_LENGTH = 240
+ MAX_PATH_LENGTH = 220
num_characters_available = MAX_PATH_LENGTH
diff --git a/hydrus/core/HydrusPubSub.py b/hydrus/core/HydrusPubSub.py
index 2b3dd4a5f..bf1c13d56 100644
--- a/hydrus/core/HydrusPubSub.py
+++ b/hydrus/core/HydrusPubSub.py
@@ -5,13 +5,12 @@
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusProfiling
-from hydrus.core import HydrusTime
+from hydrus.core.interfaces import HydrusControllerInterface
class HydrusPubSub( object ):
- def __init__( self, controller, valid_callable ):
+ def __init__( self, valid_callable ):
- self._controller = controller
self._valid_callable = valid_callable
self._doing_work = False
diff --git a/hydrus/core/interfaces/HydrusControllerInterface.py b/hydrus/core/interfaces/HydrusControllerInterface.py
index 0fec09ac1..0eacce865 100644
--- a/hydrus/core/interfaces/HydrusControllerInterface.py
+++ b/hydrus/core/interfaces/HydrusControllerInterface.py
@@ -1,19 +1,20 @@
+import typing
from hydrus.core.interfaces import HydrusThreadingInterface
class HydrusControllerInterface( object ):
- def pub( self, topic, *args, **kwargs ) -> None:
+ def pub( self, topic: str, *args, **kwargs ) -> None:
raise NotImplementedError()
- def pubimmediate( self, topic, *args, **kwargs ) -> None:
+ def pubimmediate( self, topic: str, *args, **kwargs ) -> None:
raise NotImplementedError()
- def sub( self, object, method_name, topic ) -> None:
+ def sub( self, obj: object, method_name: str, topic: str ) -> None:
raise NotImplementedError()
@@ -28,22 +29,22 @@ def ThreadSlotsAreAvailable( self, thread_type ) -> bool:
raise NotImplementedError()
- def CallLater( self, initial_delay, func, *args, **kwargs ) -> HydrusThreadingInterface.SchedulableJobInterface:
+ def CallLater( self, initial_delay: float, func: typing.Callable, *args, **kwargs ) -> HydrusThreadingInterface.SchedulableJobInterface:
raise NotImplementedError()
- def CallRepeating( self, initial_delay, period, func, *args, **kwargs ) -> HydrusThreadingInterface.SchedulableJobInterface:
+ def CallRepeating( self, initial_delay: float, period: float, func: typing.Callable, *args, **kwargs ) -> HydrusThreadingInterface.SchedulableJobInterface:
raise NotImplementedError()
- def CallToThread( self, callable, *args, **kwargs ) -> None:
+ def CallToThread( self, func: typing.Callable, *args, **kwargs ) -> None:
raise NotImplementedError()
- def CallToThreadLongRunning( self, callable, *args, **kwargs ) -> None:
+ def CallToThreadLongRunning( self, func: typing.Callable, *args, **kwargs ) -> None:
raise NotImplementedError()
diff --git a/hydrus/test/TestClientAPI.py b/hydrus/test/TestClientAPI.py
index 638a8b094..78f7be066 100644
--- a/hydrus/test/TestClientAPI.py
+++ b/hydrus/test/TestClientAPI.py
@@ -1,10 +1,8 @@
-import collections
import hashlib
import http.client
import json
import os
import random
-import shutil
import time
import unittest
import urllib
@@ -22,8 +20,9 @@
from hydrus.core import HydrusTime
from hydrus.core.files.images import HydrusImageHandling
-from hydrus.client import ClientConstants as CC
from hydrus.client import ClientAPI
+from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientServices
from hydrus.client import ClientTime
@@ -1224,7 +1223,7 @@ def _test_add_files_other_actions( self, connection, set_up_permissions ):
self.assertIn( locked_hash.hex(), text ) # error message should be complaining about it
- HG.client_controller.new_options.SetBoolean( 'delete_lock_for_archived_files', False )
+ CG.client_controller.new_options.SetBoolean( 'delete_lock_for_archived_files', False )
HG.test_controller.ClearReads( 'media_results' )
@@ -5274,7 +5273,7 @@ def _test_file_metadata( self, connection, set_up_permissions ):
only_return_basic_information_metadata = []
only_return_basic_information_metadata_but_blurhash_too = []
- services_manager = HG.client_controller.services_manager
+ services_manager = CG.client_controller.services_manager
for media_result in media_results:
@@ -5315,7 +5314,7 @@ def _test_file_metadata( self, connection, set_up_permissions ):
bounding_dimensions = HG.test_controller.options[ 'thumbnail_dimensions' ]
thumbnail_scale_type = HG.test_controller.new_options.GetInteger( 'thumbnail_scale_type' )
- thumbnail_dpr_percent = HG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
+ thumbnail_dpr_percent = CG.client_controller.new_options.GetInteger( 'thumbnail_dpr_percent' )
( thumbnail_expected_width, thumbnail_expected_height ) = HydrusImageHandling.GetThumbnailResolution( ( file_info_manager.width, file_info_manager.height ), bounding_dimensions, thumbnail_scale_type, thumbnail_dpr_percent )
diff --git a/hydrus/test/TestClientConstants.py b/hydrus/test/TestClientConstants.py
index 0890d3fc4..c75ceaba5 100644
--- a/hydrus/test/TestClientConstants.py
+++ b/hydrus/test/TestClientConstants.py
@@ -3,9 +3,9 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
-from hydrus.core import HydrusTime
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientManagers
from hydrus.client import ClientServices
from hydrus.client.metadata import ClientContentUpdates
@@ -40,7 +40,7 @@ def test_service( service, key, service_type, name ):
HG.test_controller.SetRead( 'services', services )
- services_manager = ClientServices.ServicesManager( HG.client_controller )
+ services_manager = ClientServices.ServicesManager( CG.client_controller )
#
@@ -84,7 +84,7 @@ def test_undo( self ):
command_1_inverted = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_INBOX, { hash_1 } ) )
command_2_inverted = ClientContentUpdates.ContentUpdatePackage.STATICCreateFromContentUpdate( CC.COMBINED_LOCAL_FILE_SERVICE_KEY, ClientContentUpdates.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ARCHIVE, { hash_2 } ) )
- undo_manager = ClientManagers.UndoManager( HG.client_controller )
+ undo_manager = ClientManagers.UndoManager( CG.client_controller )
#
diff --git a/hydrus/test/TestClientDBTags.py b/hydrus/test/TestClientDBTags.py
index c49bfc5fa..fcbe0aa0a 100644
--- a/hydrus/test/TestClientDBTags.py
+++ b/hydrus/test/TestClientDBTags.py
@@ -9,6 +9,7 @@
from hydrus.core import HydrusLists
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientLocation
from hydrus.client import ClientServices
from hydrus.client.db import ClientDB
@@ -3027,7 +3028,7 @@ def setUpClass( cls ):
HG.test_controller.SetRead( 'tag_parents', tag_parents )
- cls._tag_parents_manager = ClientManagers.TagParentsManager( HG.client_controller )
+ cls._tag_parents_manager = ClientManagers.TagParentsManager( CG.client_controller )
def test_expand_predicates( self ):
diff --git a/hydrus/test/TestController.py b/hydrus/test/TestController.py
index d62296fe1..07807c6de 100644
--- a/hydrus/test/TestController.py
+++ b/hydrus/test/TestController.py
@@ -192,7 +192,6 @@ def __init__( self, win, only_run ):
HydrusPaths.MakeSureDirectoryExists( client_files_default )
HG.controller = self
- HG.client_controller = self
HG.server_controller = self
HG.test_controller = self
@@ -205,7 +204,7 @@ def __init__( self, win, only_run ):
self._call_to_threads = []
- self._pubsub = HydrusPubSub.HydrusPubSub( self, lambda o: True )
+ self._pubsub = HydrusPubSub.HydrusPubSub( lambda o: True )
self.new_options = ClientOptions.ClientOptions()
diff --git a/hydrus/test/TestHydrusPaths.py b/hydrus/test/TestHydrusPaths.py
index 24cb4244f..c26248a47 100644
--- a/hydrus/test/TestHydrusPaths.py
+++ b/hydrus/test/TestHydrusPaths.py
@@ -7,8 +7,10 @@ class TestHydrusPaths( unittest.TestCase ):
def test_eliding( self ):
+ MAGIC_MAX_LENGTH = 220
+
name_too_long = 'a' * 245
- name_shortened = 'a' * 240
+ name_shortened = 'a' * MAGIC_MAX_LENGTH
self.assertEqual( HydrusPaths.ElideFilenameOrDirectorySafely( name_too_long ), name_shortened )
@@ -16,7 +18,7 @@ def test_eliding( self ):
unicode_name_too_long = bytes.fromhex( unicode_name_too_long_hex ).decode( 'utf-8' )
- unicode_name_shortened_hex = '57696e646f7773e381a7e381afe380814e544653e381aee5a0b4e59088e38081e9809ae5b8b8e38081e38395e382a1e382a4e383abe5908de381aee69c80e5a4a7e995b7e381af323630e69687e5ad97e381a7e38199e380826d61634f53efbc88556e6978e38399e383bce382b9efbc89e381a7e381afe380814846532be3818ae38288e381b341504653e381aee5a0b4e59088e38081e9809ae5b8b8e38081e38395e382a1e382a4e383abe5908de381aee69c80e5a4a7e995b7e381af323535e69687e5ad97e381a7e38199e380824c696e7578efbc88e3818ae38288e381b3e3819de381aee4bb96e381ae556e69'
+ unicode_name_shortened_hex = '57696e646f7773e381a7e381afe380814e544653e381aee5a0b4e59088e38081e9809ae5b8b8e38081e38395e382a1e382a4e383abe5908de381aee69c80e5a4a7e995b7e381af323630e69687e5ad97e381a7e38199e380826d61634f53efbc88556e6978e38399e383bce382b9efbc89e381a7e381afe380814846532be3818ae38288e381b341504653e381aee5a0b4e59088e38081e9809ae5b8b8e38081e38395e382a1e382a4e383abe5908de381aee69c80e5a4a7e995b7e381af323535e69687e5ad97e381a7e38199e380824c696e7578efbc88e3818a'
unicode_name_shortened = bytes.fromhex( unicode_name_shortened_hex ).decode( 'utf-8' )
@@ -32,13 +34,13 @@ def test_eliding( self ):
HC.PLATFORM_WINDOWS = True
- name_shortened = 'a' * ( 240 - num_characters_used_in_other_components )
+ name_shortened = 'a' * ( MAGIC_MAX_LENGTH - num_characters_used_in_other_components )
self.assertEqual( HydrusPaths.ElideFilenameOrDirectorySafely( name_too_long, num_characters_used_in_other_components = num_characters_used_in_other_components ), name_shortened )
HC.PLATFORM_WINDOWS = False
- name_shortened = 'a' * 240
+ name_shortened = 'a' * MAGIC_MAX_LENGTH
self.assertEqual( HydrusPaths.ElideFilenameOrDirectorySafely( name_too_long, num_characters_used_in_other_components = num_characters_used_in_other_components ), name_shortened )
@@ -49,7 +51,7 @@ def test_eliding( self ):
num_characters_already_used_in_this_component = 3
- name_shortened = 'a' * ( 240 - num_characters_already_used_in_this_component )
+ name_shortened = 'a' * ( MAGIC_MAX_LENGTH - num_characters_already_used_in_this_component )
self.assertEqual( HydrusPaths.ElideFilenameOrDirectorySafely( name_too_long, num_characters_already_used_in_this_component = num_characters_already_used_in_this_component ), name_shortened )
diff --git a/hydrus/test/TestHydrusServer.py b/hydrus/test/TestHydrusServer.py
index 295a58d0a..089f07236 100644
--- a/hydrus/test/TestHydrusServer.py
+++ b/hydrus/test/TestHydrusServer.py
@@ -12,15 +12,14 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusEncryption
-from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusPaths
from hydrus.core import HydrusTime
from hydrus.core.networking import HydrusNetwork
from hydrus.core.networking import HydrusNetworking
-from hydrus.core.networking import HydrusServerRequest
from hydrus.client import ClientConstants as CC
+from hydrus.client import ClientGlobals as CG
from hydrus.client import ClientServices
from hydrus.client.media import ClientMediaManagers
from hydrus.client.media import ClientMediaResult
@@ -291,7 +290,7 @@ def _test_local_booru( self, host, port ):
f.write( EXAMPLE_THUMBNAIL )
- local_booru_manager = HG.client_controller.local_booru_manager
+ local_booru_manager = CG.client_controller.local_booru_manager
#