Skip to content

Commit

Permalink
Version 155
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrusnetwork committed Apr 29, 2015
1 parent b992e83 commit 158a6f8
Show file tree
Hide file tree
Showing 22 changed files with 141 additions and 910 deletions.
14 changes: 14 additions & 0 deletions help/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
<div class="content">
<h3>changelog</h3>
<ul>
<li><h3>version 155</h3></li>
<ul>
<li>fixed a frame seek error when looping long and/or large gifs with unusual palettes</li>
<li>improved recovery when fps reads as 0 on videos</li>
<li>added error detection and graceful recovery and reporting for missing ActiveX flash control</li>
<li>removed a lot of old imported messaging code that was slowing down boot</li>
<li>removed some other old library imports that are no longer needed</li>
<li>gracefully silenced 'application shutdown' daemon errors (they were previously spamming to console)</li>
<li>fixed a hover window display check that was sometimes spamming linux with edge-case errors</li>
<li>slideshows will now pause while the right-click menu is open, stopping bizarre full program crashes occuring on many menu items while slideshow was in progress</li>
<li>fixed a thread_id-sqlite-cache_initialisation problem that was breaking tag archive sync</li>
<li>harmonised copy/paste tag protocol in manage tags dialog with 'copy all tags' of the tags list</li>
<li>removed some old messaging code in client db creation</li>
</ul>
<li><h3>version 154a</h3></li>
<ul>
<li>fixed a bug in v154 update code when there was more than one set of shortcuts to convert</li>
Expand Down
1 change: 0 additions & 1 deletion include/ClientConstants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import collections
import HydrusConstants as HC
import HydrusExceptions
import multipart
import os
import sys
import threading
Expand Down
1 change: 0 additions & 1 deletion include/ClientConstantsMessages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import HydrusConstants as HC
import HydrusImageHandling
import HydrusMessageHandling
import multipart
import os
import random
import sqlite3
Expand Down
4 changes: 4 additions & 0 deletions include/ClientController.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ def THREADBootEverything( self ):

self.InitDB() # can't run on wx thread because we need event queue free to update splash text

# can't use HC.options, because it might not have initialised yet!

HC.options = wx.GetApp().Read( 'options' )

if HC.options[ 'password' ] is not None:

HydrusGlobals.pubsub.pub( 'splash_set_text', 'waiting for password' )
Expand Down
43 changes: 3 additions & 40 deletions include/ClientDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
import HydrusExceptions
import HydrusFileHandling
import HydrusImageHandling
import HydrusMessageHandling
import HydrusNATPunch
import HydrusSerialisable
import HydrusServer
import HydrusTagArchive
import HydrusTags
import HydrusThreading
import ClientConstants as CC
import ClientConstantsMessages
import ClientDaemons
import os
import Queue
Expand Down Expand Up @@ -51,7 +49,7 @@
YAML_DUMP_ID_EXPORT_FOLDER = 6
YAML_DUMP_ID_SUBSCRIPTION = 7
YAML_DUMP_ID_LOCAL_BOORU = 8

'''
class MessageDB( object ):
def _AddContact( self, contact ):
Expand Down Expand Up @@ -986,7 +984,7 @@ def _UpdateMessageStatuses( self, message_key, status_updates ):
self.pub_after_commit( 'message_statuses_gui', message_key, status_updates )
self.pub_after_commit( 'notify_check_messages' )

'''
class DB( HydrusDB.HydrusDB ):

DB_NAME = 'client'
Expand Down Expand Up @@ -1482,16 +1480,6 @@ def _CreateDB( self ):

self._c.execute( 'INSERT INTO namespaces ( namespace_id, namespace ) VALUES ( ?, ? );', ( 1, '' ) )

self._c.execute( 'INSERT INTO contacts ( contact_id, contact_key, public_key, name, host, port ) VALUES ( ?, ?, ?, ?, ?, ? );', ( 1, None, None, 'Anonymous', 'internet', 0 ) )

with open( HC.STATIC_DIR + os.sep + 'contact - hydrus admin.yaml', 'rb' ) as f: hydrus_admin = yaml.safe_load( f.read() )

