Clean up ClientMacIntegration.py

This commit is contained in:
Paul Friederichsen 2024-02-24 08:12:59 -06:00
parent b039f4106f
commit 2d44082128
1 changed files with 6 additions and 12 deletions

View File

@ -1,9 +1,3 @@
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
from hydrus.client import ClientGlobals as CG
import objc
from Foundation import NSObject, NSURL
from Quartz import QLPreviewPanel
@ -14,21 +8,21 @@ class HydrusQLDataSource(NSObject, protocols=[QLPreviewPanelDataSource]):
def initWithCurrentlyLooking_(self, currently_showing):
self = objc.super(HydrusQLDataSource, self).init()
if self is None: return None
self.currently_showing = currently_showing
return self
def numberOfPreviewItemsInPreviewPanel_(self, panel):
return 1 if self.currently_showing is not None else 0
def previewPanel_previewItemAtIndex_(self, panel, index):
return NSURL.fileURLWithPath_(self.currently_showing) # or whatever
def show_quicklook_for_path( path ):
hydrus_data_source = HydrusQLDataSource.alloc().initWithCurrentlyLooking_(path)
panel = QLPreviewPanel.sharedPreviewPanel()
panel.setDataSource_(hydrus_data_source)
panel.makeKeyAndOrderFront_(None)