pe cocoa: adapted to the latest structural updates.

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%404
This commit is contained in:
hsoft 2009-06-06 12:11:11 +00:00
parent a17ab6136c
commit dfbbce73d6
9 changed files with 55 additions and 1526 deletions

View File

@ -6,14 +6,9 @@
@interface ResultWindow : ResultWindowBase
{
IBOutlet NSPopUpButton *actionMenu;
IBOutlet NSView *actionMenuView;
IBOutlet id app;
IBOutlet NSMenu *columnsMenu;
IBOutlet NSView *deltaSwitchView;
IBOutlet NSSearchField *filterField;
IBOutlet NSView *filterFieldView;
IBOutlet NSSegmentedControl *pmSwitch;
IBOutlet NSView *pmSwitchView;
IBOutlet NSWindow *preferencesPanel;
IBOutlet NSTextField *stats;

View File

@ -6,15 +6,6 @@
#import "AppDelegate.h"
#import "Consts.h"
static NSString* tbbDirectories = @"tbbDirectories";
static NSString* tbbDetails = @"tbbDetail";
static NSString* tbbPreferences = @"tbbPreferences";
static NSString* tbbPowerMarker = @"tbbPowerMarker";
static NSString* tbbScan = @"tbbScan";
static NSString* tbbAction = @"tbbAction";
static NSString* tbbDelta = @"tbbDelta";
static NSString* tbbFilter = @"tbbFilter";
@implementation ResultWindow
/* Override */
- (void)awakeFromNib
@ -39,12 +30,18 @@ static NSString* tbbFilter = @"tbbFilter";
NSToolbar *t = [[[NSToolbar alloc] initWithIdentifier:@"ResultWindowToolbar"] autorelease];
[t setAllowsUserCustomization:YES];
[t setAutosavesConfiguration:NO];
[t setAutosavesConfiguration:YES];
[t setDisplayMode:NSToolbarDisplayModeIconAndLabel];
[t setDelegate:self];
[[self window] setToolbar:t];
}
/* Overrides */
- (NSString *)logoImageName
{
return @"dgpe_logo32";
}
/* Actions */
- (IBAction)changePowerMarker:(id)sender
@ -465,105 +462,4 @@ static NSString* tbbFilter = @"tbbFilter";
[self refreshStats];
}
/* Toolbar */
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
{
NSToolbarItem *tbi = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier] autorelease];
if (itemIdentifier == tbbDirectories)
{
[tbi setLabel: @"Directories"];
[tbi setToolTip: @"Show/Hide the directories panel."];
[tbi setImage: [NSImage imageNamed: @"folder32"]];
[tbi setTarget: self];
[tbi setAction: @selector(toggleDirectories:)];
}
else if (itemIdentifier == tbbDetails)
{
[tbi setLabel: @"Details"];
[tbi setToolTip: @"Show/Hide the details panel."];
[tbi setImage: [NSImage imageNamed: @"details32"]];
[tbi setTarget: self];
[tbi setAction: @selector(toggleDetailsPanel:)];
}
else if (itemIdentifier == tbbPreferences)
{
[tbi setLabel: @"Preferences"];
[tbi setToolTip: @"Show the preferences panel."];
[tbi setImage: [NSImage imageNamed: @"preferences32"]];
[tbi setTarget: self];
[tbi setAction: @selector(showPreferencesPanel:)];
}
else if (itemIdentifier == tbbPowerMarker)
{
[tbi setLabel: @"Power Marker"];
[tbi setToolTip: @"When enabled, only the duplicates are shown, not the references."];
[tbi setView:pmSwitchView];
[tbi setMinSize:[pmSwitchView frame].size];
[tbi setMaxSize:[pmSwitchView frame].size];
}
else if (itemIdentifier == tbbScan)
{
[tbi setLabel: @"Start Scanning"];
[tbi setToolTip: @"Start scanning for duplicates in the selected diectories."];
[tbi setImage: [NSImage imageNamed: @"dgpe_logo_32"]];
[tbi setTarget: self];
[tbi setAction: @selector(startDuplicateScan:)];
}
else if (itemIdentifier == tbbAction)
{
[tbi setLabel: @"Action"];
[tbi setView:actionMenuView];
[tbi setMinSize:[actionMenuView frame].size];
[tbi setMaxSize:[actionMenuView frame].size];
}
else if (itemIdentifier == tbbDelta)
{
[tbi setLabel: @"Delta Values"];
[tbi setToolTip: @"When enabled, this option makes dupeGuru display, where applicable, delta values instead of absolute values."];
[tbi setView:deltaSwitchView];
[tbi setMinSize:[deltaSwitchView frame].size];
[tbi setMaxSize:[deltaSwitchView frame].size];
}
else if (itemIdentifier == tbbFilter)
{
[tbi setLabel: @"Filter"];
[tbi setToolTip: @"Filters the results using regular expression."];
[tbi setView:filterFieldView];
[tbi setMinSize:[filterFieldView frame].size];
[tbi setMaxSize:NSMakeSize(1000, [filterFieldView frame].size.height)];
}
[tbi setPaletteLabel: [tbi label]];
return tbi;
}
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
{
return [NSArray arrayWithObjects:
tbbDirectories,
tbbDetails,
tbbPreferences,
tbbPowerMarker,
tbbScan,
tbbAction,
tbbDelta,
tbbFilter,
NSToolbarSeparatorItemIdentifier,
NSToolbarSpaceItemIdentifier,
NSToolbarFlexibleSpaceItemIdentifier,
nil];
}
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
{
return [NSArray arrayWithObjects:
tbbScan,
tbbAction,
tbbDirectories,
tbbDetails,
tbbPowerMarker,
tbbDelta,
tbbFilter,
nil];
}
@end

