Skip to content

Commit

Permalink
Version 140
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrusnetwork committed Dec 17, 2014
1 parent bb2e819 commit 5127f7b
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 94 deletions.
19 changes: 18 additions & 1 deletion help/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,24 @@
<div class="content">
<h3>changelog</h3>
<ul>
<li><h3>version 138</h3></li>
<li><h3>version 140</h3></li>
<ul>
<li>if a repository or subscription popup message has nothing to report, it will dismiss itself</li>
<li>fixed handling of text popup display when the object passed was not text</li>
<li>delete orphans is now cancellable</li>
<li>vacuum, deleted orphans, and upload pending popup messages will dismiss themselves an hour after they are done</li>
<li>tightened the subscription final state popup message to just a title and a button</li>
<li>removed much of the very expensive autocomplete tag cache maintenance code, which seems not to be worth the effort</li>
<li>culled the autocomplete tag cache in prep for new maintenance cycle</li>
<li>fixed a resize timing bug that was causing large images to scale in an ugly way when the media viewer was launched in a borderless state</li>
<li>'open selection in new page' will no longer default focus on the sort dropdown; it'll go to the media panel (this was causing scrolling confusion)</li>
<li>fixed a non-updating display bug when resizing frames/dialogs with auto-resizing listctrls on linux</li>
<li>cleaned up a wall-of-text error when closing the client immediately after deleting a tag service</li>
<li>filled a gap in static text image object cleanup</li>
<li>cleaned up some thumbnail waterfall/fade code</li>
<li>filled several gaps in thumbnail object cleanup</li>
</ul>
<li><h3>version 139</h3></li>
<ul>
<li>cleaned up all the old popup message code, and fully integrated the new</li>
<li>moved repo sync to the new popup messaging system</li>
Expand Down
4 changes: 2 additions & 2 deletions include/ClientConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ def ShowTextClient( text ):

job_key = HC.JobKey()

job_key.SetVariable( 'popup_message_text_1', text )
job_key.SetVariable( 'popup_message_text_1', HC.u( text ) )

HC.pubsub.pub( 'message', job_key )

Expand Down Expand Up @@ -1340,7 +1340,7 @@ def AddData( self, key, data ):

if key not in self._keys_to_data:

while self._total_estimated_memory_footprint > HC.options[ self._cache_size_key ] or ( random.randint( 0, 2 ) == 0 and len( self._keys_to_data ) > 0 ):
while self._total_estimated_memory_footprint > HC.options[ self._cache_size_key ]:

( deletee_key, last_access_time ) = self._keys_fifo.pop( 0 )

Expand Down
6 changes: 5 additions & 1 deletion include/ClientController.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,11 @@ def MaintainDB( self ):

services = self.GetManager( 'services' ).GetServices()

for service in services: self.Read( 'service_info', service.GetServiceKey() )
for service in services:

try: self.Read( 'service_info', service.GetServiceKey() )
except: pass # sometimes this breaks when a service has just been removed and the client is closing, so ignore the error


self._timestamps[ 'last_service_info_cache_fatten' ] = HC.GetNow()

Expand Down
110 changes: 80 additions & 30 deletions include/ClientDB.py

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion include/ClientGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def __init__( self ):
HC.pubsub.sub( self, 'SetDBLockedStatus', 'db_locked_status' )
HC.pubsub.sub( self, 'SetDownloadsStatus', 'downloads_status' )
HC.pubsub.sub( self, 'SetInboxStatus', 'inbox_status' )
HC.pubsub.sub( self, 'SetMediaFocus', 'set_media_focus' )

self._menus = {}

Expand Down Expand Up @@ -298,6 +299,8 @@ def _THREADUploadPending( self, service_key ):

job_key.Finish()

wx.CallLater( 1000 * 3600, job_key.Delete )

HC.pubsub.pub( 'notify_new_pending' )


Expand Down Expand Up @@ -1662,7 +1665,7 @@ def _StartURLDownload( self ):

url_string = url

job_key = HC.JobKey()
job_key = HC.JobKey( pausable = True, cancellable = True )

HC.pubsub.pub( 'message', job_key )

Expand Down Expand Up @@ -2117,6 +2120,8 @@ def SetDownloadsStatus( self, status ):



def SetMediaFocus( self ): self._SetMediaFocus()

def SetInboxStatus( self, status ):

if self.IsShown():
Expand Down
2 changes: 2 additions & 0 deletions include/ClientGUICanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4070,6 +4070,8 @@ def _Draw( self ):

wx_bitmap = wx.BitmapFromImage( image )

wx.CallAfter( image.Destroy )

else: wx_bitmap = hydrus_bitmap.GetWxBitmap()

dc.DrawBitmap( wx_bitmap, 0, 0 )
Expand Down
11 changes: 8 additions & 3 deletions include/ClientGUICommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ def _InitialiseSizeAndPosition( self ):

if client_size[ self._resize_option_prefix + 'maximised' ]: self.Maximize()

if client_size[ self._resize_option_prefix + 'fullscreen' ]: wx.CallAfter( self.ShowFullScreen, True, wx.FULLSCREEN_ALL )
if client_size[ self._resize_option_prefix + 'fullscreen' ]: self.ShowFullScreen( True, wx.FULLSCREEN_ALL )