( public_key, name, host, port ) = hydrus_admin.GetInfo()

contact_key = hydrus_admin.GetContactKey()

self._c.execute( 'INSERT OR IGNORE INTO contacts ( contact_key, public_key, name, host, port ) VALUES ( ?, ?, ?, ?, ? );', ( sqlite3.Binary( contact_key ), public_key, name, host, port ) )

self._c.execute( 'INSERT INTO version ( version ) VALUES ( ? );', ( HC.SOFTWARE_VERSION, ) )

self._c.execute( 'COMMIT' )
Expand Down Expand Up @@ -3948,8 +3936,6 @@ def _InitCaches( self ):

self._InitArchives()

HC.options = self._GetOptions()


def _ManageDBError( self, job, e ):

Expand Down Expand Up @@ -4599,6 +4585,7 @@ def _Read( self, action, *args, **kwargs ):
elif action == 'media_results_from_ids': result = self._GetMediaResults( *args, **kwargs )
elif action == 'news': result = self._GetNews( *args, **kwargs )
elif action == 'nums_pending': result = self._GetNumsPending( *args, **kwargs )
elif action == 'options': result = self._GetOptions( *args, **kwargs )
elif action == 'pending': result = self._GetPending( *args, **kwargs )
elif action == 'pixiv_account': result = self._GetYAMLDump( YAML_DUMP_ID_SINGLE, 'pixiv_account' )
elif action == 'ratings_filter': result = self._GetRatingsFilter( *args, **kwargs )
Expand Down Expand Up @@ -4892,30 +4879,6 @@ def _UpdateDB( self, version ):

HydrusGlobals.pubsub.pub( 'splash_set_text', 'updating db to v' + HydrusData.ToString( version + 1 ) )

if version == 105:

if not os.path.exists( HC.CLIENT_UPDATES_DIR ): os.mkdir( HC.CLIENT_UPDATES_DIR )

result = self._c.execute( 'SELECT service_id, info FROM services WHERE service_type IN ' + HydrusData.SplayListForDB( HC.REPOSITORIES ) + ';' ).fetchall()

for ( service_id, info ) in result:

first_begin = info[ 'first_begin' ]
if first_begin == 0: first_begin = None

next_begin = info[ 'next_begin' ]

info[ 'first_timestamp' ] = first_begin
info[ 'next_download_timestamp' ] = 0
info[ 'next_processing_timestamp' ] = next_begin

del info[ 'first_begin' ]
del info[ 'next_begin' ]

self._c.execute( 'UPDATE services SET info = ? WHERE service_id = ?;', ( info, service_id ) )



if version == 106:

self._c.execute( 'CREATE TABLE tag_censorship ( service_id INTEGER PRIMARY KEY REFERENCES services ON DELETE CASCADE, blacklist INTEGER_BOOLEAN, tags TEXT_YAML );' )
Expand Down
6 changes: 2 additions & 4 deletions include/ClientDaemons.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
import HydrusExceptions
import HydrusFileHandling
import HydrusImageHandling
import HydrusMessageHandling
import HydrusNATPunch
import HydrusServer
import HydrusTagArchive
import HydrusTags
import HydrusThreading
import ClientConstants as CC
import ClientConstantsMessages
import os
import Queue
import random
Expand Down Expand Up @@ -404,7 +402,7 @@ def DAEMONSynchroniseAccounts():


if do_notify: HydrusGlobals.pubsub.pub( 'notify_new_permissions' )

'''
def DAEMONSynchroniseMessages():
services = wx.GetApp().GetManager( 'services' ).GetServices( ( HC.MESSAGE_DEPOT, ) )
Expand Down Expand Up @@ -577,7 +575,7 @@ def DAEMONSynchroniseMessages():
wx.GetApp().Read( 'status_num_inbox' )

'''
def DAEMONSynchroniseRepositories():

HydrusGlobals.repos_changed = False
Expand Down
102 changes: 67 additions & 35 deletions include/ClientGUICanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,22 @@ def TIMEREventUpdate( self, event ):

if self._media.GetMime() == HC.APPLICATION_FLASH:

frame_index = self._media_window.CurrentFrame()
try:

frame_index = self._media_window.CurrentFrame()

except AttributeError:

text = 'The flash window produced an unusual error that probably means it never initialised properly. This is usually because Flash has not been installed for Internet Explorer. '
text += os.linesep * 2
text += 'Please close the client, open Internet Explorer, and install flash from Adobe\'s site and then try again. If that does not work, please tell the hydrus developer.'

HydrusData.ShowText( text )

self._timer_update.Stop()

raise


if frame_index != self._current_frame_index:

Expand Down Expand Up @@ -1849,7 +1864,7 @@ def EventCharHook( self, event ):
( modifier, key ) = ClientData.GetShortcutFromEvent( event )

if modifier == wx.ACCEL_NORMAL and key in ( wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE ): self._Delete()
elif modifier == wx.ACCEL_NORMAL and key in ( wx.WXK_SPACE, wx.WXK_NUMPAD_SPACE ): self._PausePlaySlideshow()
elif modifier == wx.ACCEL_NORMAL and key in ( wx.WXK_SPACE, wx.WXK_NUMPAD_SPACE ): wx.CallAfter( self._PausePlaySlideshow )
elif modifier == wx.ACCEL_NORMAL and key in ( ord( '+' ), wx.WXK_ADD, wx.WXK_NUMPAD_ADD ): self._ZoomIn()
elif modifier == wx.ACCEL_NORMAL and key in ( ord( '-' ), wx.WXK_SUBTRACT, wx.WXK_NUMPAD_SUBTRACT ): self._ZoomOut()
elif modifier == wx.ACCEL_NORMAL and key == ord( 'Z' ): self._ZoomSwitch()
Expand Down Expand Up @@ -1911,8 +1926,8 @@ def EventMenu( self, event ):
elif command == 'pan_right': self._DoManualPan( distance, 0 )

elif command == 'remove': self._Remove()
elif command == 'slideshow': self._StartSlideshow( data )
elif command == 'slideshow_pause_play': self._PausePlaySlideshow()
elif command == 'slideshow': wx.CallAfter( self._StartSlideshow, data )
elif command == 'slideshow_pause_play': wx.CallAfter( self._PausePlaySlideshow )
elif command == 'zoom_in': self._ZoomIn()
elif command == 'zoom_out': self._ZoomOut()
elif command == 'zoom_switch': self._ZoomSwitch()
Expand Down Expand Up @@ -2003,10 +2018,10 @@ def EventShowMenu( self, event ):

copy_menu = wx.Menu()

copy_menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'copy_files' ) , 'file' )
copy_menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'copy_hash' ) , 'hash' )
copy_menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'copy_path' ) , 'path' )
copy_menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'copy_local_url' ) , 'local url' )
copy_menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'copy_files' ), 'file' )
copy_menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'copy_hash' ), 'hash' )
copy_menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'copy_path' ), 'path' )
copy_menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'copy_local_url' ), 'local url' )

share_menu.AppendMenu( CC.ID_NULL, 'copy', copy_menu )

Expand All @@ -2025,6 +2040,7 @@ def EventShowMenu( self, event ):
slideshow.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'slideshow' ), 'custom interval' )

menu.AppendMenu( CC.ID_NULL, 'start slideshow', slideshow )

if self._timer_slideshow.IsRunning(): menu.Append( ClientCaches.MENU_EVENT_ID_TO_ACTION_CACHE.GetId( 'slideshow_pause_play' ), 'stop slideshow' )

menu.AppendSeparator()
Expand All @@ -2034,7 +2050,18 @@ def EventShowMenu( self, event ):

self._menu_open = True

self.PopupMenu( menu )
if self._timer_slideshow.IsRunning():

self._timer_slideshow.Stop()

self.PopupMenu( menu )

self._timer_slideshow.Start()

else:

self.PopupMenu( menu )


self._menu_open = False