File diff suppressed because it is too large Load Diff

View File

@ -323,7 +323,6 @@
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "dupeguru" */;
buildPhases = (
CEABE1A60FCC00E3005F8031 /* ShellScript */,
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
@ -383,22 +382,6 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
CEABE1A60FCC00E3005F8031 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd help\npython gen.py\n/Developer/Applications/Utilities/Help\\ Indexer.app/Contents/MacOS/Help\\ Indexer dupeguru_pe_help";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;

14
pe/cocoa/gen.py Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env python
import os
print "Generating help"
os.chdir('help')
os.system('python -u gen.py')
os.system('/Developer/Applications/Utilities/Help\\ Indexer.app/Contents/MacOS/Help\\ Indexer dupeguru_pe_help')
os.chdir('..')
print "Generating py plugin"
os.chdir('py')
os.system('python -u gen.py')
os.chdir('..')

View File

@ -1,2 +0,0 @@
#!/bin/bash
python setup.py py2app

View File

@ -1,13 +1,15 @@
#!/usr/bin/env python
import objc
from AppKit import *
from PyObjCTools import NibClassBuilder
NibClassBuilder.extractClasses("MainMenu", bundle=NSBundle.mainBundle())
from dupeguru import app_pe_cocoa, scanner
class PyApp(NibClassBuilder.AutoBaseClass):
# Fix py2app imports which chokes on relative imports
from dupeguru import app, app_cocoa, data, directories, engine, export, ignore, results, scanner
from dupeguru.picture import block, cache, matchbase
from hsfs import auto, manual, stats, tree, utils
class PyApp(NSObject):
pass #fake class
class PyDupeGuru(PyApp):

18
pe/cocoa/py/gen.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python
import os
import os.path as op
import shutil
from hsutil.build import print_and_do
os.chdir('dupeguru')
print_and_do('python gen.py')
os.chdir('..')
if op.exists('build'):
shutil.rmtree('build')
if op.exists('dist'):
shutil.rmtree('dist')
print_and_do('python -u setup.py py2app')

View File

@ -1,11 +1,14 @@
#!/usr/bin/env python
from setuptools import setup
from hs.build import set_buildenv
from distutils.core import setup
import py2app
set_buildenv()
from hsutil.build import move_testdata_out, put_testdata_back
setup(
plugin=['dg_cocoa.py'],
setup_requires=['py2app'],
)
move_log = move_testdata_out()
try:
setup(
plugin = ['dg_cocoa.py'],
)
finally:
put_testdata_back(move_log)