def _RecordSizeAndPosition( self ):
Expand Down Expand Up @@ -2641,6 +2641,13 @@ def TryToDismiss( self ):

def Update( self ):

if self._job_key.IsDeleted():

self.TryToDismiss()

return


if self._job_key.HasVariable( 'popup_message_title' ):

text = self._job_key.GetVariable( 'popup_message_title' )
Expand Down Expand Up @@ -3103,8 +3110,6 @@ def __init__( self, parent, height, columns ):
ListCtrlAutoWidthMixin.__init__( self )
ColumnSorterMixin.__init__( self, num_columns )

self.GetTopLevelParent().SetDoubleBuffered( False ) # windows double buffer makes listctrls refresh and bug out

self.itemDataMap = {}
self._next_data_index = 0

Expand Down
4 changes: 2 additions & 2 deletions include/ClientGUIDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__( self, parent, title, style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_B

wx.Dialog.__init__( self, parent, title = title, style = style, pos = pos )

self.SetDoubleBuffered( True )
#self.SetDoubleBuffered( True )

self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) )

Expand Down Expand Up @@ -5122,7 +5122,7 @@ def EventOK( self, event ):

url_string = title + ' ' + resolution + ' ' + extension

job_key = HC.JobKey()
job_key = HC.JobKey( pausable = True, cancellable = True )

HydrusThreading.CallToThread( HydrusDownloading.THREADDownloadURL, job_key, url, url_string )

Expand Down
2 changes: 1 addition & 1 deletion include/ClientGUIManagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ def SetSearchFocus( self, page_key ):
if page_key == self._page_key:

try: self._searchbox.SetFocus() # there's a chance this doesn't exist!
except: pass
except: HC.pubsub.pub( 'set_media_focus' )



Expand Down
71 changes: 24 additions & 47 deletions include/ClientGUIMedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__( self, parent, page_key, file_service_key, media_results ):

self.SetBackgroundColour( wx.WHITE )

self.SetDoubleBuffered( True )
#self.SetDoubleBuffered( True )

self.SetScrollRate( 0, 50 )

Expand Down Expand Up @@ -1087,7 +1087,7 @@ def _DrawIndices( self, from_index, to_index ):

if hash in self._thumbnails_being_faded_in:

( original_bmp, alpha_bmp, canvas_bmp, x, y, num_frames_rendered ) = self._thumbnails_being_faded_in[ hash ]
( original_bmp, alpha_bmp, x, y, num_frames_rendered ) = self._thumbnails_being_faded_in[ hash ]

current_row = i / self._num_columns

Expand All @@ -1096,7 +1096,7 @@ def _DrawIndices( self, from_index, to_index ):
x = current_col * thumbnail_span_width + CC.THUMBNAIL_MARGIN
y = current_row * thumbnail_span_height + CC.THUMBNAIL_MARGIN

self._thumbnails_being_faded_in[ hash ] = ( original_bmp, alpha_bmp, canvas_bmp, x, y, num_frames_rendered )
self._thumbnails_being_faded_in[ hash ] = ( original_bmp, alpha_bmp, x, y, num_frames_rendered )

else:

Expand Down Expand Up @@ -1228,35 +1228,21 @@ def _FadeThumbnail( self, thumbnail ):
if ( x, y ) != ( -1, -1 ):

bmp = thumbnail.GetBmp()

image = bmp.ConvertToImage()

hash = thumbnail.GetDisplayMedia().GetHash()
try: image.InitAlpha()
except: pass

canvas_bmp = None
'''
( thumbnail_span_width, thumbnail_span_height ) = self._thumbnail_span_dimensions
image = image.AdjustChannels( 1, 1, 1, 0.25 )

canvas_bmp = wx.EmptyBitmap( thumbnail_span_width, thumbnail_span_height, 24 )
alpha_bmp = wx.BitmapFromImage( image, 32 )

canvas_bmp_dc = wx.MemoryDC( canvas_bmp )
wx.CallAfter( image.Destroy )

index = self._sorted_media.index( thumbnail )
hash = thumbnail.GetDisplayMedia().GetHash()

( from_index, to_index ) = self._drawn_index_bounds
if from_index <= index and index <= to_index:
big_canvas_bmp_dc = wx.MemoryDC( self._canvas_bmp )
canvas_bmp_dc.Blit( 0, 0, thumbnail_span_width, thumbnail_span_height, big_canvas_bmp_dc, x, y )
else:
canvas_bmp_dc.SetBrush( wx.WHITE_BRUSH )
canvas_bmp_dc.Clear()
'''
self._thumbnails_being_faded_in[ hash ] = ( bmp, None, canvas_bmp, x, y, 0 )
self._thumbnails_being_faded_in[ hash ] = ( bmp, alpha_bmp, x, y, 0 )

if not self._timer_animation.IsRunning(): self._timer_animation.Start( 1, wx.TIMER_ONE_SHOT )

Expand Down Expand Up @@ -1378,6 +1364,12 @@ def _RedrawCanvas( self ):

