Clean up ClientMacIntegration.py
This commit is contained in:
parent
b039f4106f
commit
2d44082128
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue