Allow copying bitmap of PSD
This commit is contained in:
parent
56aae029d8
commit
a6bcd114b8
|
@ -4570,7 +4570,7 @@ class CanvasMediaListBrowser( CanvasMediaListNavigable ):
|
|||
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 )
|
||||
|
||||
|
||||
if self._current_media.GetMime() in HC.IMAGES:
|
||||
if self._current_media.IsImage():
|
||||
|
||||
ClientGUIMenus.AppendMenuItem( copy_menu, 'bitmap', 'Copy this file to your clipboard as a bitmap.', self._CopyBMPToClipboard )
|
||||
|
||||
|
|
|
@ -312,9 +312,9 @@ def GetShowAction( media: ClientMedia.MediaSingleton, canvas_type: int ):
|
|||
|
||||
action = HG.client_controller.new_options.GetMediaShowAction( mime )
|
||||
|
||||
if mime == HC.APPLICATION_PSD and not HydrusPSDHandling.PSD_TOOLS_OK and action[0] == CC.MEDIA_VIEWER_ACTION_SHOW_WITH_NATIVE:
|
||||
if mime == HC.APPLICATION_PSD and action[0] == CC.MEDIA_VIEWER_ACTION_SHOW_WITH_NATIVE and not HydrusPSDHandling.PSD_TOOLS_OK :
|
||||
|
||||
# fall back to open externally button when psd_tools not available
|
||||
# fallback to open externally button when psd_tools not available
|
||||
action = ( CC.MEDIA_VIEWER_ACTION_SHOW_OPEN_EXTERNALLY_BUTTON, start_paused, start_with_embed )
|
||||
|
||||
return action
|
||||
|
|
|
@ -178,7 +178,7 @@ class MediaPanel( CAC.ApplicationCommandProcessorMixin, ClientMedia.ListeningMed
|
|||
|
||||
media = self._GetFocusSingleton()
|
||||
|
||||
if media.GetMime() in HC.IMAGES:
|
||||
if media.IsImage():
|
||||
|
||||
HG.client_controller.pub( 'clipboard', 'bmp', ( media, resolution ) )
|
||||
|
||||
|
@ -4297,7 +4297,7 @@ class MediaPanelThumbnails( MediaPanel ):
|
|||
|
||||
if focused_is_local:
|
||||
|
||||
if self._focused_media.GetMime() in HC.IMAGES:
|
||||
if self._focused_media.IsImage():
|
||||
|
||||
ClientGUIMenus.AppendMenuItem( copy_menu, 'bitmap', 'Copy this file to your clipboard as a bitmap.', self._CopyBMPToClipboard )
|
||||
|
||||
|
|
|
@ -19,6 +19,10 @@ except:
|
|||
|
||||
|
||||
def MergedPILImageFromPSD(path: str) -> PILImage:
|
||||
|
||||
if not PSD_TOOLS_OK:
|
||||
|
||||
raise Exception( 'psd_tools unavailable' )
|
||||
|
||||
psd = PSDImage.open(path)
|
||||
|
||||
|
@ -39,10 +43,6 @@ def MergedPILImageFromPSD(path: str) -> PILImage:
|
|||
|
||||
|
||||
def GenerateThumbnailBytesFromPSDPath(path: str, target_resolution: typing.Tuple[int, int], clip_rect = None) -> bytes:
|
||||
|
||||
if not PSD_TOOLS_OK:
|
||||
|
||||
raise Exception( 'psd_tools unavailable' )
|
||||
|
||||
pil_image = MergedPILImageFromPSD(path)
|
||||
|
||||
|
|
Loading…
Reference in New Issue