self._drawn_index_bounds = None

for ( original_bmp, alpha_bmp, x, y, num_frames_rendered ) in self._thumbnails_being_faded_in.values():

wx.CallAfter( original_bmp.Destroy )
wx.CallAfter( alpha_bmp.Destroy )


self._thumbnails_being_faded_in = {}

self._CleanCanvas()
Expand Down Expand Up @@ -2161,37 +2153,22 @@ def TIMEREventAnimation( self, event ):

all_info = self._thumbnails_being_faded_in.items()

for ( hash, ( original_bmp, alpha_bmp, canvas_bmp, x, y, num_frames_rendered ) ) in all_info:

if num_frames_rendered == 0:

image = original_bmp.ConvertToImage()

try: image.InitAlpha()
except: pass

image = image.AdjustChannels( 1, 1, 1, 0.25 )

alpha_bmp = wx.BitmapFromImage( image, 32 )

for ( hash, ( original_bmp, alpha_bmp, x, y, num_frames_rendered ) ) in all_info:

num_frames_rendered += 1

self._thumbnails_being_faded_in[ hash ] = ( original_bmp, alpha_bmp, canvas_bmp, x, y, num_frames_rendered )
self._thumbnails_being_faded_in[ hash ] = ( original_bmp, alpha_bmp, x, y, num_frames_rendered )

if y < min_y or y > max_y or num_frames_rendered == 9:
if y < min_y or y > max_y or num_frames_rendered >= 9:

bmp_to_use = original_bmp

del self._thumbnails_being_faded_in[ hash ]

else:

#canvas_dc = wx.MemoryDC( canvas_bmp )

#canvas_dc.DrawBitmap( alpha_bmp, 0, 0, True )
wx.CallAfter( original_bmp.Destroy )
wx.CallAfter( alpha_bmp.Destroy )

#del canvas_dc
else:

bmp_to_use = alpha_bmp

Expand Down
18 changes: 14 additions & 4 deletions include/HydrusConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
# Misc

NETWORK_VERSION = 15
SOFTWARE_VERSION = 139
SOFTWARE_VERSION = 140

UNSCALED_THUMBNAIL_DIMENSIONS = ( 200, 200 )

Expand Down Expand Up @@ -1321,7 +1321,7 @@ def ShowTextDefault( text ):

ShowText = ShowTextDefault

def SplayListForDB( xs ): return '(' + ','.join( [ '"' + u( x ) + '"' for x in xs ] ) + ')'
def SplayListForDB( xs ): return '(' + ','.join( ( '"' + u( x ) + '"' for x in xs ) ) + ')'

def SplayTupleListForDB( first_column_name, second_column_name, xys ): return ' OR '.join( [ '( ' + first_column_name + '=' + u( x ) + ' AND ' + second_column_name + ' IN ' + SplayListForDB( ys ) + ' )' for ( x, ys ) in xys ] )

Expand Down Expand Up @@ -1950,6 +1950,7 @@ def __init__( self, pausable = False, cancellable = False ):
self._pausable = pausable
self._cancellable = cancellable

self._deleted = threading.Event()
self._begun = threading.Event()
self._done = threading.Event()
self._cancelled = threading.Event()
Expand All @@ -1974,6 +1975,13 @@ def Cancel( self ):
self.Finish()


def Delete( self ):

self.Finish()

self._deleted.set()


def DeleteVariable( self, name ):

with self._variable_lock:
Expand Down Expand Up @@ -2002,6 +2010,8 @@ def IsCancellable( self ): return self._cancellable and not self.IsDone()

def IsCancelled( self ): return shutdown or self._cancelled.is_set()

def IsDeleted( self ): return shutdown or self._deleted.is_set()

def IsDone( self ): return shutdown or self._done.is_set()

def IsPausable( self ): return self._pausable and not self.IsDone()
Expand Down Expand Up @@ -2514,13 +2524,13 @@ def GetPetitionString( self ):

( old_tag, new_tag ) = self._petition_data

content_phrase = ' sibling ' + old_tag + '->' + new_tag
content_phrase = 'sibling ' + old_tag + '->' + new_tag

elif self._petition_type == CONTENT_DATA_TYPE_TAG_PARENTS:

( old_tag, new_tag ) = self._petition_data

content_phrase = ' parent ' + old_tag + '->' + new_tag
content_phrase = 'parent ' + old_tag + '->' + new_tag


return action_word + content_phrase + os.linesep * 2 + self._reason
Expand Down
10 changes: 8 additions & 2 deletions include/HydrusNetworking.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ def _ParseResponse( self, response, report_hooks ):
raise Exception( 'Response was longer than suggested!' )


for hook in report_hooks: hook( content_length, len( data ) )
for hook in report_hooks:

hook( content_length, len( data ) )



size_of_response = len( data )
Expand Down Expand Up @@ -369,7 +372,10 @@ def _WriteResponseToPath( self, response, report_hooks ):

f.write( block )

for hook in report_hooks: hook( content_length, size_of_response )
for hook in report_hooks:

hook( content_length, size_of_response )




Expand Down

0 comments on commit 5127f7b

Please sign in to comment.