Expand Down Expand Up @@ -2279,8 +2306,6 @@ def EventMenu( self, event ):
elif command == 'manage_tags': wx.CallAfter( self._ManageTags )
elif command == 'open_externally': self._OpenExternally()
elif command == 'remove': self._Remove()
elif command == 'slideshow': self._StartSlideshow( data )
elif command == 'slideshow_pause_play': self._PausePlaySlideshow()
elif command == 'zoom_in': self._ZoomIn()
elif command == 'zoom_out': self._ZoomOut()
elif command == 'zoom_switch': self._ZoomSwitch()
Expand Down Expand Up @@ -2454,32 +2479,39 @@ def SetDisplayMedia( self, canvas_key, media ):

def TIMEREventCheckIfShouldShow( self, event ):

( mouse_x, mouse_y ) = wx.GetMousePosition()

( my_x, my_y ) = self.GetPosition()

( my_width, my_height ) = self.GetSize()

in_x = my_x <= mouse_x and mouse_x <= my_x + my_width
in_y = my_y <= mouse_y and mouse_y <= my_y + my_height

a_dialog_is_open = False

tlps = wx.GetTopLevelWindows()

for tlp in tlps:
if self._current_media is None:

if isinstance( tlp, wx.Dialog ): a_dialog_is_open = True
self.Hide()

else:

( mouse_x, mouse_y ) = wx.GetMousePosition()

( my_x, my_y ) = self.GetPosition()

( my_width, my_height ) = self.GetSize()

in_x = my_x <= mouse_x and mouse_x <= my_x + my_width
in_y = my_y <= mouse_y and mouse_y <= my_y + my_height

a_dialog_is_open = False

tlps = wx.GetTopLevelWindows()

for tlp in tlps:

if isinstance( tlp, wx.Dialog ): a_dialog_is_open = True


mime = self._current_media.GetMime()

in_position = in_x and in_y

mouse_over_important_media = ( ShouldHaveAnimationBar( self._current_media ) or mime in HC.VIDEO or mime == HC.APPLICATION_FLASH ) and self.GetParent().MouseIsOverMedia()

if in_position and not mouse_over_important_media and not a_dialog_is_open: self.Show()
else: self.Hide()


mime = self._current_media.GetMime()

in_position = in_x and in_y

mouse_over_important_media = ( ShouldHaveAnimationBar( self._current_media ) or mime in HC.VIDEO or mime == HC.APPLICATION_FLASH ) and self.GetParent().MouseIsOverMedia()

if in_position and not mouse_over_important_media and not a_dialog_is_open: self.Show()
else: self.Hide()


class FullscreenHoverFrameCommands( FullscreenHoverFrame ):
Expand Down
9 changes: 4 additions & 5 deletions include/ClientGUIDialogsManage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import HydrusTags
import ClientCaches
import ClientConstants as CC
import ClientConstantsMessages
import ClientData
import ClientGUICollapsible
import ClientGUICommon
Expand Down Expand Up @@ -873,7 +872,7 @@ def Update( self, booru ):
for ( tag_classname, namespace ) in tag_classnames_to_namespaces.items(): self._tag_classnames_to_namespaces.Append( tag_classname + ' : ' + namespace, ( tag_classname, namespace ) )



'''
class DialogManageContacts( ClientGUIDialogs.Dialog ):
def __init__( self, parent ):
Expand Down Expand Up @@ -1410,7 +1409,7 @@ def Update( self, contact ):
self._public_key.SetValue( public_key )

'''
class DialogManageExportFolders( ClientGUIDialogs.Dialog ):

def __init__( self, parent ):
Expand Down Expand Up @@ -7943,7 +7942,7 @@ def EventCopyTags( self, event ):

tags = set( current_tags_to_count.keys() ).union( pending_tags_to_count.keys() )

text = yaml.safe_dump( tags )
text = os.linesep.join( tags )

HydrusGlobals.pubsub.pub( 'clipboard', 'text', text )

Expand Down Expand Up @@ -7974,7 +7973,7 @@ def EventPasteTags( self, event ):

try:

tags = yaml.safe_load( text )
tags = text.split( os.linesep )

for tag in tags: self._AddTag( tag, only_add = True )

Expand Down
Loading

0 comments on commit 158a6f8

Please sign in to comment.